39 setConfig(ps,
"DTLocalTrigger");
40 baseFolderTM =
"DT/03-LocalTrigger-TM/";
41 baseFolderDDU =
"DT/04-LocalTrigger-DDU/";
56 vector<string>::const_iterator iTr = trigSources.begin();
57 vector<string>::const_iterator trEnd = trigSources.end();
58 vector<string>::const_iterator iHw = hwSources.begin();
59 vector<string>::const_iterator hwEnd = hwSources.end();
62 if(
parameters.getUntrackedParameter<
bool>(
"staticBooking",
true)){
63 for (; iTr != trEnd; ++iTr){
65 for (; iHw != hwEnd; ++iHw){
68 for (
int wh=-2; wh<=2; ++wh){
69 if (hwSource==
"COM") {
71 bookWheelHistos(ibooker,wh,
"MatchingPhi");
74 for (
int sect=1; sect<=12; ++sect){
76 bookSectorHistos(ibooker,wh,sect,
"BXDistribPhiIn");
77 bookSectorHistos(ibooker,wh,sect,
"QualDistribPhiIn");
78 bookSectorHistos(ibooker,wh,sect,
"BXDistribPhiOut");
79 bookSectorHistos(ibooker,wh,sect,
"QualDistribPhiOut");
82 bookWheelHistos(ibooker,wh,
"CorrectBXPhiIn");
83 bookWheelHistos(ibooker,wh,
"ResidualBXPhiIn");
84 bookWheelHistos(ibooker,wh,
"CorrFractionPhiIn");
85 bookWheelHistos(ibooker,wh,
"2ndFractionPhiIn");
86 bookWheelHistos(ibooker,wh,
"TriggerInclusivePhiIn");
88 bookWheelHistos(ibooker,wh,
"CorrectBXPhiOut");
89 bookWheelHistos(ibooker,wh,
"ResidualBXPhiOut");
90 bookWheelHistos(ibooker,wh,
"CorrFractionPhiOut");
91 bookWheelHistos(ibooker,wh,
"2ndFractionPhiOut");
92 bookWheelHistos(ibooker,wh,
"TriggerInclusivePhiOut");
100 for (iTr = trigSources.begin(); iTr != trEnd; ++iTr){
102 for (iHw = hwSources.begin(); iHw != hwSources.end(); ++iHw){
105 for (
int wh=-2; wh<=2; ++wh){
106 if (hwSource==
"COM") {
108 bookWheelHistos(ibooker,wh,
"MatchingSummary",
"Summaries");
112 bookWheelHistos(ibooker,wh,
"CorrFractionSummaryIn",
"Summaries");
113 bookWheelHistos(ibooker,wh,
"2ndFractionSummaryIn",
"Summaries");
114 bookWheelHistos(ibooker,wh,
"CorrFractionSummaryOut",
"Summaries");
115 bookWheelHistos(ibooker,wh,
"2ndFractionSummaryOut",
"Summaries");
118 if (hwSource==
"COM") {
120 bookCmsHistos(ibooker,
"MatchingSummary",
"Summaries");
124 bookCmsHistos(ibooker,
"CorrFractionSummaryIn");
125 bookCmsHistos(ibooker,
"2ndFractionSummaryIn");
126 bookCmsHistos(ibooker,
"CorrFractionSummaryOut");
127 bookCmsHistos(ibooker,
"2ndFractionSummaryOut");
130 if (hwSource==
"TM") {
132 bookCmsHistos(ibooker,
"TrigGlbSummary",
"",
true);
150 if (!bookingdone) Bookings(ibooker,igetter);
153 for (vector<string>::const_iterator iTr = trigSources.begin(); iTr != trigSources.end(); ++iTr){
156 for (vector<string>::const_iterator iHw = hwSources.begin(); iHw != hwSources.end(); ++iHw){
160 for (
int wh=-2; wh<=2; ++wh){
161 for (
int sect=1; sect<=12; ++sect){
163 int sector_id = (wh+wheelArrayShift)+(sect-1)*5;
165 if (hwSource==
"COM") {
167 TH2F * DDUvsTM = getHisto<TH2F>(igetter.
get(getMEName(
"QualDDUvsQualTM",
"LocalTriggerPhiIn", chId)));
170 int matchSummary = 1;
172 if (DDUvsTM->GetEntries()>1) {
174 double entries = DDUvsTM->GetEntries();
175 double corrEntries = 0;
176 for (
int ibin=2; ibin<=8; ++ibin) {
177 corrEntries += DDUvsTM->GetBinContent(ibin,ibin);
179 double corrRatio = corrEntries/entries;
181 if (corrRatio <
parameters.getUntrackedParameter<
double>(
"matchingFracError",.65)){
184 else if (corrRatio <
parameters.getUntrackedParameter<
double>(
"matchingFracWarning",.85)){
191 if( whME[wh].
find(fullName(
"MatchingPhi")) == whME[wh].
end() ){
192 bookWheelHistos(ibooker,wh,
"MatchingPhi");
195 whME[wh].find(fullName(
"MatchingPhi"))->second->setBinContent(sect,
stat,corrRatio);
199 whME[wh].find(fullName(
"MatchingSummary"))->second->setBinContent(sect,
stat,matchSummary);
205 TH2F * BXvsQual = getHisto<TH2F>(igetter.
get(getMEName(
"BXvsQual_In",
"LocalTriggerPhiIn", chId)));
206 TH1F * BestQual = getHisto<TH1F>(igetter.
get(getMEName(
"BestQual_In",
"LocalTriggerPhiIn", chId)));
207 TH2F * Flag1stvsQual = getHisto<TH2F>(igetter.
get(getMEName(
"Flag1stvsQual_In",
"LocalTriggerPhiIn", chId)));
208 if (BXvsQual && Flag1stvsQual && BestQual) {
210 int secondSummary = 1;
213 double BXMean = 51. ;
214 double corrFrac = 0.;
215 double secondFrac = 0.;
216 double besttrigs = 0.;
217 if (BestQual->GetEntries()>1) {
218 TH1D* BXHH = BXvsQual->ProjectionY(
"",6,7,
"");
219 TH1D* Flag1st = Flag1stvsQual->ProjectionY();
220 int BXOK_bin = BXHH->GetEntries()>=1 ? BXHH->GetMaximumBin() : 51;
221 BXMean = BXHH->GetEntries()>=1 ? BXHH->GetMean() : 51;
222 BX_OK = BXvsQual->GetYaxis()->GetBinCenter(BXOK_bin);
223 double trigsFlag2nd = Flag1st->GetBinContent(2);
224 double trigs = Flag1st->GetEntries();
225 besttrigs = BestQual->GetEntries();
226 double besttrigsCorr = BestQual->Integral(5,7,
"");
230 corrFrac = besttrigsCorr/besttrigs;
231 secondFrac = trigsFlag2nd/trigs;
232 if (corrFrac <
parameters.getUntrackedParameter<
double>(
"corrFracError",.5)){
235 else if (corrFrac <
parameters.getUntrackedParameter<
double>(
"corrFracWarning",.6)){
241 if (secondFrac >
parameters.getUntrackedParameter<
double>(
"secondFracError",.2)){
244 else if (secondFrac >
parameters.getUntrackedParameter<
double>(
"secondFracWarning",.1)){
251 if( secME[sector_id].
find(fullName(
"BXDistribPhiIn")) == secME[sector_id].
end() ){
252 bookSectorHistos(ibooker,wh,sect,
"QualDistribPhiIn");
253 bookSectorHistos(ibooker,wh,sect,
"BXDistribPhiIn");
256 TH1D* BXDistr = BXvsQual->ProjectionY();
257 TH1D* QualDistr = BXvsQual->ProjectionX();
258 std::map<std::string,MonitorElement*> *innerME = &(secME[sector_id]);
260 int nbinsBX = BXDistr->GetNbinsX();
261 int firstBinCenter =
static_cast<int>(BXDistr->GetBinCenter(1));
262 int lastBinCenter =
static_cast<int>(BXDistr->GetBinCenter(nbinsBX));
263 int iMin = firstBinCenter>-4 ? firstBinCenter : -4;
264 int iMax = lastBinCenter<20 ? lastBinCenter : 20;
265 for (
int ibin=iMin+5;ibin<=iMax+5; ++ibin) {
266 innerME->find(fullName(
"BXDistribPhiIn"))->second->setBinContent(ibin,
stat,BXDistr->GetBinContent(ibin-5-firstBinCenter+1));
268 for (
int ibin=1;ibin<=7;++ibin) {
269 innerME->find(fullName(
"QualDistribPhiIn"))->second->setBinContent(ibin,
stat,QualDistr->GetBinContent(ibin));
276 std::map<std::string,MonitorElement*> *innerME = &(secME[sector_id]);
278 if( whME[wh].
find(fullName(
"CorrectBXPhiIn")) == whME[wh].
end() ){
279 bookWheelHistos(ibooker,wh,
"ResidualBXPhiIn");
280 bookWheelHistos(ibooker,wh,
"CorrectBXPhiIn");
281 bookWheelHistos(ibooker,wh,
"CorrFractionPhiIn");
282 bookWheelHistos(ibooker,wh,
"2ndFractionPhiIn");
283 bookWheelHistos(ibooker,wh,
"TriggerInclusivePhiIn");
286 innerME = &(whME[wh]);
287 innerME->find(fullName(
"CorrectBXPhiIn"))->second->setBinContent(sect,
stat,BX_OK+0.00001);
288 innerME->find(fullName(
"ResidualBXPhiIn"))->second->setBinContent(sect,
stat,round(25.*(BXMean-BX_OK))+0.00001);
289 innerME->find(fullName(
"CorrFractionPhiIn"))->second->setBinContent(sect,
stat,corrFrac);
290 innerME->find(fullName(
"TriggerInclusivePhiIn"))->second->setBinContent(sect,
stat,besttrigs);
291 innerME->find(fullName(
"2ndFractionPhiIn"))->second->setBinContent(sect,
stat,secondFrac);
294 whME[wh].find(fullName(
"CorrFractionSummaryIn"))->second->setBinContent(sect,
stat,corrSummary);
295 whME[wh].find(fullName(
"2ndFractionSummaryIn"))->second->setBinContent(sect,
stat,secondSummary);
302 TH2F * BXvsQual = getHisto<TH2F>(igetter.
get(getMEName(
"BXvsQual_Out",
"LocalTriggerPhiOut", chId)));
303 TH1F * BestQual = getHisto<TH1F>(igetter.
get(getMEName(
"BestQual_Out",
"LocalTriggerPhiOut", chId)));
304 TH2F * Flag1stvsQual = getHisto<TH2F>(igetter.
get(getMEName(
"Flag1stvsQual_Out",
"LocalTriggerPhiOut", chId)));
305 if (BXvsQual && Flag1stvsQual && BestQual) {
307 int secondSummary = 1;
310 double BXMean = 51. ;
311 double corrFrac = 0.;
312 double secondFrac = 0.;
313 double besttrigs = 0.;
315 if (BestQual->GetEntries()>1) {
316 TH1D* BXHH = BXvsQual->ProjectionY(
"",6,7,
"");
317 TH1D* Flag1st = Flag1stvsQual->ProjectionY();
318 int BXOK_bin = BXHH->GetEntries()>=1 ? BXHH->GetMaximumBin() : 51;
319 BXMean = BXHH->GetEntries()>=1 ? BXHH->GetMean() : 51;
320 BX_OK = BXvsQual->GetYaxis()->GetBinCenter(BXOK_bin);
321 double trigsFlag2nd = Flag1st->GetBinContent(2);
322 double trigs = Flag1st->GetEntries();
323 besttrigs = BestQual->GetEntries();
324 double besttrigsCorr = BestQual->Integral(5,7,
"");
328 corrFrac = besttrigsCorr/besttrigs;
329 secondFrac = trigsFlag2nd/trigs;
330 if (corrFrac <
parameters.getUntrackedParameter<
double>(
"corrFracError",.5)){
333 else if (corrFrac <
parameters.getUntrackedParameter<
double>(
"corrFracWarning",.6)){
339 if (secondFrac >
parameters.getUntrackedParameter<
double>(
"secondFracError",.2)){
342 else if (secondFrac >
parameters.getUntrackedParameter<
double>(
"secondFracWarning",.1)){
349 if( secME[sector_id].
find(fullName(
"BXDistribPhiOut")) == secME[sector_id].
end() ){
350 bookSectorHistos(ibooker,wh,sect,
"QualDistribPhiOut");
351 bookSectorHistos(ibooker,wh,sect,
"BXDistribPhiOut");
354 TH1D* BXDistr = BXvsQual->ProjectionY();
355 TH1D* QualDistr = BXvsQual->ProjectionX();
356 std::map<std::string,MonitorElement*> *innerME = &(secME[sector_id]);
358 int nbinsBX = BXDistr->GetNbinsX();
359 int firstBinCenter =
static_cast<int>(BXDistr->GetBinCenter(1));
360 int lastBinCenter =
static_cast<int>(BXDistr->GetBinCenter(nbinsBX));
361 int iMin = firstBinCenter>-4 ? firstBinCenter : -4;
362 int iMax = lastBinCenter<20 ? lastBinCenter : 20;
363 for (
int ibin=iMin+5;ibin<=iMax+5; ++ibin) {
364 innerME->find(fullName(
"BXDistribPhiOut"))->second->setBinContent(ibin,
stat,BXDistr->GetBinContent(ibin-5-firstBinCenter+1));
366 for (
int ibin=1;ibin<=7;++ibin) {
367 innerME->find(fullName(
"QualDistribPhiOut"))->second->setBinContent(ibin,
stat,QualDistr->GetBinContent(ibin));
374 std::map<std::string,MonitorElement*> *innerME = &(secME[sector_id]);
376 if( whME[wh].
find(fullName(
"CorrectBXPhiOut")) == whME[wh].
end() ){
377 bookWheelHistos(ibooker,wh,
"ResidualBXPhiOut");
378 bookWheelHistos(ibooker,wh,
"CorrectBXPhiOut");
379 bookWheelHistos(ibooker,wh,
"CorrFractionPhiOut");
380 bookWheelHistos(ibooker,wh,
"2ndFractionPhiOut");
381 bookWheelHistos(ibooker,wh,
"TriggerInclusivePhiOut");
384 innerME = &(whME[wh]);
385 innerME->find(fullName(
"CorrectBXPhiOut"))->second->setBinContent(sect,
stat,BX_OK+0.00001);
386 innerME->find(fullName(
"ResidualBXPhiOut"))->second->setBinContent(sect,
stat,round(25.*(BXMean-BX_OK))+0.00001);
387 innerME->find(fullName(
"CorrFractionPhiOut"))->second->setBinContent(sect,
stat,corrFrac);
388 innerME->find(fullName(
"TriggerInclusivePhiOut"))->second->setBinContent(sect,
stat,besttrigs);
389 innerME->find(fullName(
"2ndFractionPhiOut"))->second->setBinContent(sect,
stat,secondFrac);
392 whME[wh].find(fullName(
"CorrFractionSummaryOut"))->second->setBinContent(sect,
stat,corrSummary);
393 whME[wh].find(fullName(
"2ndFractionSummaryOut"))->second->setBinContent(sect,
stat,secondSummary);
399 if (hwSource==
"DDU") {
400 TH2F * ThetaBXvsQual = getHisto<TH2F>(igetter.
get(getMEName(
"ThetaBXvsQual",
"LocalTriggerTheta", chId)));
401 TH1F * ThetaBestQual = getHisto<TH1F>(igetter.
get(getMEName(
"ThetaBestQual",
"LocalTriggerTheta", chId)));
404 if (ThetaBXvsQual && ThetaBestQual && stat<4 && ThetaBestQual->GetEntries()>1) {
405 TH1D* BXH = ThetaBXvsQual->ProjectionY(
"",4,4,
"");
406 int BXOK_bin = BXH->GetEffectiveEntries()>=1 ? BXH->GetMaximumBin(): 10;
407 double BX_OK = ThetaBXvsQual->GetYaxis()->GetBinCenter(BXOK_bin);
408 double trigs = ThetaBestQual->GetEntries();
409 double trigsH = ThetaBestQual->GetBinContent(4);
412 if( whME[wh].
find(fullName(
"HFractionTheta")) == whME[wh].
end() ){
413 bookWheelHistos(ibooker,wh,
"CorrectBXTheta");
414 bookWheelHistos(ibooker,wh,
"HFractionTheta");
416 std::map<std::string,MonitorElement*> *innerME = &(whME.find(wh)->second);
417 innerME->find(fullName(
"CorrectBXTheta"))->second->setBinContent(sect,
stat,BX_OK+0.00001);
418 innerME->find(fullName(
"HFractionTheta"))->second->setBinContent(sect,
stat,trigsH/trigs);
422 else if (hwSource==
"TM") {
424 TH2F * ThetaPosvsBX = getHisto<TH2F>(igetter.
get(getMEName(
"PositionvsBX",
"LocalTriggerTheta", chId)));
427 if (ThetaPosvsBX && stat<4 && ThetaPosvsBX->GetEntries()>1) {
428 TH1D*
BX = ThetaPosvsBX->ProjectionX();
429 int BXOK_bin = BX->GetEffectiveEntries()>=1 ? BX->GetMaximumBin(): 10;
430 BX_OK = ThetaPosvsBX->GetXaxis()->GetBinCenter(BXOK_bin);
433 if( whME[wh].
find(fullName(
"CorrectBXTheta")) == whME[wh].
end() ){
434 bookWheelHistos(ibooker,wh,
"CorrectBXTheta");
436 std::map<std::string,MonitorElement*> *innerME = &(whME.find(wh)->second);
437 innerME->find(fullName(
"CorrectBXTheta"))->second->setBinContent(sect,
stat,BX_OK+0.00001);
441 TH2F * ThetaBXvsQual = getHisto<TH2F>(igetter.
get(getMEName(
"ThetaBXvsQual",
"LocalTriggerTheta", chId)));
442 TH1F * ThetaBestQual = getHisto<TH1F>(igetter.
get(getMEName(
"ThetaBestQual",
"LocalTriggerTheta", chId)));
443 if (ThetaBXvsQual && ThetaBestQual && stat<4 && ThetaBestQual->GetEntries()>1) {
444 double trigs = ThetaBestQual->GetEntries();
445 double trigsH = ThetaBestQual->GetBinContent(2);
446 if( whME[wh].
find(fullName(
"HFractionTheta")) == whME[wh].
end() ){
447 bookWheelHistos(ibooker,wh,
"HFractionTheta");
449 std::map<std::string,MonitorElement*> *innerME = &(whME.find(wh)->second);
450 innerME->find(fullName(
"HFractionTheta"))->second->setBinContent(sect,
stat,trigsH/trigs);
463 for (vector<string>::const_iterator iTr = trigSources.begin(); iTr != trigSources.end(); ++iTr){
465 for (vector<string>::const_iterator iHw = hwSources.begin(); iHw != hwSources.end(); ++iHw){
467 for (
int wh=-2; wh<=2; ++wh){
468 std::map<std::string,MonitorElement*> *innerME = &(whME[wh]);
469 if(hwSource==
"COM") {
470 TH2F* matchWhSummary = getHisto<TH2F>(innerME->find(fullName(
"MatchingSummary"))->second);
471 for (
int sect=1; sect<=12; ++sect){
475 switch (static_cast<int>(matchWhSummary->GetBinContent(sect,
stat))) {
482 if (matchNoData == 4) matchErr = 5;
483 cmsME.find(fullName(
"MatchingSummary"))->second->setBinContent(sect,wh+wheelArrayShift,matchErr);
488 TH2F* corrWhSummaryIn = getHisto<TH2F>(innerME->find(fullName(
"CorrFractionSummaryIn"))->second);
489 TH2F* secondWhSummaryIn = getHisto<TH2F>(innerME->find(fullName(
"2ndFractionSummaryIn"))->second);
490 for (
int sect=1; sect<=12; ++sect){
494 int secondNoData = 0;
496 switch (static_cast<int>(corrWhSummaryIn->GetBinContent(sect,
stat))) {
502 switch (static_cast<int>(secondWhSummaryIn->GetBinContent(sect,
stat))) {
509 if (corrNoData == 4) corrErr = 5;
510 if (secondNoData == 4) secondErr = 5;
511 cmsME.find(fullName(
"CorrFractionSummaryIn"))->second->setBinContent(sect,wh+wheelArrayShift,corrErr);
512 cmsME.find(fullName(
"2ndFractionSummaryIn"))->second->setBinContent(sect,wh+wheelArrayShift,secondErr);
515 TH2F* corrWhSummaryOut = getHisto<TH2F>(innerME->find(fullName(
"CorrFractionSummaryOut"))->second);
516 TH2F* secondWhSummaryOut = getHisto<TH2F>(innerME->find(fullName(
"2ndFractionSummaryOut"))->second);
517 for (
int sect=1; sect<=12; ++sect){
521 int secondNoData = 0;
523 switch (static_cast<int>(corrWhSummaryOut->GetBinContent(sect,
stat))) {
529 switch (static_cast<int>(secondWhSummaryOut->GetBinContent(sect,
stat))) {
536 if (corrNoData == 4) corrErr = 5;
537 if (secondNoData == 4) secondErr = 5;
538 cmsME.find(fullName(
"CorrFractionSummaryOut"))->second->setBinContent(sect,wh+wheelArrayShift,corrErr);
539 cmsME.find(fullName(
"2ndFractionSummaryOut"))->second->setBinContent(sect,wh+wheelArrayShift,secondErr);
546 fillGlobalSummary(igetter);
552 float glbPerc[5] = { 1., 0.9, 0.6, 0.3, 0.01 };
558 for (
int wh=-2; wh<=2; ++wh) {
559 for (
int sect=1; sect<=12; ++sect) {
562 int corr = cmsME.find(fullName(
"CorrFractionSummaryIn"))->second->getBinContent(sect,wh+wheelArrayShift);
563 int second = cmsME.find(fullName(
"2ndFractionSummaryIn"))->second->getBinContent(sect,wh+wheelArrayShift);
565 MonitorElement * lutsME = igetter.
get(topFolder(hwSource==
"TM") +
"Summaries/TrigLutSummary");
571 <<
"Test]: TM Lut test Summary histo not found." << endl;
573 (corr <5 || second<5) && nSecReadout++;
574 int errcode = ((corr<5 ? corr : 4) + (second<5 ? second : 4) + (lut<5 ? lut : 4) );
575 errcode =
min(
int((errcode/maxErr + 0.01)*5),5);
576 cmsME.find(
"TrigGlbSummary")->second->setBinContent(sect,wh+wheelArrayShift,glbPerc[errcode]);
582 cmsME.find(
"TrigGlbSummary")->second->Reset();
584 string nEvtsName =
"DT/EventInfo/Counters/nProcessedEventsTrigger";
589 cmsME.find(
"TrigGlbSummary")->second->setEntries(nProcEvts < nMinEvts ? 10. : nProcEvts);
591 cmsME.find(
"TrigGlbSummary")->second->setEntries(nMinEvts + 1);
593 <<
"Test]: ME: " << nEvtsName <<
" not found!" << endl;
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 &)
MonitorElement * get(const std::string &path)
~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 &)
double getFloatValue(void) 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.
double getBinContent(int binx) const
get content of bin (1-D)
void runClientDiagnostic(DQMStore::IBooker &, DQMStore::IGetter &) override
Run client analysis.