mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-21 11:20:04 +02:00
added load image, changed key find, changed get temp to getADC
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@123 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
parent
44eea027f3
commit
c6f61d3663
@ -1764,7 +1764,6 @@ int slsDetector::readRegister(int addr){
|
||||
PREAMP,
|
||||
TEMPERATURE,
|
||||
HUMIDITY,
|
||||
DETECTOR_BIAS
|
||||
}{};
|
||||
*/
|
||||
|
||||
@ -4544,7 +4543,52 @@ int slsDetector:: writeAngularConversion(ofstream &ofs) {
|
||||
}
|
||||
|
||||
|
||||
int slsDetector::loadImageToDetector(int index,string const fname){
|
||||
int retval;
|
||||
int fnum=F_LOAD_IMAGE;
|
||||
int ret=FAIL;
|
||||
char mess[100];
|
||||
short int arg[1280];
|
||||
|
||||
#ifdef VERBOSE
|
||||
std::cout<< std::endl<< "Loading ";
|
||||
if(!index)
|
||||
std::cout<<"Dark";
|
||||
else
|
||||
std::cout<<"Gain";
|
||||
std::cout<<" image from file " << fname << std::endl;
|
||||
#endif
|
||||
|
||||
if(readDataFile(fname,arg)){
|
||||
std::cout<< "Could not open file "<< fname << std::endl;
|
||||
return -1;
|
||||
}
|
||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||
if (controlSocket) {
|
||||
if (controlSocket->Connect()>=0) {
|
||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||
controlSocket->SendDataOnly(&index,sizeof(index));
|
||||
controlSocket->SendDataOnly(arg,sizeof(arg));
|
||||
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
|
||||
if (ret!=FAIL)
|
||||
controlSocket->ReceiveDataOnly(&retval,sizeof(retval));
|
||||
else {
|
||||
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
|
||||
std::cout<< "Detector returned error: " << mess << std::endl;
|
||||
}
|
||||
controlSocket->Disconnect();
|
||||
if (ret==FORCE_UPDATE)
|
||||
updateDetector();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if (ret==FAIL) {
|
||||
std::cout<< "failed " << std::endl;
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -109,6 +109,14 @@ slsDetectorCommand::slsDetectorCommand() {
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdThreaded;
|
||||
i++;
|
||||
|
||||
descrToFuncMap[i].m_pFuncName="darkimage"; //
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdImage;
|
||||
i++;
|
||||
|
||||
descrToFuncMap[i].m_pFuncName="gainimage"; //
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdImage;
|
||||
i++;
|
||||
|
||||
/* trim/cal directories */
|
||||
descrToFuncMap[i].m_pFuncName="trimdir"; //OK
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdSettingsDir;
|
||||
@ -438,12 +446,14 @@ slsDetectorCommand::slsDetectorCommand() {
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdDAC;
|
||||
i++;
|
||||
|
||||
/* r/w timers */
|
||||
|
||||
descrToFuncMap[i].m_pFuncName="temp_adc"; //
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdDAC;
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdADC;
|
||||
i++;
|
||||
|
||||
descrToFuncMap[i].m_pFuncName="temp_fpga"; //
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdDAC;
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdADC;
|
||||
i++;
|
||||
|
||||
/* r/w timers */
|
||||
@ -769,8 +779,10 @@ string slsDetectorCommand::executeLine(int narg, char *args[], int action) {
|
||||
/* otherwise one could try if truncated key is unique */
|
||||
|
||||
|
||||
size_t p=(descrToFuncMap[i].m_pFuncName).find(key);
|
||||
if (p==0) {
|
||||
// size_t p=(descrToFuncMap[i].m_pFuncName).find();
|
||||
// if (p==0) {
|
||||
|
||||
if(key==descrToFuncMap[i].m_pFuncName){
|
||||
#ifdef VERBOSE
|
||||
std::cout<<i << " command="<< descrToFuncMap[i].m_pFuncName<<" key="<<key <<std::endl;
|
||||
#endif
|
||||
@ -1731,6 +1743,42 @@ string slsDetectorCommand::helpThreaded(int narg, char *args[], int action){
|
||||
|
||||
|
||||
|
||||
string slsDetectorCommand::cmdImage(int narg, char *args[], int action){
|
||||
string sval;
|
||||
int retval;
|
||||
if (action==HELP_ACTION)
|
||||
return helpImage(narg,args,HELP_ACTION);
|
||||
else if (action==GET_ACTION)
|
||||
return string("Cannot get");
|
||||
|
||||
sval=string(args[1]);
|
||||
setOnline(ONLINE_FLAG);
|
||||
|
||||
if (string(args[0])==string("darkimage"))
|
||||
retval=loadImageToDetector(DARK_IMAGE,sval);
|
||||
else if (string(args[0])==string("gainimage"))
|
||||
retval=loadImageToDetector(GAIN_IMAGE,sval);
|
||||
|
||||
if(!retval)
|
||||
return string("Image loaded succesfully");
|
||||
else
|
||||
return string("Image NOT loaded");
|
||||
}
|
||||
|
||||
|
||||
string slsDetectorCommand::helpImage(int narg, char *args[], int action){
|
||||
if (action==PUT_ACTION || action==HELP_ACTION){
|
||||
if (string(args[0])==string("darkimage"))
|
||||
return string("darkimage f \t loads the image to detector from file f\n");
|
||||
else
|
||||
return string("gainimage f \t loads the image to detector from file f\n");
|
||||
}
|
||||
else
|
||||
return string("Cannot get");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
string slsDetectorCommand::cmdPositions(int narg, char *args[], int action){
|
||||
int ival;
|
||||
@ -2552,159 +2600,194 @@ string slsDetectorCommand::helpRegister(int narg, char *args[], int action) {
|
||||
|
||||
string slsDetectorCommand::cmdDAC(int narg, char *args[], int action) {
|
||||
|
||||
if (action==HELP_ACTION)
|
||||
return helpRegister(narg, args, action);
|
||||
|
||||
dacIndex dac;
|
||||
float val=-1;
|
||||
char answer[1000];
|
||||
if (action==HELP_ACTION)
|
||||
return helpDAC(narg, args, action);
|
||||
|
||||
if (cmd=="vthreshold")
|
||||
dac=THRESHOLD;
|
||||
else if (cmd=="vcalibration")
|
||||
dac=CALIBRATION_PULSE;
|
||||
else if (cmd=="vtrimbit")
|
||||
dac=TRIMBIT_SIZE;
|
||||
else if (cmd=="vpreamp")
|
||||
dac=PREAMP;
|
||||
else if (cmd=="vshaper1")
|
||||
dac=SHAPER1;
|
||||
else if (cmd=="vshaper2")
|
||||
dac=SHAPER2;
|
||||
else if (cmd=="vhighvoltage")
|
||||
dac=HV_POT;
|
||||
else if (cmd=="vapower")
|
||||
dac=VA_POT;
|
||||
else if (cmd=="vddpower")
|
||||
dac=VDD_POT;
|
||||
else if (cmd=="vshpower")
|
||||
dac=VSH_POT;
|
||||
else if (cmd=="viopower")
|
||||
dac=VIO_POT;
|
||||
else if (cmd=="vrefds")
|
||||
dac=G_VREF_DS;
|
||||
else if (cmd=="vcascn_pb")
|
||||
dac=G_VCASCN_PB;
|
||||
else if (cmd=="vcascp_pb")
|
||||
dac=G_VCASCP_PB;
|
||||
else if (cmd=="vout_cm")
|
||||
dac=G_VOUT_CM;
|
||||
else if (cmd=="vcasc_out")
|
||||
dac=G_VCASC_OUT;
|
||||
else if (cmd=="vin_cm")
|
||||
dac=G_VIN_CM;
|
||||
else if (cmd=="vref_comp")
|
||||
dac=G_VREF_COMP;
|
||||
else if (cmd=="ib_test_c")
|
||||
dac=G_IB_TESTC;
|
||||
else if (cmd=="temp_adc") {
|
||||
dac=TEMPERATURE_ADC;
|
||||
if (action==PUT_ACTION)
|
||||
return string("cannot set ")+cmd;
|
||||
} else if (cmd=="temp_fpga") {
|
||||
dac=TEMPERATURE_FPGA;
|
||||
if (action==PUT_ACTION)
|
||||
return string("cannot set ")+cmd;
|
||||
} else
|
||||
return string("cannot decode dac ")+cmd;
|
||||
dacIndex dac;
|
||||
float val=-1;
|
||||
char answer[1000];
|
||||
|
||||
if (action==PUT_ACTION) {
|
||||
if (sscanf(args[1],"%f", &val))
|
||||
;
|
||||
else
|
||||
return string("cannot scan DAC value ")+string(args[1]);
|
||||
}
|
||||
|
||||
setOnline(ONLINE_FLAG);
|
||||
if (cmd=="vthreshold")
|
||||
dac=THRESHOLD;
|
||||
else if (cmd=="vcalibration")
|
||||
dac=CALIBRATION_PULSE;
|
||||
else if (cmd=="vtrimbit")
|
||||
dac=TRIMBIT_SIZE;
|
||||
else if (cmd=="vpreamp")
|
||||
dac=PREAMP;
|
||||
else if (cmd=="vshaper1")
|
||||
dac=SHAPER1;
|
||||
else if (cmd=="vshaper2")
|
||||
dac=SHAPER2;
|
||||
else if (cmd=="vhighvoltage")
|
||||
dac=HV_POT;
|
||||
else if (cmd=="vapower")
|
||||
dac=VA_POT;
|
||||
else if (cmd=="vddpower")
|
||||
dac=VDD_POT;
|
||||
else if (cmd=="vshpower")
|
||||
dac=VSH_POT;
|
||||
else if (cmd=="viopower")
|
||||
dac=VIO_POT;
|
||||
else if (cmd=="vrefds")
|
||||
dac=G_VREF_DS;
|
||||
else if (cmd=="vcascn_pb")
|
||||
dac=G_VCASCN_PB;
|
||||
else if (cmd=="vcascp_pb")
|
||||
dac=G_VCASCP_PB;
|
||||
else if (cmd=="vout_cm")
|
||||
dac=G_VOUT_CM;
|
||||
else if (cmd=="vcasc_out")
|
||||
dac=G_VCASC_OUT;
|
||||
else if (cmd=="vin_cm")
|
||||
dac=G_VIN_CM;
|
||||
else if (cmd=="vref_comp")
|
||||
dac=G_VREF_COMP;
|
||||
else if (cmd=="ib_test_c")
|
||||
dac=G_IB_TESTC;
|
||||
else if (cmd=="temp_adc") {
|
||||
dac=TEMPERATURE_ADC;
|
||||
if (action==PUT_ACTION)
|
||||
return string("cannot set ")+cmd;
|
||||
} else if (cmd=="temp_fpga") {
|
||||
dac=TEMPERATURE_FPGA;
|
||||
if (action==PUT_ACTION)
|
||||
return string("cannot set ")+cmd;
|
||||
} else
|
||||
return string("cannot decode dac ")+cmd;
|
||||
|
||||
sprintf(answer,"%f",setDAC(val,dac));
|
||||
if (action==PUT_ACTION) {
|
||||
if (sscanf(args[1],"%f", &val))
|
||||
;
|
||||
else
|
||||
return string("cannot scan DAC value ")+string(args[1]);
|
||||
}
|
||||
|
||||
setOnline(ONLINE_FLAG);
|
||||
|
||||
sprintf(answer,"%f",setDAC(val,dac));
|
||||
return string(answer);
|
||||
|
||||
}
|
||||
|
||||
|
||||
string slsDetectorCommand::helpDAC(int narg, char *args[], int action) {
|
||||
|
||||
ostringstream os;
|
||||
if (action==PUT_ACTION || action==HELP_ACTION) {
|
||||
os << "vthreshold dacu\t sets the detector threshold in dac units (0-1024). The energy is approx 800-15*keV" << std::endl;
|
||||
os << std::endl;
|
||||
|
||||
os << "vcalibration " << "dacu\t sets the calibration pulse amplitude in dac units (0-1024)." << std::endl;
|
||||
os << std::endl;
|
||||
os << "vtrimbit " << "dacu\t sets the trimbit amplitude in dac units (0-1024)." << std::endl;
|
||||
os << std::endl;
|
||||
os << "vpreamp " << "dacu\t sets the preamp feedback voltage in dac units (0-1024)." << std::endl;
|
||||
os << std::endl;
|
||||
os << "vshaper1 " << "dacu\t sets the shaper1 feedback voltage in dac units (0-1024)." << std::endl;
|
||||
os << std::endl;
|
||||
os << "vshaper2 " << "dacu\t sets the shaper2 feedback voltage in dac units (0-1024)." << std::endl;
|
||||
os << std::endl;
|
||||
os << "vhighvoltage " << "dacu\t CHIPTEST BOARD ONLY - sets the detector HV in dac units (0-1024)." << std::endl;
|
||||
os << std::endl;
|
||||
os << "vapower " << "dacu\t CHIPTEST BOARD ONLY - sets the analog power supply in dac units (0-1024)." << std::endl;
|
||||
os << std::endl;
|
||||
os << "vddpower " << "dacu\t CHIPTEST BOARD ONLY - sets the digital power supply in dac units (0-1024)." << std::endl;
|
||||
os << std::endl;
|
||||
os << "vshpower " << "dacu\t CHIPTEST BOARD ONLY - sets the comparator power supply in dac units (0-1024)." << std::endl;
|
||||
os << std::endl;
|
||||
os << "viopower " << "dacu\t CHIPTEST BOARD ONLY - sets the FPGA I/O power supply in dac units (0-1024)." << std::endl;
|
||||
|
||||
|
||||
|
||||
os << "vrefds " << "dacu\t sets vrefds" << std::endl;
|
||||
os << "vcascn_pb " << "dacu\t sets vcascn_pb" << std::endl;
|
||||
os << "vcascp_pb " << "dacu\t sets vcascp_pb" << std::endl;
|
||||
os << "vout_cm " << "dacu\t sets vout_cm" << std::endl;
|
||||
os << "vin_cm " << "dacu\t sets vin_cm" << std::endl;
|
||||
os << "vcasc_out " << "dacu\t sets vcasc_out" << std::endl;
|
||||
os << "vref_comp " << "dacu\t sets vref_comp" << std::endl;
|
||||
os << "ib_test_c " << "dacu\t sets ib_test_c" << std::endl;
|
||||
|
||||
}
|
||||
if (action==GET_ACTION || action==HELP_ACTION) {
|
||||
|
||||
os << "vthreshold \t Gets the detector threshold in dac units (0-1024). The energy is approx 800-15*keV" << std::endl;
|
||||
os << std::endl;
|
||||
|
||||
os << "vcalibration " << "dacu\t gets the calibration pulse amplitude in dac units (0-1024)." << std::endl;
|
||||
os << std::endl;
|
||||
os << "vtrimbit " << "dacu\t gets the trimbit amplitude in dac units (0-1024)." << std::endl;
|
||||
os << std::endl;
|
||||
os << "vpreamp " << "dacu\t gets the preamp feedback voltage in dac units (0-1024)." << std::endl;
|
||||
os << std::endl;
|
||||
os << "vshaper1 " << "dacu\t gets the shaper1 feedback voltage in dac units (0-1024)." << std::endl;
|
||||
os << std::endl;
|
||||
os << "vshaper2 " << "dacu\t gets the shaper2 feedback voltage in dac units (0-1024)." << std::endl;
|
||||
os << std::endl;
|
||||
os << "vhighvoltage " << "dacu\t CHIPTEST BOARD ONLY - gets the detector HV in dac units (0-1024)." << std::endl;
|
||||
os << std::endl;
|
||||
os << "vapower " << "dacu\t CHIPTEST BOARD ONLY - gets the analog power supply in dac units (0-1024)." << std::endl;
|
||||
os << std::endl;
|
||||
os << "vddpower " << "dacu\t CHIPTEST BOARD ONLY - gets the digital power supply in dac units (0-1024)." << std::endl;
|
||||
os << std::endl;
|
||||
os << "vshpower " << "dacu\t CHIPTEST BOARD ONLY - gets the comparator power supply in dac units (0-1024)." << std::endl;
|
||||
os << std::endl;
|
||||
os << "viopower " << "dacu\t CHIPTEST BOARD ONLY - gets the FPGA I/O power supply in dac units (0-1024)." << std::endl;
|
||||
os << std::endl;
|
||||
|
||||
|
||||
os << "vrefds " << "\t gets vrefds" << std::endl;
|
||||
os << "vcascn_pb " << "\t gets vcascn_pb" << std::endl;
|
||||
os << "vcascp_pb " << "\t gets vcascp_pb" << std::endl;
|
||||
os << "vout_cm " << "\t gets vout_cm" << std::endl;
|
||||
os << "vin_cm " << "\t gets vin_cm" << std::endl;
|
||||
os << "vcasc_out " << "\t gets vcasc_out" << std::endl;
|
||||
os << "vref_comp " << "\t gets vref_comp" << std::endl;
|
||||
os << "ib_test_c " << "\t gets ib_test_c" << std::endl;
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
|
||||
|
||||
|
||||
string slsDetectorCommand::cmdADC(int narg, char *args[], int action) {
|
||||
|
||||
dacIndex adc;
|
||||
float val=-1;
|
||||
char answer[1000];
|
||||
|
||||
if (action==HELP_ACTION)
|
||||
return helpADC(narg, args, action);
|
||||
else if (action==PUT_ACTION)
|
||||
return string("cannot set ")+cmd;
|
||||
|
||||
if (cmd=="temp_adc")
|
||||
adc=TEMPERATURE_ADC;
|
||||
else if (cmd=="temp_fpga")
|
||||
adc=TEMPERATURE_FPGA;
|
||||
else
|
||||
return string("cannot decode adc ")+cmd;
|
||||
|
||||
setOnline(ONLINE_FLAG);
|
||||
|
||||
sprintf(answer,"%f",getADC(adc));
|
||||
return string(answer);
|
||||
|
||||
}
|
||||
|
||||
string slsDetectorCommand::helpDAC(int narg, char *args[], int action) {
|
||||
|
||||
ostringstream os;
|
||||
if (action==PUT_ACTION || action==HELP_ACTION) {
|
||||
os << "vthreshold dacu\t sets the detector threshold in dac units (0-1024). The energy is approx 800-15*keV" << std::endl;
|
||||
os << std::endl;
|
||||
|
||||
os << "vcalibration " << "dacu\t sets the calibration pulse amplitude in dac units (0-1024)." << std::endl;
|
||||
os << std::endl;
|
||||
os << "vtrimbit " << "dacu\t sets the trimbit amplitude in dac units (0-1024)." << std::endl;
|
||||
os << std::endl;
|
||||
os << "vpreamp " << "dacu\t sets the preamp feedback voltage in dac units (0-1024)." << std::endl;
|
||||
os << std::endl;
|
||||
os << "vshaper1 " << "dacu\t sets the shaper1 feedback voltage in dac units (0-1024)." << std::endl;
|
||||
os << std::endl;
|
||||
os << "vshaper2 " << "dacu\t sets the shaper2 feedback voltage in dac units (0-1024)." << std::endl;
|
||||
os << std::endl;
|
||||
os << "vhighvoltage " << "dacu\t CHIPTEST BOARD ONLY - sets the detector HV in dac units (0-1024)." << std::endl;
|
||||
os << std::endl;
|
||||
os << "vapower " << "dacu\t CHIPTEST BOARD ONLY - sets the analog power supply in dac units (0-1024)." << std::endl;
|
||||
os << std::endl;
|
||||
os << "vddpower " << "dacu\t CHIPTEST BOARD ONLY - sets the digital power supply in dac units (0-1024)." << std::endl;
|
||||
os << std::endl;
|
||||
os << "vshpower " << "dacu\t CHIPTEST BOARD ONLY - sets the comparator power supply in dac units (0-1024)." << std::endl;
|
||||
os << std::endl;
|
||||
os << "viopower " << "dacu\t CHIPTEST BOARD ONLY - sets the FPGA I/O power supply in dac units (0-1024)." << std::endl;
|
||||
|
||||
|
||||
|
||||
os << "vrefds " << "dacu\t sets vrefds" << std::endl;
|
||||
os << "vcascn_pb " << "dacu\t sets vcascn_pb" << std::endl;
|
||||
os << "vcascp_pb " << "dacu\t sets vcascp_pb" << std::endl;
|
||||
os << "vout_cm " << "dacu\t sets vout_cm" << std::endl;
|
||||
os << "vin_cm " << "dacu\t sets vin_cm" << std::endl;
|
||||
os << "vcasc_out " << "dacu\t sets vcasc_out" << std::endl;
|
||||
os << "vref_comp " << "dacu\t sets vref_comp" << std::endl;
|
||||
os << "ib_test_c " << "dacu\t sets ib_test_c" << std::endl;
|
||||
|
||||
}
|
||||
if (action==GET_ACTION || action==HELP_ACTION) {
|
||||
|
||||
|
||||
os << "vthreshold \t Gets the detector threshold in dac units (0-1024). The energy is approx 800-15*keV" << std::endl;
|
||||
os << std::endl;
|
||||
|
||||
os << "vcalibration " << "dacu\t gets the calibration pulse amplitude in dac units (0-1024)." << std::endl;
|
||||
os << std::endl;
|
||||
os << "vtrimbit " << "dacu\t gets the trimbit amplitude in dac units (0-1024)." << std::endl;
|
||||
os << std::endl;
|
||||
os << "vpreamp " << "dacu\t gets the preamp feedback voltage in dac units (0-1024)." << std::endl;
|
||||
os << std::endl;
|
||||
os << "vshaper1 " << "dacu\t gets the shaper1 feedback voltage in dac units (0-1024)." << std::endl;
|
||||
os << std::endl;
|
||||
os << "vshaper2 " << "dacu\t gets the shaper2 feedback voltage in dac units (0-1024)." << std::endl;
|
||||
os << std::endl;
|
||||
os << "vhighvoltage " << "dacu\t CHIPTEST BOARD ONLY - gets the detector HV in dac units (0-1024)." << std::endl;
|
||||
os << std::endl;
|
||||
os << "vapower " << "dacu\t CHIPTEST BOARD ONLY - gets the analog power supply in dac units (0-1024)." << std::endl;
|
||||
os << std::endl;
|
||||
os << "vddpower " << "dacu\t CHIPTEST BOARD ONLY - gets the digital power supply in dac units (0-1024)." << std::endl;
|
||||
os << std::endl;
|
||||
os << "vshpower " << "dacu\t CHIPTEST BOARD ONLY - gets the comparator power supply in dac units (0-1024)." << std::endl;
|
||||
os << std::endl;
|
||||
os << "viopower " << "dacu\t CHIPTEST BOARD ONLY - gets the FPGA I/O power supply in dac units (0-1024)." << std::endl;
|
||||
os << std::endl;
|
||||
|
||||
|
||||
os << "vrefds " << "\t gets vrefds" << std::endl;
|
||||
os << "vcascn_pb " << "\t gets vcascn_pb" << std::endl;
|
||||
os << "vcascp_pb " << "\t gets vcascp_pb" << std::endl;
|
||||
os << "vout_cm " << "\t gets vout_cm" << std::endl;
|
||||
os << "vin_cm " << "\t gets vin_cm" << std::endl;
|
||||
os << "vcasc_out " << "\t gets vcasc_out" << std::endl;
|
||||
os << "vref_comp " << "\t gets vref_comp" << std::endl;
|
||||
os << "ib_test_c " << "\t gets ib_test_c" << std::endl;
|
||||
os << "temp_adc " << "\t gets the temperature of the adc" << std::endl;
|
||||
os << "temp_fpga " << "\t gets the temperature of the fpga" << std::endl;
|
||||
|
||||
}
|
||||
return os.str();
|
||||
|
||||
|
||||
string slsDetectorCommand::helpADC(int narg, char *args[], int action) {
|
||||
|
||||
ostringstream os;
|
||||
if (action==PUT_ACTION || action==HELP_ACTION) {
|
||||
os << "temp_adc " << "Cannot be set" << std::endl;
|
||||
os << "temp_fpga " << "Cannot be set" << std::endl;
|
||||
}
|
||||
if (action==GET_ACTION || action==HELP_ACTION) {
|
||||
os << "temp_adc " << "\t gets the temperature of the adc" << std::endl;
|
||||
os << "temp_fpga " << "\t gets the temperature of the fpga" << std::endl;
|
||||
}
|
||||
return os.str();
|
||||
}
|
||||
|
||||
|
||||
|
@ -124,6 +124,9 @@ class slsDetectorCommand;
|
||||
string cmdThreaded(int narg, char *args[], int action);
|
||||
static string helpThreaded(int narg, char *args[], int action);
|
||||
|
||||
string cmdImage(int narg, char *args[], int action);
|
||||
static string helpImage(int narg, char *args[], int action);
|
||||
|
||||
string cmdPositions(int narg, char *args[], int action);
|
||||
static string helpPositions(int narg, char *args[], int action);
|
||||
|
||||
@ -179,6 +182,8 @@ class slsDetectorCommand;
|
||||
string cmdDAC(int narg, char *args[], int action);
|
||||
static string helpDAC(int narg, char *args[], int action);
|
||||
|
||||
string cmdADC(int narg, char *args[], int action);
|
||||
static string helpADC(int narg, char *args[], int action);
|
||||
|
||||
string cmdTimer(int narg, char *args[], int action);
|
||||
static string helpTimer(int narg, char *args[], int action);
|
||||
@ -324,6 +329,8 @@ class slsDetectorCommand;
|
||||
virtual int writeConfigurationFile(string const fname)=0;
|
||||
virtual int dumpDetectorSetup(string const fname, int level=0)=0;
|
||||
virtual int retrieveDetectorSetup(string const fname, int level=0)=0;
|
||||
virtual int loadImageToDetector(int index,string const fname)=0;
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -929,6 +929,63 @@ int slsDetectorUtils::readDataFile(ifstream &infile, int *data, int nch){
|
||||
};
|
||||
|
||||
|
||||
int slsDetectorUtils::readDataFile(string fname, short int *data, int nch){
|
||||
|
||||
ifstream infile;
|
||||
int ichan, iline=0;
|
||||
int interrupt=0;
|
||||
string str;
|
||||
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "Opening file "<< fname << std::endl;
|
||||
#endif
|
||||
infile.open(fname.c_str(), ios_base::in);
|
||||
if (infile.is_open()) {
|
||||
readDataFile(infile, data, nch);
|
||||
infile.close();
|
||||
} else {
|
||||
std::cout<< "Could not read file " << fname << std::endl;
|
||||
return -1;
|
||||
}
|
||||
return iline;
|
||||
};
|
||||
|
||||
int slsDetectorUtils::readDataFile(ifstream &infile, short int *data, int nch){
|
||||
|
||||
int ichan, iline=0;
|
||||
short int idata;
|
||||
int interrupt=0;
|
||||
string str;
|
||||
|
||||
|
||||
while (infile.good() and interrupt==0) {
|
||||
getline(infile,str);
|
||||
#ifdef VERBOSE
|
||||
std::cout<< str << std::endl;
|
||||
#endif
|
||||
istringstream ssstr(str);
|
||||
ssstr >> ichan >> idata;
|
||||
if (ssstr.fail() || ssstr.bad()) {
|
||||
interrupt=1;
|
||||
break;
|
||||
}
|
||||
if (ichan!=iline) {
|
||||
std::cout<< " Expected channel "<< iline <<" but read channel "<< ichan << std::endl;
|
||||
interrupt=1;
|
||||
break;
|
||||
} else {
|
||||
if (iline<nch) {
|
||||
data[iline]=idata;
|
||||
iline++;
|
||||
} else {
|
||||
interrupt=1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return iline;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*writes raw data file */
|
||||
@ -990,6 +1047,19 @@ int slsDetectorUtils::readDataFile(ifstream &infile, int *data){
|
||||
|
||||
|
||||
|
||||
int slsDetectorUtils::readDataFile(string fname, short int *data){
|
||||
|
||||
return readDataFile(fname, data, getTotalNumberOfChannels());
|
||||
};
|
||||
|
||||
|
||||
int slsDetectorUtils::readDataFile(ifstream &infile, short int *data){
|
||||
|
||||
return readDataFile(infile, data, getTotalNumberOfChannels());
|
||||
};
|
||||
|
||||
|
||||
|
||||
int slsDetectorUtils::readCalibrationFile(string fname, float &gain, float &offset){
|
||||
|
||||
string str;
|
||||
|
@ -204,7 +204,18 @@ class slsDetectorUtils : public slsDetectorCommand {
|
||||
int readDataFile(string fname, int *data);
|
||||
int readDataFile(ifstream &infile, int *data);
|
||||
|
||||
/**
|
||||
/**
|
||||
|
||||
reads a data file
|
||||
\param name of the file to be read
|
||||
\param data array of data values
|
||||
\returns OK or FAIL if it could not read the file or data=NULL
|
||||
\sa mythenDetector::readDataFile
|
||||
*/
|
||||
int readDataFile(string fname, short int *data);
|
||||
int readDataFile(ifstream &infile, short int *data);
|
||||
|
||||
/**
|
||||
|
||||
writes a data file
|
||||
\param name of the file to be written
|
||||
@ -259,6 +270,18 @@ class slsDetectorUtils : public slsDetectorCommand {
|
||||
*/
|
||||
static int readDataFile(string fname, int *data, int nch);
|
||||
static int readDataFile(ifstream &infile, int *data, int nch);
|
||||
|
||||
/**
|
||||
|
||||
reads a data file
|
||||
\param name of the file to be read
|
||||
\param data array of data values
|
||||
\returns OK or FAIL if it could not read the file or data=NULL
|
||||
\sa mythenDetector::readDataFile
|
||||
*/
|
||||
static int readDataFile(string fname, short int *data, int nch);
|
||||
static int readDataFile(ifstream &infile, short int *data, int nch);
|
||||
|
||||
/**
|
||||
|
||||
reads an angular conversion file
|
||||
|
Loading…
x
Reference in New Issue
Block a user