/// Class to find information in the ODB /// By now, look at DCCs (active) and FEMs (enabled) /// to set the corresponding DQ flag when masked /// And check if the TPC is out of global DAQ /// Class following the structure of ITPCGas by Blair Jamieson /// Lorena Escudero #ifndef TTPCODBInfo_hxx__ #define TTPCODBInfo_hxx__ #include #include #include "ISlowControlDatabase.hxx" #include "ISlowControlMySQLInterface.hxx" #include "TMath.h" /// Class to handle the ODB Info /// about DCCs and FEMs class ITPCODBInfo { public: /// Initialize ITPCODBInfo( long timemin , long timemax ); /// Destructor ~ITPCODBInfo(){}; // Access methods int BEBActive (){ return fBEBActive; } ///< BEB Active value int TPClocal (){ return fTPClocal; } ///< TPC local value int DCCActive (){ return fDCCActive; } ///< DCC Active value bool Status(){return fStatus;} long DCCStatus(){return fDCCStatus;} long FEMStatus(){return fFEMStatus;} long TotalStatus(){return fTotalStatus;} /// Set the unix time for this object, and read the ODB info closest /// to this time from database void SetTime( long autime ){ fTime=autime; Read(); } /// Check if readings for current time are valid bool DBReadOK(){ if ( fDCC_isok==true ){ return true; } else { return false; } } private: /// Setup vectors of strings for field names /// that will be querried in the database void SetupFieldNames(); /// Read the info void Read(); /// Initialize void Init(); /// Set character timestamp from integer unix timestamp void SetupTimeStamp(); /// Get index into each of the vectors of database query /// results for the current time void UpdateVectorTimeIdx(); /// Check if another chunk of data needs to be read from /// slow control database void CheckReadDB(); // Read another chunk of data from slow control database void Read_OUT(); /// > > QueryGetField(int time, const char *table_name, std::vector table_fields); std::vector > > QueryGetField(int time, const char *table_name, std::vector table_fields, int nrows); long fTime; // unix time for readings long fStartTime ; // unix start time for intended time range long fEndTime ; // unix end time for intended time range bool fDebug ; char * fTimeStamp; ///< local time as character array (for titles) std::vector fDCCIdFEM; // values used for bulk read from slow control database std::vector< std::string > fOUT_names0; ///< names of fields to read for TPC out of global (first check) std::vector< std::string > fOUT_names1; ///< names of fields to read for TPC out of global (second check) std::vector< std::string > fDCC_names; ///< names of fields to read for DCC std::vector< std::string > fFEM_names; ///< names of fields to read for FEM std::vector< std::pair< double, std::vector< int > > > fOUT_vec0; ///< db query result for TripTBEBActive values std::vector< std::pair< double, std::vector< int > > > fOUT_vec1; ///< db query result for GRequested_transitions values std::vector< std::pair< double, std::vector< int > > > fDCC_vec; ///< db query result for DCCActive values // std::vector< std::pair< double, std::vector< std::string > > > fDCC_vec; ///< db query result for read DCCActive values std::vector< std::pair< double, std::vector< std::string > > > fFEM_vec0; ///< db query result for FEMEnable values std::vector< std::pair< double, std::vector< std::string > > > fFEM_vec1; ///< db query result for FEMEnable values std::vector< std::pair< double, std::vector< std::string > > > fFEM_vec2; ///< db query result for FEMEnable values std::vector< std::pair< double, std::vector< std::string > > > fFEM_vec3; ///< db query result for FEMEnable values std::vector< std::pair< double, std::vector< std::string > > > fFEM_vec4; ///< db query result for FEMEnable values std::vector< std::pair< double, std::vector< std::string > > > fFEM_vec5; ///< db query result for FEMEnable values std::vector< std::pair< double, std::vector< std::string > > > fFEM_vec6; ///< db query result for FEMEnable values std::vector< std::pair< double, std::vector< std::string > > > fFEM_vec7; ///< db query result for FEMEnable values std::vector< std::pair< double, std::vector< std::string > > > fFEM_vec8; ///< db query result for FEMEnable values std::vector< std::pair< double, std::vector< std::string > > > fFEM_vec9; ///< db query result for FEMEnable values std::vector< std::pair< double, std::vector< std::string > > > fFEM_vec10; ///< db query result for FEMEnable values std::vector< std::pair< double, std::vector< std::string > > > fFEM_vec11; ///< db query result for FEMEnable values std::vector< std::pair< double, std::vector< std::string > > > fFEM_vec12; ///< db query result for FEMEnable values std::vector< std::pair< double, std::vector< std::string > > > fFEM_vec13; ///< db query result for FEMEnable values std::vector< std::pair< double, std::vector< std::string > > > fFEM_vec14; ///< db query result for FEMEnable values std::vector< std::pair< double, std::vector< std::string > > > fFEM_vec15; ///< db query result for FEMEnable values std::vector< std::pair< double, std::vector< std::string > > > fFEM_vec16; ///< db query result for FEMEnable values std::vector< std::pair< double, std::vector< std::string > > > fFEM_vec17; ///< db query result for FEMEnable values bool fOUT_isok0; bool fOUT_isok1; bool fDCC_isok; bool fFEM_isok; unsigned int fOUT_idx0; ///< time idx for current OUT first check unsigned int fOUT_idx1; ///< time idx for current OUT second check unsigned int fDCC_idx; ///< time idx for current DCC unsigned int fFEM_idx; ///< time idx for current FEM //BEB Active value int fBEBActive; //TPC in local int fTPClocal; //DCC Active value int fDCCActive; //DCC status long fDCCStatus; //FEM status long fFEMStatus; //total status long fTotalStatus; //general good/bad status bool fStatus; }; #endif //TTPCODBInfo_hxx__