CMS 3D CMS Logo

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)
 
 ~RecoTauPlotDiscriminator () override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Types

typedef std::map< std::string, HistoMapDiscMap
 
typedef std::map< std::string, TH1 * > HistoMap
 
typedef std::vector< edm::InputTagVInputTag
 

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 &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- 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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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 32 of file RecoTauPlotDiscriminator.cc.

Member Typedef Documentation

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

Definition at line 40 of file RecoTauPlotDiscriminator.cc.

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

Definition at line 39 of file RecoTauPlotDiscriminator.cc.

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

Definition at line 41 of file RecoTauPlotDiscriminator.cc.

Constructor & Destructor Documentation

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

Definition at line 50 of file RecoTauPlotDiscriminator.cc.

References discs_, edm::ParameterSet::getParameter(), histos_, SiStripPI::max, min(), pileupCalc::nbins, pileupInfoSrc_, pileupPtCut_, pileupVerticesSrc_, plotPU_, AlCaHLTBitMon_QueryRunRegistry::string, and GlobalPosition_Frontier_DevDB_cff::tag.

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

Definition at line 35 of file RecoTauPlotDiscriminator.cc.

References analyze().

35 {}

Member Function Documentation

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

Definition at line 126 of file RecoTauPlotDiscriminator.cc.

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

Referenced by ~RecoTauPlotDiscriminator().

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

Member Data Documentation

VInputTag RecoTauPlotDiscriminator::discs_
private

Definition at line 42 of file RecoTauPlotDiscriminator.cc.

Referenced by analyze(), and RecoTauPlotDiscriminator().

DiscMap RecoTauPlotDiscriminator::histos_
private

Definition at line 47 of file RecoTauPlotDiscriminator.cc.

Referenced by analyze(), and RecoTauPlotDiscriminator().

edm::InputTag RecoTauPlotDiscriminator::pileupInfoSrc_
private

Definition at line 45 of file RecoTauPlotDiscriminator.cc.

Referenced by analyze(), and RecoTauPlotDiscriminator().

double RecoTauPlotDiscriminator::pileupPtCut_
private

Definition at line 44 of file RecoTauPlotDiscriminator.cc.

Referenced by analyze(), and RecoTauPlotDiscriminator().

edm::InputTag RecoTauPlotDiscriminator::pileupVerticesSrc_
private

Definition at line 46 of file RecoTauPlotDiscriminator.cc.

Referenced by analyze(), and RecoTauPlotDiscriminator().

bool RecoTauPlotDiscriminator::plotPU_
private

Definition at line 43 of file RecoTauPlotDiscriminator.cc.

Referenced by analyze(), and RecoTauPlotDiscriminator().

edm::InputTag RecoTauPlotDiscriminator::src_
private

Definition at line 38 of file RecoTauPlotDiscriminator.cc.

Referenced by analyze().