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

◆ MCTruthPairSelector() [1/2]

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

◆ MCTruthPairSelector() [2/2]

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(), 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

Member Function Documentation

◆ operator()()

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(), c, helpers::MCTruthPairSelector< T >::checkCharge_, helpers::MCTruthPairSelector< T >::matchIds_, and CaloTowersParam_cfi::mc.

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  }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22

Member Data Documentation

◆ checkCharge_

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

Definition at line 33 of file MCTruthPairSelector.h.

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

◆ matchIds_

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