#ifndef TFgdAsumBank_hxx_seen #define TFgdAsumBank_hxx_seen #include #define TFGDASUM_BANK_TITLE "FGD ASUM Bank" namespace COMET { class IFgdAsumBank; }; #define RAWFGDASUM_PL_STARTT 0 #define RAWFGDASUM_PL_ENDT 1 #define RAWFGDASUM_PL_GLOBALCOUNTERS 2 #define RAWFGDASUM_PL_GLOBALRATE 3 #define RAWFGDASUM_PS_FIRST_GROUP_NUMBER 14 #define N_ASUM_GROUPS 32 /// This is the Access Class for FGD Analog Sum ('ASUM') banks. /// These banks provide information on the rates of ASUM triggers for each CMB. /// Specifically, it provides the following: /// i) The time over which these measurements were made (uSec) /// ii) The number of triggers for each ASUM group in that period. /// iii) The measured rate of trigger for each ASUM group (Hz) /// iv) The number of overall CMB triggers in that period. /// v) The rate of overall CMB triggers (Hz) class COMET::IFgdAsumBank: public COMET::IMidasBank { public: IFgdAsumBank(); explicit IFgdAsumBank(const ULong64_t *bank, const char* title = TFGDASUM_BANK_TITLE); virtual ~IFgdAsumBank(); /// Print contents to COMETLog void Print(const Option_t* opt = "") const; /// Get the crate number int GetCrate() const { TString name(GetName()); TString name2(name(2,2)); return name2.Atoi(); } /// Get the time counter at start of time period (in uSec) UInt_t GetStartTime() const { return this->GetData32()[RAWFGDASUM_PL_STARTT]; } /// Get the time counter at end of time period (in uSec) UInt_t GetEndTime() const { return this->GetData32()[RAWFGDASUM_PL_ENDT]; } /// Get the time length of interval (in uSec) UInt_t GetTimeLength() const { return (GetEndTime() - GetStartTime()); } /// Get the number of overall CMB triggers UInt_t GetNumberCMBTriggers() const { return this->GetData32()[RAWFGDASUM_PL_GLOBALCOUNTERS]; } /// Get the rate of overall CMB triggers (Hz) double GetRateCMBTriggers() const { if(GetTimeLength() == 0) return -1.0; return (double) GetNumberCMBTriggers() / (double) GetTimeLength() * 1.0e6; } /// Get the number of triggers for a particular group UShort_t GetNumberGroupTriggers(int i) const { if(i < 0 || i >= N_ASUM_GROUPS) return 0; return this->GetData16()[RAWFGDASUM_PS_FIRST_GROUP_NUMBER + i]; } /// Get the rate of triggers for a particular group (Hz) double GetRateGroupTriggers(int i) const { if(i < 0 || i >= N_ASUM_GROUPS) return 0; return (double) GetNumberGroupTriggers(i) / (double) GetTimeLength() * 1.0e6; } private: }; #endif