CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
helpers::MCTruthPairSelector< T > Struct Template Reference

#include <MCTruthPairSelector.h>

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
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 funct::abs(), end, Exhume::I, mps_fire::i, and helpers::MCTruthPairSelector< T >::matchIds_.

18  :
20  for( I i = begin; i != end; ++i )
21  matchIds_.insert( std::abs( * i ) );
22  }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const std::complex< double > I
Definition: I.h:8
#define end
Definition: vmac.h:37
#define begin
Definition: vmac.h:30

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 funct::abs(), reco::Candidate::charge(), helpers::MCTruthPairSelector< T >::checkCharge_, helpers::MCTruthPairSelector< T >::matchIds_, reco::Candidate::pdgId(), and reco::Candidate::status().

23  {
24  if ( mc.status() != 1 ) return false;
25  if ( checkCharge_ && c.charge() != mc.charge() ) return false;
26  if ( matchIds_.size() == 0 ) return true;
27  return matchIds_.find( std::abs( mc.pdgId() ) ) != matchIds_.end();
28  }
virtual int status() const =0
status word
virtual int pdgId() const =0
PDG identifier.
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
virtual int charge() const =0
electric charge

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