///////////////////////////////////////////////////////////////////// // PixScanConfig.h ///////////////////////////////////////////////////////////////////// // // 28/02/04 Version 1.0 (PM) // Initial release // // ****************************************************************** // ********* JW: no idea what this does!!! ************************** // ****************************************************************** #ifndef _PIXLIB_PIXSCANCONFIG #define _PIXLIB_PIXSCANCONFIG #ifdef WIN32 #pragma warning(disable: 4786) #pragma warning(disable: 4800) #endif #include #include #include "PixController/PixController.h" #include "scanControl.h" namespace PixLib { class Config; class Histo; class PixControllerExc; //! Pix Controller Exception class; an object of this type is thrown in case of a controller error class PixScanConfigExc : public PixControllerExc { public: //! Constructor PixScanConfigExc(ErrorLevel el, std::string name) : PixControllerExc(el, name) {}; //! Destructor virtual ~PixScanConfigExc() {}; private: }; #define MAX_GROUPS 4 class PixScanConfig { friend class PixController; friend class RodPixController; friend class USBPixController; public: enum ScanType { DIGITAL_SCAN, ANALOG_SCAN, THRESHOLD_SCAN, TOT_CALIB, TDAC_TUNE }; enum MaskStagingMode { NORMAL }; enum HistogramType { NONE, OCCUPANCY, TOT, LVL1, SCURVES}; enum VoltageMode { DEF_VAL, CUSTOM_VAL, OFF_VAL }; enum HistoMode { NO, KEEP, DROP }; enum FitProcessors { DSP, HOST , NOFIT}; //! Constructors PixScanConfig(); PixScanConfig(ScanType presetName); PixScanConfig(DBInquire *dbi); //! Destructor ~PixScanConfig(); //! Load predefined configurations void preset(ScanType presetName); //! Add a scan variable void addLoop(std::string varName, double startVal, double endVal, double step, int group); void addLoop(std::string varName, std::vector values, int group); void addMaskStageLoop(MaskStagingMode mode, int nStep, int group); //! Loops inspection int nLoops(); std::string loopVarName(int loop, int group); std::vector& loopVarValues(int loop, int group); void loopRemove(int loop); //! Global scan variables void enableStrobe(int group); void disableStrobe(int group); bool strobeEnabled(int group); void enableTrigger(int group); void disableTrigger(int group); bool triggerEnabled(int group); void enableReadout(int group); void disableReadout(int group); bool readoutEnabled(int group); void strobeLvl1Delay(int delay); int strobeLvl1Delay(); void consecutiveLvl1(int nLvl1); int consecutiveLvl1(); void defineGroup(int group, unsigned int mask); unsigned int getGroupMask(int group); void nEvents(int nEv); int nEvents(); //! Scan structure refernce void initConfig(); ScanControl &scanControl(); unsigned int histoRoutineType() { return m_histoRoutineType; }; unsigned int histoTotResolution() { return m_histoTotResolution; }; unsigned int histoTotMin() { return m_histoTotMin; }; unsigned int histoTotMax() { return m_histoTotMax; }; //! DataBase interaction void writeConfig(DBInquire *dbi); void writeHisto(DBInquire *dbi); void write(DBInquire* dbi); void readConfig(DBInquire *dbi); void readHisto(DBInquire *dbi); void read(DBInquire *dbi); Config &config() { return *m_conf; }; //! Histogram handling void getHisto(PixController *ctrl, unsigned int mod); void clearHisto(unsigned int mod); void calcThr(PixController *ctrl, unsigned int mod); std::vector< std::vector > &occupancy() { return m_occup; }; std::vector< Histo * > &thr() { return m_thr; }; std::vector< Histo * > &noise() { return m_noise; }; std::vector< Histo * > &chi2() { return m_chi2; }; int getHOccupancy() { return m_hOccupancy; }; int getHTimeProfile() { return m_hTimeProfile; }; int getHTot() { return m_hTot; }; int getHTotMean() { return m_hTotMean; }; int getHTotSigma() { return m_hTotSigma; }; int getHScurves() { return m_hScurves; }; private: int m_nLoop; unsigned int m_groupMask[MAX_GROUPS]; bool m_strobeEnabled[MAX_GROUPS]; bool m_triggerEnabled[MAX_GROUPS]; bool m_readoutEnabled[MAX_GROUPS]; int m_gr01TrigDelay; int m_gr23TrigDelay; std::vector m_varNames[4]; std::vector > m_varUniform[4]; std::vector > m_varValues[4]; VoltageMode m_biasMode; float m_biasValue; VoltageMode m_avddMode; float m_avddValue; VoltageMode m_dvddMode; float m_dvddValue; bool m_keepHisto; bool m_dspFit; unsigned int m_histoRoutineType; unsigned int m_histoTotResolution; unsigned int m_histoTotMin; unsigned int m_histoTotMax; std::vector< std::vector > m_occup; std::vector< Histo * > m_thr; std::vector< Histo * > m_noise; std::vector< Histo * > m_chi2; ScanControl m_scanPar; DBInquire* m_dbInquire; PixConfDBInterface *m_db; Config *m_conf; int m_hOccupancy; int m_hTimeProfile; int m_hTot; int m_hTotMean; int m_hTotSigma; int m_hScurves; }; class PixRunConfig { friend class PixController; public: enum RunType { DEF }; enum HistogramType { NONE, OCCUPANCY, TOT, LVL1 }; //! Constructors PixRunConfig(); PixRunConfig(RunType presetName); PixRunConfig(DBInquire *dbi); //! Destructor ~PixRunConfig(); //! Load predefined configurations void preset(RunType presetName); //! Global run variables void enableTrigger(int group); void disableTrigger(int group); bool triggerEnabled(int group); void enableReadout(int group); void disableReadout(int group); bool readoutEnabled(int group); void triggerDelay(int delay); int triggerDelay(); void consecutiveLvl1(int nLvl1); int consecutiveLvl1(); void defineGroup(int group, unsigned int mask); unsigned int getGroupMask(int group); void nEvents(int nEv); int nEvents(); //! Scan structure refernce void runControlInit(); //! DataBase interaction void loadConfig(DBInquire *dbi); void saveConfig(DBInquire *dbi); void readDbInquire(); Config *config() { return m_conf; }; private: unsigned int m_groupMask[MAX_GROUPS]; bool m_triggerEnabled[MAX_GROUPS]; bool m_readoutEnabled[MAX_GROUPS]; unsigned int m_triggerDelay; unsigned int m_nAccepts; DBInquire* m_dbInquire; PixConfDBInterface *m_db; Config *m_conf; }; } #endif