mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 18:17:59 +02:00
added calibrate pedestal for gotthard
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@456 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
@ -3911,11 +3911,19 @@ int slsDetector::setDynamicRange(int n){
|
||||
return thisDetector->dynamicRange;
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
/*
|
||||
int slsDetector::setROI(int nroi, int *xmin, int *xmax, int *ymin, int *ymax){
|
||||
|
||||
|
||||
return thisDetector->nROI;
|
||||
};
|
||||
|
||||
|
||||
int slsDetector::getROI(int nroi, int *xmin, int *xmax, int *ymin, int *ymax){
|
||||
|
||||
|
||||
return thisDetector->nROI;
|
||||
};
|
||||
*/
|
||||
|
||||
@ -6146,4 +6154,37 @@ int slsDetector::setFrameIndex(int index){
|
||||
}
|
||||
|
||||
|
||||
int slsDetector::calibratePedestal(int frames){
|
||||
int ret=FAIL;
|
||||
int retval=-1;
|
||||
int fnum=F_CALIBRATE_PEDESTAL;
|
||||
char mess[100];
|
||||
|
||||
#ifdef VERBOSE
|
||||
std::cout<<"Calibrating Pedestal " <<std::endl;
|
||||
#endif
|
||||
|
||||
if (thisDetector->onlineFlag==ONLINE_FLAG) {
|
||||
if (controlSocket) {
|
||||
if (controlSocket->Connect()>=0) {
|
||||
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
|
||||
controlSocket->SendDataOnly(&frames,sizeof(frames));
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -1038,16 +1038,18 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
|
||||
int getDataBytes(){return thisDetector->dataBytes;};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
set roi
|
||||
|
||||
not yet implemented
|
||||
\param nroi number of rois
|
||||
\param xmin x minimum of roi
|
||||
\param xmax x maximum of roi
|
||||
\param ymin y minimum of roi
|
||||
\param ymax y maximum of roi
|
||||
\returns number of rois added
|
||||
*/
|
||||
int setROI(int nroi=-1, int *xmin=NULL, int *xmax=NULL, int *ymin=NULL, int *ymax=NULL);
|
||||
|
||||
//int setROI(int nroi=-1, int *xmin=NULL, int *xmax=NULL, int *ymin=NULL, int *ymax=NULL);
|
||||
|
||||
|
||||
/**
|
||||
set/get readout flags
|
||||
@ -1523,6 +1525,11 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
|
||||
int fillModuleMask(int *mM);
|
||||
|
||||
|
||||
/** Starts acquisition, calibrates pedestal and writes to fpga
|
||||
/returns number of frames
|
||||
*/
|
||||
int calibratePedestal(int frames = 0);
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
@ -383,6 +383,9 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdDetectorSize;
|
||||
i++;
|
||||
|
||||
//descrToFuncMap[i].m_pFuncName="roi"; //
|
||||
//descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdDetectorSize;
|
||||
//i++;
|
||||
|
||||
/* flags */
|
||||
|
||||
@ -461,6 +464,13 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdSettings;
|
||||
i++;
|
||||
|
||||
|
||||
descrToFuncMap[i].m_pFuncName="pedestal"; //
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdSettings;
|
||||
i++;
|
||||
|
||||
|
||||
|
||||
/* pots */
|
||||
|
||||
descrToFuncMap[i].m_pFuncName="vthreshold"; //
|
||||
@ -2543,7 +2553,9 @@ string slsDetectorCommand::cmdDetectorSize(int narg, char *args[], int action) {
|
||||
if (action==PUT_ACTION) {
|
||||
if (cmd=="maxmod")
|
||||
return string("cannot put!");
|
||||
// else if (cmd=="roi"){
|
||||
|
||||
// } else
|
||||
if (sscanf(args[1],"%d",&val))
|
||||
;
|
||||
else
|
||||
@ -2594,11 +2606,9 @@ string slsDetectorCommand::cmdSettings(int narg, char *args[], int action) {
|
||||
return helpSettings(narg,args,action);
|
||||
int val=-1;//ret,
|
||||
char ans[1000];
|
||||
|
||||
|
||||
// portType index;
|
||||
|
||||
|
||||
|
||||
|
||||
// if (sscanf(args[1],"%d",&val))
|
||||
// ;
|
||||
// else
|
||||
@ -2672,6 +2682,15 @@ string slsDetectorCommand::cmdSettings(int narg, char *args[], int action) {
|
||||
myDet->saveSettingsFile(sval, -1);
|
||||
return string("done");
|
||||
|
||||
} else if (cmd=="pedestal") {
|
||||
if (action==GET_ACTION)
|
||||
return string("cannot get");
|
||||
if (sscanf(args[1],"%d",&val)){
|
||||
sprintf(ans,"%d",myDet->calibratePedestal(val));
|
||||
return string(ans);
|
||||
}else
|
||||
return string("cannot parse frame number")+cmd;
|
||||
|
||||
}
|
||||
return string("unknown settings command ")+cmd;
|
||||
|
||||
@ -2686,6 +2705,8 @@ string slsDetectorCommand::helpSettings(int narg, char *args[], int action) {
|
||||
os << "threshold eV\n sets the detector threshold in eV"<< std::endl;
|
||||
os << "trimbits fname\n loads the trimfile fname to the detector. If no extension is specified, the serial number of each module will be attached."<< std::endl;
|
||||
os << "trim:mode fname\n trims the detector according to mode (can be noise, beam, improve, fix) and saves the resulting trimbits to file fname."<< std::endl;
|
||||
os << "pedestal i \n starts acquisition for i frames, calculates pedestal and writes back to fpga."<< std::endl;
|
||||
|
||||
}
|
||||
if (action==GET_ACTION || action==HELP_ACTION) {
|
||||
os << "settings \n gets the settings of the detector"<< std::endl;
|
||||
|
@ -650,6 +650,11 @@ virtual int exitReceiver()=0;
|
||||
virtual int enableWriteToFile(int enable=-1)=0;
|
||||
|
||||
|
||||
/** Starts acquisition, calibrates pedestal and writes to fpga
|
||||
/returns number of frames
|
||||
*/
|
||||
virtual int calibratePedestal(int frames = 0)=0;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
Reference in New Issue
Block a user