CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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)
 
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(), PFTauSelectorDefinition::DiscCutPair::inputTag, and AlCaHLTBitMon_QueryRunRegistry::string.

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

References selected_.

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

Definition at line 47 of file PFTauSelectorDefinition.h.

References selected_.

47 { 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_, edm::hlt::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.

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

Definition at line 86 of file PFTauSelectorDefinition.h.

References selected_.

86 { return selected_.size(); }

Member Data Documentation

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

Definition at line 91 of file PFTauSelectorDefinition.h.

Referenced by PFTauSelectorDefinition(), and select().

DiscCutPairVec PFTauSelectorDefinition::discriminators_
private

Definition at line 90 of file PFTauSelectorDefinition.h.

Referenced by PFTauSelectorDefinition(), and select().

container PFTauSelectorDefinition::selected_
private

Definition at line 89 of file PFTauSelectorDefinition.h.

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