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

Definition at line 15 of file MCTruthPairSelector.h.

◆ 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.

18  for (I i = begin; i != end; ++i)
19  matchIds_.insert(std::abs(*i));
20  }

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

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.

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  }

References funct::abs(), HltBtagPostValidation_cff::c, helpers::MCTruthPairSelector< T >::checkCharge_, helpers::MCTruthPairSelector< T >::matchIds_, and CaloTowersParam_cfi::mc.

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
PA_ZEESkim_cff.checkCharge
checkCharge
Definition: PA_ZEESkim_cff.py:27
mps_fire.i
i
Definition: mps_fire.py:355
CaloTowersParam_cfi.mc
mc
Definition: CaloTowersParam_cfi.py:8
helpers::MCTruthPairSelector::matchIds_
std::set< int > matchIds_
Definition: MCTruthPairSelector.h:32
end
#define end
Definition: vmac.h:39
Exhume::I
const std::complex< double > I
Definition: I.h:8
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
helpers::MCTruthPairSelector::checkCharge_
bool checkCharge_
Definition: MCTruthPairSelector.h:33
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
begin
#define begin
Definition: vmac.h:32