CMS 3D CMS Logo

ParticlePropagator.cc
Go to the documentation of this file.
1 //CMSSW headers
4 
5 //FAMOS headers
14 
16 
18  double RCyl,
19  double ZCyl,
20  const MagneticFieldMap* aFieldMap,
21  const RandomEngineAndDistribution* engine,
23  : BaseParticlePropagator(myPart, RCyl, ZCyl, 0.), theFieldMap(aFieldMap), random(engine), theTable(table) {
26 }
27 
29  const MagneticFieldMap* aFieldMap,
30  const RandomEngineAndDistribution* engine,
32  : BaseParticlePropagator(myPart, 0., 0., 0.),
33  theFieldMap(aFieldMap),
34  random(engine),
35  theTable(table)
36 
37 {
40 }
41 
43  const XYZTLorentzVector& vert,
44  float q,
45  const MagneticFieldMap* aFieldMap,
47  : BaseParticlePropagator(RawParticle(mom, vert, q), 0., 0., 0.),
48  theFieldMap(aFieldMap),
49  random(nullptr),
50  theTable(table) {
52 }
53 
55  const XYZVector& vert,
56  float q,
57  const MagneticFieldMap* aFieldMap,
59  : BaseParticlePropagator(RawParticle(mom, XYZTLorentzVector(vert.X(), vert.Y(), vert.Z(), 0.0), q), 0., 0., 0.),
60  theFieldMap(aFieldMap),
61  random(nullptr),
62  theTable(table) {
64 }
65 
67  const MagneticFieldMap* aFieldMap,
68  const RandomEngineAndDistribution* engine,
71  makeParticle(table, simTrack.type(), simTrack.momentum(), simTrack.vertex().position()), 0., 0., 0.),
72  theFieldMap(aFieldMap),
73  random(engine),
74  theTable(table) {
76  if (simTrack.decayTime() < 0.) {
77  if (simTrack.nDaughters())
78  // This particle already decayed, don't decay it twice
79  this->setProperDecayTime(1E99);
80  else
81  // This particle hasn't decayed yet. Decay time according to particle lifetime
83  } else {
84  // Decay time pre-defined at generator level
85  this->setProperDecayTime(simTrack.decayTime());
86  }
87 }
88 
90  : BaseParticlePropagator(myPropPart), theFieldMap(myPropPart.theFieldMap) {
91  // setMagneticField(fieldMap(x(),y(),z()));
92 }
93 
95  const MagneticFieldMap* aFieldMap,
97  : BaseParticlePropagator(myPropPart), theFieldMap(aFieldMap), theTable(table) {
99 }
100 
102  // And this is the proper time at which the particle will decay
103  double properDecayTime = (particle().pid() == 0 || particle().pid() == 22 || abs(particle().pid()) == 11 ||
104  abs(particle().pid()) == 2112 || abs(particle().pid()) == 2212 || !random)
105  ? 1E99
107 
108  this->setProperDecayTime(properDecayTime);
109 }
110 
111 bool ParticlePropagator::propagateToClosestApproach(double x0, double y0, bool first) {
112  setMagneticField(fieldMap(0., 0., 0.));
114 }
115 
117  setMagneticField(fieldMap(0., 0., 0.));
119 }
120 
123 }
124 
125 double ParticlePropagator::fieldMap(double xx, double yy, double zz) {
126  // Arguments now passed in cm.
127  // return MagneticFieldMap::instance()->inTesla(GlobalPoint(xx/10.,yy/10.,zz/10.)).z();
128  // Return a dummy value for neutral particles!
129  return particle().charge() == 0.0 || theFieldMap == nullptr ? 4. : theFieldMap->inTeslaZ(GlobalPoint(xx, yy, zz));
130 }
131 
132 double ParticlePropagator::fieldMap(const TrackerLayer& layer, double coord, int success) {
133  // Arguments now passed in cm.
134  // return MagneticFieldMap::instance()->inTesla(GlobalPoint(xx/10.,yy/10.,zz/10.)).z();
135  // Return a dummy value for neutral particles!
136  return particle().charge() == 0.0 || theFieldMap == nullptr ? 4. : theFieldMap->inTeslaZ(layer, coord, success);
137 }
138 
140  fiducial = true;
141  BoundDisk const* disk = layer.disk();
142  // bool disk = layer.forward();
143  // double innerradius=-999;
144  double innerradius = disk ? layer.diskInnerRadius() : -999.;
145 
146  // if( disk ) {
147  // const Surface& surface = layer.surface();
148  // const BoundDisk & myDisk = dynamic_cast<const BoundDisk&>(surface);
149  // innerradius=myDisk.innerRadius();
150  // innerradius=myDisk->innerRadius();
151  // }
152 
153  bool done = propagate();
154 
155  // Set the magnetic field at the new location (if succesfully propagated)
156  if (done && !hasDecayed()) {
157  if (success == 2)
159  else if (success == 1)
161  }
162 
163  // There is some real material here
164  fiducial = !(!disk && success != 1) && !(disk && (success != 2 || particle().r() < innerradius));
165 
166  return done;
167 }
168 
170  // Set the magentic field
171  // setMagneticField(fieldMap(x(),y(),z()));
172 
173  // Set R and Z according to the Tracker Layer characteristics.
174  // const Surface& surface = layer.surface();
175 
176  if (layer.forward()) {
177  // const BoundDisk & myDisk = dynamic_cast<const BoundDisk&>(surface);
178  // ParticlePropagator works in mm, whereas the detector geometry is in cm
180  layer.diskOuterRadius(), fabs(layer.disk()->position().z()), firstLoop);
181 
182  // ... or if it is a cylinder barrel
183  } else {
184  // const BoundCylinder & myCylinder = dynamic_cast<const BoundCylinder &>(surface);
185  // ParticlePropagator works now in cm
187  layer.cylinder()->bounds().width() / 2., layer.cylinder()->bounds().length() / 2., firstLoop);
188  }
189 }
const MagneticFieldMap * theFieldMap
ParticlePropagator()
Default c&#39;tor.
double cTau(int pdgID, const HepPDT::ParticleDataTable *pdt)
bool propagateToNominalVertex(const XYZTLorentzVector &hit2=XYZTLorentzVector(0., 0., 0., 0.))
HepPDT::ParticleDataTable ParticleDataTable
int pid() const
get the HEP particle ID number
Definition: RawParticle.h:277
bool propagateToClosestApproach(double x0=0., double y0=0., bool first=true)
bool firstLoop
Do only the first half-loop.
int success
0:propagation still be done, 1:reached &#39;barrel&#39;, 2:reached &#39;endcaps&#39;
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
BaseParticlePropagator propagated() const
#define X(str)
Definition: MuonsGrabber.cc:38
bool propagateToBoundSurface(const TrackerLayer &)
void setPropagationConditions(double r, double z, bool firstLoop=true)
Set the propagation characteristics (rCyl, zCyl and first loop only)
void setMagneticField(double b)
Set the magnetic field.
double fieldMap(double x, double y, double z)
double charge() const
get the MEASURED charge
Definition: RawParticle.h:294
constexpr std::array< uint8_t, layerIndexSize > layer
bool propagateToClosestApproach(double x0=0., double y0=0, bool first=true)
const HepPDT::ParticleDataTable * theTable
double properDecayTime
The proper decay time of the particle.
void setPropagationConditions(const TrackerLayer &, bool firstLoop=true)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool hasDecayed() const
Has the particle decayed while propagated ?
RawParticle const & particle() const
The particle being propagated.
double decayTime() const
Return the pre-defined decay time.
Definition: FSimTrack.h:218
void setProperDecayTime(double t)
Set the proper decay time.
static int position[264][3]
Definition: ReadPGInfo.cc:289
bool propagateToNominalVertex(const XYZTLorentzVector &hit2=XYZTLorentzVector(0., 0., 0., 0.))
ParticlePropagator propagated() const
double inTeslaZ(const GlobalPoint &) const
double flatShoot(double xmin=0.0, double xmax=1.0) const
math::XYZVector XYZVector
Definition: RawParticle.h:26
const RandomEngineAndDistribution * random
bool fiducial
The particle traverses some real material.
math::XYZTLorentzVector XYZTLorentzVector
Definition: RawParticle.h:25