CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Types | Private Attributes
RecoTauPlotDiscriminator Class Reference
Inheritance diagram for RecoTauPlotDiscriminator:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &evt, const edm::EventSetup &es) override
 
 RecoTauPlotDiscriminator (const edm::ParameterSet &pset)
 
virtual ~RecoTauPlotDiscriminator ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Types

typedef std::map< std::string,
HistoMap
DiscMap
 
typedef std::map< std::string,
TH1 * > 
HistoMap
 
typedef std::vector
< edm::InputTag
VInputTag
 

Private Attributes

VInputTag discs_
 
DiscMap histos_
 
edm::InputTag pileupInfoSrc_
 
double pileupPtCut_
 
edm::InputTag pileupVerticesSrc_
 
bool plotPU_
 
edm::InputTag src_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 34 of file RecoTauPlotDiscriminator.cc.

Member Typedef Documentation

typedef std::map<std::string, HistoMap> RecoTauPlotDiscriminator::DiscMap
private

Definition at line 42 of file RecoTauPlotDiscriminator.cc.

typedef std::map<std::string, TH1*> RecoTauPlotDiscriminator::HistoMap
private

Definition at line 41 of file RecoTauPlotDiscriminator.cc.

typedef std::vector<edm::InputTag> RecoTauPlotDiscriminator::VInputTag
private

Definition at line 43 of file RecoTauPlotDiscriminator.cc.

Constructor & Destructor Documentation

RecoTauPlotDiscriminator::RecoTauPlotDiscriminator ( const edm::ParameterSet pset)

Definition at line 52 of file RecoTauPlotDiscriminator.cc.

References discs_, edm::ParameterSet::getParameter(), histos_, edm::InputTag::label(), bookConverter::max, min(), hlt_dqm_clientPB-live_cfg::nbins, pileupInfoSrc_, pileupPtCut_, pileupVerticesSrc_, plotPU_, AlCaHLTBitMon_QueryRunRegistry::string, and GlobalPosition_Frontier_DevDB_cff::tag.

53  :src_(pset.getParameter<edm::InputTag>("src")) {
54  uint32_t nbins = pset.getParameter<uint32_t>("nbins");
55  double min = pset.getParameter<double>("min");
56  double max = pset.getParameter<double>("max");
58  // Get the discriminators
59  discs_ = pset.getParameter<std::vector<edm::InputTag> >("discriminators");
60 
61  plotPU_ = pset.getParameter<bool>("plotPU");
62  if (plotPU_) {
63  pileupPtCut_ = pset.getParameter<double>("pileupTauPtCut");
64  pileupInfoSrc_ = pset.getParameter<edm::InputTag>("pileupInfo");
65  pileupVerticesSrc_ = pset.getParameter<edm::InputTag>("pileupVertices");
66  }
67 
68  BOOST_FOREACH(const edm::InputTag &tag, discs_) {
69  HistoMap discMap;
70  discMap["plain"] =
71  fs->make<TH1F>(tag.label().c_str(), tag.label().c_str(),
72  nbins, min, max);
73 
74  // Make correlation plots w.r.t tau pt
75  std::string vs_pt_name = tag.label()+"_pt";
76  discMap["vs_pt"] =
77  fs->make<TH2F>(vs_pt_name.c_str(), vs_pt_name.c_str(),
78  nbins, min, max, 100, 0, 200);
79 
80  // W.r.t. jet pt
81  std::string vs_jetpt_name = tag.label()+"_jetPt";
82  discMap["vs_jetPt"] =
83  fs->make<TH2F>(vs_jetpt_name.c_str(), vs_jetpt_name.c_str(),
84  nbins, min, max, 100, 0, 200);
85 
86  // W.r.t. embedded pt in alternat lorentz vector (used to hold gen tau pt)
87  std::string vs_embedpt_name = tag.label()+"_embedPt";
88  discMap["vs_embedPt"] =
89  fs->make<TH2F>(vs_embedpt_name.c_str(), vs_embedpt_name.c_str(),
90  nbins, min, max, 100, 0, 200);
91 
92  // 3D histogram with tau pt & jet pt
93  std::string vs_pt_jetPt_name = tag.label()+"_pt_jetPt";
94  discMap["vs_pt_jetPt"] =
95  fs->make<TH3F>(vs_pt_jetPt_name.c_str(), vs_pt_jetPt_name.c_str(),
96  nbins, min, max, 100, 0, 200, 100, 0, 200);
97 
98  std::string vs_pt_embedPt_name = tag.label()+"_pt_embedPt";
99  discMap["vs_pt_embedPt"] =
100  fs->make<TH3F>(vs_pt_embedPt_name.c_str(), vs_pt_embedPt_name.c_str(),
101  nbins, min, max, 100, 0, 200, 100, 0, 200);
102 
103 
104  std::string vs_eta_name = tag.label()+"_eta";
105  discMap["vs_eta"] =
106  fs->make<TH2F>(vs_eta_name.c_str(), vs_eta_name.c_str(),
107  nbins, min, max, 100, -2.5, 2.5);
108 
109  std::string vs_dm_name = tag.label()+"_dm";
110  discMap["vs_dm"] =
111  fs->make<TH2F>(vs_dm_name.c_str(), vs_dm_name.c_str(),
112  nbins, min, max, 15, -0.5, 14.5);
113 
114  if (plotPU_) {
115  std::string vs_truePU_name = tag.label()+"_truePU";
116  discMap["vs_truePU"] = fs->make<TH2F>(vs_truePU_name.c_str(),
117  vs_truePU_name.c_str(), nbins, min, max, 15, -0.5, 14.5);
118  std::string vs_recoPU_name = tag.label()+"_recoPU";
119  discMap["vs_recoPU"] = fs->make<TH2F>(vs_recoPU_name.c_str(),
120  vs_recoPU_name.c_str(), nbins, min, max, 15, -0.5, 14.5);
121  }
122 
123  histos_[tag.label()] = discMap;
124  }
125 }
T getParameter(std::string const &) const
T min(T a, T b)
Definition: MathUtil.h:58
std::map< std::string, TH1 * > HistoMap
std::string const & label() const
Definition: InputTag.h:36
virtual RecoTauPlotDiscriminator::~RecoTauPlotDiscriminator ( )
inlinevirtual

Definition at line 37 of file RecoTauPlotDiscriminator.cc.

37 {}

Member Function Documentation

void RecoTauPlotDiscriminator::analyze ( const edm::Event evt,
const edm::EventSetup es 
)
overridevirtual

Implements edm::EDAnalyzer.

Definition at line 128 of file RecoTauPlotDiscriminator.cc.

References discs_, HcalObjRepresent::Fill(), edm::Event::getByLabel(), histos_, input, edm::InputTag::label(), pileupInfoSrc_, pileupPtCut_, pileupVerticesSrc_, plotPU_, mps_fire::result, src_, GlobalPosition_Frontier_DevDB_cff::tag, and metsig::tau.

129  {
130  // Get the input collection to clean
132  evt.getByLabel(src_, input);
133 
134  // Cast the input candidates to Refs to real taus
135  reco::PFTauRefVector inputRefs =
136  reco::tau::castView<reco::PFTauRefVector>(input);
137 
140  if (plotPU_) {
141  evt.getByLabel(pileupInfoSrc_, puInfo);
142  evt.getByLabel(pileupVerticesSrc_, puVertices);
143  }
144 
145  // Plot the discriminator output for each of our taus
146  BOOST_FOREACH(const reco::PFTauRef& tau, inputRefs) {
147  // Plot each discriminator
148  BOOST_FOREACH(const edm::InputTag &tag, discs_) {
150  evt.getByLabel(tag, discHandle);
151  //const HistoMap &discHistos = disc.second;
152  double result = (*discHandle)[tau];
153  HistoMap& mymap = histos_[tag.label()];
154  mymap["plain"]->Fill(result);
155  mymap["vs_pt"]->Fill(result, tau->pt());
156  mymap["vs_jetPt"]->Fill(result, tau->jetRef()->pt());
157  mymap["vs_embedPt"]->Fill(result, tau->alternatLorentzVect().pt());
158  dynamic_cast<TH3F*>(mymap["vs_pt_jetPt"])->Fill(
159  result, tau->pt(), tau->jetRef()->pt());
160  dynamic_cast<TH3F*>(mymap["vs_pt_embedPt"])->Fill(
161  result, tau->pt(), tau->alternatLorentzVect().pt());
162  mymap["vs_eta"]->Fill(result, tau->eta());
163  mymap["vs_dm"]->Fill(result, tau->decayMode());
164  if (plotPU_ && tau->pt() > pileupPtCut_) {
165  if (puInfo.isValid())
166  mymap["vs_truePU"]->Fill(result, puInfo->getPU_NumInteractions());
167  mymap["vs_recoPU"]->Fill(result, puVertices->size());
168  }
169  }
170  }
171 }
static std::string const input
Definition: EdmProvDump.cc:44
tuple result
Definition: mps_fire.py:84
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:418
std::map< std::string, TH1 * > HistoMap
std::string const & label() const
Definition: InputTag.h:36

Member Data Documentation

VInputTag RecoTauPlotDiscriminator::discs_
private

Definition at line 44 of file RecoTauPlotDiscriminator.cc.

Referenced by analyze(), and RecoTauPlotDiscriminator().

DiscMap RecoTauPlotDiscriminator::histos_
private

Definition at line 49 of file RecoTauPlotDiscriminator.cc.

Referenced by analyze(), and RecoTauPlotDiscriminator().

edm::InputTag RecoTauPlotDiscriminator::pileupInfoSrc_
private

Definition at line 47 of file RecoTauPlotDiscriminator.cc.

Referenced by analyze(), and RecoTauPlotDiscriminator().

double RecoTauPlotDiscriminator::pileupPtCut_
private

Definition at line 46 of file RecoTauPlotDiscriminator.cc.

Referenced by analyze(), and RecoTauPlotDiscriminator().

edm::InputTag RecoTauPlotDiscriminator::pileupVerticesSrc_
private

Definition at line 48 of file RecoTauPlotDiscriminator.cc.

Referenced by analyze(), and RecoTauPlotDiscriminator().

bool RecoTauPlotDiscriminator::plotPU_
private

Definition at line 45 of file RecoTauPlotDiscriminator.cc.

Referenced by analyze(), and RecoTauPlotDiscriminator().

edm::InputTag RecoTauPlotDiscriminator::src_
private

Definition at line 40 of file RecoTauPlotDiscriminator.cc.

Referenced by analyze().