#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< collection > | HandleToCollection |
typedef std::vector< TDiscCutPair > | TDiscCutPairVec |
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::ParameterSet > | discriminators_ |
container | selected_ |
Definition at line 11 of file CaloTauSelectorDefinition.h.
Definition at line 13 of file CaloTauSelectorDefinition.h.
typedef container::const_iterator CaloTauSelectorDefinition::const_iterator |
Definition at line 16 of file CaloTauSelectorDefinition.h.
typedef std::vector< reco::CaloTau *> CaloTauSelectorDefinition::container |
Definition at line 15 of file CaloTauSelectorDefinition.h.
Definition at line 14 of file CaloTauSelectorDefinition.h.
typedef std::vector<TDiscCutPair> CaloTauSelectorDefinition::TDiscCutPairVec |
Definition at line 22 of file CaloTauSelectorDefinition.h.
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().
{ discriminators_ = cfg.getParameter< std::vector<edm::ParameterSet> >( "discriminators" ); cut_ = ( cfg.exists("cut") ) ? new StringCutObjectSelector<reco::CaloTau>( cfg.getParameter<std::string>( "cut" ) ) : 0; }
CaloTauSelectorDefinition::~CaloTauSelectorDefinition | ( | ) | [inline] |
const_iterator CaloTauSelectorDefinition::begin | ( | void | ) | const [inline] |
Definition at line 31 of file CaloTauSelectorDefinition.h.
References selected_.
{ return selected_.begin(); }
const_iterator CaloTauSelectorDefinition::end | ( | void | ) | const [inline] |
Definition at line 33 of file CaloTauSelectorDefinition.h.
References selected_.
{ 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_, discriminators_, edm::Event::getByLabel(), edm::HandleBase::isValid(), combine::key, CaloTauSelectorDefinition::TDiscCutPair::m_cut, CaloTauSelectorDefinition::TDiscCutPair::m_discHandle, and selected_.
{ selected_.clear(); assert( hc.isValid() ); // collection of CaloTaus // get discriminators and coresponding cuts from stored vpset static TDiscCutPairVec discriminators; discriminators.clear(); for(std::vector< edm::ParameterSet >::iterator it = discriminators_.begin(); it != discriminators_.end(); ++it) { TDiscCutPair disc; // get discriminator, check if valid // assert isn't a good method to do it if(!(e.getByLabel( it->getParameter<edm::InputTag>("discriminator"), disc.m_discHandle))) assert(0); disc.m_cut = it->getParameter<double>("selectionCut"); // the discriminator collection and the CaloTau collection // must have the same size assert( disc.m_discHandle->size() == hc->size()); discriminators.push_back(disc); } unsigned key=0; static bool passedAllCuts; for( collection::const_iterator calotau = hc->begin(); calotau != hc->end(); ++calotau, ++key) { passedAllCuts = true; reco::CaloTauRef calotauRef(hc, key); //iterate over all discriminators, check the cuts for (TDiscCutPairVec::iterator discIt = discriminators.begin(); discIt!=discriminators.end(); ++discIt) { if ( (*(discIt->m_discHandle))[calotauRef] <= discIt->m_cut) passedAllCuts = false; } if ( cut_ ) passedAllCuts &= (*cut_)(*calotau); if(passedAllCuts) selected_.push_back( new reco::CaloTau(*calotau) ); } // end collection iteration } // end select()
size_t CaloTauSelectorDefinition::size | ( | void | ) | const [inline] |
Definition at line 87 of file CaloTauSelectorDefinition.h.
References selected_.
{ return selected_.size(); }
Definition at line 92 of file CaloTauSelectorDefinition.h.
Referenced by CaloTauSelectorDefinition(), select(), and ~CaloTauSelectorDefinition().
std::vector< edm::ParameterSet > CaloTauSelectorDefinition::discriminators_ [private] |
Definition at line 91 of file CaloTauSelectorDefinition.h.
Referenced by CaloTauSelectorDefinition(), and select().