36 inputTokenRaw_ = consumes<FEDRawDataCollection>(
38 inputTokenReport_ = consumes<HcalUnpackerReport>(
40 inputTokenDigi_ = consumes<CastorDigiCollection>(
42 inputTokenRecHitCASTOR_ = consumes<CastorRecHitCollection>(
44 inputTokenCastorTowers_ = consumes<CastorTowerCollection>(
46 JetAlgorithm = consumes<BasicJetCollection>(
48 tokenTriggerResults = consumes<edm::TriggerResults>(
53 irun_ = ilumisec_ = ievent_ = ibunch_ = 0;
73 if (DigiMon_ !=
nullptr)
delete DigiMon_;
74 if (RecHitMon_ !=
nullptr)
delete RecHitMon_;
75 if (LedMon_ !=
nullptr)
delete LedMon_;
80 if (fVerbosity > 0)
LogPrint(
"CastorMonitorModule") <<
"dqmBeginRun(start)";
89 if (DigiMon_ !=
nullptr) {
90 DigiMon_->bookHistograms(ibooker, iRun, iSetup);
92 if (RecHitMon_ !=
nullptr) {
93 RecHitMon_->bookHistograms(ibooker, iRun, iSetup);
95 if (LedMon_ !=
nullptr) {
96 LedMon_->bookHistograms(ibooker, iRun, iSetup);
101 sprintf(s,
"CastorEventProducts");
102 CastorEventProduct = ibooker.
book1DD(s, s, 6, -0.5, 5.5);
103 CastorEventProduct->
getTH1D()->GetYaxis()->SetTitle(
"Events");
104 TAxis* xa = CastorEventProduct->getTH1D()->GetXaxis();
105 xa->SetBinLabel(1,
"FEDs/3");
106 xa->SetBinLabel(2,
"RawData");
107 xa->SetBinLabel(3,
"Digi");
108 xa->SetBinLabel(4,
"RecHits");
109 xa->SetBinLabel(5,
"Towers");
110 xa->SetBinLabel(6,
"Jets");
112 sprintf(s,
"CASTORUnpackReport");
113 hunpkrep = ibooker.
bookProfile(s, s, 6, -0.5, 5.5, 100, 0, 1.e10,
"");
115 xa->SetBinLabel(1,
"N_FEDs");
116 xa->SetBinLabel(2,
"SPIGOT_Err");
117 xa->SetBinLabel(3,
"empty");
118 xa->SetBinLabel(4,
"busy");
119 xa->SetBinLabel(5,
"OvF");
120 xa->SetBinLabel(6,
"BadDigis");
129 <<
"beginLuminosityBlock(start): " <<
NLumiSec <<
"(" << ilumisec_
138 if (DigiMon_ !=
nullptr) {
145 if (fVerbosity > 1)
LogPrint(
"CastorMonitorModule") <<
"analyze (start)";
147 irun_ = iEvent.
id().
run();
156 bool rechitOK_ =
true, towerOK_ =
true, jetsOK_ =
true;
157 int nDigi = 0, nrecHits = 0,
nTowers = 0, nJets = 0;
160 iEvent.
getByToken(tokenTriggerResults, TrigResults);
164 if (!RawData.
isValid()) rawOK_ =
false;
166 float fedsUnpacked = 0.;
172 const std::vector<int> feds = (*report).getFedsUnpacked();
173 fedsUnpacked =
float(feds.size());
174 hunpkrep->Fill(0, fedsUnpacked);
183 iEvent.
getByToken(inputTokenDigi_, CastorDigi);
185 nDigi = CastorDigi->
size();
190 iEvent.
getByToken(inputTokenRecHitCASTOR_, CastorHits);
192 nrecHits = CastorHits->
size();
197 iEvent.
getByToken(inputTokenCastorTowers_, castorTowers);
199 nTowers = castorTowers->size();
206 nJets = jets->size();
212 <<
"CastorProductValid(size): RawDataValid=" << RawData.
isValid()
213 <<
" Digi=" << digiOK_ <<
"(" << nDigi <<
") Hits=" << rechitOK_ <<
"(" 215 <<
" Towers=" << towerOK_ <<
"(" <<
nTowers <<
")" 216 <<
" Jets=" << jetsOK_ <<
"(" << nJets <<
")";
218 CastorEventProduct->Fill(0, fedsUnpacked / 3.);
219 CastorEventProduct->Fill(1, rawOK_);
220 CastorEventProduct->Fill(2, digiOK_);
221 CastorEventProduct->Fill(3, rechitOK_);
222 CastorEventProduct->Fill(4, towerOK_);
223 CastorEventProduct->Fill(5, jetsOK_);
226 DigiMon_->processEvent(iEvent, *CastorDigi, *TrigResults, *conditions_);
229 if (DigiMon_ !=
nullptr)
230 std::cout <<
"TIMER:: DIGI MONITOR ->" << cpu_timer.cpuTime()
236 if (rechitOK_) RecHitMon_->processEvent(*CastorHits);
239 if (RecHitMon_ !=
nullptr)
240 std::cout <<
"TIMER:: RECHIT MONITOR->" << cpu_timer.cpuTime()
246 if (towerOK_) RecHitMon_->processEventTowers(*castorTowers);
247 if (jetsOK_) RecHitMon_->processEventJets(*jets);
249 if (fVerbosity > 0 && ievt_ % 100 == 0)
250 LogPrint(
"CastorMonitorModule") <<
"processed " << ievt_ <<
" events";
TProfile * getTProfile() const
T getParameter(std::string const &) const
EventNumber_t event() const
T getUntrackedParameter(std::string const &, T const &) const
int spigotFormatErrors() const
int emptyEventSpigots() const
MonitorElement * bookProfile(Args &&...args)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
void endRun(const edm::Run &run, const edm::EventSetup &eventSetup) override
#define DEFINE_FWK_MODULE(type)
void endLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &eventSetup) override
int bunchCrossing() const
edm::LuminosityBlockNumber_t luminosityBlock() const
void dqmBeginRun(const edm::Run &, const edm::EventSetup &) override
void setCurrentFolder(std::string const &fullpath)
CastorMonitorModule(const edm::ParameterSet &ps)
void beginLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &eventSetup) override
int badQualityDigis() const
void analyze(const edm::Event &iEvent, const edm::EventSetup &eventSetup) override
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
MonitorElement * book1DD(Args &&...args)
~CastorMonitorModule() override