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 17 of file MCTruthPairSelector.h.

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

18  for (I i = begin; i != end; ++i)
19  matchIds_.insert(std::abs(*i));
20  }
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:39
#define begin
Definition: vmac.h:32

Member Function Documentation

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

Definition at line 21 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().

21  {
22  if (mc.status() != 1)
23  return false;
24  if (checkCharge_ && c.charge() != mc.charge())
25  return false;
26  if (matchIds_.empty())
27  return true;
28  return matchIds_.find(std::abs(mc.pdgId())) != matchIds_.end();
29  }
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 33 of file MCTruthPairSelector.h.

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

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