CMS 3D CMS Logo

Public Member Functions | Private Attributes

helpers::MCTruthPairSelector< T > Struct Template Reference

#include <MCTruthPairSelector.h>

List of all members.

Public Member Functions

 MCTruthPairSelector (bool checkCharge=false)
template<typename I >
 MCTruthPairSelector (const I &begin, const I &end, bool checkCharge=false)
bool operator() (const T &c, const reco::Candidate &mc) const

Private Attributes

bool checkCharge_
std::set< int > matchIds_

Detailed Description

template<typename T>
struct helpers::MCTruthPairSelector< T >

Definition at line 14 of file MCTruthPairSelector.h.


Constructor & Destructor Documentation

template<typename T >
helpers::MCTruthPairSelector< T >::MCTruthPairSelector ( bool  checkCharge = false) [inline]

Definition at line 15 of file MCTruthPairSelector.h.

                                                    : 
      checkCharge_( checkCharge ) { }
template<typename T >
template<typename I >
helpers::MCTruthPairSelector< T >::MCTruthPairSelector ( const I &  begin,
const I &  end,
bool  checkCharge = false 
) [inline]

Definition at line 18 of file MCTruthPairSelector.h.

References abs, end, Exhume::I, i, and helpers::MCTruthPairSelector< T >::matchIds_.

                                                                                    :
      checkCharge_( checkCharge ) {
      for( I i = begin; i != end; ++i )
        matchIds_.insert( std::abs( * i ) );
    }

Member Function Documentation

template<typename T >
bool helpers::MCTruthPairSelector< T >::operator() ( const T c,
const reco::Candidate mc 
) const [inline]

Definition at line 23 of file MCTruthPairSelector.h.

References abs, reco::Candidate::charge(), helpers::MCTruthPairSelector< T >::checkCharge_, helpers::MCTruthPairSelector< T >::matchIds_, reco::Candidate::pdgId(), and reco::Candidate::status().

                                                                   {
      if ( mc.status() != 1 ) return false;
      if ( checkCharge_ && c.charge() != mc.charge() ) return false;
      if ( matchIds_.size() == 0 ) return true;
      return matchIds_.find( std::abs( mc.pdgId() ) ) != matchIds_.end();
    }

Member Data Documentation

template<typename T >
bool helpers::MCTruthPairSelector< T >::checkCharge_ [private]

Definition at line 31 of file MCTruthPairSelector.h.

Referenced by helpers::MCTruthPairSelector< T >::operator()().

template<typename T >
std::set<int> helpers::MCTruthPairSelector< T >::matchIds_ [private]