CMS 3D CMS Logo

ParticleManager.h
Go to the documentation of this file.
1 #ifndef FASTSIM_PARTICLEMANAGER_H
2 #define FASTSIM_PARTICLEMANAGER_H
3 
5 #include "HepMC/GenEvent.h"
6 #include <vector>
7 #include <memory>
8 
11 
12 
14 // Author: L. Vanelderen, S. Kurz
15 // Date: 29 May 2017
17 
18 
19 namespace HepPDT
20 {
21  class ParticleDataTable;
22 }
23 
25 
26 namespace fastsim {
27  class Particle;
28  class ParticleFilter;
29  class SimplifiedGeometry;
30 
32 
40  {
41  public:
43 
53  const HepMC::GenEvent & genEvent,
54  const HepPDT::ParticleDataTable & particleDataTable,
55  double beamPipeRadius,
56  double deltaRchargedMother,
57  const ParticleFilter & particleFilter,
58  std::vector<SimTrack> & simTracks,
59  std::vector<SimVertex> & simVertices,
60  bool fixLongLivedBug);
61 
63  ~ParticleManager();
64 
66 
73  std::unique_ptr<Particle> nextParticle(const RandomEngineAndDistribution & random);
74 
76 
82  void addSecondaries(
83  const math::XYZTLorentzVector & vertexPosition,
84  int motherSimTrackId,
85  std::vector<std::unique_ptr<Particle> > & secondaries,
86  const SimplifiedGeometry * layer = nullptr);
87 
89  const SimVertex getSimVertex(unsigned i) { return simVertices_->at(i); }
90 
92  const SimTrack getSimTrack(unsigned i) { return simTracks_->at(i); }
93 
95 
100  unsigned addEndVertex(const Particle * particle);
101 
102  private:
104 
110  unsigned addSimVertex(
112  int motherIndex);
113 
115 
122  unsigned addSimTrack(const Particle * particle);
123  void exoticRelativesChecker(const HepMC::GenVertex* originVertex, int& hasExoticAssociation, int ngendepth);
124 
126 
129  std::unique_ptr<Particle> nextGenParticle();
130 
131  // data members
132  const HepMC::GenEvent * const genEvent_;
133  HepMC::GenEvent::particle_const_iterator genParticleIterator_;
134  const HepMC::GenEvent::particle_const_iterator genParticleEnd_;
137  const double beamPipeRadius2_;
138  const double deltaRchargedMother_;
140  std::vector<SimTrack> * simTracks_;
141  std::vector<SimVertex> * simVertices_;
146  std::vector<std::unique_ptr<Particle> > particleBuffer_;
148  };
149 }
150 
151 inline bool isExotic(bool fixLongLivedBug, int pdgid_) {
152  unsigned int pdgid = std::abs(pdgid_);
153  return ((pdgid >= 1000000 && pdgid < 4000000 && pdgid != 3000022) || // SUSY, R-hadron, and technicolor particles
154  pdgid == 17 || // 4th generation lepton
155  pdgid == 34 || // W-prime
156  pdgid == 37 || // charged Higgs
157  (pdgid == 39 && fixLongLivedBug)); // bulk graviton
158 
159 }
160 
161 #endif
Implementation of a generic detector layer (base class for forward/barrel layers).
Manages GenParticles and Secondaries from interactions.
HepPDT::ParticleDataTable ParticleDataTable
const double deltaRchargedMother_
For FastSim (cheat) tracking: cut on the angle between a charged mother and charged daughter...
const ParticleFilter *const particleFilter_
(Kinematic) cuts on the particles that have to be propagated.
double momentumUnitConversionFactor_
Convert pythia units to GeV (FastSim standard)
std::vector< std::unique_ptr< Particle > > particleBuffer_
The vector of all secondaries that are not yet propagated in the event.
HepMC::GenEvent::particle_const_iterator genParticleIterator_
Iterator to keep track on which GenParticles where already considered.
TRandom random
Definition: MVATrainer.cc:138
const HepMC::GenEvent *const genEvent_
The GenEvent.
const HepMC::GenEvent::particle_const_iterator genParticleEnd_
The last particle of the GenEvent.
double lengthUnitConversionFactor2_
Convert pythia unis to cm^2 (FastSim standard)
const SimVertex getSimVertex(unsigned i)
Returns the position of a given SimVertex. Needed for interfacing the code with the old calorimetry...
const SimTrack getSimTrack(unsigned i)
Returns a given SimTrack. Needed for interfacing the code with the old calorimetry.
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
const double beamPipeRadius2_
(Radius of the beampipe)^2
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool isExotic(bool fixLongLivedBug, int pdgid_)
std::vector< SimTrack > * simTracks_
The generated SimTrack of this event.
double lengthUnitConversionFactor_
Convert pythia unis to cm (FastSim standard)
const HepPDT::ParticleDataTable *const particleDataTable_
Necessary to get information like lifetime and charge of a particle if unknown.
double timeUnitConversionFactor_
Convert pythia unis to ns (FastSim standard)
static int position[264][3]
Definition: ReadPGInfo.cc:509
std::vector< SimVertex > * simVertices_
The generated SimVertices of this event.
(Kinematic) cuts on the particles that are propagated.
int genParticleIndex_
Index of particle in the GenEvent (if it is a GenParticle)