14 autoConfMode_ =
pset.getUntrackedParameter<
bool>(
"autoConfMode",
false);
18 verbosity_ =
pset.getUntrackedParameter<
unsigned int>(
"verbosity", 0);
19 genEtaAcc_ =
pset.getParameter<
double>(
"genEtaAcc");
20 genEtAcc_ =
pset.getParameter<
double>(
"genEtAcc");
21 ptMax_ =
pset.getUntrackedParameter<
double>(
"PtMax", 1000.);
22 ptMin_ =
pset.getUntrackedParameter<
double>(
"PtMin", 0.);
23 etaMax_ =
pset.getUntrackedParameter<
double>(
"EtaMax", 2.7);
24 phiMax_ =
pset.getUntrackedParameter<
double>(
"PhiMax", 3.15);
25 nbins_ =
pset.getUntrackedParameter<
unsigned int>(
"Nbins", 40);
26 eta2DMax_ =
pset.getUntrackedParameter<
double>(
"Eta2DMax", 2.8);
27 phi2DMax_ =
pset.getUntrackedParameter<
double>(
"Phi2DMax", 3.2);
28 nbins2D_ =
pset.getUntrackedParameter<
unsigned int>(
"Nbins2D", 16);
29 minEtForEtaEffPlot_ =
pset.getUntrackedParameter<
unsigned int>(
"minEtForEtaEffPlot", 15);
30 useHumanReadableHistTitles_ =
pset.getUntrackedParameter<
bool>(
"useHumanReadableHistTitles",
false);
31 mcMatchedOnly_ =
pset.getUntrackedParameter<
bool>(
"mcMatchedOnly",
true);
32 noPhiPlots_ =
pset.getUntrackedParameter<
bool>(
"noPhiPlots",
true);
33 noIsolationPlots_ =
pset.getUntrackedParameter<
bool>(
"noIsolationPlots",
true);
36 paramSets.push_back(
pset);
39 isData_ =
pset.getParameter<
bool>(
"isData");
49 genParticles_token = consumes<edm::View<reco::Candidate>>(
edm::InputTag(
"genParticles"));
50 triggerObject_token = consumes<trigger::TriggerEventWithRefs>(triggerObject_);
51 hltResults_token = consumes<edm::TriggerResults>(
edm::InputTag(
"TriggerResults",
"", triggerObject_.process()));
53 gencutColl_fidWenu_token = mayConsume<edm::View<reco::Candidate>>(
edm::InputTag(
"fiducialWenu"));
54 gencutColl_fidZee_token = mayConsume<edm::View<reco::Candidate>>(
edm::InputTag(
"fiducialZee"));
55 gencutColl_fidTripleEle_token = mayConsume<edm::View<reco::Candidate>>(
edm::InputTag(
"fiducialTripleEle"));
56 gencutColl_fidGammaJet_token = mayConsume<edm::View<reco::Candidate>>(
edm::InputTag(
"fiducialGammaJet"));
57 gencutColl_fidDiGamma_token = mayConsume<edm::View<reco::Candidate>>(
edm::InputTag(
"fiducialDiGamma"));
59 gencutColl_manualConf_token =
60 consumes<edm::View<reco::Candidate>>(
pset.getParameter<
edm::InputTag>(
"cutcollection"));
66 if (hltConfig_.init(iRun, iSetup, triggerObject_.process(), changed)) {
70 if (verbosity_ >= OUTPUT_ALL) {
74 edm::LogPrint(
"EmDQM") <<
"processName=" << hltConfig_.processName();
75 edm::LogPrint(
"EmDQM") <<
"tableName=" << hltConfig_.tableName();
77 edm::LogInfo(
"EmDQM") <<
"The following filter types are not analyzed: \n" 78 <<
"\tHLTGlobalSumsMET\n" 79 <<
"\tHLTHtMhtFilter\n" 87 <<
"\tPFTauSelector\n" 89 <<
"\tHLTPFJetCollectionsFilter\n" 90 <<
"\tHLTPFJetCollectionsVBFFilter\n" 92 <<
"\tEtMinCaloJetSelector\n" 93 <<
"\tEtMinPFJetSelector\n" 94 <<
"\tLargestEtCaloJetSelector\n" 95 <<
"\tLargestEtPFJetSelector\n" 96 <<
"\tHLTEgammaTriggerFilterObjectWrapper\n" 97 <<
"\tHLTEgammaDoubleLegCombFilter\n" 98 <<
"\tHLT2ElectronTau\n" 99 <<
"\tHLT2ElectronMET\n" 100 <<
"\tHLT2ElectronPFTau\n" 101 <<
"\tHLTPMMassFilter\n" 102 <<
"\tHLTHcalTowerFilter\n" 105 <<
"\tHLTRHemisphere\n" 106 <<
"\tHLTElectronPFMTFilter\n" 107 <<
"\tPrimaryVertexObjectFilter\n" 108 <<
"\tHLTEgammaAllCombMassFilter\n" 124 std::vector<std::string> filterModules;
126 for (
unsigned int j = 0;
j < egammaPaths.size();
j++) {
127 if (verbosity_ >= OUTPUT_ALL) {
129 case TYPE_SINGLE_ELE:
130 edm::LogPrint(
"EmDQM") <<
"////////////////////////////////////////" 131 "/\nSingle electron paths: ";
133 case TYPE_DOUBLE_ELE:
134 edm::LogPrint(
"EmDQM") <<
"////////////////////////////////////////" 135 "/\nDouble electron paths: ";
137 case TYPE_TRIPLE_ELE:
138 edm::LogPrint(
"EmDQM") <<
"////////////////////////////////////////" 139 "/\nTriple electron paths: ";
141 case TYPE_SINGLE_PHOTON:
142 edm::LogPrint(
"EmDQM") <<
"////////////////////////////////////////" 143 "/\nSingle photon paths: ";
145 case TYPE_DOUBLE_PHOTON:
146 edm::LogPrint(
"EmDQM") <<
"////////////////////////////////////////" 147 "/\nDouble photon paths: ";
152 for (
unsigned int i = 0;
i < egammaPaths.at(
j).size();
i++) {
155 if (verbosity_ >= OUTPUT_ALL)
159 filterModules = getFilterModules(
pathName);
174 if (verbosity_ >= OUTPUT_WARNINGS)
176 <<
"': Unable to determine a minimum Et. Will not include " 177 "this path in the validation.";
183 double ptMax = ptMax_;
184 double ptMin = ptMin_;
195 case TYPE_SINGLE_ELE:
201 case TYPE_DOUBLE_ELE:
207 case TYPE_TRIPLE_ELE:
213 case TYPE_SINGLE_PHOTON:
219 case TYPE_DOUBLE_PHOTON:
231 std::vector<edm::ParameterSet> filterVPSet;
236 for (std::vector<std::string>::iterator
filter = filterModules.begin();
filter != filterModules.end();
242 if (moduleType ==
"Pythia6GeneratorFilter" || moduleType ==
"HLTTriggerTypeFilter" ||
243 moduleType ==
"HLTLevel1Activity" || moduleType ==
"HLTPrescaler" || moduleType ==
"HLTBool")
247 if (moduleType ==
"HLTLevel1GTSeed") {
249 }
else if (moduleType ==
"HLTEgammaL1MatchFilterRegional") {
251 }
else if (moduleType ==
"HLTEgammaEtFilter") {
253 }
else if (moduleType ==
"HLTElectronOneOEMinusOneOPFilterRegional") {
255 }
else if (moduleType ==
"HLTElectronPixelMatchFilter") {
257 }
else if (moduleType ==
"HLTEgammaGenericFilter") {
259 }
else if (moduleType ==
"HLTEgammaGenericQuadraticFilter") {
260 filterPSet = makePSetForEgammaGenericQuadraticFilter(
moduleLabel);
261 }
else if (moduleType ==
"HLTElectronGenericFilter") {
263 }
else if (moduleType ==
"HLTEgammaDoubleEtDeltaPhiFilter") {
264 filterPSet = makePSetForEgammaDoubleEtDeltaPhiFilter(
moduleLabel);
265 }
else if (moduleType ==
"HLTGlobalSumsMET" || moduleType ==
"HLTHtMhtFilter" ||
266 moduleType ==
"HLTMhtFilter" || moduleType ==
"HLTJetTag" || moduleType ==
"HLT1CaloJet" ||
267 moduleType ==
"HLT1CaloMET" || moduleType ==
"HLT1CaloBJet" || moduleType ==
"HLT1Tau" ||
268 moduleType ==
"HLT1PFTau" || moduleType ==
"PFTauSelector" || moduleType ==
"HLT1PFJet" ||
269 moduleType ==
"HLTPFJetCollectionsFilter" || moduleType ==
"HLTPFJetCollectionsVBFFilter" ||
270 moduleType ==
"HLTPFJetTag" || moduleType ==
"EtMinCaloJetSelector" ||
271 moduleType ==
"EtMinPFJetSelector" || moduleType ==
"LargestEtCaloJetSelector" ||
272 moduleType ==
"LargestEtPFJetSelector" ||
273 moduleType ==
"HLTEgammaTriggerFilterObjectWrapper" 274 || moduleType ==
"HLTEgammaDoubleLegCombFilter" 277 || moduleType ==
"HLT2ElectronMET" || moduleType ==
"HLT2ElectronTau" ||
278 moduleType ==
"HLT2ElectronPFTau" || moduleType ==
"HLTPMMassFilter" ||
279 moduleType ==
"HLTHcalTowerFilter" || moduleType ==
"HLT1Photon" || moduleType ==
"HLTRFilter" ||
280 moduleType ==
"HLTRHemisphere" || moduleType ==
"HLTElectronPFMTFilter" ||
281 moduleType ==
"PrimaryVertexObjectFilter" || moduleType ==
"HLTEgammaAllCombMassFilter" ||
282 moduleType.find(
"HLTMuon") != std::string::npos)
285 if (verbosity_ >= OUTPUT_WARNINGS)
287 << moduleType <<
"' added. Module will not be analyzed.";
292 if (!filterPSet.
empty()) {
293 if (!hltConfig_.modulePSet(
moduleLabel).exists(
"saveTags")) {
297 if (
moduleLabel.find(
"Unseeded") != std::string::npos &&
298 (
j == TYPE_DOUBLE_PHOTON ||
j == TYPE_SINGLE_PHOTON)) {
307 << paramSet.
getParameter<
int>(
"cutnum") <<
", determined from path name.";
310 edm::LogInfo(
"EmDQM") <<
"Changed required number of candidates from " 317 filterVPSet.push_back(filterPSet);
324 if (!filterPSet.
empty()) {
326 if (!hltConfig_.modulePSet(lastModuleName).exists(
"saveTags")) {
330 if ((
j == TYPE_SINGLE_PHOTON ||
j == TYPE_DOUBLE_PHOTON) &&
pathName.rfind(
"Ele") == std::string::npos) {
334 paramSet.
addParameter<std::vector<edm::ParameterSet>>(
"filters", filterVPSet);
336 if (verbosity_ >= OUTPUT_ALL)
337 edm::LogPrint(
"EmDQM") <<
"Will not include this path in the validation due to " 338 "errors while generating the parameter set.";
345 paramSets.push_back(paramSet);
351 hltCollectionLabelsFoundPerPath.reserve(paramSets.size());
352 hltCollectionLabelsMissedPerPath.reserve(paramSets.size());
357 for (std::vector<edm::ParameterSet>::iterator psetIt = paramSets.begin(); psetIt != paramSets.end(); ++psetIt) {
358 hltCollectionLabelsFoundPerPath.push_back(hltCollectionLabelsFound);
359 hltCollectionLabelsMissedPerPath.push_back(hltCollectionLabelsMissed);
369 if (verbosity_ >= OUTPUT_ERRORS)
370 edm::LogError(
"EmDQM") <<
" HLT config extraction failure with process name '" << triggerObject_.process()
380 for (std::vector<edm::ParameterSet>::iterator psetIt = paramSets.begin(); psetIt != paramSets.end(); ++psetIt) {
381 SetVarsFromPSet(psetIt);
391 std::vector<MonitorElement *> etahist;
392 std::vector<MonitorElement *> phihist;
393 std::vector<MonitorElement *> ethist;
394 std::vector<MonitorElement *> etahistmatch;
395 std::vector<MonitorElement *> phihistmatch;
396 std::vector<MonitorElement *> ethistmatch;
397 std::vector<MonitorElement *> histEtOfHltObjMatchToGen;
398 std::vector<MonitorElement *> histEtaOfHltObjMatchToGen;
399 std::vector<MonitorElement *> histPhiOfHltObjMatchToGen;
400 std::vector<MonitorElement *> etaphihist;
401 std::vector<MonitorElement *> etaphihistmatch;
402 std::vector<MonitorElement *> histEtaPhiOfHltObjMatchToGen;
414 if (!mcMatchedOnly_) {
418 histName.c_str(),
histTitle.c_str(), numOfHLTCollectionLabels + 2, 0, numOfHLTCollectionLabels + 2);
419 total->setBinLabel(numOfHLTCollectionLabels + 1,
"Total");
420 total->setBinLabel(numOfHLTCollectionLabels + 2,
"Gen");
421 for (
unsigned int u = 0; u < numOfHLTCollectionLabels; u++) {
426 histName =
"total_eff_MC_matched";
427 histTitle =
"total events passing (mc matched)";
428 totalmatch = iBooker.
book1D(
429 histName.c_str(),
histTitle.c_str(), numOfHLTCollectionLabels + 2, 0, numOfHLTCollectionLabels + 2);
430 totalmatch->
setBinLabel(numOfHLTCollectionLabels + 1,
"Total");
431 totalmatch->
setBinLabel(numOfHLTCollectionLabels + 2,
"Gen");
432 for (
unsigned int u = 0; u < numOfHLTCollectionLabels; u++) {
445 pdgIdString =
"Electron";
448 pdgIdString =
"Photon";
451 pdgIdString =
"Particle";
455 histTitle =
"E_{T} of " + pdgIdString +
"s";
456 etgen = iBooker.
book1D(histName.c_str(),
histTitle.c_str(), nbins_, plotPtMin, plotPtMax);
457 histName =
"gen_eta";
458 histTitle =
"#eta of " + pdgIdString +
"s ";
459 etagen = iBooker.
book1D(histName.c_str(),
histTitle.c_str(), nbins_, -etaMax_, etaMax_);
460 histName =
"gen_phi";
461 histTitle =
"#phi of " + pdgIdString +
"s ";
463 phigen = iBooker.
book1D(histName.c_str(),
histTitle.c_str(), nbins_, -phiMax_, phiMax_);
464 histName =
"gen_etaphi";
465 histTitle =
"#eta-#phi of " + pdgIdString +
"s ";
466 etaphigen = iBooker.
book2D(
467 histName.c_str(),
histTitle.c_str(), nbins2D_ - 2, -eta2DMax_, eta2DMax_, nbins2D_, -phi2DMax_, phi2DMax_);
472 std::vector<std::string> HltHistTitle;
473 if (theHLTCollectionHumanNames.size() == numOfHLTCollectionLabels && useHumanReadableHistTitles_) {
474 HltHistTitle = theHLTCollectionHumanNames;
476 for (
unsigned int i = 0;
i < numOfHLTCollectionLabels;
i++) {
481 for (
unsigned int i = 0;
i < numOfHLTCollectionLabels;
i++) {
482 if (!mcMatchedOnly_) {
486 tmphisto = iBooker.
book1D(histName.c_str(),
histTitle.c_str(), nbins_, plotPtMin, plotPtMax);
487 ethist.push_back(tmphisto);
492 tmphisto = iBooker.
book1D(histName.c_str(),
histTitle.c_str(), nbins_, -etaMax_, etaMax_);
493 etahist.push_back(tmphisto);
499 tmphisto = iBooker.
book1D(histName.c_str(),
histTitle.c_str(), nbins_, -phiMax_, phiMax_);
500 phihist.push_back(tmphisto);
504 histTitle = HltHistTitle[
i] +
" #eta-#phi (ALL)";
505 tmphisto = iBooker.
book2D(
506 histName.c_str(),
histTitle.c_str(), nbins2D_ - 2, -eta2DMax_, eta2DMax_, nbins2D_, -phi2DMax_, phi2DMax_);
507 etaphihist.push_back(tmphisto);
513 tmphisto = iBooker.
book1D(histName.c_str(),
histTitle.c_str(), nbins_, plotPtMin, plotPtMax);
514 histEtOfHltObjMatchToGen.push_back(tmphisto);
520 tmphisto = iBooker.
book1D(histName.c_str(),
histTitle.c_str(), nbins_, -etaMax_, etaMax_);
521 histEtaOfHltObjMatchToGen.push_back(tmphisto);
528 tmphisto = iBooker.
book1D(histName.c_str(),
histTitle.c_str(), nbins_, -phiMax_, phiMax_);
529 histPhiOfHltObjMatchToGen.push_back(tmphisto);
534 tmphisto = iBooker.
book2D(
535 histName.c_str(),
histTitle.c_str(), nbins2D_ - 2, -eta2DMax_, eta2DMax_, nbins2D_, -phi2DMax_, phi2DMax_);
536 histEtaPhiOfHltObjMatchToGen.push_back(tmphisto);
541 histTitle = HltHistTitle[
i] +
" Et (MC matched)";
542 tmphisto = iBooker.
book1D(histName.c_str(),
histTitle.c_str(), nbins_, plotPtMin, plotPtMax);
543 ethistmatch.push_back(tmphisto);
547 histTitle = HltHistTitle[
i] +
" #eta (MC matched)";
548 tmphisto = iBooker.
book1D(histName.c_str(),
histTitle.c_str(), nbins_, -etaMax_, etaMax_);
549 etahistmatch.push_back(tmphisto);
554 histTitle = HltHistTitle[
i] +
" #phi (MC matched)";
555 tmphisto = iBooker.
book1D(histName.c_str(),
histTitle.c_str(), nbins_, -phiMax_, phiMax_);
556 phihistmatch.push_back(tmphisto);
560 histTitle = HltHistTitle[
i] +
" #eta-#phi (MC matched)";
561 tmphisto = iBooker.
book2D(
562 histName.c_str(),
histTitle.c_str(), nbins2D_ - 2, -eta2DMax_, eta2DMax_, nbins2D_, -phi2DMax_, phi2DMax_);
563 etaphihistmatch.push_back(tmphisto);
567 etahists.push_back(etahist);
568 phihists.push_back(phihist);
569 ethists.push_back(ethist);
570 etahistmatchs.push_back(etahistmatch);
571 phihistmatchs.push_back(phihistmatch);
572 ethistmatchs.push_back(ethistmatch);
573 histEtOfHltObjMatchToGens.push_back(histEtOfHltObjMatchToGen);
574 histEtaOfHltObjMatchToGens.push_back(histEtaOfHltObjMatchToGen);
575 histPhiOfHltObjMatchToGens.push_back(histPhiOfHltObjMatchToGen);
576 etaphihists.push_back(etaphihist);
577 etaphihistmatchs.push_back(etaphihistmatch);
578 histEtaPhiOfHltObjMatchToGens.push_back(histEtaPhiOfHltObjMatchToGen);
591 totals.push_back(
total);
592 totalmatchs.push_back(totalmatch);
593 etgens.push_back(etgen);
594 etagens.push_back(etagen);
595 phigens.push_back(phigen);
596 etaphigens.push_back(etaphigen);
615 if (verbosity_ >= OUTPUT_WARNINGS)
620 std::vector<reco::LeafCandidate> allSortedGenParticles;
624 currentGenParticle++) {
628 if (!(
abs((*currentGenParticle).pdgId()) ==
pdgGen && (*currentGenParticle).status() == 1 &&
629 (*currentGenParticle).et() > 2.0))
634 if (tmpcand.
et() < plotEtMin)
637 allSortedGenParticles.push_back(tmpcand);
640 std::sort(allSortedGenParticles.begin(), allSortedGenParticles.end(), pTGenComparator_);
643 if (allSortedGenParticles.size() < gencut_)
653 for (
unsigned int i = 0;
i < gencut_;
i++) {
654 bool inECALgap = fabs(allSortedGenParticles[
i].
eta()) > 1.4442 && fabs(allSortedGenParticles[
i].
eta()) < 1.556;
655 if ((fabs(allSortedGenParticles[
i].
eta()) > genEtaAcc_) || inECALgap) {
680 event.getByToken(gencutColl_fidWenu_token, referenceParticles);
682 event.getByToken(gencutColl_fidGammaJet_token, referenceParticles);
686 event.getByToken(gencutColl_fidZee_token, referenceParticles);
688 event.getByToken(gencutColl_fidDiGamma_token, referenceParticles);
691 event.getByToken(gencutColl_fidTripleEle_token, referenceParticles);
695 event.getByToken(gencutColl_manualConf_token, referenceParticles);
697 if (!referenceParticles.
isValid()) {
698 if (verbosity_ >= OUTPUT_WARNINGS)
703 std::vector<const reco::Candidate *> allSortedReferenceParticles;
706 currentReferenceParticle != referenceParticles->end();
707 currentReferenceParticle++) {
708 if (currentReferenceParticle->et() <= 2.0)
716 if (currentReferenceParticle->et() < plotEtMin)
720 allSortedReferenceParticles.push_back(&(*currentReferenceParticle));
727 return allSortedReferenceParticles.size() >= gencut_;
735 unsigned int vPos = 0;
736 for (std::vector<edm::ParameterSet>::iterator psetIt = paramSets.begin(); psetIt != paramSets.end();
738 SetVarsFromPSet(psetIt);
740 hltCollectionLabelsFound = hltCollectionLabelsFoundPerPath.at(vPos);
741 hltCollectionLabelsMissed = hltCollectionLabelsMissedPerPath.at(vPos);
753 event.getByToken(gencutColl_fidWenu_token, cutCounter);
755 event.getByToken(gencutColl_fidGammaJet_token, cutCounter);
759 event.getByToken(gencutColl_fidZee_token, cutCounter);
761 event.getByToken(gencutColl_fidDiGamma_token, cutCounter);
764 event.getByToken(gencutColl_fidTripleEle_token, cutCounter);
768 event.getByToken(gencutColl_manualConf_token, cutCounter);
770 if (cutCounter->size() < (
unsigned int)gencut_) {
779 event.getByToken(triggerObject_token, triggerObj);
781 if (verbosity_ >= OUTPUT_WARNINGS)
782 edm::LogWarning(
"EmDQM") <<
"parameter triggerobject (" << triggerObject_
783 <<
") does not corresond to a valid TriggerEventWithRefs product. " 784 "Please check especially the process name (e.g. when running " 785 "over reprocessed datasets)";
790 if (
event.isRealData()) {
796 if (!checkRecoParticlesRequirement(
event))
800 if (!checkGeneratedParticlesRequirement(
event))
811 totals.at(vPos)->Fill(numOfHLTCollectionLabels + 0.5);
812 totalmatchs.at(vPos)->Fill(numOfHLTCollectionLabels + 0.5);
820 std::vector<reco::Particle> sortedGen;
823 reco::Particle tmpcand(genpart->charge(), genpart->p4(), genpart->vertex(), genpart->pdgId(), genpart->status());
824 if (tmpcand.et() >= plotEtMin) {
825 sortedGen.push_back(tmpcand);
828 std::sort(sortedGen.begin(), sortedGen.end(), pTComparator_);
833 if (sortedGen.size() < gencut_) {
836 sortedGen.erase(sortedGen.begin() + gencut_, sortedGen.end());
838 for (
unsigned int i = 0;
i < gencut_;
i++) {
839 etgens.at(vPos)->Fill(sortedGen[
i].
et());
841 if (sortedGen[
i].
et() > minEtForEtaEffPlot_) {
842 etagens.at(vPos)->Fill(sortedGen[
i].
eta());
844 phigens.at(vPos)->Fill(sortedGen[
i].
phi());
845 etaphigens.at(vPos)->Fill(sortedGen[
i].
eta(), sortedGen[
i].
phi());
848 if (gencut_ >=
reqNum && !mcMatchedOnly_)
849 totals.at(vPos)->Fill(numOfHLTCollectionLabels +
852 totalmatchs.at(vPos)->Fill(numOfHLTCollectionLabels +
855 bool accepted =
true;
857 event.getByToken(hltResults_token,
hltResults);
861 for (
unsigned int n = 0;
n < numOfHLTCollectionLabels;
n++) {
864 if (sortedGen.size() < nCandCuts.at(
n)) {
865 if (verbosity_ >= OUTPUT_ERRORS)
866 edm::LogError(
"EmDQM") <<
"There are less generated particles than the module '" 870 std::vector<reco::Particle> sortedGenForFilter(sortedGen);
871 sortedGenForFilter.erase(sortedGenForFilter.begin() + nCandCuts.at(
n), sortedGenForFilter.end());
874 if (pathIndex != 0 &&
881 histoFillerL1NonIso->fillHistos(triggerObj,
event, vPos,
n, sortedGenForFilter, accepted);
884 histoFillerL1Iso->fillHistos(triggerObj,
event, vPos,
n, sortedGenForFilter, accepted);
887 histoFillerPho->fillHistos(triggerObj,
event, vPos,
n, sortedGenForFilter, accepted);
890 histoFillerEle->fillHistos(triggerObj,
event, vPos,
n, sortedGenForFilter, accepted);
893 histoFillerClu->fillHistos(triggerObj,
event, vPos,
n, sortedGenForFilter, accepted);
896 throw(
cms::Exception(
"Release Validation Error") <<
"HLT output type not implemented: theHLTOutputTypes[n]");
901 hltCollectionLabelsFoundPerPath.at(vPos) = hltCollectionLabelsFound;
902 hltCollectionLabelsMissedPerPath.at(vPos) = hltCollectionLabelsMissed;
915 std::vector<reco::Particle> &sortedGen,
917 std::vector<edm::Ref<T>> recoecalcands;
919 dqm->hltCollectionLabelsMissed.insert(
dqm->theHLTCollectionLabels[
n].encode());
924 dqm->hltCollectionLabelsFound.insert(
dqm->theHLTCollectionLabels[
n].encode());
930 triggerObj->
filterIndex(
dqm->theHLTCollectionLabels[
n]),
dqm->theHLTOutputTypes[
n], recoecalcands);
934 std::vector<edm::Ref<T>> isocands;
936 if (!isocands.empty()) {
937 for (
unsigned int i = 0;
i < isocands.size();
i++)
938 recoecalcands.push_back(isocands[
i]);
942 if (recoecalcands.empty()) {
948 if (recoecalcands.size() >=
dqm->nCandCuts.at(
n) && !
dqm->mcMatchedOnly_)
949 dqm->totals.at(vPos)->Fill(
n + 0.5);
955 for (
unsigned int j = 0;
j < recoecalcands.size();
j++) {
956 if (!(recoecalcands.at(
j).isAvailable())) {
957 if (
dqm->verbosity_ >=
dqm->OUTPUT_ERRORS)
958 edm::LogError(
"EmDQMInvalidRefs") <<
"Event content inconsistent: TriggerEventWithRefs contains " 959 "invalid Refs. Invalid refs for: " 960 <<
dqm->theHLTCollectionLabels[
n].label()
961 <<
". The collection that this module uses may has been dropped in " 967 if (!
dqm->mcMatchedOnly_) {
973 for (
unsigned int i = 0;
i <
dqm->nCandCuts.at(
n);
i++) {
976 float closestDeltaR = 0.5;
977 int closestEcalCandIndex = -1;
978 for (
unsigned int j = 0;
j < recoecalcands.size();
j++) {
979 float deltaR =
DeltaR(recoecalcands[
j]->momentum(), currentGenParticleMomentum);
981 if (
deltaR < closestDeltaR) {
983 closestEcalCandIndex =
j;
989 if (closestEcalCandIndex >= 0) {
990 dqm->histEtOfHltObjMatchToGens.at(vPos).at(
n)->Fill(recoecalcands[closestEcalCandIndex]->
et());
991 dqm->histEtaOfHltObjMatchToGens.at(vPos).at(
n)->Fill(recoecalcands[closestEcalCandIndex]->
eta());
992 if (!
dqm->noPhiPlots_)
993 dqm->histPhiOfHltObjMatchToGens.at(vPos).at(
n)->Fill(recoecalcands[closestEcalCandIndex]->
phi());
994 dqm->histEtaPhiOfHltObjMatchToGens.at(vPos).at(
n)->Fill(recoecalcands[closestEcalCandIndex]->
eta(),
995 recoecalcands[closestEcalCandIndex]->
phi());
1005 for (
unsigned int i = 0;
i < recoecalcands.size();
i++) {
1025 dqm->ethists.at(vPos).at(
n)->Fill(recoecalcands[
i]->
et());
1026 dqm->etahists.at(vPos).at(
n)->Fill(recoecalcands[
i]->
eta());
1027 if (!
dqm->noPhiPlots_)
1028 dqm->phihists.at(vPos).at(
n)->Fill(recoecalcands[
i]->
phi());
1029 dqm->etaphihists.at(vPos).at(
n)->Fill(recoecalcands[
i]->
eta(), recoecalcands[
i]->
phi());
1036 unsigned int matchedMcParts = 0;
1037 float mindist = 0.3;
1040 for (
unsigned int i = 0;
i <
dqm->nCandCuts.at(
n); ++
i) {
1042 bool matchThis =
false;
1045 double closestDr = 1000.;
1046 for (
unsigned int trigOb = 0; trigOb < recoecalcands.size(); ++trigOb) {
1047 double dr =
DeltaR(recoecalcands[trigOb]->momentum(), candDir);
1048 if (
dr < closestDr) {
1052 if (closestDr > mindist) {
1064 dqm->ethistmatchs.at(vPos).at(
n)->Fill(sortedGen[
i].
et());
1065 if (sortedGen[
i].
et() >
dqm->minEtForEtaEffPlot_) {
1066 dqm->etahistmatchs.at(vPos).at(
n)->Fill(sortedGen[
i].
eta());
1067 if (!
dqm->noPhiPlots_)
1068 dqm->phihistmatchs.at(vPos).at(
n)->Fill(sortedGen[
i].
phi());
1069 dqm->etaphihistmatchs.at(vPos).at(
n)->Fill(sortedGen[
i].
eta(), sortedGen[
i].
phi());
1074 if (matchedMcParts >=
dqm->nCandCuts.at(
n) && accepted ==
true)
1075 dqm->totalmatchs.at(vPos)->Fill(
n + 0.5);
1080 unsigned int vPos = 0;
1081 for (std::vector<edm::ParameterSet>::iterator psetIt = paramSets.begin(); psetIt != paramSets.end();
1083 SetVarsFromPSet(psetIt);
1089 std::vector<std::string> labelsNeverFound;
1091 for (
const auto &
tag : hltCollectionLabelsMissedPerPath.at(vPos)) {
1093 if ((hltCollectionLabelsFoundPerPath.at(vPos)).
count(
atag.encode()) == 0)
1095 labelsNeverFound.push_back(
atag.encode());
1099 if (labelsNeverFound.empty())
1102 std::sort(labelsNeverFound.begin(), labelsNeverFound.end());
1107 if (verbosity_ >= OUTPUT_WARNINGS)
1108 edm::LogWarning(
"EmDQM") <<
"There were some HLTCollectionLabels which were never found:";
1110 for (
auto const &
tag : labelsNeverFound) {
1111 if (verbosity_ >= OUTPUT_ALL)
1119 if (sub.length() == 0)
1131 std::vector<std::vector<std::string>>
Paths(5);
1133 for (
unsigned int i = 0;
i < hltConfig_.size();
i++) {
1137 if (
int(
path.find(
"HLT_")) == 0) {
1139 int scCount = countSubstring(
path,
"_SC");
1140 int eleCount = countSubstring(
path,
"Ele");
1141 int doubleEleCount = countSubstring(
path,
"DoubleEle");
1142 int doubleSCCount = countSubstring(
path,
"DiSC");
1143 int tripleEleCount = countSubstring(
path,
"TripleEle");
1144 int photonCount = countSubstring(
path,
"hoton");
1145 int doublePhotonCount = countSubstring(
path,
"DoublePhoton") + countSubstring(
path,
"Diphoton");
1147 int totEleCount = 2 * tripleEleCount + doubleEleCount + eleCount + scCount + 2 * doubleSCCount;
1148 int totPhotonCount = doublePhotonCount + photonCount;
1150 if (totEleCount + totPhotonCount < 1)
1152 switch (totEleCount) {
1167 switch (totPhotonCount) {
1169 Paths[TYPE_SINGLE_PHOTON].push_back(
path);
1173 Paths[TYPE_DOUBLE_PHOTON].push_back(
path);
1187 std::vector<std::string>
filters;
1192 for (
unsigned int i = 0;
i < hltConfig_.size(
path);
i++) {
1198 if (moduleEDMType ==
"EDFilter" ||
1199 moduleType.find(
"Filter") != std::string::npos) {
1214 boost::regex reg(
"^HLT_.*?(Ele|hoton|EG|SC)([[:digit:]]+).*");
1217 if (boost::regex_match(
path, what, reg, boost::match_extra)) {
1218 minEt = std::stod(what[2]);
1233 retPSet.
addParameter<std::vector<double>>(
"PlotBounds", std::vector<double>(2, 0.0));
1237 retPSet.
addParameter<std::vector<edm::InputTag>>(
"IsoCollections",
1238 std::vector<edm::InputTag>(1,
std::string(
"none")));
1245 int egCount = countSubstring(
moduleName,
"EG");
1246 int dEgCount = countSubstring(
moduleName,
"DoubleEG");
1247 int tEgCount = countSubstring(
moduleName,
"TripleEG");
1249 int candCount = 2 * tEgCount + dEgCount + egCount;
1253 if (orCount > 0 && candCount > 0) {
1254 if (egCount % (orCount + 1) == 0 && dEgCount % (orCount + 1) == 0 && tEgCount % (orCount + 1) == 0)
1255 candCount /= (orCount + 1);
1256 else if (egCount - dEgCount - tEgCount > 0)
1258 else if (dEgCount > 0)
1260 else if (tEgCount > 0)
1266 switch (candCount) {
1297 retPSet.
addParameter<std::vector<double>>(
"PlotBounds", std::vector<double>(2, 0.0));
1301 retPSet.
addParameter<std::vector<edm::InputTag>>(
"IsoCollections",
1302 std::vector<edm::InputTag>(1,
std::string(
"none")));
1314 retPSet.
addParameter<std::vector<double>>(
"PlotBounds", std::vector<double>(2, 0.0));
1318 retPSet.
addParameter<std::vector<edm::InputTag>>(
"IsoCollections",
1319 std::vector<edm::InputTag>(1,
std::string(
"none")));
1331 retPSet.
addParameter<std::vector<double>>(
"PlotBounds", std::vector<double>(2, 0.0));
1335 retPSet.
addParameter<std::vector<edm::InputTag>>(
"IsoCollections",
1336 std::vector<edm::InputTag>(1,
std::string(
"none")));
1348 retPSet.
addParameter<std::vector<double>>(
"PlotBounds", std::vector<double>(2, 0.0));
1352 retPSet.
addParameter<std::vector<edm::InputTag>>(
"IsoCollections",
1353 std::vector<edm::InputTag>(1,
std::string(
"none")));
1365 retPSet.
addParameter<std::vector<double>>(
"PlotBounds", std::vector<double>(2, 0.0));
1369 retPSet.
addParameter<std::vector<edm::InputTag>>(
"IsoCollections",
1370 std::vector<edm::InputTag>(1,
std::string(
"none")));
1428 std::vector<edm::InputTag> isoCollections;
1429 isoCollections.push_back(
varTag);
1437 if (inputType ==
"EgammaHLTR9IDProducer" ||
1438 inputType ==
"EgammaHLTClusterShapeProducer" ||
1439 inputType ==
"EgammaHLTGsfTrackVarProducer" ||
1440 inputType ==
"EgammaHLTBcHcalIsolationProducersRegional" ||
1441 inputType ==
"EgammaHLTHcalVarProducerFromRecHit" ||
1442 inputType ==
"EgammaHLTEcalPFClusterIsolationProducer" ||
1443 inputType ==
"EgammaHLTHcalPFClusterIsolationProducer" ||
1444 inputType ==
"EgammaHLTElectronTrackIsolationProducers" 1446 retPSet.
addParameter<std::vector<double>>(
"PlotBounds", std::vector<double>(2, 0.0));
1450 retPSet.
addParameter<std::vector<edm::InputTag>>(
"IsoCollections", isoCollections);
1456 if (verbosity_ >= OUTPUT_ERRORS)
1458 <<
"' should do: uses a collection produced by a module of C++ type '" << inputType <<
"'.";
1512 std::vector<edm::InputTag> isoCollections;
1513 isoCollections.push_back(
varTag);
1521 if (inputType ==
"EgammaHLTR9IDProducer" ||
1522 inputType ==
"EgammaHLTClusterShapeProducer" ||
1523 inputType ==
"EgammaHLTBcHcalIsolationProducersRegional" ||
1524 inputType ==
"EgammaHLTHcalVarProducerFromRecHit" ||
1525 inputType ==
"EgammaHLTEcalPFClusterIsolationProducer" ||
1526 inputType ==
"EgammaHLTHcalPFClusterIsolationProducer" ||
1527 inputType ==
"EgammaHLTPhotonTrackIsolationProducersRegional" 1529 retPSet.
addParameter<std::vector<double>>(
"PlotBounds", std::vector<double>(2, 0.0));
1533 retPSet.
addParameter<std::vector<edm::InputTag>>(
"IsoCollections", isoCollections);
1539 if (verbosity_ >= OUTPUT_ERRORS)
1541 <<
"' should do: uses a collection produced by a module of C++ type '" << inputType <<
"'.";
1590 std::vector<edm::InputTag> isoCollections;
1591 isoCollections.push_back(
varTag);
1601 if (inputType ==
"EgammaHLTElectronTrackIsolationProducers" 1603 retPSet.
addParameter<std::vector<double>>(
"PlotBounds", std::vector<double>(2, 0.0));
1607 retPSet.
addParameter<std::vector<edm::InputTag>>(
"IsoCollections", isoCollections);
1613 if (verbosity_ >= OUTPUT_ERRORS)
1615 <<
"' should do: uses a collection produced by a module of C++ type '" << inputType <<
"'.";
1622 dirname_ =
"HLT/HLTEgammaValidation/" + psetIt->getParameter<
std::string>(
"@module_label");
1624 pathIndex = psetIt->getUntrackedParameter<
unsigned int>(
"pathIndex", 0);
1626 reqNum = psetIt->getParameter<
unsigned int>(
"reqNum");
1627 pdgGen = psetIt->getParameter<
int>(
"pdgGen");
1629 plotEtMin = psetIt->getUntrackedParameter<
double>(
"genEtMin", 0.);
1630 plotPtMin = psetIt->getUntrackedParameter<
double>(
"PtMin", 0.);
1631 plotPtMax = psetIt->getUntrackedParameter<
double>(
"PtMax", 1000.);
1634 gencutCollection_ = psetIt->getParameter<
edm::InputTag>(
"cutcollection");
1635 gencut_ = psetIt->getParameter<
int>(
"cutnum");
1641 std::vector<edm::ParameterSet>
filters = psetIt->getParameter<std::vector<edm::ParameterSet>>(
"filters");
1646 theHLTCollectionHumanNames.clear();
1653 for (std::vector<edm::ParameterSet>::iterator filterconf =
filters.begin(); filterconf !=
filters.end();
1656 theHLTOutputTypes.push_back(filterconf->getParameter<
int>(
"theHLTOutputTypes"));
1659 theHLTCollectionHumanNames.push_back(
1662 std::vector<double>
bounds = filterconf->getParameter<std::vector<double>>(
"PlotBounds");
1665 plotBounds.push_back(std::pair<double, double>(
bounds[0],
bounds[1]));
1666 isoNames.push_back(filterconf->getParameter<std::vector<edm::InputTag>>(
"IsoCollections"));
1692 assert(!isoNames.back().empty());
1693 if (isoNames.back().at(0).label() ==
"none") {
1694 plotiso.push_back(
false);
1696 if (!noIsolationPlots_)
1697 plotiso.push_back(
true);
1699 plotiso.push_back(
false);
1701 nCandCuts.push_back(filterconf->getParameter<
int>(
"ncandcut"));
edm::ParameterSet makePSetForEgammaGenericFilter(const std::string &)
~EmDQM() override
Destructor.
constexpr int32_t ceil(float num)
edm::ParameterSet makePSetForEgammaGenericQuadraticFilter(const std::string &)
T getParameter(std::string const &) const
void fillHistos(edm::Handle< trigger::TriggerEventWithRefs > &, const edm::Event &, unsigned int, unsigned int, std::vector< reco::Particle > &, bool &)
std::vector< std::vector< std::string > > findEgammaPaths()
bool checkRecoParticlesRequirement(const edm::Event &event)
def makePSetForL1SeedToSuperClusterMatchFilter(self, moduleName)
virtual void setCurrentFolder(std::string const &fullpath)
def makePSetForEtFilter(self, moduleName)
void dqmEndRun(edm::Run const &, edm::EventSetup const &) override
void dqmBeginRun(edm::Run const &, edm::EventSetup const &) override
void analyze(const edm::Event &event, const edm::EventSetup &) override
edm::ParameterSet makePSetForOneOEMinusOneOPFilter(const std::string &)
Log< level::Error, false > LogError
edm::ParameterSet makePSetForElectronGenericFilter(const std::string &)
def findEgammaPaths(process)
std::vector< TPRegexp > filters
edm::ParameterSet makePSetForL1SeedFilter(const std::string &)
std::vector< std::string > getFilterModules(const std::string &)
size_type filterIndex(const edm::InputTag &filterTag) const
index from tag
void addParameter(std::string const &name, T const &value)
def makePSetForOneOEMinusOneOPFilter(self, moduleName)
void SetVarsFromPSet(std::vector< edm::ParameterSet >::iterator)
Abs< T >::type abs(const T &t)
def makePSetForEgammaGenericFilter(self, module, moduleName)
#define DEFINE_FWK_MODULE(type)
edm::ParameterSet makePSetForEgammaDoubleEtDeltaPhiFilter(const std::string &)
virtual void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
Log< level::Warning, true > LogPrint
EmDQM(const edm::ParameterSet &pset)
Constructor.
Log< level::Info, false > LogInfo
def makePSetForPixelMatchFilter(self, moduleName)
bool checkGeneratedParticlesRequirement(const edm::Event &event)
XYZVectorD XYZVector
spatial vector with cartesian internal representation
void addUntrackedParameter(std::string const &name, T const &value)
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
int countSubstring(const std::string &, const std::string &)
size_type size() const
number of filters
double getPrimaryEtCut(const std::string &)
edm::ParameterSet makePSetForL1SeedToSuperClusterMatchFilter(const std::string &)
double et() const final
transverse energy
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Log< level::Warning, false > LogWarning
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
def makePSetForElectronGenericFilter(self, module, moduleName)
edm::ParameterSet makePSetForEtFilter(const std::string &)
edm::ParameterSet makePSetForPixelMatchFilter(const std::string &)
def makePSetForL1SeedFilter(self, moduleName)
print >> sys.stderr,msgPrefix,"WARNING: unknown module type", module.type_(), " with name " + moduleN...
void getObjects(size_type filter, Vids &ids, VRphoton &photons) const
extract Ref<C>s for a specific filter and of specific physics type