CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Attributes
TauValidationMiniAOD Class Reference

#include <TauValidationMiniAOD.h>

Inheritance diagram for TauValidationMiniAOD:
DQMEDAnalyzer edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >

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 DQMEDAnalyzer
void accumulate (edm::Event const &event, edm::EventSetup const &setup) final
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
void beginStream (edm::StreamID id) final
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer ()
 
void endLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void endRun (edm::Run const &run, edm::EventSetup const &setup) final
 
virtual bool getCanSaveByLumi ()
 
- Public Member Functions inherited from edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Attributes

std::map< std::string,
MonitorElement * > 
byDeepTau2017v2p1VSerawMap
 
std::map< std::string,
MonitorElement * > 
byDeepTau2017v2p1VSjetrawMap
 
std::map< std::string,
MonitorElement * > 
byDeepTau2017v2p1VSmurawMap
 
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_
 

Additional Inherited Members

- Public Types inherited from DQMEDAnalyzer
typedef dqm::reco::DQMStore DQMStore
 
typedef dqm::reco::MonitorElement MonitorElement
 
- Public Types inherited from edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >
using CacheTypes = CacheContexts< T...>
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T...>
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 
- Static Public Member Functions inherited from DQMEDAnalyzer
static void globalEndJob (DQMEDAnalyzerGlobalCache const *)
 
static void globalEndLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &setup, LuminosityBlockContext const *context)
 
static void globalEndRunProduce (edm::Run &run, edm::EventSetup const &setup, RunContext const *context)
 
static std::unique_ptr
< DQMEDAnalyzerGlobalCache
initializeGlobalCache (edm::ParameterSet const &)
 
- Protected Member Functions inherited from DQMEDAnalyzer
uint64_t meId () const
 
- Protected Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 
unsigned int streamId_
 

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 52 of file TauValidationMiniAOD.h.

Constructor & Destructor Documentation

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

Definition at line 26 of file TauValidationMiniAOD.cc.

References edm::ParameterSet::getParameter().

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

Definition at line 33 of file TauValidationMiniAOD.cc.

33 {}

Member Function Documentation

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

Reimplemented from DQMEDAnalyzer.

Definition at line 129 of file TauValidationMiniAOD.cc.

References HLT_FULL_cff::deltaR, HLT_FULL_cff::etaMap, edm::Event::getByToken(), reco::isTau(), dqmiolumiharvest::j, MuTauSkim_cff::selectionCut, metsig::tau, and HLT_FULL_cff::taus.

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

Implements DQMEDAnalyzer.

Definition at line 35 of file TauValidationMiniAOD.cc.

References dqm::implementation::IBooker::book1D(), HLT_FULL_cff::etaMap, dqmiolumiharvest::j, histoInfo::max, histoInfo::min, histoInfo::nbins, and dqm::implementation::NavigatorBase::setCurrentFolder().

37  {
38  MonitorElement *ptTemp, *etaTemp, *phiTemp, *massTemp, *decayModeFindingTemp, *decayModeTemp,
39  *byDeepTau2017v2p1VSerawTemp, *byDeepTau2017v2p1VSjetrawTemp, *byDeepTau2017v2p1VSmurawTemp, *summaryTemp;
40  ibooker.setCurrentFolder("RecoTauV/miniAODValidation" + extensionName_);
41 
42  //summary plots
43  histoInfo summaryHinfo = (histoSettings_.exists("summary"))
45  : histoInfo(21, -0.5, 20.5);
46  summaryTemp =
47  ibooker.book1D("summaryPlotNum", "summaryPlotNum", summaryHinfo.nbins, summaryHinfo.min, summaryHinfo.max);
48  summaryMap.insert(std::make_pair("Num", summaryTemp));
49  summaryTemp =
50  ibooker.book1D("summaryPlotDen", "summaryPlotDen", summaryHinfo.nbins, summaryHinfo.min, summaryHinfo.max);
51  summaryMap.insert(std::make_pair("Den", summaryTemp));
52  summaryTemp = ibooker.book1D("summaryPlot", "summaryPlot", summaryHinfo.nbins, summaryHinfo.min, summaryHinfo.max);
53  summaryMap.insert(std::make_pair("", summaryTemp));
54 
55  int j = 0;
56  for (const auto& it : discriminators_) {
57  string DiscriminatorLabel = it.getParameter<string>("discriminator");
58  summaryMap.find("Den")->second->setBinLabel(j + 1, DiscriminatorLabel);
59  summaryMap.find("Num")->second->setBinLabel(j + 1, DiscriminatorLabel);
60  summaryMap.find("")->second->setBinLabel(j + 1, DiscriminatorLabel);
61  j = j + 1;
62  }
63 
64  //other plots
66  : histoInfo(200, 0., 1000.);
68  : histoInfo(200, -3, 3.);
70  : histoInfo(200, -3, 3.);
71  histoInfo massHinfo = (histoSettings_.exists("mass"))
73  : histoInfo(200, 0, 10.);
74  histoInfo decayModeFindingHinfo = (histoSettings_.exists("decayModeFinding"))
76  : histoInfo(2, -0.5, 1.5);
77  histoInfo decayModeHinfo = (histoSettings_.exists("decayMode"))
79  : histoInfo(11, -0.5, 10.5);
80  histoInfo byDeepTau2017v2p1VSerawHinfo =
81  (histoSettings_.exists("byDeepTau2017v2p1VSeraw"))
82  ? histoInfo(histoSettings_.getParameter<edm::ParameterSet>("byDeepTau2017v2p1VSeraw"))
83  : histoInfo(200, 0., 1.);
84  histoInfo byDeepTau2017v2p1VSjetrawHinfo =
85  (histoSettings_.exists("byDeepTau2017v2p1VSjetraw"))
86  ? histoInfo(histoSettings_.getParameter<edm::ParameterSet>("byDeepTau2017v2p1VSjetraw"))
87  : histoInfo(200, 0., 1.);
88  histoInfo byDeepTau2017v2p1VSmurawHinfo =
89  (histoSettings_.exists("byDeepTau2017v2p1VSmuraw"))
90  ? histoInfo(histoSettings_.getParameter<edm::ParameterSet>("byDeepTau2017v2p1VSmuraw"))
91  : histoInfo(200, 0., 1.);
92  ptTemp = ibooker.book1D("tau_pt", "tau_pt", ptHinfo.nbins, ptHinfo.min, ptHinfo.max);
93  etaTemp = ibooker.book1D("tau_eta", "tau_eta", etaHinfo.nbins, etaHinfo.min, etaHinfo.max);
94  phiTemp = ibooker.book1D("tau_phi", "tau_phi", phiHinfo.nbins, phiHinfo.min, phiHinfo.max);
95  massTemp = ibooker.book1D("tau_mass", "tau_mass", massHinfo.nbins, massHinfo.min, massHinfo.max);
96  decayModeFindingTemp = ibooker.book1D("tau_decayModeFinding",
97  "tau_decayModeFinding",
98  decayModeFindingHinfo.nbins,
99  decayModeFindingHinfo.min,
100  decayModeFindingHinfo.max);
101  decayModeTemp =
102  ibooker.book1D("tau_decayMode", "tau_decayMode", decayModeHinfo.nbins, decayModeHinfo.min, decayModeHinfo.max);
103  byDeepTau2017v2p1VSerawTemp = ibooker.book1D("tau_byDeepTau2017v2p1VSeraw",
104  "tau_byDeepTau2017v2p1VSeraw",
105  byDeepTau2017v2p1VSerawHinfo.nbins,
106  byDeepTau2017v2p1VSerawHinfo.min,
107  byDeepTau2017v2p1VSerawHinfo.max);
108  byDeepTau2017v2p1VSjetrawTemp = ibooker.book1D("tau_byDeepTau2017v2p1VSjetraw",
109  "tau_byDeepTau2017v2p1VSjetraw",
110  byDeepTau2017v2p1VSjetrawHinfo.nbins,
111  byDeepTau2017v2p1VSjetrawHinfo.min,
112  byDeepTau2017v2p1VSjetrawHinfo.max);
113  byDeepTau2017v2p1VSmurawTemp = ibooker.book1D("tau_byDeepTau2017v2p1VSmuraw",
114  "tau_byDeepTau2017v2p1VSmuraw",
115  byDeepTau2017v2p1VSmurawHinfo.nbins,
116  byDeepTau2017v2p1VSmurawHinfo.min,
117  byDeepTau2017v2p1VSmurawHinfo.max);
118  ptMap.insert(std::make_pair("", ptTemp));
119  etaMap.insert(std::make_pair("", etaTemp));
120  phiMap.insert(std::make_pair("", phiTemp));
121  massMap.insert(std::make_pair("", massTemp));
122  decayModeFindingMap.insert(std::make_pair("", decayModeFindingTemp));
123  decayModeMap.insert(std::make_pair("", decayModeTemp));
124  byDeepTau2017v2p1VSerawMap.insert(std::make_pair("", byDeepTau2017v2p1VSerawTemp));
125  byDeepTau2017v2p1VSjetrawMap.insert(std::make_pair("", byDeepTau2017v2p1VSjetrawTemp));
126  byDeepTau2017v2p1VSmurawMap.insert(std::make_pair("", byDeepTau2017v2p1VSmurawTemp));
127 }
std::map< std::string, MonitorElement * > byDeepTau2017v2p1VSjetrawMap
std::map< std::string, MonitorElement * > decayModeMap
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
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 * > phiMap
edm::ParameterSet histoSettings_
std::map< std::string, MonitorElement * > summaryMap
std::vector< edm::ParameterSet > discriminators_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::map< std::string, MonitorElement * > byDeepTau2017v2p1VSerawMap
std::map< std::string, MonitorElement * > massMap
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
std::map< std::string, MonitorElement * > byDeepTau2017v2p1VSmurawMap
std::map< std::string, MonitorElement * > ptMap

Member Data Documentation

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

Definition at line 63 of file TauValidationMiniAOD.h.

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

Definition at line 63 of file TauValidationMiniAOD.h.

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

Definition at line 63 of file TauValidationMiniAOD.h.

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

Definition at line 63 of file TauValidationMiniAOD.h.

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

Definition at line 63 of file TauValidationMiniAOD.h.

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

Definition at line 67 of file TauValidationMiniAOD.h.

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

Definition at line 63 of file TauValidationMiniAOD.h.

std::string TauValidationMiniAOD::extensionName_
private

Definition at line 66 of file TauValidationMiniAOD.h.

edm::ParameterSet TauValidationMiniAOD::histoSettings_
private

Definition at line 65 of file TauValidationMiniAOD.h.

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

Definition at line 63 of file TauValidationMiniAOD.h.

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

Definition at line 63 of file TauValidationMiniAOD.h.

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

Definition at line 63 of file TauValidationMiniAOD.h.

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

Definition at line 62 of file TauValidationMiniAOD.h.

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

Definition at line 63 of file TauValidationMiniAOD.h.

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

Definition at line 61 of file TauValidationMiniAOD.h.