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 18 of file PFTauSelectorDefinition.h.

Member Typedef Documentation

Definition at line 20 of file PFTauSelectorDefinition.h.

typedef container::const_iterator PFTauSelectorDefinition::const_iterator

Definition at line 23 of file PFTauSelectorDefinition.h.

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

Definition at line 22 of file PFTauSelectorDefinition.h.

Definition at line 30 of file PFTauSelectorDefinition.h.

Definition at line 21 of file PFTauSelectorDefinition.h.

Constructor & Destructor Documentation

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

Definition at line 32 of file PFTauSelectorDefinition.h.

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

32  {
33  std::vector<edm::ParameterSet> discriminators =
34  cfg.getParameter<std::vector<edm::ParameterSet> >("discriminators");
35  // Build each of our cuts
36  BOOST_FOREACH(const edm::ParameterSet &pset, discriminators) {
37  DiscCutPair newCut;
38  newCut.inputToken = iC.consumes<reco::PFTauDiscriminator>(pset.getParameter<edm::InputTag>("discriminator"));
39  newCut.cut = pset.getParameter<double>("selectionCut");
40  discriminators_.push_back(newCut);
41  }
42 
43  // Build a string cut if desired
44  if (cfg.exists("cut")) {
46  cfg.getParameter<std::string>( "cut" )));
47  }
48  }
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 50 of file PFTauSelectorDefinition.h.

References selected_.

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

Definition at line 51 of file PFTauSelectorDefinition.h.

References selected_.

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

Definition at line 53 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.

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

Member Data Documentation

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

Definition at line 95 of file PFTauSelectorDefinition.h.

Referenced by PFTauSelectorDefinition(), and select().

DiscCutPairVec PFTauSelectorDefinition::discriminators_
private

Definition at line 94 of file PFTauSelectorDefinition.h.

Referenced by PFTauSelectorDefinition(), and select().

container PFTauSelectorDefinition::selected_
private

Definition at line 93 of file PFTauSelectorDefinition.h.

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