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,
"");
152 corrFrac = besttrigsCorr / besttrigs;
153 secondFrac = trigsFlag2nd / trigs;
154 if (corrFrac <
parameters.getUntrackedParameter<
double>(
"corrFracError", .5)) {
156 }
else if (corrFrac <
parameters.getUntrackedParameter<
double>(
"corrFracWarning", .6)) {
161 if (secondFrac >
parameters.getUntrackedParameter<
double>(
"secondFracError", .2)) {
163 }
else if (secondFrac >
parameters.getUntrackedParameter<
double>(
"secondFracWarning", .1)) {
169 if (secME[sector_id].
find(
fullName(
"BXDistribPhiIn")) == secME[sector_id].
end()) {
170 bookSectorHistos(ibooker, wh, sect,
"QualDistribPhiIn");
171 bookSectorHistos(ibooker, wh, sect,
"BXDistribPhiIn");
174 TH1D* BXDistr = BXvsQual->ProjectionY();
175 TH1D* QualDistr = BXvsQual->ProjectionX();
176 std::map<std::string, MonitorElement*>* innerME = &(secME[sector_id]);
178 int nbinsBX = BXDistr->GetNbinsX();
179 int firstBinCenter =
static_cast<int>(BXDistr->GetBinCenter(1));
180 int lastBinCenter =
static_cast<int>(BXDistr->GetBinCenter(nbinsBX));
181 int iMin = firstBinCenter > -4 ? firstBinCenter : -4;
182 int iMax = lastBinCenter < 20 ? lastBinCenter : 20;
183 for (
int ibin = iMin + 5; ibin <= iMax + 5; ++ibin) {
184 innerME->find(
fullName(
"BXDistribPhiIn"))
185 ->second->setBinContent(ibin,
stat, BXDistr->GetBinContent(ibin - 5 - firstBinCenter + 1));
187 for (
int ibin = 1; ibin <= 7; ++ibin) {
188 innerME->find(
fullName(
"QualDistribPhiIn"))
189 ->second->setBinContent(ibin,
stat, QualDistr->GetBinContent(ibin));
196 std::map<std::string, MonitorElement*>* innerME = &(secME[sector_id]);
199 bookWheelHistos(ibooker, wh,
"ResidualBXPhiIn");
200 bookWheelHistos(ibooker, wh,
"CorrectBXPhiIn");
201 bookWheelHistos(ibooker, wh,
"CorrFractionPhiIn");
202 bookWheelHistos(ibooker, wh,
"2ndFractionPhiIn");
203 bookWheelHistos(ibooker, wh,
"TriggerInclusivePhiIn");
206 innerME = &(whME[wh]);
207 innerME->find(
fullName(
"CorrectBXPhiIn"))->second->setBinContent(sect,
stat, BX_OK + 0.00001);
208 innerME->find(
fullName(
"ResidualBXPhiIn"))
209 ->second->setBinContent(sect,
stat, round(25. * (BXMean - BX_OK)) + 0.00001);
210 innerME->find(
fullName(
"CorrFractionPhiIn"))->second->setBinContent(sect,
stat, corrFrac);
211 innerME->find(
fullName(
"TriggerInclusivePhiIn"))->second->setBinContent(sect,
stat, besttrigs);
212 innerME->find(
fullName(
"2ndFractionPhiIn"))->second->setBinContent(sect,
stat, secondFrac);
214 whME[wh].find(
fullName(
"CorrFractionSummaryIn"))->second->setBinContent(sect,
stat, corrSummary);
215 whME[wh].find(
fullName(
"2ndFractionSummaryIn"))->second->setBinContent(sect,
stat, secondSummary);
222 TH2F* BXvsQual = getHisto<TH2F>(igetter.
get(getMEName(
"BXvsQual_Out",
"LocalTriggerPhiOut", chId)));
223 TH1F* BestQual = getHisto<TH1F>(igetter.
get(getMEName(
"BestQual_Out",
"LocalTriggerPhiOut", chId)));
224 TH2F* Flag1stvsQual =
225 getHisto<TH2F>(igetter.
get(getMEName(
"Flag1stvsQual_Out",
"LocalTriggerPhiOut", chId)));
226 if (BXvsQual && Flag1stvsQual && BestQual) {
228 int secondSummary = 1;
232 double corrFrac = 0.;
233 double secondFrac = 0.;
234 double besttrigs = 0.;
236 if (BestQual->GetEntries() > 1) {
237 TH1D* BXHH = BXvsQual->ProjectionY(
"", 6, 7,
"");
238 TH1D* Flag1st = Flag1stvsQual->ProjectionY();
239 int BXOK_bin = BXHH->GetEntries() >= 1 ? BXHH->GetMaximumBin() : 51;
240 BXMean = BXHH->GetEntries() >= 1 ? BXHH->GetMean() : 51;
241 BX_OK = BXvsQual->GetYaxis()->GetBinCenter(BXOK_bin);
242 double trigsFlag2nd = Flag1st->GetBinContent(2);
243 double trigs = Flag1st->GetEntries();
244 besttrigs = BestQual->GetEntries();
245 double besttrigsCorr = BestQual->Integral(5, 7,
"");
249 corrFrac = besttrigsCorr / besttrigs;
250 secondFrac = trigsFlag2nd / trigs;
251 if (corrFrac <
parameters.getUntrackedParameter<
double>(
"corrFracError", .5)) {
253 }
else if (corrFrac <
parameters.getUntrackedParameter<
double>(
"corrFracWarning", .6)) {
258 if (secondFrac >
parameters.getUntrackedParameter<
double>(
"secondFracError", .2)) {
260 }
else if (secondFrac >
parameters.getUntrackedParameter<
double>(
"secondFracWarning", .1)) {
266 if (secME[sector_id].
find(
fullName(
"BXDistribPhiOut")) == secME[sector_id].
end()) {
267 bookSectorHistos(ibooker, wh, sect,
"QualDistribPhiOut");
268 bookSectorHistos(ibooker, wh, sect,
"BXDistribPhiOut");
271 TH1D* BXDistr = BXvsQual->ProjectionY();
272 TH1D* QualDistr = BXvsQual->ProjectionX();
273 std::map<std::string, MonitorElement*>* innerME = &(secME[sector_id]);
275 int nbinsBX = BXDistr->GetNbinsX();
276 int firstBinCenter =
static_cast<int>(BXDistr->GetBinCenter(1));
277 int lastBinCenter =
static_cast<int>(BXDistr->GetBinCenter(nbinsBX));
278 int iMin = firstBinCenter > -4 ? firstBinCenter : -4;
279 int iMax = lastBinCenter < 20 ? lastBinCenter : 20;
280 for (
int ibin = iMin + 5; ibin <= iMax + 5; ++ibin) {
281 innerME->find(
fullName(
"BXDistribPhiOut"))
282 ->second->setBinContent(ibin,
stat, BXDistr->GetBinContent(ibin - 5 - firstBinCenter + 1));
284 for (
int ibin = 1; ibin <= 7; ++ibin) {
285 innerME->find(
fullName(
"QualDistribPhiOut"))
286 ->second->setBinContent(ibin,
stat, QualDistr->GetBinContent(ibin));
293 std::map<std::string, MonitorElement*>* innerME = &(secME[sector_id]);
296 bookWheelHistos(ibooker, wh,
"ResidualBXPhiOut");
297 bookWheelHistos(ibooker, wh,
"CorrectBXPhiOut");
298 bookWheelHistos(ibooker, wh,
"CorrFractionPhiOut");
299 bookWheelHistos(ibooker, wh,
"2ndFractionPhiOut");
300 bookWheelHistos(ibooker, wh,
"TriggerInclusivePhiOut");
303 innerME = &(whME[wh]);
304 innerME->find(
fullName(
"CorrectBXPhiOut"))->second->setBinContent(sect,
stat, BX_OK + 0.00001);
305 innerME->find(
fullName(
"ResidualBXPhiOut"))
306 ->second->setBinContent(sect,
stat, round(25. * (BXMean - BX_OK)) + 0.00001);
307 innerME->find(
fullName(
"CorrFractionPhiOut"))->second->setBinContent(sect,
stat, corrFrac);
308 innerME->find(
fullName(
"TriggerInclusivePhiOut"))->second->setBinContent(sect,
stat, besttrigs);
309 innerME->find(
fullName(
"2ndFractionPhiOut"))->second->setBinContent(sect,
stat, secondFrac);
311 whME[wh].find(
fullName(
"CorrFractionSummaryOut"))->second->setBinContent(sect,
stat, corrSummary);
312 whME[wh].find(
fullName(
"2ndFractionSummaryOut"))->second->setBinContent(sect,
stat, secondSummary);
320 TH2F* ThetaPosvsBX = getHisto<TH2F>(igetter.
get(getMEName(
"PositionvsBX",
"LocalTriggerTheta", chId)));
323 if (ThetaPosvsBX && stat < 4 && ThetaPosvsBX->GetEntries() > 1) {
324 TH1D*
BX = ThetaPosvsBX->ProjectionX();
325 int BXOK_bin = BX->GetEffectiveEntries() >= 1 ? BX->GetMaximumBin() : 10;
326 BX_OK = ThetaPosvsBX->GetXaxis()->GetBinCenter(BXOK_bin);
330 bookWheelHistos(ibooker, wh,
"CorrectBXTheta");
332 std::map<std::string, MonitorElement*>* innerME = &(whME.find(wh)->second);
333 innerME->find(
fullName(
"CorrectBXTheta"))->second->setBinContent(sect,
stat, BX_OK + 0.00001);
336 TH2F* ThetaBXvsQual = getHisto<TH2F>(igetter.
get(getMEName(
"ThetaBXvsQual",
"LocalTriggerTheta", chId)));
337 TH1F* ThetaBestQual = getHisto<TH1F>(igetter.
get(getMEName(
"ThetaBestQual",
"LocalTriggerTheta", chId)));
338 if (ThetaBXvsQual && ThetaBestQual && stat < 4 && ThetaBestQual->GetEntries() > 1) {
339 double trigs = ThetaBestQual->GetEntries();
340 double trigsH = ThetaBestQual->GetBinContent(
343 bookWheelHistos(ibooker, wh,
"HFractionTheta");
345 std::map<std::string, MonitorElement*>* innerME = &(whME.find(wh)->second);
346 innerME->find(
fullName(
"HFractionTheta"))->second->setBinContent(sect,
stat, trigsH / trigs);
356 for (vector<string>::const_iterator iTr = trigSources.begin(); iTr != trigSources.end(); ++iTr) {
358 for (vector<string>::const_iterator iHw =
hwSources.begin(); iHw !=
hwSources.end(); ++iHw) {
360 for (
int wh = -2; wh <= 2; ++wh) {
361 std::map<std::string, MonitorElement*>* innerME = &(whME[wh]);
363 TH2F* corrWhSummaryIn = getHisto<TH2F>(innerME->find(
fullName(
"CorrFractionSummaryIn"))->second);
364 TH2F* secondWhSummaryIn = getHisto<TH2F>(innerME->find(
fullName(
"2ndFractionSummaryIn"))->second);
365 for (
int sect = 1; sect <= 12; ++sect) {
369 int secondNoData = 0;
371 switch (static_cast<int>(corrWhSummaryIn->GetBinContent(sect,
stat))) {
378 switch (static_cast<int>(secondWhSummaryIn->GetBinContent(sect,
stat))) {
388 if (secondNoData == 4)
390 cmsME.find(
fullName(
"CorrFractionSummaryIn"))->second->setBinContent(sect, wh + wheelArrayShift, corrErr);
391 cmsME.find(
fullName(
"2ndFractionSummaryIn"))->second->setBinContent(sect, wh + wheelArrayShift, secondErr);
394 TH2F* corrWhSummaryOut = getHisto<TH2F>(innerME->find(
fullName(
"CorrFractionSummaryOut"))->second);
395 TH2F* secondWhSummaryOut = getHisto<TH2F>(innerME->find(
fullName(
"2ndFractionSummaryOut"))->second);
396 for (
int sect = 1; sect <= 12; ++sect) {
400 int secondNoData = 0;
402 switch (static_cast<int>(corrWhSummaryOut->GetBinContent(sect,
stat))) {
409 switch (static_cast<int>(secondWhSummaryOut->GetBinContent(sect,
stat))) {
419 if (secondNoData == 4)
421 cmsME.find(
fullName(
"CorrFractionSummaryOut"))->second->setBinContent(sect, wh + wheelArrayShift, corrErr);
422 cmsME.find(
fullName(
"2ndFractionSummaryOut"))->second->setBinContent(sect, wh + wheelArrayShift, secondErr);
427 fillGlobalSummary(igetter);
431 float glbPerc[5] = {1., 0.9, 0.6, 0.3, 0.01};
437 for (
int wh = -2; wh <= 2; ++wh) {
438 for (
int sect = 1; sect <= 12; ++sect) {
440 int corr = cmsME.find(
fullName(
"CorrFractionSummaryIn"))->second->getBinContent(sect, wh + wheelArrayShift);
441 int second = cmsME.find(
fullName(
"2ndFractionSummaryIn"))->second->getBinContent(sect, wh + wheelArrayShift);
450 (corr < 5 || second < 5) && nSecReadout++;
451 int errcode = ((corr < 5 ? corr : 4) + (second < 5 ? second : 4) + (lut < 5 ? lut : 4));
452 errcode =
min(
int((errcode / maxErr + 0.01) * 5), 5);
453 cmsME.find(
"TrigGlbSummary")->second->setBinContent(sect, wh + wheelArrayShift, glbPerc[errcode]);
458 cmsME.find(
"TrigGlbSummary")->second->Reset();
460 string nEvtsName =
"DT/EventInfo/Counters/nProcessedEventsTrigger";
465 cmsME.find(
"TrigGlbSummary")->second->setEntries(nProcEvts < nMinEvts ? 10. : nProcEvts);
467 cmsME.find(
"TrigGlbSummary")->second->setEntries(nMinEvts + 1);
void beginRun(const edm::Run &r, const edm::EventSetup &c) override
BeginRun.
T getUntrackedParameter(std::string const &, T const &) const
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)
U second(std::pair< T, U > const &p)
void fillGlobalSummary(DQMStore::IGetter &)
EventID const & min(EventID const &lh, EventID const &rh)
virtual double getBinContent(int binx) const
get content of bin (1-D)
void beginRun(edm::Run const &run, edm::EventSetup const &context) override
BeginRun.
DTLocalTriggerTest(const edm::ParameterSet &ps)
Constructor.
virtual double getFloatValue() const
void runClientDiagnostic(DQMStore::IBooker &, DQMStore::IGetter &) override
Run client analysis.
MonitorElement * get(std::string const &path)