CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
BaseParticlePropagator.h
Go to the documentation of this file.
1 /*Emacs: -*- C++ -*- */
2 #ifndef BASEPARTICLEPROPAGATOR_H
3 #define BASEPARTICLEPROPAGATOR_H
4 
79 //FAMOS
81 
83 
84 public:
85 
88 
92  BaseParticlePropagator(const RawParticle& myPart,
93  double r, double z, double B);
94  BaseParticlePropagator(const RawParticle& myPart,
95  double r, double z, double B, double t);
96 
98  void init();
99 
102  bool propagate();
103 
106  bool backPropagate();
107 
111 
116  bool propagateToClosestApproach(double x0=0.,double y0=0,bool first=true);
117  bool propagateToEcal(bool first=true);
118  bool propagateToPreshowerLayer1(bool first=true);
119  bool propagateToPreshowerLayer2(bool first=true);
120  bool propagateToEcalEntrance(bool first=true);
121  bool propagateToHcalEntrance(bool first=true);
122  bool propagateToVFcalEntrance(bool first=true);
123  bool propagateToHcalExit(bool first=true);
124  bool propagateToNominalVertex(const XYZTLorentzVector& hit2=XYZTLorentzVector(0.,0.,0.,0.));
125  bool propagateToBeamCylinder(const XYZTLorentzVector& v, double radius=0.);
127  void setPropagationConditions(double r, double z, bool firstLoop=true);
128 
129 private:
131  // RawParticle particle;
133  double rCyl;
134  double rCyl2;
136  double zCyl;
138  double bField;
142  bool debug;
143 
144 protected:
146  int success;
148  bool fiducial;
149 
151  inline double c_light() const { return 299.792458; }
152 
153 private:
155  bool firstLoop;
157  bool decayed;
159  double properTime;
161  int propDir;
162 
163 public:
164 
166  inline void setProperDecayTime(double t) { properDecayTime = t; }
167 
169  inline void increaseRCyl(double delta) {rCyl = rCyl + delta; rCyl2 = rCyl*rCyl; }
170 
172  double xyImpactParameter(double x0=0., double y0=0.) const;
173 
175  inline double zImpactParameter(double x0=0, double y0=0.) const {
176  // Longitudinal impact parameter
177  return Z() - Pz() * std::sqrt( ((X()-x0)*(X()-x0) + (Y()-y0)*(Y()-y0) ) / Perp2());
178  }
179 
181  inline double helixRadius() const {
182  // The helix Radius
183  //
184  // The helix' Radius sign accounts for the orientation of the magnetic field
185  // (+ = along z axis) and the sign of the electric charge of the particle.
186  // It signs the rotation of the (charged) particle around the z axis:
187  // Positive means anti-clockwise, negative means clockwise rotation.
188  //
189  // The radius is returned in cm to match the units in RawParticle.
190  return charge() == 0 ? 0.0 : - Pt() / ( c_light() * 1e-5 * bField * charge() );
191  }
192 
193  inline double helixRadius(double pT) const {
194  // a faster version of helixRadius, once Perp() has been computed
195  return charge() == 0 ? 0.0 : - pT / ( c_light() * 1e-5 * bField * charge() );
196  }
197 
199  inline double helixStartPhi() const {
200  // The azimuth of the momentum at the vertex
201  return Px() == 0.0 && Py() == 0.0 ? 0.0 : std::atan2(Py(),Px());
202  }
203 
205  inline double helixCentreX() const {
206  // The x coordinate of the helix axis
207  return X() - helixRadius() * std::sin ( helixStartPhi() );
208  }
209 
210  inline double helixCentreX(double radius, double phi) const {
211  // Fast version of helixCentreX()
212  return X() - radius * std::sin (phi);
213  }
214 
216  inline double helixCentreY() const {
217  // The y coordinate of the helix axis
218  return Y() + helixRadius() * std::cos ( helixStartPhi() );
219 }
220 
221  inline double helixCentreY(double radius, double phi) const {
222  // Fast version of helixCentreX()
223  return Y() + radius * std::cos (phi);
224  }
225 
227  inline double helixCentreDistToAxis() const {
228  // The distance between the cylinder and the helix axes
229  double xC = helixCentreX();
230  double yC = helixCentreY();
231  return std::sqrt( xC*xC + yC*yC );
232  }
233 
234  inline double helixCentreDistToAxis(double xC, double yC) const {
235  // Faster version of helixCentreDistToAxis
236  return std::sqrt( xC*xC + yC*yC );
237  }
238 
240  inline double helixCentrePhi() const {
241  // The azimuth if the vector joining the cylinder and the helix axes
242  double xC = helixCentreX();
243  double yC = helixCentreY();
244  return xC == 0.0 && yC == 0.0 ? 0.0 : std::atan2(yC,xC);
245  }
246 
247  inline double helixCentrePhi(double xC, double yC) const {
248  // Faster version of helixCentrePhi()
249  return xC == 0.0 && yC == 0.0 ? 0.0 : std::atan2(yC,xC);
250  }
251 
253  inline bool inside() const {
254  return (R2()<rCyl2-0.00001*rCyl && fabs(Z())<zCyl-0.00001);}
255 
256  inline bool inside(double rPos2) const {
257  return (rPos2<rCyl2-0.00001*rCyl && fabs(Z())<zCyl-0.00001);}
258 
259 
261  inline bool onSurface() const {
262  return ( onBarrel() || onEndcap() );
263  }
264 
265  inline bool onSurface(double rPos2) const {
266  return ( onBarrel(rPos2) || onEndcap(rPos2) );
267  }
268 
270  inline bool onBarrel() const {
271  double rPos2 = R2();
272  return ( fabs(rPos2-rCyl2) < 0.00001*rCyl && fabs(Z()) <= zCyl );
273  }
274 
275  inline bool onBarrel(double rPos2) const {
276  return ( fabs(rPos2-rCyl2) < 0.00001*rCyl && fabs(Z()) <= zCyl );
277  }
278 
280  inline bool onEndcap() const {
281  return ( fabs(fabs(Z())-zCyl) < 0.00001 && R2() <= rCyl2 );
282  }
283 
284  inline bool onEndcap(double rPos2) const {
285  return ( fabs(fabs(Z())-zCyl) < 0.00001 && rPos2 <= rCyl2 );
286  }
287 
289  inline bool onFiducial() const { return fiducial; }
290 
292  inline bool hasDecayed() const { return decayed; }
293 
295  inline int getSuccess() const { return success; }
296 
298  inline void setMagneticField(double b) { bField=b; }
299 
301  inline double getMagneticField() const { return bField; }
302 
304  inline void setDebug() { debug = true; }
305  inline void resetDebug() { debug = false; }
306 
307 };
308 
309 #endif
bool hasDecayed() const
Has the particle decayed while propagated ?
bool onSurface(double rPos2) const
dbl * delta
Definition: mlp_gen.cc:36
double zCyl
Half-height of the cylinder (centred at 0,0,0) to which propagation is done.
double helixRadius() const
The helix Radius.
double zImpactParameter(double x0=0, double y0=0.) const
Longitudinal impact parameter.
double helixCentrePhi() const
The azimuth if the vector joining the cylinder and the helix axes.
bool propagateToPreshowerLayer1(bool first=true)
bool inside(double rPos2) const
double rCyl
Simulated particle that is to be resp has been propagated.
bool propagateToNominalVertex(const XYZTLorentzVector &hit2=XYZTLorentzVector(0., 0., 0., 0.))
void init()
Initialize internal switches and quantities.
void increaseRCyl(double delta)
Just an internal trick.
double z() const
z of vertex
Definition: RawParticle.h:271
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;
double properTime
The proper time of the particle.
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
BaseParticlePropagator()
Default c&#39;tor.
int getSuccess() const
Has propagation been performed and was barrel or endcap reached ?
bool propagateToBeamCylinder(const XYZTLorentzVector &v, double radius=0.)
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 helixCentrePhi(double xC, double yC) const
double c_light() const
The speed of light in mm/ns (!) without clhep (yeaaahhh!)
double R2() const
vertex radius**2
Definition: RawParticle.h:278
bool propagateToEcal(bool first=true)
bool propagateToClosestApproach(double x0=0., double y0=0, bool first=true)
double helixCentreX() const
The x coordinate of the helix axis.
bool propagateToVFcalEntrance(bool first=true)
double helixCentreDistToAxis() const
The distance between the cylinder and the helix axes.
double t() const
vertex time
Definition: RawParticle.h:272
void setDebug()
Set the debug leve;.
double properDecayTime
The proper decay time of the particle.
T sqrt(T t)
Definition: SSEVec.h:28
bool propagateToHcalExit(bool first=true)
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
double Y() const
y of vertex
Definition: RawParticle.h:274
double Z() const
z of vertex
Definition: RawParticle.h:275
bool onEndcap(double rPos2) const
double charge() const
get the MEASURED charge
Definition: RawParticle.h:281
bool first
Definition: L1TdeRCT.cc:79
double helixCentreY(double radius, double phi) const
int propDir
The propagation direction.
bool propagateToEcalEntrance(bool first=true)
double helixCentreX(double radius, double phi) const
bool onEndcap() const
Is the vertex already on the cylinder endcap ?
bool decayed
The particle decayed while propagated !
BaseParticlePropagator propagated() const
double helixCentreY() const
The y coordinate of the helix axis.
bool inside() const
Is the vertex inside the cylinder ? (stricly inside : true)
double b
Definition: hdecay.h:120
bool onSurface() const
Is the vertex already on the cylinder surface ?
double r() const
vertex radius
Definition: RawParticle.h:279
double X() const
x of vertex
Definition: RawParticle.h:273
bool debug
The debug level.
double helixStartPhi() const
The azimuth of the momentum at the vertex.
double getMagneticField() const
Get the magnetic field.
bool propagateToHcalEntrance(bool first=true)
double helixRadius(double pT) const
void setProperDecayTime(double t)
Set the proper decay time.
double bField
Magnetic field in the cylinder, oriented along the Z axis.
bool onFiducial() const
Is the vertex on some material ?
bool onBarrel(double rPos2) const
bool onBarrel() const
Is the vertex already on the cylinder barrel ?
bool propagateToPreshowerLayer2(bool first=true)
double helixCentreDistToAxis(double xC, double yC) const
mathSSE::Vec4< T > v
double xyImpactParameter(double x0=0., double y0=0.) const
Transverse impact parameter.
bool fiducial
The particle traverses some real material.
math::XYZTLorentzVector XYZTLorentzVector
Definition: RawParticle.h:15
Definition: DDAxes.h:10