test
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 
117  bool propagateToClosestApproach(double x0=0.,double y0=0,bool first=true);
118  bool propagateToEcal(bool first=true);
119  bool propagateToPreshowerLayer1(bool first=true);
120  bool propagateToPreshowerLayer2(bool first=true);
121  bool propagateToEcalEntrance(bool first=true);
122  bool propagateToHcalEntrance(bool first=true);
123  bool propagateToVFcalEntrance(bool first=true);
124  bool propagateToHcalExit(bool first=true);
125  bool propagateToHOLayer(bool first=true);
126  bool propagateToNominalVertex(const XYZTLorentzVector& hit2=XYZTLorentzVector(0.,0.,0.,0.));
127  bool propagateToBeamCylinder(const XYZTLorentzVector& v, double radius=0.);
129  void setPropagationConditions(double r, double z, bool firstLoop=true);
130 
131 private:
133  // RawParticle particle;
135  double rCyl;
136  double rCyl2;
138  double zCyl;
140  double bField;
144  bool debug;
145 
146 protected:
148  int success;
150  bool fiducial;
151 
153  inline double c_light() const { return 299.792458; }
154 
155 private:
157  bool firstLoop;
159  bool decayed;
161  double properTime;
163  int propDir;
164 
165 public:
166 
168  inline void setProperDecayTime(double t) { properDecayTime = t; }
169 
171  inline void increaseRCyl(double delta) {rCyl = rCyl + delta; rCyl2 = rCyl*rCyl; }
172 
174  double xyImpactParameter(double x0=0., double y0=0.) const;
175 
177  inline double zImpactParameter(double x0=0, double y0=0.) const {
178  // Longitudinal impact parameter
179  return Z() - Pz() * std::sqrt( ((X()-x0)*(X()-x0) + (Y()-y0)*(Y()-y0) ) / Perp2());
180  }
181 
183  inline double helixRadius() const {
184  // The helix Radius
185  //
186  // The helix' Radius sign accounts for the orientation of the magnetic field
187  // (+ = along z axis) and the sign of the electric charge of the particle.
188  // It signs the rotation of the (charged) particle around the z axis:
189  // Positive means anti-clockwise, negative means clockwise rotation.
190  //
191  // The radius is returned in cm to match the units in RawParticle.
192  return charge() == 0 ? 0.0 : - Pt() / ( c_light() * 1e-5 * bField * charge() );
193  }
194 
195  inline double helixRadius(double pT) const {
196  // a faster version of helixRadius, once Perp() has been computed
197  return charge() == 0 ? 0.0 : - pT / ( c_light() * 1e-5 * bField * charge() );
198  }
199 
201  inline double helixStartPhi() const {
202  // The azimuth of the momentum at the vertex
203  return Px() == 0.0 && Py() == 0.0 ? 0.0 : std::atan2(Py(),Px());
204  }
205 
207  inline double helixCentreX() const {
208  // The x coordinate of the helix axis
209  return X() - helixRadius() * std::sin ( helixStartPhi() );
210  }
211 
212  inline double helixCentreX(double radius, double phi) const {
213  // Fast version of helixCentreX()
214  return X() - radius * std::sin (phi);
215  }
216 
218  inline double helixCentreY() const {
219  // The y coordinate of the helix axis
220  return Y() + helixRadius() * std::cos ( helixStartPhi() );
221 }
222 
223  inline double helixCentreY(double radius, double phi) const {
224  // Fast version of helixCentreX()
225  return Y() + radius * std::cos (phi);
226  }
227 
229  inline double helixCentreDistToAxis() const {
230  // The distance between the cylinder and the helix axes
231  double xC = helixCentreX();
232  double yC = helixCentreY();
233  return std::sqrt( xC*xC + yC*yC );
234  }
235 
236  inline double helixCentreDistToAxis(double xC, double yC) const {
237  // Faster version of helixCentreDistToAxis
238  return std::sqrt( xC*xC + yC*yC );
239  }
240 
242  inline double helixCentrePhi() const {
243  // The azimuth if the vector joining the cylinder and the helix axes
244  double xC = helixCentreX();
245  double yC = helixCentreY();
246  return xC == 0.0 && yC == 0.0 ? 0.0 : std::atan2(yC,xC);
247  }
248 
249  inline double helixCentrePhi(double xC, double yC) const {
250  // Faster version of helixCentrePhi()
251  return xC == 0.0 && yC == 0.0 ? 0.0 : std::atan2(yC,xC);
252  }
253 
255  inline bool inside() const {
256  return (R2()<rCyl2-0.00001*rCyl && fabs(Z())<zCyl-0.00001);}
257 
258  inline bool inside(double rPos2) const {
259  return (rPos2<rCyl2-0.00001*rCyl && fabs(Z())<zCyl-0.00001);}
260 
261 
263  inline bool onSurface() const {
264  return ( onBarrel() || onEndcap() );
265  }
266 
267  inline bool onSurface(double rPos2) const {
268  return ( onBarrel(rPos2) || onEndcap(rPos2) );
269  }
270 
272  inline bool onBarrel() const {
273  double rPos2 = R2();
274  return ( fabs(rPos2-rCyl2) < 0.00001*rCyl && fabs(Z()) <= zCyl );
275  }
276 
277  inline bool onBarrel(double rPos2) const {
278  return ( fabs(rPos2-rCyl2) < 0.00001*rCyl && fabs(Z()) <= zCyl );
279  }
280 
282  inline bool onEndcap() const {
283  return ( fabs(fabs(Z())-zCyl) < 0.00001 && R2() <= rCyl2 );
284  }
285 
286  inline bool onEndcap(double rPos2) const {
287  return ( fabs(fabs(Z())-zCyl) < 0.00001 && rPos2 <= rCyl2 );
288  }
289 
291  inline bool onFiducial() const { return fiducial; }
292 
294  inline bool hasDecayed() const { return decayed; }
295 
297  inline int getSuccess() const { return success; }
298 
300  inline void setMagneticField(double b) { bField=b; }
301 
303  inline double getMagneticField() const { return bField; }
304 
306  inline void setDebug() { debug = true; }
307  inline void resetDebug() { debug = false; }
308 
309 };
310 
311 #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:272
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:279
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:273
void setDebug()
Set the debug leve;.
double properDecayTime
The proper decay time of the particle.
T sqrt(T t)
Definition: SSEVec.h:18
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:275
double Z() const
z of vertex
Definition: RawParticle.h:276
bool onEndcap(double rPos2) const
double charge() const
get the MEASURED charge
Definition: RawParticle.h:282
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:280
double X() const
x of vertex
Definition: RawParticle.h:274
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 propagateToHOLayer(bool first=true)
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
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