#include <RecoTauBinnedIsolationPlugin.h>
Public Member Functions | |
void | beginEvent () |
virtual reco::PFCandidateRefVector | extractIsoObjects (const reco::PFTauRef &tau) const =0 |
std::vector< double > | operator() (const reco::PFTauRef &tau) const |
RecoTauDiscriminationBinnedIsolation (const edm::ParameterSet &pset) | |
virtual | ~RecoTauDiscriminationBinnedIsolation () |
Private Attributes | |
std::map< int, std::vector < double > > | binning_ |
std::vector< double > | defaultBinning_ |
size_t | nVertices_ |
edm::InputTag | puVtxSrc_ |
Definition at line 24 of file RecoTauBinnedIsolationPlugin.h.
reco::tau::RecoTauDiscriminationBinnedIsolation::RecoTauDiscriminationBinnedIsolation | ( | const edm::ParameterSet & | pset | ) |
Definition at line 21 of file RecoTauBinnedIsolationPlugin.cc.
References ValidateTausOnRealData_cff::binning, binning_, defaultBinning_, Exception, edm::ParameterSet::getParameter(), and puVtxSrc_.
:RecoTauDiscriminantPlugin(pset) { puVtxSrc_ = pset.getParameter<edm::InputTag>("vtxSource"); // Configure the binning typedef std::vector<edm::ParameterSet> VPSet; VPSet binning = pset.getParameter<VPSet>("binning"); BOOST_FOREACH(const edm::ParameterSet& bincfg, binning) { std::vector<double> bins = bincfg.getParameter<std::vector<double> >( "binLowEdges"); int nVtx = bincfg.getParameter<int>("nPUVtx"); // Sanity checks // No double entries if (binning_.count(nVtx)) { throw cms::Exception("BadIsoBinVtxConfig") << "Multiple configuraions for" << " vertex multiplicity: " << nVtx << " have been entered!"; } // Bins are sorted if (!is_sorted(bins)) { throw cms::Exception("BadIsoBinConfig") << "The binning for vertex: " << nVtx << " is not in ascending order!"; } binning_[nVtx] = bins; } defaultBinning_ = pset.getParameter<std::vector<double> >("defaultBinning"); }
virtual reco::tau::RecoTauDiscriminationBinnedIsolation::~RecoTauDiscriminationBinnedIsolation | ( | ) | [inline, virtual] |
Definition at line 27 of file RecoTauBinnedIsolationPlugin.h.
{}
void reco::tau::RecoTauDiscriminationBinnedIsolation::beginEvent | ( | ) | [virtual] |
Reimplemented from reco::tau::RecoTauDiscriminantPlugin.
Definition at line 48 of file RecoTauBinnedIsolationPlugin.cc.
References reco::tau::RecoTauEventHolderPlugin::evt(), edm::Event::getByLabel(), nVertices_, and puVtxSrc_.
{ edm::Handle<reco::VertexCollection> vertices_; evt()->getByLabel(puVtxSrc_, vertices_); nVertices_ = vertices_->size(); }
virtual reco::PFCandidateRefVector reco::tau::RecoTauDiscriminationBinnedIsolation::extractIsoObjects | ( | const reco::PFTauRef & | tau | ) | const [pure virtual] |
Implemented in reco::tau::RecoTauDiscriminationBinnedIsolationImpl< Extractor >.
Referenced by operator()().
std::vector< double > reco::tau::RecoTauDiscriminationBinnedIsolation::operator() | ( | const reco::PFTauRef & | tau | ) | const [virtual] |
Implements reco::tau::RecoTauDiscriminantPlugin.
Definition at line 55 of file RecoTauBinnedIsolationPlugin.cc.
References binning_, defaultBinning_, Exception, extractIsoObjects(), NULL, nVertices_, and convertSQLitetoXML_cfg::output.
{ // Get the binning for this event std::map<int, std::vector<double> >::const_iterator binningIter = binning_.find(nVertices_); const std::vector<double>* bins = NULL; if (binningIter != binning_.end()) { bins = &(binningIter->second); } else { bins = &defaultBinning_; } if (!bins) { throw cms::Exception("NullBinning") << "The binning for nVtx: " << nVertices_ << " is null!"; } // Create our output spectrum std::vector<double> output(bins->size(), 0.0); // Get the desired isolation objects reco::PFCandidateRefVector isoObjects = extractIsoObjects(tau); // Loop over each and histogram their pt BOOST_FOREACH(const reco::PFCandidateRef& cand, isoObjects) { int highestBinLessThan = -1; for (size_t ibin = 0; ibin < bins->size(); ++ibin) { if (cand->pt() > bins->at(ibin)) { highestBinLessThan = ibin; } } if (highestBinLessThan >= 0) output[highestBinLessThan] += 1; } return output; }
std::map<int, std::vector<double> > reco::tau::RecoTauDiscriminationBinnedIsolation::binning_ [private] |
Definition at line 36 of file RecoTauBinnedIsolationPlugin.h.
Referenced by operator()(), and RecoTauDiscriminationBinnedIsolation().
std::vector<double> reco::tau::RecoTauDiscriminationBinnedIsolation::defaultBinning_ [private] |
Definition at line 37 of file RecoTauBinnedIsolationPlugin.h.
Referenced by operator()(), and RecoTauDiscriminationBinnedIsolation().
size_t reco::tau::RecoTauDiscriminationBinnedIsolation::nVertices_ [private] |
Definition at line 39 of file RecoTauBinnedIsolationPlugin.h.
Referenced by beginEvent(), and operator()().
Definition at line 40 of file RecoTauBinnedIsolationPlugin.h.
Referenced by beginEvent(), and RecoTauDiscriminationBinnedIsolation().