mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-07 10:30:41 +02:00
detector id returns a number form a file or 0 if no file: eiger
This commit is contained in:
parent
dd1233bc7c
commit
2152eb1d28
@ -236,7 +236,17 @@ int64_t getDetectorId(enum idMode arg){
|
|||||||
|
|
||||||
|
|
||||||
int getDetectorNumber(){
|
int getDetectorNumber(){
|
||||||
|
int res=0;
|
||||||
|
|
||||||
|
//execute and get address
|
||||||
|
char output[255];
|
||||||
|
FILE* sysFile = popen("more /home/root/executables/detid.txt", "r");
|
||||||
|
fgets(output, sizeof(output), sysFile);
|
||||||
|
pclose(sysFile);
|
||||||
|
sscanf(output,"%d",&res);
|
||||||
|
printf("detector id: %d\n",res);
|
||||||
|
|
||||||
|
/*
|
||||||
int res=0;
|
int res=0;
|
||||||
char hostname[100];
|
char hostname[100];
|
||||||
if (gethostname(hostname, sizeof hostname) == 0)
|
if (gethostname(hostname, sizeof hostname) == 0)
|
||||||
@ -244,6 +254,7 @@ int getDetectorNumber(){
|
|||||||
else
|
else
|
||||||
perror("gethostname");
|
perror("gethostname");
|
||||||
sscanf(hostname,"%x",&res);
|
sscanf(hostname,"%x",&res);
|
||||||
|
*/
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3147,8 +3147,8 @@ slsDetectorDefs::detectorSettings slsDetector::setSettings( detectorSettings ise
|
|||||||
case EIGER:
|
case EIGER:
|
||||||
//settings is saved in myMod.reg
|
//settings is saved in myMod.reg
|
||||||
myMod->reg=thisDetector->currentSettings;
|
myMod->reg=thisDetector->currentSettings;
|
||||||
ostfn << thisDetector->settingsDir << ssettings <<"/noise.sn"<< setw(6) << hex << getId(DETECTOR_SERIAL_NUMBER) << setbase(10);
|
ostfn << thisDetector->settingsDir << ssettings <<"/noise.sn" << setfill('0') << setw(3) << dec << getId(DETECTOR_SERIAL_NUMBER) << setbase(10);
|
||||||
oscfn << thisDetector->calDir << ssettings << "/calibration.sn"<<setw(6) << hex << getId(DETECTOR_SERIAL_NUMBER) << setbase(10);
|
oscfn << thisDetector->calDir << ssettings << "/calibration.sn" << setfill('0') << setw(3) << dec << getId(DETECTOR_SERIAL_NUMBER) << setbase(10);
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout<< thisDetector->settingsDir<<endl<< thisDetector->calDir <<endl;
|
std::cout<< thisDetector->settingsDir<<endl<< thisDetector->calDir <<endl;
|
||||||
#endif
|
#endif
|
||||||
@ -6009,7 +6009,7 @@ int slsDetector::loadSettingsFile(string fname, int imod) {
|
|||||||
fn=ostfn.str();
|
fn=ostfn.str();
|
||||||
}
|
}
|
||||||
}else if (fname.find(".sn")==string::npos && fname.find(".trim")==string::npos && fname.find(".settings")==string::npos) {
|
}else if (fname.find(".sn")==string::npos && fname.find(".trim")==string::npos && fname.find(".settings")==string::npos) {
|
||||||
ostfn << ".sn" << setw(6) << hex << getId(DETECTOR_SERIAL_NUMBER, im);
|
ostfn << ".sn" << setfill('0') << setw(3) << dec << getId(DETECTOR_SERIAL_NUMBER, im);
|
||||||
fn=ostfn.str();
|
fn=ostfn.str();
|
||||||
}
|
}
|
||||||
myMod=readSettingsFile(fn, thisDetector->myDetectorType);
|
myMod=readSettingsFile(fn, thisDetector->myDetectorType);
|
||||||
@ -6043,7 +6043,7 @@ int slsDetector::saveSettingsFile(string fname, int imod) {
|
|||||||
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" << setw(6) << hex << getId(DETECTOR_SERIAL_NUMBER);
|
ostfn << fname << ".sn" << setfill('0') << setw(3) << dec << getId(DETECTOR_SERIAL_NUMBER);
|
||||||
else
|
else
|
||||||
ostfn << fname << ".sn" << setfill('0') << setw(3) << hex << getId(MODULE_SERIAL_NUMBER,im);
|
ostfn << fname << ".sn" << setfill('0') << setw(3) << hex << getId(MODULE_SERIAL_NUMBER,im);
|
||||||
if ((myMod=getModule(im))) {
|
if ((myMod=getModule(im))) {
|
||||||
@ -6126,7 +6126,7 @@ int slsDetector::loadCalibrationFile(string fname, int imod) {
|
|||||||
ostfn << ".sn" << setfill('0') << setw(3) << hex << getId(MODULE_SERIAL_NUMBER, im);
|
ostfn << ".sn" << setfill('0') << setw(3) << hex << getId(MODULE_SERIAL_NUMBER, im);
|
||||||
}
|
}
|
||||||
}else if (fname.find(".sn")==string::npos && fname.find(".cal")==string::npos) {
|
}else if (fname.find(".sn")==string::npos && fname.find(".cal")==string::npos) {
|
||||||
ostfn << "." << setw(6) << hex << getId(DETECTOR_SERIAL_NUMBER);
|
ostfn << "." << setfill('0') << setw(3) << dec << getId(DETECTOR_SERIAL_NUMBER);
|
||||||
}
|
}
|
||||||
fn=ostfn.str();
|
fn=ostfn.str();
|
||||||
if((myMod=getModule(im))){
|
if((myMod=getModule(im))){
|
||||||
@ -6166,7 +6166,7 @@ int slsDetector::saveCalibrationFile(string fname, int imod) {
|
|||||||
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" << setw(6) << hex << getId(DETECTOR_SERIAL_NUMBER);
|
ostfn << fname << ".sn" << setfill('0') << setw(3) << dec << getId(DETECTOR_SERIAL_NUMBER);
|
||||||
else
|
else
|
||||||
ostfn << fname << ".sn" << setfill('0') << setw(3) << hex << getId(MODULE_SERIAL_NUMBER,im);
|
ostfn << fname << ".sn" << setfill('0') << setw(3) << hex << getId(MODULE_SERIAL_NUMBER,im);
|
||||||
if ((myMod=getModule(im))) {
|
if ((myMod=getModule(im))) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user