/// Class to build average temperature inside TPC /// over a particular time period (or run). Also /// has facilities to make an animated gif of the /// TPC temperature over a period of time. /// Blair Jamieson (C) 2009 #ifndef TTPCTempAvg_hxx__ #define TTPCTempAvg_hxx__ #include #include #include using namespace std; #include #include #include #include #include #include "ITPCTemperature.hxx" /// Class to build average temperature inside TPC /// over a particular time period (or run). Also /// has facilities to make an animated gif of the /// TPC temperature over a period of time. /// Blair Jamieson (C) 2009 class ITPCTempAvg { public: /// Initialize TPC temperature averaging object using unix times ITPCTempAvg( int maxsamples = -1, long autmin = 1224118800, long autmax = 1224118800 ); /// Initialize TPC temperature averaging object using year, /// month(0-11), day (1-31), ... ITPCTempAvg( int maxsamples, int ayearmin, int amonthmin, int adaymin, int ahourmin, int aminmin, int asecmin, int ayearmax, int amonthmax, int adaymax, int ahourmax, int aminmax, int asecmax ); /// Methods to get number of readings int GetNTemperatures(){ return fNTemps; } /// Method to get minimum unix time for set of temperature measurements long GetTimeMin() { return fTimeMin; } /// Method to get maximum unix time for set of temperature measurements long GetTimeMax() { return fTimeMax; } /// Method to get minimum run number for set of temperature measurements int GetRunMin() { return fRunMin; } /// Method to get maximum run number for set of temperature measurements int GetRunMax() { return fRunMax; } /// Method to get pointer to average temperature histogram TH2F* GetAvgTH2F() { return fhAvgT; } /// Method to get pointer to RMS temperature histogram TH2F* GetRMSTH2F() { return fhRMST; } /// Get average of all temperatures in degC float GetAvgT() { return fTAvg; } /// Get RMS of all temperatures in degC float GetRMST() { return fTRMS; } /// Method to create gifsicle of temperature readings used void MakeGifSicle(); /// Method to enable/disable GifSicle creation void EnableGifSicle( bool anon = true ){ fHaveGifSicle = anon ; } /// Print average and rms temperature results to std::cout void Print(); private: int fMaxSamples; ///< Maximum number of samples to use in averaging long fTimeMin; ///< Minumum in time range long fTimeMax; ///< Maximum in time range int fRunMin; ///< Minimum in run range int fRunMax; ///< Maximum in run range int fNTemps; ///< Number of temperature readings ITPCTemperature * aT; ///< TPC temperature reading tool float fTMin; ///< Overall minimum temperature (degC) float fTMax; ///< Overall maximum temperature (degC) TH2F * fhAvgT; ///< Average temperature histogram TH2F * fhRMST; ///< RMS temperature histogram float fTAvg; ///< Average of all temperatures float fTRMS; ///< Average of all temperature RMSs float fRMSTMin; ///< Minimum in temperature RMS histogram float fRMSTMax; ///< Maximum in temperature RMS histogram int fNavg; // calculation variables for avg, rms of each temperature bin vector > asum; vector > asum2; vector > anum; bool fHaveGifSicle; ///< Test once if gifsicle program is available. /// Initialize temperature / pressure averaging object void Init(); void AddUpdate( bool lastflag=false); }; #endif