46 LogDebug(
"HLTInclusiveVBFSource") <<
"constructor....";
53 triggerSummaryToken = consumes<trigger::TriggerEvent>(triggerSummaryLabel_);
55 triggerSummaryFUToken = consumes<trigger::TriggerEvent>(
57 triggerResultsFUToken = consumes<edm::TriggerResults>(
77 check_mjj650_Pt35_DEta3p5 =
false;
78 check_mjj700_Pt35_DEta3p5 =
false;
79 check_mjj750_Pt35_DEta3p5 =
false;
80 check_mjj800_Pt35_DEta3p5 =
false;
81 check_mjj650_Pt40_DEta3p5 =
false;
82 check_mjj700_Pt40_DEta3p5 =
false;
83 check_mjj750_Pt40_DEta3p5 =
false;
84 check_mjj800_Pt40_DEta3p5 =
false;
100 cout <<
"DEBUG-0: Start to analyze" << endl;
111 edm::LogInfo(
"HLTInclusiveVBFSource") <<
"TriggerResults not found, "
121 iEvent.getByToken(triggerSummaryToken, triggerObj_);
122 if (!triggerObj_.isValid()) {
123 iEvent.getByToken(triggerSummaryFUToken, triggerObj_);
124 if (!triggerObj_.isValid()) {
125 edm::LogInfo(
"HLTInclusiveVBFSource") <<
"TriggerEvent not found, "
132 cout <<
"DEBUG-1: Trigger information" << endl;
160 cout <<
"DEBUG-2: AOD Information" << endl;
167 filtername =
"dummy";
210 checkOffline =
false;
212 checkHLTIndex =
false;
221 checkdR_sameOrder =
false;
222 checkdR_crossOrder =
false;
225 reco_deltaetajet = 0.;
226 reco_deltaphijet = 0.;
227 reco_invmassjet = 0.;
228 hlt_deltaetajet = 0.;
229 hlt_deltaphijet = 0.;
236 checkOffline =
false;
237 for (
unsigned int ijet1 = 0; ijet1 <
jets.size(); ijet1++) {
240 if (
jets[ijet1].neutralEmEnergyFraction() > 0.99)
242 for (
unsigned int ijet2 = ijet1 + 1; ijet2 <
jets.size(); ijet2++) {
245 if (
jets[ijet2].neutralEmEnergyFraction() > 0.99)
248 reco_ejet1 =
jets[ijet1].energy();
250 reco_pxjet1 =
jets[ijet1].momentum().X();
251 reco_pyjet1 =
jets[ijet1].momentum().Y();
252 reco_pzjet1 =
jets[ijet1].momentum().Z();
253 reco_ptjet1 =
jets[ijet1].pt();
254 reco_etajet1 =
jets[ijet1].eta();
255 reco_phijet1 =
jets[ijet1].phi();
257 reco_ejet2 =
jets[ijet2].energy();
259 reco_pxjet2 =
jets[ijet2].momentum().X();
260 reco_pyjet2 =
jets[ijet2].momentum().Y();
261 reco_pzjet2 =
jets[ijet2].momentum().Z();
262 reco_ptjet2 =
jets[ijet2].pt();
263 reco_etajet2 =
jets[ijet2].eta();
264 reco_phijet2 =
jets[ijet2].phi();
266 reco_deltaetajet = reco_etajet1 - reco_etajet2;
268 reco_invmassjet =
sqrt((reco_ejet1 + reco_ejet2) * (reco_ejet1 + reco_ejet2) -
269 (reco_pxjet1 + reco_pxjet2) * (reco_pxjet1 + reco_pxjet2) -
270 (reco_pyjet1 + reco_pyjet2) * (reco_pyjet1 + reco_pyjet2) -
271 (reco_pzjet1 + reco_pzjet2) * (reco_pzjet1 + reco_pzjet2));
274 if (reco_ptjet1 < minPtHigh_)
276 if (reco_ptjet2 < minPtLow_)
278 if (etaOpposite_ ==
true && reco_etajet1 * reco_etajet2 > 0)
280 if (
std::abs(reco_deltaetajet) < minDeltaEta_)
282 if (
std::abs(reco_invmassjet) < minInvMass_)
287 cout <<
"DEBUG-3" << endl;
291 if (checkOffline ==
true)
294 if (checkOffline ==
false)
302 for (
auto&
v : hltPathsAll_) {
304 checkHLTIndex =
false;
307 v.getMEhisto_RECO_deltaEta_DiJet()->Fill(reco_deltaetajet);
308 v.getMEhisto_RECO_deltaPhi_DiJet()->Fill(reco_deltaphijet);
309 v.getMEhisto_RECO_invMass_DiJet()->Fill(reco_invmassjet);
313 cout <<
"DEBUG-4-0: Path loops" << endl;
316 if (isHLTPathAccepted(
v.getPath()) ==
false)
322 cout <<
"DEBUG-4-1: Path is accepted. Now we are looking for " <<
v.getLabel() <<
" module." << endl;
326 const int hltIndex = triggerObj_->filterIndex(
hltTag);
327 if (hltIndex >= triggerObj_->sizeFilters())
331 cout <<
"DEBUG-4-2: HLT module " <<
v.getLabel() <<
" exists" << endl;
332 const trigger::Keys& khlt = triggerObj_->filterKeys(hltIndex);
333 auto kj = khlt.begin();
334 for (; kj != khlt.end(); kj += 2) {
336 cout <<
"DEBUG-5" << endl;
337 checkdR_sameOrder =
false;
338 checkdR_crossOrder =
false;
339 hlt_ejet1 = toc[*kj].energy();
341 hlt_pxjet1 = toc[*kj].px();
342 hlt_pyjet1 = toc[*kj].py();
343 hlt_pzjet1 = toc[*kj].pz();
344 hlt_ptjet1 = toc[*kj].pt();
345 hlt_etajet1 = toc[*kj].eta();
346 hlt_phijet1 = toc[*kj].phi();
348 hlt_ejet2 = toc[*(kj + 1)].
energy();
350 hlt_pxjet2 = toc[*(kj + 1)].
px();
351 hlt_pyjet2 = toc[*(kj + 1)].
py();
352 hlt_pzjet2 = toc[*(kj + 1)].pz();
353 hlt_ptjet2 = toc[*(kj + 1)].
pt();
354 hlt_etajet2 = toc[*(kj + 1)].
eta();
355 hlt_phijet2 = toc[*(kj + 1)].phi();
357 dR_HLT_RECO_11 =
reco::deltaR(hlt_etajet1, hlt_phijet1, reco_etajet1, reco_phijet1);
358 dR_HLT_RECO_22 =
reco::deltaR(hlt_etajet2, hlt_phijet2, reco_etajet2, reco_phijet2);
359 dR_HLT_RECO_12 =
reco::deltaR(hlt_etajet1, hlt_phijet1, reco_etajet2, reco_phijet2);
360 dR_HLT_RECO_21 =
reco::deltaR(hlt_etajet2, hlt_phijet2, reco_etajet1, reco_phijet1);
361 if (dR_HLT_RECO_11 < deltaRMatch_ && dR_HLT_RECO_22 < deltaRMatch_)
362 checkdR_sameOrder =
true;
363 if (dR_HLT_RECO_12 < deltaRMatch_ && dR_HLT_RECO_21 < deltaRMatch_)
364 checkdR_crossOrder =
true;
365 if (checkdR_sameOrder ==
false && checkdR_crossOrder ==
false)
367 checkHLTIndex =
true;
370 cout <<
"DEBUG-6: Match" << endl;
371 hlt_deltaetajet = hlt_etajet1 - hlt_etajet2;
373 if (checkdR_crossOrder) {
374 hlt_deltaetajet = (-1) * hlt_deltaetajet;
377 hlt_invmassjet =
sqrt((hlt_ejet1 + hlt_ejet2) * (hlt_ejet1 + hlt_ejet2) -
378 (hlt_pxjet1 + hlt_pxjet2) * (hlt_pxjet1 + hlt_pxjet2) -
379 (hlt_pyjet1 + hlt_pyjet2) * (hlt_pyjet1 + hlt_pyjet2) -
380 (hlt_pzjet1 + hlt_pzjet2) * (hlt_pzjet1 + hlt_pzjet2));
381 v.getMEhisto_HLT_deltaEta_DiJet()->Fill(hlt_deltaetajet);
382 v.getMEhisto_HLT_deltaPhi_DiJet()->Fill(hlt_deltaphijet);
383 v.getMEhisto_HLT_invMass_DiJet()->Fill(hlt_invmassjet);
385 v.getMEhisto_RECO_deltaEta_DiJet_Match()->Fill(reco_deltaetajet);
386 v.getMEhisto_RECO_deltaPhi_DiJet_Match()->Fill(reco_deltaphijet);
387 v.getMEhisto_RECO_invMass_DiJet_Match()->Fill(reco_invmassjet);
389 v.getMEhisto_RECOHLT_deltaEta()->Fill(reco_deltaetajet, hlt_deltaetajet);
390 v.getMEhisto_RECOHLT_deltaPhi()->Fill(reco_deltaphijet, hlt_deltaphijet);
391 v.getMEhisto_RECOHLT_invMass()->Fill(reco_invmassjet, hlt_invmassjet);
393 if (checkHLTIndex ==
true)
400 if (checkHLT ==
true && checkHLTIndex ==
true) {
402 cout <<
"DEBUG-7: Match" << endl;
403 v.getMEhisto_NumberOfMatches()->Fill(1);
406 cout <<
"DEBUG-8: Not match" << endl;
407 v.getMEhisto_NumberOfMatches()->Fill(0);
414 for (
auto&
v : hltPathsAll_) {
415 if (isHLTPathAccepted(
v.getPath()) ==
false)
418 cout <<
"DEBUG-9: Loop for rate approximation: " <<
v.getPath() << endl;
419 check_mjj650_Pt35_DEta3p5 =
false;
420 check_mjj700_Pt35_DEta3p5 =
false;
421 check_mjj750_Pt35_DEta3p5 =
false;
422 check_mjj800_Pt35_DEta3p5 =
false;
423 check_mjj650_Pt40_DEta3p5 =
false;
424 check_mjj700_Pt40_DEta3p5 =
false;
425 check_mjj750_Pt40_DEta3p5 =
false;
426 check_mjj800_Pt40_DEta3p5 =
false;
428 const int hltIndex = triggerObj_->filterIndex(
hltTag);
429 if (hltIndex >= triggerObj_->sizeFilters())
431 const trigger::Keys& khlt = triggerObj_->filterKeys(hltIndex);
432 auto kj = khlt.begin();
433 for (; kj != khlt.end(); kj += 2) {
434 checkdR_sameOrder =
false;
435 checkdR_crossOrder =
false;
437 hlt_ejet1 = toc[*kj].energy();
439 hlt_pxjet1 = toc[*kj].px();
440 hlt_pyjet1 = toc[*kj].py();
441 hlt_pzjet1 = toc[*kj].pz();
442 hlt_ptjet1 = toc[*kj].pt();
443 hlt_etajet1 = toc[*kj].eta();
444 hlt_phijet1 = toc[*kj].phi();
446 hlt_ejet2 = toc[*(kj + 1)].
energy();
448 hlt_pxjet2 = toc[*(kj + 1)].
px();
449 hlt_pyjet2 = toc[*(kj + 1)].
py();
450 hlt_pzjet2 = toc[*(kj + 1)].pz();
451 hlt_ptjet2 = toc[*(kj + 1)].
pt();
452 hlt_etajet2 = toc[*(kj + 1)].
eta();
453 hlt_phijet2 = toc[*(kj + 1)].phi();
455 hlt_deltaetajet = hlt_etajet1 - hlt_etajet2;
457 hlt_invmassjet =
sqrt((hlt_ejet1 + hlt_ejet2) * (hlt_ejet1 + hlt_ejet2) -
458 (hlt_pxjet1 + hlt_pxjet2) * (hlt_pxjet1 + hlt_pxjet2) -
459 (hlt_pyjet1 + hlt_pyjet2) * (hlt_pyjet1 + hlt_pyjet2) -
460 (hlt_pzjet1 + hlt_pzjet2) * (hlt_pzjet1 + hlt_pzjet2));
462 if (check_mjj650_Pt35_DEta3p5 ==
false && hlt_ptjet1 > 35. && hlt_ptjet2 >= 35. && hlt_invmassjet > 650 &&
464 check_mjj650_Pt35_DEta3p5 =
true;
466 if (check_mjj700_Pt35_DEta3p5 ==
false && hlt_ptjet1 > 35. && hlt_ptjet2 >= 35. && hlt_invmassjet > 700 &&
468 check_mjj700_Pt35_DEta3p5 =
true;
470 if (check_mjj750_Pt35_DEta3p5 ==
false && hlt_ptjet1 > 35. && hlt_ptjet2 >= 35. && hlt_invmassjet > 750 &&
472 check_mjj750_Pt35_DEta3p5 =
true;
474 if (check_mjj800_Pt35_DEta3p5 ==
false && hlt_ptjet1 > 35. && hlt_ptjet2 >= 35. && hlt_invmassjet > 800 &&
476 check_mjj800_Pt35_DEta3p5 =
true;
478 if (check_mjj650_Pt40_DEta3p5 ==
false && hlt_ptjet1 > 40. && hlt_ptjet2 >= 40. && hlt_invmassjet > 650 &&
480 check_mjj650_Pt40_DEta3p5 =
true;
482 if (check_mjj700_Pt40_DEta3p5 ==
false && hlt_ptjet1 > 40. && hlt_ptjet2 >= 40. && hlt_invmassjet > 700 &&
484 check_mjj700_Pt40_DEta3p5 =
true;
486 if (check_mjj750_Pt40_DEta3p5 ==
false && hlt_ptjet1 > 40. && hlt_ptjet2 >= 40. && hlt_invmassjet > 750 &&
488 check_mjj750_Pt40_DEta3p5 =
true;
490 if (check_mjj800_Pt40_DEta3p5 ==
false && hlt_ptjet1 > 40. && hlt_ptjet2 >= 40. && hlt_invmassjet > 800 &&
492 check_mjj800_Pt40_DEta3p5 =
true;
495 if (check_mjj650_Pt35_DEta3p5 ==
true)
496 v.getMEhisto_NumberOfEvents()->Fill(0);
497 if (check_mjj700_Pt35_DEta3p5 ==
true)
498 v.getMEhisto_NumberOfEvents()->Fill(1);
499 if (check_mjj750_Pt35_DEta3p5 ==
true)
500 v.getMEhisto_NumberOfEvents()->Fill(2);
501 if (check_mjj800_Pt35_DEta3p5 ==
true)
502 v.getMEhisto_NumberOfEvents()->Fill(3);
503 if (check_mjj650_Pt40_DEta3p5 ==
true)
504 v.getMEhisto_NumberOfEvents()->Fill(4);
505 if (check_mjj700_Pt40_DEta3p5 ==
true)
506 v.getMEhisto_NumberOfEvents()->Fill(5);
507 if (check_mjj750_Pt40_DEta3p5 ==
true)
508 v.getMEhisto_NumberOfEvents()->Fill(6);
509 if (check_mjj800_Pt40_DEta3p5 ==
true)
510 v.getMEhisto_NumberOfEvents()->Fill(7);
520 if (!hltConfig_.init(
run,
c, processname_, changed)) {
521 LogDebug(
"HLTInclusiveVBFSource") <<
"HLTConfigProvider failed to initialize.";
524 const unsigned int numberOfPaths(hltConfig_.size());
525 for (
unsigned int i = 0;
i != numberOfPaths; ++
i) {
526 bool numFound =
false;
528 filtername =
"dummy";
529 unsigned int usedPrescale = 1;
530 unsigned int objectType = 0;
533 if (
pathname.find(
"HLT_Di") == std::string::npos)
535 if (
pathname.find(
"Jet") == std::string::npos)
537 if (
pathname.find(
"MJJ") == std::string::npos)
539 if (
pathname.find(
"VBF_v") == std::string::npos)
551 for (
unsigned int i = 0;
i != numberOfPaths; ++
i) {
557 if (numFound ==
false)
559 std::vector<std::string> numpathmodules = hltConfig_.moduleLabels(
pathname);
560 auto numpathmodule = numpathmodules.begin();
561 for (; numpathmodule != numpathmodules.end(); ++numpathmodule) {
563 if (hltConfig_.moduleType(*numpathmodule) ==
"HLTCaloJetVBFFilter" ||
564 hltConfig_.moduleType(*numpathmodule) ==
"HLTPFJetVBFFilter") {
565 filtername = *numpathmodule;
567 cout <<
" - Startup:Module = " << hltConfig_.moduleType(*numpathmodule) <<
", FilterName = " << filtername
572 cout <<
" - Startup:Final filter = " << filtername << endl;
574 if (objectType == 0 || numFound ==
false)
587 for (
auto&
v : hltPathsAll_) {
589 cout <<
"Storing: " <<
v.getPath() <<
", Prescale = " <<
v.getprescaleUsed() << endl;
612 RECO_deltaEta_DiJet = iBooker.
bookFloat(
"RECO_deltaEta_DiJet");
613 RECO_deltaPhi_DiJet = iBooker.
bookFloat(
"RECO_deltaPhi_DiJet");
614 RECO_invMass_DiJet = iBooker.
bookFloat(
"RECO_invMass_DiJet");
615 HLT_deltaEta_DiJet = iBooker.
bookFloat(
"HLT_deltaEta_DiJet");
616 HLT_deltaPhi_DiJet = iBooker.
bookFloat(
"HLT_deltaPhi_DiJet ");
617 HLT_invMass_DiJet = iBooker.
bookFloat(
"HLT_invMass_DiJet");
618 RECO_deltaEta_DiJet_Match = iBooker.
bookFloat(
"RECO_deltaEta_DiJet_Match");
619 RECO_deltaPhi_DiJet_Match = iBooker.
bookFloat(
"RECO_deltaPhi_DiJet_Match");
620 RECO_invMass_DiJet_Match = iBooker.
bookFloat(
"RECO_invMass_DiJet_Match");
621 RECOHLT_deltaEta = iBooker.
bookFloat(
"RECOHLT_deltaEta");
622 RECOHLT_deltaPhi = iBooker.
bookFloat(
"RECOHLT_deltaPhi ");
623 RECOHLT_invMass = iBooker.
bookFloat(
"RECOHLT_invMass");
624 NumberOfMatches = iBooker.
bookFloat(
"NumberOfMatches");
625 NumberOfEvents = iBooker.
bookFloat(
"NumberOfEvents");
632 histoname = labelname +
"_RECO_deltaEta_DiJet";
633 title = labelname +
"_RECO_deltaEta_DiJet " + trigPath;
634 RECO_deltaEta_DiJet = iBooker.
book1D(histoname.c_str(),
title.c_str(), 50, -10., 10.);
635 RECO_deltaEta_DiJet->
getTH1F();
638 histoname = labelname +
"_RECO_deltaPhi_DiJet";
639 title = labelname +
"_RECO_deltaPhi_DiJet " + trigPath;
640 RECO_deltaPhi_DiJet = iBooker.
book1D(histoname.c_str(),
title.c_str(), 35, -3.5, 3.5);
641 RECO_deltaPhi_DiJet->
getTH1F();
644 histoname = labelname +
"_RECO_invMass_DiJet";
645 title = labelname +
"_RECO_invMass_DiJet " + trigPath;
646 RECO_invMass_DiJet = iBooker.
book1D(histoname.c_str(),
title.c_str(), 100, 500., 2000.);
650 histoname = labelname +
"_HLT_deltaEta_DiJet";
651 title = labelname +
"_HLT_deltaEta_DiJet " + trigPath;
652 HLT_deltaEta_DiJet = iBooker.
book1D(histoname.c_str(),
title.c_str(), 50, -10., 10.);
656 histoname = labelname +
"_HLT_deltaPhi_DiJet";
657 title = labelname +
"_HLT_deltaPhi_DiJet " + trigPath;
658 HLT_deltaPhi_DiJet = iBooker.
book1D(histoname.c_str(),
title.c_str(), 35, -3.5, 3.5);
662 histoname = labelname +
"_HLT_invMass_DiJet";
663 title = labelname +
"_HLT_invMass_DiJet " + trigPath;
664 HLT_invMass_DiJet = iBooker.
book1D(histoname.c_str(),
title.c_str(), 100, 500., 2000.);
668 histoname = labelname +
"_RECO_deltaEta_DiJet_Match";
669 title = labelname +
"_RECO_deltaEta_DiJet_Match " + trigPath;
670 RECO_deltaEta_DiJet_Match = iBooker.
book1D(histoname.c_str(),
title.c_str(), 50, -10., 10.);
671 RECO_deltaEta_DiJet_Match->
getTH1F();
674 histoname = labelname +
"_RECO_deltaPhi_DiJet_Match";
675 title = labelname +
"_RECO_deltaPhi_DiJet_Match " + trigPath;
676 RECO_deltaPhi_DiJet_Match = iBooker.
book1D(histoname.c_str(),
title.c_str(), 35, -3.5, 3.5);
677 RECO_deltaPhi_DiJet_Match->
getTH1F();
680 histoname = labelname +
"_RECO_invMass_DiJet_Match";
681 title = labelname +
"_RECO_invMass_DiJet_Match " + trigPath;
682 RECO_invMass_DiJet_Match = iBooker.
book1D(histoname.c_str(),
title.c_str(), 100, 500., 2000.);
683 RECO_invMass_DiJet_Match->
getTH1F();
686 histoname = labelname +
"_RECOHLT_deltaEta";
687 title = labelname +
"_RECOHLT_deltaEta " + trigPath;
688 RECOHLT_deltaEta = iBooker.
book2D(histoname.c_str(),
title.c_str(), 50, -10., 10., 50, -10., 10.);
692 histoname = labelname +
"_RECOHLT_deltaPhi";
693 title = labelname +
"_RECOHLT_deltaPhi " + trigPath;
694 RECOHLT_deltaPhi = iBooker.
book2D(histoname.c_str(),
title.c_str(), 35, -3.5, 3.5, 35, -3.5, 3.5);
698 histoname = labelname +
"_RECOHLT_invMass";
699 title = labelname +
"_RECOHLT_invMass " + trigPath;
700 RECOHLT_invMass = iBooker.
book2D(histoname.c_str(),
title.c_str(), 100, 500., 2000., 100, 500., 2000.);
704 histoname = labelname +
"_NumberOfMatches ";
705 title = labelname +
"_NumberOfMatches " + trigPath;
706 NumberOfMatches = iBooker.
book1D(histoname.c_str(),
title.c_str(), 2, 0., 2.);
710 histoname = labelname +
"_NumberOfEvents";
711 title = labelname +
"_NumberOfEvents " + trigPath;
712 NumberOfEvents = iBooker.
book1D(histoname.c_str(),
title.c_str(), 10, 0., 10.);
716 v.setHistos(RECO_deltaEta_DiJet,
722 RECO_deltaEta_DiJet_Match,
723 RECO_deltaPhi_DiJet_Match,
724 RECO_invMass_DiJet_Match,
736 if (fabs(
eta) <= 1.3)
743 if (fabs(
eta) <= 3.0 && fabs(
eta) > 1.3)
758 for (
unsigned int j = 0;
j != hltConfig_.size(); ++
j) {
759 if (hltConfig_.triggerName(
j) ==
pathname)
780 const int index = triggerObj_->filterIndex(testTag);
781 if (
index >= triggerObj_->sizeFilters()) {
782 edm::LogInfo(
"HLTInclusiveVBFSource") <<
"no index " <<
index <<
" of that name ";