mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-08 19:10:42 +02:00
Merge branch '3.0.1' into developer
This commit is contained in:
commit
092487c08e
@ -1,9 +1,9 @@
|
|||||||
Path: slsDetectorsPackage/slsDetectorSoftware
|
Path: slsDetectorsPackage/slsDetectorSoftware
|
||||||
URL: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git
|
URL: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git
|
||||||
Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git
|
Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git
|
||||||
Repsitory UUID: 5d45181f177b552819bd60947c6cf4f0abae7681
|
Repsitory UUID: 3c1eb747d1930d6d38030a5a607f72d3b58a7a21
|
||||||
Revision: 1543
|
Revision: 1544
|
||||||
Branch: 3.0
|
Branch: 3.0
|
||||||
Last Changed Author: Dhanya_Maliakal
|
Last Changed Author: Dhanya_Maliakal
|
||||||
Last Changed Rev: 1548
|
Last Changed Rev: 1549
|
||||||
Last Changed Date: 2017-08-28 12:02:38.000000002 +0200 ./multiSlsDetector/multiSlsDetector.cpp
|
Last Changed Date: 2017-09-14 17:05:04.000000002 +0200 ./threadFiles/ThreadPool.o
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -204,6 +204,9 @@ class multiSlsDetector : public slsDetectorUtils {
|
|||||||
/** external gui */
|
/** external gui */
|
||||||
bool externalgui;
|
bool externalgui;
|
||||||
|
|
||||||
|
/** receiver online flag - is set if the receiver is connected, unset if socket connection is not possible */
|
||||||
|
int receiverOnlineFlag;
|
||||||
|
|
||||||
} sharedMultiSlsDetector;
|
} sharedMultiSlsDetector;
|
||||||
|
|
||||||
|
|
||||||
@ -1233,6 +1236,11 @@ class multiSlsDetector : public slsDetectorUtils {
|
|||||||
*/
|
*/
|
||||||
int getFramesCaughtByReceiver();
|
int getFramesCaughtByReceiver();
|
||||||
|
|
||||||
|
/** gets the number of frames caught by any one receiver (to avoid using threadpool)
|
||||||
|
\returns number of frames caught by any one receiver (master receiver if exists)
|
||||||
|
*/
|
||||||
|
int getFramesCaughtByAnyReceiver();
|
||||||
|
|
||||||
/** gets the current frame index of receiver
|
/** gets the current frame index of receiver
|
||||||
\returns current frame index of receiver
|
\returns current frame index of receiver
|
||||||
*/
|
*/
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
//#define SVNPATH ""
|
//#define SVNPATH ""
|
||||||
#define SVNURLLIB "git@git.psi.ch:sls_detectors_software/sls_detector_software.git"
|
#define SVNURLLIB "git@git.psi.ch:sls_detectors_software/sls_detector_software.git"
|
||||||
//#define SVNREPPATH ""
|
//#define SVNREPPATH ""
|
||||||
#define SVNREPUUIDLIB "5d45181f177b552819bd60947c6cf4f0abae7681"
|
#define SVNREPUUIDLIB "3c1eb747d1930d6d38030a5a607f72d3b58a7a21"
|
||||||
//#define SVNREV 0x1548
|
//#define SVNREV 0x1549
|
||||||
//#define SVNKIND ""
|
//#define SVNKIND ""
|
||||||
//#define SVNSCHED ""
|
//#define SVNSCHED ""
|
||||||
#define SVNAUTHLIB "Dhanya_Maliakal"
|
#define SVNAUTHLIB "Dhanya_Maliakal"
|
||||||
#define SVNREVLIB 0x1548
|
#define SVNREVLIB 0x1549
|
||||||
#define SVNDATELIB 0x20170828
|
#define SVNDATELIB 0x20170914
|
||||||
//
|
//
|
||||||
|
@ -190,9 +190,9 @@ slsDetector::slsDetector(int pos, int id, multiSlsDetector *p) :slsDetectorUtils
|
|||||||
if it fails the detector id is incremented until it succeeds
|
if it fails the detector id is incremented until it succeeds
|
||||||
*/
|
*/
|
||||||
shmId=initSharedMemory(type,id);
|
shmId=initSharedMemory(type,id);
|
||||||
id++;
|
++id;
|
||||||
}
|
}
|
||||||
id--;
|
--id;
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout<< "Detector id is " << id << std::endl;
|
std::cout<< "Detector id is " << id << std::endl;
|
||||||
#endif
|
#endif
|
||||||
@ -238,9 +238,9 @@ slsDetector::slsDetector(int pos, detectorType type, int id, multiSlsDetector *p
|
|||||||
if it fails the detector id is incremented until it succeeds
|
if it fails the detector id is incremented until it succeeds
|
||||||
*/
|
*/
|
||||||
shmId=initSharedMemory(type,id);
|
shmId=initSharedMemory(type,id);
|
||||||
id++;
|
++id;
|
||||||
}
|
}
|
||||||
id--;
|
--id;
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout<< "Detector id is " << id << " type is " << type << std::endl;
|
std::cout<< "Detector id is " << id << " type is " << type << std::endl;
|
||||||
#endif
|
#endif
|
||||||
@ -304,9 +304,9 @@ slsDetector::slsDetector(int pos, char *name, int id, int cport,multiSlsDetector
|
|||||||
if it fails the detector id is incremented until it succeeds
|
if it fails the detector id is incremented until it succeeds
|
||||||
*/
|
*/
|
||||||
shmId=initSharedMemory(type,id);
|
shmId=initSharedMemory(type,id);
|
||||||
id++;
|
++id;
|
||||||
}
|
}
|
||||||
id--;
|
--id;
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout<< "Detector id is " << id << std::endl;
|
std::cout<< "Detector id is " << id << std::endl;
|
||||||
#endif
|
#endif
|
||||||
@ -782,13 +782,13 @@ int slsDetector::initializeDetectorSize(detectorType type) {
|
|||||||
thisDetector->flippedData[1] = 0;
|
thisDetector->flippedData[1] = 0;
|
||||||
thisDetector->zmqport = 0;
|
thisDetector->zmqport = 0;
|
||||||
|
|
||||||
for (int ia=0; ia<MAX_ACTIONS; ia++) {
|
for (int ia=0; ia<MAX_ACTIONS; ++ia) {
|
||||||
strcpy(thisDetector->actionScript[ia],"none");
|
strcpy(thisDetector->actionScript[ia],"none");
|
||||||
strcpy(thisDetector->actionParameter[ia],"none");
|
strcpy(thisDetector->actionParameter[ia],"none");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for (int iscan=0; iscan<MAX_SCAN_LEVELS; iscan++) {
|
for (int iscan=0; iscan<MAX_SCAN_LEVELS; ++iscan) {
|
||||||
|
|
||||||
thisDetector->scanMode[iscan]=0;
|
thisDetector->scanMode[iscan]=0;
|
||||||
strcpy(thisDetector->scanScript[iscan],"none");
|
strcpy(thisDetector->scanScript[iscan],"none");
|
||||||
@ -833,7 +833,7 @@ int slsDetector::initializeDetectorSize(detectorType type) {
|
|||||||
fferrors=(double*)(goff+thisDetector->fferroff);
|
fferrors=(double*)(goff+thisDetector->fferroff);
|
||||||
detectorModules=(sls_detector_module*)(goff+ thisDetector->modoff);
|
detectorModules=(sls_detector_module*)(goff+ thisDetector->modoff);
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
// for (int imod=0; imod< thisDetector->nModsMax; imod++)
|
// for (int imod=0; imod< thisDetector->nModsMax; ++imod)
|
||||||
// std::cout<< hex << detectorModules+imod << dec <<std::endl;
|
// std::cout<< hex << detectorModules+imod << dec <<std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -948,7 +948,7 @@ int slsDetector::initializeDetectorStructure() {
|
|||||||
//p2=(char*)thisDetector;
|
//p2=(char*)thisDetector;
|
||||||
|
|
||||||
/** for each of the detector modules up to the maximum number which can be installed initlialize the sls_detector_module structure \sa ::sls_detector_module*/
|
/** for each of the detector modules up to the maximum number which can be installed initlialize the sls_detector_module structure \sa ::sls_detector_module*/
|
||||||
for (int imod=0; imod<thisDetector->nModsMax; imod++) {
|
for (int imod=0; imod<thisDetector->nModsMax; ++imod) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -967,37 +967,37 @@ int slsDetector::initializeDetectorStructure() {
|
|||||||
thisMod->reg=0;
|
thisMod->reg=0;
|
||||||
|
|
||||||
/** initializes the dacs values to 0 */
|
/** initializes the dacs values to 0 */
|
||||||
for (int idac=0; idac<thisDetector->nDacs; idac++) {
|
for (int idac=0; idac<thisDetector->nDacs; ++idac) {
|
||||||
*(dacs+idac+thisDetector->nDacs*imod)=0;
|
*(dacs+idac+thisDetector->nDacs*imod)=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** initializes the adc values to 0 */
|
/** initializes the adc values to 0 */
|
||||||
for (int iadc=0; iadc<thisDetector->nAdcs; iadc++) {
|
for (int iadc=0; iadc<thisDetector->nAdcs; ++iadc) {
|
||||||
*(adcs+iadc+thisDetector->nAdcs*imod)=0;
|
*(adcs+iadc+thisDetector->nAdcs*imod)=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** initializes the chip registers to 0 */
|
/** initializes the chip registers to 0 */
|
||||||
for (int ichip=0; ichip<thisDetector->nChips; ichip++) {
|
for (int ichip=0; ichip<thisDetector->nChips; ++ichip) {
|
||||||
*(chipregs+ichip+thisDetector->nChips*imod)=-1;
|
*(chipregs+ichip+thisDetector->nChips*imod)=-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** initializes the channel registers to 0 */
|
/** initializes the channel registers to 0 */
|
||||||
for (int ichan=0; ichan<thisDetector->nChans*thisDetector->nChips; ichan++) {
|
for (int ichan=0; ichan<thisDetector->nChans*thisDetector->nChips; ++ichan) {
|
||||||
*(chanregs+ichan+thisDetector->nChips*thisDetector->nChans*imod)=-1;
|
*(chanregs+ichan+thisDetector->nChips*thisDetector->nChans*imod)=-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** initializes the gain values to 0 */
|
/** initializes the gain values to 0 */
|
||||||
for (int igain=0; igain<thisDetector->nGain; igain++) {
|
for (int igain=0; igain<thisDetector->nGain; ++igain) {
|
||||||
*(gain+igain+thisDetector->nGain*imod)=0;
|
*(gain+igain+thisDetector->nGain*imod)=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** initializes the offset values to 0 */
|
/** initializes the offset values to 0 */
|
||||||
for (int ioffset=0; ioffset<thisDetector->nOffset; ioffset++) {
|
for (int ioffset=0; ioffset<thisDetector->nOffset; ++ioffset) {
|
||||||
*(offset+ioffset+thisDetector->nOffset*imod)=0;
|
*(offset+ioffset+thisDetector->nOffset*imod)=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1733,7 +1733,7 @@ int slsDetector::getTotalNumberOfChannels() {
|
|||||||
if (thisDetector->nChan[X]>=32) {
|
if (thisDetector->nChan[X]>=32) {
|
||||||
if (thisDetector->nROI>0) {
|
if (thisDetector->nROI>0) {
|
||||||
thisDetector->nChan[X]-=32;
|
thisDetector->nChan[X]-=32;
|
||||||
for (int iroi=0; iroi<thisDetector->nROI; iroi++)
|
for (int iroi=0; iroi<thisDetector->nROI; ++iroi)
|
||||||
thisDetector->nChan[X]+=thisDetector->roiLimits[iroi].xmax-thisDetector->roiLimits[iroi].xmin+1;
|
thisDetector->nChan[X]+=thisDetector->roiLimits[iroi].xmax-thisDetector->roiLimits[iroi].xmin+1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2493,7 +2493,7 @@ dacs_t slsDetector::setDAC(dacs_t val, dacIndex index, int mV, int imod){
|
|||||||
*(dacs+index+imod*thisDetector->nDacs)=retval[0];
|
*(dacs+index+imod*thisDetector->nDacs)=retval[0];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for (imod=0; imod<thisDetector->nModsMax; imod++)
|
for (imod=0; imod<thisDetector->nModsMax; ++imod)
|
||||||
*(dacs+index+imod*thisDetector->nDacs)=retval[0];
|
*(dacs+index+imod*thisDetector->nDacs)=retval[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2605,9 +2605,9 @@ int slsDetector::setChannel(int64_t reg, int ichan, int ichip, int imod){
|
|||||||
chamax=thisDetector->nChans;
|
chamax=thisDetector->nChans;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
// for (int im=mmin; im<mmax; im++) {
|
// for (int im=mmin; im<mmax; ++im) {
|
||||||
// for (int ichi=chimin; ichi<chimax; ichi++) {
|
// for (int ichi=chimin; ichi<chimax; ++ichi) {
|
||||||
// for (int icha=chamin; icha<chamax; icha++) {
|
// for (int icha=chamin; icha<chamax; ++icha) {
|
||||||
myChan.chan=ichan;//icha;
|
myChan.chan=ichan;//icha;
|
||||||
myChan.chip=ichip;//ichi;
|
myChan.chip=ichip;//ichi;
|
||||||
myChan.module=imod;//im;
|
myChan.module=imod;//im;
|
||||||
@ -2675,9 +2675,9 @@ int slsDetector::setChannel(sls_detector_channel chan){
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
for (int im=mmin; im<mmax; im++) {
|
for (int im=mmin; im<mmax; ++im) {
|
||||||
for (int ichi=chimin; ichi<chimax; ichi++) {
|
for (int ichi=chimin; ichi<chimax; ++ichi) {
|
||||||
for (int icha=chamin; icha<chamax; icha++) {
|
for (int icha=chamin; icha<chamax; ++icha) {
|
||||||
|
|
||||||
*(chanregs+im*thisDetector->nChans*thisDetector->nChips+ichi*thisDetector->nChips+icha)=retval;
|
*(chanregs+im*thisDetector->nChans*thisDetector->nChips+ichi*thisDetector->nChips+icha)=retval;
|
||||||
|
|
||||||
@ -2783,14 +2783,14 @@ int slsDetector::setChip(int reg, int ichip, int imod){
|
|||||||
|
|
||||||
myChip.nchan=thisDetector->nChans;
|
myChip.nchan=thisDetector->nChans;
|
||||||
myChip.reg=reg;
|
myChip.reg=reg;
|
||||||
for (int im=mmin; im<mmax; im++) {
|
for (int im=mmin; im<mmax; ++im) {
|
||||||
for (int ichi=chimin; ichi<chimax; ichi++) {
|
for (int ichi=chimin; ichi<chimax; ++ichi) {
|
||||||
myChip.chip=ichi;
|
myChip.chip=ichi;
|
||||||
myChip.module=im;
|
myChip.module=im;
|
||||||
if (chanregs)
|
if (chanregs)
|
||||||
myChip.chanregs=(chanregs+ichi*thisDetector->nChans+im*thisDetector->nChans*thisDetector->nChips);
|
myChip.chanregs=(chanregs+ichi*thisDetector->nChans+im*thisDetector->nChans*thisDetector->nChips);
|
||||||
else {
|
else {
|
||||||
for (int i=0; i<thisDetector->nChans; i++)
|
for (int i=0; i<thisDetector->nChans; ++i)
|
||||||
chregs[i]=-1;
|
chregs[i]=-1;
|
||||||
myChip.chanregs=chregs;
|
myChip.chanregs=chregs;
|
||||||
}
|
}
|
||||||
@ -2889,7 +2889,7 @@ slsDetectorDefs::sls_detector_chip slsDetector::getChip(int ichip, int imod){
|
|||||||
if (chipregs)
|
if (chipregs)
|
||||||
*(chipregs+ichip+imod*thisDetector->nChips)=myChip.reg;
|
*(chipregs+ichip+imod*thisDetector->nChips)=myChip.reg;
|
||||||
if (chanregs) {
|
if (chanregs) {
|
||||||
for (int ichan=0; ichan<thisDetector->nChans; ichan++)
|
for (int ichan=0; ichan<thisDetector->nChans; ++ichan)
|
||||||
*(chanregs+imod*thisDetector->nChans*thisDetector->nChips+ichip*thisDetector->nChans+ichan)=*((myChip.chanregs)+ichan);
|
*(chanregs+imod*thisDetector->nChans*thisDetector->nChips+ichip*thisDetector->nChans+ichan)=*((myChip.chanregs)+ichan);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2927,7 +2927,7 @@ int slsDetector::setModule(int reg, int imod){
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
for (int im=mmin; im<mmax; im++) {
|
for (int im=mmin; im<mmax; ++im) {
|
||||||
|
|
||||||
myModule.module=im;
|
myModule.module=im;
|
||||||
myModule.nchan=thisDetector->nChans;
|
myModule.nchan=thisDetector->nChans;
|
||||||
@ -2947,34 +2947,34 @@ int slsDetector::setModule(int reg, int imod){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for (int i=0; i<thisDetector->nAdcs; i++)
|
for (int i=0; i<thisDetector->nAdcs; ++i)
|
||||||
ads[i]=-1;
|
ads[i]=-1;
|
||||||
|
|
||||||
if (chanregs)
|
if (chanregs)
|
||||||
myModule.chanregs=chanregs+im*thisDetector->nChips*thisDetector->nChans;
|
myModule.chanregs=chanregs+im*thisDetector->nChips*thisDetector->nChans;
|
||||||
else {
|
else {
|
||||||
for (int i=0; i<thisDetector->nChans*thisDetector->nChips; i++)
|
for (int i=0; i<thisDetector->nChans*thisDetector->nChips; ++i)
|
||||||
charegs[i]=-1;
|
charegs[i]=-1;
|
||||||
myModule.chanregs=charegs;
|
myModule.chanregs=charegs;
|
||||||
}
|
}
|
||||||
if (chipregs)
|
if (chipregs)
|
||||||
myModule.chipregs=chanregs+im*thisDetector->nChips;
|
myModule.chipregs=chanregs+im*thisDetector->nChips;
|
||||||
else {
|
else {
|
||||||
for (int ichip=0; ichip<thisDetector->nChips; ichip++)
|
for (int ichip=0; ichip<thisDetector->nChips; ++ichip)
|
||||||
chiregs[ichip]=-1;
|
chiregs[ichip]=-1;
|
||||||
myModule.chipregs=chiregs;
|
myModule.chipregs=chiregs;
|
||||||
}
|
}
|
||||||
if (dacs)
|
if (dacs)
|
||||||
myModule.dacs=dacs+im*thisDetector->nDacs;
|
myModule.dacs=dacs+im*thisDetector->nDacs;
|
||||||
else {
|
else {
|
||||||
for (int i=0; i<thisDetector->nDacs; i++)
|
for (int i=0; i<thisDetector->nDacs; ++i)
|
||||||
das[i]=-1;
|
das[i]=-1;
|
||||||
myModule.dacs=das;
|
myModule.dacs=das;
|
||||||
}
|
}
|
||||||
if (adcs)
|
if (adcs)
|
||||||
myModule.adcs=adcs+im*thisDetector->nAdcs;
|
myModule.adcs=adcs+im*thisDetector->nAdcs;
|
||||||
else {
|
else {
|
||||||
for (int i=0; i<thisDetector->nAdcs; i++)
|
for (int i=0; i<thisDetector->nAdcs; ++i)
|
||||||
ads[i]=-1;
|
ads[i]=-1;
|
||||||
myModule.adcs=ads;
|
myModule.adcs=ads;
|
||||||
}
|
}
|
||||||
@ -3055,25 +3055,25 @@ int slsDetector::setModule(sls_detector_module module, int iodelay, int tau, int
|
|||||||
|
|
||||||
if(thisDetector->myDetectorType != JUNGFRAU){
|
if(thisDetector->myDetectorType != JUNGFRAU){
|
||||||
if(tb) {
|
if(tb) {
|
||||||
for (int ichip=0; ichip<thisDetector->nChips; ichip++) {
|
for (int ichip=0; ichip<thisDetector->nChips; ++ichip) {
|
||||||
if (chipregs)
|
if (chipregs)
|
||||||
chipregs[ichip+thisDetector->nChips*imod]=module.chipregs[ichip];
|
chipregs[ichip+thisDetector->nChips*imod]=module.chipregs[ichip];
|
||||||
|
|
||||||
if (chanregs) {
|
if (chanregs) {
|
||||||
for (int i=0; i<thisDetector->nChans; i++) {
|
for (int i=0; i<thisDetector->nChans; ++i) {
|
||||||
chanregs[i+ichip*thisDetector->nChans+thisDetector->nChips*thisDetector->nChans*imod]=module.chanregs[ichip*thisDetector->nChans+i];
|
chanregs[i+ichip*thisDetector->nChans+thisDetector->nChips*thisDetector->nChans*imod]=module.chanregs[ichip*thisDetector->nChans+i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (adcs) {
|
if (adcs) {
|
||||||
for (int i=0; i<thisDetector->nAdcs; i++)
|
for (int i=0; i<thisDetector->nAdcs; ++i)
|
||||||
adcs[i+imod*thisDetector->nAdcs]=module.adcs[i];
|
adcs[i+imod*thisDetector->nAdcs]=module.adcs[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dacs) {
|
if (dacs) {
|
||||||
for (int i=0; i<thisDetector->nDacs; i++)
|
for (int i=0; i<thisDetector->nDacs; ++i)
|
||||||
dacs[i+imod*thisDetector->nDacs]=module.dacs[i];
|
dacs[i+imod*thisDetector->nDacs]=module.dacs[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3085,12 +3085,12 @@ int slsDetector::setModule(sls_detector_module module, int iodelay, int tau, int
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((thisDetector->nGain) && (gainval) && (gain)) {
|
if ((thisDetector->nGain) && (gainval) && (gain)) {
|
||||||
for (int i=0; i<thisDetector->nGain; i++)
|
for (int i=0; i<thisDetector->nGain; ++i)
|
||||||
gain[i+imod*thisDetector->nGain]=gainval[i];
|
gain[i+imod*thisDetector->nGain]=gainval[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((thisDetector->nOffset) && (offsetval) && (offset)) {
|
if ((thisDetector->nOffset) && (offsetval) && (offset)) {
|
||||||
for (int i=0; i<thisDetector->nOffset; i++)
|
for (int i=0; i<thisDetector->nOffset; ++i)
|
||||||
offset[i+imod*thisDetector->nOffset]=offsetval[i];
|
offset[i+imod*thisDetector->nOffset]=offsetval[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3185,25 +3185,25 @@ slsDetectorDefs::sls_detector_module *slsDetector::getModule(int imod){
|
|||||||
thisDetector->nAdcs=myMod->nadc;
|
thisDetector->nAdcs=myMod->nadc;
|
||||||
|
|
||||||
if(thisDetector->myDetectorType != JUNGFRAU){
|
if(thisDetector->myDetectorType != JUNGFRAU){
|
||||||
for (int ichip=0; ichip<thisDetector->nChips; ichip++) {
|
for (int ichip=0; ichip<thisDetector->nChips; ++ichip) {
|
||||||
if (chipregs)
|
if (chipregs)
|
||||||
chipregs[ichip+thisDetector->nChips*imod]=myMod->chipregs[ichip];
|
chipregs[ichip+thisDetector->nChips*imod]=myMod->chipregs[ichip];
|
||||||
|
|
||||||
if (chanregs) {
|
if (chanregs) {
|
||||||
for (int i=0; i<thisDetector->nChans; i++) {
|
for (int i=0; i<thisDetector->nChans; ++i) {
|
||||||
chanregs[i+ichip*thisDetector->nChans+thisDetector->nChips*thisDetector->nChans*imod]=myMod->chanregs[ichip*thisDetector->nChans+i];
|
chanregs[i+ichip*thisDetector->nChans+thisDetector->nChips*thisDetector->nChans*imod]=myMod->chanregs[ichip*thisDetector->nChans+i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (adcs) {
|
if (adcs) {
|
||||||
for (int i=0; i<thisDetector->nAdcs; i++)
|
for (int i=0; i<thisDetector->nAdcs; ++i)
|
||||||
adcs[i+imod*thisDetector->nAdcs]=myMod->adcs[i];
|
adcs[i+imod*thisDetector->nAdcs]=myMod->adcs[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dacs) {
|
if (dacs) {
|
||||||
for (int i=0; i<thisDetector->nDacs; i++)
|
for (int i=0; i<thisDetector->nDacs; ++i)
|
||||||
dacs[i+imod*thisDetector->nDacs]=myMod->dacs[i];
|
dacs[i+imod*thisDetector->nDacs]=myMod->dacs[i];
|
||||||
}
|
}
|
||||||
(detectorModules+imod)->gain=myMod->gain;
|
(detectorModules+imod)->gain=myMod->gain;
|
||||||
@ -3214,12 +3214,12 @@ slsDetectorDefs::sls_detector_module *slsDetector::getModule(int imod){
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((thisDetector->nGain) && (gainval) && (gain)) {
|
if ((thisDetector->nGain) && (gainval) && (gain)) {
|
||||||
for (int i=0; i<thisDetector->nGain; i++)
|
for (int i=0; i<thisDetector->nGain; ++i)
|
||||||
gain[i+imod*thisDetector->nGain]=gainval[i];
|
gain[i+imod*thisDetector->nGain]=gainval[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((thisDetector->nOffset) && (offsetval) && (offset)) {
|
if ((thisDetector->nOffset) && (offsetval) && (offset)) {
|
||||||
for (int i=0; i<thisDetector->nOffset; i++)
|
for (int i=0; i<thisDetector->nOffset; ++i)
|
||||||
offset[i+imod*thisDetector->nOffset]=offsetval[i];
|
offset[i+imod*thisDetector->nOffset]=offsetval[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3682,7 +3682,7 @@ slsDetectorDefs::detectorSettings slsDetector::setSettings( detectorSettings ise
|
|||||||
modma=thisDetector->nMod[X]*thisDetector->nMod[Y];
|
modma=thisDetector->nMod[X]*thisDetector->nMod[Y];
|
||||||
}
|
}
|
||||||
|
|
||||||
for (im=modmi; im<modma; im++) {
|
for (im=modmi; im<modma; ++im) {
|
||||||
ostringstream ostfn, oscfn;
|
ostringstream ostfn, oscfn;
|
||||||
myMod->module=im;
|
myMod->module=im;
|
||||||
|
|
||||||
@ -3823,12 +3823,12 @@ slsDetectorDefs::detectorSettings slsDetector::setSettings( detectorSettings ise
|
|||||||
int slsDetector::getChanRegs(double* retval,bool fromDetector){
|
int slsDetector::getChanRegs(double* retval,bool fromDetector){
|
||||||
int n=getTotalNumberOfChannels();
|
int n=getTotalNumberOfChannels();
|
||||||
if(fromDetector){
|
if(fromDetector){
|
||||||
for(int im=0;im<setNumberOfModules();im++)
|
for(int im=0;im<setNumberOfModules();++im)
|
||||||
getModule(im);
|
getModule(im);
|
||||||
}
|
}
|
||||||
//the original array has 0 initialized
|
//the original array has 0 initialized
|
||||||
if(chanregs){
|
if(chanregs){
|
||||||
for (int i=0; i<n; i++)
|
for (int i=0; i<n; ++i)
|
||||||
retval[i] = (double) (chanregs[i] & TRIMBITMASK);
|
retval[i] = (double) (chanregs[i] & TRIMBITMASK);
|
||||||
}
|
}
|
||||||
return n;
|
return n;
|
||||||
@ -4235,7 +4235,7 @@ int* slsDetector::getDataFromDetector(int *retval){
|
|||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
// for (int ib=0; ib<thisDetector->dataBytes/8; ib++)
|
// for (int ib=0; ib<thisDetector->dataBytes/8; ++ib)
|
||||||
// cout << ((*(((u_int64_t*)retval)+ib))>>17&1) ;
|
// cout << ((*(((u_int64_t*)retval)+ib))>>17&1) ;
|
||||||
|
|
||||||
|
|
||||||
@ -4266,7 +4266,7 @@ int* slsDetector::readAll(){
|
|||||||
|
|
||||||
while ((retval=getDataFromDetector())){
|
while ((retval=getDataFromDetector())){
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
i++;
|
++i;
|
||||||
std::cout<< i << std::endl;
|
std::cout<< i << std::endl;
|
||||||
#endif
|
#endif
|
||||||
dataQueue.push(retval);
|
dataQueue.push(retval);
|
||||||
@ -4328,7 +4328,7 @@ int* slsDetector::startAndReadAll(){
|
|||||||
//#endif
|
//#endif
|
||||||
while ((retval=getDataFromDetector())){
|
while ((retval=getDataFromDetector())){
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
i++;
|
++i;
|
||||||
std::cout<< i << std::endl;
|
std::cout<< i << std::endl;
|
||||||
//#else
|
//#else
|
||||||
//std::cout<< "-" << flush;
|
//std::cout<< "-" << flush;
|
||||||
@ -4346,7 +4346,7 @@ int* slsDetector::startAndReadAll(){
|
|||||||
#endif
|
#endif
|
||||||
return dataQueue.front(); // check what we return!
|
return dataQueue.front(); // check what we return!
|
||||||
/* while ((retval=getDataFromDetectorNoWait()))
|
/* while ((retval=getDataFromDetectorNoWait()))
|
||||||
i++;
|
++i;
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout<< "Received " << i << " frames"<< std::endl;
|
std::cout<< "Received " << i << " frames"<< std::endl;
|
||||||
#endif
|
#endif
|
||||||
@ -5119,10 +5119,10 @@ int slsDetector::setROI(int n,ROI roiLimits[]){
|
|||||||
//sort ascending order
|
//sort ascending order
|
||||||
int temp;
|
int temp;
|
||||||
|
|
||||||
for(int i=0;i<n;i++){
|
for(int i=0;i<n;++i){
|
||||||
|
|
||||||
// cout << "*** ROI "<< i << " xmin " << roiLimits[i].xmin << " xmax "<< roiLimits[i].xmax << endl;
|
// cout << "*** ROI "<< i << " xmin " << roiLimits[i].xmin << " xmax "<< roiLimits[i].xmax << endl;
|
||||||
for(int j=i+1;j<n;j++){
|
for(int j=i+1;j<n;++j){
|
||||||
if(roiLimits[j].xmin<roiLimits[i].xmin){
|
if(roiLimits[j].xmin<roiLimits[i].xmin){
|
||||||
|
|
||||||
temp=roiLimits[i].xmin;roiLimits[i].xmin=roiLimits[j].xmin;roiLimits[j].xmin=temp;
|
temp=roiLimits[i].xmin;roiLimits[i].xmin=roiLimits[j].xmin;roiLimits[j].xmin=temp;
|
||||||
@ -5201,13 +5201,13 @@ int slsDetector::sendROI(int n,ROI roiLimits[]){
|
|||||||
|
|
||||||
//update client
|
//update client
|
||||||
if(ret!=FAIL){
|
if(ret!=FAIL){
|
||||||
for(int i=0;i<retvalsize;i++)
|
for(int i=0;i<retvalsize;++i)
|
||||||
thisDetector->roiLimits[i]=retval[i];
|
thisDetector->roiLimits[i]=retval[i];
|
||||||
thisDetector->nROI = retvalsize;
|
thisDetector->nROI = retvalsize;
|
||||||
}
|
}
|
||||||
|
|
||||||
//#ifdef VERBOSE
|
//#ifdef VERBOSE
|
||||||
for(int j=0;j<thisDetector->nROI;j++)
|
for(int j=0;j<thisDetector->nROI;++j)
|
||||||
cout<<"get"<< roiLimits[j].xmin<<"\t"<<roiLimits[j].xmax<<"\t"<<roiLimits[j].ymin<<"\t"<<roiLimits[j].ymax<<endl;
|
cout<<"get"<< roiLimits[j].xmin<<"\t"<<roiLimits[j].xmax<<"\t"<<roiLimits[j].ymin<<"\t"<<roiLimits[j].ymax<<endl;
|
||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
@ -5366,7 +5366,7 @@ double* slsDetector::decodeData(int *datain, int &nn, double *fdata) {
|
|||||||
if (thisDetector->timerValue[PROBES_NUMBER]==0) {
|
if (thisDetector->timerValue[PROBES_NUMBER]==0) {
|
||||||
if (thisDetector->myDetectorType==JUNGFRAUCTB) {
|
if (thisDetector->myDetectorType==JUNGFRAUCTB) {
|
||||||
|
|
||||||
for (ichan=0; ichan<nn; ichan++) {
|
for (ichan=0; ichan<nn; ++ichan) {
|
||||||
// // }
|
// // }
|
||||||
dataout[ichan]=*((u_int16_t*)ptr);
|
dataout[ichan]=*((u_int16_t*)ptr);
|
||||||
ptr+=2;
|
ptr+=2;
|
||||||
@ -5376,38 +5376,38 @@ double* slsDetector::decodeData(int *datain, int &nn, double *fdata) {
|
|||||||
} else {
|
} else {
|
||||||
switch (nbits) {
|
switch (nbits) {
|
||||||
case 1:
|
case 1:
|
||||||
for (ibyte=0; ibyte<thisDetector->dataBytes; ibyte++) {
|
for (ibyte=0; ibyte<thisDetector->dataBytes; ++ibyte) {
|
||||||
iptr=ptr[ibyte];//&0x1;
|
iptr=ptr[ibyte];//&0x1;
|
||||||
for (ipos=0; ipos<8; ipos++) {
|
for (ipos=0; ipos<8; ++ipos) {
|
||||||
// dataout[ibyte*2+ichan]=((iptr&((0xf)<<ichan))>>ichan)&0xf;
|
// dataout[ibyte*2+ichan]=((iptr&((0xf)<<ichan))>>ichan)&0xf;
|
||||||
ival=(iptr>>(ipos))&0x1;
|
ival=(iptr>>(ipos))&0x1;
|
||||||
dataout[ichan]=ival;
|
dataout[ichan]=ival;
|
||||||
ichan++;
|
++ichan;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
for (ibyte=0; ibyte<thisDetector->dataBytes; ibyte++) {
|
for (ibyte=0; ibyte<thisDetector->dataBytes; ++ibyte) {
|
||||||
iptr=ptr[ibyte];
|
iptr=ptr[ibyte];
|
||||||
for (ipos=0; ipos<2; ipos++) {
|
for (ipos=0; ipos<2; ++ipos) {
|
||||||
// dataout[ibyte*2+ichan]=((iptr&((0xf)<<ichan))>>ichan)&0xf;
|
// dataout[ibyte*2+ichan]=((iptr&((0xf)<<ichan))>>ichan)&0xf;
|
||||||
ival=(iptr>>(ipos*4))&0xf;
|
ival=(iptr>>(ipos*4))&0xf;
|
||||||
dataout[ichan]=ival;
|
dataout[ichan]=ival;
|
||||||
ichan++;
|
++ichan;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
for (ichan=0; ichan<thisDetector->dataBytes; ichan++) {
|
for (ichan=0; ichan<thisDetector->dataBytes; ++ichan) {
|
||||||
ival=ptr[ichan]&0xff;
|
ival=ptr[ichan]&0xff;
|
||||||
dataout[ichan]=ival;
|
dataout[ichan]=ival;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 16:
|
case 16:
|
||||||
for (ichan=0; ichan<nch; ichan++) {
|
for (ichan=0; ichan<nch; ++ichan) {
|
||||||
// dataout[ichan]=0;
|
// dataout[ichan]=0;
|
||||||
// ival=0;
|
// ival=0;
|
||||||
// for (ibyte=0; ibyte<2; ibyte++) {
|
// for (ibyte=0; ibyte<2; ++ibyte) {
|
||||||
// iptr=ptr[ichan*2+ibyte];
|
// iptr=ptr[ichan*2+ibyte];
|
||||||
// ival|=((iptr<<(ibyte*bytesize))&(0xff<<(ibyte*bytesize)));
|
// ival|=((iptr<<(ibyte*bytesize))&(0xff<<(ibyte*bytesize)));
|
||||||
// }
|
// }
|
||||||
@ -5418,13 +5418,13 @@ double* slsDetector::decodeData(int *datain, int &nn, double *fdata) {
|
|||||||
default:
|
default:
|
||||||
int mask=0xffffffff;
|
int mask=0xffffffff;
|
||||||
if(thisDetector->myDetectorType == MYTHEN) mask=0xffffff;
|
if(thisDetector->myDetectorType == MYTHEN) mask=0xffffff;
|
||||||
for (ichan=0; ichan<nch; ichan++) {
|
for (ichan=0; ichan<nch; ++ichan) {
|
||||||
dataout[ichan]=datain[ichan]&mask;
|
dataout[ichan]=datain[ichan]&mask;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (ichan=0; ichan<nch; ichan++) {
|
for (ichan=0; ichan<nch; ++ichan) {
|
||||||
dataout[ichan]=datain[ichan];
|
dataout[ichan]=datain[ichan];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5485,7 +5485,7 @@ int slsDetector::setFlatFieldCorrection(string fname)
|
|||||||
int nm=getNMods();
|
int nm=getNMods();
|
||||||
int chpm[nm];
|
int chpm[nm];
|
||||||
int mMask[nm];
|
int mMask[nm];
|
||||||
for (int i=0; i<nm; i++) {
|
for (int i=0; i<nm; ++i) {
|
||||||
chpm[im]=getChansPerMod(im);
|
chpm[im]=getChansPerMod(im);
|
||||||
mMask[im]=im;
|
mMask[im]=im;
|
||||||
}
|
}
|
||||||
@ -5512,7 +5512,7 @@ int slsDetector::setFlatFieldCorrection(string fname)
|
|||||||
|
|
||||||
int slsDetector::fillModuleMask(int *mM){
|
int slsDetector::fillModuleMask(int *mM){
|
||||||
if (mM)
|
if (mM)
|
||||||
for (int i=0; i<getNMods(); i++)
|
for (int i=0; i<getNMods(); ++i)
|
||||||
mM[i]=i;
|
mM[i]=i;
|
||||||
|
|
||||||
return getNMods();
|
return getNMods();
|
||||||
@ -5521,7 +5521,7 @@ int slsDetector::fillModuleMask(int *mM){
|
|||||||
|
|
||||||
int slsDetector::setFlatFieldCorrection(double *corr, double *ecorr) {
|
int slsDetector::setFlatFieldCorrection(double *corr, double *ecorr) {
|
||||||
if (corr!=NULL) {
|
if (corr!=NULL) {
|
||||||
for (int ichan=0; ichan<thisDetector->nMod[Y]*thisDetector->nMod[X]*thisDetector->nChans*thisDetector->nChips; ichan++) {
|
for (int ichan=0; ichan<thisDetector->nMod[Y]*thisDetector->nMod[X]*thisDetector->nChans*thisDetector->nChips; ++ichan) {
|
||||||
// #ifdef VERBOSE
|
// #ifdef VERBOSE
|
||||||
// std::cout<< ichan << " "<< corr[ichan] << std::endl;
|
// std::cout<< ichan << " "<< corr[ichan] << std::endl;
|
||||||
// #endif
|
// #endif
|
||||||
@ -5559,7 +5559,7 @@ int slsDetector::getFlatFieldCorrection(double *corr, double *ecorr) {
|
|||||||
std::cout<< "Flat field correction is enabled" << std::endl;
|
std::cout<< "Flat field correction is enabled" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
if (corr) {
|
if (corr) {
|
||||||
for (int ichan=0; ichan<thisDetector->nMod[X]*thisDetector->nMod[Y]*thisDetector->nChans*thisDetector->nChips; ichan++) {
|
for (int ichan=0; ichan<thisDetector->nMod[X]*thisDetector->nMod[Y]*thisDetector->nChans*thisDetector->nChips; ++ichan) {
|
||||||
// corr[ichan]=(ffcoefficients[ichan]*ffcoefficients[ichan])/(fferrors[ichan]*fferrors[ichan]);
|
// corr[ichan]=(ffcoefficients[ichan]*ffcoefficients[ichan])/(fferrors[ichan]*fferrors[ichan]);
|
||||||
corr[ichan]=ffcoefficients[ichan];
|
corr[ichan]=ffcoefficients[ichan];
|
||||||
if (ecorr) {
|
if (ecorr) {
|
||||||
@ -5574,7 +5574,7 @@ int slsDetector::getFlatFieldCorrection(double *corr, double *ecorr) {
|
|||||||
std::cout<< "Flat field correction is disabled" << std::endl;
|
std::cout<< "Flat field correction is disabled" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
if (corr)
|
if (corr)
|
||||||
for (int ichan=0; ichan<thisDetector->nMod[X]*thisDetector->nMod[Y]*thisDetector->nChans*thisDetector->nChips; ichan++) {
|
for (int ichan=0; ichan<thisDetector->nMod[X]*thisDetector->nMod[Y]*thisDetector->nChans*thisDetector->nChips; ++ichan) {
|
||||||
corr[ichan]=1;
|
corr[ichan]=1;
|
||||||
if (ecorr)
|
if (ecorr)
|
||||||
ecorr[ichan]=0;
|
ecorr[ichan]=0;
|
||||||
@ -5591,7 +5591,7 @@ int slsDetector::flatFieldCorrect(double* datain, double *errin, double* dataout
|
|||||||
#endif
|
#endif
|
||||||
double e, eo;
|
double e, eo;
|
||||||
if (thisDetector->correctionMask & (1<<FLAT_FIELD_CORRECTION)) {
|
if (thisDetector->correctionMask & (1<<FLAT_FIELD_CORRECTION)) {
|
||||||
for (int ichan=0; ichan<thisDetector->nMod[X]*thisDetector->nChans*thisDetector->nChips; ichan++) {
|
for (int ichan=0; ichan<thisDetector->nMod[X]*thisDetector->nChans*thisDetector->nChips; ++ichan) {
|
||||||
if (errin==NULL) {
|
if (errin==NULL) {
|
||||||
e=0;
|
e=0;
|
||||||
} else {
|
} else {
|
||||||
@ -5765,7 +5765,7 @@ int slsDetector::rateCorrect(double* datain, double *errin, double* dataout, dou
|
|||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout<< "Rate correcting data with dead time "<< tau << " and acquisition time "<< t << std::endl;
|
std::cout<< "Rate correcting data with dead time "<< tau << " and acquisition time "<< t << std::endl;
|
||||||
#endif
|
#endif
|
||||||
for (int ichan=0; ichan<thisDetector->nMod[X]*thisDetector->nMod[Y]*thisDetector->nChans*thisDetector->nChips; ichan++) {
|
for (int ichan=0; ichan<thisDetector->nMod[X]*thisDetector->nMod[Y]*thisDetector->nChans*thisDetector->nChips; ++ichan) {
|
||||||
|
|
||||||
if (errin==NULL) {
|
if (errin==NULL) {
|
||||||
e=sqrt(datain[ichan]);
|
e=sqrt(datain[ichan]);
|
||||||
@ -5824,10 +5824,10 @@ int slsDetector::setBadChannelCorrection(int nch, int *chs, int ff) {
|
|||||||
if (nch<MAX_BADCHANS && nch>0) {
|
if (nch<MAX_BADCHANS && nch>0) {
|
||||||
thisDetector->correctionMask|=(1<<DISCARD_BAD_CHANNELS);
|
thisDetector->correctionMask|=(1<<DISCARD_BAD_CHANNELS);
|
||||||
thisDetector->nBadChans=0;
|
thisDetector->nBadChans=0;
|
||||||
for (int ich=0 ;ich<nch; ich++) {
|
for (int ich=0 ;ich<nch; ++ich) {
|
||||||
if (chs[ich]>=0 && chs[ich]<getMaxNumberOfChannels()) {
|
if (chs[ich]>=0 && chs[ich]<getMaxNumberOfChannels()) {
|
||||||
thisDetector->badChansList[ich]=chs[ich];
|
thisDetector->badChansList[ich]=chs[ich];
|
||||||
thisDetector->nBadChans++;
|
++thisDetector->nBadChans;
|
||||||
// cout << "det : " << thisDetector->nBadChans << " " << thisDetector->badChansList[ich] << endl;
|
// cout << "det : " << thisDetector->nBadChans << " " << thisDetector->badChansList[ich] << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5836,7 +5836,7 @@ int slsDetector::setBadChannelCorrection(int nch, int *chs, int ff) {
|
|||||||
} else {
|
} else {
|
||||||
if (nch<MAX_BADCHANS && nch>0) {
|
if (nch<MAX_BADCHANS && nch>0) {
|
||||||
thisDetector->nBadFF=nch;
|
thisDetector->nBadFF=nch;
|
||||||
for (int ich=0 ;ich<nch; ich++) {
|
for (int ich=0 ;ich<nch; ++ich) {
|
||||||
thisDetector->badFFList[ich]=chs[ich];
|
thisDetector->badFFList[ich]=chs[ich];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5863,9 +5863,9 @@ int slsDetector::getBadChannelCorrection(int *bad) {
|
|||||||
int ichan;
|
int ichan;
|
||||||
if (thisDetector->correctionMask&(1<< DISCARD_BAD_CHANNELS)) {
|
if (thisDetector->correctionMask&(1<< DISCARD_BAD_CHANNELS)) {
|
||||||
if (bad) {
|
if (bad) {
|
||||||
for (ichan=0; ichan<thisDetector->nBadChans; ichan++)
|
for (ichan=0; ichan<thisDetector->nBadChans; ++ichan)
|
||||||
bad[ichan]=thisDetector->badChansList[ichan];
|
bad[ichan]=thisDetector->badChansList[ichan];
|
||||||
for (int ich=0; ich<thisDetector->nBadFF; ich++)
|
for (int ich=0; ich<thisDetector->nBadFF; ++ich)
|
||||||
bad[ichan+ich]=thisDetector->badFFList[ich];
|
bad[ichan+ich]=thisDetector->badFFList[ich];
|
||||||
}
|
}
|
||||||
return thisDetector->nBadChans+thisDetector->nBadFF;
|
return thisDetector->nBadChans+thisDetector->nBadFF;
|
||||||
@ -6125,7 +6125,8 @@ string slsDetector::setReceiver(string receiverIP){
|
|||||||
else
|
else
|
||||||
printf("Disabling Data Streaming\n");
|
printf("Disabling Data Streaming\n");
|
||||||
// push client state to receiver
|
// push client state to receiver
|
||||||
parentDet->enableDataStreamingFromReceiver(clientSockets);
|
/*parentDet->enableDataStreamingFromReceiver(clientSockets);*/
|
||||||
|
enableDataStreamingFromReceiver(clientSockets);
|
||||||
pthread_mutex_unlock(&ms);
|
pthread_mutex_unlock(&ms);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -6445,7 +6446,7 @@ int slsDetector::configureMAC(){
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
for(i=0;i<2;i++){
|
for(i=0;i<2;++i){
|
||||||
if(!strcmp(arg[i],"none")){
|
if(!strcmp(arg[i],"none")){
|
||||||
std::cout<< "Configure MAC Error. IP/MAC Addresses not set"<< std::endl;
|
std::cout<< "Configure MAC Error. IP/MAC Addresses not set"<< std::endl;
|
||||||
setErrorMask((getErrorMask())|(COULD_NOT_CONFIGURE_MAC));
|
setErrorMask((getErrorMask())|(COULD_NOT_CONFIGURE_MAC));
|
||||||
@ -6590,7 +6591,7 @@ int slsDetector::configureMAC(){
|
|||||||
int slsDetector::getAngularConversion(int &direction, angleConversionConstant *angconv) {
|
int slsDetector::getAngularConversion(int &direction, angleConversionConstant *angconv) {
|
||||||
direction=thisDetector->angDirection;
|
direction=thisDetector->angDirection;
|
||||||
if (angconv) {
|
if (angconv) {
|
||||||
for (int imod=0; imod<thisDetector->nMods; imod++) {
|
for (int imod=0; imod<thisDetector->nMods; ++imod) {
|
||||||
(angconv+imod)->center=thisDetector->angOff[imod].center;
|
(angconv+imod)->center=thisDetector->angOff[imod].center;
|
||||||
(angconv+imod)->r_conversion=thisDetector->angOff[imod].r_conversion;
|
(angconv+imod)->r_conversion=thisDetector->angOff[imod].r_conversion;
|
||||||
(angconv+imod)->offset=thisDetector->angOff[imod].offset;
|
(angconv+imod)->offset=thisDetector->angOff[imod].offset;
|
||||||
@ -6886,7 +6887,7 @@ int slsDetector::readConfigurationFile(ifstream &infile){
|
|||||||
sargname="none";
|
sargname="none";
|
||||||
sargval="0";
|
sargval="0";
|
||||||
getline(infile,str);
|
getline(infile,str);
|
||||||
iline++;
|
++iline;
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout<< str << std::endl;
|
std::cout<< str << std::endl;
|
||||||
#endif
|
#endif
|
||||||
@ -6912,7 +6913,7 @@ int slsDetector::readConfigurationFile(ifstream &infile){
|
|||||||
#endif
|
#endif
|
||||||
strcpy(myargs[iargval],sargname.c_str());
|
strcpy(myargs[iargval],sargname.c_str());
|
||||||
args[iargval]=myargs[iargval];
|
args[iargval]=myargs[iargval];
|
||||||
iargval++;
|
++iargval;
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
ans=cmd->executeLine(iargval,args,PUT_ACTION);
|
ans=cmd->executeLine(iargval,args,PUT_ACTION);
|
||||||
@ -6920,7 +6921,7 @@ int slsDetector::readConfigurationFile(ifstream &infile){
|
|||||||
std::cout<< ans << std::endl;
|
std::cout<< ans << std::endl;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
iline++;
|
++iline;
|
||||||
}
|
}
|
||||||
delete cmd;
|
delete cmd;
|
||||||
return OK;
|
return OK;
|
||||||
@ -7022,17 +7023,17 @@ int slsDetector::writeConfigurationFile(ofstream &outfile, int id){
|
|||||||
char *args[100];
|
char *args[100];
|
||||||
char myargs[100][1000];
|
char myargs[100][1000];
|
||||||
|
|
||||||
for (int ia=0; ia<100; ia++) {
|
for (int ia=0; ia<100; ++ia) {
|
||||||
//args[ia]=new char[1000];
|
//args[ia]=new char[1000];
|
||||||
|
|
||||||
args[ia]=myargs[ia];
|
args[ia]=myargs[ia];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for (iv=0; iv<nvar; iv++) {
|
for (iv=0; iv<nvar; ++iv) {
|
||||||
cout << iv << " " << names[iv] << endl;
|
cout << iv << " " << names[iv] << endl;
|
||||||
if (names[iv]=="extsig") {
|
if (names[iv]=="extsig") {
|
||||||
for (int is=0; is<nsig; is++) {
|
for (int is=0; is<nsig; ++is) {
|
||||||
sprintf(args[0],"%s:%d",names[iv].c_str(),is);
|
sprintf(args[0],"%s:%d",names[iv].c_str(),is);
|
||||||
|
|
||||||
if (id>=0)
|
if (id>=0)
|
||||||
@ -7109,17 +7110,17 @@ int slsDetector::programFPGA(string fname){
|
|||||||
FILE* src = fopen(fname.c_str(),"rb");
|
FILE* src = fopen(fname.c_str(),"rb");
|
||||||
FILE* dst = fopen(destfname.c_str(),"wb");
|
FILE* dst = fopen(destfname.c_str(),"wb");
|
||||||
// Remove header (0...11C)
|
// Remove header (0...11C)
|
||||||
for (filepos=0; filepos < 0x11C; filepos++)
|
for (filepos=0; filepos < 0x11C; ++filepos)
|
||||||
fgetc(src);
|
fgetc(src);
|
||||||
// Write 0x80 times 0xFF (0...7F)
|
// Write 0x80 times 0xFF (0...7F)
|
||||||
for (filepos=0; filepos < 0x80; filepos++)
|
for (filepos=0; filepos < 0x80; ++filepos)
|
||||||
fputc(0xFF,dst);
|
fputc(0xFF,dst);
|
||||||
// Swap bits and write to file
|
// Swap bits and write to file
|
||||||
for (filepos=0x80; filepos < 0x1000000; filepos++) {
|
for (filepos=0x80; filepos < 0x1000000; ++filepos) {
|
||||||
x = fgetc(src);
|
x = fgetc(src);
|
||||||
if (x < 0) break;
|
if (x < 0) break;
|
||||||
y=0;
|
y=0;
|
||||||
for (i=0; i < 8; i++)
|
for (i=0; i < 8; ++i)
|
||||||
y=y| ( (( x & (1<<i) ) >> i) << (7-i) ); // This swaps the bits
|
y=y| ( (( x & (1<<i) ) >> i) << (7-i) ); // This swaps the bits
|
||||||
fputc(y,dst);
|
fputc(y,dst);
|
||||||
}
|
}
|
||||||
@ -7199,7 +7200,7 @@ int slsDetector::programFPGA(string fname){
|
|||||||
int count = 66;
|
int count = 66;
|
||||||
while(count>0){
|
while(count>0){
|
||||||
usleep(1 * 1000 * 1000);
|
usleep(1 * 1000 * 1000);
|
||||||
count--;
|
--count;
|
||||||
printf("Erasing Flash:%d%%\r",(int) (((double)(65-count)/65)*100));
|
printf("Erasing Flash:%d%%\r",(int) (((double)(65-count)/65)*100));
|
||||||
std::cout << flush;
|
std::cout << flush;
|
||||||
}
|
}
|
||||||
@ -7348,7 +7349,7 @@ int slsDetector::loadSettingsFile(string fname, int imod) {
|
|||||||
mmin=imod;
|
mmin=imod;
|
||||||
mmax=imod+1;
|
mmax=imod+1;
|
||||||
}
|
}
|
||||||
for (int im=mmin; im<mmax; im++) {
|
for (int im=mmin; im<mmax; ++im) {
|
||||||
ostringstream ostfn;
|
ostringstream ostfn;
|
||||||
ostfn << fname;
|
ostfn << fname;
|
||||||
if(thisDetector->myDetectorType != EIGER){
|
if(thisDetector->myDetectorType != EIGER){
|
||||||
@ -7388,7 +7389,7 @@ int slsDetector::saveSettingsFile(string fname, int imod) {
|
|||||||
mmin=imod;
|
mmin=imod;
|
||||||
mmax=imod+1;
|
mmax=imod+1;
|
||||||
}
|
}
|
||||||
for (int im=mmin; im<mmax; im++) {
|
for (int im=mmin; im<mmax; ++im) {
|
||||||
ostringstream ostfn;
|
ostringstream ostfn;
|
||||||
if(thisDetector->myDetectorType == EIGER){
|
if(thisDetector->myDetectorType == EIGER){
|
||||||
ostfn << fname << ".sn" << setfill('0') << setw(3) << dec << getId(DETECTOR_SERIAL_NUMBER);
|
ostfn << fname << ".sn" << setfill('0') << setw(3) << dec << getId(DETECTOR_SERIAL_NUMBER);
|
||||||
@ -7459,12 +7460,12 @@ int slsDetector::loadCalibrationFile(string fname, int imod) {
|
|||||||
int* gainval=0; int* offsetval=0;
|
int* gainval=0; int* offsetval=0;
|
||||||
if(thisDetector->nGain){
|
if(thisDetector->nGain){
|
||||||
gainval=new int[thisDetector->nGain];
|
gainval=new int[thisDetector->nGain];
|
||||||
for(int i=0;i<thisDetector->nGain;i++)
|
for(int i=0;i<thisDetector->nGain;++i)
|
||||||
gainval[i] = -1;
|
gainval[i] = -1;
|
||||||
}
|
}
|
||||||
if(thisDetector->nOffset){
|
if(thisDetector->nOffset){
|
||||||
offsetval=new int[thisDetector->nOffset];
|
offsetval=new int[thisDetector->nOffset];
|
||||||
for(int i=0;i<thisDetector->nOffset;i++)
|
for(int i=0;i<thisDetector->nOffset;++i)
|
||||||
offsetval[i] = -1;
|
offsetval[i] = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7476,7 +7477,7 @@ int slsDetector::loadCalibrationFile(string fname, int imod) {
|
|||||||
mmin=imod;
|
mmin=imod;
|
||||||
mmax=imod+1;
|
mmax=imod+1;
|
||||||
}
|
}
|
||||||
for (int im=mmin; im<mmax; im++) {
|
for (int im=mmin; im<mmax; ++im) {
|
||||||
ostringstream ostfn;
|
ostringstream ostfn;
|
||||||
ostfn << fname ;
|
ostfn << fname ;
|
||||||
if(thisDetector->myDetectorType != EIGER){
|
if(thisDetector->myDetectorType != EIGER){
|
||||||
@ -7520,7 +7521,7 @@ int slsDetector::saveCalibrationFile(string fname, int imod) {
|
|||||||
mmin=imod;
|
mmin=imod;
|
||||||
mmax=imod+1;
|
mmax=imod+1;
|
||||||
}
|
}
|
||||||
for (int im=mmin; im<mmax; im++) {
|
for (int im=mmin; im<mmax; ++im) {
|
||||||
ostringstream ostfn;
|
ostringstream ostfn;
|
||||||
if(thisDetector->myDetectorType == EIGER)
|
if(thisDetector->myDetectorType == EIGER)
|
||||||
ostfn << fname << ".sn" << setfill('0') << setw(3) << dec << getId(DETECTOR_SERIAL_NUMBER);
|
ostfn << fname << ".sn" << setfill('0') << setw(3) << dec << getId(DETECTOR_SERIAL_NUMBER);
|
||||||
@ -7639,19 +7640,23 @@ slsDetectorDefs::synchronizationMode slsDetector::setSynchronization(synchroniza
|
|||||||
|
|
||||||
/*receiver*/
|
/*receiver*/
|
||||||
int slsDetector::setReceiverOnline(int off) {
|
int slsDetector::setReceiverOnline(int off) {
|
||||||
// int prev = thisDetector->receiverOnlineFlag;
|
if (off!=GET_ONLINE_FLAG) {
|
||||||
if (off!=GET_ONLINE_FLAG) {
|
// setting flag to offline
|
||||||
if(strcmp(thisDetector->receiver_hostname,"none")){
|
if (off == OFFLINE_FLAG)
|
||||||
thisDetector->receiverOnlineFlag=off;
|
thisDetector->receiverOnlineFlag = off;
|
||||||
if (thisDetector->receiverOnlineFlag==ONLINE_FLAG){
|
// set flag to online only if hostname not none
|
||||||
setReceiverTCPSocket();
|
else if(strcmp(thisDetector->receiver_hostname,"none")){
|
||||||
if(thisDetector->receiverOnlineFlag==OFFLINE_FLAG){
|
thisDetector->receiverOnlineFlag=off;
|
||||||
std::cout << "cannot connect to receiver" << endl;
|
}
|
||||||
setErrorMask((getErrorMask())|(CANNOT_CONNECT_TO_RECEIVER));
|
if (thisDetector->receiverOnlineFlag==ONLINE_FLAG){
|
||||||
}
|
setReceiverTCPSocket();
|
||||||
}
|
// error in connecting
|
||||||
}
|
if(thisDetector->receiverOnlineFlag==OFFLINE_FLAG){
|
||||||
}
|
std::cout << "cannot connect to receiver" << endl;
|
||||||
|
setErrorMask((getErrorMask())|(CANNOT_CONNECT_TO_RECEIVER));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return thisDetector->receiverOnlineFlag;
|
return thisDetector->receiverOnlineFlag;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7821,17 +7826,14 @@ string slsDetector::setFileName(string s) {
|
|||||||
int ret = FAIL;
|
int ret = FAIL;
|
||||||
char arg[MAX_STR_LENGTH]="";
|
char arg[MAX_STR_LENGTH]="";
|
||||||
char retval[MAX_STR_LENGTH]="";
|
char retval[MAX_STR_LENGTH]="";
|
||||||
|
string sretval="";
|
||||||
|
|
||||||
if(!s.empty()){
|
/*if(!s.empty()){
|
||||||
pthread_mutex_lock(&ms);
|
pthread_mutex_lock(&ms);
|
||||||
fileIO::setFileName(s);
|
fileIO::setFileName(s);
|
||||||
/*if(thisDetector->myDetectorType == EIGER)
|
|
||||||
parentDet->setDetectorIndex(posId);
|
|
||||||
else if(parentDet->getNumberOfDetectors()>1)
|
|
||||||
parentDet->setDetectorIndex(-1);*/
|
|
||||||
s=parentDet->createReceiverFilePrefix();
|
s=parentDet->createReceiverFilePrefix();
|
||||||
pthread_mutex_unlock(&ms);
|
pthread_mutex_unlock(&ms);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
if(thisDetector->receiverOnlineFlag==ONLINE_FLAG){
|
if(thisDetector->receiverOnlineFlag==ONLINE_FLAG){
|
||||||
strcpy(arg,s.c_str());
|
strcpy(arg,s.c_str());
|
||||||
@ -7846,20 +7848,25 @@ string slsDetector::setFileName(string s) {
|
|||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout << "Complete file prefix from receiver: " << retval << std::endl;
|
std::cout << "Complete file prefix from receiver: " << retval << std::endl;
|
||||||
#endif
|
#endif
|
||||||
|
/*
|
||||||
pthread_mutex_lock(&ms);
|
pthread_mutex_lock(&ms);
|
||||||
fileIO::setFileName(parentDet->getNameFromReceiverFilePrefix(string(retval)));
|
fileIO::setFileName(parentDet->getNameFromReceiverFilePrefix(string(retval)));
|
||||||
pthread_mutex_unlock(&ms);
|
pthread_mutex_unlock(&ms);
|
||||||
|
*/
|
||||||
|
sretval = fileIO::getNameFromReceiverFilePrefix(string(retval));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ret==FORCE_UPDATE)
|
if(ret==FORCE_UPDATE)
|
||||||
updateReceiver();
|
updateReceiver();
|
||||||
}
|
}
|
||||||
|
|
||||||
pthread_mutex_lock(&ms);
|
/*pthread_mutex_lock(&ms);
|
||||||
s = fileIO::getFileName();
|
s = fileIO::getFileName();
|
||||||
pthread_mutex_unlock(&ms);
|
pthread_mutex_unlock(&ms);
|
||||||
|
|
||||||
return s;
|
return s;*/
|
||||||
|
return sretval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -8169,7 +8176,7 @@ int slsDetector::resetFramesCaught(){
|
|||||||
// return NULL; }
|
// return NULL; }
|
||||||
// //jungfrau masking adcval
|
// //jungfrau masking adcval
|
||||||
// if(thisDetector->myDetectorType == JUNGFRAU){
|
// if(thisDetector->myDetectorType == JUNGFRAU){
|
||||||
// for(unsigned int i=0;i<nel;i++){
|
// for(unsigned int i=0;i<nel;++i){
|
||||||
// retval[i] = (retval[i] & 0x3FFF3FFF);
|
// retval[i] = (retval[i] & 0x3FFF3FFF);
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
@ -8509,7 +8516,7 @@ int64_t slsDetector::clearAllErrorMask(){
|
|||||||
clearErrorMask();
|
clearErrorMask();
|
||||||
|
|
||||||
pthread_mutex_lock(&ms);
|
pthread_mutex_lock(&ms);
|
||||||
for(int i=0;i<parentDet->getNumberOfDetectors();i++){
|
for(int i=0;i<parentDet->getNumberOfDetectors();++i){
|
||||||
if(parentDet->getDetectorId(i) == getDetectorId())
|
if(parentDet->getDetectorId(i) == getDetectorId())
|
||||||
parentDet->setErrorMask(parentDet->getErrorMask()|(0<<i));
|
parentDet->setErrorMask(parentDet->getErrorMask()|(0<<i));
|
||||||
}
|
}
|
||||||
@ -8818,7 +8825,7 @@ int slsDetector::setCTBPattern(string fname) {
|
|||||||
while (fread(&word, sizeof(word), 1,fd)) {
|
while (fread(&word, sizeof(word), 1,fd)) {
|
||||||
setCTBWord(addr,word);
|
setCTBWord(addr,word);
|
||||||
// cout << hex << addr << " " << word << dec << endl;
|
// cout << hex << addr << " " << word << dec << endl;
|
||||||
addr++;
|
++addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(fd);
|
fclose(fd);
|
||||||
|
@ -1638,6 +1638,11 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
|
|||||||
*/
|
*/
|
||||||
int getFramesCaughtByReceiver();
|
int getFramesCaughtByReceiver();
|
||||||
|
|
||||||
|
/** gets the number of frames caught by any one receiver (to avoid using threadpool)
|
||||||
|
\returns number of frames caught by any one receiver (master receiver if exists)
|
||||||
|
*/
|
||||||
|
int getFramesCaughtByAnyReceiver() {getFramesCaughtByReceiver();};
|
||||||
|
|
||||||
/** gets the current frame index of receiver
|
/** gets the current frame index of receiver
|
||||||
\returns current frame index of receiver
|
\returns current frame index of receiver
|
||||||
*/
|
*/
|
||||||
|
@ -380,6 +380,54 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
|
|||||||
int64_t setNumberOfFrames(int64_t t=-1){return setTimer(FRAME_NUMBER,t);};
|
int64_t setNumberOfFrames(int64_t t=-1){return setTimer(FRAME_NUMBER,t);};
|
||||||
int64_t setNumberOfCycles(int64_t t=-1){return setTimer(CYCLES_NUMBER,t);};
|
int64_t setNumberOfCycles(int64_t t=-1){return setTimer(CYCLES_NUMBER,t);};
|
||||||
|
|
||||||
|
|
||||||
|
/** sets/gets the value of important readout speed parameters
|
||||||
|
\param sp is the parameter to be set/get
|
||||||
|
\param value is the value to be set, if -1 get value
|
||||||
|
\returns current value for the specified parameter
|
||||||
|
\sa speedVariable
|
||||||
|
*/
|
||||||
|
virtual int setSpeed(speedVariable sp, int value=-1)=0;
|
||||||
|
int setClockDivider(int s=-1){return setSpeed(CLOCK_DIVIDER,s);};
|
||||||
|
|
||||||
|
/**
|
||||||
|
set/get readout flags
|
||||||
|
\param flag readout flag to be set
|
||||||
|
\returns current flag
|
||||||
|
*/
|
||||||
|
virtual int setReadOutFlags(readOutFlags flag=GET_READOUT_FLAGS)=0;
|
||||||
|
int getContinuousReadoutFlag(){if(setReadOutFlags()&CONTINOUS_RO) return OK; return FAIL;};
|
||||||
|
void setContinuousReadoutFlag(){setReadOutFlags(CONTINOUS_RO); };
|
||||||
|
int getStoreInRamReadoutFlag(){if(setReadOutFlags()&STORE_IN_RAM) return OK; return FAIL;};
|
||||||
|
void setStoreInRamReadoutFlag(){setReadOutFlags(STORE_IN_RAM); };
|
||||||
|
int getParallelReadoutFlag(){if(setReadOutFlags()&PARALLEL) return OK; return FAIL;};
|
||||||
|
void setParallelReadoutFlag(){setReadOutFlags(PARALLEL); };
|
||||||
|
int getNonParallelReadoutFlag(){if(setReadOutFlags()&NONPARALLEL) return OK; return FAIL;};
|
||||||
|
void setNonParallelReadoutFlag(){setReadOutFlags(NONPARALLEL); };
|
||||||
|
int getSafeReadoutFlag(){if(setReadOutFlags()&SAFE) return OK; return FAIL;};
|
||||||
|
void setSafeReadoutFlag(){setReadOutFlags(SAFE); };
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
set dacs value
|
||||||
|
\param val value (in V)
|
||||||
|
\param index DAC index
|
||||||
|
\param mV 0 in dac units or 1 in mV
|
||||||
|
\param imod module number (if -1 alla modules)
|
||||||
|
\returns current DAC value
|
||||||
|
*/
|
||||||
|
virtual dacs_t setDAC(dacs_t val, dacIndex index , int mV, int imod=-1)=0;
|
||||||
|
int setDACValue(int val, int index , int mV, int imod=-1) { return (int)setDAC((dacs_t)val,(dacIndex)index, mV,imod);};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
gets ADC value
|
||||||
|
\param index ADC index
|
||||||
|
\param imod module number
|
||||||
|
\returns current ADC value
|
||||||
|
*/
|
||||||
|
virtual dacs_t getADC(dacIndex index, int imod=-1)=0;
|
||||||
|
int getADCValue(int index, int imod=-1){return (int)getADC((dacIndex)index, imod);};
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////
|
||||||
/**
|
/**
|
||||||
@short get run status
|
@short get run status
|
||||||
@ -490,6 +538,11 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
|
|||||||
*/
|
*/
|
||||||
virtual int getFramesCaughtByReceiver()=0;
|
virtual int getFramesCaughtByReceiver()=0;
|
||||||
|
|
||||||
|
/** gets the number of frames caught by any one receiver (to avoid using threadpool)
|
||||||
|
\returns number of frames caught by any one receiver (master receiver if exists)
|
||||||
|
*/
|
||||||
|
virtual int getFramesCaughtByAnyReceiver()=0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\returns current frame index of receiver
|
\returns current frame index of receiver
|
||||||
*/
|
*/
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -316,3 +316,70 @@ string slsDetectorUsers::getCommand(int narg, char *args[], int pos){
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int slsDetectorUsers::setClockDivider(int value) {
|
||||||
|
return myDetector->setClockDivider(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int slsDetectorUsers::getContinuousReadoutFlag(){
|
||||||
|
return myDetector->getContinuousReadoutFlag();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void slsDetectorUsers::setContinuousReadoutFlag(){
|
||||||
|
myDetector->setContinuousReadoutFlag();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int slsDetectorUsers::getStoreInRamReadoutFlag(){
|
||||||
|
return myDetector->getStoreInRamReadoutFlag();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void slsDetectorUsers::setStoreInRamReadoutFlag(){
|
||||||
|
myDetector->setStoreInRamReadoutFlag();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int slsDetectorUsers::getParallelReadoutFlag(){
|
||||||
|
return myDetector->getParallelReadoutFlag();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void slsDetectorUsers::setParallelReadoutFlag(){
|
||||||
|
myDetector->setParallelReadoutFlag();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int slsDetectorUsers::getNonParallelReadoutFlag(){
|
||||||
|
return myDetector->getNonParallelReadoutFlag();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void slsDetectorUsers::setNonParallelReadoutFlag(){
|
||||||
|
myDetector->setNonParallelReadoutFlag();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int slsDetectorUsers::getSafeReadoutFlag(){
|
||||||
|
return myDetector->getSafeReadoutFlag();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void slsDetectorUsers::setSafeReadoutFlag(){
|
||||||
|
myDetector->setSafeReadoutFlag();
|
||||||
|
}
|
||||||
|
|
||||||
|
int slsDetectorUsers::setAllTrimbits(int val) {
|
||||||
|
return myDetector->setAllTrimbits(val);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int slsDetectorUsers::setDAC(int id, int dacindex, int val) {
|
||||||
|
return myDetector->setDACValue(val, dacindex, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
int slsDetectorUsers::getADC(int id, int adcindex) {
|
||||||
|
return myDetector->getADCValue(adcindex, id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -541,6 +541,102 @@ class slsDetectorUsers
|
|||||||
*/
|
*/
|
||||||
string getCommand(int narg, char *args[], int pos=-1);
|
string getCommand(int narg, char *args[], int pos=-1);
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
|
|
||||||
|
ADVANCED FUNCTIONS
|
||||||
|
|
||||||
|
*********************************************************************/
|
||||||
|
/**
|
||||||
|
@short sets clock divider of detector
|
||||||
|
\param value value to be set (-1 gets)
|
||||||
|
\returns speed of detector
|
||||||
|
*/
|
||||||
|
int setClockDivider(int value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
@short gets continuous readout flag
|
||||||
|
\returns gets continuous readout flag
|
||||||
|
*/
|
||||||
|
int getContinuousReadoutFlag();
|
||||||
|
|
||||||
|
/**
|
||||||
|
@short sets continuous readout flag
|
||||||
|
\returns OK if successful, else false
|
||||||
|
*/
|
||||||
|
void setContinuousReadoutFlag();
|
||||||
|
|
||||||
|
/**
|
||||||
|
@short gets store in ram readout flag
|
||||||
|
\returns gets store in ram readout flag
|
||||||
|
*/
|
||||||
|
int getStoreInRamReadoutFlag();
|
||||||
|
|
||||||
|
/**
|
||||||
|
@short sets store in ram readout flag
|
||||||
|
\returns OK if successful, else false
|
||||||
|
*/
|
||||||
|
void setStoreInRamReadoutFlag();
|
||||||
|
|
||||||
|
/**
|
||||||
|
@short gets parallel readout flag
|
||||||
|
\returns gets parallel readout flag
|
||||||
|
*/
|
||||||
|
int getParallelReadoutFlag();
|
||||||
|
|
||||||
|
/**
|
||||||
|
@short sets parallel readout flag
|
||||||
|
\returns OK if successful, else false
|
||||||
|
*/
|
||||||
|
void setParallelReadoutFlag();
|
||||||
|
|
||||||
|
/**
|
||||||
|
@short gets non parallel readout flag
|
||||||
|
\returns gets non parallel readout flag
|
||||||
|
*/
|
||||||
|
int getNonParallelReadoutFlag();
|
||||||
|
|
||||||
|
/**
|
||||||
|
@short sets non parallel readout flag
|
||||||
|
\returns OK if successful, else false
|
||||||
|
*/
|
||||||
|
void setNonParallelReadoutFlag();
|
||||||
|
|
||||||
|
/**
|
||||||
|
@short gets safe readout flag
|
||||||
|
\returns gets safe readout flag
|
||||||
|
*/
|
||||||
|
int getSafeReadoutFlag();
|
||||||
|
|
||||||
|
/**
|
||||||
|
@short sets safe readout flag
|
||||||
|
\returns OK if successful, else false
|
||||||
|
*/
|
||||||
|
void setSafeReadoutFlag();
|
||||||
|
|
||||||
|
/**
|
||||||
|
@short sets all trimbits to value (only available for eiger)
|
||||||
|
\param val value to be set (-1 gets)
|
||||||
|
\returns value set
|
||||||
|
*/
|
||||||
|
int setAllTrimbits(int val);
|
||||||
|
|
||||||
|
/**
|
||||||
|
@short set dac value
|
||||||
|
\param id module index (-1 for all)
|
||||||
|
\param dacindex dac index \sa dacIndex
|
||||||
|
\param val value to be set (-1 gets)
|
||||||
|
\returns dac value
|
||||||
|
*/
|
||||||
|
int setDAC(int id, int dacindex, int val);
|
||||||
|
|
||||||
|
/**
|
||||||
|
@short get adc value
|
||||||
|
\param id module index (-1 for all)
|
||||||
|
\param adcindex adc index \sa dacIndex
|
||||||
|
\returns adc value
|
||||||
|
*/
|
||||||
|
int getADC(int id, int adcindex);
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
|
|
||||||
STATIC FUNCTIONS
|
STATIC FUNCTIONS
|
||||||
@ -627,6 +723,7 @@ class slsDetectorUsers
|
|||||||
if (s== "triggered_gating") return 4; \
|
if (s== "triggered_gating") return 4; \
|
||||||
return -1; };
|
return -1; };
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
multiSlsDetector *myDetector;
|
multiSlsDetector *myDetector;
|
||||||
multiSlsDetectorCommand *myCmd;
|
multiSlsDetectorCommand *myCmd;
|
||||||
|
@ -50,8 +50,10 @@ int slsDetectorUtils::acquire(int delflag){
|
|||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef VERBOSE
|
||||||
struct timespec begin,end;
|
struct timespec begin,end;
|
||||||
clock_gettime(CLOCK_REALTIME, &begin);
|
clock_gettime(CLOCK_REALTIME, &begin);
|
||||||
|
#endif
|
||||||
|
|
||||||
//not in the loop for real time acqusition yet,
|
//not in the loop for real time acqusition yet,
|
||||||
//in the real time acquisition loop, processing thread will wait for a post each time
|
//in the real time acquisition loop, processing thread will wait for a post each time
|
||||||
@ -140,9 +142,8 @@ int slsDetectorUtils::acquire(int delflag){
|
|||||||
if(receiver){
|
if(receiver){
|
||||||
pthread_mutex_lock(&mg); //cout << "lock"<< endl;
|
pthread_mutex_lock(&mg); //cout << "lock"<< endl;
|
||||||
if(getReceiverStatus()!=IDLE)
|
if(getReceiverStatus()!=IDLE)
|
||||||
stopReceiver();
|
if(stopReceiver() == FAIL)
|
||||||
if(setReceiverOnline()==OFFLINE_FLAG)
|
*stoppedFlag=1;
|
||||||
*stoppedFlag=1;
|
|
||||||
pthread_mutex_unlock(&mg);//cout << "unlock"<< endl;
|
pthread_mutex_unlock(&mg);//cout << "unlock"<< endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,12 +157,13 @@ int slsDetectorUtils::acquire(int delflag){
|
|||||||
//resets frames caught in receiver
|
//resets frames caught in receiver
|
||||||
if(receiver){
|
if(receiver){
|
||||||
pthread_mutex_lock(&mg); //cout << "lock"<< endl;
|
pthread_mutex_lock(&mg); //cout << "lock"<< endl;
|
||||||
resetFramesCaught();
|
if (resetFramesCaught() == FAIL)
|
||||||
|
*stoppedFlag=1;
|
||||||
pthread_mutex_unlock(&mg);//cout << "unlock"<< endl;
|
pthread_mutex_unlock(&mg);//cout << "unlock"<< endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for(int im=0;im<nm;im++) {
|
for(int im=0;im<nm;++im) {
|
||||||
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cout << " starting measurement "<< im << " of " << nm << endl;
|
cout << " starting measurement "<< im << " of " << nm << endl;
|
||||||
@ -182,7 +184,7 @@ int slsDetectorUtils::acquire(int delflag){
|
|||||||
executeAction(startScript);
|
executeAction(startScript);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int is0=0; is0<ns0; is0++) {
|
for (int is0=0; is0<ns0; ++is0) {
|
||||||
// cout << "scan0 loop" << endl;
|
// cout << "scan0 loop" << endl;
|
||||||
|
|
||||||
if (*stoppedFlag==0) {
|
if (*stoppedFlag==0) {
|
||||||
@ -191,7 +193,7 @@ int slsDetectorUtils::acquire(int delflag){
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
for (int is1=0; is1<ns1; is1++) {
|
for (int is1=0; is1<ns1; ++is1) {
|
||||||
// cout << "scan1 loop" << endl;
|
// cout << "scan1 loop" << endl;
|
||||||
|
|
||||||
if (*stoppedFlag==0) {
|
if (*stoppedFlag==0) {
|
||||||
@ -206,7 +208,7 @@ int slsDetectorUtils::acquire(int delflag){
|
|||||||
|
|
||||||
ResetPositionIndex();
|
ResetPositionIndex();
|
||||||
|
|
||||||
for (int ip=0; ip<np; ip++) {
|
for (int ip=0; ip<np; ++ip) {
|
||||||
|
|
||||||
// cout << "positions " << endl;
|
// cout << "positions " << endl;
|
||||||
if (*stoppedFlag==0) {
|
if (*stoppedFlag==0) {
|
||||||
@ -332,10 +334,13 @@ int slsDetectorUtils::acquire(int delflag){
|
|||||||
|
|
||||||
while (dataQueueSize()) usleep(100000);
|
while (dataQueueSize()) usleep(100000);
|
||||||
// cout << "mglock " << endl;;
|
// cout << "mglock " << endl;;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
pthread_mutex_lock(&mg); //cout << "lock"<< endl;
|
pthread_mutex_lock(&mg); //cout << "lock"<< endl;
|
||||||
// cout << "done " << endl;;
|
// cout << "done " << endl;;
|
||||||
//offline
|
//offline
|
||||||
if(setReceiverOnline()==OFFLINE_FLAG){
|
if(!receiver){
|
||||||
if ((getDetectorsType()==GOTTHARD) || (getDetectorsType()==MOENCH) || (getDetectorsType()==JUNGFRAU)|| (getDetectorsType()==JUNGFRAUCTB) ){
|
if ((getDetectorsType()==GOTTHARD) || (getDetectorsType()==MOENCH) || (getDetectorsType()==JUNGFRAU)|| (getDetectorsType()==JUNGFRAUCTB) ){
|
||||||
if((*correctionMask)&(1<<WRITE_FILE))
|
if((*correctionMask)&(1<<WRITE_FILE))
|
||||||
closeDataFile();
|
closeDataFile();
|
||||||
@ -343,14 +348,8 @@ int slsDetectorUtils::acquire(int delflag){
|
|||||||
}
|
}
|
||||||
//online
|
//online
|
||||||
else{
|
else{
|
||||||
|
if (stopReceiver() == FAIL)
|
||||||
if(setReceiverOnline(ONLINE_FLAG)!=ONLINE_FLAG){
|
*stoppedFlag = 1;
|
||||||
stopAcquisition();
|
|
||||||
stopReceiver();
|
|
||||||
pthread_mutex_unlock(&mg);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
stopReceiver();
|
|
||||||
// cout<<"***********receiver stopped"<<endl;
|
// cout<<"***********receiver stopped"<<endl;
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(&mg);//cout << "unlock"<< endl;
|
pthread_mutex_unlock(&mg);//cout << "unlock"<< endl;
|
||||||
@ -507,8 +506,8 @@ int slsDetectorUtils::acquire(int delflag){
|
|||||||
setAcquiringFlag(false);
|
setAcquiringFlag(false);
|
||||||
sem_destroy(&sem_newRTAcquisition);
|
sem_destroy(&sem_newRTAcquisition);
|
||||||
|
|
||||||
clock_gettime(CLOCK_REALTIME, &end);
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
|
clock_gettime(CLOCK_REALTIME, &end);
|
||||||
cout << "Elapsed time for acquisition:" << (( end.tv_sec - begin.tv_sec ) + ( end.tv_nsec - begin.tv_nsec ) / 1000000000.0) << " seconds" << endl;
|
cout << "Elapsed time for acquisition:" << (( end.tv_sec - begin.tv_sec ) + ( end.tv_nsec - begin.tv_nsec ) / 1000000000.0) << " seconds" << endl;
|
||||||
#endif
|
#endif
|
||||||
return OK;
|
return OK;
|
||||||
|
@ -669,6 +669,11 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
|
|||||||
*/
|
*/
|
||||||
virtual int getFramesCaughtByReceiver()=0;
|
virtual int getFramesCaughtByReceiver()=0;
|
||||||
|
|
||||||
|
/** gets the number of frames caught by any one receiver (to avoid using threadpool)
|
||||||
|
\returns number of frames caught by any one receiver (master receiver if exists)
|
||||||
|
*/
|
||||||
|
virtual int getFramesCaughtByAnyReceiver()=0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\returns current frame index of receiver
|
\returns current frame index of receiver
|
||||||
*/
|
*/
|
||||||
|
@ -545,7 +545,7 @@ void* postProcessing::processData(int delflag) {
|
|||||||
//get progress
|
//get progress
|
||||||
pthread_mutex_lock(&mg);
|
pthread_mutex_lock(&mg);
|
||||||
if(setReceiverOnline() == ONLINE_FLAG){
|
if(setReceiverOnline() == ONLINE_FLAG){
|
||||||
caught = getFramesCaughtByReceiver();
|
caught = getFramesCaughtByAnyReceiver();
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(&mg);
|
pthread_mutex_unlock(&mg);
|
||||||
|
|
||||||
|
@ -8,189 +8,188 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
#include "Global.h"
|
#include "Global.h"
|
||||||
#include "sls_detector_defs.h"
|
#include "sls_detector_defs.h"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <stdio.h>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
class slsDetector;
|
class slsDetector;
|
||||||
|
|
||||||
template<typename _Ret, typename _Class>
|
template<typename _Ret>
|
||||||
class func00_t{
|
class func00_t{
|
||||||
public:
|
public:
|
||||||
func00_t(_Ret (_Class::*fn)(),_Class* ptr):
|
func00_t(_Ret (slsDetector::*fn)(),slsDetector* ptr):
|
||||||
m_fn(fn),m_ptr(ptr){}
|
m_fn(fn),m_ptr(ptr){}
|
||||||
~func00_t() {}
|
~func00_t() {}
|
||||||
void operator()() const {((m_ptr->*m_fn)());}
|
void operator()() const {((m_ptr->*m_fn)());}
|
||||||
private:
|
private:
|
||||||
_Ret (_Class::*m_fn)();
|
_Ret (slsDetector::*m_fn)();
|
||||||
_Class* m_ptr;
|
slsDetector* m_ptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename _Ret, typename _Class, typename _Store>
|
template<typename _Ret>
|
||||||
class func0_t{
|
class func0_t{
|
||||||
public:
|
public:
|
||||||
func0_t(_Ret (_Class::*fn)(),_Class* ptr, _Store* sto):
|
func0_t(_Ret (slsDetector::*fn)(),slsDetector* ptr, _Ret* sto):
|
||||||
m_fn(fn),m_ptr(ptr),m_store(sto){}
|
m_fn(fn),m_ptr(ptr),m_store(sto){}
|
||||||
~func0_t() {}
|
~func0_t() {}
|
||||||
void operator()() const {*m_store = ((m_ptr->*m_fn)());}
|
void operator()() const {*m_store = ((m_ptr->*m_fn)());}
|
||||||
private:
|
private:
|
||||||
_Ret (_Class::*m_fn)();
|
_Ret (slsDetector::*m_fn)();
|
||||||
_Class* m_ptr;
|
slsDetector* m_ptr;
|
||||||
_Store* m_store;
|
_Ret* m_store;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename _Ret, typename _Class,typename _Arg1, typename _Store>
|
template<typename _Ret,typename _Arg1>
|
||||||
class func1_t{
|
class func1_t{
|
||||||
public:
|
public:
|
||||||
func1_t(_Ret (_Class::*fn)(_Arg1),_Class* ptr,_Arg1 arg1, _Store* sto):
|
func1_t(_Ret (slsDetector::*fn)(_Arg1),slsDetector* ptr,_Arg1 arg1, _Ret* sto):
|
||||||
m_fn(fn),m_ptr(ptr),m_arg1(arg1),m_store(sto){}
|
m_fn(fn),m_ptr(ptr),m_arg1(arg1),m_store(sto){}
|
||||||
~func1_t() {}
|
~func1_t() {}
|
||||||
void operator()() const {*m_store = ((m_ptr->*m_fn)(m_arg1));}
|
void operator()() const {*m_store = ((m_ptr->*m_fn)(m_arg1));}
|
||||||
private:
|
private:
|
||||||
_Ret (_Class::*m_fn)(_Arg1);
|
_Ret (slsDetector::*m_fn)(_Arg1);
|
||||||
_Class* m_ptr;
|
slsDetector* m_ptr;
|
||||||
_Arg1 m_arg1;
|
_Arg1 m_arg1;
|
||||||
_Store* m_store;
|
_Ret* m_store;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename _Ret, typename _Class,typename _Arg1, typename _Arg2,typename _Store>
|
template<typename _Ret,typename _Arg1, typename _Arg2>
|
||||||
class func2_t{
|
class func2_t{
|
||||||
public:
|
public:
|
||||||
func2_t(_Ret (_Class::*fn)(_Arg1,_Arg2),_Class* ptr,_Arg1 arg1,_Arg2 arg2,_Store* sto):
|
func2_t(_Ret (slsDetector::*fn)(_Arg1,_Arg2),slsDetector* ptr,_Arg1 arg1,_Arg2 arg2,_Ret* sto):
|
||||||
m_fn(fn),m_ptr(ptr),m_arg1(arg1),m_arg2(arg2),m_store(sto){}
|
m_fn(fn),m_ptr(ptr),m_arg1(arg1),m_arg2(arg2),m_store(sto){}
|
||||||
~func2_t() {}
|
~func2_t() {}
|
||||||
void operator()() const {*m_store = ((m_ptr->*m_fn)(m_arg1,m_arg2));}
|
void operator()() const {*m_store = ((m_ptr->*m_fn)(m_arg1,m_arg2));}
|
||||||
private:
|
private:
|
||||||
_Ret (_Class::*m_fn)(_Arg1,_Arg2);
|
_Ret (slsDetector::*m_fn)(_Arg1,_Arg2);
|
||||||
_Class* m_ptr;
|
slsDetector* m_ptr;
|
||||||
_Arg1 m_arg1;
|
_Arg1 m_arg1;
|
||||||
_Arg2 m_arg2;
|
_Arg2 m_arg2;
|
||||||
_Store* m_store;
|
_Ret* m_store;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename _Ret, typename _Class,typename _Arg1, typename _Arg2, typename _Arg3, typename _Store>
|
template<typename _Ret,typename _Arg1, typename _Arg2, typename _Arg3>
|
||||||
class func3_t{
|
class func3_t{
|
||||||
public:
|
public:
|
||||||
func3_t(_Ret (_Class::*fn)(_Arg1,_Arg2,_Arg3),_Class* ptr,_Arg1 arg1,_Arg2 arg2,_Arg3 arg3,_Store* sto):
|
func3_t(_Ret (slsDetector::*fn)(_Arg1,_Arg2,_Arg3),slsDetector* ptr,_Arg1 arg1,_Arg2 arg2,_Arg3 arg3,_Ret* sto):
|
||||||
m_fn(fn),m_ptr(ptr),m_arg1(arg1),m_arg2(arg2),m_arg3(arg3),m_store(sto){}
|
m_fn(fn),m_ptr(ptr),m_arg1(arg1),m_arg2(arg2),m_arg3(arg3),m_store(sto){}
|
||||||
~func3_t() {}
|
~func3_t() {}
|
||||||
void operator()() const {*m_store = ((m_ptr->*m_fn)(m_arg1,m_arg2,m_arg3));}
|
void operator()() const {*m_store = ((m_ptr->*m_fn)(m_arg1,m_arg2,m_arg3));}
|
||||||
private:
|
private:
|
||||||
_Ret (_Class::*m_fn)(_Arg1,_Arg2,_Arg3);
|
_Ret (slsDetector::*m_fn)(_Arg1,_Arg2,_Arg3);
|
||||||
_Class* m_ptr;
|
slsDetector* m_ptr;
|
||||||
_Arg1 m_arg1;
|
_Arg1 m_arg1;
|
||||||
_Arg2 m_arg2;
|
_Arg2 m_arg2;
|
||||||
_Arg3 m_arg3;
|
_Arg3 m_arg3;
|
||||||
_Store* m_store;
|
_Ret* m_store;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename _Ret, typename _Class,typename _Arg1, typename _Arg2, typename _Arg3, typename _Arg4,typename _Store>
|
template<typename _Ret,typename _Arg1, typename _Arg2, typename _Arg3, typename _Arg4>
|
||||||
class func4_t{
|
class func4_t{
|
||||||
public:
|
public:
|
||||||
func4_t(_Ret (_Class::*fn)(_Arg1,_Arg2,_Arg3,_Arg4),_Class* ptr,_Arg1 arg1,_Arg2 arg2,_Arg3 arg3,_Arg4 arg4,_Store* sto):
|
func4_t(_Ret (slsDetector::*fn)(_Arg1,_Arg2,_Arg3,_Arg4),slsDetector* ptr,_Arg1 arg1,_Arg2 arg2,_Arg3 arg3,_Arg4 arg4,_Ret* sto):
|
||||||
m_fn(fn),m_ptr(ptr),m_arg1(arg1),m_arg2(arg2),m_arg3(arg3),m_arg4(arg4),m_store(sto){}
|
m_fn(fn),m_ptr(ptr),m_arg1(arg1),m_arg2(arg2),m_arg3(arg3),m_arg4(arg4),m_store(sto){}
|
||||||
~func4_t() {}
|
~func4_t() {}
|
||||||
void operator()() const {*m_store = ((m_ptr->*m_fn)(m_arg1,m_arg2,m_arg3,m_arg4));}
|
void operator()() const {*m_store = ((m_ptr->*m_fn)(m_arg1,m_arg2,m_arg3,m_arg4));}
|
||||||
private:
|
private:
|
||||||
_Ret (_Class::*m_fn)(_Arg1,_Arg2,_Arg3,_Arg4);
|
_Ret (slsDetector::*m_fn)(_Arg1,_Arg2,_Arg3,_Arg4);
|
||||||
_Class* m_ptr;
|
slsDetector* m_ptr;
|
||||||
_Arg1 m_arg1;
|
_Arg1 m_arg1;
|
||||||
_Arg2 m_arg2;
|
_Arg2 m_arg2;
|
||||||
_Arg3 m_arg3;
|
_Arg3 m_arg3;
|
||||||
_Arg4 m_arg4;
|
_Arg4 m_arg4;
|
||||||
_Store* m_store;
|
_Ret* m_store;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Task: public virtual slsDetectorDefs{
|
|
||||||
|
class SuperTask: public virtual slsDetectorDefs {
|
||||||
public:
|
public:
|
||||||
/* Return: int, Param: int */
|
SuperTask():
|
||||||
Task(func1_t <int,slsDetector,int,int>* t): m1(t),m2(0),m3(0),m4(0),m5(0),m6(0),m7(0),m8(0),m9(0),m10(0),m11(0),m12(0),m13(0),m14(0),m15(0){};
|
m1(0),m2(0),m3(0),m4(0),m5(0),m6(0),m7(0),m8(0),m9(0),m10(0),m11(0),m12(0),m13(0),m14(0),m15(0),m16(0),m17(0),m18(0){};
|
||||||
/* Return: int, Param: string,int */
|
~SuperTask(){};
|
||||||
Task(func2_t <int,slsDetector,string,int,int>* t): m1(0),m2(t),m3(0),m4(0),m5(0),m6(0),m7(0),m8(0),m9(0),m10(0),m11(0),m12(0),m13(0),m14(0),m15(0){};
|
protected:
|
||||||
/* Return: string, Param: string */
|
/** Function signature defined
|
||||||
Task(func1_t <string,slsDetector,string,string>* t): m1(0),m2(0),m3(t),m4(0),m5(0),m6(0),m7(0),m8(0),m9(0),m10(0),m11(0),m12(0),m13(0),m14(0),m15(0){};
|
* First argument is Return type, the remaining are arguments
|
||||||
/* Return: char*, Param: char* */
|
*/
|
||||||
Task(func1_t <char*,slsDetector,char*,string>* t): m1(0),m2(0),m3(0),m4(t),m5(0),m6(0),m7(0),m8(0),m9(0),m10(0),m11(0),m12(0),m13(0),m14(0),m15(0){};
|
func00_t <void >* m1;
|
||||||
/* Return: detectorSettings, Param: int */
|
func0_t <int >* m2;
|
||||||
Task(func1_t <detectorSettings,slsDetector,int,int>* t): m1(0),m2(0),m3(0),m4(0),m5(t),m6(0),m7(0),m8(0),m9(0),m10(0),m11(0),m12(0),m13(0),m14(0),m15(0){};
|
func0_t <double >* m3;
|
||||||
/* Return: detectorSettings, Param: detectorSettings,int */
|
func0_t <runStatus >* m4;
|
||||||
Task(func2_t <detectorSettings,slsDetector,detectorSettings,int,int>* t): m1(0),m2(0),m3(0),m4(0),m5(0),m6(t),m7(0),m8(0),m9(0),m10(0),m11(0),m12(0),m13(0),m14(0),m15(0){};
|
func1_t <int, int>* m5;
|
||||||
/* Return: int, Param: int,int */
|
func1_t <int, double>* m6;
|
||||||
Task(func2_t <int,slsDetector,int,int,int>* t): m1(0),m2(0),m3(0),m4(0),m5(0),m6(0),m7(t),m8(0),m9(0),m10(0),m11(0),m12(0),m13(0),m14(0),m15(0){};
|
func1_t <string, string>* m7;
|
||||||
/* Return: int, Param: int,int,int */
|
func1_t <detectorSettings, int>* m8;
|
||||||
Task(func3_t <int,slsDetector,int,int,int,int>* t): m1(0),m2(0),m3(0),m4(0),m5(0),m6(0),m7(0),m8(t),m9(0),m10(0),m11(0),m12(0),m13(0),m14(0),m15(0){};
|
func2_t <int, int,int>* m9;
|
||||||
/* Return: int, Param: trimMode,int,int,int */
|
func2_t <int, string,int>* m10;
|
||||||
Task(func4_t <int,slsDetector,trimMode,int,int,int,int>* t): m1(0),m2(0),m3(0),m4(0),m5(0),m6(0),m7(0),m8(0),m9(t),m10(0),m11(0),m12(0),m13(0),m14(0),m15(0){};
|
func2_t <dacs_t, dacIndex,int>* m11;
|
||||||
/* Return: int, Param: none */
|
func2_t <detectorSettings, detectorSettings,int>* m12;
|
||||||
Task(func0_t <int,slsDetector,int>* t): m1(0),m2(0),m3(0),m4(0),m5(0),m6(0),m7(0),m8(0),m9(0),m10(t),m11(0),m12(0),m13(0),m14(0),m15(0){};
|
func2_t <int64_t, timerIndex,int64_t>* m13;
|
||||||
/* Return: char*, Param: networkParameter,string */
|
func2_t <string, networkParameter,string>* m14;
|
||||||
Task(func2_t <string,slsDetector,networkParameter,string,string>* t): m1(0),m2(0),m3(0),m4(0),m5(0),m6(0),m7(0),m8(0),m9(0),m10(0),m11(t),m12(0),m13(0),m14(0),m15(0){};
|
func3_t <int, int,int,int>* m15;
|
||||||
/* Return: void, Param: none */
|
func4_t <int, trimMode,int,int,int>* m16;
|
||||||
Task(func00_t <void,slsDetector>* t): m1(0),m2(0),m3(0),m4(0),m5(0),m6(0),m7(0),m8(0),m9(0),m10(0),m11(0),m12(t),m13(0),m14(0),m15(0){};
|
func4_t <int, int,int,detectorSettings,int>* m17;
|
||||||
/* Return: int, Param: int,int,detectorSettings,int */
|
func4_t <dacs_t, dacs_t,dacIndex,int,int>* m18;
|
||||||
Task(func4_t <int,slsDetector,int,int,detectorSettings,int,int>* t): m1(0),m2(0),m3(0),m4(0),m5(0),m6(0),m7(0),m8(0),m9(0),m10(0),m11(0),m12(0),m13(t),m14(0),m15(0){};
|
};
|
||||||
/* Return: dacs_t, Param: dacs_t, dacIndex, int, int */
|
|
||||||
Task(func4_t <dacs_t,slsDetector,dacs_t,dacIndex,int,int,dacs_t>* t): m1(0),m2(0),m3(0),m4(0),m5(0),m6(0),m7(0),m8(0),m9(0),m10(0),m11(0),m12(0),m13(0),m14(t),m15(0){};
|
|
||||||
/* Return: dacs_t, Param: dacIndex, int */
|
|
||||||
Task(func2_t <dacs_t,slsDetector,dacIndex,int,dacs_t>* t): m1(0),m2(0),m3(0),m4(0),m5(0),m6(0),m7(0),m8(0),m9(0),m10(0),m11(0),m12(0),m13(0),m14(0),m15(t){};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class Task: public virtual SuperTask {
|
||||||
|
public:
|
||||||
|
/** Task Constructors using appropriate function signature
|
||||||
|
* First argument is Return type, the remaining are arguments
|
||||||
|
*/
|
||||||
|
Task(func00_t <void >* t): SuperTask(),fnum(1){m1 = t;};
|
||||||
|
Task(func0_t <int >* t): SuperTask(),fnum(2){m2 = t;};
|
||||||
|
Task(func0_t <double >* t): SuperTask(),fnum(3){m3 = t;};
|
||||||
|
Task(func0_t <runStatus >* t): SuperTask(),fnum(4){m4 = t;};
|
||||||
|
Task(func1_t <int, int>* t): SuperTask(),fnum(5){m5 = t;};
|
||||||
|
Task(func1_t <int, double>* t): SuperTask(),fnum(6){m6 = t;};
|
||||||
|
Task(func1_t <string, string>* t): SuperTask(),fnum(7){m7 = t;};
|
||||||
|
Task(func1_t <detectorSettings, int>* t): SuperTask(),fnum(8){m8 = t;};
|
||||||
|
Task(func2_t <int, int,int>* t): SuperTask(),fnum(9){m9 = t;};
|
||||||
|
Task(func2_t <int, string,int>* t): SuperTask(),fnum(10){m10 = t;};
|
||||||
|
Task(func2_t <dacs_t, dacIndex,int>* t): SuperTask(),fnum(11){m11 = t;};
|
||||||
|
Task(func2_t <detectorSettings, detectorSettings,int>* t): SuperTask(),fnum(12){m12 = t;};
|
||||||
|
Task(func2_t <int64_t, timerIndex,int64_t>* t): SuperTask(),fnum(13){m13 = t;};
|
||||||
|
Task(func2_t <string, networkParameter,string>* t): SuperTask(),fnum(14){m14 = t;};
|
||||||
|
Task(func3_t <int, int,int,int>* t): SuperTask(),fnum(15){m15 = t;};
|
||||||
|
Task(func4_t <int, trimMode,int,int,int>* t): SuperTask(),fnum(16){m16 = t;};
|
||||||
|
Task(func4_t <int, int,int,detectorSettings,int>* t): SuperTask(),fnum(17){m17 = t;};
|
||||||
|
Task(func4_t <dacs_t, dacs_t,dacIndex,int,int>* t): SuperTask(),fnum(18){m18 = t;};
|
||||||
|
|
||||||
~Task(){}
|
~Task(){}
|
||||||
|
|
||||||
void operator()(){
|
void operator()(){
|
||||||
if(m1) (*m1)();
|
switch(fnum) {
|
||||||
else if(m2) (*m2)();
|
case 1: (*m1)(); break;
|
||||||
else if(m3) (*m3)();
|
case 2: (*m2)(); break;
|
||||||
else if(m4) (*m4)();
|
case 3: (*m3)(); break;
|
||||||
else if(m5) (*m5)();
|
case 4: (*m4)(); break;
|
||||||
else if(m6) (*m6)();
|
case 5: (*m5)(); break;
|
||||||
else if(m7) (*m7)();
|
case 6: (*m6)(); break;
|
||||||
else if(m8) (*m8)();
|
case 7: (*m7)(); break;
|
||||||
else if(m9) (*m9)();
|
case 8: (*m8)(); break;
|
||||||
else if(m10) (*m10)();
|
case 9: (*m9)(); break;
|
||||||
else if(m11) (*m11)();
|
case 10: (*m10)(); break;
|
||||||
else if(m12) (*m12)();
|
case 11: (*m11)(); break;
|
||||||
else if(m13) (*m13)();
|
case 12: (*m12)(); break;
|
||||||
else if(m14) (*m14)();
|
case 13: (*m13)(); break;
|
||||||
else if(m15) (*m15)();
|
case 14: (*m14)(); break;
|
||||||
|
case 15: (*m15)(); break;
|
||||||
|
case 16: (*m16)(); break;
|
||||||
|
case 17: (*m17)(); break;
|
||||||
|
case 18: (*m18)(); break;
|
||||||
|
default:
|
||||||
|
cprintf(RED, "Error: Task not defined. Abort!\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/* Return: int, Param: int */
|
/** function number */
|
||||||
func1_t <int,slsDetector,int,int>* m1;
|
int fnum;
|
||||||
/* Return: int, Param: string,int */
|
|
||||||
func2_t <int,slsDetector,string,int,int>* m2;
|
|
||||||
/* Return: string, Param: string */
|
|
||||||
func1_t <string,slsDetector,string,string>* m3;
|
|
||||||
/* Return: char*, Param: char* */
|
|
||||||
func1_t <char*,slsDetector,char*,string>* m4;
|
|
||||||
/* Return: detectorSettings, Param: int */
|
|
||||||
func1_t <detectorSettings,slsDetector,int,int>* m5;
|
|
||||||
/* Return: detectorSettings, Param: detectorSettings,int */
|
|
||||||
func2_t <detectorSettings,slsDetector,detectorSettings,int,int>* m6;
|
|
||||||
/* Return: int, Param: int,int */
|
|
||||||
func2_t <int,slsDetector,int,int,int>* m7;
|
|
||||||
/* Return: int, Param: int,int,int */
|
|
||||||
func3_t <int,slsDetector,int,int,int,int>* m8;
|
|
||||||
/* Return: int, Param: trimMode,int,int,int */
|
|
||||||
func4_t <int,slsDetector,trimMode,int,int,int,int>* m9;
|
|
||||||
/* Return: int, Param: int */
|
|
||||||
func0_t <int,slsDetector,int>* m10;
|
|
||||||
/* Return: char*, Param: networkParameter,string */
|
|
||||||
func2_t <string,slsDetector,networkParameter,string,string>* m11;
|
|
||||||
/* Return: void, Param: none */
|
|
||||||
func00_t <void,slsDetector>* m12;
|
|
||||||
/* Return: int, Param: int,int,detectorSettings,int */
|
|
||||||
func4_t <int,slsDetector,int,int,detectorSettings,int,int>* m13;
|
|
||||||
/* Return: dacs_t, Param: dacs_t, dacIndex, int, int */
|
|
||||||
func4_t <dacs_t,slsDetector,dacs_t,dacIndex,int,int,dacs_t>* m14;
|
|
||||||
/* Return: dacs_t, Param: dacIndex, int */
|
|
||||||
func2_t <dacs_t,slsDetector,dacIndex,int,dacs_t>* m15;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user