CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
GenParticleCustomSelector Class Reference

#include <GenParticleCustomSelector.h>

Public Member Functions

 GenParticleCustomSelector ()
 
 GenParticleCustomSelector (double ptMin, double minRapidity, double maxRapidity, double tip, double lip, bool chargedOnly, int status, const std::vector< int > &pdgId=std::vector< int >(), bool invertRapidityCut=false, double minPhi=-3.2, double maxPhi=3.2)
 
bool operator() (const reco::GenParticle &tp) const
 Operator() performs the selection: e.g. if (tPSelector(tp)) {...}. More...
 

Private Attributes

bool chargedOnly_
 
bool invertRapidityCut_
 
double lip_
 
double maxRapidity_
 
float meanPhi_
 
double minRapidity_
 
std::vector< int > pdgId_
 
double ptMin_
 
float rangePhi_
 
int status_
 
double tip_
 

Detailed Description

Definition at line 11 of file GenParticleCustomSelector.h.

Constructor & Destructor Documentation

◆ GenParticleCustomSelector() [1/2]

GenParticleCustomSelector::GenParticleCustomSelector ( )
inline

Definition at line 13 of file GenParticleCustomSelector.h.

13 {}

◆ GenParticleCustomSelector() [2/2]

GenParticleCustomSelector::GenParticleCustomSelector ( double  ptMin,
double  minRapidity,
double  maxRapidity,
double  tip,
double  lip,
bool  chargedOnly,
int  status,
const std::vector< int > &  pdgId = std::vector<int>(),
bool  invertRapidityCut = false,
double  minPhi = -3.2,
double  maxPhi = 3.2 
)
inline

Definition at line 14 of file GenParticleCustomSelector.h.

25  : ptMin_(ptMin),
28  meanPhi_((minPhi + maxPhi) / 2.),
29  rangePhi_((maxPhi - minPhi) / 2.),
30  tip_(tip),
31  lip_(lip),
33  status_(status),
34  pdgId_(pdgId),
36  if (minPhi >= maxPhi) {
37  throw cms::Exception("Configuration")
38  << "GenParticleCustomSelector: minPhi (" << minPhi << ") must be smaller than maxPhi (" << maxPhi
39  << "). The range is constructed from minPhi to maxPhi around their "
40  "average.";
41  }
42  if (minPhi >= M_PI) {
43  throw cms::Exception("Configuration") << "GenParticleCustomSelector: minPhi (" << minPhi
44  << ") must be smaller than PI. The range is constructed from minPhi "
45  "to maxPhi around their average.";
46  }
47  if (maxPhi <= -M_PI) {
48  throw cms::Exception("Configuration") << "GenParticleCustomSelector: maxPhi (" << maxPhi
49  << ") must be larger than -PI. The range is constructed from minPhi "
50  "to maxPhi around their average.";
51  }
52  }

References Exception, M_PI, HLT_FULL_cff::maxPhi, and HLT_FULL_cff::minPhi.

Member Function Documentation

◆ operator()()

bool GenParticleCustomSelector::operator() ( const reco::GenParticle tp) const
inline

Operator() performs the selection: e.g. if (tPSelector(tp)) {...}.

Definition at line 55 of file GenParticleCustomSelector.h.

55  {
56  if (chargedOnly_ && tp.charge() == 0)
57  return false; //select only if charge!=0
58  bool testId = false;
59  unsigned int idSize = pdgId_.size();
60  if (idSize == 0)
61  testId = true;
62  else
63  for (unsigned int it = 0; it != idSize; ++it) {
64  if (tp.pdgId() == pdgId_[it])
65  testId = true;
66  }
67 
68  auto etaOk = [&](const reco::GenParticle& p) -> bool {
69  float eta = p.eta();
70  if (!invertRapidityCut_)
71  return (eta >= minRapidity_) && (eta <= maxRapidity_);
72  else
73  return (eta < minRapidity_ || eta > maxRapidity_);
74  };
75  auto phiOk = [&](const reco::GenParticle& p) {
76  float dphi = deltaPhi(atan2f(p.py(), p.px()), meanPhi_);
77  return dphi >= -rangePhi_ && dphi <= rangePhi_;
78  };
79  auto ptOk = [&](const reco::GenParticle& p) {
80  double pt = p.pt();
81  return pt >= ptMin_;
82  };
83 
84  return (ptOk(tp) && etaOk(tp) && phiOk(tp) && sqrt(tp.vertex().perp2()) <= tip_ && fabs(tp.vertex().z()) <= lip_ &&
85  tp.status() == status_ && testId);
86  }

References chargedOnly_, SiPixelRawToDigiRegional_cfi::deltaPhi, PVValHelper::eta, invertRapidityCut_, lip_, maxRapidity_, meanPhi_, minRapidity_, AlCaHLTBitMon_ParallelJobs::p, pdgId_, DiDispStaMuonMonitor_cfi::pt, ptMin_, rangePhi_, mathSSE::sqrt(), status_, tip_, and cmsswSequenceInfo::tp.

Member Data Documentation

◆ chargedOnly_

bool GenParticleCustomSelector::chargedOnly_
private

Definition at line 96 of file GenParticleCustomSelector.h.

Referenced by operator()().

◆ invertRapidityCut_

bool GenParticleCustomSelector::invertRapidityCut_
private

Definition at line 99 of file GenParticleCustomSelector.h.

Referenced by operator()().

◆ lip_

double GenParticleCustomSelector::lip_
private

Definition at line 95 of file GenParticleCustomSelector.h.

Referenced by operator()().

◆ maxRapidity_

double GenParticleCustomSelector::maxRapidity_
private

Definition at line 91 of file GenParticleCustomSelector.h.

Referenced by operator()().

◆ meanPhi_

float GenParticleCustomSelector::meanPhi_
private

Definition at line 92 of file GenParticleCustomSelector.h.

Referenced by operator()().

◆ minRapidity_

double GenParticleCustomSelector::minRapidity_
private

Definition at line 90 of file GenParticleCustomSelector.h.

Referenced by operator()().

◆ pdgId_

std::vector<int> GenParticleCustomSelector::pdgId_
private

Definition at line 98 of file GenParticleCustomSelector.h.

Referenced by operator()().

◆ ptMin_

double GenParticleCustomSelector::ptMin_
private

Definition at line 89 of file GenParticleCustomSelector.h.

Referenced by operator()().

◆ rangePhi_

float GenParticleCustomSelector::rangePhi_
private

Definition at line 93 of file GenParticleCustomSelector.h.

Referenced by operator()().

◆ status_

int GenParticleCustomSelector::status_
private

Definition at line 97 of file GenParticleCustomSelector.h.

Referenced by operator()().

◆ tip_

double GenParticleCustomSelector::tip_
private

Definition at line 94 of file GenParticleCustomSelector.h.

Referenced by operator()().

GenParticleCustomSelector::meanPhi_
float meanPhi_
Definition: GenParticleCustomSelector.h:92
HLT_FULL_cff.invertRapidityCut
invertRapidityCut
Definition: HLT_FULL_cff.py:52986
qcdUeDQM_cfi.minRapidity
minRapidity
Definition: qcdUeDQM_cfi.py:24
reco::GenParticle
Definition: GenParticle.h:21
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
GenParticleCustomSelector::tip_
double tip_
Definition: GenParticleCustomSelector.h:94
GenParticleCustomSelector::lip_
double lip_
Definition: GenParticleCustomSelector.h:95
mps_update.status
status
Definition: mps_update.py:69
qcdUeDQM_cfi.maxRapidity
maxRapidity
Definition: qcdUeDQM_cfi.py:27
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
GenParticleCustomSelector::invertRapidityCut_
bool invertRapidityCut_
Definition: GenParticleCustomSelector.h:99
GenParticleCustomSelector::status_
int status_
Definition: GenParticleCustomSelector.h:97
ptMin
constexpr float ptMin
Definition: PhotonIDValueMapProducer.cc:155
qcdUeDQM_cfi.lip
lip
Definition: qcdUeDQM_cfi.py:25
HLT_FULL_cff.maxPhi
maxPhi
Definition: HLT_FULL_cff.py:52987
SiPixelRawToDigiRegional_cfi.deltaPhi
deltaPhi
Definition: SiPixelRawToDigiRegional_cfi.py:9
PVValHelper::eta
Definition: PVValidationHelpers.h:70
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
GenParticleCustomSelector::minRapidity_
double minRapidity_
Definition: GenParticleCustomSelector.h:90
GenParticleCustomSelector::ptMin_
double ptMin_
Definition: GenParticleCustomSelector.h:89
cmsswSequenceInfo.tp
tp
Definition: cmsswSequenceInfo.py:17
qcdUeDQM_cfi.tip
tip
Definition: qcdUeDQM_cfi.py:23
M_PI
#define M_PI
Definition: BXVectorInputProducer.cc:49
EgammaValidation_cff.pdgId
pdgId
Definition: EgammaValidation_cff.py:118
GenParticleCustomSelector::rangePhi_
float rangePhi_
Definition: GenParticleCustomSelector.h:93
GenParticleCustomSelector::pdgId_
std::vector< int > pdgId_
Definition: GenParticleCustomSelector.h:98
GenParticleCustomSelector::chargedOnly_
bool chargedOnly_
Definition: GenParticleCustomSelector.h:96
HLT_FULL_cff.minPhi
minPhi
Definition: HLT_FULL_cff.py:52975
Exception
Definition: hltDiff.cc:245
cosmictrackingParticleSelector_cfi.chargedOnly
chargedOnly
Definition: cosmictrackingParticleSelector_cfi.py:5
GenParticleCustomSelector::maxRapidity_
double maxRapidity_
Definition: GenParticleCustomSelector.h:91