#ifndef BeSlinkAna_HH #define BeSlinkAna_HH #include #include #include #include "TH1D.h" #include "TH2D.h" #include "TH1I.h" #include "Buffering/BeSlinkSim.hh" class BeSlinkAna { public: BeSlinkAna() { } void boj(const BeSlinkSim &b, unsigned nHistory=100000) { fBeSlinkSim=&b; fPreviousThrottleActive=false; fRaisedThrottleBx=-1; fEndedThrottleBx=-1; fThrottleHistWeight=fBeSlinkSim->fBufferLimit; std::ostringstream sout; sout << "BeSlinkAna" << std::setw(2) << std::setfill('0') << fBeSlinkSim->slinkNumber(); std::string sHgcroc[18]={"00","01","02","03","04","05","06","07","08", "09","10","11","12","13","14","15","16","17"}; hTotalEventWords=new TH1D((sout.str()+"TotalEventWords").c_str(), ";Total number of bytes per event",250,0,4000); const SlinkArch &slinkArch(*(fBeSlinkSim->fSlinkArch)); for(unsigned e(0);eFill(bx-fRaisedThrottleBx); if(fEndedThrottleBx!=-1) hEndedThrottleToL1Accept->Fill(bx-fEndedThrottleBx); } void analyseBx(uint64_t bx) { unsigned maxBufferUsed(0); const SlinkArch &slinkArch(*(fBeSlinkSim->fSlinkArch)); for(unsigned e(0);efEventBuffer[e][b].used()); if(maxBufferUsedFill(bufferUsed); hEventBufferUsedHistory[e][b]->Fill(bx,bufferUsed); if(fBeSlinkSim->exceededBuffer()) hEventBufferExceeded[e][b]->Fill(bufferUsed); } } hEventBufferUsedMax->Fill(maxBufferUsed); hEventBufferUsedHistoryMax->Fill(bx,maxBufferUsed); if(fBeSlinkSim->fL1AcceptEoe) { hTotalEventWords->Fill(16*fBeSlinkSim->fTotalNumberOfEventWords); } // Add +1 as throttle is applied to next BX if(fBeSlinkSim->throttleActive()) { if(!fPreviousThrottleActive) fRaisedThrottleBx=bx+1; hThrottleActiveHistory->Fill(bx+1,fThrottleHistWeight); } else { if(fPreviousThrottleActive) fEndedThrottleBx=bx+1; } if(fBeSlinkSim->delayedThrottleActive(bx)) { hDelayedThrottleActiveHistory->Fill(bx+1,fThrottleHistWeight-50); } fPreviousThrottleActive=fBeSlinkSim->fThrottleActive; } void eoj() { } private: const BeSlinkSim *fBeSlinkSim; bool fPreviousThrottleActive; uint64_t fRaisedThrottleBx; uint64_t fEndedThrottleBx; unsigned fThrottleHistWeight; TH1D *hTotalEventWords; TH1I *hThrottleActiveHistory; TH1I *hDelayedThrottleActiveHistory; TH1D *hRaisedThrottleToL1Accept; TH1D *hEndedThrottleToL1Accept; TH1D *hEventBufferUsed[Dimensions::MaxNumberOfEconsPerSlink][Dimensions::MaxNumberOfBlocksPerEcon]; TH1I *hEventBufferUsedHistory[Dimensions::MaxNumberOfEconsPerSlink][Dimensions::MaxNumberOfBlocksPerEcon]; TH1D *hEventBufferExceeded[Dimensions::MaxNumberOfEconsPerSlink][Dimensions::MaxNumberOfBlocksPerEcon]; TH1D *hEventBufferUsedMax; TH1I *hEventBufferUsedHistoryMax; }; #endif