CMS 3D CMS Logo

Public Member Functions | Private Attributes

reco::tau::RecoTauDiscriminationBinnedIsolation Class Reference

#include <RecoTauBinnedIsolationPlugin.h>

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

List of all members.

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_

Detailed Description

Definition at line 24 of file RecoTauBinnedIsolationPlugin.h.


Constructor & Destructor Documentation

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.

{}

Member Function Documentation

void reco::tau::RecoTauDiscriminationBinnedIsolation::beginEvent ( ) [virtual]
virtual reco::PFCandidateRefVector reco::tau::RecoTauDiscriminationBinnedIsolation::extractIsoObjects ( const reco::PFTauRef tau) const [pure virtual]
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;
}

Member Data Documentation

std::map<int, std::vector<double> > reco::tau::RecoTauDiscriminationBinnedIsolation::binning_ [private]

Definition at line 39 of file RecoTauBinnedIsolationPlugin.h.

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