CMS 3D CMS Logo

PFTauSelectorDefinition Struct Reference

#include <RecoTauTag/TauTagTools/plugins/PFTauSelectorDefinition.h>

List of all members.

Public Types

typedef reco::PFTauCollection collection
typedef container::const_iterator const_iterator
typedef std::vector
< reco::PFTau * > 
container
typedef edm::Handle< collectionHandleToCollection
typedef std::vector< TDiscCutPairTDiscCutPairVec

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::vector< edm::ParameterSetdiscriminators_
container selected_

Classes

struct  TDiscCutPair


Detailed Description

Definition at line 9 of file PFTauSelectorDefinition.h.


Member Typedef Documentation

typedef reco::PFTauCollection PFTauSelectorDefinition::collection

Definition at line 11 of file PFTauSelectorDefinition.h.

typedef container::const_iterator PFTauSelectorDefinition::const_iterator

Definition at line 14 of file PFTauSelectorDefinition.h.

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

Definition at line 13 of file PFTauSelectorDefinition.h.

typedef edm::Handle< collection > PFTauSelectorDefinition::HandleToCollection

Definition at line 12 of file PFTauSelectorDefinition.h.

typedef std::vector<TDiscCutPair> PFTauSelectorDefinition::TDiscCutPairVec

Definition at line 20 of file PFTauSelectorDefinition.h.


Constructor & Destructor Documentation

PFTauSelectorDefinition::PFTauSelectorDefinition ( const edm::ParameterSet cfg  )  [inline]

Definition at line 22 of file PFTauSelectorDefinition.h.

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

00022                                                           {
00023     discriminators_ = cfg.getParameter< std::vector<edm::ParameterSet> >( "discriminators" ); 
00024   }


Member Function Documentation

const_iterator PFTauSelectorDefinition::begin ( void   )  const [inline]

Definition at line 26 of file PFTauSelectorDefinition.h.

References selected_.

00026 { return selected_.begin(); }

const_iterator PFTauSelectorDefinition::end ( void   )  const [inline]

Definition at line 28 of file PFTauSelectorDefinition.h.

References selected_.

00028 { return selected_.end(); }

void PFTauSelectorDefinition::select ( const HandleToCollection hc,
const edm::Event e,
const edm::EventSetup s 
) [inline]

Definition at line 30 of file PFTauSelectorDefinition.h.

References discriminators_, edm::Event::getByLabel(), edm::Handle< T >::isValid(), it, getDQMSummary::key, PFTauSelectorDefinition::TDiscCutPair::m_cut, PFTauSelectorDefinition::TDiscCutPair::m_discHandle, and selected_.

00033   {
00034            
00035     selected_.clear();
00036     assert( hc.isValid() ); // collection of PFTaus
00037     
00038     // get discriminators and coresponding cuts from stored vpset
00039     static TDiscCutPairVec discriminators;
00040     discriminators.clear();
00041     
00042     for(std::vector< edm::ParameterSet >::iterator it = discriminators_.begin(); 
00043         it != discriminators_.end();
00044         ++it)
00045     {
00046       TDiscCutPair disc;
00047       // get discriminator, check if valid
00048       // assert isn't a good method to do it
00049       if(!(e.getByLabel( it->getParameter<edm::InputTag>("discriminator"), disc.m_discHandle))) assert(0);
00050       disc.m_cut = it->getParameter<double>("selectionCut");
00051       // the discriminator collection and the PFTau collection
00052       // must have the same size
00053       assert( disc.m_discHandle->size() ==  hc->size());
00054       discriminators.push_back(disc);
00055     }
00056       
00057 
00058     unsigned key=0;
00059     static bool passedAllCuts;
00060     for( collection::const_iterator pftau = hc->begin(); 
00061           pftau != hc->end();
00062           ++pftau, ++key) 
00063     {
00064       passedAllCuts = true;
00065       reco::PFTauRef pfTauRef(hc, key);
00066       
00067       //iterate over all discriminators, check the cuts
00068       for (TDiscCutPairVec::iterator discIt = discriminators.begin();
00069            discIt!=discriminators.end();
00070            ++discIt)
00071       {
00072         if ( (*(discIt->m_discHandle))[pfTauRef] <= discIt->m_cut)
00073           passedAllCuts = false;
00074       }
00075       
00076          
00077       if(passedAllCuts)
00078         selected_.push_back( new reco::PFTau(*pftau) );
00079     } // end collection iteration
00080   } // end select()

size_t PFTauSelectorDefinition::size ( void   )  const [inline]

Definition at line 82 of file PFTauSelectorDefinition.h.

References selected_.

00082 { return selected_.size(); }


Member Data Documentation

std::vector< edm::ParameterSet > PFTauSelectorDefinition::discriminators_ [private]

Definition at line 86 of file PFTauSelectorDefinition.h.

Referenced by PFTauSelectorDefinition(), and select().

container PFTauSelectorDefinition::selected_ [private]

Definition at line 85 of file PFTauSelectorDefinition.h.

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


The documentation for this struct was generated from the following file:
Generated on Tue Jun 9 18:29:49 2009 for CMSSW by  doxygen 1.5.4