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 }
cscDigiValidation_cfi.simTrack
simTrack
Definition: cscDigiValidation_cfi.py:29
RawParticle
Definition: RawParticle.h:37
geometryCSVtoXML.zz
zz
Definition: geometryCSVtoXML.py:19
ParticlePropagator::propagateToBoundSurface
bool propagateToBoundSurface(const TrackerLayer &)
Definition: ParticlePropagator.cc:139
BaseParticlePropagator::particle
RawParticle const & particle() const
The particle being propagated.
Definition: BaseParticlePropagator.h:164
BoundDisk.h
X
#define X(str)
Definition: MuonsGrabber.cc:38
ParticlePropagator::fieldMap
double fieldMap(double x, double y, double z)
Definition: ParticlePropagator.cc:125
MagneticFieldMap::inTeslaZ
double inTeslaZ(const GlobalPoint &) const
Definition: MagneticFieldMap.cc:91
FSimTrack::decayTime
double decayTime() const
Return the pre-defined decay time.
Definition: FSimTrack.h:218
MagneticFieldMap
Definition: MagneticFieldMap.h:18
FSimTrack.h
XYZVector
math::XYZVector XYZVector
Definition: RawParticle.h:26
ParticlePropagator::initProperDecayTime
void initProperDecayTime()
Definition: ParticlePropagator.cc:101
RawParticle::pid
int pid() const
get the HEP particle ID number
Definition: RawParticle.h:277
BoundCylinder.h
XYZTLorentzVector
math::XYZTLorentzVector XYZTLorentzVector
Definition: RawParticle.h:25
BaseParticlePropagator::setProperDecayTime
void setProperDecayTime(double t)
Set the proper decay time.
Definition: BaseParticlePropagator.h:169
FSimVertex.h
findQualityFiles.v
v
Definition: findQualityFiles.py:179
ParticlePropagator::propagated
ParticlePropagator propagated() const
Definition: ParticlePropagator.cc:121
RawParticle::charge
double charge() const
get the MEASURED charge
Definition: RawParticle.h:294
ParticlePropagator::setPropagationConditions
void setPropagationConditions(const TrackerLayer &, bool firstLoop=true)
Definition: ParticlePropagator.cc:169
ParticlePropagator::theTable
const HepPDT::ParticleDataTable * theTable
Definition: ParticlePropagator.h:105
RandomEngineAndDistribution.h
BoundDisk
BaseParticlePropagator
Definition: BaseParticlePropagator.h:82
TrackerLayer.h
fileCollector.done
done
Definition: fileCollector.py:123
DDAxes::z
summarizeEdmComparisonLogfiles.success
success
Definition: summarizeEdmComparisonLogfiles.py:115
GlobalPoint
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
ParticlePropagator.h
first
auto first
Definition: CAHitNtupletGeneratorKernelsImpl.h:112
ParticlePropagator::theFieldMap
const MagneticFieldMap * theFieldMap
Definition: ParticlePropagator.h:103
phase1PixelTopology::layer
constexpr std::array< uint8_t, layerIndexSize > layer
Definition: phase1PixelTopology.h:99
BaseParticlePropagator::fiducial
bool fiducial
The particle traverses some real material.
Definition: BaseParticlePropagator.h:147
pdg_functions.h
bphysicsOniaDQM_cfi.vertex
vertex
Definition: bphysicsOniaDQM_cfi.py:7
geometryCSVtoXML.yy
yy
Definition: geometryCSVtoXML.py:19
MagneticFieldMap.h
type
type
Definition: SiPixelVCal_PayloadInspector.cc:37
BaseParticlePropagator::propagate
bool propagate()
Definition: BaseParticlePropagator.cc:34
TrackerLayer
Definition: TrackerLayer.h:13
position
static int position[264][3]
Definition: ReadPGInfo.cc:289
ParticlePropagator
Definition: ParticlePropagator.h:28
ParticlePropagator::propagateToNominalVertex
bool propagateToNominalVertex(const XYZTLorentzVector &hit2=XYZTLorentzVector(0., 0., 0., 0.))
Definition: ParticlePropagator.cc:116
BaseParticlePropagator::success
int success
0:propagation still be done, 1:reached 'barrel', 2:reached 'endcaps'
Definition: BaseParticlePropagator.h:145
ParticlePropagator::propagateToClosestApproach
bool propagateToClosestApproach(double x0=0., double y0=0., bool first=true)
Definition: ParticlePropagator.cc:111
submitPVResolutionJobs.q
q
Definition: submitPVResolutionJobs.py:84
makeParticle.h
ParticlePropagator::random
const RandomEngineAndDistribution * random
Definition: ParticlePropagator.h:104
BaseParticlePropagator::propagateToNominalVertex
bool propagateToNominalVertex(const XYZTLorentzVector &hit2=XYZTLorentzVector(0., 0., 0., 0.))
Definition: BaseParticlePropagator.cc:566
makeParticle
RandomEngineAndDistribution::flatShoot
double flatShoot(double xmin=0.0, double xmax=1.0) const
Definition: RandomEngineAndDistribution.h:27
TrackerSimHits_cfi.firstLoop
firstLoop
Definition: TrackerSimHits_cfi.py:8
BaseParticlePropagator::setMagneticField
void setMagneticField(double b)
Set the magnetic field.
Definition: BaseParticlePropagator.h:299
BaseParticlePropagator::setPropagationConditions
void setPropagationConditions(double r, double z, bool firstLoop=true)
Set the propagation characteristics (rCyl, zCyl and first loop only)
Definition: BaseParticlePropagator.cc:318
alignCSCRings.r
r
Definition: alignCSCRings.py:93
pdg::cTau
double cTau(int pdgID, const HepPDT::ParticleDataTable *pdt)
Definition: pdg_functions.cc:26
BaseParticlePropagator::firstLoop
bool firstLoop
Do only the first half-loop.
Definition: BaseParticlePropagator.h:154
BaseParticlePropagator::propagated
BaseParticlePropagator propagated() const
Definition: BaseParticlePropagator.cc:304
BaseParticlePropagator::propagateToClosestApproach
bool propagateToClosestApproach(double x0=0., double y0=0, bool first=true)
Definition: BaseParticlePropagator.cc:325
BeamSpotPI::Y
Definition: BeamSpotPayloadInspectorHelper.h:32
dqm-mbProfile.log
log
Definition: dqm-mbProfile.py:17
FSimTrack
Definition: FSimTrack.h:30
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
BeamSpotPI::Z
Definition: BeamSpotPayloadInspectorHelper.h:33
BaseParticlePropagator::properDecayTime
double properDecayTime
The proper decay time of the particle.
Definition: BaseParticlePropagator.h:139
TableParser.table
table
Definition: TableParser.py:111
ParticleDataTable
HepPDT::ParticleDataTable ParticleDataTable
Definition: ParticleDataTable.h:8
geometryCSVtoXML.xx
xx
Definition: geometryCSVtoXML.py:19
ParticlePropagator::ParticlePropagator
ParticlePropagator()
Default c'tor.
Definition: ParticlePropagator.cc:15
BaseParticlePropagator::hasDecayed
bool hasDecayed() const
Has the particle decayed while propagated ?
Definition: BaseParticlePropagator.h:293
RandomEngineAndDistribution
Definition: RandomEngineAndDistribution.h:18