41 LogDebug(
"HLTInclusiveVBFSource") <<
"constructor....";
48 triggerSummaryToken = consumes<trigger::TriggerEvent>(triggerSummaryLabel_);
50 triggerSummaryFUToken = consumes<trigger::TriggerEvent>(
52 triggerResultsFUToken = consumes<edm::TriggerResults>(
72 check_mjj650_Pt35_DEta3p5 =
false;
73 check_mjj700_Pt35_DEta3p5 =
false;
74 check_mjj750_Pt35_DEta3p5 =
false;
75 check_mjj800_Pt35_DEta3p5 =
false;
76 check_mjj650_Pt40_DEta3p5 =
false;
77 check_mjj700_Pt40_DEta3p5 =
false;
78 check_mjj750_Pt40_DEta3p5 =
false;
79 check_mjj800_Pt40_DEta3p5 =
false;
95 cout <<
"DEBUG-0: Start to analyze" << endl;
106 edm::LogInfo(
"HLTInclusiveVBFSource") <<
"TriggerResults not found, " 116 iEvent.getByToken(triggerSummaryToken, triggerObj_);
117 if (!triggerObj_.isValid()) {
118 iEvent.getByToken(triggerSummaryFUToken, triggerObj_);
119 if (!triggerObj_.isValid()) {
120 edm::LogInfo(
"HLTInclusiveVBFSource") <<
"TriggerEvent not found, " 127 cout <<
"DEBUG-1: Trigger information" << endl;
155 cout <<
"DEBUG-2: AOD Information" << endl;
205 checkOffline =
false;
207 checkHLTIndex =
false;
216 checkdR_sameOrder =
false;
217 checkdR_crossOrder =
false;
220 reco_deltaetajet = 0.;
221 reco_deltaphijet = 0.;
222 reco_invmassjet = 0.;
223 hlt_deltaetajet = 0.;
224 hlt_deltaphijet = 0.;
231 checkOffline =
false;
232 for (
unsigned int ijet1 = 0; ijet1 <
jets.size(); ijet1++) {
235 if (
jets[ijet1].neutralEmEnergyFraction() > 0.99)
237 for (
unsigned int ijet2 = ijet1 + 1; ijet2 <
jets.size(); ijet2++) {
240 if (
jets[ijet2].neutralEmEnergyFraction() > 0.99)
243 reco_ejet1 =
jets[ijet1].energy();
245 reco_pxjet1 =
jets[ijet1].momentum().X();
246 reco_pyjet1 =
jets[ijet1].momentum().Y();
247 reco_pzjet1 =
jets[ijet1].momentum().Z();
248 reco_ptjet1 =
jets[ijet1].pt();
249 reco_etajet1 =
jets[ijet1].eta();
250 reco_phijet1 =
jets[ijet1].phi();
252 reco_ejet2 =
jets[ijet2].energy();
254 reco_pxjet2 =
jets[ijet2].momentum().X();
255 reco_pyjet2 =
jets[ijet2].momentum().Y();
256 reco_pzjet2 =
jets[ijet2].momentum().Z();
257 reco_ptjet2 =
jets[ijet2].pt();
258 reco_etajet2 =
jets[ijet2].eta();
259 reco_phijet2 =
jets[ijet2].phi();
261 reco_deltaetajet = reco_etajet1 - reco_etajet2;
263 reco_invmassjet =
sqrt((reco_ejet1 + reco_ejet2) * (reco_ejet1 + reco_ejet2) -
264 (reco_pxjet1 + reco_pxjet2) * (reco_pxjet1 + reco_pxjet2) -
265 (reco_pyjet1 + reco_pyjet2) * (reco_pyjet1 + reco_pyjet2) -
266 (reco_pzjet1 + reco_pzjet2) * (reco_pzjet1 + reco_pzjet2));
269 if (reco_ptjet1 < minPtHigh_)
271 if (reco_ptjet2 < minPtLow_)
273 if (etaOpposite_ ==
true && reco_etajet1 * reco_etajet2 > 0)
275 if (
std::abs(reco_deltaetajet) < minDeltaEta_)
277 if (
std::abs(reco_invmassjet) < minInvMass_)
282 cout <<
"DEBUG-3" << endl;
286 if (checkOffline ==
true)
289 if (checkOffline ==
false)
297 for (
auto&
v : hltPathsAll_) {
299 checkHLTIndex =
false;
302 v.getMEhisto_RECO_deltaEta_DiJet()->Fill(reco_deltaetajet);
303 v.getMEhisto_RECO_deltaPhi_DiJet()->Fill(reco_deltaphijet);
304 v.getMEhisto_RECO_invMass_DiJet()->Fill(reco_invmassjet);
308 cout <<
"DEBUG-4-0: Path loops" << endl;
311 if (isHLTPathAccepted(
v.getPath()) ==
false)
317 cout <<
"DEBUG-4-1: Path is accepted. Now we are looking for " <<
v.getLabel() <<
" module." << endl;
321 const int hltIndex = triggerObj_->filterIndex(
hltTag);
322 if (hltIndex >= triggerObj_->sizeFilters())
326 cout <<
"DEBUG-4-2: HLT module " <<
v.getLabel() <<
" exists" << endl;
327 const trigger::Keys& khlt = triggerObj_->filterKeys(hltIndex);
328 auto kj = khlt.begin();
329 for (; kj != khlt.end(); kj += 2) {
331 cout <<
"DEBUG-5" << endl;
332 checkdR_sameOrder =
false;
333 checkdR_crossOrder =
false;
334 hlt_ejet1 = toc[*kj].energy();
336 hlt_pxjet1 = toc[*kj].px();
337 hlt_pyjet1 = toc[*kj].py();
338 hlt_pzjet1 = toc[*kj].pz();
339 hlt_ptjet1 = toc[*kj].pt();
340 hlt_etajet1 = toc[*kj].eta();
341 hlt_phijet1 = toc[*kj].phi();
343 hlt_ejet2 = toc[*(kj + 1)].
energy();
345 hlt_pxjet2 = toc[*(kj + 1)].
px();
346 hlt_pyjet2 = toc[*(kj + 1)].
py();
347 hlt_pzjet2 = toc[*(kj + 1)].pz();
348 hlt_ptjet2 = toc[*(kj + 1)].
pt();
349 hlt_etajet2 = toc[*(kj + 1)].
eta();
350 hlt_phijet2 = toc[*(kj + 1)].phi();
352 dR_HLT_RECO_11 =
reco::deltaR(hlt_etajet1, hlt_phijet1, reco_etajet1, reco_phijet1);
353 dR_HLT_RECO_22 =
reco::deltaR(hlt_etajet2, hlt_phijet2, reco_etajet2, reco_phijet2);
354 dR_HLT_RECO_12 =
reco::deltaR(hlt_etajet1, hlt_phijet1, reco_etajet2, reco_phijet2);
355 dR_HLT_RECO_21 =
reco::deltaR(hlt_etajet2, hlt_phijet2, reco_etajet1, reco_phijet1);
356 if (dR_HLT_RECO_11 < deltaRMatch_ && dR_HLT_RECO_22 < deltaRMatch_)
357 checkdR_sameOrder =
true;
358 if (dR_HLT_RECO_12 < deltaRMatch_ && dR_HLT_RECO_21 < deltaRMatch_)
359 checkdR_crossOrder =
true;
360 if (checkdR_sameOrder ==
false && checkdR_crossOrder ==
false)
362 checkHLTIndex =
true;
365 cout <<
"DEBUG-6: Match" << endl;
366 hlt_deltaetajet = hlt_etajet1 - hlt_etajet2;
368 if (checkdR_crossOrder) {
369 hlt_deltaetajet = (-1) * hlt_deltaetajet;
372 hlt_invmassjet =
sqrt((hlt_ejet1 + hlt_ejet2) * (hlt_ejet1 + hlt_ejet2) -
373 (hlt_pxjet1 + hlt_pxjet2) * (hlt_pxjet1 + hlt_pxjet2) -
374 (hlt_pyjet1 + hlt_pyjet2) * (hlt_pyjet1 + hlt_pyjet2) -
375 (hlt_pzjet1 + hlt_pzjet2) * (hlt_pzjet1 + hlt_pzjet2));
376 v.getMEhisto_HLT_deltaEta_DiJet()->Fill(hlt_deltaetajet);
377 v.getMEhisto_HLT_deltaPhi_DiJet()->Fill(hlt_deltaphijet);
378 v.getMEhisto_HLT_invMass_DiJet()->Fill(hlt_invmassjet);
380 v.getMEhisto_RECO_deltaEta_DiJet_Match()->Fill(reco_deltaetajet);
381 v.getMEhisto_RECO_deltaPhi_DiJet_Match()->Fill(reco_deltaphijet);
382 v.getMEhisto_RECO_invMass_DiJet_Match()->Fill(reco_invmassjet);
384 v.getMEhisto_RECOHLT_deltaEta()->Fill(reco_deltaetajet, hlt_deltaetajet);
385 v.getMEhisto_RECOHLT_deltaPhi()->Fill(reco_deltaphijet, hlt_deltaphijet);
386 v.getMEhisto_RECOHLT_invMass()->Fill(reco_invmassjet, hlt_invmassjet);
388 if (checkHLTIndex ==
true)
395 if (checkHLT ==
true && checkHLTIndex ==
true) {
397 cout <<
"DEBUG-7: Match" << endl;
398 v.getMEhisto_NumberOfMatches()->Fill(1);
401 cout <<
"DEBUG-8: Not match" << endl;
402 v.getMEhisto_NumberOfMatches()->Fill(0);
409 for (
auto&
v : hltPathsAll_) {
410 if (isHLTPathAccepted(
v.getPath()) ==
false)
413 cout <<
"DEBUG-9: Loop for rate approximation: " <<
v.getPath() << endl;
414 check_mjj650_Pt35_DEta3p5 =
false;
415 check_mjj700_Pt35_DEta3p5 =
false;
416 check_mjj750_Pt35_DEta3p5 =
false;
417 check_mjj800_Pt35_DEta3p5 =
false;
418 check_mjj650_Pt40_DEta3p5 =
false;
419 check_mjj700_Pt40_DEta3p5 =
false;
420 check_mjj750_Pt40_DEta3p5 =
false;
421 check_mjj800_Pt40_DEta3p5 =
false;
423 const int hltIndex = triggerObj_->filterIndex(
hltTag);
424 if (hltIndex >= triggerObj_->sizeFilters())
426 const trigger::Keys& khlt = triggerObj_->filterKeys(hltIndex);
427 auto kj = khlt.begin();
428 for (; kj != khlt.end(); kj += 2) {
429 checkdR_sameOrder =
false;
430 checkdR_crossOrder =
false;
432 hlt_ejet1 = toc[*kj].energy();
434 hlt_pxjet1 = toc[*kj].px();
435 hlt_pyjet1 = toc[*kj].py();
436 hlt_pzjet1 = toc[*kj].pz();
437 hlt_ptjet1 = toc[*kj].pt();
438 hlt_etajet1 = toc[*kj].eta();
439 hlt_phijet1 = toc[*kj].phi();
441 hlt_ejet2 = toc[*(kj + 1)].
energy();
443 hlt_pxjet2 = toc[*(kj + 1)].
px();
444 hlt_pyjet2 = toc[*(kj + 1)].
py();
445 hlt_pzjet2 = toc[*(kj + 1)].pz();
446 hlt_ptjet2 = toc[*(kj + 1)].
pt();
447 hlt_etajet2 = toc[*(kj + 1)].
eta();
448 hlt_phijet2 = toc[*(kj + 1)].phi();
450 hlt_deltaetajet = hlt_etajet1 - hlt_etajet2;
452 hlt_invmassjet =
sqrt((hlt_ejet1 + hlt_ejet2) * (hlt_ejet1 + hlt_ejet2) -
453 (hlt_pxjet1 + hlt_pxjet2) * (hlt_pxjet1 + hlt_pxjet2) -
454 (hlt_pyjet1 + hlt_pyjet2) * (hlt_pyjet1 + hlt_pyjet2) -
455 (hlt_pzjet1 + hlt_pzjet2) * (hlt_pzjet1 + hlt_pzjet2));
457 if (check_mjj650_Pt35_DEta3p5 ==
false && hlt_ptjet1 > 35. && hlt_ptjet2 >= 35. && hlt_invmassjet > 650 &&
459 check_mjj650_Pt35_DEta3p5 =
true;
461 if (check_mjj700_Pt35_DEta3p5 ==
false && hlt_ptjet1 > 35. && hlt_ptjet2 >= 35. && hlt_invmassjet > 700 &&
463 check_mjj700_Pt35_DEta3p5 =
true;
465 if (check_mjj750_Pt35_DEta3p5 ==
false && hlt_ptjet1 > 35. && hlt_ptjet2 >= 35. && hlt_invmassjet > 750 &&
467 check_mjj750_Pt35_DEta3p5 =
true;
469 if (check_mjj800_Pt35_DEta3p5 ==
false && hlt_ptjet1 > 35. && hlt_ptjet2 >= 35. && hlt_invmassjet > 800 &&
471 check_mjj800_Pt35_DEta3p5 =
true;
473 if (check_mjj650_Pt40_DEta3p5 ==
false && hlt_ptjet1 > 40. && hlt_ptjet2 >= 40. && hlt_invmassjet > 650 &&
475 check_mjj650_Pt40_DEta3p5 =
true;
477 if (check_mjj700_Pt40_DEta3p5 ==
false && hlt_ptjet1 > 40. && hlt_ptjet2 >= 40. && hlt_invmassjet > 700 &&
479 check_mjj700_Pt40_DEta3p5 =
true;
481 if (check_mjj750_Pt40_DEta3p5 ==
false && hlt_ptjet1 > 40. && hlt_ptjet2 >= 40. && hlt_invmassjet > 750 &&
483 check_mjj750_Pt40_DEta3p5 =
true;
485 if (check_mjj800_Pt40_DEta3p5 ==
false && hlt_ptjet1 > 40. && hlt_ptjet2 >= 40. && hlt_invmassjet > 800 &&
487 check_mjj800_Pt40_DEta3p5 =
true;
490 if (check_mjj650_Pt35_DEta3p5 ==
true)
491 v.getMEhisto_NumberOfEvents()->Fill(0);
492 if (check_mjj700_Pt35_DEta3p5 ==
true)
493 v.getMEhisto_NumberOfEvents()->Fill(1);
494 if (check_mjj750_Pt35_DEta3p5 ==
true)
495 v.getMEhisto_NumberOfEvents()->Fill(2);
496 if (check_mjj800_Pt35_DEta3p5 ==
true)
497 v.getMEhisto_NumberOfEvents()->Fill(3);
498 if (check_mjj650_Pt40_DEta3p5 ==
true)
499 v.getMEhisto_NumberOfEvents()->Fill(4);
500 if (check_mjj700_Pt40_DEta3p5 ==
true)
501 v.getMEhisto_NumberOfEvents()->Fill(5);
502 if (check_mjj750_Pt40_DEta3p5 ==
true)
503 v.getMEhisto_NumberOfEvents()->Fill(6);
504 if (check_mjj800_Pt40_DEta3p5 ==
true)
505 v.getMEhisto_NumberOfEvents()->Fill(7);
515 if (!hltConfig_.init(
run,
c, processname_, changed)) {
516 LogDebug(
"HLTInclusiveVBFSource") <<
"HLTConfigProvider failed to initialize.";
519 const unsigned int numberOfPaths(hltConfig_.size());
520 for (
unsigned int i = 0;
i != numberOfPaths; ++
i) {
521 bool numFound =
false;
524 unsigned int usedPrescale = 1;
525 unsigned int objectType = 0;
528 if (
pathname.find(
"HLT_Di") == std::string::npos)
530 if (
pathname.find(
"Jet") == std::string::npos)
532 if (
pathname.find(
"MJJ") == std::string::npos)
534 if (
pathname.find(
"VBF_v") == std::string::npos)
546 for (
unsigned int i = 0;
i != numberOfPaths; ++
i) {
552 if (numFound ==
false)
554 std::vector<std::string> numpathmodules = hltConfig_.moduleLabels(
pathname);
555 auto numpathmodule = numpathmodules.begin();
556 for (; numpathmodule != numpathmodules.end(); ++numpathmodule) {
558 if (hltConfig_.moduleType(*numpathmodule) ==
"HLTCaloJetVBFFilter" ||
559 hltConfig_.moduleType(*numpathmodule) ==
"HLTPFJetVBFFilter") {
562 cout <<
" - Startup:Module = " << hltConfig_.moduleType(*numpathmodule) <<
", FilterName = " <<
filtername 569 if (objectType == 0 || numFound ==
false)
582 for (
auto&
v : hltPathsAll_) {
584 cout <<
"Storing: " <<
v.getPath() <<
", Prescale = " <<
v.getprescaleUsed() << endl;
607 RECO_deltaEta_DiJet = iBooker.
bookFloat(
"RECO_deltaEta_DiJet");
608 RECO_deltaPhi_DiJet = iBooker.
bookFloat(
"RECO_deltaPhi_DiJet");
609 RECO_invMass_DiJet = iBooker.
bookFloat(
"RECO_invMass_DiJet");
610 HLT_deltaEta_DiJet = iBooker.
bookFloat(
"HLT_deltaEta_DiJet");
611 HLT_deltaPhi_DiJet = iBooker.
bookFloat(
"HLT_deltaPhi_DiJet ");
612 HLT_invMass_DiJet = iBooker.
bookFloat(
"HLT_invMass_DiJet");
613 RECO_deltaEta_DiJet_Match = iBooker.
bookFloat(
"RECO_deltaEta_DiJet_Match");
614 RECO_deltaPhi_DiJet_Match = iBooker.
bookFloat(
"RECO_deltaPhi_DiJet_Match");
615 RECO_invMass_DiJet_Match = iBooker.
bookFloat(
"RECO_invMass_DiJet_Match");
616 RECOHLT_deltaEta = iBooker.
bookFloat(
"RECOHLT_deltaEta");
617 RECOHLT_deltaPhi = iBooker.
bookFloat(
"RECOHLT_deltaPhi ");
618 RECOHLT_invMass = iBooker.
bookFloat(
"RECOHLT_invMass");
619 NumberOfMatches = iBooker.
bookFloat(
"NumberOfMatches");
620 NumberOfEvents = iBooker.
bookFloat(
"NumberOfEvents");
627 histoname = labelname +
"_RECO_deltaEta_DiJet";
628 title = labelname +
"_RECO_deltaEta_DiJet " + trigPath;
629 RECO_deltaEta_DiJet = iBooker.
book1D(histoname.c_str(),
title.c_str(), 50, -10., 10.);
630 RECO_deltaEta_DiJet->
getTH1F();
633 histoname = labelname +
"_RECO_deltaPhi_DiJet";
634 title = labelname +
"_RECO_deltaPhi_DiJet " + trigPath;
635 RECO_deltaPhi_DiJet = iBooker.
book1D(histoname.c_str(),
title.c_str(), 35, -3.5, 3.5);
636 RECO_deltaPhi_DiJet->
getTH1F();
639 histoname = labelname +
"_RECO_invMass_DiJet";
640 title = labelname +
"_RECO_invMass_DiJet " + trigPath;
641 RECO_invMass_DiJet = iBooker.
book1D(histoname.c_str(),
title.c_str(), 100, 500., 2000.);
645 histoname = labelname +
"_HLT_deltaEta_DiJet";
646 title = labelname +
"_HLT_deltaEta_DiJet " + trigPath;
647 HLT_deltaEta_DiJet = iBooker.
book1D(histoname.c_str(),
title.c_str(), 50, -10., 10.);
651 histoname = labelname +
"_HLT_deltaPhi_DiJet";
652 title = labelname +
"_HLT_deltaPhi_DiJet " + trigPath;
653 HLT_deltaPhi_DiJet = iBooker.
book1D(histoname.c_str(),
title.c_str(), 35, -3.5, 3.5);
657 histoname = labelname +
"_HLT_invMass_DiJet";
658 title = labelname +
"_HLT_invMass_DiJet " + trigPath;
659 HLT_invMass_DiJet = iBooker.
book1D(histoname.c_str(),
title.c_str(), 100, 500., 2000.);
663 histoname = labelname +
"_RECO_deltaEta_DiJet_Match";
664 title = labelname +
"_RECO_deltaEta_DiJet_Match " + trigPath;
665 RECO_deltaEta_DiJet_Match = iBooker.
book1D(histoname.c_str(),
title.c_str(), 50, -10., 10.);
666 RECO_deltaEta_DiJet_Match->
getTH1F();
669 histoname = labelname +
"_RECO_deltaPhi_DiJet_Match";
670 title = labelname +
"_RECO_deltaPhi_DiJet_Match " + trigPath;
671 RECO_deltaPhi_DiJet_Match = iBooker.
book1D(histoname.c_str(),
title.c_str(), 35, -3.5, 3.5);
672 RECO_deltaPhi_DiJet_Match->
getTH1F();
675 histoname = labelname +
"_RECO_invMass_DiJet_Match";
676 title = labelname +
"_RECO_invMass_DiJet_Match " + trigPath;
677 RECO_invMass_DiJet_Match = iBooker.
book1D(histoname.c_str(),
title.c_str(), 100, 500., 2000.);
678 RECO_invMass_DiJet_Match->
getTH1F();
681 histoname = labelname +
"_RECOHLT_deltaEta";
682 title = labelname +
"_RECOHLT_deltaEta " + trigPath;
683 RECOHLT_deltaEta = iBooker.
book2D(histoname.c_str(),
title.c_str(), 50, -10., 10., 50, -10., 10.);
687 histoname = labelname +
"_RECOHLT_deltaPhi";
688 title = labelname +
"_RECOHLT_deltaPhi " + trigPath;
689 RECOHLT_deltaPhi = iBooker.
book2D(histoname.c_str(),
title.c_str(), 35, -3.5, 3.5, 35, -3.5, 3.5);
693 histoname = labelname +
"_RECOHLT_invMass";
694 title = labelname +
"_RECOHLT_invMass " + trigPath;
695 RECOHLT_invMass = iBooker.
book2D(histoname.c_str(),
title.c_str(), 100, 500., 2000., 100, 500., 2000.);
699 histoname = labelname +
"_NumberOfMatches ";
700 title = labelname +
"_NumberOfMatches " + trigPath;
701 NumberOfMatches = iBooker.
book1D(histoname.c_str(),
title.c_str(), 2, 0., 2.);
705 histoname = labelname +
"_NumberOfEvents";
706 title = labelname +
"_NumberOfEvents " + trigPath;
707 NumberOfEvents = iBooker.
book1D(histoname.c_str(),
title.c_str(), 10, 0., 10.);
711 v.setHistos(RECO_deltaEta_DiJet,
717 RECO_deltaEta_DiJet_Match,
718 RECO_deltaPhi_DiJet_Match,
719 RECO_invMass_DiJet_Match,
731 if (fabs(
eta) <= 1.3)
738 if (fabs(
eta) <= 3.0 && fabs(
eta) > 1.3)
753 for (
unsigned int j = 0;
j != hltConfig_.size(); ++
j) {
754 if (hltConfig_.triggerName(
j) ==
pathname)
775 const int index = triggerObj_->filterIndex(testTag);
776 if (
index >= triggerObj_->sizeFilters()) {
777 edm::LogInfo(
"HLTInclusiveVBFSource") <<
"no index " <<
index <<
" of that name ";
constexpr double deltaPhi(double phi1, double phi2)
T getParameter(std::string const &) const
MonitorElement * bookFloat(TString const &name, FUNC onbooking=NOOP())
virtual void setCurrentFolder(std::string const &fullpath)
virtual bool isForward(double eta)
virtual bool isBarrel(double eta)
virtual bool validPathHLT(std::string path)
~HLTInclusiveVBFSource() override
T getUntrackedParameter(std::string const &, T const &) const
void analyze(const edm::Event &, const edm::EventSetup &) override
HLTInclusiveVBFSource(const edm::ParameterSet &)
Abs< T >::type abs(const T &t)
#define DEFINE_FWK_MODULE(type)
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
Log< level::Info, false > LogInfo
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
std::vector< size_type > Keys
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
virtual bool isTriggerObjectFound(std::string objectName)
virtual bool isHLTPathAccepted(std::string pathName)
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
virtual bool isEndCap(double eta)