supports frames with many samples for jctb - obtained by faking number of chips in case of many samples

This commit is contained in:
2015-01-30 12:58:53 +01:00
parent a149d7fb2e
commit 9ac08e5e76
15 changed files with 488 additions and 423 deletions

View File

@ -612,6 +612,10 @@ int slsDetector::initializeDetectorSize(detectorType type) {
thisDetector->dataBytes=thisDetector->nMod[X]*thisDetector->nMod[Y]*thisDetector->nChips*thisDetector->nChans*thisDetector->dynamicRange/8;
if(thisDetector->myDetectorType==JUNGFRAUCTB) {
thisDetector->dataBytes=thisDetector->nMod[X]*thisDetector->nMod[Y]*thisDetector->nChans*thisDetector->dynamicRange/8;
}
if(thisDetector->myDetectorType==MYTHEN){
if (thisDetector->dynamicRange==24 || thisDetector->timerValue[PROBES_NUMBER]>0)
thisDetector->dataBytes=thisDetector->nMod[X]*thisDetector->nMod[Y]*thisDetector->nChips*thisDetector->nChans*4;
@ -1540,6 +1544,11 @@ int slsDetector::setNumberOfModules(int n, dimension d){
thisDetector->dataBytes=thisDetector->nMod[X]*thisDetector->nMod[Y]*thisDetector->nChips*thisDetector->nChans*4;
}
if(thisDetector->myDetectorType==JUNGFRAUCTB){
thisDetector->dataBytes=thisDetector->nMod[X]*thisDetector->nMod[Y]*thisDetector->nChans*dr/8;
}
#ifdef VERBOSE
std::cout<< "Data size is " << thisDetector->dataBytes << std::endl;
@ -3363,9 +3372,9 @@ int* slsDetector::getDataFromDetector(int *retval){
} else {
n=controlSocket->ReceiveDataOnly(retval,thisDetector->dataBytes);
#ifdef VERBOSE
// #ifdef VERBOSE
std::cout<< "Received "<< n << " data bytes" << std::endl;
#endif
// #endif
if (n!=thisDetector->dataBytes) {
std::cout<< "wrong data size received: received " << n << " but expected " << thisDetector->dataBytes << std::endl;
thisDetector->stoppedFlag=1;
@ -3376,7 +3385,7 @@ int* slsDetector::getDataFromDetector(int *retval){
return NULL;
}
}
// cout << "get data returning " << endl;
return retval;
};
@ -3401,12 +3410,13 @@ int* slsDetector::readAll(){
while ((retval=getDataFromDetector())){
i++;
#ifdef VERBOSE
//#ifdef VERBOSE
std::cout<< i << std::endl;
//#else
//std::cout << "-" << flush ;
#endif
//#endif
dataQueue.push(retval);
std::cout<< "pushed" << std::endl;
}
controlSocket->Disconnect();
}
@ -4097,6 +4107,9 @@ int slsDetector::setDynamicRange(int n){
#endif
if (n==24)
n=32;
if (thisDetector->onlineFlag==ONLINE_FLAG) {
if (connectControl() == OK){
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
@ -4121,24 +4134,31 @@ int slsDetector::setDynamicRange(int n){
if (ret!=FAIL && retval>0) {
/* checking the number of probes to chose the data size */
thisDetector->dataBytes=thisDetector->nMod[X]*thisDetector->nMod[Y]*thisDetector->nChips*thisDetector->nChans*retval/8;
if(thisDetector->myDetectorType==MYTHEN){
if (thisDetector->timerValue[PROBES_NUMBER]!=0)
thisDetector->dataBytes=thisDetector->nMod[X]*thisDetector->nMod[Y]*thisDetector->nChips*thisDetector->nChans*4;
if (retval==32)
thisDetector->dynamicRange=24;
}
thisDetector->dynamicRange=retval;
thisDetector->dataBytes=thisDetector->nMod[X]*thisDetector->nMod[Y]*thisDetector->nChips*thisDetector->nChans*retval/8;
if (thisDetector->myDetectorType==JUNGFRAUCTB) {
thisDetector->nChip[X]=retval/16;
thisDetector->nChips=thisDetector->nChip[X]*thisDetector->nChip[Y];
thisDetector->dataBytes=thisDetector->nMod[X]*thisDetector->nMod[Y]*thisDetector->nChans*retval/8;
}
if(thisDetector->myDetectorType==MYTHEN){
if (thisDetector->timerValue[PROBES_NUMBER]!=0)
thisDetector->dataBytes=thisDetector->nMod[X]*thisDetector->nMod[Y]*thisDetector->nChips*thisDetector->nChans*4;
if (retval==32)
thisDetector->dynamicRange=24;
}
#ifdef VERBOSE
thisDetector->dynamicRange=retval;
//#ifdef VERBOSE
std::cout<< "Dynamic range set to "<< thisDetector->dynamicRange << std::endl;
std::cout<< "Data bytes "<< thisDetector->dataBytes << std::endl;
#endif
//#endif
}
@ -4368,11 +4388,14 @@ int slsDetector::executeTrimming(trimMode mode, int par1, int par2, int imod){
double* slsDetector::decodeData(int *datain, double *fdata) {
double *dataout;
if (fdata)
if (fdata) {
dataout=fdata;
else
// printf("not allocating fdata!\n");
}
else {
dataout=new double[thisDetector->nChans*thisDetector->nChips*thisDetector->nMods];
// printf("allocating fdata!\n");
}
const int bytesize=8;
int ival=0;

View File

@ -204,11 +204,11 @@ class slsDetectorActions : public virtual slsDetectorBase
*/
virtual int setAllTrimbits(int val, int imod=-1)=0;
/** returns the detector type
\param pos position in the multi detector structure (is -1 returns type of detector with id -1)
\returns type
*/
virtual detectorType getDetectorsType(int pos=-1)=0;
/* /\** returns the detector type */
/* \param pos position in the multi detector structure (is -1 returns type of detector with id -1) */
/* \returns type */
/* *\/ */
/* virtual detectorType getDetectorsType(int pos=-1)=0; */
virtual int setThresholdEnergy(int, int im=-1, detectorSettings isettings=GET_SETTINGS)=0;
virtual int setChannel(int64_t, int ich=-1, int ichip=-1, int imod=-1)=0;

View File

@ -77,6 +77,12 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
/** virtual destructor */
virtual ~slsDetectorBase(){};
/** returns the detector type
\param pos position in the multi detector structure (is -1 returns type of detector with id -1)
\returns type
*/
virtual detectorType getDetectorsType(int pos=-1)=0;
string getDetectorDeveloper(){return string("PSI");};
// protected:

View File

@ -828,6 +828,13 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdSpeed;
i++;
descrToFuncMap[i].m_pFuncName="adcpipeline"; //
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdSpeed;
i++;
/* settings dump/retrieve */
descrToFuncMap[i].m_pFuncName="config";
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdConfiguration;
@ -3939,6 +3946,8 @@ string slsDetectorCommand::cmdSpeed(int narg, char *args[], int action) {
index=ADC_CLOCK;
else if (cmd=="adcphase")
index=ADC_PHASE;
else if (cmd=="adcpipeline")
index=ADC_PIPELINE;
else
return string("could not decode speed variable ")+cmd;

View File

@ -75,6 +75,7 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
// int getPositions(double *pos=NULL){return angularConversion::getPositions(pos);};
using slsDetectorBase::setFlatFieldCorrection;
using slsDetectorBase::getDetectorsType;
using postProcessing::setBadChannelCorrection;
int enableFlatFieldCorrection(int i=-1) {if (i>0) setFlatFieldCorrectionFile("default"); else if (i==0) setFlatFieldCorrectionFile(""); return getFlatFieldCorrection();};
@ -126,12 +127,6 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
virtual string setHostname(const char* name, int pos=-1)=0;
/** returns the detector type
\param pos position in the multi detector structure (is -1 returns type of detector with id -1)
\returns type
*/
virtual detectorType getDetectorsType(int pos=-1)=0;
/** returns the detector type
\param pos position in the multi detector structure (is -1 returns type of detector with id -1)
\returns type