CMS 3D CMS Logo

Classes | Public Types | Public Member Functions | Private Attributes

PFTauSelectorDefinition Struct Reference

#include <PFTauSelectorDefinition.h>

List of all members.

Classes

struct  DiscCutPair

Public Types

typedef reco::PFTauCollection collection
typedef container::const_iterator const_iterator
typedef std::vector< const
reco::PFTau * > 
container
typedef std::vector< DiscCutPairDiscCutPairVec
typedef edm::Handle< collectionHandleToCollection

Public Member Functions

const_iterator begin () const
const_iterator end () const
 PFTauSelectorDefinition (const edm::ParameterSet &cfg)
void select (const HandleToCollection &hc, const edm::Event &e, const edm::EventSetup &s)
size_t size () const

Private Attributes

std::auto_ptr
< StringCutObjectSelector
< reco::PFTau > > 
cut_
DiscCutPairVec discriminators_
container selected_

Detailed Description

Definition at line 14 of file PFTauSelectorDefinition.h.


Member Typedef Documentation

Definition at line 16 of file PFTauSelectorDefinition.h.

typedef container::const_iterator PFTauSelectorDefinition::const_iterator

Definition at line 19 of file PFTauSelectorDefinition.h.

typedef std::vector< const reco::PFTau *> PFTauSelectorDefinition::container

Definition at line 18 of file PFTauSelectorDefinition.h.

Definition at line 26 of file PFTauSelectorDefinition.h.

Definition at line 17 of file PFTauSelectorDefinition.h.


Constructor & Destructor Documentation

PFTauSelectorDefinition::PFTauSelectorDefinition ( const edm::ParameterSet cfg) [inline]

Definition at line 28 of file PFTauSelectorDefinition.h.

References PFTauSelectorDefinition::DiscCutPair::cut, cut_, RecoTauValidation_cfi::discriminators, discriminators_, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), and PFTauSelectorDefinition::DiscCutPair::inputTag.

                                                       {
    std::vector<edm::ParameterSet> discriminators =
      cfg.getParameter<std::vector<edm::ParameterSet> >("discriminators");
    // Build each of our cuts
    BOOST_FOREACH(const edm::ParameterSet &pset, discriminators) {
      DiscCutPair newCut;
      newCut.inputTag = pset.getParameter<edm::InputTag>("discriminator");
      newCut.cut = pset.getParameter<double>("selectionCut");
      discriminators_.push_back(newCut);
    }

    // Build a string cut if desired
    if (cfg.exists("cut")) {
      cut_.reset(new StringCutObjectSelector<reco::PFTau>(
            cfg.getParameter<std::string>( "cut" )));
    }
  }

Member Function Documentation

const_iterator PFTauSelectorDefinition::begin ( void  ) const [inline]

Definition at line 46 of file PFTauSelectorDefinition.h.

References selected_.

{ return selected_.begin(); }
const_iterator PFTauSelectorDefinition::end ( void  ) const [inline]

Definition at line 47 of file PFTauSelectorDefinition.h.

References selected_.

{ return selected_.end(); }
void PFTauSelectorDefinition::select ( const HandleToCollection hc,
const edm::Event e,
const edm::EventSetup s 
) [inline]

Definition at line 49 of file PFTauSelectorDefinition.h.

References PFTauSelectorDefinition::DiscCutPair::cut, cut_, discriminators_, Exception, edm::Ref< C, T, F >::get(), edm::Event::getByLabel(), PFTauSelectorDefinition::DiscCutPair::handle, edm::HandleBase::id(), PFTauSelectorDefinition::DiscCutPair::inputTag, edm::HandleBase::isValid(), selected_, and metsig::tau.

                              {
    selected_.clear();

    if (!hc.isValid()) {
      throw cms::Exception("PFTauSelectorBadHandle")
        << "an invalid PFTau handle with ProductID"
        << hc.id() << " passed to PFTauSelector.";
    }

    // Load each discriminator
    BOOST_FOREACH(DiscCutPair &disc, discriminators_) {
      e.getByLabel(disc.inputTag, disc.handle);
    }

    const size_t nTaus = hc->size();
    for (size_t iTau = 0; iTau < nTaus; ++iTau) {
      bool passed = true;
      reco::PFTauRef tau(hc, iTau);
      // Check if it passed all the discrimiantors
      BOOST_FOREACH(const DiscCutPair &disc, discriminators_) {
        // Check this discriminator passes
        if (!(*disc.handle)[tau] > disc.cut) {
          passed = false;
          break;
        }
      }

      if (passed && cut_.get()) {
        passed = (*cut_)(*tau);
      }

      if (passed)
        selected_.push_back(tau.get());
    }
  } // end select()
size_t PFTauSelectorDefinition::size ( void  ) const [inline]

Definition at line 86 of file PFTauSelectorDefinition.h.

References selected_.

{ return selected_.size(); }

Member Data Documentation

Definition at line 91 of file PFTauSelectorDefinition.h.

Referenced by PFTauSelectorDefinition(), and select().

Definition at line 90 of file PFTauSelectorDefinition.h.

Referenced by PFTauSelectorDefinition(), and select().

Definition at line 89 of file PFTauSelectorDefinition.h.

Referenced by begin(), end(), select(), and size().