34 setConfig(ps,
"DTLocalTrigger");
35 baseFolderTM =
"DT/03-LocalTrigger-TM/";
44 vector<string>::const_iterator iTr = trigSources.begin();
45 vector<string>::const_iterator trEnd = trigSources.end();
46 vector<string>::const_iterator iHw =
hwSources.begin();
47 vector<string>::const_iterator hwEnd =
hwSources.end();
50 if (
parameters.getUntrackedParameter<
bool>(
"staticBooking",
true)) {
51 for (; iTr != trEnd; ++iTr) {
53 for (; iHw != hwEnd; ++iHw) {
56 for (
int wh = -2; wh <= 2; ++wh) {
57 for (
int sect = 1; sect <= 12; ++sect) {
58 bookSectorHistos(ibooker, wh, sect,
"BXDistribPhiIn");
59 bookSectorHistos(ibooker, wh, sect,
"QualDistribPhiIn");
60 bookSectorHistos(ibooker, wh, sect,
"BXDistribPhiOut");
61 bookSectorHistos(ibooker, wh, sect,
"QualDistribPhiOut");
64 bookWheelHistos(ibooker, wh,
"CorrectBXPhiIn");
65 bookWheelHistos(ibooker, wh,
"ResidualBXPhiIn");
66 bookWheelHistos(ibooker, wh,
"CorrFractionPhiIn");
67 bookWheelHistos(ibooker, wh,
"2ndFractionPhiIn");
68 bookWheelHistos(ibooker, wh,
"TriggerInclusivePhiIn");
70 bookWheelHistos(ibooker, wh,
"CorrectBXPhiOut");
71 bookWheelHistos(ibooker, wh,
"ResidualBXPhiOut");
72 bookWheelHistos(ibooker, wh,
"CorrFractionPhiOut");
73 bookWheelHistos(ibooker, wh,
"2ndFractionPhiOut");
74 bookWheelHistos(ibooker, wh,
"TriggerInclusivePhiOut");
80 for (iTr = trigSources.begin(); iTr != trEnd; ++iTr) {
85 for (
int wh = -2; wh <= 2; ++wh) {
86 bookWheelHistos(ibooker, wh,
"CorrFractionSummaryIn",
"Summaries");
87 bookWheelHistos(ibooker, wh,
"2ndFractionSummaryIn",
"Summaries");
88 bookWheelHistos(ibooker, wh,
"CorrFractionSummaryOut",
"Summaries");
89 bookWheelHistos(ibooker, wh,
"2ndFractionSummaryOut",
"Summaries");
91 bookCmsHistos(ibooker,
"CorrFractionSummaryIn");
92 bookCmsHistos(ibooker,
"2ndFractionSummaryIn");
93 bookCmsHistos(ibooker,
"CorrFractionSummaryOut");
94 bookCmsHistos(ibooker,
"2ndFractionSummaryOut");
97 bookCmsHistos(ibooker,
"TrigGlbSummary",
"",
true);
111 Bookings(ibooker, igetter);
114 for (vector<string>::const_iterator iTr = trigSources.begin(); iTr != trigSources.end(); ++iTr) {
117 for (vector<string>::const_iterator iHw =
hwSources.begin(); iHw !=
hwSources.end(); ++iHw) {
121 for (
int wh = -2; wh <= 2; ++wh) {
122 for (
int sect = 1; sect <= 12; ++sect) {
124 int sector_id = (wh + wheelArrayShift) + (sect - 1) * 5;
127 TH2F* BXvsQual = getHisto<TH2F>(igetter.
get(getMEName(
"BXvsQual_In",
"LocalTriggerPhiIn", chId)));
128 TH1F* BestQual = getHisto<TH1F>(igetter.
get(getMEName(
"BestQual_In",
"LocalTriggerPhiIn", chId)));
129 TH2F* Flag1stvsQual = getHisto<TH2F>(igetter.
get(getMEName(
"Flag1stvsQual_In",
"LocalTriggerPhiIn", chId)));
130 if (BXvsQual && Flag1stvsQual && BestQual) {
132 int secondSummary = 1;
136 double corrFrac = 0.;
137 double secondFrac = 0.;
138 double besttrigs = 0.;
139 if (BestQual->GetEntries() > 1) {
140 TH1D* BXHH = BXvsQual->ProjectionY(
"", 6, 7,
"");
141 TH1D* Flag1st = Flag1stvsQual->ProjectionY();
142 int BXOK_bin = BXHH->GetEntries() >= 1 ? BXHH->GetMaximumBin() : 51;
143 BXMean = BXHH->GetEntries() >= 1 ? BXHH->GetMean() : 51;
144 BX_OK = BXvsQual->GetYaxis()->GetBinCenter(BXOK_bin);
145 double trigsFlag2nd = Flag1st->GetBinContent(2);
146 double trigs = Flag1st->GetEntries();
147 besttrigs = BestQual->GetEntries();
148 double besttrigsCorr = BestQual->Integral(5, 7,
"");
153 corrFrac = besttrigsCorr / besttrigs;
157 secondFrac = trigsFlag2nd / trigs;
161 if (corrFrac <
parameters.getUntrackedParameter<
double>(
"corrFracError", .5)) {
163 }
else if (corrFrac <
parameters.getUntrackedParameter<
double>(
"corrFracWarning", .6)) {
168 if (secondFrac >
parameters.getUntrackedParameter<
double>(
"secondFracError", .2)) {
170 }
else if (secondFrac >
parameters.getUntrackedParameter<
double>(
"secondFracWarning", .1)) {
176 if (secME[sector_id].
find(
fullName(
"BXDistribPhiIn")) == secME[sector_id].end()) {
177 bookSectorHistos(ibooker, wh, sect,
"QualDistribPhiIn");
178 bookSectorHistos(ibooker, wh, sect,
"BXDistribPhiIn");
181 TH1D* BXDistr = BXvsQual->ProjectionY();
182 TH1D* QualDistr = BXvsQual->ProjectionX();
183 std::map<std::string, MonitorElement*>* innerME = &(secME[sector_id]);
185 int nbinsBX = BXDistr->GetNbinsX();
186 int firstBinCenter =
static_cast<int>(BXDistr->GetBinCenter(1));
187 int lastBinCenter =
static_cast<int>(BXDistr->GetBinCenter(nbinsBX));
188 int iMin = firstBinCenter > -4 ? firstBinCenter : -4;
189 int iMax = lastBinCenter < 20 ? lastBinCenter : 20;
190 for (
int ibin = iMin + 5; ibin <= iMax + 5; ++ibin) {
191 innerME->find(
fullName(
"BXDistribPhiIn"))
192 ->second->setBinContent(ibin,
stat, BXDistr->GetBinContent(ibin - 5 - firstBinCenter + 1));
194 for (
int ibin = 1; ibin <= 7; ++ibin) {
195 innerME->find(
fullName(
"QualDistribPhiIn"))
196 ->second->setBinContent(ibin,
stat, QualDistr->GetBinContent(ibin));
203 std::map<std::string, MonitorElement*>* innerME = &(secME[sector_id]);
205 if (whME[wh].
find(
fullName(
"CorrectBXPhiIn")) == whME[wh].end()) {
206 bookWheelHistos(ibooker, wh,
"ResidualBXPhiIn");
207 bookWheelHistos(ibooker, wh,
"CorrectBXPhiIn");
208 bookWheelHistos(ibooker, wh,
"CorrFractionPhiIn");
209 bookWheelHistos(ibooker, wh,
"2ndFractionPhiIn");
210 bookWheelHistos(ibooker, wh,
"TriggerInclusivePhiIn");
213 innerME = &(whME[wh]);
214 innerME->find(
fullName(
"CorrectBXPhiIn"))->second->setBinContent(sect,
stat, BX_OK + 0.00001);
215 innerME->find(
fullName(
"ResidualBXPhiIn"))
216 ->second->setBinContent(sect,
stat, round(25. * (BXMean - BX_OK)) + 0.00001);
217 innerME->find(
fullName(
"CorrFractionPhiIn"))->second->setBinContent(sect,
stat, corrFrac);
218 innerME->find(
fullName(
"TriggerInclusivePhiIn"))->second->setBinContent(sect,
stat, besttrigs);
219 innerME->find(
fullName(
"2ndFractionPhiIn"))->second->setBinContent(sect,
stat, secondFrac);
221 whME[wh].find(
fullName(
"CorrFractionSummaryIn"))->second->setBinContent(sect,
stat, corrSummary);
222 whME[wh].find(
fullName(
"2ndFractionSummaryIn"))->second->setBinContent(sect,
stat, secondSummary);
229 TH2F* BXvsQual = getHisto<TH2F>(igetter.
get(getMEName(
"BXvsQual_Out",
"LocalTriggerPhiOut", chId)));
230 TH1F* BestQual = getHisto<TH1F>(igetter.
get(getMEName(
"BestQual_Out",
"LocalTriggerPhiOut", chId)));
231 TH2F* Flag1stvsQual =
232 getHisto<TH2F>(igetter.
get(getMEName(
"Flag1stvsQual_Out",
"LocalTriggerPhiOut", chId)));
233 if (BXvsQual && Flag1stvsQual && BestQual) {
235 int secondSummary = 1;
239 double corrFrac = 0.;
240 double secondFrac = 0.;
241 double besttrigs = 0.;
243 if (BestQual->GetEntries() > 1) {
244 TH1D* BXHH = BXvsQual->ProjectionY(
"", 6, 7,
"");
245 TH1D* Flag1st = Flag1stvsQual->ProjectionY();
246 int BXOK_bin = BXHH->GetEntries() >= 1 ? BXHH->GetMaximumBin() : 51;
247 BXMean = BXHH->GetEntries() >= 1 ? BXHH->GetMean() : 51;
248 BX_OK = BXvsQual->GetYaxis()->GetBinCenter(BXOK_bin);
249 double trigsFlag2nd = Flag1st->GetBinContent(2);
250 double trigs = Flag1st->GetEntries();
251 besttrigs = BestQual->GetEntries();
252 double besttrigsCorr = BestQual->Integral(5, 7,
"");
256 corrFrac = besttrigsCorr / besttrigs;
257 secondFrac = trigsFlag2nd / trigs;
258 if (corrFrac <
parameters.getUntrackedParameter<
double>(
"corrFracError", .5)) {
260 }
else if (corrFrac <
parameters.getUntrackedParameter<
double>(
"corrFracWarning", .6)) {
265 if (secondFrac >
parameters.getUntrackedParameter<
double>(
"secondFracError", .2)) {
267 }
else if (secondFrac >
parameters.getUntrackedParameter<
double>(
"secondFracWarning", .1)) {
273 if (secME[sector_id].
find(
fullName(
"BXDistribPhiOut")) == secME[sector_id].end()) {
274 bookSectorHistos(ibooker, wh, sect,
"QualDistribPhiOut");
275 bookSectorHistos(ibooker, wh, sect,
"BXDistribPhiOut");
278 TH1D* BXDistr = BXvsQual->ProjectionY();
279 TH1D* QualDistr = BXvsQual->ProjectionX();
280 std::map<std::string, MonitorElement*>* innerME = &(secME[sector_id]);
282 int nbinsBX = BXDistr->GetNbinsX();
283 int firstBinCenter =
static_cast<int>(BXDistr->GetBinCenter(1));
284 int lastBinCenter =
static_cast<int>(BXDistr->GetBinCenter(nbinsBX));
285 int iMin = firstBinCenter > -4 ? firstBinCenter : -4;
286 int iMax = lastBinCenter < 20 ? lastBinCenter : 20;
287 for (
int ibin = iMin + 5; ibin <= iMax + 5; ++ibin) {
288 innerME->find(
fullName(
"BXDistribPhiOut"))
289 ->second->setBinContent(ibin,
stat, BXDistr->GetBinContent(ibin - 5 - firstBinCenter + 1));
291 for (
int ibin = 1; ibin <= 7; ++ibin) {
292 innerME->find(
fullName(
"QualDistribPhiOut"))
293 ->second->setBinContent(ibin,
stat, QualDistr->GetBinContent(ibin));
300 std::map<std::string, MonitorElement*>* innerME = &(secME[sector_id]);
302 if (whME[wh].
find(
fullName(
"CorrectBXPhiOut")) == whME[wh].end()) {
303 bookWheelHistos(ibooker, wh,
"ResidualBXPhiOut");
304 bookWheelHistos(ibooker, wh,
"CorrectBXPhiOut");
305 bookWheelHistos(ibooker, wh,
"CorrFractionPhiOut");
306 bookWheelHistos(ibooker, wh,
"2ndFractionPhiOut");
307 bookWheelHistos(ibooker, wh,
"TriggerInclusivePhiOut");
310 innerME = &(whME[wh]);
311 innerME->find(
fullName(
"CorrectBXPhiOut"))->second->setBinContent(sect,
stat, BX_OK + 0.00001);
312 innerME->find(
fullName(
"ResidualBXPhiOut"))
313 ->second->setBinContent(sect,
stat, round(25. * (BXMean - BX_OK)) + 0.00001);
314 innerME->find(
fullName(
"CorrFractionPhiOut"))->second->setBinContent(sect,
stat, corrFrac);
315 innerME->find(
fullName(
"TriggerInclusivePhiOut"))->second->setBinContent(sect,
stat, besttrigs);
316 innerME->find(
fullName(
"2ndFractionPhiOut"))->second->setBinContent(sect,
stat, secondFrac);
318 whME[wh].find(
fullName(
"CorrFractionSummaryOut"))->second->setBinContent(sect,
stat, corrSummary);
319 whME[wh].find(
fullName(
"2ndFractionSummaryOut"))->second->setBinContent(sect,
stat, secondSummary);
327 TH2F* ThetaPosvsBX = getHisto<TH2F>(igetter.
get(getMEName(
"PositionvsBX",
"LocalTriggerTheta", chId)));
330 if (ThetaPosvsBX && stat < 4 && ThetaPosvsBX->GetEntries() > 1) {
331 TH1D*
BX = ThetaPosvsBX->ProjectionX();
332 int BXOK_bin =
BX->GetEffectiveEntries() >= 1 ?
BX->GetMaximumBin() : 10;
333 BX_OK = ThetaPosvsBX->GetXaxis()->GetBinCenter(BXOK_bin);
336 if (whME[wh].
find(
fullName(
"CorrectBXTheta")) == whME[wh].end()) {
337 bookWheelHistos(ibooker, wh,
"CorrectBXTheta");
339 std::map<std::string, MonitorElement*>* innerME = &(whME.find(wh)->second);
340 innerME->find(
fullName(
"CorrectBXTheta"))->second->setBinContent(sect,
stat, BX_OK + 0.00001);
343 TH2F* ThetaBXvsQual = getHisto<TH2F>(igetter.
get(getMEName(
"ThetaBXvsQual",
"LocalTriggerTheta", chId)));
344 TH1F* ThetaBestQual = getHisto<TH1F>(igetter.
get(getMEName(
"ThetaBestQual",
"LocalTriggerTheta", chId)));
345 if (ThetaBXvsQual && ThetaBestQual && stat < 4 && ThetaBestQual->GetEntries() > 1) {
346 double trigs = ThetaBestQual->GetEntries();
347 double trigsH = ThetaBestQual->GetBinContent(
349 if (whME[wh].
find(
fullName(
"HFractionTheta")) == whME[wh].end()) {
350 bookWheelHistos(ibooker, wh,
"HFractionTheta");
352 std::map<std::string, MonitorElement*>* innerME = &(whME.find(wh)->second);
353 innerME->find(
fullName(
"HFractionTheta"))->second->setBinContent(sect,
stat, trigsH / trigs);
363 for (vector<string>::const_iterator iTr = trigSources.begin(); iTr != trigSources.end(); ++iTr) {
365 for (vector<string>::const_iterator iHw =
hwSources.begin(); iHw !=
hwSources.end(); ++iHw) {
367 for (
int wh = -2; wh <= 2; ++wh) {
368 std::map<std::string, MonitorElement*>* innerME = &(whME[wh]);
370 TH2F* corrWhSummaryIn = getHisto<TH2F>(innerME->find(
fullName(
"CorrFractionSummaryIn"))->second);
371 TH2F* secondWhSummaryIn = getHisto<TH2F>(innerME->find(
fullName(
"2ndFractionSummaryIn"))->second);
372 for (
int sect = 1; sect <= 12; ++sect) {
376 int secondNoData = 0;
378 switch (static_cast<int>(corrWhSummaryIn->GetBinContent(sect,
stat))) {
385 switch (static_cast<int>(secondWhSummaryIn->GetBinContent(sect,
stat))) {
395 if (secondNoData == 4)
397 cmsME.find(
fullName(
"CorrFractionSummaryIn"))->second->setBinContent(sect, wh + wheelArrayShift, corrErr);
398 cmsME.find(
fullName(
"2ndFractionSummaryIn"))->second->setBinContent(sect, wh + wheelArrayShift, secondErr);
401 TH2F* corrWhSummaryOut = getHisto<TH2F>(innerME->find(
fullName(
"CorrFractionSummaryOut"))->second);
402 TH2F* secondWhSummaryOut = getHisto<TH2F>(innerME->find(
fullName(
"2ndFractionSummaryOut"))->second);
403 for (
int sect = 1; sect <= 12; ++sect) {
407 int secondNoData = 0;
409 switch (static_cast<int>(corrWhSummaryOut->GetBinContent(sect,
stat))) {
416 switch (static_cast<int>(secondWhSummaryOut->GetBinContent(sect,
stat))) {
426 if (secondNoData == 4)
428 cmsME.find(
fullName(
"CorrFractionSummaryOut"))->second->setBinContent(sect, wh + wheelArrayShift, corrErr);
429 cmsME.find(
fullName(
"2ndFractionSummaryOut"))->second->setBinContent(sect, wh + wheelArrayShift, secondErr);
434 fillGlobalSummary(igetter);
438 float glbPerc[5] = {1., 0.9, 0.6, 0.3, 0.01};
444 for (
int wh = -2; wh <= 2; ++wh) {
445 for (
int sect = 1; sect <= 12; ++sect) {
447 int corr = cmsME.find(
fullName(
"CorrFractionSummaryIn"))->second->getBinContent(sect, wh + wheelArrayShift);
448 int second = cmsME.find(
fullName(
"2ndFractionSummaryIn"))->second->getBinContent(sect, wh + wheelArrayShift);
459 errcode =
min(
int((errcode / maxErr + 0.01) * 4), 4);
460 cmsME.find(
"TrigGlbSummary")->second->setBinContent(sect, wh + wheelArrayShift, glbPerc[errcode]);
465 cmsME.find(
"TrigGlbSummary")->second->Reset();
467 string nEvtsName =
"DT/EventInfo/Counters/nProcessedEventsTrigger";
472 cmsME.find(
"TrigGlbSummary")->second->setEntries(nProcEvts < nMinEvts ? 10. : nProcEvts);
474 cmsME.find(
"TrigGlbSummary")->second->setEntries(nMinEvts + 1);
void beginRun(const edm::Run &r, const edm::EventSetup &c) override
BeginRun.
Log< level::Info, true > LogVerbatim
void Bookings(DQMStore::IBooker &, DQMStore::IGetter &)
~DTLocalTriggerTest() override
Destructor.
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
T getUntrackedParameter(std::string const &, T const &) const
U second(std::pair< T, U > const &p)
void fillGlobalSummary(DQMStore::IGetter &)
virtual double getFloatValue() const
EventID const & min(EventID const &lh, EventID const &rh)
void beginRun(edm::Run const &run, edm::EventSetup const &context) override
BeginRun.
DTLocalTriggerTest(const edm::ParameterSet &ps)
Constructor.
virtual MonitorElement * get(std::string const &fullpath) const
void runClientDiagnostic(DQMStore::IBooker &, DQMStore::IGetter &) override
Run client analysis.
virtual double getBinContent(int binx) const
get content of bin (1-D)