CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
reco::tau::RecoTauDiscriminationBinnedIsolation Class Referenceabstract

#include <RecoTauBinnedIsolationPlugin.h>

Inheritance diagram for reco::tau::RecoTauDiscriminationBinnedIsolation:
reco::tau::RecoTauDiscriminantPlugin reco::tau::RecoTauEventHolderPlugin reco::tau::RecoTauNamedPlugin reco::tau::RecoTauDiscriminationBinnedIsolationImpl< Extractor >

Public Member Functions

void beginEvent () override
 
virtual std::vector< reco::CandidatePtrextractIsoObjects (const reco::PFTauRef &tau) const =0
 
std::vector< double > operator() (const reco::PFTauRef &tau) const override
 
 RecoTauDiscriminationBinnedIsolation (const edm::ParameterSet &pset)
 
 ~RecoTauDiscriminationBinnedIsolation () override
 
- Public Member Functions inherited from reco::tau::RecoTauDiscriminantPlugin
void beginEvent () override
 
 RecoTauDiscriminantPlugin (const edm::ParameterSet &pset)
 
 ~RecoTauDiscriminantPlugin () override
 
- Public Member Functions inherited from reco::tau::RecoTauEventHolderPlugin
const edm::Eventevt () const
 
edm::Eventevt ()
 
const edm::EventSetupevtSetup () const
 
 RecoTauEventHolderPlugin (const edm::ParameterSet &pset)
 
void setup (edm::Event &, const edm::EventSetup &)
 
 ~RecoTauEventHolderPlugin () override
 
- Public Member Functions inherited from reco::tau::RecoTauNamedPlugin
const std::string & name () const
 
 RecoTauNamedPlugin (const edm::ParameterSet &pset)
 
virtual ~RecoTauNamedPlugin ()
 

Private Attributes

std::map< int, std::vector< double > > binning_
 
std::vector< double > defaultBinning_
 
size_t nVertices_
 
edm::InputTag puVtxSrc_
 

Detailed Description

Definition at line 24 of file RecoTauBinnedIsolationPlugin.h.

Constructor & Destructor Documentation

reco::tau::RecoTauDiscriminationBinnedIsolation::RecoTauDiscriminationBinnedIsolation ( const edm::ParameterSet pset)

Definition at line 20 of file RecoTauBinnedIsolationPlugin.cc.

References RecoTauDiscriminantConfiguration::binning, binning_, create_public_pileup_plots::bins, defaultBinning_, Exception, edm::ParameterSet::getParameter(), puVtxSrc_, and HistogramManager_cfi::VPSet().

22  puVtxSrc_ = pset.getParameter<edm::InputTag>("vtxSource");
23  // Configure the binning
24  typedef std::vector<edm::ParameterSet> VPSet;
25  VPSet binning = pset.getParameter<VPSet>("binning");
26  for(auto const& bincfg : binning) {
27  std::vector<double> bins = bincfg.getParameter<std::vector<double> >(
28  "binLowEdges");
29  int nVtx = bincfg.getParameter<int>("nPUVtx");
30  // Sanity checks
31  // No double entries
32  if (binning_.count(nVtx)) {
33  throw cms::Exception("BadIsoBinVtxConfig") << "Multiple configuraions for"
34  << " vertex multiplicity: " << nVtx << " have been entered!";
35  }
36  // Bins are sorted
37  if (!is_sorted(bins)) {
38  throw cms::Exception("BadIsoBinConfig") << "The binning for vertex: "
39  << nVtx << " is not in ascending order!";
40  }
41  binning_[nVtx] = bins;
42  }
43  defaultBinning_ = pset.getParameter<std::vector<double> >("defaultBinning");
44 }
T getParameter(std::string const &) const
RecoTauDiscriminantPlugin(const edm::ParameterSet &pset)
reco::tau::RecoTauDiscriminationBinnedIsolation::~RecoTauDiscriminationBinnedIsolation ( )
inlineoverride

Definition at line 27 of file RecoTauBinnedIsolationPlugin.h.

References beginEvent(), extractIsoObjects(), operator()(), and metsig::tau.

27 {}

Member Function Documentation

void reco::tau::RecoTauDiscriminationBinnedIsolation::beginEvent ( )
overridevirtual
virtual std::vector<reco::CandidatePtr> reco::tau::RecoTauDiscriminationBinnedIsolation::extractIsoObjects ( const reco::PFTauRef tau) const
pure virtual
std::vector< double > reco::tau::RecoTauDiscriminationBinnedIsolation::operator() ( const reco::PFTauRef tau) const
overridevirtual

Implements reco::tau::RecoTauDiscriminantPlugin.

Definition at line 54 of file RecoTauBinnedIsolationPlugin.cc.

References binning_, create_public_pileup_plots::bins, defaultBinning_, Exception, extractIsoObjects(), nVertices_, and convertSQLitetoXML_cfg::output.

Referenced by ~RecoTauDiscriminationBinnedIsolation().

55  {
56  // Get the binning for this event
57  std::map<int, std::vector<double> >::const_iterator binningIter =
58  binning_.find(nVertices_);
59 
60  const std::vector<double>* bins = nullptr;
61  if (binningIter != binning_.end()) {
62  bins = &(binningIter->second);
63  } else {
64  bins = &defaultBinning_;
65  }
66 
67  if (!bins) {
68  throw cms::Exception("NullBinning")
69  << "The binning for nVtx: " << nVertices_ << " is null!";
70  }
71 
72  // Create our output spectrum
73  std::vector<double> output(bins->size(), 0.0);
74  // Get the desired isolation objects
75  std::vector<reco::CandidatePtr> isoObjects = extractIsoObjects(tau);
76  // Loop over each and histogram their pt
77  for(auto const& cand : isoObjects) {
78  int highestBinLessThan = -1;
79  for (size_t ibin = 0; ibin < bins->size(); ++ibin) {
80  if (cand->pt() > bins->at(ibin)) {
81  highestBinLessThan = ibin;
82  }
83  }
84  if (highestBinLessThan >= 0)
85  output[highestBinLessThan] += 1;
86  }
87  return output;
88 }
virtual std::vector< reco::CandidatePtr > extractIsoObjects(const reco::PFTauRef &tau) const =0

Member Data Documentation

std::map<int, std::vector<double> > reco::tau::RecoTauDiscriminationBinnedIsolation::binning_
private
std::vector<double> reco::tau::RecoTauDiscriminationBinnedIsolation::defaultBinning_
private
size_t reco::tau::RecoTauDiscriminationBinnedIsolation::nVertices_
private

Definition at line 39 of file RecoTauBinnedIsolationPlugin.h.

Referenced by beginEvent(), and operator()().

edm::InputTag reco::tau::RecoTauDiscriminationBinnedIsolation::puVtxSrc_
private