moench client and receiver works with gotthard module, without gui

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@511 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
l_maliakal_d
2013-04-12 12:54:36 +00:00
parent cb9de5973f
commit 27c91c36ff
18 changed files with 420 additions and 172 deletions

View File

@ -48,12 +48,19 @@ int slsDetector::initSharedMemory(detectorType type, int id) {
nm=1; //modules/detector
nc=4; //chips
nd=16; //dacs+adcs
break;
case MOENCH:
nch=160*160;
nm=1; //modules/detector
nc=1; //chips
nd=9; //dacs+adcs
break;
default:
nch=0; // dum!
nm=0; //modules/detector
nc=0; //chips
nd=0; //dacs+adcs
break;
}
/**
The size of the shared memory is:
@ -148,7 +155,7 @@ slsDetector::slsDetector(int id,multiSlsDetector *p) :slsDetectorUtils(),
#endif
detId=id;
/**Initializes the detector stucture \sa initializeDetectorSize
*/
initializeDetectorSize(type);
@ -512,6 +519,15 @@ int slsDetector::initializeDetectorSize(detectorType type) {
thisDetector->nModMax[Y]=1;
thisDetector->dynamicRange=16;
break;
case MOENCH:
thisDetector->nChans=160*160;
thisDetector->nChips=1;
thisDetector->nDacs=8;
thisDetector->nAdcs=1;
thisDetector->nModMax[X]=1;
thisDetector->nModMax[Y]=1;
thisDetector->dynamicRange=16;
break;
default:
thisDetector->nChans=0;
thisDetector->nChips=0;
@ -642,9 +658,9 @@ int slsDetector::initializeDetectorSize(detectorType type) {
adcs=(dacs_t*)(goff+thisDetector->adcoff);
chipregs=(int*)(goff+thisDetector->chipoff);
chanregs=(int*)(goff+thisDetector->chanoff);
if (thisDetector->alreadyExisting==0) {
if (thisDetector->alreadyExisting==0) {
/** if thisDetector is new, initialize its structures \sa initializeDetectorStructure(); */
initializeDetectorStructure();
initializeDetectorStructure();
/** set thisDetector->alreadyExisting=1 */
thisDetector->alreadyExisting=1;
}
@ -691,7 +707,8 @@ int slsDetector::initializeDetectorSize(detectorType type) {
framesPerFile=parentDet->framesPerFile;
if(thisDetector->myDetectorType==GOTTHARD)
setFramesPerFile(MAX_FRAMES_PER_FILE);
if (thisDetector->myDetectorType==MOENCH)
setFramesPerFile(MOENCH_MAX_FRAMES_PER_FILE);
thisReceiver = new receiverInterface(dataSocket);
// setAngularConversionPointer(thisDetector->angOff,&thisDetector->nMods, thisDetector->nChans*thisDetector->nChips);
@ -723,14 +740,14 @@ int slsDetector::initializeDetectorStructure() {
thisMod=detectorModules+imod;
thisMod->module=imod;
/** sets the size of the module to nChans, nChips etc. */
thisMod->nchan=thisDetector->nChans*thisDetector->nChips;
thisMod->nchip=thisDetector->nChips;
thisMod->ndac=thisDetector->nDacs;
thisMod->nadc=thisDetector->nAdcs;
/** initializes the serial number and register to 0 */
thisMod->serialnumber=0;
thisMod->reg=0;
@ -753,7 +770,7 @@ int slsDetector::initializeDetectorStructure() {
*(chipregs+ichip+thisDetector->nChips*imod)=-1;
}
/** initializes the channel registers to 0 */
for (int ichan=0; ichan<thisDetector->nChans*thisDetector->nChips; ichan++) {
*(chanregs+ichan+thisDetector->nChips*thisDetector->nChans*imod)=-1;
@ -797,7 +814,15 @@ slsDetectorDefs::sls_detector_module* slsDetector::createModule(detectorType t)
nm=1; //modules/detector
nc=4; //chips
nd=16; //dacs
na=16;
na=16;
break;
case MOENCH:
nch=160*160;
nm=1; //modules/detector
nc=1; //chips
nd=8; //dacs
na=1;
break;
default:
nch=0; // dum!
nm=0; //modules/detector
@ -1262,7 +1287,8 @@ int slsDetector::execCommand(string cmd, string answer){
PILATUS,
EIGER,
GOTTHARD,
AGIPD
AGIPD,
MOENCH
};
*/
@ -2757,6 +2783,7 @@ slsDetectorDefs::detectorSettings slsDetector::setSettings( detectorSettings ise
detectorSettings minsettings, maxsettings;
switch(thisDetector->myDetectorType){
case MOENCH:
case GOTTHARD:
minsettings = HIGHGAIN;
maxsettings = VERYHIGHGAIN;
@ -2811,6 +2838,7 @@ slsDetectorDefs::detectorSettings slsDetector::setSettings( detectorSettings ise
myMod->module=im;
//create file names
switch(thisDetector->myDetectorType){
case MOENCH:
case GOTTHARD:
//settings is saved in myMod.reg for gotthard
myMod->reg=thisDetector->currentSettings;
@ -2838,6 +2866,7 @@ slsDetectorDefs::detectorSettings slsDetector::setSettings( detectorSettings ise
} else {
ostringstream ostfn,oscfn;
switch(thisDetector->myDetectorType){
case MOENCH:
case GOTTHARD:
ostfn << thisDetector->settingsDir << ssettings << ssettings << ".settings";
break;
@ -2936,7 +2965,7 @@ int slsDetector::updateDetectorNoWait() {
n = controlSocket->ReceiveDataOnly( &t,sizeof(t));
thisDetector->currentSettings=t;
if(thisDetector->myDetectorType!= GOTTHARD){
if((thisDetector->myDetectorType!= GOTTHARD)&&(thisDetector->myDetectorType!= MOENCH)){
//thr=getThresholdEnergy();
n = controlSocket->ReceiveDataOnly( &thr,sizeof(thr));
thisDetector->currentThresholdEV=thr;
@ -2960,7 +2989,7 @@ int slsDetector::updateDetectorNoWait() {
thisDetector->timerValue[GATES_NUMBER]=retval;
//retval=setProbes(tns);
if(thisDetector->myDetectorType!= GOTTHARD){
if((thisDetector->myDetectorType!= GOTTHARD)&&(thisDetector->myDetectorType!= MOENCH)){
n = controlSocket->ReceiveDataOnly( &retval,sizeof(int64_t));
thisDetector->timerValue[PROBES_NUMBER]=retval;
}
@ -3401,7 +3430,7 @@ int64_t slsDetector::setTimer(timerIndex index, int64_t t){
//std::cout<< "offline " << std::endl;
if (t>=0)
thisDetector->timerValue[index]=t;
if(thisDetector->myDetectorType==GOTTHARD)
if((thisDetector->myDetectorType==GOTTHARD)||(thisDetector->myDetectorType==MOENCH))
thisDetector->timerValue[PROBES_NUMBER]=0;
}
} else {
@ -4941,8 +4970,8 @@ int slsDetector::configureMAC(){
std::cout<< "Configuring MAC failed " << std::endl;
setErrorMask((getErrorMask())|(COULD_NOT_CONFIGURE_MAC));
}
else{
//set frames per file
else if (thisDetector->myDetectorType==GOTTHARD){
//set frames per file - only for gotthard
if(retval==-1)
setFramesPerFile(MAX_FRAMES_PER_FILE);
else
@ -5317,7 +5346,7 @@ int slsDetector::writeConfigurationFile(ofstream &outfile, int id){
// "trimen",
// "receiverTCPPort",
if (thisDetector->myDetectorType==GOTTHARD) {
if ((thisDetector->myDetectorType==GOTTHARD)||(thisDetector->myDetectorType==MOENCH)) {
names[0]= "hostname";
names[1]= "port";
names[2]= "stopport";
@ -5417,8 +5446,8 @@ int slsDetector::loadSettingsFile(string fname, int imod) {
myMod=readSettingsFile(fn, thisDetector->myDetectorType);
if (myMod) {
myMod->module=im;
//settings is saved in myMod.reg for gotthard
if(thisDetector->myDetectorType==GOTTHARD)
//settings is saved in myMod.reg for gotthard or moench
if((thisDetector->myDetectorType==GOTTHARD)||(thisDetector->myDetectorType==MOENCH))
myMod->reg=thisDetector->currentSettings;
setModule(*myMod);
deleteModule(myMod);

View File

@ -307,7 +307,7 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
static int exists(int id);
/**
configures mac for gotthard readout
configures mac for gotthard, moench readout
\returns OK or FAIL
*/
int configureMAC();
@ -611,22 +611,22 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
sets/gets detector type
normally the detector knows what type of detector it is
\param type is the detector type (defaults to GET_DETECTOR_TYPE)
\returns returns detector type index (1 GENERIC, 2 MYTHEN, 3 PILATUS, 4 XFS, 5 GOTTHARD, 6 AGIPD, -1 command failed)
\returns returns detector type index (1 GENERIC, 2 MYTHEN, 3 PILATUS, 4 XFS, 5 GOTTHARD, 6 AGIPD, 7 MOENCH, -1 command failed)
*/
int setDetectorType(detectorType type=GET_DETECTOR_TYPE);
/**
sets/gets detector type
normally the detector knows what type of detector it is
\param type is the detector type ("Mythen", "Pilatus", "XFS", "Gotthard", Agipd")
\returns returns detector type index (1 GENERIC, 2 MYTHEN, 3 PILATUS, 4 XFS, 5 GOTTHARD, 6 AGIPD, -1 command failed)
\param type is the detector type ("Mythen", "Pilatus", "XFS", "Gotthard", Agipd", "Mönch")
\returns returns detector type index (1 GENERIC, 2 MYTHEN, 3 PILATUS, 4 XFS, 5 GOTTHARD, 6 AGIPD, 7 MOENCH, -1 command failed)
*/
int setDetectorType(string type);
/**
gets detector type
normally the detector knows what type of detector it is
\returns returns detector type index (1 GENERIC, 2 MYTHEN, 3 PILATUS, 4 XFS, 5 GOTTHARD, 6 AGIPD, -1 command failed)
\returns returns detector type index (1 GENERIC, 2 MYTHEN, 3 PILATUS, 4 XFS, 5 GOTTHARD, 6 AGIPD, 7 MOENCH,-1 command failed)
*/
detectorType getDetectorsType(int pos=-1);

View File

@ -486,7 +486,7 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
case EIGER: return string("Eiger"); \
case GOTTHARD: return string("Gotthard"); \
case AGIPD: return string("Agipd"); \
case MOENCH: return string("Mönch"); \
case MOENCH: return string("Moench"); \
default: return string("Unknown"); \
}};
@ -500,7 +500,7 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
if (type=="Eiger") return EIGER; \
if (type=="Gotthard") return GOTTHARD; \
if (type=="Agipd") return AGIPD; \
if (type=="Mönch") return MOENCH; \
if (type=="Moench") return MOENCH; \
return GENERIC;};

View File

@ -310,7 +310,7 @@ void slsDetectorUtils::acquire(int delflag){
usleep(100000);
}
if (getDetectorsType()==GOTTHARD){
if ((getDetectorsType()==GOTTHARD) || (getDetectorsType()==MOENCH)){
if((*correctionMask)&(1<<WRITE_FILE))
closeDataFile();
}
@ -466,7 +466,7 @@ int slsDetectorUtils::setTotalProgress() {
if (timerValue[FRAME_NUMBER])
nf=timerValue[FRAME_NUMBER];
if(getDetectorsType() == MOENCH) nf/=20;/**TEMP SOLUTION:need to be removed when the proper moench is used*/
if (timerValue[CYCLES_NUMBER]>0)
nc=timerValue[CYCLES_NUMBER];