Gotthard class implemented

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@34 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
bergamaschi
2011-10-13 11:26:28 +00:00
parent 3367bb3026
commit ab27ab1c5d
36 changed files with 17857 additions and 161 deletions

View File

@ -6,10 +6,6 @@
//using namespace std;
string mythenDetector::executeLine(int narg, char *args[], int action) {
@ -99,8 +95,8 @@ string mythenDetector::executeLine(int narg, char *args[], int action) {
std::cout<< helpLine(action);
return string("more questions? Refere to software documentation!");
}
if (var=="hostname") {
if (var=="hostname") {
if (action==PUT_ACTION) {
setTCPSocket(args[1]);
}
@ -270,9 +266,9 @@ string mythenDetector::executeLine(int narg, char *args[], int action) {
if (var=="trimdir") {
if (action==PUT_ACTION) {
sval=string(args[1]);
setTrimDir(sval);
setSettingsDir(sval);
}
return string(getTrimDir());
return string(getSettingsDir());
} else if (var=="caldir") {
if (action==PUT_ACTION) {
sval=string(args[1]);
@ -730,9 +726,11 @@ string mythenDetector::executeLine(int narg, char *args[], int action) {
sett=FAST;
else if (sval=="highgain")
sett=HIGHGAIN;
//setSettings(sett);
else {
sprintf(answer,"%s not defined for this detector",sval.c_str());
return string(answer);
}
}
//switch (setSettings( GET_SETTINGS)) {
switch (setSettings(sett)) {
case STANDARD:
return string("standard");
@ -740,6 +738,14 @@ string mythenDetector::executeLine(int narg, char *args[], int action) {
return string("fast");
case HIGHGAIN:
return string("highgain");
case DYNAMICGAIN:
return string("dynamicgain");
case GAIN1:
return string("gain1");
case GAIN2:
return string("gain2");
case GAIN3:
return string("gain3");
default:
return string("undefined");
}
@ -981,14 +987,14 @@ string mythenDetector::executeLine(int narg, char *args[], int action) {
if (action==GET_ACTION) {
ostfn << sval << ".sn" << setfill('0') << setw(3) << hex << getId(MODULE_SERIAL_NUMBER, im);
if ((myMod=getModule(im))) {
writeTrimFile(ostfn.str(),*myMod);
writeSettingsFile(ostfn.str(),*myMod);
deleteModule(myMod);
}
} else if (action==PUT_ACTION) {
ostfn << sval ;
if (sval.find('.',sval.length()-7)<string::npos)
ostfn << ".sn" << setfill('0') << setw(3) << hex << getId(MODULE_SERIAL_NUMBER, im);
myMod=readTrimFile(ostfn.str());
myMod=readSettingsFile(ostfn.str());
if (myMod) {
myMod->module=im;
setModule(*myMod);
@ -998,7 +1004,7 @@ string mythenDetector::executeLine(int narg, char *args[], int action) {
}
}
std::cout<< "Returning trimfile " << std::endl;
return string(getTrimFile());
return string(getSettingsFile());
} else if (var.find("trim")==0) {
if (action==GET_ACTION) {
trimMode mode=NOISE_TRIMMING;
@ -1040,7 +1046,7 @@ string mythenDetector::executeLine(int narg, char *args[], int action) {
//create file names
ostfn << sval << ".sn" << setfill('0') << setw(3) << hex << getId(MODULE_SERIAL_NUMBER, im);
if ((myMod=getModule(im))) {
writeTrimFile(ostfn.str(),*myMod);
writeSettingsFile(ostfn.str(),*myMod);
deleteModule(myMod);
}
}
@ -1549,29 +1555,6 @@ string mythenDetector::helpLine( int action) {
/* detector configuration (no communication to server) */
/*
@ -1921,11 +1904,10 @@ int mythenDetector::retrieveDetectorSetup(string fname1, int level){
/* I/O */
sls_detector_module* mythenDetector::readTrimFile(string fname, sls_detector_module *myMod){
sls_detector_module* mythenDetector::readSettingsFile(string fname, sls_detector_module *myMod){
int nflag=0;
@ -2056,7 +2038,7 @@ int mythenDetector::retrieveDetectorSetup(string fname1, int level){
std::cout<< "read " << ichan*ichip << " channels" <<std::endl;
#endif
infile.close();
strcpy(thisDetector->trimFile,fname.c_str());
strcpy(thisDetector->settingsFile,fname.c_str());
return myMod;
} else {
std::cout<< "could not open trim file " << myfname << std::endl;
@ -2068,7 +2050,7 @@ int mythenDetector::retrieveDetectorSetup(string fname1, int level){
};
int mythenDetector::writeTrimFile(string fname, sls_detector_module mod){
int mythenDetector::writeSettingsFile(string fname, sls_detector_module mod){
ofstream outfile;
string names[]={"Vtrim", "Vthresh", "Rgsh1", "Rgsh2", "Rgpr", "Vcal", "outBuffEnable"};
@ -2119,9 +2101,9 @@ int mythenDetector::writeTrimFile(string fname, sls_detector_module mod){
int mythenDetector::writeTrimFile(string fname, int imod){
int mythenDetector::writeSettingsFile(string fname, int imod){
return writeTrimFile(fname,detectorModules[imod]);
return writeSettingsFile(fname,detectorModules[imod]);
};

View File

@ -35,7 +35,8 @@ class mythenDetector : public slsDetector{
// ~slsDetector(){while(dataQueue.size()>0){}};
/** destructor */
virtual ~mythenDetector(){};
/**
executes a set of string arguments according to a given format. It is used to read/write configuration file, dump and retrieve detector settings and for the command line interface command parsing
\param narg number of arguments
@ -81,35 +82,33 @@ enum {GET_ACTION, PUT_ACTION, READOUT_ACTION};
*/
int retrieveDetectorSetup(string const fname, int level=0);
/**
reads a trim file
reads a trim/settings file
\param fname name of the file to be read
\param myMod pointer to the module structure which has to be set. <BR> If it is NULL a new module structure will be created
\returns the pointer to myMod or NULL if reading the file failed
*/
sls_detector_module* readTrimFile(string fname, sls_detector_module* myMod=NULL);
sls_detector_module* readSettingsFile(string fname, sls_detector_module* myMod=NULL);
/**
writes a trim file
writes a trim/settings file
\param fname name of the file to be written
\param mod module structure which has to be written to file
\returns OK or FAIL if the file could not be written
\sa ::sls_detector_module
*/
int writeTrimFile(string fname, sls_detector_module mod);
int writeSettingsFile(string fname, sls_detector_module mod);
/**
writes a trim file for module number imod - the values will be read from the current detector structure
writes a trim/settings file for module number imod - the values will be read from the current detector structure
\param fname name of the file to be written
\param imod module number
\returns OK or FAIL if the file could not be written
\sa ::sls_detector_module sharedSlsDetector
*/
int writeTrimFile(string fname, int imod);
int writeSettingsFile(string fname, int imod);
/**
writes a data file