CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
TauValidationMiniAOD Class Reference

#include <TauValidationMiniAOD.h>

Inheritance diagram for TauValidationMiniAOD:
one::DQMEDAnalyzer< T > one::dqmimplementation::DQMBaseClass< T... >

Public Member Functions

void analyze (const edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
 TauValidationMiniAOD (const edm::ParameterSet &)
 
 ~TauValidationMiniAOD () override
 
- Public Member Functions inherited from one::DQMEDAnalyzer< T >
 DQMEDAnalyzer ()=default
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > const &)=delete
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > &&)=delete
 
 ~DQMEDAnalyzer () override=default
 

Private Attributes

std::map< std::string, MonitorElement * > byDeepTau2017v2VSerawMap
 
std::map< std::string, MonitorElement * > byDeepTau2017v2VSjetrawMap
 
std::map< std::string, MonitorElement * > byDeepTau2017v2VSmurawMap
 
std::map< std::string, MonitorElement * > decayModeFindingMap
 
std::map< std::string, MonitorElement * > decayModeMap
 
std::vector< edm::ParameterSetdiscriminators_
 
std::map< std::string, MonitorElement * > etaMap
 
std::string extensionName_
 
edm::ParameterSet histoSettings_
 
std::map< std::string, MonitorElement * > massMap
 
std::map< std::string, MonitorElement * > phiMap
 
std::map< std::string, MonitorElement * > ptMap
 
edm::EDGetTokenT< edm::View< reco::Candidate > > refCollectionInputTagToken_
 
std::map< std::string, MonitorElement * > summaryMap
 
edm::EDGetTokenT< std::vector< pat::Tau > > tauCollection_
 

Detailed Description

Description: <one line="" class="" summary>="">

Class used to do the Validation of the Tau in miniAOD

Implementation: <Notes on="" implementation>="">

Definition at line 53 of file TauValidationMiniAOD.h.

Constructor & Destructor Documentation

TauValidationMiniAOD::TauValidationMiniAOD ( const edm::ParameterSet iConfig)
explicit

Definition at line 25 of file TauValidationMiniAOD.cc.

References edm::ParameterSet::getParameter().

25  {
26  tauCollection_ = consumes<pat::TauCollection>(iConfig.getParameter<InputTag>("tauCollection"));
27  refCollectionInputTagToken_ = consumes<edm::View<reco::Candidate> >(iConfig.getParameter<InputTag>("RefCollection"));
28  extensionName_ = iConfig.getParameter<string>("ExtensionName");
29  discriminators_ = iConfig.getParameter<std::vector<edm::ParameterSet> >("discriminators");
30 }
T getParameter(std::string const &) const
edm::EDGetTokenT< std::vector< pat::Tau > > tauCollection_
std::vector< edm::ParameterSet > discriminators_
edm::EDGetTokenT< edm::View< reco::Candidate > > refCollectionInputTagToken_
TauValidationMiniAOD::~TauValidationMiniAOD ( )
override

Definition at line 32 of file TauValidationMiniAOD.cc.

32 {}

Member Function Documentation

void TauValidationMiniAOD::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 128 of file TauValidationMiniAOD.cc.

References MessageLogger_cfi::cerr, boostedElectronIsolation_cff::deltaR, PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi::dR, HiRecoPFJets_cff::etaMap, edm::Event::getByToken(), reco::isTau(), mvaPFMET_leptons_cfi::selectionCut, metsig::tau, and nano_cff::taus.

128  {
130  bool isTau = iEvent.getByToken(tauCollection_, taus);
131  if (!isTau) {
132  std::cerr << " Tau collection not found while running TauValidationMiniAOD.cc " << std::endl;
133  return;
134  }
135  typedef edm::View<reco::Candidate> refCandidateCollection;
136  Handle<refCandidateCollection> ReferenceCollection;
137  bool isRef = iEvent.getByToken(refCollectionInputTagToken_, ReferenceCollection);
138  if (!isRef) {
139  std::cerr << " Reference collection not found while running TauValidationMiniAOD.cc " << std::endl;
140  return;
141  }
142  for (refCandidateCollection::const_iterator RefJet = ReferenceCollection->begin();
143  RefJet != ReferenceCollection->end();
144  RefJet++) {
145  float dRmin = 0.15;
146  unsigned matchedTauIndex = -99;
147  for (unsigned iTau = 0; iTau < taus->size(); iTau++) {
148  pat::TauRef tau(taus, iTau);
149  //for (pat::TauCollection::const_iterator tau = taus->begin(); tau != taus->end(); tau++) {
150  //pat::TauRef matchedTau(*tau);
151  float dR = deltaR(tau->eta(), tau->phi(), RefJet->eta(), RefJet->phi());
152  if (dR < dRmin) {
153  dRmin = dR;
154  matchedTauIndex = iTau;
155  }
156  }
157  if (dRmin < 0.15) {
158  pat::TauRef matchedTau(taus, matchedTauIndex);
159  ptMap.find("")->second->Fill(matchedTau->pt());
160  etaMap.find("")->second->Fill(matchedTau->eta());
161  phiMap.find("")->second->Fill(matchedTau->phi());
162  massMap.find("")->second->Fill(matchedTau->mass());
163  decayModeMap.find("")->second->Fill(matchedTau->decayMode());
164  if (matchedTau->isTauIDAvailable("decayModeFinding"))
165  decayModeFindingMap.find("")->second->Fill(matchedTau->tauID("decayModeFinding"));
166  if (matchedTau->isTauIDAvailable("byDeepTau2017v2VSeraw"))
167  byDeepTau2017v2VSerawMap.find("")->second->Fill(matchedTau->tauID("byDeepTau2017v2VSeraw"));
168  if (matchedTau->isTauIDAvailable("byDeepTau2017v2VSjetraw"))
169  byDeepTau2017v2VSjetrawMap.find("")->second->Fill(matchedTau->tauID("byDeepTau2017v2VSjetraw"));
170  if (matchedTau->isTauIDAvailable("byDeepTau2017v2VSmuraw"))
171  byDeepTau2017v2VSmurawMap.find("")->second->Fill(matchedTau->tauID("byDeepTau2017v2VSmuraw"));
172  int j = 0;
173  for (const auto& it : discriminators_) {
174  string currentDiscriminator = it.getParameter<string>("discriminator");
175  double selectionCut = it.getParameter<double>("selectionCut");
176  summaryMap.find("Den")->second->Fill(j);
177  if (matchedTau->tauID(currentDiscriminator) >= selectionCut)
178  summaryMap.find("Num")->second->Fill(j);
179  j = j + 1;
180  }
181  }
182  }
183 }
std::map< std::string, MonitorElement * > decayModeMap
std::map< std::string, MonitorElement * > byDeepTau2017v2VSjetrawMap
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
std::map< std::string, MonitorElement * > etaMap
std::map< std::string, MonitorElement * > decayModeFindingMap
std::map< std::string, MonitorElement * > byDeepTau2017v2VSmurawMap
std::map< std::string, MonitorElement * > phiMap
edm::EDGetTokenT< std::vector< pat::Tau > > tauCollection_
std::map< std::string, MonitorElement * > summaryMap
std::vector< edm::ParameterSet > discriminators_
edm::EDGetTokenT< edm::View< reco::Candidate > > refCollectionInputTagToken_
std::map< std::string, MonitorElement * > massMap
std::map< std::string, MonitorElement * > ptMap
bool isTau(const Candidate &part)
Definition: pdgIdUtils.h:15
std::map< std::string, MonitorElement * > byDeepTau2017v2VSerawMap
void TauValidationMiniAOD::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  iRun,
edm::EventSetup const &   
)
override

Definition at line 34 of file TauValidationMiniAOD.cc.

References DQMStore::IBooker::book1D(), HiRecoPFJets_cff::etaMap, histoInfo::max, histoInfo::min, histoInfo::nbins, MonitorElement::setBinLabel(), and DQMStore::IBooker::setCurrentFolder().

36  {
37  MonitorElement *ptTemp, *etaTemp, *phiTemp, *massTemp, *decayModeFindingTemp, *decayModeTemp,
38  *byDeepTau2017v2VSerawTemp, *byDeepTau2017v2VSjetrawTemp, *byDeepTau2017v2VSmurawTemp, *summaryTemp;
39  ibooker.setCurrentFolder("RecoTauV/miniAODValidation" + extensionName_);
40 
41  //summary plots
42  histoInfo summaryHinfo = (histoSettings_.exists("summary"))
44  : histoInfo(21, -0.5, 20.5);
45  summaryTemp =
46  ibooker.book1D("summaryPlotNum", "summaryPlotNum", summaryHinfo.nbins, summaryHinfo.min, summaryHinfo.max);
47  summaryMap.insert(std::make_pair("Num", summaryTemp));
48  summaryTemp =
49  ibooker.book1D("summaryPlotDen", "summaryPlotDen", summaryHinfo.nbins, summaryHinfo.min, summaryHinfo.max);
50  summaryMap.insert(std::make_pair("Den", summaryTemp));
51  summaryTemp = ibooker.book1D("summaryPlot", "summaryPlot", summaryHinfo.nbins, summaryHinfo.min, summaryHinfo.max);
52  summaryMap.insert(std::make_pair("", summaryTemp));
53 
54  int j = 0;
55  for (const auto& it : discriminators_) {
56  string DiscriminatorLabel = it.getParameter<string>("discriminator");
57  summaryMap.find("Den")->second->setBinLabel(j + 1, DiscriminatorLabel);
58  summaryMap.find("Num")->second->setBinLabel(j + 1, DiscriminatorLabel);
59  summaryMap.find("")->second->setBinLabel(j + 1, DiscriminatorLabel);
60  j = j + 1;
61  }
62 
63  //other plots
65  : histoInfo(200, 0., 1000.);
67  : histoInfo(200, -3, 3.);
69  : histoInfo(200, -3, 3.);
70  histoInfo massHinfo = (histoSettings_.exists("mass"))
72  : histoInfo(200, 0, 10.);
73  histoInfo decayModeFindingHinfo = (histoSettings_.exists("decayModeFinding"))
75  : histoInfo(2, -0.5, 1.5);
76  histoInfo decayModeHinfo = (histoSettings_.exists("decayMode"))
78  : histoInfo(11, -0.5, 10.5);
79  histoInfo byDeepTau2017v2VSerawHinfo =
80  (histoSettings_.exists("byDeepTau2017v2VSeraw"))
81  ? histoInfo(histoSettings_.getParameter<edm::ParameterSet>("byDeepTau2017v2VSeraw"))
82  : histoInfo(200, 0., 1.);
83  histoInfo byDeepTau2017v2VSjetrawHinfo =
84  (histoSettings_.exists("byDeepTau2017v2VSjetraw"))
85  ? histoInfo(histoSettings_.getParameter<edm::ParameterSet>("byDeepTau2017v2VSjetraw"))
86  : histoInfo(200, 0., 1.);
87  histoInfo byDeepTau2017v2VSmurawHinfo =
88  (histoSettings_.exists("byDeepTau2017v2VSmuraw"))
89  ? histoInfo(histoSettings_.getParameter<edm::ParameterSet>("byDeepTau2017v2VSmuraw"))
90  : histoInfo(200, 0., 1.);
91  ptTemp = ibooker.book1D("tau_pt", "tau_pt", ptHinfo.nbins, ptHinfo.min, ptHinfo.max);
92  etaTemp = ibooker.book1D("tau_eta", "tau_eta", etaHinfo.nbins, etaHinfo.min, etaHinfo.max);
93  phiTemp = ibooker.book1D("tau_phi", "tau_phi", phiHinfo.nbins, phiHinfo.min, phiHinfo.max);
94  massTemp = ibooker.book1D("tau_mass", "tau_mass", massHinfo.nbins, massHinfo.min, massHinfo.max);
95  decayModeFindingTemp = ibooker.book1D("tau_decayModeFinding",
96  "tau_decayModeFinding",
97  decayModeFindingHinfo.nbins,
98  decayModeFindingHinfo.min,
99  decayModeFindingHinfo.max);
100  decayModeTemp =
101  ibooker.book1D("tau_decayMode", "tau_decayMode", decayModeHinfo.nbins, decayModeHinfo.min, decayModeHinfo.max);
102  byDeepTau2017v2VSerawTemp = ibooker.book1D("tau_byDeepTau2017v2VSeraw",
103  "tau_byDeepTau2017v2VSeraw",
104  byDeepTau2017v2VSerawHinfo.nbins,
105  byDeepTau2017v2VSerawHinfo.min,
106  byDeepTau2017v2VSerawHinfo.max);
107  byDeepTau2017v2VSjetrawTemp = ibooker.book1D("tau_byDeepTau2017v2VSjetraw",
108  "tau_byDeepTau2017v2VSjetraw",
109  byDeepTau2017v2VSjetrawHinfo.nbins,
110  byDeepTau2017v2VSjetrawHinfo.min,
111  byDeepTau2017v2VSjetrawHinfo.max);
112  byDeepTau2017v2VSmurawTemp = ibooker.book1D("tau_byDeepTau2017v2VSmuraw",
113  "tau_byDeepTau2017v2VSmuraw",
114  byDeepTau2017v2VSmurawHinfo.nbins,
115  byDeepTau2017v2VSmurawHinfo.min,
116  byDeepTau2017v2VSmurawHinfo.max);
117  ptMap.insert(std::make_pair("", ptTemp));
118  etaMap.insert(std::make_pair("", etaTemp));
119  phiMap.insert(std::make_pair("", phiTemp));
120  massMap.insert(std::make_pair("", massTemp));
121  decayModeFindingMap.insert(std::make_pair("", decayModeFindingTemp));
122  decayModeMap.insert(std::make_pair("", decayModeTemp));
123  byDeepTau2017v2VSerawMap.insert(std::make_pair("", byDeepTau2017v2VSerawTemp));
124  byDeepTau2017v2VSjetrawMap.insert(std::make_pair("", byDeepTau2017v2VSjetrawTemp));
125  byDeepTau2017v2VSmurawMap.insert(std::make_pair("", byDeepTau2017v2VSmurawTemp));
126 }
T getParameter(std::string const &) const
std::map< std::string, MonitorElement * > decayModeMap
std::map< std::string, MonitorElement * > byDeepTau2017v2VSjetrawMap
std::map< std::string, MonitorElement * > etaMap
bool exists(std::string const &parameterName) const
checks if a parameter exists
std::map< std::string, MonitorElement * > decayModeFindingMap
std::map< std::string, MonitorElement * > byDeepTau2017v2VSmurawMap
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
std::map< std::string, MonitorElement * > phiMap
edm::ParameterSet histoSettings_
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:106
std::map< std::string, MonitorElement * > summaryMap
std::vector< edm::ParameterSet > discriminators_
std::map< std::string, MonitorElement * > massMap
std::map< std::string, MonitorElement * > ptMap
std::map< std::string, MonitorElement * > byDeepTau2017v2VSerawMap

Member Data Documentation

std::map<std::string, MonitorElement *> TauValidationMiniAOD::byDeepTau2017v2VSerawMap
private

Definition at line 64 of file TauValidationMiniAOD.h.

std::map<std::string, MonitorElement *> TauValidationMiniAOD::byDeepTau2017v2VSjetrawMap
private

Definition at line 64 of file TauValidationMiniAOD.h.

std::map<std::string, MonitorElement *> TauValidationMiniAOD::byDeepTau2017v2VSmurawMap
private

Definition at line 64 of file TauValidationMiniAOD.h.

std::map<std::string, MonitorElement *> TauValidationMiniAOD::decayModeFindingMap
private

Definition at line 64 of file TauValidationMiniAOD.h.

std::map<std::string, MonitorElement *> TauValidationMiniAOD::decayModeMap
private

Definition at line 64 of file TauValidationMiniAOD.h.

std::vector<edm::ParameterSet> TauValidationMiniAOD::discriminators_
private

Definition at line 68 of file TauValidationMiniAOD.h.

std::map<std::string, MonitorElement *> TauValidationMiniAOD::etaMap
private

Definition at line 64 of file TauValidationMiniAOD.h.

std::string TauValidationMiniAOD::extensionName_
private

Definition at line 67 of file TauValidationMiniAOD.h.

edm::ParameterSet TauValidationMiniAOD::histoSettings_
private

Definition at line 66 of file TauValidationMiniAOD.h.

std::map<std::string, MonitorElement *> TauValidationMiniAOD::massMap
private

Definition at line 64 of file TauValidationMiniAOD.h.

std::map<std::string, MonitorElement *> TauValidationMiniAOD::phiMap
private

Definition at line 64 of file TauValidationMiniAOD.h.

std::map<std::string, MonitorElement *> TauValidationMiniAOD::ptMap
private

Definition at line 64 of file TauValidationMiniAOD.h.

edm::EDGetTokenT<edm::View<reco::Candidate> > TauValidationMiniAOD::refCollectionInputTagToken_
private

Definition at line 63 of file TauValidationMiniAOD.h.

std::map<std::string, MonitorElement *> TauValidationMiniAOD::summaryMap
private

Definition at line 64 of file TauValidationMiniAOD.h.

edm::EDGetTokenT<std::vector<pat::Tau> > TauValidationMiniAOD::tauCollection_
private

Definition at line 62 of file TauValidationMiniAOD.h.