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::unique_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 17 of file PFTauSelectorDefinition.h.

typedef container::const_iterator PFTauSelectorDefinition::const_iterator

Definition at line 20 of file PFTauSelectorDefinition.h.

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

Definition at line 19 of file PFTauSelectorDefinition.h.

Definition at line 27 of file PFTauSelectorDefinition.h.

Definition at line 18 of file PFTauSelectorDefinition.h.

Constructor & Destructor Documentation

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

Definition at line 29 of file PFTauSelectorDefinition.h.

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

29  {
30  std::vector<edm::ParameterSet> discriminators = cfg.getParameter<std::vector<edm::ParameterSet> >("discriminators");
31  // Build each of our cuts
32  for (auto const& pset : discriminators) {
33  DiscCutPair newCut;
34  newCut.inputToken = iC.consumes<reco::PFTauDiscriminator>(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  }
43  }
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::unique_ptr< StringCutObjectSelector< reco::PFTau > > cut_

Member Function Documentation

const_iterator PFTauSelectorDefinition::begin ( void  ) const
inline

Definition at line 45 of file PFTauSelectorDefinition.h.

References selected_.

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

Definition at line 46 of file PFTauSelectorDefinition.h.

References selected_.

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

Definition at line 48 of file PFTauSelectorDefinition.h.

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

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

Member Data Documentation

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

Definition at line 88 of file PFTauSelectorDefinition.h.

Referenced by PFTauSelectorDefinition(), and select().

DiscCutPairVec PFTauSelectorDefinition::discriminators_
private

Definition at line 87 of file PFTauSelectorDefinition.h.

Referenced by PFTauSelectorDefinition(), and select().

container PFTauSelectorDefinition::selected_
private

Definition at line 86 of file PFTauSelectorDefinition.h.

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