Skip to content

Commit

Permalink
Merge pull request #44680 from slehti/HLTTauValidationUpdateApril2024…
Browse files Browse the repository at this point in the history
…_PNetTau

HLT Tau DQM for PNet taus: backport for 14_0_X
  • Loading branch information
cmsbuild authored Apr 10, 2024
2 parents 0f85469 + 5ff91d9 commit ad6a6b4
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 15 deletions.
1 change: 1 addition & 0 deletions DQMOffline/Trigger/interface/HLTTauDQMPathPlotter.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class HLTTauDQMPathPlotter : private HLTTauDQMPlotter {

HLTTauDQMPath hltPath_;

MonitorElement *hCounter_;
MonitorElement *hAcceptedEvents_;
MonitorElement *hTrigTauEt_;
MonitorElement *hTrigTauEta_;
Expand Down
1 change: 1 addition & 0 deletions DQMOffline/Trigger/python/HLTTauDQMOffline_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

HLTTauDQMOffline = cms.Sequence(TauRefProducer
+hltTauOfflineMonitor_PFTaus
+hltTauOfflineMonitor_PNetTaus
+hltTauOfflineMonitor_Inclusive
+hltTauOfflineMonitor_TagAndProbe
)
Expand Down
5 changes: 5 additions & 0 deletions DQMOffline/Trigger/python/HLTTauDQMOffline_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@
),
)

hltTauOfflineMonitor_PNetTaus = hltTauOfflineMonitor_PFTaus.clone(
DQMBaseFolder = cms.untracked.string("HLT/TAU/PNetTaus"),
Paths = cms.untracked.string("PNetTauh")
)

hltTauOfflineMonitor_Inclusive = hltTauOfflineMonitor_PFTaus.clone(
DQMBaseFolder = "HLT/TAU/Inclusive",
Matching = cms.PSet(
Expand Down
2 changes: 2 additions & 0 deletions DQMOffline/Trigger/python/HLTTauPostProcessor_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,12 @@ def _addEfficiencies(level, quantities, nameFormat, titleObject="#tau", postfix=

(HLTTauPostAnalysisInclusive, HLTTauPostAnalysisInclusive2) = makeInclusiveAnalyzer(hltTauOfflineMonitor_Inclusive)
(HLTTauPostAnalysisPFTaus, HLTTauPostAnalysisPFTaus2) = makePFTauAnalyzer(hltTauOfflineMonitor_PFTaus)
(HLTTauPostAnalysisPNetTaus, HLTTauPostAnalysisPNetTaus2) = makePFTauAnalyzer(hltTauOfflineMonitor_PNetTaus)
(HLTTauPostAnalysisTP, HLTTauPostAnalysisTP2) = makePFTauAnalyzer(hltTauOfflineMonitor_TagAndProbe)

HLTTauPostSeq = cms.Sequence(
HLTTauPostAnalysisInclusive+HLTTauPostAnalysisInclusive2+
HLTTauPostAnalysisPFTaus+HLTTauPostAnalysisPFTaus2+
HLTTauPostAnalysisPNetTaus+HLTTauPostAnalysisPNetTaus2+
HLTTauPostAnalysisTP+HLTTauPostAnalysisTP2
)
22 changes: 16 additions & 6 deletions DQMOffline/Trigger/src/HLTTauDQMPath.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ namespace {
continue;
if (iLabel->find('-') == 0) // ignore
continue;
if (type == "L2TauTagFilter") // gives L1taus as output
continue;
if (type == "HLT2PhotonPFTau" || type == "HLT2ElectronPFTau" || type == "HLT2MuonPFTau" ||
type == "HLT2PhotonTau" || type == "HLT2ElectronTau" || type == "HLT2MuonTau")
leptonTauFilters.emplace_back(*iLabel);
Expand Down Expand Up @@ -98,7 +100,8 @@ namespace {

bool isL3TauProducer(const HLTConfigProvider& HLTCP, const std::string& producerLabel) const {
const std::string type = HLTCP.moduleType(producerLabel);
if (type == "PFRecoTauProducer" || type == "RecoTauPiZeroUnembedder") {
if (type == "PFRecoTauProducer" || type == "RecoTauPiZeroUnembedder" ||
type == "BTagProbabilityToDiscriminator") {
LogDebug("HLTTauDQMOffline") << "Found tau producer " << type << " with label " << producerLabel
<< " from path " << name_;
return true;
Expand Down Expand Up @@ -134,6 +137,8 @@ namespace {
return isL3TauProducer(HLTCP, pset.getParameter<edm::InputTag>("inputTag1").label());
if (pset.exists("inputTag2"))
return isL3TauProducer(HLTCP, pset.getParameter<edm::InputTag>("inputTag2").label());
if (pset.exists("taus"))
return isL3TauProducer(HLTCP, pset.getParameter<edm::InputTag>("taus").label());
return false;
}

Expand Down Expand Up @@ -257,6 +262,9 @@ namespace {
if (getParameterSafe(HLTCP, filterName, "triggerType") == trigger::TriggerTau) {
n.tau = getParameterSafe(HLTCP, filterName, "MinN");
}
} else if (moduleType == "TauTagFilter") {
n.level = 3;
n.tau = getParameterSafe(HLTCP, filterName, "nExpected");
} else if (moduleType == "HLT1PFJet") {
n.level = 3;
//const edm::ParameterSet& pset = HLTCP.modulePSet(filterName);
Expand Down Expand Up @@ -406,11 +414,13 @@ HLTTauDQMPath::HLTTauDQMPath(std::string pathName,
const std::string& moduleType = HLTCP.moduleType(filterName);

TauLeptonMultiplicity n = inferTauLeptonMultiplicity(HLTCP, filterName, moduleType, pathName_);
filterTauN_.push_back(n.tau);
filterElectronN_.push_back(n.electron);
filterMuonN_.push_back(n.muon);
filterMET_.push_back(n.met);
filterLevel_.push_back(n.level);
if (n.level > 0) {
filterTauN_.push_back(n.tau);
filterElectronN_.push_back(n.electron);
filterMuonN_.push_back(n.muon);
filterMET_.push_back(n.met);
filterLevel_.push_back(n.level);
}

#ifdef EDM_ML_DEBUG
ss << "\n " << i << " " << std::get<kModuleIndex>(filterIndice) << " " << filterName << " " << moduleType
Expand Down
26 changes: 18 additions & 8 deletions DQMOffline/Trigger/src/HLTTauDQMPathPlotter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,19 @@ void HLTTauDQMPathPlotter::bookHistograms(HistoWrapper& iWrapper, DQMStore::IBoo
// Book histograms
iBooker.setCurrentFolder(triggerTag());

hCounter_ = iWrapper.book1D(iBooker, "EventCounter", "Accepted events;;entries", 3, 0, 3, kEverything);
hAcceptedEvents_ = iWrapper.book1D(iBooker,
"EventsPerFilter",
"Accepted Events per filter;;entries",
hltPath_.filtersSize(),
0,
hltPath_.filtersSize(),
kEverything);
if (hCounter_) {
hCounter_->setBinLabel(1, "all events");
hCounter_->setBinLabel(2, "ref tau found");
hCounter_->setBinLabel(3, "passed trg");
}
for (size_t i = 0; i < hltPath_.filtersSize(); ++i) {
if (hAcceptedEvents_)
hAcceptedEvents_->setBinLabel(i + 1, hltPath_.getFilterName(i));
Expand Down Expand Up @@ -111,13 +117,8 @@ void HLTTauDQMPathPlotter::bookHistograms(HistoWrapper& iWrapper, DQMStore::IBoo
}

if (hltPath_.hasL3Taus()) {
hL3TrigTauEtEffNum_ = iWrapper.book1D(iBooker,
"L3TrigTauEtEffNum",
"L3 #tau p_{T} efficiency;Ref #tau p_{T};entries",
ptbins_,
0,
ptmax_,
kEverything);
hL3TrigTauEtEffNum_ = iWrapper.book1D(
iBooker, "L3TrigTauEtEffNum", "L3 #tau p_{T} efficiency;Ref #tau p_{T};entries", ptbins_, 0, ptmax_, kVital);
hL3TrigTauEtEffDenom_ = iWrapper.book1D(iBooker,
"L3TrigTauEtEffDenom",
"L3 #tau p_{T} denominator;Ref #tau p_{T};Efficiency",
Expand Down Expand Up @@ -451,6 +452,14 @@ void HLTTauDQMPathPlotter::analyze(const edm::TriggerResults& triggerResults,
int lastMatchedMuonFilter = -1;
int lastMatchedTauFilter = -1;
int firstMatchedMETFilter = -1;
if (hCounter_) {
hCounter_->Fill(0.5);
if (refCollection.taus.size() > 0) {
hCounter_->Fill(1.5);
if (hltPath_.fired(triggerResults))
hCounter_->Fill(2.5);
}
}

if (doRefAnalysis_) {
double matchDr = hltPath_.isFirstFilterL1Seed() ? l1MatchDr_ : hltMatchDr_;
Expand Down Expand Up @@ -479,7 +488,8 @@ void HLTTauDQMPathPlotter::analyze(const edm::TriggerResults& triggerResults,
if (hltPath_.getFilterName(i).find("hltPFTau") < hltPath_.getFilterName(i).length() ||
hltPath_.getFilterName(i).find("hltHpsPFTau") < hltPath_.getFilterName(i).length() ||
hltPath_.getFilterName(i).find("hltDoublePFTau") < hltPath_.getFilterName(i).length() ||
hltPath_.getFilterName(i).find("hltHpsDoublePFTau") < hltPath_.getFilterName(i).length())
hltPath_.getFilterName(i).find("hltHpsDoublePFTau") < hltPath_.getFilterName(i).length() ||
hltPath_.getFilterName(i).find("PNetTauhTag") < hltPath_.getFilterName(i).length())
lastMatchedTauFilter = i;
if (firstMatchedMETFilter < 0 && hltPath_.getFilterName(i).find("hltMET") < hltPath_.getFilterName(i).length())
firstMatchedMETFilter = i;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@

(HLTTauValPostAnalysisMC, HLTTauValPostAnalysisMC2) = postProcessor.makePFTauAnalyzer(hltTauValIdealMonitorMC)
(HLTTauValPostAnalysisPF, HLTTauValPostAnalysisPF2) = postProcessor.makePFTauAnalyzer(hltTauValIdealMonitorPF)
(HLTTauValPostAnalysisPN, HLTTauValPostAnalysisPN2) = postProcessor.makePFTauAnalyzer(hltTauValIdealMonitorPNet)
(HLTTauValPostAnalysisTP, HLTTauValPostAnalysisTP2) = postProcessor.makePFTauAnalyzer(hltTauValTagAndProbe)
HLTTauPostVal = cms.Sequence(
HLTTauValPostAnalysisMC+HLTTauValPostAnalysisMC2+
HLTTauValPostAnalysisPF+HLTTauValPostAnalysisPF2+
HLTTauValPostAnalysisPN+HLTTauValPostAnalysisPN2+
HLTTauValPostAnalysisTP+HLTTauValPostAnalysisTP2
)
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@
),
)

hltTauValIdealMonitorPNet = hltTauValIdealMonitorMC.clone(
DQMBaseFolder = cms.untracked.string("HLT/TAU/RelVal/PNet"),
Paths = cms.untracked.string("PNetTau")
)

from DQMOffline.Trigger.HLTTauDQMOffline_cfi import hltTauOfflineMonitor_TagAndProbe
hltTauValTagAndProbe = hltTauValIdealMonitorMC.clone(
DQMBaseFolder = cms.untracked.string("HLT/TAU/RelVal/TagAndProbe"),
Expand Down Expand Up @@ -94,5 +99,5 @@
)

#hltTauValIdeal = cms.Sequence(hltTauValIdealMonitorMC+hltTauValIdealMonitorPF)
hltTauValIdeal = cms.Sequence(hltTauValIdealMonitorMC+hltTauValIdealMonitorPF+hltTauValTagAndProbe)
hltTauValIdeal = cms.Sequence(hltTauValIdealMonitorMC+hltTauValIdealMonitorPF+hltTauValIdealMonitorPNet+hltTauValTagAndProbe)

0 comments on commit ad6a6b4

Please sign in to comment.