CMS 3D CMS Logo

Classes | Public Types | Public Member Functions | Private Attributes

PFTauSelectorDefinition Struct Reference

#include <PFTauSelectorDefinition.h>

List of all members.

Classes

struct  TDiscCutPair

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
 ~PFTauSelectorDefinition ()

Private Attributes

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

Detailed Description

Definition at line 11 of file PFTauSelectorDefinition.h.


Member Typedef Documentation

Definition at line 13 of file PFTauSelectorDefinition.h.

typedef container::const_iterator PFTauSelectorDefinition::const_iterator

Definition at line 16 of file PFTauSelectorDefinition.h.

Definition at line 15 of file PFTauSelectorDefinition.h.

Definition at line 14 of file PFTauSelectorDefinition.h.

Definition at line 22 of file PFTauSelectorDefinition.h.


Constructor & Destructor Documentation

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

Definition at line 24 of file PFTauSelectorDefinition.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::PFTau>( cfg.getParameter<std::string>( "cut" ) ) : 0;
  }
PFTauSelectorDefinition::~PFTauSelectorDefinition ( ) [inline]

Definition at line 29 of file PFTauSelectorDefinition.h.

References cut_.

{ delete cut_; }

Member Function Documentation

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

Definition at line 31 of file PFTauSelectorDefinition.h.

References selected_.

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

Definition at line 33 of file PFTauSelectorDefinition.h.

References selected_.

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

Definition at line 35 of file PFTauSelectorDefinition.h.

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

  {

    selected_.clear();
    assert( hc.isValid() ); // collection of PFTaus

    // 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 PFTau 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 pftau = hc->begin();
          pftau != hc->end();
          ++pftau, ++key)
    {
      passedAllCuts = true;
      reco::PFTauRef pfTauRef(hc, key);

      //iterate over all discriminators, check the cuts
      for (TDiscCutPairVec::iterator discIt = discriminators.begin();
           discIt!=discriminators.end();
           ++discIt)
      {
        if ( (*(discIt->m_discHandle))[pfTauRef] <= discIt->m_cut)
          passedAllCuts = false;
      }

      if ( cut_ ) passedAllCuts &= (*cut_)(*pftau);

      if(passedAllCuts)
        selected_.push_back( new reco::PFTau(*pftau) );
    } // end collection iteration
  } // end select()
size_t PFTauSelectorDefinition::size ( void  ) const [inline]

Definition at line 87 of file PFTauSelectorDefinition.h.

References selected_.

{ return selected_.size(); }

Member Data Documentation

Definition at line 91 of file PFTauSelectorDefinition.h.

Referenced by PFTauSelectorDefinition(), and select().

Definition at line 90 of file PFTauSelectorDefinition.h.

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