CMS 3D CMS Logo

ParticleFilter.cc
Go to the documentation of this file.
4 #include "vdt/vdtMath.h"
5 
7 {
8  // Charged particles must have pt greater than chargedPtMin [GeV]
9  double chargedPtMin = cfg.getParameter<double>("chargedPtMin");
10  chargedPtMin2_ = chargedPtMin*chargedPtMin;
11 
12  // (All) particles must have energy greater than EMin [GeV]
13  EMin_ = cfg.getParameter<double>("EMin");
14 
15  // Allow *ALL* protons with energy > protonEMin
16  protonEMin_ = cfg.getParameter<double>("protonEMin");
17 
18  // List of invisible particles if extension needed
19  // Predefined: Neutrinos, Neutralino_1
20  skipParticles_ = cfg.getParameter<std::vector<int>>("invisibleParticles");
21 
22  // Particles must have abs(eta) < etaMax (if close enough to 0,0,0)
23  double etaMax = cfg.getParameter<double>("etaMax");
24  cos2ThetaMax_ = (vdt::fast_exp(2.*etaMax)-1.) / (vdt::fast_exp(2.*etaMax)+1.);
25  cos2ThetaMax_ *= cos2ThetaMax_;
26 
27  // Particles must have vertex inside the tracker
28  vertexRMax2_ = 129.0*129.0;
29  vertexZMax_ = 303.353;
30 }
31 
33 {
34  int absPdgId = abs(particle.pdgId());
35 
36  // skip invisible particles
37  if(absPdgId == 12 || absPdgId == 14 || absPdgId == 16 || absPdgId == 1000022)
38  {
39  return false;
40  }
41  // keep all high-energy protons
42  else if(absPdgId == 2212 && particle.momentum().E() >= protonEMin_)
43  {
44  return true;
45  }
46 
47  // cut on eta if the origin vertex is close to the beam
48  else if(particle.position().Perp2() < 25. && particle.momentum().Pz()*particle.momentum().Pz()/particle.momentum().P2() > cos2ThetaMax_)
49  {
50  return false;
51  }
52 
53  // possible to extend list of invisible particles
54  for(unsigned InvIdx = 0; InvIdx < skipParticles_.size(); InvIdx++){
55  if(absPdgId == abs(skipParticles_.at(InvIdx)))
56  {
57  return false;
58  }
59  }
60 
61  // particles must have vertex in volume of tracker
62  return acceptsVtx(particle.position()) && acceptsEn(particle);
63  //return (acceptsVtx(particle.position()) || particle.momentum().Pz()*particle.momentum().Pz()/particle.momentum().P2() > (vdt::fast_exp(2.*3.0)-1.) / (vdt::fast_exp(2.*3.0)+1.)*(vdt::fast_exp(2.*3.0)-1.) / (vdt::fast_exp(2.*3.0)+1.)) && acceptsEn(particle);
64 }
65 
67 {
68  int absPdgId = abs(particle.pdgId());
69 
70  // keep all high-energy protons
71  if(absPdgId == 2212 && particle.momentum().E() >= protonEMin_)
72  {
73  return true;
74  }
75 
76  // cut on the energy
77  else if(particle.momentum().E() < EMin_)
78  {
79  return false;
80  }
81 
82  // cut on pt of charged particles
83  else if(particle.charge()!=0 && particle.momentum().Perp2()<chargedPtMin2_)
84  {
85  return false;
86  }
87 
88  return true;
89 }
90 
91 
93 {
94  // origin vertex is within the tracker volume
95  return (originVertex.Perp2() < vertexRMax2_ && fabs(originVertex.Z()) < vertexZMax_);
96 }
T getParameter(std::string const &) const
const math::XYZTLorentzVector & position() const
Return position of the particle.
Definition: Particle.h:142
ParticleFilter(const edm::ParameterSet &cfg)
Default Constructor.
double cos2ThetaMax_
Particles must have abs(eta) < etaMax if close to beampipe.
bool accepts(const Particle &particle) const
Check all if all criteria are fullfilled.
double EMin_
Minimum energy of a particle.
int pdgId() const
Return pdgId of the particle.
Definition: Particle.h:136
std::vector< int > skipParticles_
List of invisible particles (neutrinos are excluded by default)
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
double protonEMin_
Allow ALL protons with energy > protonEMin.
bool acceptsEn(const Particle &particle) const
Kinematic cuts on the particle.
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double vertexRMax2_
Radius^2 of tracker volume.
double vertexZMax_
Z of tracker volume.
double charge() const
Return charge of the particle.
Definition: Particle.h:139
const math::XYZTLorentzVector & momentum() const
Return momentum of the particle.
Definition: Particle.h:145
Definition of a generic FastSim Particle which can be propagated through the detector (formerly Parti...
Definition: Particle.h:19
double chargedPtMin2_
Minimum pT^2 of a charged particle.
bool acceptsVtx(const math::XYZTLorentzVector &originVertexPosition) const
Vertex within tracker volume.