#ifndef HgcrocAna_HH #define HgcrocAna_HH #include #include #include #include "TH1D.h" #include "TH1I.h" #include "Buffering/HgcrocSim.hh" class HgcrocAna { public: HgcrocAna(const HgcrocSim &h, unsigned nHistory=100000) : fHgcrocSim(h), fBusyLength(0) { unsigned bd(fHgcrocSim.bufferDepth()); std::string sName("HgcrocAna"); hEvents=new TH1D((sName+"Events").c_str(), ";Number of events in buffer;BXs",bd,0,bd); hL1AEvents=new TH1D((sName+"L1AEvents").c_str(), ";Number of events in buffer;L1Accepts",bd,0,bd); hBusyLength=new TH1D((sName+"BusyLength").c_str(), ";Length of continuous output (Events);Number",1000,0,1000); hL1AcceptHistory=new TH1I((sName+"L1AcceptHistory").c_str(), ";BX;L1Accept",nHistory,0,nHistory); hEventCompleteHistory=new TH1I((sName+"EventCompleteHistory").c_str(), ";BX;Event complete",nHistory,0,nHistory); hEventsHistory=new TH1I((sName+"EventsHistory").c_str(), ";BX;Number of events in buffer",nHistory,0,nHistory); hWordsHistory=new TH1I((sName+"WordsHistory").c_str(), ";BX;Number of words transmitted",nHistory,0,nHistory); } void analyseBx(uint64_t bx) { hEvents->Fill(fHgcrocSim.numberOfEvents()); if(fHgcrocSim.l1Accept()) { hL1AEvents->Fill(fHgcrocSim.numberOfEvents()); hL1AcceptHistory->Fill(bx,3); } if(fHgcrocSim.eventComplete()) hEventCompleteHistory->Fill(bx,2); hEventsHistory->Fill(bx,fHgcrocSim.numberOfEvents()); hWordsHistory->Fill(bx,fHgcrocSim.numberOfWords()); if(fHgcrocSim.numberOfEvents()>0) fBusyLength++; else { if(fBusyLength!=0) { hBusyLength->Fill((fBusyLength+1)/fHgcrocSim.eventLength()); fBusyLength=0; } } } private: const HgcrocSim &fHgcrocSim; unsigned fBusyLength; TH1D *hEvents; TH1D *hL1AEvents; TH1D *hBusyLength; TH1I *hL1AcceptHistory; TH1I *hEventCompleteHistory; TH1I *hEventsHistory; TH1I *hWordsHistory; }; #endif