mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-21 00:58:01 +02:00
adding std:: where needed
This commit is contained in:
@ -15,7 +15,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
using namespace std;
|
// using namespace std;
|
||||||
|
|
||||||
/** Error flags */
|
/** Error flags */
|
||||||
/*Assumption: Only upto 63 detectors */
|
/*Assumption: Only upto 63 detectors */
|
||||||
@ -112,9 +112,9 @@ public:
|
|||||||
* param errorMask error mask
|
* param errorMask error mask
|
||||||
/returns error message from error mask
|
/returns error message from error mask
|
||||||
*/
|
*/
|
||||||
static string getErrorMessage(int64_t slsErrorMask){
|
static std::string getErrorMessage(int64_t slsErrorMask){
|
||||||
|
|
||||||
string retval = "";
|
std::string retval = "";
|
||||||
|
|
||||||
if(slsErrorMask&CANNOT_CONNECT_TO_DETECTOR)
|
if(slsErrorMask&CANNOT_CONNECT_TO_DETECTOR)
|
||||||
retval.append("Cannot connect to Detector\n");
|
retval.append("Cannot connect to Detector\n");
|
||||||
|
@ -38,7 +38,7 @@ class slsDetectorActions : public virtual slsDetectorBase
|
|||||||
\param par for script
|
\param par for script
|
||||||
\returns 0 if action disabled, >0 otherwise
|
\returns 0 if action disabled, >0 otherwise
|
||||||
*/
|
*/
|
||||||
int setAction(int iaction, string fname="", string par="");
|
int setAction(int iaction,std::string fname="",std::string par="");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
set action script
|
set action script
|
||||||
@ -46,7 +46,7 @@ class slsDetectorActions : public virtual slsDetectorBase
|
|||||||
\param fname for script ("" disable)
|
\param fname for script ("" disable)
|
||||||
\returns 0 if action disabled, >0 otherwise
|
\returns 0 if action disabled, >0 otherwise
|
||||||
*/
|
*/
|
||||||
int setActionScript(int iaction, string fname="");
|
int setActionScript(int iaction, std::string fname="");
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -55,7 +55,7 @@ class slsDetectorActions : public virtual slsDetectorBase
|
|||||||
\param par for script
|
\param par for script
|
||||||
\returns 0 if action disabled, >0 otherwise
|
\returns 0 if action disabled, >0 otherwise
|
||||||
*/
|
*/
|
||||||
int setActionParameter(int iaction, string par="");
|
int setActionParameter(int iaction, std::string par="");
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -63,14 +63,14 @@ class slsDetectorActions : public virtual slsDetectorBase
|
|||||||
\param iaction can be enum {startScript, scriptBefore, headerBefore, headerAfter,scriptAfter, stopScript}
|
\param iaction can be enum {startScript, scriptBefore, headerBefore, headerAfter,scriptAfter, stopScript}
|
||||||
\returns action script
|
\returns action script
|
||||||
*/
|
*/
|
||||||
string getActionScript(int iaction);
|
std::string getActionScript(int iaction);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
returns action parameter
|
returns action parameter
|
||||||
\param iaction can be enum {startScript, scriptBefore, headerBefore, headerAfter,scriptAfter, stopScript}
|
\param iaction can be enum {startScript, scriptBefore, headerBefore, headerAfter,scriptAfter, stopScript}
|
||||||
\returns action parameter
|
\returns action parameter
|
||||||
*/
|
*/
|
||||||
string getActionParameter(int iaction);
|
std::string getActionParameter(int iaction);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
returns action mode
|
returns action mode
|
||||||
@ -89,20 +89,20 @@ class slsDetectorActions : public virtual slsDetectorBase
|
|||||||
\param precision to write the scan varaible in the scan name (-1 unchanged)
|
\param precision to write the scan varaible in the scan name (-1 unchanged)
|
||||||
\returns 0 is scan disabled, >0 otherwise
|
\returns 0 is scan disabled, >0 otherwise
|
||||||
*/
|
*/
|
||||||
int setScan(int index, string script="", int nvalues=-1, double *values=NULL, string par="", int precision=-1);
|
int setScan(int index, std::string script="", int nvalues=-1, double *values=NULL, std::string par="", int precision=-1);
|
||||||
|
|
||||||
/** set scan script
|
/** set scan script
|
||||||
\param index of the scan (0,1)
|
\param index of the scan (0,1)
|
||||||
\param script fname for script ("" disables, "none" disables and overwrites current, "threshold" threshold scan, "trimbits", trimbits scan)
|
\param script fname for script ("" disables, "none" disables and overwrites current, "threshold" threshold scan, "trimbits", trimbits scan)
|
||||||
\returns 0 is scan disabled, >0 otherwise
|
\returns 0 is scan disabled, >0 otherwise
|
||||||
*/
|
*/
|
||||||
int setScanScript(int index, string script="");
|
int setScanScript(int index, std::string script="");
|
||||||
/** set scan script parameter
|
/** set scan script parameter
|
||||||
\param index of the scan (0,1)
|
\param index of the scan (0,1)
|
||||||
\param script parameter for scan
|
\param script parameter for scan
|
||||||
\returns 0 is scan disabled, >0 otherwise
|
\returns 0 is scan disabled, >0 otherwise
|
||||||
*/
|
*/
|
||||||
int setScanParameter(int index, string par="");
|
int setScanParameter(int index, std::string par="");
|
||||||
/** set scan script parameter
|
/** set scan script parameter
|
||||||
\param index of the scan (0,1)
|
\param index of the scan (0,1)
|
||||||
\param precision scan varaible precision to be printed in file name
|
\param precision scan varaible precision to be printed in file name
|
||||||
@ -130,14 +130,14 @@ class slsDetectorActions : public virtual slsDetectorBase
|
|||||||
\param iscan can be (0,1)
|
\param iscan can be (0,1)
|
||||||
\returns scan script
|
\returns scan script
|
||||||
*/
|
*/
|
||||||
string getScanScript(int iscan);
|
std::string getScanScript(int iscan);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
returns scan parameter
|
returns scan parameter
|
||||||
\param iscan can be (0,1)
|
\param iscan can be (0,1)
|
||||||
\returns scan parameter
|
\returns scan parameter
|
||||||
*/
|
*/
|
||||||
string getScanParameter(int iscan);
|
std::string getScanParameter(int iscan);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
returns scan mode
|
returns scan mode
|
||||||
@ -273,7 +273,7 @@ class slsDetectorActions : public virtual slsDetectorBase
|
|||||||
int startIndex;
|
int startIndex;
|
||||||
int lastIndex;
|
int lastIndex;
|
||||||
int nowIndex;
|
int nowIndex;
|
||||||
string fName;
|
std::string fName;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -54,8 +54,11 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
using std::string;
|
||||||
|
using std::ofstream;
|
||||||
|
using std::ifstream;
|
||||||
|
|
||||||
//using namespace std;
|
// using namespace std;
|
||||||
/**
|
/**
|
||||||
|
|
||||||
@libdoc The slsDetectorBase contains also a set of purely virtual functions useful for the implementation of the derived classes
|
@libdoc The slsDetectorBase contains also a set of purely virtual functions useful for the implementation of the derived classes
|
||||||
@ -83,7 +86,7 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
|
|||||||
*/
|
*/
|
||||||
virtual detectorType getDetectorsType(int pos=-1)=0;
|
virtual detectorType getDetectorsType(int pos=-1)=0;
|
||||||
|
|
||||||
string getDetectorDeveloper(){return string("PSI");};
|
std::string getDetectorDeveloper(){return std::string("PSI");};
|
||||||
// protected:
|
// protected:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -91,14 +94,14 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
|
|||||||
\param fname file with angular conversion constants ("" disable)
|
\param fname file with angular conversion constants ("" disable)
|
||||||
\returns 0 if angular conversion disabled, >0 otherwise
|
\returns 0 if angular conversion disabled, >0 otherwise
|
||||||
*/
|
*/
|
||||||
virtual int setAngularConversionFile(string fname="")=0;
|
virtual int setAngularConversionFile(std::string fname="")=0;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
pure virtual function
|
pure virtual function
|
||||||
returns the angular conversion file
|
returns the angular conversion file
|
||||||
*/
|
*/
|
||||||
virtual string getAngularConversionFile()=0;
|
virtual std::string getAngularConversionFile()=0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -108,7 +111,7 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
|
|||||||
\param fname for script ("" disable)
|
\param fname for script ("" disable)
|
||||||
\returns 0 if action disabled, >0 otherwise
|
\returns 0 if action disabled, >0 otherwise
|
||||||
*/
|
*/
|
||||||
virtual int setActionScript(int iaction, string fname="")=0;
|
virtual int setActionScript(int iaction, std::string fname="")=0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
set action
|
set action
|
||||||
@ -116,21 +119,21 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
|
|||||||
\param par for script ("" disable)
|
\param par for script ("" disable)
|
||||||
\returns 0 if action disabled, >0 otherwise
|
\returns 0 if action disabled, >0 otherwise
|
||||||
*/
|
*/
|
||||||
virtual int setActionParameter(int iaction, string par="")=0;
|
virtual int setActionParameter(int iaction, std::string par="")=0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
returns action script
|
returns action script
|
||||||
\param iaction can be enum {startScript, scriptBefore, headerBefore, headerAfter,scriptAfter, stopScript}
|
\param iaction can be enum {startScript, scriptBefore, headerBefore, headerAfter,scriptAfter, stopScript}
|
||||||
\returns action script
|
\returns action script
|
||||||
*/
|
*/
|
||||||
virtual string getActionScript(int iaction)=0;
|
virtual std::string getActionScript(int iaction)=0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
returns action parameter
|
returns action parameter
|
||||||
\param iaction can be enum {startScript, scriptBefore, headerBefore, headerAfter,scriptAfter, stopScript}
|
\param iaction can be enum {startScript, scriptBefore, headerBefore, headerAfter,scriptAfter, stopScript}
|
||||||
\returns action parameter
|
\returns action parameter
|
||||||
*/
|
*/
|
||||||
virtual string getActionParameter(int iaction)=0;
|
virtual std::string getActionParameter(int iaction)=0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
set scan script
|
set scan script
|
||||||
@ -138,7 +141,7 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
|
|||||||
\param script fname for script ("" disable, "none" disables and overwrites current, "threshold" makes threshold scan, "trimbits" make trimbits scan, "energy" makes energy scan)
|
\param script fname for script ("" disable, "none" disables and overwrites current, "threshold" makes threshold scan, "trimbits" make trimbits scan, "energy" makes energy scan)
|
||||||
\returns 0 if scan disabled, >0 otherwise
|
\returns 0 if scan disabled, >0 otherwise
|
||||||
*/
|
*/
|
||||||
virtual int setScanScript(int index, string script="")=0;
|
virtual int setScanScript(int index, std::string script="")=0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
set scan script parameter
|
set scan script parameter
|
||||||
@ -146,7 +149,7 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
|
|||||||
\param spar parameter to be passed to the scan script with syntax par=spar
|
\param spar parameter to be passed to the scan script with syntax par=spar
|
||||||
\returns 0 if scan disabled, >0 otherwise
|
\returns 0 if scan disabled, >0 otherwise
|
||||||
*/
|
*/
|
||||||
virtual int setScanParameter(int index, string spar="")=0;
|
virtual int setScanParameter(int index, std::string spar="")=0;
|
||||||
|
|
||||||
|
|
||||||
/** set scan precision
|
/** set scan precision
|
||||||
@ -169,14 +172,14 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
|
|||||||
\param index is the scan index (0 or 1)
|
\param index is the scan index (0 or 1)
|
||||||
\returns "none" if disables, "threshold" threshold scan, "trimbits" trimbits scan, "energy" energy scan or scan script name
|
\returns "none" if disables, "threshold" threshold scan, "trimbits" trimbits scan, "energy" energy scan or scan script name
|
||||||
*/
|
*/
|
||||||
virtual string getScanScript(int index)=0;
|
virtual std::string getScanScript(int index)=0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
get scan script
|
get scan script
|
||||||
\param index is the scan index (0 or 1)
|
\param index is the scan index (0 or 1)
|
||||||
\returns scan script parameter
|
\returns scan script parameter
|
||||||
*/
|
*/
|
||||||
virtual string getScanParameter(int index)=0;
|
virtual std::string getScanParameter(int index)=0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
get scan precision
|
get scan precision
|
||||||
@ -199,7 +202,7 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
|
|||||||
\param fname file name
|
\param fname file name
|
||||||
\returns OK or FAIL
|
\returns OK or FAIL
|
||||||
*/
|
*/
|
||||||
virtual int writeConfigurationFile(string const fname)=0;
|
virtual int writeConfigurationFile(std::string const fname)=0;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -208,7 +211,7 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
|
|||||||
\param fname file name to load data from
|
\param fname file name to load data from
|
||||||
\returns OK or FAIL
|
\returns OK or FAIL
|
||||||
*/
|
*/
|
||||||
virtual int loadImageToDetector(imageType index,string const fname)=0;
|
virtual int loadImageToDetector(imageType index,std::string const fname)=0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\returns number of positions
|
\returns number of positions
|
||||||
@ -241,7 +244,7 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
|
|||||||
virtual int getTotalNumberOfChannels(dimension d)=0;
|
virtual int getTotalNumberOfChannels(dimension d)=0;
|
||||||
|
|
||||||
/** generates file name without extension */
|
/** generates file name without extension */
|
||||||
virtual string createFileName()=0;
|
virtual std::string createFileName()=0;
|
||||||
|
|
||||||
|
|
||||||
virtual void incrementProgress()=0;
|
virtual void incrementProgress()=0;
|
||||||
@ -254,12 +257,12 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
|
|||||||
virtual double* decodeData(int *datain, int &nn, double *fdata=NULL)=0;
|
virtual double* decodeData(int *datain, int &nn, double *fdata=NULL)=0;
|
||||||
|
|
||||||
|
|
||||||
virtual string getCurrentFileName()=0;
|
virtual std::string getCurrentFileName()=0;
|
||||||
|
|
||||||
|
|
||||||
virtual int getFileIndexFromFileName(string fname)=0;
|
virtual int getFileIndexFromFileName(std::string fname)=0;
|
||||||
|
|
||||||
virtual int getIndicesFromFileName(string fname,int &index)=0;
|
virtual int getIndicesFromFileName(std::string fname,int &index)=0;
|
||||||
|
|
||||||
virtual double *convertAngles()=0;
|
virtual double *convertAngles()=0;
|
||||||
/**
|
/**
|
||||||
@ -282,9 +285,9 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
|
|||||||
*/
|
*/
|
||||||
virtual int getRateCorrection()=0;
|
virtual int getRateCorrection()=0;
|
||||||
|
|
||||||
virtual int setFlatFieldCorrection(string fname="")=0;
|
virtual int setFlatFieldCorrection(std::string fname="")=0;
|
||||||
|
|
||||||
int setFlatFieldCorrectionFile(string fname=""){return setFlatFieldCorrection(fname);};
|
int setFlatFieldCorrectionFile(std::string fname=""){return setFlatFieldCorrection(fname);};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
set/get dynamic range
|
set/get dynamic range
|
||||||
@ -532,12 +535,12 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
|
|||||||
\param fname file name
|
\param fname file name
|
||||||
\returns OK or FAIL
|
\returns OK or FAIL
|
||||||
*/
|
*/
|
||||||
virtual int readConfigurationFile(string const fname)=0;
|
virtual int readConfigurationFile(std::string const fname)=0;
|
||||||
|
|
||||||
virtual int dumpDetectorSetup(string const fname, int level)=0;
|
virtual int dumpDetectorSetup(std::string const fname, int level)=0;
|
||||||
int dumpDetectorSetup(string const fname){return dumpDetectorSetup(fname,0);};
|
int dumpDetectorSetup(std::string const fname){return dumpDetectorSetup(fname,0);};
|
||||||
virtual int retrieveDetectorSetup(string const fname, int level)=0;
|
virtual int retrieveDetectorSetup(std::string const fname, int level)=0;
|
||||||
int retrieveDetectorSetup(string const fname){return retrieveDetectorSetup(fname,0);};
|
int retrieveDetectorSetup(std::string const fname){return retrieveDetectorSetup(fname,0);};
|
||||||
/**
|
/**
|
||||||
@short
|
@short
|
||||||
\returns the default output file index
|
\returns the default output file index
|
||||||
@ -628,11 +631,11 @@ virtual int enableDataStreamingFromReceiver(int enable=-1)=0;
|
|||||||
virtual runStatus startReceiverReadout()=0;
|
virtual runStatus startReceiverReadout()=0;
|
||||||
|
|
||||||
|
|
||||||
/** returns detector type string from detector type index
|
/** returns detector type std::string from detector type index
|
||||||
\param t string can be Mythen, Pilatus, Eiger, Gotthard, Agipd, Unknown
|
\param t std::string can be Mythen, Pilatus, Eiger, Gotthard, Agipd, Unknown
|
||||||
\returns MYTHEN, PILATUS, EIGER, GOTTHARD, AGIPD, MÖNCH, GENERIC
|
\returns MYTHEN, PILATUS, EIGER, GOTTHARD, AGIPD, MÖNCH, GENERIC
|
||||||
*/
|
*/
|
||||||
static string getDetectorType(detectorType t){\
|
static std::string getDetectorType(detectorType t){\
|
||||||
switch (t) {\
|
switch (t) {\
|
||||||
case MYTHEN: return string("Mythen"); \
|
case MYTHEN: return string("Mythen"); \
|
||||||
case PILATUS: return string("Pilatus"); \
|
case PILATUS: return string("Pilatus"); \
|
||||||
@ -650,7 +653,7 @@ virtual int enableDataStreamingFromReceiver(int enable=-1)=0;
|
|||||||
\param type can be MYTHEN, PILATUS, EIGER, GOTTHARD, AGIPD, GENERIC
|
\param type can be MYTHEN, PILATUS, EIGER, GOTTHARD, AGIPD, GENERIC
|
||||||
\returns Mythen, Pilatus, Eiger, Gotthard, Agipd, Mönch, Unknown
|
\returns Mythen, Pilatus, Eiger, Gotthard, Agipd, Mönch, Unknown
|
||||||
*/
|
*/
|
||||||
static detectorType getDetectorType(string const type){\
|
static detectorType getDetectorType(std::string const type){\
|
||||||
if (type=="Mythen") return MYTHEN;\
|
if (type=="Mythen") return MYTHEN;\
|
||||||
if (type=="Pilatus") return PILATUS; \
|
if (type=="Pilatus") return PILATUS; \
|
||||||
if (type=="Eiger") return EIGER; \
|
if (type=="Eiger") return EIGER; \
|
||||||
@ -668,7 +671,7 @@ virtual int enableDataStreamingFromReceiver(int enable=-1)=0;
|
|||||||
\param type can be none, gating, trigger, complementary
|
\param type can be none, gating, trigger, complementary
|
||||||
\returns ONE, MASTER_GATES, MASTER_TRIGGERS, SLAVE_STARTS_WHEN_MASTER_STOPS
|
\returns ONE, MASTER_GATES, MASTER_TRIGGERS, SLAVE_STARTS_WHEN_MASTER_STOPS
|
||||||
*/
|
*/
|
||||||
static synchronizationMode getSyncType(string const type){\
|
static synchronizationMode getSyncType(std::string const type){\
|
||||||
if (type=="none") return NO_SYNCHRONIZATION;\
|
if (type=="none") return NO_SYNCHRONIZATION;\
|
||||||
if (type=="gating") return MASTER_GATES;\
|
if (type=="gating") return MASTER_GATES;\
|
||||||
if (type=="trigger") return MASTER_TRIGGERS; \
|
if (type=="trigger") return MASTER_TRIGGERS; \
|
||||||
@ -676,11 +679,11 @@ virtual int enableDataStreamingFromReceiver(int enable=-1)=0;
|
|||||||
return GET_SYNCHRONIZATION_MODE; \
|
return GET_SYNCHRONIZATION_MODE; \
|
||||||
};
|
};
|
||||||
|
|
||||||
/** returns synchronization type string from index
|
/** returns synchronization type std::string from index
|
||||||
\param s can be NONE, MASTER_GATES, MASTER_TRIGGERS, SLAVE_STARTS_WHEN_MASTER_STOPS
|
\param s can be NONE, MASTER_GATES, MASTER_TRIGGERS, SLAVE_STARTS_WHEN_MASTER_STOPS
|
||||||
\returns none, gating, trigger, complementary, unknown
|
\returns none, gating, trigger, complementary, unknown
|
||||||
*/
|
*/
|
||||||
static string getSyncType(synchronizationMode s ){\
|
static std::string getSyncType(synchronizationMode s ){\
|
||||||
switch(s) { \
|
switch(s) { \
|
||||||
case NO_SYNCHRONIZATION: return string("none"); \
|
case NO_SYNCHRONIZATION: return string("none"); \
|
||||||
case MASTER_GATES: return string("gating"); \
|
case MASTER_GATES: return string("gating"); \
|
||||||
@ -691,11 +694,11 @@ virtual int enableDataStreamingFromReceiver(int enable=-1)=0;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** returns string from external signal type index
|
/** returns std::string from external signal type index
|
||||||
\param f can be SIGNAL_OFF, GATE_IN_ACTIVE_HIGH, GATE_IN_ACTIVE_LOW, TRIGGER_IN_RISING_EDGE, TRIGGER_IN_FALLING_EDGE, RO_TRIGGER_IN_RISING_EDGE, RO_TRIGGER_IN_FALLING_EDGE, GATE_OUT_ACTIVE_HIGH, GATE_OUT_ACTIVE_LOW, =TRIGGER_OUT_RISING_EDGE, TRIGGER_OUT_FALLING_EDGE, RO_TRIGGER_OUT_RISING_EDGE, RO_TRIGGER_OUT_FALLING_EDGE, OUTPUT_LOW, OUTPUT_HIGH, MASTER_SLAVE_SYNCHRONIZATION, GET_EXTERNAL_SIGNAL_FLAG
|
\param f can be SIGNAL_OFF, GATE_IN_ACTIVE_HIGH, GATE_IN_ACTIVE_LOW, TRIGGER_IN_RISING_EDGE, TRIGGER_IN_FALLING_EDGE, RO_TRIGGER_IN_RISING_EDGE, RO_TRIGGER_IN_FALLING_EDGE, GATE_OUT_ACTIVE_HIGH, GATE_OUT_ACTIVE_LOW, =TRIGGER_OUT_RISING_EDGE, TRIGGER_OUT_FALLING_EDGE, RO_TRIGGER_OUT_RISING_EDGE, RO_TRIGGER_OUT_FALLING_EDGE, OUTPUT_LOW, OUTPUT_HIGH, MASTER_SLAVE_SYNCHRONIZATION, GET_EXTERNAL_SIGNAL_FLAG
|
||||||
\returns string off, gate_in_active_high, gate_in_active_low, trigger_in_rising_edge, trigger_in_falling_edge, ro_trigger_in_rising_edge, ro_trigger_in_falling_edge, gate_out_active_high, gate_out_active_low, trigger_out_rising_edge, trigger_out_falling_edge, ro_trigger_out_rising_edge, ro_trigger_out_falling_edge, gnd, vcc, sync, unknown
|
\returns std::string off, gate_in_active_high, gate_in_active_low, trigger_in_rising_edge, trigger_in_falling_edge, ro_trigger_in_rising_edge, ro_trigger_in_falling_edge, gate_out_active_high, gate_out_active_low, trigger_out_rising_edge, trigger_out_falling_edge, ro_trigger_out_rising_edge, ro_trigger_out_falling_edge, gnd, vcc, sync, unknown
|
||||||
*/
|
*/
|
||||||
static string externalSignalType(externalSignalFlag f){\
|
static std::string externalSignalType(externalSignalFlag f){\
|
||||||
switch(f) { \
|
switch(f) { \
|
||||||
case SIGNAL_OFF: return string( "off"); \
|
case SIGNAL_OFF: return string( "off"); \
|
||||||
case GATE_IN_ACTIVE_HIGH: return string( "gate_in_active_high"); \
|
case GATE_IN_ACTIVE_HIGH: return string( "gate_in_active_high"); \
|
||||||
@ -724,7 +727,7 @@ virtual int enableDataStreamingFromReceiver(int enable=-1)=0;
|
|||||||
\returns can be SIGNAL_OFF, GATE_IN_ACTIVE_HIGH, GATE_IN_ACTIVE_LOW, TRIGGER_IN_RISING_EDGE, TRIGGER_IN_FALLING_EDGE, RO_TRIGGER_IN_RISING_EDGE, RO_TRIGGER_IN_FALLING_EDGE, GATE_OUT_ACTIVE_HIGH, GATE_OUT_ACTIVE_LOW, TRIGGER_OUT_RISING_EDGE, TRIGGER_OUT_FALLING_EDGE, RO_TRIGGER_OUT_RISING_EDGE, RO_TRIGGER_OUT_FALLING_EDGE, OUTPUT_LOW, OUTPUT_HIGH, MASTER_SLAVE_SYNCHRONIZATION, GET_EXTERNAL_SIGNAL_FLAG (if unknown)
|
\returns can be SIGNAL_OFF, GATE_IN_ACTIVE_HIGH, GATE_IN_ACTIVE_LOW, TRIGGER_IN_RISING_EDGE, TRIGGER_IN_FALLING_EDGE, RO_TRIGGER_IN_RISING_EDGE, RO_TRIGGER_IN_FALLING_EDGE, GATE_OUT_ACTIVE_HIGH, GATE_OUT_ACTIVE_LOW, TRIGGER_OUT_RISING_EDGE, TRIGGER_OUT_FALLING_EDGE, RO_TRIGGER_OUT_RISING_EDGE, RO_TRIGGER_OUT_FALLING_EDGE, OUTPUT_LOW, OUTPUT_HIGH, MASTER_SLAVE_SYNCHRONIZATION, GET_EXTERNAL_SIGNAL_FLAG (if unknown)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static externalSignalFlag externalSignalType(string sval){\
|
static externalSignalFlag externalSignalType(std::string sval){\
|
||||||
if (sval=="off") return SIGNAL_OFF;\
|
if (sval=="off") return SIGNAL_OFF;\
|
||||||
if (sval=="gate_in_active_high") return GATE_IN_ACTIVE_HIGH; \
|
if (sval=="gate_in_active_high") return GATE_IN_ACTIVE_HIGH; \
|
||||||
if (sval=="gate_in_active_low") return GATE_IN_ACTIVE_LOW;\
|
if (sval=="gate_in_active_low") return GATE_IN_ACTIVE_LOW;\
|
||||||
@ -743,13 +746,13 @@ virtual int enableDataStreamingFromReceiver(int enable=-1)=0;
|
|||||||
if (sval=="vcc") return OUTPUT_HIGH;\
|
if (sval=="vcc") return OUTPUT_HIGH;\
|
||||||
return GET_EXTERNAL_SIGNAL_FLAG ;};
|
return GET_EXTERNAL_SIGNAL_FLAG ;};
|
||||||
|
|
||||||
/** returns detector settings string from index
|
/** returns detector settings std::string from index
|
||||||
\param s can be STANDARD, FAST, HIGHGAIN, DYNAMICGAIN, LOWGAIN, MEDIUMGAIN, VERYHIGHGAIN, LOWNOISE,
|
\param s can be STANDARD, FAST, HIGHGAIN, DYNAMICGAIN, LOWGAIN, MEDIUMGAIN, VERYHIGHGAIN, LOWNOISE,
|
||||||
DYNAMICHG0, FIXGAIN1, FIXGAIN2, FORCESWITCHG1, FORCESWITCHG2, GET_SETTINGS
|
DYNAMICHG0, FIXGAIN1, FIXGAIN2, FORCESWITCHG1, FORCESWITCHG2, GET_SETTINGS
|
||||||
\returns standard, fast, highgain, dynamicgain, lowgain, mediumgain, veryhighgain, lownoise,
|
\returns standard, fast, highgain, dynamicgain, lowgain, mediumgain, veryhighgain, lownoise,
|
||||||
dynamichg0, fixgain1, fixgain2, forceswitchg1, forceswitchg2, verylowgain, undefined
|
dynamichg0, fixgain1, fixgain2, forceswitchg1, forceswitchg2, verylowgain, undefined
|
||||||
*/
|
*/
|
||||||
static string getDetectorSettings(detectorSettings s){\
|
static std::string getDetectorSettings(detectorSettings s){\
|
||||||
switch(s) { \
|
switch(s) { \
|
||||||
case STANDARD: return string("standard"); \
|
case STANDARD: return string("standard"); \
|
||||||
case FAST: return string("fast"); \
|
case FAST: return string("fast"); \
|
||||||
@ -768,14 +771,14 @@ virtual int enableDataStreamingFromReceiver(int enable=-1)=0;
|
|||||||
default: return string("undefined"); \
|
default: return string("undefined"); \
|
||||||
}};
|
}};
|
||||||
|
|
||||||
/** returns detector settings string from index
|
/** returns detector settings std::string from index
|
||||||
\param s can be standard, fast, highgain, dynamicgain, lowgain, mediumgain, veryhighgain, lownoise,
|
\param s can be standard, fast, highgain, dynamicgain, lowgain, mediumgain, veryhighgain, lownoise,
|
||||||
dynamichg0, fixgain1, fixgain2, forceswitchg1, forceswitchg2, undefined
|
dynamichg0, fixgain1, fixgain2, forceswitchg1, forceswitchg2, undefined
|
||||||
\returns setting index STANDARD, FAST, HIGHGAIN, DYNAMICGAIN, LOWGAIN, MEDIUMGAIN, VERYHIGHGAIN,LOWNOISE,
|
\returns setting index STANDARD, FAST, HIGHGAIN, DYNAMICGAIN, LOWGAIN, MEDIUMGAIN, VERYHIGHGAIN,LOWNOISE,
|
||||||
DYNAMICHG0, FIXGAIN1, FIXGAIN2, FORCESWITCHG1, FORCESWITCHG2, VERYLOWGAIN, GET_SETTINGS
|
DYNAMICHG0, FIXGAIN1, FIXGAIN2, FORCESWITCHG1, FORCESWITCHG2, VERYLOWGAIN, GET_SETTINGS
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static detectorSettings getDetectorSettings(string s){ \
|
static detectorSettings getDetectorSettings(std::string s){ \
|
||||||
if (s=="standard") return STANDARD; \
|
if (s=="standard") return STANDARD; \
|
||||||
if (s=="fast") return FAST; \
|
if (s=="fast") return FAST; \
|
||||||
if (s=="highgain") return HIGHGAIN; \
|
if (s=="highgain") return HIGHGAIN; \
|
||||||
@ -795,12 +798,12 @@ virtual int enableDataStreamingFromReceiver(int enable=-1)=0;
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
returns external communication mode string from index
|
returns external communication mode std::string from index
|
||||||
\param f can be AUTO_TIMING, TRIGGER_EXPOSURE, TRIGGER_READOUT, GATE_FIX_NUMBER, GATE_WITH_START_TRIGGER, BURST_TRIGGER, GET_EXTERNAL_COMMUNICATION_MODE
|
\param f can be AUTO_TIMING, TRIGGER_EXPOSURE, TRIGGER_READOUT, GATE_FIX_NUMBER, GATE_WITH_START_TRIGGER, BURST_TRIGGER, GET_EXTERNAL_COMMUNICATION_MODE
|
||||||
\returns auto, trigger, ro_trigger, gating, triggered_gating, unknown
|
\returns auto, trigger, ro_trigger, gating, triggered_gating, unknown
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static string externalCommunicationType(externalCommunicationMode f){ \
|
static std::string externalCommunicationType(externalCommunicationMode f){ \
|
||||||
switch(f) { \
|
switch(f) { \
|
||||||
case AUTO_TIMING: return string( "auto"); \
|
case AUTO_TIMING: return string( "auto"); \
|
||||||
case TRIGGER_EXPOSURE: return string("trigger"); \
|
case TRIGGER_EXPOSURE: return string("trigger"); \
|
||||||
@ -819,7 +822,7 @@ virtual int enableDataStreamingFromReceiver(int enable=-1)=0;
|
|||||||
\returns AUTO_TIMING, TRIGGER_EXPOSURE, TRIGGER_READOUT, GATE_FIX_NUMBER, GATE_WITH_START_TRIGGER, BURST_TRIGGER, GET_EXTERNAL_COMMUNICATION_MODE
|
\returns AUTO_TIMING, TRIGGER_EXPOSURE, TRIGGER_READOUT, GATE_FIX_NUMBER, GATE_WITH_START_TRIGGER, BURST_TRIGGER, GET_EXTERNAL_COMMUNICATION_MODE
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static externalCommunicationMode externalCommunicationType(string sval){\
|
static externalCommunicationMode externalCommunicationType(std::string sval){\
|
||||||
if (sval=="auto") return AUTO_TIMING;\
|
if (sval=="auto") return AUTO_TIMING;\
|
||||||
if (sval=="trigger") return TRIGGER_EXPOSURE; \
|
if (sval=="trigger") return TRIGGER_EXPOSURE; \
|
||||||
if (sval=="ro_trigger") return TRIGGER_READOUT;\
|
if (sval=="ro_trigger") return TRIGGER_READOUT;\
|
||||||
@ -829,11 +832,11 @@ virtual int enableDataStreamingFromReceiver(int enable=-1)=0;
|
|||||||
return GET_EXTERNAL_COMMUNICATION_MODE; \
|
return GET_EXTERNAL_COMMUNICATION_MODE; \
|
||||||
};
|
};
|
||||||
|
|
||||||
/** returns string from run status index
|
/** returns std::string from run status index
|
||||||
\param s can be ERROR, WAITING, RUNNING, TRANSMITTING, RUN_FINISHED
|
\param s can be ERROR, WAITING, RUNNING, TRANSMITTING, RUN_FINISHED
|
||||||
\returns string error, waiting, running, data, finished
|
\returns std::string error, waiting, running, data, finished
|
||||||
*/
|
*/
|
||||||
static string runStatusType(runStatus s){\
|
static std::string runStatusType(runStatus s){\
|
||||||
switch (s) { \
|
switch (s) { \
|
||||||
case ERROR: return string("error"); \
|
case ERROR: return string("error"); \
|
||||||
case WAITING: return string("waiting"); \
|
case WAITING: return string("waiting"); \
|
||||||
@ -843,11 +846,11 @@ virtual int enableDataStreamingFromReceiver(int enable=-1)=0;
|
|||||||
default: return string("idle"); \
|
default: return string("idle"); \
|
||||||
}};
|
}};
|
||||||
|
|
||||||
/** returns string from file format index
|
/** returns std::string from file format index
|
||||||
\param s can be RAW, HDF5
|
\param s can be RAW, HDF5
|
||||||
\returns string raw, hdf5
|
\returns std::string raw, hdf5
|
||||||
*/
|
*/
|
||||||
static string fileFormats(fileFormat f){\
|
static std::string fileFormats(fileFormat f){\
|
||||||
switch (f) { \
|
switch (f) { \
|
||||||
case BINARY: return string("binary"); \
|
case BINARY: return string("binary"); \
|
||||||
case ASCII: return string("ascii"); \
|
case ASCII: return string("ascii"); \
|
||||||
@ -855,11 +858,11 @@ virtual int enableDataStreamingFromReceiver(int enable=-1)=0;
|
|||||||
default: return string("unknown"); \
|
default: return string("unknown"); \
|
||||||
}};
|
}};
|
||||||
|
|
||||||
/** returns string from timer index
|
/** returns std::string from timer index
|
||||||
\param s can be FRAME_NUMBER,ACQUISITION_TIME,FRAME_PERIOD, DELAY_AFTER_TRIGGER,GATES_NUMBER,PROBES_NUMBER, CYCLES_NUMBER, ACTUAL_TIME,MEASUREMENT_TIME, PROGRESS,MEASUREMENTS_NUMBER,FRAMES_FROM_START,FRAMES_FROM_START_PG,SAMPLES_JCTB,SUBFRAME_ACQUISITION_TIME,STORAGE_CELL_NUMBER, SUBFRAME_PERIOD
|
\param s can be FRAME_NUMBER,ACQUISITION_TIME,FRAME_PERIOD, DELAY_AFTER_TRIGGER,GATES_NUMBER,PROBES_NUMBER, CYCLES_NUMBER, ACTUAL_TIME,MEASUREMENT_TIME, PROGRESS,MEASUREMENTS_NUMBER,FRAMES_FROM_START,FRAMES_FROM_START_PG,SAMPLES_JCTB,SUBFRAME_ACQUISITION_TIME,STORAGE_CELL_NUMBER, SUBFRAME_PERIOD
|
||||||
\returns string frame_number,acquisition_time,frame_period, delay_after_trigger,gates_number,probes_number, cycles_number, actual_time,measurement_time, progress,measurements_number,frames_from_start,frames_from_start_pg,samples_jctb,subframe_acquisition_time,storage_cell_number, subframe_period
|
\returns std::string frame_number,acquisition_time,frame_period, delay_after_trigger,gates_number,probes_number, cycles_number, actual_time,measurement_time, progress,measurements_number,frames_from_start,frames_from_start_pg,samples_jctb,subframe_acquisition_time,storage_cell_number, subframe_period
|
||||||
*/
|
*/
|
||||||
static string getTimerType(timerIndex t){ \
|
static std::string getTimerType(timerIndex t){ \
|
||||||
switch (t) { \
|
switch (t) { \
|
||||||
case FRAME_NUMBER: return string("frame_number"); \
|
case FRAME_NUMBER: return string("frame_number"); \
|
||||||
case ACQUISITION_TIME: return string("acquisition_time"); \
|
case ACQUISITION_TIME: return string("acquisition_time"); \
|
||||||
@ -888,7 +891,7 @@ virtual int enableDataStreamingFromReceiver(int enable=-1)=0;
|
|||||||
\returns TEMPERATURE_FPGA, TEMPERATURE_FPGAEXT, TEMPERATURE_10GE, TEMPERATURE_DCDC, TEMPERATURE_SODL,
|
\returns TEMPERATURE_FPGA, TEMPERATURE_FPGAEXT, TEMPERATURE_10GE, TEMPERATURE_DCDC, TEMPERATURE_SODL,
|
||||||
TEMPERATURE_SODR, TEMPERATURE_FPGA2, TEMPERATURE_FPGA3, -1 when unknown mode
|
TEMPERATURE_SODR, TEMPERATURE_FPGA2, TEMPERATURE_FPGA3, -1 when unknown mode
|
||||||
*/
|
*/
|
||||||
static int getADCIndex(string s){
|
static int getADCIndex(std::string s){
|
||||||
if (s=="temp_fpga") return TEMPERATURE_FPGA;
|
if (s=="temp_fpga") return TEMPERATURE_FPGA;
|
||||||
if (s=="temp_fpgaext") return TEMPERATURE_FPGAEXT;
|
if (s=="temp_fpgaext") return TEMPERATURE_FPGAEXT;
|
||||||
if (s=="temp_10ge") return TEMPERATURE_10GE;
|
if (s=="temp_10ge") return TEMPERATURE_10GE;
|
||||||
@ -906,7 +909,7 @@ virtual int enableDataStreamingFromReceiver(int enable=-1)=0;
|
|||||||
\param s can be vcmp_ll, vcmp_lr, vcmp_rl, vcmp_rr, vthreshold, vrf, vrs, vtr, vcall, vcp
|
\param s can be vcmp_ll, vcmp_lr, vcmp_rl, vcmp_rr, vthreshold, vrf, vrs, vtr, vcall, vcp
|
||||||
\returns E_Vcmp_ll, E_Vcmp_lr, E_Vcmp_rl, E_Vcmp_rr, THRESHOLD, E_Vrf, E_Vrs, E_Vtr, E_cal, E_Vcp , -1 when unknown mode
|
\returns E_Vcmp_ll, E_Vcmp_lr, E_Vcmp_rl, E_Vcmp_rr, THRESHOLD, E_Vrf, E_Vrs, E_Vtr, E_cal, E_Vcp , -1 when unknown mode
|
||||||
*/
|
*/
|
||||||
static int getDACIndex(string s){
|
static int getDACIndex(std::string s){
|
||||||
if (s=="vcmp_ll") return E_Vcmp_ll;
|
if (s=="vcmp_ll") return E_Vcmp_ll;
|
||||||
if (s=="vcmp_lr") return E_Vcmp_lr;
|
if (s=="vcmp_lr") return E_Vcmp_lr;
|
||||||
if (s=="vcmp_rl") return E_Vcmp_rl;
|
if (s=="vcmp_rl") return E_Vcmp_rl;
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
//double angle(int ichan, double encoder, double totalOffset, double conv_r, double center, double offset, double tilt, int direction)
|
//double angle(int ichan, double encoder, double totalOffset, double conv_r, double center, double offset, double tilt, int direction)
|
||||||
|
|
||||||
|
|
||||||
using namespace std;
|
// using namespace std;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@short Angular conversion constants needed for a detector module
|
@short Angular conversion constants needed for a detector module
|
||||||
@ -58,7 +58,7 @@ class angularConversion : public virtual slsDetectorBase, public angularConversi
|
|||||||
pure virtual function
|
pure virtual function
|
||||||
\param file name to be written (nmod and array of angular conversion constants default to the ones ot the slsDetector
|
\param file name to be written (nmod and array of angular conversion constants default to the ones ot the slsDetector
|
||||||
*/
|
*/
|
||||||
virtual int writeAngularConversion(string fname)=0;
|
virtual int writeAngularConversion(std::string fname)=0;
|
||||||
/**
|
/**
|
||||||
sets the arrays of the merged data to 0. NB The array should be created with size >= 360./getBinSize();
|
sets the arrays of the merged data to 0. NB The array should be created with size >= 360./getBinSize();
|
||||||
\param mp already merged postions
|
\param mp already merged postions
|
||||||
@ -250,19 +250,19 @@ class angularConversion : public virtual slsDetectorBase, public angularConversi
|
|||||||
\returns angular conversion flag
|
\returns angular conversion flag
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int setAngularConversionFile(string fname);
|
int setAngularConversionFile(std::string fname);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
returns the angular conversion file
|
returns the angular conversion file
|
||||||
*/
|
*/
|
||||||
string getAngularConversionFile(){if (setAngularCorrectionMask()) return string(angConvFile); else return string("none");};
|
std::string getAngularConversionFile(){if (setAngularCorrectionMask()) return string(angConvFile); else return string("none");};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
reads teh angular conversion file for the (multi)detector and writes it to shared memory
|
reads teh angular conversion file for the (multi)detector and writes it to shared memory
|
||||||
*/
|
*/
|
||||||
virtual int readAngularConversionFile(string fname="")=0;
|
virtual int readAngularConversionFile(std::string fname="")=0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,12 +7,12 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
using namespace std;
|
// using namespace std;
|
||||||
class badChannelCorrections{
|
class badChannelCorrections{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
static int readBadChannelCorrectionFile(string fname, int &nbad, int *badlist){ ifstream infile(fname.c_str()); int nb=-1; if (infile.is_open()) {nb=readBadChannelCorrectionFile(infile,nbad,badlist); infile.close();}; return nb;};
|
static int readBadChannelCorrectionFile(std::string fname, int &nbad, int *badlist){ ifstream infile(fname.c_str()); int nb=-1; if (infile.is_open()) {nb=readBadChannelCorrectionFile(infile,nbad,badlist); infile.close();}; return nb;};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -20,11 +20,11 @@ class badChannelCorrections{
|
|||||||
int interrupt=0; \
|
int interrupt=0; \
|
||||||
int ich; \
|
int ich; \
|
||||||
int chmin,chmax; \
|
int chmin,chmax; \
|
||||||
string str; \
|
std::string str; \
|
||||||
nbad=0; \
|
nbad=0; \
|
||||||
while (infile.good() and interrupt==0) { \
|
while (infile.good() and interrupt==0) { \
|
||||||
getline(infile,str); \
|
getline(infile,str); \
|
||||||
istringstream ssstr; \
|
std::istringstream ssstr; \
|
||||||
ssstr.str(str); \
|
ssstr.str(str); \
|
||||||
if (ssstr.bad() || ssstr.fail() || infile.eof()) { \
|
if (ssstr.bad() || ssstr.fail() || infile.eof()) { \
|
||||||
interrupt=1; \
|
interrupt=1; \
|
||||||
|
@ -14,6 +14,9 @@
|
|||||||
#define MYROOT
|
#define MYROOT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
using std::endl;
|
||||||
|
using std::cout;
|
||||||
|
|
||||||
#include "sls_detector_defs.h"
|
#include "sls_detector_defs.h"
|
||||||
// using namespace std;
|
// using namespace std;
|
||||||
/**
|
/**
|
||||||
@ -59,8 +62,8 @@ class fileIOStatic {
|
|||||||
static std::string createFileName(char *filepath, char *filename, int aMask, double sv0, int prec0, double sv1, int prec1, int pindex, int npos, int findex, int frameindex=-1, int detindex=-1){ \
|
static std::string createFileName(char *filepath, char *filename, int aMask, double sv0, int prec0, double sv1, int prec1, int pindex, int npos, int findex, int frameindex=-1, int detindex=-1){ \
|
||||||
std::ostringstream osfn; \
|
std::ostringstream osfn; \
|
||||||
osfn << filepath << "/" << filename; \
|
osfn << filepath << "/" << filename; \
|
||||||
if ( aMask& (1 << (slsDetectorDefs::MAX_ACTIONS))) osfn << "_S" << fixed << setprecision(prec0) << sv0; \
|
if ( aMask& (1 << (slsDetectorDefs::MAX_ACTIONS))) osfn << "_S" << std::fixed << std::setprecision(prec0) << sv0; \
|
||||||
if (aMask & (1 << (slsDetectorDefs::MAX_ACTIONS+1))) osfn << "_s" << fixed << setprecision(prec1) << sv1; \
|
if (aMask & (1 << (slsDetectorDefs::MAX_ACTIONS+1))) osfn << "_s" << std::fixed << std::setprecision(prec1) << sv1; \
|
||||||
if (pindex>0 && pindex<=npos) osfn << "_p" << pindex; \
|
if (pindex>0 && pindex<=npos) osfn << "_p" << pindex; \
|
||||||
if(detindex>=0) osfn << "_d"<< detindex; \
|
if(detindex>=0) osfn << "_d"<< detindex; \
|
||||||
if(frameindex>=0) osfn << "_f" << frameindex; \
|
if(frameindex>=0) osfn << "_f" << frameindex; \
|
||||||
@ -89,8 +92,8 @@ class fileIOStatic {
|
|||||||
static std::string createReceiverFilePrefix(char *filename, int aMask, double sv0, int prec0, double sv1, int prec1, int pindex, int npos,int detindex=-1){ \
|
static std::string createReceiverFilePrefix(char *filename, int aMask, double sv0, int prec0, double sv1, int prec1, int pindex, int npos,int detindex=-1){ \
|
||||||
std::ostringstream osfn; \
|
std::ostringstream osfn; \
|
||||||
osfn << filename; \
|
osfn << filename; \
|
||||||
if ( aMask& (1 << (slsDetectorDefs::MAX_ACTIONS))) osfn << "_S" << fixed << setprecision(prec0) << sv0; \
|
if ( aMask& (1 << (slsDetectorDefs::MAX_ACTIONS))) osfn << "_S" << std::fixed << std::setprecision(prec0) << sv0; \
|
||||||
if (aMask & (1 << (slsDetectorDefs::MAX_ACTIONS+1))) osfn << "_s" << fixed << setprecision(prec1) << sv1; \
|
if (aMask & (1 << (slsDetectorDefs::MAX_ACTIONS+1))) osfn << "_s" << std::fixed << std::setprecision(prec1) << sv1; \
|
||||||
if (pindex>0 && pindex<=npos) osfn << "_p" << pindex; \
|
if (pindex>0 && pindex<=npos) osfn << "_p" << pindex; \
|
||||||
if(detindex!=-1) osfn << "_d"<< detindex; \
|
if(detindex!=-1) osfn << "_d"<< detindex; \
|
||||||
return osfn.str(); \
|
return osfn.str(); \
|
||||||
@ -359,12 +362,12 @@ class fileIOStatic {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static int writeDataFile(std::string fname, int nch, double *data, double *err=NULL, double *ang=NULL, char dataformat='f'){ \
|
static int writeDataFile(std::string fname, int nch, double *data, double *err=NULL, double *ang=NULL, char dataformat='f'){ \
|
||||||
ofstream outfile; \
|
std::ofstream outfile; \
|
||||||
if (data==NULL) { \
|
if (data==NULL) { \
|
||||||
cout << "No data to write!" << endl; \
|
cout << "No data to write!" << endl; \
|
||||||
return slsDetectorDefs::FAIL; \
|
return slsDetectorDefs::FAIL; \
|
||||||
} \
|
} \
|
||||||
outfile.open (fname.c_str(),ios_base::out); \
|
outfile.open (fname.c_str(),std::ios_base::out); \
|
||||||
if (outfile.is_open()) { \
|
if (outfile.is_open()) { \
|
||||||
writeDataFile(outfile, nch, data, err, ang, dataformat, 0); \
|
writeDataFile(outfile, nch, data, err, ang, dataformat, 0); \
|
||||||
outfile.close(); \
|
outfile.close(); \
|
||||||
@ -389,7 +392,7 @@ class fileIOStatic {
|
|||||||
\param offset start channel number
|
\param offset start channel number
|
||||||
\returns OK or FAIL if it could not write the file or data=NULL
|
\returns OK or FAIL if it could not write the file or data=NULL
|
||||||
*/
|
*/
|
||||||
static int writeDataFile(ofstream &outfile, int nch, double *data, double *err=NULL, double *ang=NULL, char dataformat='f', int offset=0){
|
static int writeDataFile(std::ofstream &outfile, int nch, double *data, double *err=NULL, double *ang=NULL, char dataformat='f', int offset=0){
|
||||||
int idata; \
|
int idata; \
|
||||||
if (data==NULL || nch==0) { \
|
if (data==NULL || nch==0) { \
|
||||||
cout << "No data to write!" << endl; \
|
cout << "No data to write!" << endl; \
|
||||||
@ -427,9 +430,9 @@ class fileIOStatic {
|
|||||||
\returns OK or FAIL if it could not write the file or data=NULL
|
\returns OK or FAIL if it could not write the file or data=NULL
|
||||||
*/
|
*/
|
||||||
static int writeDataFile(std::string fname,int nch, int *data){ \
|
static int writeDataFile(std::string fname,int nch, int *data){ \
|
||||||
ofstream outfile; \
|
std::ofstream outfile; \
|
||||||
if (data==NULL) return slsDetectorDefs::FAIL; \
|
if (data==NULL) return slsDetectorDefs::FAIL; \
|
||||||
outfile.open (fname.c_str(),ios_base::out); \
|
outfile.open (fname.c_str(),std::ios_base::out); \
|
||||||
if (outfile.is_open()) { \
|
if (outfile.is_open()) { \
|
||||||
writeDataFile(outfile, nch, data, 0); \
|
writeDataFile(outfile, nch, data, 0); \
|
||||||
outfile.close(); \
|
outfile.close(); \
|
||||||
@ -473,7 +476,7 @@ class fileIOStatic {
|
|||||||
\param offset start channel number
|
\param offset start channel number
|
||||||
\returns OK or FAIL if it could not write the file or data=NULL
|
\returns OK or FAIL if it could not write the file or data=NULL
|
||||||
*/
|
*/
|
||||||
static int writeDataFile(ofstream &outfile,int nch, int *data, int offset=0){ \
|
static int writeDataFile(std::ofstream &outfile,int nch, int *data, int offset=0){ \
|
||||||
if (data==NULL) return slsDetectorDefs::FAIL; \
|
if (data==NULL) return slsDetectorDefs::FAIL; \
|
||||||
for (int ichan=0; ichan<nch; ichan++) outfile << ichan+offset << " " << *(data+ichan) << std::endl; \
|
for (int ichan=0; ichan<nch; ichan++) outfile << ichan+offset << " " << *(data+ichan) << std::endl; \
|
||||||
return slsDetectorDefs::OK; \
|
return slsDetectorDefs::OK; \
|
||||||
@ -491,9 +494,9 @@ class fileIOStatic {
|
|||||||
\returns OK or FAIL if it could not write the file or data=NULL
|
\returns OK or FAIL if it could not write the file or data=NULL
|
||||||
*/
|
*/
|
||||||
static int writeDataFile(std::string fname,int nch, short int *data) { \
|
static int writeDataFile(std::string fname,int nch, short int *data) { \
|
||||||
ofstream outfile; \
|
std::ofstream outfile; \
|
||||||
if (data==NULL) return slsDetectorDefs::FAIL; \
|
if (data==NULL) return slsDetectorDefs::FAIL; \
|
||||||
outfile.open (fname.c_str(),ios_base::out); \
|
outfile.open (fname.c_str(),std::ios_base::out); \
|
||||||
if (outfile.is_open()) { \
|
if (outfile.is_open()) { \
|
||||||
writeDataFile(outfile, nch, data, 0); \
|
writeDataFile(outfile, nch, data, 0); \
|
||||||
outfile.close(); \
|
outfile.close(); \
|
||||||
@ -514,7 +517,7 @@ class fileIOStatic {
|
|||||||
\param offset start channel number
|
\param offset start channel number
|
||||||
\returns OK or FAIL if it could not write the file or data=NULL
|
\returns OK or FAIL if it could not write the file or data=NULL
|
||||||
*/
|
*/
|
||||||
static int writeDataFile(ofstream &outfile,int nch, short int *data, int offset=0){ \
|
static int writeDataFile(std::ofstream &outfile,int nch, short int *data, int offset=0){ \
|
||||||
if (data==NULL) return slsDetectorDefs::FAIL; \
|
if (data==NULL) return slsDetectorDefs::FAIL; \
|
||||||
for (int ichan=0; ichan<nch; ichan++) outfile << ichan+offset << " " << *(data+ichan) << std::endl; \
|
for (int ichan=0; ichan<nch; ichan++) outfile << ichan+offset << " " << *(data+ichan) << std::endl; \
|
||||||
return slsDetectorDefs::OK; \
|
return slsDetectorDefs::OK; \
|
||||||
@ -532,10 +535,10 @@ class fileIOStatic {
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
static int readDataFile(int nch, std::string fname, double *data, double *err=NULL, double *ang=NULL, char dataformat='f') { \
|
static int readDataFile(int nch, std::string fname, double *data, double *err=NULL, double *ang=NULL, char dataformat='f') { \
|
||||||
ifstream infile; \
|
std::ifstream infile; \
|
||||||
int iline=0; \
|
int iline=0; \
|
||||||
std::string str; \
|
std::string str; \
|
||||||
infile.open(fname.c_str(), ios_base::in); \
|
infile.open(fname.c_str(), std::ios_base::in); \
|
||||||
if (infile.is_open()) { \
|
if (infile.is_open()) { \
|
||||||
iline=readDataFile(nch, infile, data, err, ang, dataformat, 0); \
|
iline=readDataFile(nch, infile, data, err, ang, dataformat, 0); \
|
||||||
infile.close(); \
|
infile.close(); \
|
||||||
@ -558,7 +561,7 @@ class fileIOStatic {
|
|||||||
\returns number of channels read or -1 if it could not read the file or data=NULL
|
\returns number of channels read or -1 if it could not read the file or data=NULL
|
||||||
|
|
||||||
*/
|
*/
|
||||||
static int readDataFile(int nch, ifstream &infile, double *data, double *err=NULL, double *ang=NULL, char dataformat='f', int offset=0){ \
|
static int readDataFile(int nch, std::ifstream &infile, double *data, double *err=NULL, double *ang=NULL, char dataformat='f', int offset=0){ \
|
||||||
int ichan,iline=0; \
|
int ichan,iline=0; \
|
||||||
int interrupt=0; \
|
int interrupt=0; \
|
||||||
double fdata, ferr, fang; \
|
double fdata, ferr, fang; \
|
||||||
@ -618,10 +621,10 @@ class fileIOStatic {
|
|||||||
\returns OK or FAIL if it could not read the file or data=NULL
|
\returns OK or FAIL if it could not read the file or data=NULL
|
||||||
*/
|
*/
|
||||||
static int readDataFile(std::string fname, int *data, int nch) { \
|
static int readDataFile(std::string fname, int *data, int nch) { \
|
||||||
ifstream infile; \
|
std::ifstream infile; \
|
||||||
int iline=0; \
|
int iline=0; \
|
||||||
std::string str; \
|
std::string str; \
|
||||||
infile.open(fname.c_str(), ios_base::in); \
|
infile.open(fname.c_str(), std::ios_base::in); \
|
||||||
if (infile.is_open()) { \
|
if (infile.is_open()) { \
|
||||||
iline=readDataFile(infile, data, nch, 0); \
|
iline=readDataFile(infile, data, nch, 0); \
|
||||||
infile.close(); \
|
infile.close(); \
|
||||||
@ -641,7 +644,7 @@ class fileIOStatic {
|
|||||||
\param offset start channel value
|
\param offset start channel value
|
||||||
\returns OK or FAIL if it could not read the file or data=NULL
|
\returns OK or FAIL if it could not read the file or data=NULL
|
||||||
*/
|
*/
|
||||||
static int readDataFile(ifstream &infile, int *data, int nch, int offset) { \
|
static int readDataFile(std::ifstream &infile, int *data, int nch, int offset) { \
|
||||||
int ichan, idata, iline=0; \
|
int ichan, idata, iline=0; \
|
||||||
int interrupt=0; \
|
int interrupt=0; \
|
||||||
std::string str; \
|
std::string str; \
|
||||||
@ -674,10 +677,10 @@ class fileIOStatic {
|
|||||||
\returns OK or FAIL if it could not read the file or data=NULL
|
\returns OK or FAIL if it could not read the file or data=NULL
|
||||||
*/
|
*/
|
||||||
static int readDataFile(std::string fname, short int *data, int nch){ \
|
static int readDataFile(std::string fname, short int *data, int nch){ \
|
||||||
ifstream infile; \
|
std::ifstream infile; \
|
||||||
int iline=0; \
|
int iline=0; \
|
||||||
std::string str; \
|
std::string str; \
|
||||||
infile.open(fname.c_str(), ios_base::in); \
|
infile.open(fname.c_str(), std::ios_base::in); \
|
||||||
if (infile.is_open()) { \
|
if (infile.is_open()) { \
|
||||||
iline=readDataFile(infile, data, nch, 0); \
|
iline=readDataFile(infile, data, nch, 0); \
|
||||||
infile.close(); \
|
infile.close(); \
|
||||||
@ -696,7 +699,7 @@ class fileIOStatic {
|
|||||||
\param offset start channel value
|
\param offset start channel value
|
||||||
\returns OK or FAIL if it could not read the file or data=NULL
|
\returns OK or FAIL if it could not read the file or data=NULL
|
||||||
*/
|
*/
|
||||||
static int readDataFile(ifstream &infile, short int *data, int nch, int offset) { \
|
static int readDataFile(std::ifstream &infile, short int *data, int nch, int offset) { \
|
||||||
int ichan, iline=0; \
|
int ichan, iline=0; \
|
||||||
short int idata; \
|
short int idata; \
|
||||||
int interrupt=0; \
|
int interrupt=0; \
|
||||||
|
Reference in New Issue
Block a user