mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-28 09:10:01 +02:00
replaced post incrementing by pre incrementing
This commit is contained in:
parent
a95e2efdb0
commit
90f899c936
File diff suppressed because it is too large
Load Diff
@ -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
|
||||||
@ -779,13 +779,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");
|
||||||
@ -830,7 +830,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
|
||||||
|
|
||||||
@ -945,7 +945,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) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -964,37 +964,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1730,7 +1730,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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2489,7 +2489,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];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2601,9 +2601,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;
|
||||||
@ -2671,9 +2671,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;
|
||||||
|
|
||||||
@ -2779,14 +2779,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;
|
||||||
}
|
}
|
||||||
@ -2885,7 +2885,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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2923,7 +2923,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;
|
||||||
@ -2943,34 +2943,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;
|
||||||
}
|
}
|
||||||
@ -3051,25 +3051,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];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3081,12 +3081,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];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3181,25 +3181,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;
|
||||||
@ -3210,12 +3210,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];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3678,7 +3678,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;
|
||||||
|
|
||||||
@ -3819,12 +3819,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;
|
||||||
@ -4231,7 +4231,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) ;
|
||||||
|
|
||||||
|
|
||||||
@ -4262,7 +4262,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);
|
||||||
@ -4324,7 +4324,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;
|
||||||
@ -4342,7 +4342,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
|
||||||
@ -5112,10 +5112,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;
|
||||||
@ -5194,13 +5194,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
|
||||||
|
|
||||||
@ -5359,7 +5359,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;
|
||||||
@ -5369,38 +5369,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)));
|
||||||
// }
|
// }
|
||||||
@ -5411,13 +5411,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];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5478,7 +5478,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;
|
||||||
}
|
}
|
||||||
@ -5505,7 +5505,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();
|
||||||
@ -5514,7 +5514,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
|
||||||
@ -5552,7 +5552,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) {
|
||||||
@ -5567,7 +5567,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;
|
||||||
@ -5584,7 +5584,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 {
|
||||||
@ -5758,7 +5758,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]);
|
||||||
@ -5817,10 +5817,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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5829,7 +5829,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];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5856,9 +5856,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;
|
||||||
@ -6401,7 +6401,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));
|
||||||
@ -6546,7 +6546,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;
|
||||||
@ -6842,7 +6842,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
|
||||||
@ -6868,7 +6868,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);
|
||||||
@ -6876,7 +6876,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;
|
||||||
@ -6978,17 +6978,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)
|
||||||
@ -7065,17 +7065,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);
|
||||||
}
|
}
|
||||||
@ -7155,7 +7155,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;
|
||||||
}
|
}
|
||||||
@ -7297,7 +7297,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){
|
||||||
@ -7337,7 +7337,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);
|
||||||
@ -7408,12 +7408,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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7425,7 +7425,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){
|
||||||
@ -7469,7 +7469,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);
|
||||||
@ -8120,7 +8120,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);
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
@ -8456,7 +8456,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));
|
||||||
}
|
}
|
||||||
@ -8765,7 +8765,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);
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -163,7 +163,7 @@ int slsDetectorUtils::acquire(int delflag){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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;
|
||||||
@ -184,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) {
|
||||||
@ -193,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) {
|
||||||
@ -208,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) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user