some more changes in savesettings for gotthard and loadsettings

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@259 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
l_maliakal_d 2012-09-18 15:58:16 +00:00
parent 8ed87df48f
commit 7b058c55cf
2 changed files with 41 additions and 39 deletions

View File

@ -5107,12 +5107,12 @@ int slsDetector::loadSettingsFile(string fname, int imod) {
ostfn << ".sn" << setfill('0') << setw(3) << hex << getId(MODULE_SERIAL_NUMBER, im);
fn=ostfn.str();
}
//settings is saved in myMod.reg for gotthard
if(thisDetector->myDetectorType==GOTTHARD)
myMod->reg=thisDetector->currentSettings;
myMod=readSettingsFile(fn, thisDetector->myDetectorType);
if (myMod) {
myMod->module=im;
//settings is saved in myMod.reg for gotthard
if(thisDetector->myDetectorType==GOTTHARD)
myMod->reg=thisDetector->currentSettings;
setModule(*myMod);
deleteModule(myMod);
} else

View File

@ -280,45 +280,47 @@ int energyConversion::writeSettingsFile(string fname, detectorType myDetectorTyp
int iv, ichan, ichip;
int iv1, idac;
int nb;
outfile.open(fname.c_str(), ios_base::out);
outfile.open(fname.c_str(), ios_base::out);
if (outfile.is_open()) {
for (idac=0; idac<mod.ndac; idac++) {
iv=(int)mod.dacs[idac];
outfile << names[idac] << " " << iv << std::endl;
}
for (ichip=0; ichip<mod.nchip; ichip++) {
iv1=mod.chipregs[ichip]&1;
outfile << names[idac] << " " << iv1 << std::endl;
for (ichan=0; ichan<nch; ichan++) {
iv=mod.chanregs[ichip*nch+ichan];
iv1= (iv&TRIMBITMASK);
outfile <<iv1 << " ";
nb=9;
iv1=((iv&(1<<nb))>>nb);
outfile << iv1 << " ";
nb=8;
iv1=((iv&(1<<nb))>>nb);
outfile << iv1 << " ";
nb=7;
iv1=((iv&(1<<nb))>>nb);
outfile <<iv1 << " ";
nb=10;
iv1=((iv&(1<<nb))>>nb);
outfile << iv1 << " ";
nb=11;
iv1= ((iv&0xfffff800)>>nb);
outfile << iv1 << std::endl;
}
}
outfile.close();
return OK;
} else {
std::cout<< "could not open SETTINGS file " << fname << std::endl;
return FAIL;
if (outfile.is_open()) {
for (idac=0; idac<mod.ndac; idac++) {
iv=(int)mod.dacs[idac];
outfile << names[idac] << " " << iv << std::endl;
}
if(myDetectorType!=GOTTHARD){
for (ichip=0; ichip<mod.nchip; ichip++) {
iv1=mod.chipregs[ichip]&1;
outfile << names[idac] << " " << iv1 << std::endl;
for (ichan=0; ichan<nch; ichan++) {
iv=mod.chanregs[ichip*nch+ichan];
iv1= (iv&TRIMBITMASK);
outfile <<iv1 << " ";
nb=9;
iv1=((iv&(1<<nb))>>nb);
outfile << iv1 << " ";
nb=8;
iv1=((iv&(1<<nb))>>nb);
outfile << iv1 << " ";
nb=7;
iv1=((iv&(1<<nb))>>nb);
outfile <<iv1 << " ";
nb=10;
iv1=((iv&(1<<nb))>>nb);
outfile << iv1 << " ";
nb=11;
iv1= ((iv&0xfffff800)>>nb);
outfile << iv1 << std::endl;
}
}
}
outfile.close();
return OK;
} else {
std::cout<< "could not open SETTINGS file " << fname << std::endl;
return FAIL;
}
};