CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
reco::MCMatchSelector< T1, T2 > Class Template Reference

#include <MCMatchSelector.h>

Public Member Functions

 MCMatchSelector (const edm::ParameterSet &cfg)
 
 MCMatchSelector (const edm::ParameterSet &cfg)
 
bool operator() (const T1 &c, const T2 &mc) const
 true if match is possible More...
 
bool operator() (const T1 &c, const T2 &mc) const
 true if match is possible More...
 

Private Attributes

bool checkCharge_
 
std::set< int > ids_
 
std::set< int > status_
 

Detailed Description

template<typename T1, typename T2>
class reco::MCMatchSelector< T1, T2 >

Definition at line 14 of file MCMatchSelector.h.

Constructor & Destructor Documentation

◆ MCMatchSelector() [1/2]

template<typename T1 , typename T2 >
reco::MCMatchSelector< T1, T2 >::MCMatchSelector ( const edm::ParameterSet cfg)
inline

Definition at line 16 of file MCMatchSelector.h.

16  : checkCharge_(cfg.getParameter<bool>("checkCharge")) {
17  std::vector<int> ids = cfg.getParameter<std::vector<int> >("mcPdgId");
18  for (std::vector<int>::const_iterator i = ids.begin(); i != ids.end(); ++i)
19  ids_.insert(*i);
20  std::vector<int> status = cfg.getParameter<std::vector<int> >("mcStatus");
21  for (std::vector<int>::const_iterator i = status.begin(); i != status.end(); ++i)
22  status_.insert(*i);
23  }

References looper::cfg, mps_fire::i, reco::MCMatchSelector< T1, T2 >::ids_, mps_update::status, and reco::MCMatchSelector< T1, T2 >::status_.

◆ MCMatchSelector() [2/2]

template<typename T1 , typename T2 >
reco::MCMatchSelector< T1, T2 >::MCMatchSelector ( const edm::ParameterSet cfg)
inline

Definition at line 16 of file MCMatchSelector.h.

16  :
17  checkCharge_(cfg.getParameter<bool>("checkCharge")) {
18  std::vector<int> ids =
19  cfg.getParameter< std::vector<int> >("mcPdgId");
20  for ( std::vector<int>::const_iterator i=ids.begin();
21  i!=ids.end(); ++i ) ids_.insert(*i);
22  std::vector<int> status =
23  cfg.getParameter< std::vector<int> >("mcStatus");
24  for ( std::vector<int>::const_iterator i=status.begin();
25  i!=status.end(); ++i ) status_.insert(*i);
26  }

References looper::cfg, mps_fire::i, reco::MCMatchSelector< T1, T2 >::ids_, mps_update::status, and reco::MCMatchSelector< T1, T2 >::status_.

Member Function Documentation

◆ operator()() [1/2]

template<typename T1 , typename T2 >
bool reco::MCMatchSelector< T1, T2 >::operator() ( const T1 &  c,
const T2 &  mc 
) const
inline

true if match is possible

Definition at line 25 of file MCMatchSelector.h.

25  {
26  if (checkCharge_ && c.charge() != mc.charge())
27  return false;
28  if (!ids_.empty()) {
29  if (ids_.find(abs(mc.pdgId())) == ids_.end())
30  return false;
31  }
32  if (status_.empty())
33  return true;
34  return status_.find(mc.status()) != status_.end();
35  }

References funct::abs(), c, reco::MCMatchSelector< T1, T2 >::checkCharge_, reco::MCMatchSelector< T1, T2 >::ids_, CaloTowersParam_cfi::mc, and reco::MCMatchSelector< T1, T2 >::status_.

◆ operator()() [2/2]

template<typename T1 , typename T2 >
bool reco::MCMatchSelector< T1, T2 >::operator() ( const T1 &  c,
const T2 &  mc 
) const
inline

true if match is possible

Definition at line 28 of file MCMatchSelector.h.

28  {
29  if ( checkCharge_ && c.charge() != mc.charge() ) return false;
30  if ( !ids_.empty() ) {
31  if ( ids_.find(abs(mc.pdgId()))==ids_.end() ) return false;
32  }
33  if ( status_.empty() ) return true;
34  return status_.find(mc.status())!=status_.end();
35  }

References funct::abs(), c, reco::MCMatchSelector< T1, T2 >::checkCharge_, reco::MCMatchSelector< T1, T2 >::ids_, CaloTowersParam_cfi::mc, and reco::MCMatchSelector< T1, T2 >::status_.

Member Data Documentation

◆ checkCharge_

template<typename T1 , typename T2 >
bool reco::MCMatchSelector< T1, T2 >::checkCharge_
private

Definition at line 38 of file MCMatchSelector.h.

Referenced by reco::MCMatchSelector< T1, T2 >::operator()().

◆ ids_

template<typename T1 , typename T2 >
std::set< int > reco::MCMatchSelector< T1, T2 >::ids_
private

◆ status_

template<typename T1 , typename T2 >
std::set< int > reco::MCMatchSelector< T1, T2 >::status_
private
mps_fire.i
i
Definition: mps_fire.py:428
CaloTowersParam_cfi.mc
mc
Definition: CaloTowersParam_cfi.py:8
mps_update.status
status
Definition: mps_update.py:68
reco::MCMatchSelector::checkCharge_
bool checkCharge_
Definition: MCMatchSelector.h:38
reco::MCMatchSelector::ids_
std::set< int > ids_
Definition: MCMatchSelector.h:39
reco::MCMatchSelector::status_
std::set< int > status_
Definition: MCMatchSelector.h:40
looper.cfg
cfg
Definition: looper.py:296
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:56