// Collection of classes to acces APV pedestal and raw data recorded by MMDAQ // Declaration: // class APV_Pedestal_Tree // class APV_Info // class APV_Raw_Tree #if !defined PROCESS_APV_DATA #define PROCESS_APV_DATA #if !defined(__CINT__) || defined(__MAKECINT__) //#if !defined(__CLING__) || defined(__ROOTCLING__) // for root 6 #include #include #include #endif class APV_Pedestal_Tree { public: APV_Pedestal_Tree (); APV_Pedestal_Tree (TTree *atree); void LinkTree(TTree *atree); virtual ~APV_Pedestal_Tree (); std::vector *GetFEC(void) { return p_m_apv_fec; } std::vector *GetAPVid(void) { return p_m_apv_id; } std::vector *GetAPVChannel(void) { return p_m_apv_ch; } std::vector *GetAPVPedestal(void) { return p_m_apv_pedmean; } std::vector *GetAPVPedSigma(void) { return p_m_apv_pedsigma; } std::vector *GetAPVPedSTD(void) { return p_m_apv_pedstd; } void SetDebug(const int dbg) { m_debug = dbg; } protected: UInt_t m_apv_evt; int m_time_s; /*time_t */ int m_time_us; /*suseconds_t*/ std::vector m_apv_fec; std::vector m_apv_id; // APVChip; std::vector m_apv_ch; // APVChannel; std::vector m_mm_id; // MM chamber id std::vector m_mm_readout; // MM readout plane; std::vector m_mm_strip; // MM strip id //root - raw tree data - for the pedestal root file std::vector m_apv_pedmean; std::vector m_apv_pedsigma; std::vector m_apv_pedstd; UInt_t *p_m_apv_evt; int *p_m_time_s; int *p_m_time_us; std::vector *p_m_apv_fec; std::vector *p_m_apv_id; std::vector *p_m_apv_ch; std::vector *p_m_mm_id; std::vector *p_m_mm_readout; std::vector *p_m_mm_strip; std::vector *p_m_apv_pedmean; std::vector *p_m_apv_pedsigma; std::vector *p_m_apv_pedstd; Int_t m_debug; }; class APV_Info : public APV_Pedestal_Tree { public: APV_Info(void); APV_Info(const char *fname, const Int_t entrid = -1); virtual ~APV_Info(); Float_t GetPedestal(const int chipid, const int channalid) const; Float_t GetNoise(const int chipid, const int channalid); const std::map< Int_t, std::vector > *GetPedestal(void) { return &pedestal; } const std::map< Int_t, std::vector > *GetNoise(void) { return &noise; } static const Int_t APV_CH_NUMBER; protected: void LoadData(const Int_t entrid = -1); TFile *pfile; TTree *ptree; Int_t entrread; std::map< Int_t, std::vector > pedestal; std::map< Int_t, std::vector > noise; }; class APV_Raw_Tree { public: APV_Raw_Tree (); APV_Raw_Tree (const Char_t *fname); virtual ~APV_Raw_Tree (); Int_t GetEntry(const Int_t eid) { if (p_rawtree && eidGetEntries() ) { m_active_entry = eid; return p_rawtree->GetEntry(eid); } else return 0; } Int_t Next(void) {if (p_rawtree && m_active_entry < p_rawtree->GetEntries()-1 ) return p_rawtree->GetEntry(++m_active_entry); else return 0; } Int_t GetActiveEntryID(void) const { return m_active_entry; } const std::vector *GetFEC(void) const { return p_m_apv_fec; } const std::vector *GetAPVid(void) const { return p_m_apv_id; } const std::vector *GetAPVChannel(void) const { return p_m_apv_ch; } const std::vector < std::vector > *GetAPVSignal(void) const { return p_m_apv_q; } protected: void Init (void); UInt_t m_apv_evt; int m_time_s; /*time_t */ int m_time_us; /*suseconds_t*/ std::vector m_apv_fec; std::vector m_apv_id; // APVChip; std::vector m_apv_ch; // APVChannel; std::vector m_mm_id; // MM chamber id std::vector m_mm_readout; // MM readout plane; std::vector m_mm_strip; // MM strip id std::vector < std::vector > m_apv_q; // time bns q UInt_t m_apv_presamples; // number of presamples in apv data UInt_t *p_m_apv_evt; int *p_m_time_s; int *p_m_time_us; std::vector *p_m_apv_fec; std::vector *p_m_apv_id; std::vector *p_m_apv_ch; std::vector *p_m_mm_id; std::vector *p_m_mm_readout; std::vector *p_m_mm_strip; std::vector < std::vector > *p_m_apv_q; UInt_t *p_m_apv_presamples; TFile *p_file; TTree *p_rawtree; Int_t m_active_entry; Int_t m_debug; }; #endif