Skip to content

Commit

Permalink
Merge pull request #41381 from vukasinmilosevic/VM_Tau_plots_fix_anti…
Browse files Browse the repository at this point in the history
…ele_bkport

[13_0_X] Fixing the missing Tau plots within the L1T offline DQM
  • Loading branch information
cmsbuild authored Apr 25, 2023
2 parents 0649bd5 + af93e92 commit b300ac3
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 25 deletions.
3 changes: 3 additions & 0 deletions DQMOffline/L1Trigger/interface/L1TTauOffline.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,9 @@ class L1TTauOffline : public DQMEDAnalyzer {

std::vector<int> m_trigIndices;

//V.M. 16.3.2023. Temporary variable for checking the anti-ele discriminator
bool m_AntiEleExists;

// Histograms
MonitorElement* h_nVertex_;
MonitorElement* h_tagAndProbeMass_;
Expand Down
2 changes: 1 addition & 1 deletion DQMOffline/L1Trigger/python/L1TTauOffline_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
l1tInputTag = cms.untracked.InputTag("caloStage2Digis:Tau"),
vtxInputTag = cms.untracked.InputTag("offlinePrimaryVertices"),
bsInputTag = cms.untracked.InputTag("offlineBeamSpot"),
triggerNames = cms.untracked.vstring("HLT_IsoMu18_v*","HLT_IsoMu20_v*","HLT_IsoMu22_v*","HLT_IsoMu24_v*","HLT_IsoMu27_v*"),
triggerNames = cms.untracked.vstring("HLT_IsoMu18_v*","HLT_IsoMu20_v*","HLT_IsoMu22_v*","HLT_IsoMu24_v*","HLT_IsoMu27_v*", "HLT_IsoMu30_v*"),
trigInputTag = cms.untracked.InputTag("hltTriggerSummaryAOD", "", "HLT"),
trigProcess = cms.untracked.string("HLT"),
trigProcess_token = cms.untracked.InputTag("TriggerResults","","HLT"),
Expand Down
65 changes: 41 additions & 24 deletions DQMOffline/L1Trigger/src/L1TTauOffline.cc
Original file line number Diff line number Diff line change
Expand Up @@ -533,10 +533,20 @@ bool L1TTauOffline::matchHlt(edm::Handle<trigger::TriggerEvent> const& triggerEv

trigger::TriggerObjectCollection trigObjs = triggerEvent->getObjects();

for (auto trigIndexIt = m_trigIndices.begin(); trigIndexIt != m_trigIndices.end(); ++trigIndexIt) {
const vector<string> moduleLabels(m_hltConfig.moduleLabels(*trigIndexIt));
const unsigned moduleIndex = m_hltConfig.size((*trigIndexIt)) - 2;

for (auto& trigIndex : m_trigIndices) {
const vector<string> moduleLabels(m_hltConfig.moduleLabels(trigIndex));
// V.M. 2023.03.08 Same issue as in the L1TMuonDQMOffline.cc - some modules are behind hltBoolEnd, but we want the last one before the "hltBoolEnd"
int moduleIndex = 999999;
for (int ii = moduleLabels.size() - 1; ii > 0; ii--) {
if (moduleLabels[ii] == "hltBoolEnd") {
moduleIndex = ii - 1;
break;
}
}
if (moduleIndex == 999999) {
edm::LogError("L1TMuonDQMOffline") << "Found no module label in trigger " << trigIndex;
continue;
}
const unsigned hltFilterIndex = triggerEvent->filterIndex(InputTag(moduleLabels[moduleIndex], "", trigProcess_));

if (hltFilterIndex < triggerEvent->sizeFilters()) {
Expand All @@ -553,7 +563,6 @@ bool L1TTauOffline::matchHlt(edm::Handle<trigger::TriggerEvent> const& triggerEv
}
}
}

return (matchDeltaR < m_MaxHltTauDR);
}

Expand Down Expand Up @@ -634,28 +643,29 @@ void L1TTauOffline::getProbeTaus(const edm::Event& iEvent,
edm::Handle<reco::TauDiscriminatorContainer> antimu;
iEvent.getByToken(AntiMuInputTag_, antimu);
if (!antimu.isValid()) {
edm::LogWarning("L1TTauOffline") << "invalid collection: reco::PFTauDiscriminator " << std::endl;
edm::LogWarning("L1TTauOffline") << "invalid collection: reco::PFTauDiscriminator anti-mu";
return;
}

edm::Handle<reco::PFTauDiscriminator> dmf;
iEvent.getByToken(DecayModeFindingInputTag_, dmf);
if (!dmf.isValid()) {
edm::LogWarning("L1TTauOffline") << "invalid collection: reco::PFTauDiscriminator " << std::endl;
edm::LogWarning("L1TTauOffline") << "invalid collection: reco::PFTauDiscriminator decay mode finding input";
return;
}
m_AntiEleExists = true;

edm::Handle<reco::TauDiscriminatorContainer> antiele;
iEvent.getByToken(AntiEleInputTag_, antiele);
if (!antiele.isValid()) {
edm::LogWarning("L1TTauOffline") << "invalid collection: reco::PFTauDiscriminator " << std::endl;
return;
//V.M. 16.3.2023. Bypassing the return option for now, as the anti-ele discr. is not available.
m_AntiEleExists = false;
}

edm::Handle<reco::TauDiscriminatorContainer> comb3T;
iEvent.getByToken(comb3TInputTag_, comb3T);
if (!comb3T.isValid()) {
edm::LogWarning("L1TTauOffline") << "invalid collection: reco::PFTauDiscriminator " << std::endl;
edm::LogWarning("L1TTauOffline") << "invalid collection: reco::PFTauDiscriminator comb3T";
return;
}

Expand All @@ -678,13 +688,15 @@ void L1TTauOffline::getProbeTaus(const edm::Event& iEvent,
}
}
{
const edm::Provenance* prov = antiele.provenance();
const std::vector<std::string> psetsFromProvenance =
edm::parameterSet(prov->stable(), iEvent.processHistory())
.getParameter<std::vector<std::string>>("workingPoints");
for (uint i = 0; i < psetsFromProvenance.size(); i++) {
if (psetsFromProvenance[i] == AntiEleWP_)
AntiEleWPIndex_ = i;
if (m_AntiEleExists) {
const edm::Provenance* prov = antiele.provenance();
const std::vector<std::string> psetsFromProvenance =
edm::parameterSet(prov->stable(), iEvent.processHistory())
.getParameter<std::vector<std::string>>("workingPoints");
for (unsigned int i = 0; i < psetsFromProvenance.size(); i++) {
if (psetsFromProvenance[i] == AntiEleWP_)
AntiEleWPIndex_ = i;
}
}
}
{
Expand All @@ -705,21 +717,26 @@ void L1TTauOffline::getProbeTaus(const edm::Event& iEvent,
mytau.SetPtEtaPhiE(tauIt->pt(), tauIt->eta(), tauIt->phi(), tauIt->energy());

if ((*antimu)[tauCandidate].workingPoints.empty()) {
edm::LogWarning("L1TTauOffline") << "This offline tau has no antimu discriminator, skipping" << std::endl;
edm::LogWarning("L1TTauOffline") << "This offline tau has no antimu discriminator, skipping";
continue;
}
if ((*antiele)[tauCandidate].workingPoints.empty()) {
edm::LogWarning("L1TTauOffline") << "This offline tau has no antiele discriminator, skipping" << std::endl;
continue;
if (m_AntiEleExists) {
if ((*antiele)[tauCandidate].workingPoints.empty()) {
edm::LogWarning("L1TTauOffline") << "This offline tau has no antiele discriminator, skipping";
continue;
}
}
if ((*comb3T)[tauCandidate].workingPoints.empty()) {
edm::LogWarning("L1TTauOffline") << "This offline tau has no comb3T discriminator, skipping" << std::endl;
edm::LogWarning("L1TTauOffline") << "This offline tau has no comb3T discriminator, skipping";
continue;
}
bool antiele_condition = true;

if (m_AntiEleExists)
antiele_condition = (*antiele)[tauCandidate].workingPoints[AntiEleWPIndex_];

if (fabs(tauIt->charge()) == 1 && fabs(tauIt->eta()) < 2.1 && tauIt->pt() > 20 &&
(*antimu)[tauCandidate].workingPoints[AntiMuWPIndex_] &&
(*antiele)[tauCandidate].workingPoints[AntiEleWPIndex_] && (*dmf)[tauCandidate] > 0.5 &&
(*antimu)[tauCandidate].workingPoints[AntiMuWPIndex_] && antiele_condition && (*dmf)[tauCandidate] > 0.5 &&
(*comb3T)[tauCandidate].workingPoints[comb3TWPIndex_]) {
if (mymu.DeltaR(mytau) > 0.5 && (mymu + mytau).M() > 40 && (mymu + mytau).M() < 80 &&
m_TightMuons[0]->charge() * tauIt->charge() < 0) {
Expand Down

0 comments on commit b300ac3

Please sign in to comment.