/// Class to hold TPC and MM status for /// a range of times, and calculate /// live times. Uses ITPCMMStatus to /// read the values at a particular time. /// /// Blair Jamieson (C) 2010 #ifndef TTPCStatus_hxx__ #define TTPCStatus_hxx__ #include #include #include #include #include #include "ILiveTime.hxx" #include "ITPCMMStatus.hxx" #include "ITPCGas.hxx" #include "ITPCODBInfo.hxx" #include "IAvgRMSPlot.hxx" class ITPCStatus { public: /// Initialize TPC MM status object using unix time ITPCStatus( long autimemin = 1224118800, long autimemax = 1224118800, bool verbose=false, bool makeplots=false); /// Initialize TPC MM status object using year, month(0-11), /// day(1-31),... ITPCStatus( int ayearmin, int amonthmin, int adaymin, int ahourmin, int aminmin, int asecmin, int ayearmax, int amonthmax, int adaymax, int ahourmax, int aminmax, int asecmax, bool verbose=false, bool makeplots=false); /// Write log file in format needed for detector status database entries void WriteLog( char * aauthor, char * acomment ); /// Destructor does nothing... may leave a histogram /// floating around ~ITPCStatus(){}; // Access methods // itpc is 0-2 // irp is 0-1 // imm is 0-11 ILiveTime * MMStatus (int itpc, int irp, int imm){ return (fMMStatus[itpc][irp][imm]); } ///< Status for given MM = 0 for good ILiveTime * TPCStatus(int itpc ) { return (fTPCStatus[itpc]); } ///< Status for given TPC = 0 for good ILiveTime * Status () { return (fStatus); } ///< Status for All TPC = 0 for good private: long fStart; ///< start unix time of validity range long fEnd; ///< end unix time of validity range bool fVerbose; ///< flag to say if should print lots bool fMakePlots; ///< flag to say if plots should be saved to png files /// Calculate livetime and related plots /// for overall status of each MM /// status is 0 if everything is okay /// status is 1 if LV is bad /// status is 2 if FEM is off /// status is 4 if MMHV is off /// status is 8 if DCC is off /// index is [TPC][RP][MM] ILiveTime * fMMStatus[3][2][12]; /// Calculate livetime and related plots /// for overall status for each TPC /// status is 0 if all okay /// status is maximum of MM statuses otherwise /// index is TPC ILiveTime * fTPCStatus[3]; /// Calculate overall status for TPCs /// status is 0 if everything is okay /// status is maximum of MM statuses otherwise ILiveTime * fStatus; /// Update the graph values for graphs that will be saved at end void SaveGraphValues( ITPCGas &gas, ITPCMMStatus &mmstatus, bool lastflag ); // values saved for graphs: IAvgRMSPlot fIbuMon; ///< Isobutane % from safety monitor IAvgRMSPlot fVdIn; ///< Drift speed of input gas ( cm / microseconds ) IAvgRMSPlot fLV_I[3][2][12]; ///< Low voltage curretn [TPC][RP][MM] IAvgRMSPlot fFEM_V[3][2][12]; ///< Fem voltage [TPC][RP][MM] IAvgRMSPlot fMM_HV[3][2][12]; ///< MM high voltage [TPC][RP][MM] IAvgRMSPlot fDCC_V[3][2][12]; ///< DCC voltage[TPC][RP][MM] IAvgRMSPlot fCath_V[3]; ///< Cathode HV [TPC] IAvgRMSPlot fTemp; ///< Temperature (gas shack) degC IAvgRMSPlot fTTpc[3]; ///< Tpc Temperature degC IAvgRMSPlot fPatm; ///< Atmospheric pressure mbar IAvgRMSPlot fDensityGS; ///< P/T (mbar/K) using Patm, TO2 IAvgRMSPlot fDensity[3]; ///< P/T (mbar/K) usint Tpc Temperature /// Update the livetime objects void AddUpdate( ITPCMMStatus &mmstatus, long atime, long astart_time, long aend_time ); void AddUpdate( long istatus, long atime, long astart_time, long aend_time ); void AddUpdate( long istatus, ITPCMMStatus &mmstatus, long atime, long astart_time, long aend_time ); /// Initialize livetime and status objects void Init(); /// Collect all of the TGraphs, and save them to file. void SavePlotsToFile(); }; #endif //TTPCStatus_hxx__