|
| 1 | +#ifndef _CaloIERCDQMHistoContainer_h_ |
| 2 | +#define _CaloIERCDQMHistoContainer_h_ |
| 3 | + |
| 4 | +#include "art/Framework/Services/Registry/ServiceHandle.h" |
| 5 | +#include "art_root_io/TFileDirectory.h" |
| 6 | +#include "art_root_io/TFileService.h" |
| 7 | +#include "otsdaq/Macros/CoutMacros.h" |
| 8 | +#include "otsdaq/NetworkUtilities/TCPPublishServer.h" |
| 9 | +#include <TH1F.h> |
| 10 | +#include <string> |
| 11 | + |
| 12 | +#include "TRACE/tracemf.h" |
| 13 | +#define TRACE_NAME "CaloIERCDQM" |
| 14 | + |
| 15 | +namespace ots { |
| 16 | + |
| 17 | +class CaloIERCDQMHistoContainer { |
| 18 | +public: |
| 19 | + CaloIERCDQMHistoContainer(){}; |
| 20 | + virtual ~CaloIERCDQMHistoContainer(void){}; |
| 21 | + struct InfoHist_ { |
| 22 | + TH1F *_Hist; |
| 23 | + InfoHist_() { _Hist = NULL; } |
| 24 | + }; |
| 25 | + struct InfoGraph_ { |
| 26 | + TGraph *_Graph; |
| 27 | + InfoGraph_() { _Graph = NULL; } |
| 28 | + }; |
| 29 | + |
| 30 | + std::map<int, InfoHist_> map_h1_dt_singlechan; |
| 31 | + std::map<int, InfoGraph_> map_g_dtevt_singlechan; |
| 32 | + |
| 33 | + std::map<int, InfoHist_> map_h1_dt_sameboard; |
| 34 | + std::map<int, InfoGraph_> map_g_dtevt_sameboard; |
| 35 | + |
| 36 | + std::map<int, InfoHist_> map_h1_dt_diffboard; |
| 37 | + std::map<int, InfoGraph_> map_g_dtevt_diffboard; |
| 38 | + |
| 39 | + void BookSingleChannel(art::ServiceHandle<art::TFileService> tfs, int mapID, |
| 40 | + std::string Name, std::string Title, int nBins, |
| 41 | + float min, float max) { |
| 42 | + TLOG(TLVL_DEBUG) << "Booking single channel hist for sipmID " << mapID; |
| 43 | + map_h1_dt_singlechan[mapID] = InfoHist_(); |
| 44 | + art::TFileDirectory testDir = tfs->mkdir("SingleChannel"); |
| 45 | + this->map_h1_dt_singlechan[mapID]._Hist = |
| 46 | + testDir.make<TH1F>(Name.c_str(), Title.c_str(), nBins, min, max); |
| 47 | + this->map_h1_dt_singlechan[mapID]._Hist->GetXaxis()->SetTitle("dt [ns]"); |
| 48 | + } |
| 49 | + void BookSingleChannelG(art::ServiceHandle<art::TFileService> tfs, int mapID, |
| 50 | + std::string Name, std::string Title) { |
| 51 | + TLOG(TLVL_DEBUG) << "Booking single channel graph for sipmID " << mapID; |
| 52 | + map_g_dtevt_singlechan[mapID] = InfoGraph_(); |
| 53 | + art::TFileDirectory testDir = tfs->mkdir("SingleChannel"); |
| 54 | + this->map_g_dtevt_singlechan[mapID]._Graph = |
| 55 | + testDir.makeAndRegister<TGraph>(Name.c_str(), Title.c_str()); |
| 56 | + this->map_g_dtevt_singlechan[mapID]._Graph->GetXaxis()->SetTitle( |
| 57 | + "Event number"); |
| 58 | + this->map_g_dtevt_singlechan[mapID]._Graph->GetYaxis()->SetTitle("dt [ns]"); |
| 59 | + this->map_g_dtevt_singlechan[mapID]._Graph->SetMarkerStyle(20); |
| 60 | + } |
| 61 | + void BookSameBoard(art::ServiceHandle<art::TFileService> tfs, int mapID, |
| 62 | + std::string Name, std::string Title, int nBins, float min, |
| 63 | + float max) { |
| 64 | + TLOG(TLVL_DEBUG) << "Booking single board hist for sipmID " << mapID; |
| 65 | + map_h1_dt_sameboard[mapID] = InfoHist_(); |
| 66 | + art::TFileDirectory testDir = tfs->mkdir("SameBoard"); |
| 67 | + this->map_h1_dt_sameboard[mapID]._Hist = |
| 68 | + testDir.make<TH1F>(Name.c_str(), Title.c_str(), nBins, min, max); |
| 69 | + this->map_h1_dt_sameboard[mapID]._Hist->GetXaxis()->SetTitle("dt [ns]"); |
| 70 | + } |
| 71 | + void BookSameBoardG(art::ServiceHandle<art::TFileService> tfs, int mapID, |
| 72 | + std::string Name, std::string Title) { |
| 73 | + TLOG(TLVL_DEBUG) << "Booking single board graph for sipmID " << mapID; |
| 74 | + map_g_dtevt_sameboard[mapID] = InfoGraph_(); |
| 75 | + art::TFileDirectory testDir = tfs->mkdir("SameBoard"); |
| 76 | + this->map_g_dtevt_sameboard[mapID]._Graph = |
| 77 | + testDir.makeAndRegister<TGraph>(Name.c_str(), Title.c_str()); |
| 78 | + this->map_g_dtevt_sameboard[mapID]._Graph->GetXaxis()->SetTitle( |
| 79 | + "Event number"); |
| 80 | + this->map_g_dtevt_sameboard[mapID]._Graph->GetYaxis()->SetTitle("dt [ns]"); |
| 81 | + this->map_g_dtevt_sameboard[mapID]._Graph->SetMarkerStyle(20); |
| 82 | + } |
| 83 | + void BookDiffBoard(art::ServiceHandle<art::TFileService> tfs, int mapID, |
| 84 | + std::string Name, std::string Title, int nBins, float min, |
| 85 | + float max) { |
| 86 | + TLOG(TLVL_DEBUG) << "Booking diff board hist for sipmID " << mapID; |
| 87 | + map_h1_dt_diffboard[mapID] = InfoHist_(); |
| 88 | + art::TFileDirectory testDir = tfs->mkdir("DiffBoard"); |
| 89 | + this->map_h1_dt_diffboard[mapID]._Hist = |
| 90 | + testDir.make<TH1F>(Name.c_str(), Title.c_str(), nBins, min, max); |
| 91 | + this->map_h1_dt_diffboard[mapID]._Hist->GetXaxis()->SetTitle("dt [ns]"); |
| 92 | + } |
| 93 | + void BookDiffBoardG(art::ServiceHandle<art::TFileService> tfs, int mapID, |
| 94 | + std::string Name, std::string Title) { |
| 95 | + TLOG(TLVL_DEBUG) << "Booking diff board graph for sipmID " << mapID; |
| 96 | + map_g_dtevt_diffboard[mapID] = InfoGraph_(); |
| 97 | + art::TFileDirectory testDir = tfs->mkdir("DiffBoard"); |
| 98 | + this->map_g_dtevt_diffboard[mapID]._Graph = |
| 99 | + testDir.makeAndRegister<TGraph>(Name.c_str(), Title.c_str()); |
| 100 | + this->map_g_dtevt_diffboard[mapID]._Graph->GetXaxis()->SetTitle( |
| 101 | + "Event number"); |
| 102 | + this->map_g_dtevt_diffboard[mapID]._Graph->GetYaxis()->SetTitle("dt [ns]"); |
| 103 | + this->map_g_dtevt_diffboard[mapID]._Graph->SetMarkerStyle(20); |
| 104 | + } |
| 105 | +}; |
| 106 | + |
| 107 | +} // namespace ots |
| 108 | + |
| 109 | +#endif |
0 commit comments