CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Private Attributes
PFTauSelectorDefinition Struct Reference

#include <PFTauSelectorDefinition.h>

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, edm::ConsumesCollector &&iC)
 
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 16 of file PFTauSelectorDefinition.h.

Member Typedef Documentation

Definition at line 18 of file PFTauSelectorDefinition.h.

typedef container::const_iterator PFTauSelectorDefinition::const_iterator

Definition at line 21 of file PFTauSelectorDefinition.h.

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

Definition at line 20 of file PFTauSelectorDefinition.h.

Definition at line 28 of file PFTauSelectorDefinition.h.

Definition at line 19 of file PFTauSelectorDefinition.h.

Constructor & Destructor Documentation

PFTauSelectorDefinition::PFTauSelectorDefinition ( const edm::ParameterSet cfg,
edm::ConsumesCollector &&  iC 
)
inline

Definition at line 30 of file PFTauSelectorDefinition.h.

References PFTauSelectorDefinition::DiscCutPair::cut, cut_, mvaPFMET_leptons_cfi::discriminators, discriminators_, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), PFTauSelectorDefinition::DiscCutPair::inputToken, muonDTDigis_cfi::pset, and AlCaHLTBitMon_QueryRunRegistry::string.

30  {
31  std::vector<edm::ParameterSet> discriminators =
32  cfg.getParameter<std::vector<edm::ParameterSet> >("discriminators");
33  // Build each of our cuts
34  BOOST_FOREACH(const edm::ParameterSet &pset, discriminators) {
35  DiscCutPair newCut;
36  newCut.inputToken = iC.consumes<reco::PFTauDiscriminator>(pset.getParameter<edm::InputTag>("discriminator"));
37  newCut.cut = pset.getParameter<double>("selectionCut");
38  discriminators_.push_back(newCut);
39  }
40 
41  // Build a string cut if desired
42  if (cfg.exists("cut")) {
44  cfg.getParameter<std::string>( "cut" )));
45  }
46  }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
bool exists(std::string const &parameterName) const
checks if a parameter exists
std::auto_ptr< StringCutObjectSelector< reco::PFTau > > cut_

Member Function Documentation

const_iterator PFTauSelectorDefinition::begin ( void  ) const
inline

Definition at line 48 of file PFTauSelectorDefinition.h.

References selected_.

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

Definition at line 49 of file PFTauSelectorDefinition.h.

References selected_.

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

Definition at line 51 of file PFTauSelectorDefinition.h.

References PFTauSelectorDefinition::DiscCutPair::cut, cut_, TtSemiLepEvtBuilder_cfi::disc, discriminators_, Exception, edm::Ref< C, T, F >::get(), edm::Event::getByToken(), PFTauSelectorDefinition::DiscCutPair::handle, edm::HandleBase::id(), PFTauSelectorDefinition::DiscCutPair::inputToken, edm::HandleBase::isValid(), TriggerAnalyzer::passed, selected_, and metsig::tau.

52  {
53  selected_.clear();
54 
55  if (!hc.isValid()) {
56  throw cms::Exception("PFTauSelectorBadHandle")
57  << "an invalid PFTau handle with ProductID"
58  << hc.id() << " passed to PFTauSelector.";
59  }
60 
61  // Load each discriminator
62  BOOST_FOREACH(DiscCutPair &disc, discriminators_) {
63  e.getByToken(disc.inputToken, disc.handle);
64  }
65 
66  const size_t nTaus = hc->size();
67  for (size_t iTau = 0; iTau < nTaus; ++iTau) {
68  bool passed = true;
69  reco::PFTauRef tau(hc, iTau);
70  // Check if it passed all the discrimiantors
71  BOOST_FOREACH(const DiscCutPair &disc, discriminators_) {
72  // Check this discriminator passes
73  if (!((*disc.handle)[tau] > disc.cut)) {
74  passed = false;
75  break;
76  }
77  }
78 
79  if (passed && cut_.get()) {
80  passed = (*cut_)(*tau);
81  }
82 
83  if (passed)
84  selected_.push_back(tau.get());
85  }
86  } // end select()
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
susybsm::HSCParticleCollection hc
Definition: classes.h:25
std::auto_ptr< StringCutObjectSelector< reco::PFTau > > cut_
size_t PFTauSelectorDefinition::size ( void  ) const
inline

Definition at line 88 of file PFTauSelectorDefinition.h.

References selected_.

Referenced by ntuple._Collection::__iter__(), and ntuple._Collection::__len__().

88 { return selected_.size(); }

Member Data Documentation

std::auto_ptr<StringCutObjectSelector<reco::PFTau> > PFTauSelectorDefinition::cut_
private

Definition at line 93 of file PFTauSelectorDefinition.h.

Referenced by PFTauSelectorDefinition(), and select().

DiscCutPairVec PFTauSelectorDefinition::discriminators_
private

Definition at line 92 of file PFTauSelectorDefinition.h.

Referenced by PFTauSelectorDefinition(), and select().

container PFTauSelectorDefinition::selected_
private

Definition at line 91 of file PFTauSelectorDefinition.h.

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