Skip to content

Commit

Permalink
protect tau DQM against taus with non-existing tauIDs
Browse files Browse the repository at this point in the history
  • Loading branch information
mbluj committed Oct 2, 2024
1 parent 1475b2e commit a62be2b
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions Validation/RecoTau/src/TauValidationMiniAOD.cc
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,8 @@ void TauValidationMiniAOD::analyze(const edm::Event &iEvent, const edm::EventSet
string currentDiscriminator = it.getParameter<string>("discriminator");
double selectionCut = it.getParameter<double>("selectionCut");
summaryMap.find("Den")->second->Fill(j);
if (matchedTau->tauID(currentDiscriminator) >= selectionCut)
if (matchedTau->isTauIDAvailable(currentDiscriminator) &&
matchedTau->tauID(currentDiscriminator) >= selectionCut)
summaryMap.find("Num")->second->Fill(j);
j = j + 1;
}
Expand All @@ -631,23 +632,26 @@ void TauValidationMiniAOD::analyze(const edm::Event &iEvent, const edm::EventSet
if (extensionName_.compare(qcd) == 0 || extensionName_.compare(real_data) == 0 ||
extensionName_.compare(ztt) == 0) {
// vsJet/tight
if (matchedTau->tauID("byTightDeepTau2018v2p5VSjet") >= 0.5) {
if (matchedTau->isTauIDAvailable("byTightDeepTau2018v2p5VSjet") &&
matchedTau->tauID("byTightDeepTau2018v2p5VSjet") >= 0.5) {
ptTightvsJetMap.find("")->second->Fill(matchedTau->pt());
etaTightvsJetMap.find("")->second->Fill(matchedTau->eta());
phiTightvsJetMap.find("")->second->Fill(matchedTau->phi());
massTightvsJetMap.find("")->second->Fill(matchedTau->mass());
puTightvsJetMap.find("")->second->Fill(pvHandle->size());
}
// vsJet/medium
if (matchedTau->tauID("byMediumDeepTau2018v2p5VSjet") >= 0.5) {
if (matchedTau->isTauIDAvailable("byMediumDeepTau2018v2p5VSjet") &&
matchedTau->tauID("byMediumDeepTau2018v2p5VSjet") >= 0.5) {
ptMediumvsJetMap.find("")->second->Fill(matchedTau->pt());
etaMediumvsJetMap.find("")->second->Fill(matchedTau->eta());
phiMediumvsJetMap.find("")->second->Fill(matchedTau->phi());
massMediumvsJetMap.find("")->second->Fill(matchedTau->mass());
puMediumvsJetMap.find("")->second->Fill(pvHandle->size());
}
// vsJet/loose
if (matchedTau->tauID("byLooseDeepTau2018v2p5VSjet") >= 0.5) {
if (matchedTau->isTauIDAvailable("byLooseDeepTau2018v2p5VSjet") &&
matchedTau->tauID("byLooseDeepTau2018v2p5VSjet") >= 0.5) {
ptLoosevsJetMap.find("")->second->Fill(matchedTau->pt());
etaLoosevsJetMap.find("")->second->Fill(matchedTau->eta());
phiLoosevsJetMap.find("")->second->Fill(matchedTau->phi());
Expand All @@ -659,23 +663,26 @@ void TauValidationMiniAOD::analyze(const edm::Event &iEvent, const edm::EventSet
if (extensionName_.compare(real_eledata) == 0 || extensionName_.compare(zee) == 0 ||
extensionName_.compare(ztt) == 0) {
// vsEle/tight
if (matchedTau->tauID("byTightDeepTau2018v2p5VSe") >= 0.5) {
if (matchedTau->isTauIDAvailable("byTightDeepTau2018v2p5VSe") &&
matchedTau->tauID("byTightDeepTau2018v2p5VSe") >= 0.5) {
ptTightvsEleMap.find("")->second->Fill(matchedTau->pt());
etaTightvsEleMap.find("")->second->Fill(matchedTau->eta());
phiTightvsEleMap.find("")->second->Fill(matchedTau->phi());
massTightvsEleMap.find("")->second->Fill(matchedTau->mass());
puTightvsEleMap.find("")->second->Fill(pvHandle->size());
}
// vsEle/medium
if (matchedTau->tauID("byMediumDeepTau2018v2p5VSe") >= 0.5) {
if (matchedTau->isTauIDAvailable("byMediumDeepTau2018v2p5VSe") &&
matchedTau->tauID("byMediumDeepTau2018v2p5VSe") >= 0.5) {
ptMediumvsEleMap.find("")->second->Fill(matchedTau->pt());
etaMediumvsEleMap.find("")->second->Fill(matchedTau->eta());
phiMediumvsEleMap.find("")->second->Fill(matchedTau->phi());
massMediumvsEleMap.find("")->second->Fill(matchedTau->mass());
puMediumvsEleMap.find("")->second->Fill(pvHandle->size());
}
// vsEle/loose
if (matchedTau->tauID("byLooseDeepTau2018v2p5VSe") >= 0.5) {
if (matchedTau->isTauIDAvailable("byLooseDeepTau2018v2p5VSe") &&
matchedTau->tauID("byLooseDeepTau2018v2p5VSe") >= 0.5) {
ptLoosevsEleMap.find("")->second->Fill(matchedTau->pt());
etaLoosevsEleMap.find("")->second->Fill(matchedTau->eta());
phiLoosevsEleMap.find("")->second->Fill(matchedTau->phi());
Expand All @@ -687,23 +694,26 @@ void TauValidationMiniAOD::analyze(const edm::Event &iEvent, const edm::EventSet
if (extensionName_.compare(real_mudata) == 0 || extensionName_.compare(zmm) == 0 ||
extensionName_.compare(ztt) == 0) {
// vsMuo/tight
if (matchedTau->tauID("byTightDeepTau2018v2p5VSmu") >= 0.5) {
if (matchedTau->isTauIDAvailable("byTightDeepTau2018v2p5VSmu") &&
matchedTau->tauID("byTightDeepTau2018v2p5VSmu") >= 0.5) {
ptTightvsMuoMap.find("")->second->Fill(matchedTau->pt());
etaTightvsMuoMap.find("")->second->Fill(matchedTau->eta());
phiTightvsMuoMap.find("")->second->Fill(matchedTau->phi());
massTightvsMuoMap.find("")->second->Fill(matchedTau->mass());
puTightvsMuoMap.find("")->second->Fill(pvHandle->size());
}
// vsMuo/medium
if (matchedTau->tauID("byMediumDeepTau2018v2p5VSmu") >= 0.5) {
if (matchedTau->isTauIDAvailable("byMediumDeepTau2018v2p5VSmu") &&
matchedTau->tauID("byMediumDeepTau2018v2p5VSmu") >= 0.5) {
ptMediumvsMuoMap.find("")->second->Fill(matchedTau->pt());
etaMediumvsMuoMap.find("")->second->Fill(matchedTau->eta());
phiMediumvsMuoMap.find("")->second->Fill(matchedTau->phi());
massMediumvsMuoMap.find("")->second->Fill(matchedTau->mass());
puMediumvsMuoMap.find("")->second->Fill(pvHandle->size());
}
// vsMuo/loose
if (matchedTau->tauID("byLooseDeepTau2018v2p5VSmu") >= 0.5) {
if (matchedTau->isTauIDAvailable("byLooseDeepTau2018v2p5VSmu") &&
matchedTau->tauID("byLooseDeepTau2018v2p5VSmu") >= 0.5) {
ptLoosevsMuoMap.find("")->second->Fill(matchedTau->pt());
etaLoosevsMuoMap.find("")->second->Fill(matchedTau->eta());
phiLoosevsMuoMap.find("")->second->Fill(matchedTau->phi());
Expand Down

0 comments on commit a62be2b

Please sign in to comment.