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
CaloTauSelectorDefinition Struct Reference

#include <CaloTauSelectorDefinition.h>

Classes

struct  TDiscCutPair
 

Public Types

typedef reco::CaloTauCollection collection
 
typedef container::const_iterator const_iterator
 
typedef std::vector
< reco::CaloTau * > 
container
 
typedef edm::Handle< collectionHandleToCollection
 
typedef std::vector< TDiscCutPairTDiscCutPairVec
 

Public Member Functions

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

Private Attributes

StringCutObjectSelector
< reco::CaloTau > * 
cut_
 
std::vector< edm::ParameterSetdiscriminators_
 
container selected_
 

Detailed Description

Definition at line 11 of file CaloTauSelectorDefinition.h.

Member Typedef Documentation

Definition at line 13 of file CaloTauSelectorDefinition.h.

typedef container::const_iterator CaloTauSelectorDefinition::const_iterator

Definition at line 16 of file CaloTauSelectorDefinition.h.

Definition at line 15 of file CaloTauSelectorDefinition.h.

Definition at line 14 of file CaloTauSelectorDefinition.h.

Definition at line 22 of file CaloTauSelectorDefinition.h.

Constructor & Destructor Documentation

CaloTauSelectorDefinition::CaloTauSelectorDefinition ( const edm::ParameterSet cfg)
inline

Definition at line 24 of file CaloTauSelectorDefinition.h.

References cut_, discriminators_, edm::ParameterSet::exists(), and edm::ParameterSet::getParameter().

24  {
25  discriminators_ = cfg.getParameter< std::vector<edm::ParameterSet> >( "discriminators" );
26  cut_ = ( cfg.exists("cut") ) ? new StringCutObjectSelector<reco::CaloTau>( cfg.getParameter<std::string>( "cut" ) ) : 0;
27  }
T getParameter(std::string const &) const
std::vector< edm::ParameterSet > discriminators_
bool exists(std::string const &parameterName) const
checks if a parameter exists
StringCutObjectSelector< reco::CaloTau > * cut_
CaloTauSelectorDefinition::~CaloTauSelectorDefinition ( )
inline

Definition at line 29 of file CaloTauSelectorDefinition.h.

References cut_.

29 { delete cut_; }
StringCutObjectSelector< reco::CaloTau > * cut_

Member Function Documentation

const_iterator CaloTauSelectorDefinition::begin ( void  ) const
inline

Definition at line 31 of file CaloTauSelectorDefinition.h.

References selected_.

31 { return selected_.begin(); }
const_iterator CaloTauSelectorDefinition::end ( void  ) const
inline

Definition at line 33 of file CaloTauSelectorDefinition.h.

References selected_.

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

Definition at line 35 of file CaloTauSelectorDefinition.h.

References cut_, RecoTauValidation_cfi::discriminators, discriminators_, edm::Event::getByLabel(), edm::HandleBase::isValid(), combine::key, CaloTauSelectorDefinition::TDiscCutPair::m_cut, CaloTauSelectorDefinition::TDiscCutPair::m_discHandle, and selected_.

38  {
39 
40  selected_.clear();
41  assert( hc.isValid() ); // collection of CaloTaus
42 
43  // get discriminators and coresponding cuts from stored vpset
45  discriminators.clear();
46 
47  for(std::vector< edm::ParameterSet >::iterator it = discriminators_.begin();
48  it != discriminators_.end();
49  ++it)
50  {
51  TDiscCutPair disc;
52  // get discriminator, check if valid
53  // assert isn't a good method to do it
54  if(!(e.getByLabel( it->getParameter<edm::InputTag>("discriminator"), disc.m_discHandle))) assert(0);
55  disc.m_cut = it->getParameter<double>("selectionCut");
56  // the discriminator collection and the CaloTau collection
57  // must have the same size
58  assert( disc.m_discHandle->size() == hc->size());
59  discriminators.push_back(disc);
60  }
61 
62  unsigned key=0;
63  static bool passedAllCuts;
64  for( collection::const_iterator calotau = hc->begin();
65  calotau != hc->end();
66  ++calotau, ++key)
67  {
68  passedAllCuts = true;
69  reco::CaloTauRef calotauRef(hc, key);
70 
71  //iterate over all discriminators, check the cuts
72  for (TDiscCutPairVec::iterator discIt = discriminators.begin();
73  discIt!=discriminators.end();
74  ++discIt)
75  {
76  if ( (*(discIt->m_discHandle))[calotauRef] <= discIt->m_cut)
77  passedAllCuts = false;
78  }
79 
80  if ( cut_ ) passedAllCuts &= (*cut_)(*calotau);
81 
82  if(passedAllCuts)
83  selected_.push_back( new reco::CaloTau(*calotau) );
84  } // end collection iteration
85  } // end select()
std::vector< edm::ParameterSet > discriminators_
StringCutObjectSelector< reco::CaloTau > * cut_
std::vector< TDiscCutPair > TDiscCutPairVec
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
list key
Definition: combine.py:13
size_t CaloTauSelectorDefinition::size ( void  ) const
inline

Definition at line 87 of file CaloTauSelectorDefinition.h.

References selected_.

87 { return selected_.size(); }

Member Data Documentation

StringCutObjectSelector<reco::CaloTau>* CaloTauSelectorDefinition::cut_
private
std::vector< edm::ParameterSet > CaloTauSelectorDefinition::discriminators_
private

Definition at line 91 of file CaloTauSelectorDefinition.h.

Referenced by CaloTauSelectorDefinition(), and select().

container CaloTauSelectorDefinition::selected_
private

Definition at line 90 of file CaloTauSelectorDefinition.h.

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