CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes
BaseParticlePropagator Class Reference

#include <BaseParticlePropagator.h>

Inheritance diagram for BaseParticlePropagator:
RawParticle ParticlePropagator

Public Member Functions

bool backPropagate ()
 
 BaseParticlePropagator ()
 Default c'tor. More...
 
 BaseParticlePropagator (const RawParticle &myPart, double r, double z, double B)
 
 BaseParticlePropagator (const RawParticle &myPart, double r, double z, double B, double t)
 
double getMagneticField () const
 Get the magnetic field. More...
 
int getSuccess () const
 Has propagation been performed and was barrel or endcap reached ? More...
 
bool hasDecayed () const
 Has the particle decayed while propagated ? More...
 
double helixCentreDistToAxis () const
 The distance between the cylinder and the helix axes. More...
 
double helixCentreDistToAxis (double xC, double yC) const
 
double helixCentrePhi () const
 The azimuth if the vector joining the cylinder and the helix axes. More...
 
double helixCentrePhi (double xC, double yC) const
 
double helixCentreX () const
 The x coordinate of the helix axis. More...
 
double helixCentreX (double radius, double phi) const
 
double helixCentreY () const
 The y coordinate of the helix axis. More...
 
double helixCentreY (double radius, double phi) const
 
double helixRadius () const
 The helix Radius. More...
 
double helixRadius (double pT) const
 
double helixStartPhi () const
 The azimuth of the momentum at the vertex. More...
 
void increaseRCyl (double delta)
 Just an internal trick. More...
 
void init ()
 Initialize internal switches and quantities. More...
 
bool inside () const
 Is the vertex inside the cylinder ? (stricly inside : true) More...
 
bool inside (double rPos2) const
 
bool onBarrel () const
 Is the vertex already on the cylinder barrel ? More...
 
bool onBarrel (double rPos2) const
 
bool onEndcap () const
 Is the vertex already on the cylinder endcap ? More...
 
bool onEndcap (double rPos2) const
 
bool onFiducial () const
 Is the vertex on some material ? More...
 
bool onSurface () const
 Is the vertex already on the cylinder surface ? More...
 
bool onSurface (double rPos2) const
 
bool propagate ()
 
BaseParticlePropagator propagated () const
 
bool propagateToBeamCylinder (const XYZTLorentzVector &v, double radius=0.)
 
bool propagateToClosestApproach (double x0=0., double y0=0, bool first=true)
 
bool propagateToEcal (bool first=true)
 
bool propagateToEcalEntrance (bool first=true)
 
bool propagateToHcalEntrance (bool first=true)
 
bool propagateToHcalExit (bool first=true)
 
bool propagateToNominalVertex (const XYZTLorentzVector &hit2=XYZTLorentzVector(0., 0., 0., 0.))
 
bool propagateToPreshowerLayer1 (bool first=true)
 
bool propagateToPreshowerLayer2 (bool first=true)
 
bool propagateToVFcalEntrance (bool first=true)
 
void resetDebug ()
 
void setDebug ()
 Set the debug leve;. More...
 
void setMagneticField (double b)
 Set the magnetic field. More...
 
void setPropagationConditions (double r, double z, bool firstLoop=true)
 Set the propagation characteristics (rCyl, zCyl and first loop only) More...
 
void setProperDecayTime (double t)
 Set the proper decay time. More...
 
double xyImpactParameter (double x0=0., double y0=0.) const
 Transverse impact parameter. More...
 
double zImpactParameter (double x0=0, double y0=0.) const
 Longitudinal impact parameter. More...
 
- Public Member Functions inherited from RawParticle
void boost (double bx, double by, double bz)
 
void boost (const Boost &b)
 
double charge () const
 get the MEASURED charge More...
 
void chargeConjugate ()
 
double cos2Theta () const
 Cos**2(theta) is faster to determine than eta. More...
 
double cos2ThetaV () const
 
double et () const
 get the transverse energy More...
 
double eta () const
 
int isUsed () const
 
double mass () const
 get the MEASURED mass More...
 
const XYZTLorentzVectormomentum () const
 the momentum fourvector More...
 
RawParticleoperator= (const RawParticle &rhs)
 
double PDGcharge () const
 get the THEORETICAL charge More...
 
double PDGcTau () const
 get the THEORETICAL lifetime More...
 
double PDGmass () const
 get the THEORETICAL mass More...
 
std::string PDGname () const
 get the PDG name More...
 
int pid () const
 get the HEP particle ID number More...
 
void print () const
 
void printName () const
 
double r () const
 vertex radius More...
 
double R () const
 vertex radius More...
 
double r2 () const
 vertex radius**2 More...
 
double R2 () const
 vertex radius**2 More...
 
 RawParticle ()
 
 RawParticle (const XYZTLorentzVector &p)
 
 RawParticle (const int id, const XYZTLorentzVector &p)
 
 RawParticle (const std::string name, const XYZTLorentzVector &p)
 
 RawParticle (const XYZTLorentzVector &p, const XYZTLorentzVector &xStart)
 
 RawParticle (double px, double py, double pz, double e)
 
 RawParticle (const RawParticle &p)
 
void reUse ()
 
void rotate (double rphi, const XYZVector &raxis)
 
void rotate (const Rotation &r)
 
void rotate (const Rotation3D &r)
 
void rotate (const RotationX &r)
 
void rotate (const RotationY &r)
 
void rotate (const RotationZ &r)
 
void rotateX (double rphi)
 
void rotateY (double rphi)
 
void rotateZ (double rphi)
 
void setCharge (float q)
 set the MEASURED charge More...
 
void setID (const int id)
 
void setID (const std::string name)
 
void setMass (float m)
 set the RECONSTRUCTED mass More...
 
void setStatus (int istat)
 
void setT (const double t)
 set the time of creation More...
 
void setVertex (const XYZTLorentzVector &vtx)
 set the vertex More...
 
void setVertex (double xv, double yv, double zv, double tv)
 
int status () const
 get the particle status More...
 
double t () const
 vertex time More...
 
double T () const
 vertex time More...
 
void translate (const XYZVector &t)
 
void use ()
 
const XYZTLorentzVectorvertex () const
 the vertex fourvector More...
 
double x () const
 x of vertex More...
 
double X () const
 x of vertex More...
 
double y () const
 y of vertex More...
 
double Y () const
 y of vertex More...
 
double z () const
 z of vertex More...
 
double Z () const
 z of vertex More...
 
virtual ~RawParticle ()
 

Protected Member Functions

double c_light () const
 The speed of light in mm/ns (!) without clhep (yeaaahhh!) More...
 

Protected Attributes

bool fiducial
 The particle traverses some real material. More...
 
int success
 0:propagation still be done, 1:reached 'barrel', 2:reached 'endcaps' More...
 
- Protected Attributes inherited from RawParticle
double myCharge
 the MEASURED charge More...
 
int myId
 the particle id number HEP-PID More...
 
const ParticleDatamyInfo
 The pointer to the PDG info. More...
 
double myMass
 the RECONSTRUCTED mass More...
 
int myStatus
 the status code according to PYTHIA More...
 
int myUsed
 status of the locking More...
 
XYZTLorentzVector myVertex
 the four vector of the vertex More...
 

Private Attributes

double bField
 Magnetic field in the cylinder, oriented along the Z axis. More...
 
bool debug
 The debug level. More...
 
bool decayed
 The particle decayed while propagated ! More...
 
bool firstLoop
 Do only the first half-loop. More...
 
int propDir
 The propagation direction. More...
 
double properDecayTime
 The proper decay time of the particle. More...
 
double properTime
 The proper time of the particle. More...
 
double rCyl
 Simulated particle that is to be resp has been propagated. More...
 
double rCyl2
 
double zCyl
 Half-height of the cylinder (centred at 0,0,0) to which propagation is done. More...
 

Additional Inherited Members

- Public Types inherited from RawParticle
typedef ROOT::Math::Boost Boost
 
typedef ROOT::Math::AxisAngle Rotation
 
typedef ROOT::Math::Rotation3D Rotation3D
 
typedef ROOT::Math::RotationX RotationX
 
typedef ROOT::Math::RotationY RotationY
 
typedef ROOT::Math::RotationZ RotationZ
 

Detailed Description

This class is aimed at propagating charged and neutral particles (yet under the form of a RawParticle) from a given vertex to a cylinder, defined by a radius rCyl and a length 2*zCyl, centered in (0,0,0) and whose axis is parallel to the B field (B is oriented along z, by definition of the z axis).

The main method

bool propagate()

returns true if an intersection between the propagated RawParticle and the cylinder is found. The location of the intersection is given by the value of success:

The method

propagated()

returns a new RawParticle with the propagated coordinates, if overwriting is not considered an advantage by the user.

Particles can be propagated backward with the method

backPropagate()

Member functions

o propagateToPreshowerLayer1(), o propagateToPreshowerLayer2(), o propagateToEcalEntrance(), o propagateToHcalEntrance(), o propagateToHcalExit(), o propagateToClosestApproach(),

only need a momentum, a vertex and an electric charge to operate. Radii, half-lengths and default B field (4T) are set therein by default.

As of today, no average loss of energy (dE/dx, Brems) is considered in the propagation. No uncertainty (multiple scattering, dE/dx, Brems) is yet implemented.

Author
Patrick Janot $Date : 19-Aug-2002, with subsequent modification for FAMOS
Version
15-Dec-2003

Definition at line 82 of file BaseParticlePropagator.h.

Constructor & Destructor Documentation

BaseParticlePropagator::BaseParticlePropagator ( )

Default c'tor.

Definition at line 4 of file BaseParticlePropagator.cc.

4  :
5  RawParticle(), rCyl(0.), rCyl2(0.), zCyl(0.), bField(0), properDecayTime(1E99)
6 {;}
double zCyl
Half-height of the cylinder (centred at 0,0,0) to which propagation is done.
double rCyl
Simulated particle that is to be resp has been propagated.
double properDecayTime
The proper decay time of the particle.
double bField
Magnetic field in the cylinder, oriented along the Z axis.
BaseParticlePropagator::BaseParticlePropagator ( const RawParticle myPart,
double  r,
double  z,
double  B 
)

Constructors taking as arguments a RawParticle, as well as the radius, half-height and magnetic field defining the cylinder for which propagation is to be performed, and optionally, the proper decay time

Definition at line 15 of file BaseParticlePropagator.cc.

References init().

16  :
17  RawParticle(myPart), rCyl(R), rCyl2(R*R), zCyl(Z), bField(B), properDecayTime(1E99)
18 {
19  init();
20 }
double zCyl
Half-height of the cylinder (centred at 0,0,0) to which propagation is done.
double rCyl
Simulated particle that is to be resp has been propagated.
void init()
Initialize internal switches and quantities.
double R() const
vertex radius
Definition: RawParticle.h:277
double properDecayTime
The proper decay time of the particle.
double Z() const
z of vertex
Definition: RawParticle.h:275
double bField
Magnetic field in the cylinder, oriented along the Z axis.
BaseParticlePropagator::BaseParticlePropagator ( const RawParticle myPart,
double  r,
double  z,
double  B,
double  t 
)

Definition at line 8 of file BaseParticlePropagator.cc.

References init().

9  :
10  RawParticle(myPart), rCyl(R), rCyl2(R*R), zCyl(Z), bField(B), properDecayTime(t)
11 {
12  init();
13 }
double zCyl
Half-height of the cylinder (centred at 0,0,0) to which propagation is done.
double rCyl
Simulated particle that is to be resp has been propagated.
void init()
Initialize internal switches and quantities.
double R() const
vertex radius
Definition: RawParticle.h:277
double t() const
vertex time
Definition: RawParticle.h:272
double properDecayTime
The proper decay time of the particle.
double Z() const
z of vertex
Definition: RawParticle.h:275
double bField
Magnetic field in the cylinder, oriented along the Z axis.

Member Function Documentation

bool BaseParticlePropagator::backPropagate ( )

Update the current instance, after the back-propagation of the particle to the surface of the cylinder

Definition at line 320 of file BaseParticlePropagator.cc.

References RawParticle::charge(), generateEDF::done, propagate(), propDir, and RawParticle::setCharge().

Referenced by propagated(), and propagateToClosestApproach().

320  {
321 
322  // Backpropagate
323  SetXYZT(-Px(),-Py(),-Pz(),E());
324  setCharge(-charge());
325  propDir = -1;
326  bool done = propagate();
327  SetXYZT(-Px(),-Py(),-Pz(),E());
328  setCharge(-charge());
329  propDir = +1;
330 
331  return done;
332 }
void setCharge(float q)
set the MEASURED charge
Definition: RawParticle.cc:138
double charge() const
get the MEASURED charge
Definition: RawParticle.h:281
int propDir
The propagation direction.
double BaseParticlePropagator::c_light ( ) const
inlineprotected

The speed of light in mm/ns (!) without clhep (yeaaahhh!)

Definition at line 151 of file BaseParticlePropagator.h.

Referenced by helixRadius(), and propagateToBeamCylinder().

151 { return 299.792458; }
double BaseParticlePropagator::getMagneticField ( ) const
inline

Get the magnetic field.

Definition at line 301 of file BaseParticlePropagator.h.

References bField.

Referenced by TrajectoryManager::createPSimHits(), and ConvBremSeedProducer::produce().

301 { return bField; }
double bField
Magnetic field in the cylinder, oriented along the Z axis.
int BaseParticlePropagator::getSuccess ( ) const
inline

Has propagation been performed and was barrel or endcap reached ?

Definition at line 295 of file BaseParticlePropagator.h.

References success.

Referenced by PFTrackTransformer::addPointsAndBrems(), FBaseSimEvent::fill(), ConvBremSeedProducer::GoodCluster(), GoodSeedProducer::produce(), ConvBremSeedProducer::produce(), TrajectoryManager::propagateToCalorimeters(), and TrajectoryManager::propagateToLayer().

295 { return success; }
int success
0:propagation still be done, 1:reached &#39;barrel&#39;, 2:reached &#39;endcaps&#39;
bool BaseParticlePropagator::hasDecayed ( ) const
inline

Has the particle decayed while propagated ?

Definition at line 292 of file BaseParticlePropagator.h.

References decayed.

Referenced by ParticlePropagator::propagateToBoundSurface(), and TrajectoryManager::propagateToCalorimeters().

292 { return decayed; }
bool decayed
The particle decayed while propagated !
double BaseParticlePropagator::helixCentreDistToAxis ( ) const
inline

The distance between the cylinder and the helix axes.

Definition at line 227 of file BaseParticlePropagator.h.

References helixCentreX(), helixCentreY(), and mathSSE::sqrt().

Referenced by propagate(), propagateToBeamCylinder(), propagateToClosestApproach(), and xyImpactParameter().

227  {
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  }
double helixCentreX() const
The x coordinate of the helix axis.
T sqrt(T t)
Definition: SSEVec.h:28
double helixCentreY() const
The y coordinate of the helix axis.
double BaseParticlePropagator::helixCentreDistToAxis ( double  xC,
double  yC 
) const
inline

Definition at line 234 of file BaseParticlePropagator.h.

References mathSSE::sqrt().

234  {
235  // Faster version of helixCentreDistToAxis
236  return std::sqrt( xC*xC + yC*yC );
237  }
T sqrt(T t)
Definition: SSEVec.h:28
double BaseParticlePropagator::helixCentrePhi ( ) const
inline

The azimuth if the vector joining the cylinder and the helix axes.

Definition at line 240 of file BaseParticlePropagator.h.

References helixCentreX(), and helixCentreY().

Referenced by propagate().

240  {
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  }
double helixCentreX() const
The x coordinate of the helix axis.
double helixCentreY() const
The y coordinate of the helix axis.
double BaseParticlePropagator::helixCentrePhi ( double  xC,
double  yC 
) const
inline

Definition at line 247 of file BaseParticlePropagator.h.

247  {
248  // Faster version of helixCentrePhi()
249  return xC == 0.0 && yC == 0.0 ? 0.0 : std::atan2(yC,xC);
250  }
double BaseParticlePropagator::helixCentreX ( ) const
inline

The x coordinate of the helix axis.

Definition at line 205 of file BaseParticlePropagator.h.

References helixRadius(), helixStartPhi(), funct::sin(), and RawParticle::X().

Referenced by helixCentreDistToAxis(), helixCentrePhi(), propagate(), propagateToBeamCylinder(), propagateToClosestApproach(), and xyImpactParameter().

205  {
206  // The x coordinate of the helix axis
207  return X() - helixRadius() * std::sin ( helixStartPhi() );
208  }
double helixRadius() const
The helix Radius.
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
double X() const
x of vertex
Definition: RawParticle.h:273
double helixStartPhi() const
The azimuth of the momentum at the vertex.
double BaseParticlePropagator::helixCentreX ( double  radius,
double  phi 
) const
inline

Definition at line 210 of file BaseParticlePropagator.h.

References funct::sin(), and RawParticle::X().

210  {
211  // Fast version of helixCentreX()
212  return X() - radius * std::sin (phi);
213  }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
double X() const
x of vertex
Definition: RawParticle.h:273
Definition: DDAxes.h:10
double BaseParticlePropagator::helixCentreY ( ) const
inline

The y coordinate of the helix axis.

Definition at line 216 of file BaseParticlePropagator.h.

References funct::cos(), helixRadius(), helixStartPhi(), and RawParticle::Y().

Referenced by helixCentreDistToAxis(), helixCentrePhi(), propagate(), propagateToBeamCylinder(), propagateToClosestApproach(), and xyImpactParameter().

216  {
217  // The y coordinate of the helix axis
218  return Y() + helixRadius() * std::cos ( helixStartPhi() );
219 }
double helixRadius() const
The helix Radius.
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
double Y() const
y of vertex
Definition: RawParticle.h:274
double helixStartPhi() const
The azimuth of the momentum at the vertex.
double BaseParticlePropagator::helixCentreY ( double  radius,
double  phi 
) const
inline

Definition at line 221 of file BaseParticlePropagator.h.

References funct::cos(), and RawParticle::Y().

221  {
222  // Fast version of helixCentreX()
223  return Y() + radius * std::cos (phi);
224  }
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
double Y() const
y of vertex
Definition: RawParticle.h:274
Definition: DDAxes.h:10
double BaseParticlePropagator::helixRadius ( ) const
inline

The helix Radius.

Definition at line 181 of file BaseParticlePropagator.h.

References bField, c_light(), RawParticle::charge(), and reco::tau::disc::Pt().

Referenced by helixCentreX(), helixCentreY(), propagate(), propagateToClosestApproach(), propagateToNominalVertex(), and xyImpactParameter().

181  {
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  }
double c_light() const
The speed of light in mm/ns (!) without clhep (yeaaahhh!)
double charge() const
get the MEASURED charge
Definition: RawParticle.h:281
double bField
Magnetic field in the cylinder, oriented along the Z axis.
double BaseParticlePropagator::helixRadius ( double  pT) const
inline

Definition at line 193 of file BaseParticlePropagator.h.

References bField, c_light(), and RawParticle::charge().

193  {
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  }
double c_light() const
The speed of light in mm/ns (!) without clhep (yeaaahhh!)
double charge() const
get the MEASURED charge
Definition: RawParticle.h:281
double bField
Magnetic field in the cylinder, oriented along the Z axis.
double BaseParticlePropagator::helixStartPhi ( ) const
inline

The azimuth of the momentum at the vertex.

Definition at line 199 of file BaseParticlePropagator.h.

Referenced by helixCentreX(), helixCentreY(), propagate(), propagateToClosestApproach(), and xyImpactParameter().

199  {
200  // The azimuth of the momentum at the vertex
201  return Px() == 0.0 && Py() == 0.0 ? 0.0 : std::atan2(Py(),Px());
202  }
void BaseParticlePropagator::increaseRCyl ( double  delta)
inline

Just an internal trick.

Definition at line 169 of file BaseParticlePropagator.h.

References delta, rCyl, and rCyl2.

169 {rCyl = rCyl + delta; rCyl2 = rCyl*rCyl; }
dbl * delta
Definition: mlp_gen.cc:36
double rCyl
Simulated particle that is to be resp has been propagated.
void BaseParticlePropagator::init ( void  )

Initialize internal switches and quantities.

Definition at line 23 of file BaseParticlePropagator.cc.

References debug, decayed, fiducial, firstLoop, propDir, properTime, and success.

Referenced by BaseParticlePropagator().

23  {
24 
25  // The status of the propagation
26  success = 0;
27  // Propagate only for the first half-loop
28  firstLoop = true;
29  //
30  fiducial = true;
31  // The particle has not yet decayed
32  decayed = false;
33  // The proper time is set to zero
34  properTime = 0.;
35  // The propagation direction is along the momentum
36  propDir = 1;
37  //
38  debug = false;
39 
40 }
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.
int propDir
The propagation direction.
bool decayed
The particle decayed while propagated !
bool debug
The debug level.
bool fiducial
The particle traverses some real material.
bool BaseParticlePropagator::inside ( ) const
inline

Is the vertex inside the cylinder ? (stricly inside : true)

Definition at line 253 of file BaseParticlePropagator.h.

References RawParticle::R2(), rCyl, rCyl2, RawParticle::Z(), and zCyl.

Referenced by propagate().

253  {
254  return (R2()<rCyl2-0.00001*rCyl && fabs(Z())<zCyl-0.00001);}
double zCyl
Half-height of the cylinder (centred at 0,0,0) to which propagation is done.
double rCyl
Simulated particle that is to be resp has been propagated.
double R2() const
vertex radius**2
Definition: RawParticle.h:278
double Z() const
z of vertex
Definition: RawParticle.h:275
bool BaseParticlePropagator::inside ( double  rPos2) const
inline

Definition at line 256 of file BaseParticlePropagator.h.

References rCyl, rCyl2, RawParticle::Z(), and zCyl.

256  {
257  return (rPos2<rCyl2-0.00001*rCyl && fabs(Z())<zCyl-0.00001);}
double zCyl
Half-height of the cylinder (centred at 0,0,0) to which propagation is done.
double rCyl
Simulated particle that is to be resp has been propagated.
double Z() const
z of vertex
Definition: RawParticle.h:275
bool BaseParticlePropagator::onBarrel ( ) const
inline

Is the vertex already on the cylinder barrel ?

Definition at line 270 of file BaseParticlePropagator.h.

References RawParticle::R2(), rCyl, rCyl2, RawParticle::Z(), and zCyl.

Referenced by onSurface(), and propagate().

270  {
271  double rPos2 = R2();
272  return ( fabs(rPos2-rCyl2) < 0.00001*rCyl && fabs(Z()) <= zCyl );
273  }
double zCyl
Half-height of the cylinder (centred at 0,0,0) to which propagation is done.
double rCyl
Simulated particle that is to be resp has been propagated.
double R2() const
vertex radius**2
Definition: RawParticle.h:278
double Z() const
z of vertex
Definition: RawParticle.h:275
bool BaseParticlePropagator::onBarrel ( double  rPos2) const
inline

Definition at line 275 of file BaseParticlePropagator.h.

References rCyl, rCyl2, RawParticle::Z(), and zCyl.

275  {
276  return ( fabs(rPos2-rCyl2) < 0.00001*rCyl && fabs(Z()) <= zCyl );
277  }
double zCyl
Half-height of the cylinder (centred at 0,0,0) to which propagation is done.
double rCyl
Simulated particle that is to be resp has been propagated.
double Z() const
z of vertex
Definition: RawParticle.h:275
bool BaseParticlePropagator::onEndcap ( ) const
inline

Is the vertex already on the cylinder endcap ?

Definition at line 280 of file BaseParticlePropagator.h.

References RawParticle::R2(), rCyl2, RawParticle::Z(), and zCyl.

Referenced by onSurface(), and propagate().

280  {
281  return ( fabs(fabs(Z())-zCyl) < 0.00001 && R2() <= rCyl2 );
282  }
double zCyl
Half-height of the cylinder (centred at 0,0,0) to which propagation is done.
double R2() const
vertex radius**2
Definition: RawParticle.h:278
double Z() const
z of vertex
Definition: RawParticle.h:275
bool BaseParticlePropagator::onEndcap ( double  rPos2) const
inline

Definition at line 284 of file BaseParticlePropagator.h.

References rCyl2, RawParticle::Z(), and zCyl.

284  {
285  return ( fabs(fabs(Z())-zCyl) < 0.00001 && rPos2 <= rCyl2 );
286  }
double zCyl
Half-height of the cylinder (centred at 0,0,0) to which propagation is done.
double Z() const
z of vertex
Definition: RawParticle.h:275
bool BaseParticlePropagator::onFiducial ( ) const
inline

Is the vertex on some material ?

Definition at line 289 of file BaseParticlePropagator.h.

References fiducial.

Referenced by TrajectoryManager::propagateToLayer().

289 { return fiducial; }
bool fiducial
The particle traverses some real material.
bool BaseParticlePropagator::onSurface ( ) const
inline

Is the vertex already on the cylinder surface ?

Definition at line 261 of file BaseParticlePropagator.h.

References onBarrel(), and onEndcap().

Referenced by propagate().

261  {
262  return ( onBarrel() || onEndcap() );
263  }
bool onEndcap() const
Is the vertex already on the cylinder endcap ?
bool onBarrel() const
Is the vertex already on the cylinder barrel ?
bool BaseParticlePropagator::onSurface ( double  rPos2) const
inline

Definition at line 265 of file BaseParticlePropagator.h.

References onBarrel(), and onEndcap().

265  {
266  return ( onBarrel(rPos2) || onEndcap(rPos2) );
267  }
bool onEndcap() const
Is the vertex already on the cylinder endcap ?
bool onBarrel() const
Is the vertex already on the cylinder barrel ?
bool BaseParticlePropagator::propagate ( )

Update the current instance, after the propagation of the particle to the surface of the cylinder

Definition at line 43 of file BaseParticlePropagator.cc.

References bField, RawParticle::charge(), funct::cos(), decayed, delta, Geom::deltaPhi(), firstLoop, helixCentreDistToAxis(), helixCentrePhi(), helixCentreX(), helixCentreY(), helixRadius(), helixStartPhi(), inside(), M_PI, RawParticle::mass(), min, onBarrel(), onEndcap(), onSurface(), propDir, properDecayTime, properTime, reco::tau::disc::Pt(), RawParticle::R2(), CosmicsPD_Skims::radius, rCyl, rCyl2, RawParticle::setVertex(), funct::sin(), mathSSE::sqrt(), success, RawParticle::T(), RawParticle::X(), RawParticle::Y(), RawParticle::Z(), and zCyl.

Referenced by PFTrackTransformer::addPointsAndBrems(), backPropagate(), ConvBremSeedProducer::produce(), propagated(), ParticlePropagator::propagateToBoundSurface(), propagateToEcal(), propagateToEcalEntrance(), propagateToHcalEntrance(), propagateToHcalExit(), FastPixelHitMatcher::propagateToLayer(), propagateToPreshowerLayer1(), propagateToPreshowerLayer2(), and propagateToVFcalEntrance().

43  {
44 
45 
46  //
47  // Check that the particle is not already on the cylinder surface
48  //
49  double rPos2 = R2();
50 
51  if ( onBarrel(rPos2) ) {
52  success = 1;
53  return true;
54  }
55  //
56  if ( onEndcap(rPos2) ) {
57  success = 2;
58  return true;
59  }
60  //
61  // Treat neutral particles (or no magnetic field) first
62  //
63  if ( fabs(charge()) < 1E-12 || bField < 1E-12 ) {
64 
65  //
66  // First check that the particle crosses the cylinder
67  //
68  double pT2 = Perp2();
69  // double pT2 = pT*pT;
70  // double b2 = rCyl * pT;
71  double b2 = rCyl2 * pT2;
72  double ac = fabs ( X()*Py() - Y()*Px() );
73  double ac2 = ac*ac;
74  //
75  // The particle never crosses (or never crossed) the cylinder
76  //
77  // if ( ac > b2 ) return false;
78  if ( ac2 > b2 ) return false;
79 
80  // double delta = std::sqrt(b2*b2 - ac*ac);
81  double delta = std::sqrt(b2 - ac2);
82  double tplus = -( X()*Px()+Y()*Py() ) + delta;
83  double tminus = -( X()*Px()+Y()*Py() ) - delta;
84  //
85  // Find the first (time-wise) intersection point with the cylinder
86  //
87 
88  double solution = tminus < 0 ? tplus/pT2 : tminus/pT2;
89  if ( solution < 0. ) return false;
90  //
91  // Check that the particle does (did) not exit from the endcaps first.
92  //
93  double zProp = Z() + Pz() * solution;
94  if ( fabs(zProp) > zCyl ) {
95  tplus = ( zCyl - Z() ) / Pz();
96  tminus = (-zCyl - Z() ) / Pz();
97  solution = tminus < 0 ? tplus : tminus;
98  if ( solution < 0. ) return false;
99  zProp = Z() + Pz() * solution;
100  success = 2;
101  }
102  else {
103  success = 1;
104  }
105 
106  //
107  // Check the decay time
108  //
109  double delTime = propDir * mass() * solution;
110  double factor = 1.;
111  properTime += delTime;
112  if ( properTime > properDecayTime ) {
113  factor = 1.-(properTime-properDecayTime)/delTime;
115  decayed = true;
116  }
117 
118  //
119  // Compute the coordinates of the RawParticle after propagation
120  //
121  double xProp = X() + Px() * solution * factor;
122  double yProp = Y() + Py() * solution * factor;
123  zProp = Z() + Pz() * solution * factor;
124  double tProp = T() + E() * solution * factor;
125 
126  //
127  // Last check : Although propagated to the endcaps, R could still be
128  // larger than rCyl because the cylinder was too short...
129  //
130  if ( success == 2 && xProp*xProp+yProp*yProp > rCyl2 ) {
131  success = -1;
132  return true;
133  }
134 
135  //
136  // ... and update the particle with its propagated coordinates
137  //
138  setVertex( XYZTLorentzVector(xProp,yProp,zProp,tProp) );
139 
140  return true;
141  }
142  //
143  // Treat charged particles with magnetic field next.
144  //
145  else {
146  //
147  // First check that the particle can cross the cylinder
148  //
149  double pT = Pt();
150  double radius = helixRadius(pT);
151  double phi0 = helixStartPhi();
152  double xC = helixCentreX(radius,phi0);
153  double yC = helixCentreY(radius,phi0);
154  double dist = helixCentreDistToAxis(xC,yC);
155  //
156  // The helix either is outside or includes the cylinder -> no intersection
157  //
158  if ( fabs ( fabs(radius) - dist ) > rCyl ) return false;
159  //
160  // The particle is already away from the endcaps, and will never come back
161  // Could be back-propagated, so warn the user that it is so.
162  //
163  if ( Z() * Pz() > zCyl * fabs(Pz()) ) {
164  success = -2;
165  return true;
166  }
167 
168  double pZ = Pz();
169  double phiProp, zProp;
170  //
171  // Does the helix cross the cylinder barrel ? If not, do the first half-loop
172  //
173  double rProp = std::min(fabs(radius)+dist-0.000001, rCyl);
174 
175  // Check for rounding errors in the ArcSin.
176  double sinPhiProp =
177  (rProp*rProp-radius*radius-dist*dist)/( 2.*dist*radius);
178 
179  //
180  double deltaPhi = 1E99;
181 
182  // Taylor development up to third order for large momenta
183  if ( 1.-fabs(sinPhiProp) < 1E-9 ) {
184 
185  double cphi0 = std::cos(phi0);
186  double sphi0 = std::sin(phi0);
187  double r0 = (X()*cphi0 + Y()*sphi0)/radius;
188  double q0 = (X()*sphi0 - Y()*cphi0)/radius;
189  double rcyl2 = (rCyl2 - X()*X() - Y()*Y())/(radius*radius);
190  double delta = r0*r0 + rcyl2*(1.-q0);
191 
192  // This is a solution of a second order equation, assuming phi = phi0 + epsilon
193  // and epsilon is small.
194  deltaPhi = radius > 0 ?
195  ( -r0 + std::sqrt(delta ) ) / (1.-q0) :
196  ( -r0 - std::sqrt(delta ) ) / (1.-q0);
197 
198  }
199 
200  // Use complete calculation otherwise, or if the delta phi is large anyway.
201  if ( fabs(deltaPhi) > 1E-3 ) {
202 
203  // phiProp = fabs(sinPhiProp) < 0.99999999 ?
204  // std::asin(sinPhiProp) : M_PI/2. * sinPhiProp;
205  phiProp = std::asin(sinPhiProp);
206 
207  //
208  // Compute phi after propagation (two solutions, but the asin definition
209  // (between -pi/2 and +pi/2) takes care of the wrong one.
210  //
211  phiProp = helixCentrePhi(xC,yC) +
212  ( inside(rPos2) || onSurface(rPos2) ? phiProp : M_PI-phiProp );
213 
214  //
215  // Solve the obvious two-pi ambiguities: more than one turn!
216  //
217  if ( fabs(phiProp - phi0) > 2.*M_PI )
218  phiProp += ( phiProp > phi0 ? -2.*M_PI : +2.*M_PI );
219 
220  //
221  // Check that the phi difference has the right sign, according to Q*B
222  // (Another two pi ambuiguity, slightly more subtle)
223  //
224  if ( (phiProp-phi0)*radius < 0.0 )
225  radius > 0.0 ? phiProp += 2 * M_PI : phiProp -= 2 * M_PI;
226 
227  } else {
228 
229  // Use Taylor
230  phiProp = phi0 + deltaPhi;
231 
232  }
233 
234  //
235  // Check that the particle does not exit from the endcaps first.
236  //
237  zProp = Z() + ( phiProp - phi0 ) * pZ * radius / pT ;
238  if ( fabs(zProp) > zCyl ) {
239 
240  zProp = zCyl * fabs(pZ)/pZ;
241  phiProp = phi0 + (zProp - Z()) / radius * pT / pZ;
242  success = 2;
243 
244  } else {
245 
246  //
247  // If the particle does not cross the barrel, either process the
248  // first-half loop only or propagate all the way down to the endcaps
249  //
250  if ( rProp < rCyl ) {
251 
252  if ( firstLoop || fabs(pZ)/pT < 1E-10 ) {
253 
254  success = 0;
255 
256  } else {
257 
258  zProp = zCyl * fabs(pZ)/pZ;
259  phiProp = phi0 + (zProp - Z()) / radius * pT / pZ;
260  success = 2;
261 
262  }
263  //
264  // The particle crossed the barrel
265  //
266  } else {
267 
268  success = 1;
269 
270  }
271  }
272  //
273  // Compute the coordinates of the RawParticle after propagation
274  //
275  //
276  // Check the decay time
277  //
278  double delTime = propDir * (phiProp-phi0)*radius*mass() / pT;
279  double factor = 1.;
280  properTime += delTime;
281  if ( properTime > properDecayTime ) {
282  factor = 1.-(properTime-properDecayTime)/delTime;
284  decayed = true;
285  }
286 
287  zProp = Z() + (zProp-Z())*factor;
288 
289  phiProp = phi0 + (phiProp-phi0)*factor;
290 
291  double sProp = std::sin(phiProp);
292  double cProp = std::cos(phiProp);
293  double xProp = xC + radius * sProp;
294  double yProp = yC - radius * cProp;
295  double tProp = T() + (phiProp-phi0)*radius*E()/pT;
296  double pxProp = pT * cProp;
297  double pyProp = pT * sProp;
298 
299  //
300  // Last check : Although propagated to the endcaps, R could still be
301  // larger than rCyl because the cylinder was too short...
302  //
303  if ( success == 2 && xProp*xProp+yProp*yProp > rCyl2 ) {
304  success = -1;
305  return true;
306  }
307  //
308  // ... and update the particle vertex and momentum
309  //
310  setVertex( XYZTLorentzVector(xProp,yProp,zProp,tProp) );
311  SetXYZT(pxProp,pyProp,pZ,E());
312  // SetPx(pxProp);
313  // SetPy(pyProp);
314  return true;
315 
316  }
317 }
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 helixCentrePhi() const
The azimuth if the vector joining the cylinder and the helix axes.
double rCyl
Simulated particle that is to be resp has been propagated.
double deltaPhi(float phi1, float phi2)
Definition: VectorUtil.h:30
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
#define min(a, b)
Definition: mlp_lapack.h:161
double mass() const
get the MEASURED mass
Definition: RawParticle.h:282
double R2() const
vertex radius**2
Definition: RawParticle.h:278
double helixCentreX() const
The x coordinate of the helix axis.
double helixCentreDistToAxis() const
The distance between the cylinder and the helix axes.
double properDecayTime
The proper decay time of the particle.
T sqrt(T t)
Definition: SSEVec.h:28
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
double charge() const
get the MEASURED charge
Definition: RawParticle.h:281
int propDir
The propagation direction.
bool onEndcap() const
Is the vertex already on the cylinder endcap ?
bool decayed
The particle decayed while propagated !
#define M_PI
Definition: BFit3D.cc:3
double helixCentreY() const
The y coordinate of the helix axis.
bool inside() const
Is the vertex inside the cylinder ? (stricly inside : true)
bool onSurface() const
Is the vertex already on the cylinder surface ?
double X() const
x of vertex
Definition: RawParticle.h:273
double helixStartPhi() const
The azimuth of the momentum at the vertex.
double bField
Magnetic field in the cylinder, oriented along the Z axis.
double T() const
vertex time
Definition: RawParticle.h:276
bool onBarrel() const
Is the vertex already on the cylinder barrel ?
void setVertex(const XYZTLorentzVector &vtx)
set the vertex
Definition: RawParticle.h:287
math::XYZTLorentzVector XYZTLorentzVector
Definition: RawParticle.h:15
BaseParticlePropagator BaseParticlePropagator::propagated ( ) const

Return a new instance, corresponding to the particle propagated to the surface of the cylinder

Definition at line 335 of file BaseParticlePropagator.cc.

References backPropagate(), firstLoop, propagate(), and success.

Referenced by ParticlePropagator::propagated().

335  {
336  // Copy the input particle in a new instance
337  BaseParticlePropagator myPropPart(*this);
338  // Allow for many loops
339  myPropPart.firstLoop=false;
340  // Propagate the particle !
341  myPropPart.propagate();
342  // Back propagate if the forward propagation was not a success
343  if (myPropPart.success < 0 )
344  myPropPart.backPropagate();
345  // Return the new instance
346  return myPropPart;
347 }
bool BaseParticlePropagator::propagateToBeamCylinder ( const XYZTLorentzVector v,
double  radius = 0. 
)

Definition at line 608 of file BaseParticlePropagator.cc.

References a, b, bField, trackerHits::c, c_light(), RawParticle::charge(), funct::cos(), gather_cfg::cout, helixCentreDistToAxis(), helixCentreX(), helixCentreY(), i, lumiNorm::norm, propagateToClosestApproach(), reco::tau::disc::Pt(), RawParticle::r(), RawParticle::r2(), CosmicsPD_Skims::radius, RawParticle::setCharge(), funct::sin(), mathSSE::sqrt(), RawParticle::X(), RawParticle::Y(), and RawParticle::Z().

Referenced by TrajectorySeedProducer::compatibleWithBeamAxis().

609 {
610 
611  // For neutral (or BField = 0, simply check that the track passes through the cylinder
612  if ( charge() == 0. || bField == 0.)
613  return fabs( Px() * Y() - Py() * X() ) / Pt() < radius;
614 
615  // Now go to the charged particles
616 
617  // A few needed intermediate variables (to make the code understandable)
618  // The inner cylinder
619  double r = radius;
620  double r2 = r*r;
621  double r4 = r2*r2;
622  // The two hits
623  double dx = X()-v.X();
624  double dy = Y()-v.Y();
625  double dz = Z()-v.Z();
626  double Sxy = X()*v.X() + Y()*v.Y();
627  double Dxy = Y()*v.X() - X()*v.Y();
628  double Dxy2 = Dxy*Dxy;
629  double Sxy2 = Sxy*Sxy;
630  double SDxy = dx*dx + dy*dy;
631  double SSDxy = std::sqrt(SDxy);
632  double ATxy = std::atan2(dy,dx);
633  // The coefficients of the second order equation for the trajectory radius
634  double a = r2 - Dxy2/SDxy;
635  double b = r * (r2 - Sxy);
636  double c = r4 - 2.*Sxy*r2 + Sxy2 + Dxy2;
637 
638  // Here are the four possible solutions for
639  // 1) The trajectory radius
640  std::vector<double> helixRs(4,static_cast<double>(0.));
641  helixRs[0] = (b - std::sqrt(b*b - a*c))/(2.*a);
642  helixRs[1] = (b + std::sqrt(b*b - a*c))/(2.*a);
643  helixRs[2] = -helixRs[0];
644  helixRs[3] = -helixRs[1];
645  // 2) The azimuthal direction at the second point
646  std::vector<double> helixPhis(4,static_cast<double>(0.));
647  helixPhis[0] = std::asin ( SSDxy/(2.*helixRs[0]) );
648  helixPhis[1] = std::asin ( SSDxy/(2.*helixRs[1]) );
649  helixPhis[2] = -helixPhis[0];
650  helixPhis[3] = -helixPhis[1];
651  // Only two solutions are valid though
652  double solution1=0.;
653  double solution2=0.;
654  double phi1=0.;
655  double phi2=0.;
656  // Loop over the four possibilities
657  for ( unsigned int i=0; i<4; ++i ) {
658  helixPhis[i] = ATxy + helixPhis[i];
659  // The centre of the helix
660  double xC = helixCentreX(helixRs[i],helixPhis[i]);
661  double yC = helixCentreY(helixRs[i],helixPhis[i]);
662  // The distance of that centre to the origin
663  double dist = helixCentreDistToAxis(xC, yC);
664  /*
665  std::cout << "Solution "<< i << " = " << helixRs[i] << " accepted ? "
666  << fabs(fabs(helixRs[i]) - dist ) << " - " << radius << " = "
667  << fabs(fabs(helixRs[i]) - dist ) - fabs(radius) << " "
668  << ( fabs( fabs(fabs(helixRs[i]) - dist) -fabs(radius) ) < 1e-6) << std::endl;
669  */
670  // Check that the propagation will lead to a trajectroy tangent to the inner cylinder
671  if ( fabs( fabs(fabs(helixRs[i]) - dist) -fabs(radius) ) < 1e-6 ) {
672  // Fill first solution
673  if ( solution1 == 0. ) {
674  solution1 = helixRs[i];
675  phi1 = helixPhis[i];
676  // Fill second solution (ordered)
677  } else if ( solution2 == 0. ) {
678  if ( helixRs[i] < solution1 ) {
679  solution2 = solution1;
680  solution1 = helixRs[i];
681  phi2 = phi1;
682  phi1 = helixPhis[i];
683  } else {
684  solution2 = helixRs[i];
685  phi2 = helixPhis[i];
686  }
687  // Must not happen!
688  } else {
689  std::cout << "warning !!! More than two solutions for this track !!! " << std::endl;
690  }
691  }
692  }
693 
694  // Find the largest possible pT compatible with coming from within the inne cylinder
695  double pT = 0.;
696  double helixPhi = 0.;
697  double helixR = 0.;
698  // This should not happen
699  if ( solution1*solution2 == 0. ) {
700  std::cout << "warning !!! Less than two solution for this track! "
701  << solution1 << " " << solution2 << std::endl;
702  return false;
703  // If the two solutions have opposite sign, it means that pT = infinity is a possibility.
704  } else if ( solution1*solution2 < 0. ) {
705  pT = 1000.;
706  double norm = pT/std::sqrt(SDxy);
707  setCharge(+1.);
708  SetXYZT(dx*norm,dy*norm,dz*norm,0.);
709  SetE(std::sqrt(Vect().Mag2()));
710  // Otherwise take the solution that gives the largest transverse momentum
711  } else {
712  if (solution1<0.) {
713  helixR = solution1;
714  helixPhi = phi1;
715  pT = fabs(solution1) * 1e-5 * c_light() *bField;
716  setCharge(+1.);
717  } else {
718  helixR = solution2;
719  helixPhi = phi2;
720  pT = fabs(solution2) * 1e-5 * c_light() *bField;
721  setCharge(-1.);
722  }
723  double norm = pT/std::sqrt(SDxy);
724  SetXYZT(pT*std::cos(helixPhi),pT*std::sin(helixPhi),dz*norm,0.);
725  SetE(std::sqrt(Vect().Mag2()));
726  }
727 
728  // Propagate to closest approach to get the Z value (a bit of an overkill)
730 
731 }
void setCharge(float q)
set the MEASURED charge
Definition: RawParticle.cc:138
int i
Definition: DBlmapReader.cc:9
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
double c_light() const
The speed of light in mm/ns (!) without clhep (yeaaahhh!)
bool propagateToClosestApproach(double x0=0., double y0=0, bool first=true)
double helixCentreX() const
The x coordinate of the helix axis.
double helixCentreDistToAxis() const
The distance between the cylinder and the helix axes.
double r2() const
vertex radius**2
Definition: RawParticle.h:280
T sqrt(T t)
Definition: SSEVec.h:28
tuple norm
Definition: lumiNorm.py:78
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
double charge() const
get the MEASURED charge
Definition: RawParticle.h:281
double helixCentreY() const
The y coordinate of the helix axis.
double b
Definition: hdecay.h:120
double r() const
vertex radius
Definition: RawParticle.h:279
double X() const
x of vertex
Definition: RawParticle.h:273
double a
Definition: hdecay.h:121
tuple cout
Definition: gather_cfg.py:41
double bField
Magnetic field in the cylinder, oriented along the Z axis.
mathSSE::Vec4< T > v
bool BaseParticlePropagator::propagateToClosestApproach ( double  x0 = 0.,
double  y0 = 0,
bool  first = true 
)

Update the particle after propagation to the closest approach from Z axis, to the preshower layer 1 & 2, to the ECAL entrance, to the HCAL entrance, the HCAL 2nd and 3rd layer (not coded yet), the VFCAL entrance, or any BoundSurface(disk or cylinder)

Definition at line 358 of file BaseParticlePropagator.cc.

References backPropagate(), bField, RawParticle::charge(), generateEDF::done, helixCentreDistToAxis(), helixCentreX(), helixCentreY(), helixRadius(), helixStartPhi(), RawParticle::momentum(), reco::tau::disc::Pt(), CosmicsPD_Skims::radius, setPropagationConditions(), RawParticle::setVertex(), mathSSE::sqrt(), RawParticle::vertex(), RawParticle::X(), RawParticle::Y(), and RawParticle::z().

Referenced by propagateToBeamCylinder(), ParticlePropagator::propagateToClosestApproach(), and propagateToNominalVertex().

358  {
359 
360  // Pre-computed quantities
361  double pT = Pt();
362  double radius = helixRadius(pT);
363  double phi0 = helixStartPhi();
364 
365  // The Helix centre coordinates are computed wrt to the z axis
366  // Actually the z axis might be centred on 0,0: it's the beam spot position (x0,y0)!
367  double xC = helixCentreX(radius,phi0);
368  double yC = helixCentreY(radius,phi0);
369  double distz = helixCentreDistToAxis(xC-x0,yC-y0);
370  double dist0 = helixCentreDistToAxis(xC,yC);
371 
372  //
373  // Propagation to point of clostest approach to z axis
374  //
375  double rz,r0,z;
376  if ( charge() != 0.0 && bField != 0.0 ) {
377  rz = fabs ( fabs(radius) - distz ) + std::sqrt(x0*x0+y0*y0) + 0.0000001;
378  r0 = fabs ( fabs(radius) - dist0 ) + 0.0000001;
379  } else {
380  rz = fabs( Px() * (Y()-y0) - Py() * (X()-x0) ) / Pt();
381  r0 = fabs( Px() * Y() - Py() * X() ) / Pt();
382  }
383 
384  z = 999999.;
385 
386  // Propagate to the first interesection point
387  // with cylinder of radius sqrt(x0**2+y0**2)
389  bool done = backPropagate();
390 
391  // Unsuccessful propagation - should not happen!
392  if ( !done ) return done;
393 
394  // The z axis is (0,0) - no need to go further
395  if ( fabs(rz-r0) < 1E-10 ) return done;
396  double dist1 = (X()-x0)*(X()-x0) + (Y()-y0)*(Y()-y0);
397 
398  // We are already at closest approach - no need to go further
399  if ( dist1 < 1E-10 ) return done;
400 
401  // Keep for later if it happens to be the right solution
402  XYZTLorentzVector vertex1 = vertex();
403  XYZTLorentzVector momentum1 = momentum();
404 
405  // Propagate to the distance of closest approach to (0,0)
407  done = backPropagate();
408  if ( !done ) return done;
409 
410  // Propagate to the first interesection point
411  // with cylinder of radius sqrt(x0**2+y0**2)
413  done = backPropagate();
414  if ( !done ) return done;
415  double dist2 = (X()-x0)*(X()-x0) + (Y()-y0)*(Y()-y0);
416 
417  // Keep the good solution.
418  if ( dist2 > dist1 ) {
419  setVertex(vertex1);
420  SetXYZT(momentum1.X(),momentum1.Y(),momentum1.Z(),momentum1.E());
421  dist2 = dist1;
422  }
423 
424  // Done
425  return done;
426 
427 }
double helixRadius() const
The helix Radius.
double z() const
z of vertex
Definition: RawParticle.h:271
void setPropagationConditions(double r, double z, bool firstLoop=true)
Set the propagation characteristics (rCyl, zCyl and first loop only)
double helixCentreX() const
The x coordinate of the helix axis.
const XYZTLorentzVector & momentum() const
the momentum fourvector
Definition: RawParticle.h:285
double helixCentreDistToAxis() const
The distance between the cylinder and the helix axes.
T sqrt(T t)
Definition: SSEVec.h:28
double Y() const
y of vertex
Definition: RawParticle.h:274
double charge() const
get the MEASURED charge
Definition: RawParticle.h:281
bool first
Definition: L1TdeRCT.cc:79
const XYZTLorentzVector & vertex() const
the vertex fourvector
Definition: RawParticle.h:284
double helixCentreY() const
The y coordinate of the helix axis.
double X() const
x of vertex
Definition: RawParticle.h:273
double helixStartPhi() const
The azimuth of the momentum at the vertex.
double bField
Magnetic field in the cylinder, oriented along the Z axis.
void setVertex(const XYZTLorentzVector &vtx)
set the vertex
Definition: RawParticle.h:287
math::XYZTLorentzVector XYZTLorentzVector
Definition: RawParticle.h:15
bool BaseParticlePropagator::propagateToEcal ( bool  first = true)

Definition at line 430 of file BaseParticlePropagator.cc.

References propagate(), and setPropagationConditions().

430  {
431  //
432  // Propagation to Ecal (including preshower) after the
433  // last Tracker layer
434  // TODO: include proper geometry
435  // Geometry taken from CMS ECAL TDR
436  //
437  // First propagate to global barrel / endcap cylinder
438  // setPropagationConditions(1290. , 3045 , first);
439  // New position of the preshower as of CMSSW_1_7_X
440  setPropagationConditions(129.0 , 303.353 , first);
441  return propagate();
442 
443 }
void setPropagationConditions(double r, double z, bool firstLoop=true)
Set the propagation characteristics (rCyl, zCyl and first loop only)
bool first
Definition: L1TdeRCT.cc:79
bool BaseParticlePropagator::propagateToEcalEntrance ( bool  first = true)

Definition at line 487 of file BaseParticlePropagator.cc.

References RawParticle::cos2ThetaV(), generateEDF::done, propagate(), setPropagationConditions(), and success.

Referenced by PFTrackTransformer::addPointsAndBrems(), FBaseSimEvent::fill(), ConvBremSeedProducer::GoodCluster(), GoodSeedProducer::produce(), and TrajectoryManager::propagateToCalorimeters().

487  {
488  //
489  // Propagation to ECAL entrance
490  // TODO: include proper geometry
491  // Geometry taken from CMS ECAL TDR
492  //
493  // First propagate to global barrel / endcap cylinder
494  setPropagationConditions(129.0 , 320.9,first);
495  bool done = propagate();
496 
497  // Go to endcap cylinder in the "barrel cut corner"
498  // eta = 1.479 -> cos^2(theta) = 0.81230
499  // if ( done && eta > 1.479 && success == 1 ) {
500  if ( done && cos2ThetaV() > 0.81230 && success == 1 ) {
501  setPropagationConditions(152.6 , 320.9, first);
502  done = propagate();
503  }
504 
505  // We are not in the ECAL acceptance
506  // eta = 3.0 -> cos^2(theta) = 0.99013
507  if ( cos2ThetaV() > 0.99014 ) success = 0;
508 
509  return done;
510 }
int success
0:propagation still be done, 1:reached &#39;barrel&#39;, 2:reached &#39;endcaps&#39;
void setPropagationConditions(double r, double z, bool firstLoop=true)
Set the propagation characteristics (rCyl, zCyl and first loop only)
double cos2ThetaV() const
Definition: RawParticle.h:268
bool first
Definition: L1TdeRCT.cc:79
bool BaseParticlePropagator::propagateToHcalEntrance ( bool  first = true)

Definition at line 513 of file BaseParticlePropagator.cc.

References RawParticle::cos2ThetaV(), generateEDF::done, propagate(), propDir, setPropagationConditions(), and success.

Referenced by PFTrackTransformer::addPointsAndBrems(), FBaseSimEvent::fill(), and TrajectoryManager::propagateToCalorimeters().

513  {
514  //
515  // Propagation to HCAL entrance
516  // TODO: include proper geometry
517  // Geometry taken from CMSSW_3_1_X xml (Sunanda)
518  //
519 
520  // First propagate to global barrel / endcap cylinder
521  setPropagationConditions(177.5 , 335.0, first);
522  propDir = 0;
523  bool done = propagate();
524  propDir = 1;
525 
526  // If went through the bottom of HB cylinder -> re-propagate to HE surface
527  if (done && success == 2) {
528  setPropagationConditions(300.0, 400.458, first);
529  propDir = 0;
530  done = propagate();
531  propDir = 1;
532  }
533 
534 
535  // out of the HB/HE acceptance
536  // eta = 3.0 -> cos^2(theta) = 0.99014
537  if ( done && cos2ThetaV() > 0.99014 ) success = 0;
538 
539  return done;
540 }
int success
0:propagation still be done, 1:reached &#39;barrel&#39;, 2:reached &#39;endcaps&#39;
void setPropagationConditions(double r, double z, bool firstLoop=true)
Set the propagation characteristics (rCyl, zCyl and first loop only)
double cos2ThetaV() const
Definition: RawParticle.h:268
bool first
Definition: L1TdeRCT.cc:79
int propDir
The propagation direction.
bool BaseParticlePropagator::propagateToHcalExit ( bool  first = true)

Definition at line 566 of file BaseParticlePropagator.cc.

References generateEDF::done, propagate(), propDir, and setPropagationConditions().

Referenced by PFTrackTransformer::addPointsAndBrems().

566  {
567  //
568  // Propagation to HCAL exit
569  // TODO: include proper geometry
570  // Geometry taken from CMSSW_3_1_X xml (Sunanda)
571  //
572 
573  // Approximate it to a single cylinder as it is not that crucial.
574  setPropagationConditions(263.9 , 554.1, first);
575  // this->rawPart().setCharge(0.0); ?? Shower Propagation ??
576  propDir = 0;
577  bool done = propagate();
578  propDir = 1;
579 
580  return done;
581 }
void setPropagationConditions(double r, double z, bool firstLoop=true)
Set the propagation characteristics (rCyl, zCyl and first loop only)
bool first
Definition: L1TdeRCT.cc:79
int propDir
The propagation direction.
bool BaseParticlePropagator::propagateToNominalVertex ( const XYZTLorentzVector hit2 = XYZTLorentzVector(0.,0.,0.,0.))

Definition at line 584 of file BaseParticlePropagator.cc.

References bField, RawParticle::charge(), funct::cos(), helixRadius(), phi, propagateToClosestApproach(), funct::sin(), mathSSE::sqrt(), RawParticle::X(), and RawParticle::Y().

Referenced by ParticlePropagator::propagateToNominalVertex().

585 {
586 
587 
588  // Not implemented for neutrals (used for electrons only)
589  if ( charge() == 0. || bField == 0.) return false;
590 
591  // Define the proper pT direction to meet the point (vx,vy) in (x,y)
592  double dx = X()-v.X();
593  double dy = Y()-v.Y();
594  double phi = std::atan2(dy,dx) + std::asin ( std::sqrt(dx*dx+dy*dy)/(2.*helixRadius()) );
595 
596  // The absolute pT (kept to the original value)
597  double pT = pt();
598 
599  // Set the new pT
600  SetPx(pT*std::cos(phi));
601  SetPy(pT*std::sin(phi));
602 
603  return propagateToClosestApproach(v.X(),v.Y());
604 
605 }
double helixRadius() const
The helix Radius.
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
bool propagateToClosestApproach(double x0=0., double y0=0, bool first=true)
T sqrt(T t)
Definition: SSEVec.h:28
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
double Y() const
y of vertex
Definition: RawParticle.h:274
double charge() const
get the MEASURED charge
Definition: RawParticle.h:281
double X() const
x of vertex
Definition: RawParticle.h:273
double bField
Magnetic field in the cylinder, oriented along the Z axis.
mathSSE::Vec4< T > v
Definition: DDAxes.h:10
bool BaseParticlePropagator::propagateToPreshowerLayer1 ( bool  first = true)

Definition at line 446 of file BaseParticlePropagator.cc.

References generateEDF::done, propagate(), RawParticle::R2(), setPropagationConditions(), and success.

Referenced by PFTrackTransformer::addPointsAndBrems(), FBaseSimEvent::fill(), TrajectoryManager::propagateToCalorimeters(), and GoodSeedProducer::PSforTMVA().

446  {
447  //
448  // Propagation to Preshower Layer 1
449  // TODO: include proper geometry
450  // Geometry taken from CMS ECAL TDR
451  //
452  // First propagate to global barrel / endcap cylinder
453  // setPropagationConditions(1290., 3045 , first);
454  // New position of the preshower as of CMSSW_1_7_X
455  setPropagationConditions(129.0, 303.353 , first);
456  bool done = propagate();
457 
458  // Check that were are on the Layer 1
459  if ( done && (R2() > 125.0*125.0 || R2() < 45.0*45.0) )
460  success = 0;
461 
462  return done;
463 }
int success
0:propagation still be done, 1:reached &#39;barrel&#39;, 2:reached &#39;endcaps&#39;
void setPropagationConditions(double r, double z, bool firstLoop=true)
Set the propagation characteristics (rCyl, zCyl and first loop only)
double R2() const
vertex radius**2
Definition: RawParticle.h:278
bool first
Definition: L1TdeRCT.cc:79
bool BaseParticlePropagator::propagateToPreshowerLayer2 ( bool  first = true)

Definition at line 466 of file BaseParticlePropagator.cc.

References generateEDF::done, propagate(), RawParticle::R2(), setPropagationConditions(), and success.

Referenced by PFTrackTransformer::addPointsAndBrems(), FBaseSimEvent::fill(), and TrajectoryManager::propagateToCalorimeters().

466  {
467  //
468  // Propagation to Preshower Layer 2
469  // TODO: include proper geometry
470  // Geometry taken from CMS ECAL TDR
471  //
472  // First propagate to global barrel / endcap cylinder
473  // setPropagationConditions(1290. , 3090 , first);
474  // New position of the preshower as of CMSSW_1_7_X
475  setPropagationConditions(129.0 , 307.838 , first);
476  bool done = propagate();
477 
478  // Check that we are on Layer 2
479  if ( done && (R2() > 125.0*125.0 || R2() < 45.0*45.0 ) )
480  success = 0;
481 
482  return done;
483 
484 }
int success
0:propagation still be done, 1:reached &#39;barrel&#39;, 2:reached &#39;endcaps&#39;
void setPropagationConditions(double r, double z, bool firstLoop=true)
Set the propagation characteristics (rCyl, zCyl and first loop only)
double R2() const
vertex radius**2
Definition: RawParticle.h:278
bool first
Definition: L1TdeRCT.cc:79
bool BaseParticlePropagator::propagateToVFcalEntrance ( bool  first = true)

Definition at line 543 of file BaseParticlePropagator.cc.

References RawParticle::cos2ThetaV(), generateEDF::done, propagate(), propDir, setPropagationConditions(), and success.

Referenced by FBaseSimEvent::fill(), and TrajectoryManager::propagateToCalorimeters().

543  {
544  //
545  // Propagation to VFCAL entrance
546  // TODO: include proper geometry
547  // Geometry taken from DAQ TDR Chapter 13
548 
549  setPropagationConditions(400.0 , 1110.0, first);
550  propDir = 0;
551  bool done = propagate();
552  propDir = 1;
553 
554  if (!done) success = 0;
555 
556  // We are not in the VFCAL acceptance
557  // eta = 3.0 -> cos^2(theta) = 0.99014
558  // eta = 5.2 -> cos^2(theta) = 0.9998755
559  double c2teta = cos2ThetaV();
560  if ( done && ( c2teta < 0.99014 || c2teta > 0.9998755 ) ) success = 0;
561 
562  return done;
563 }
int success
0:propagation still be done, 1:reached &#39;barrel&#39;, 2:reached &#39;endcaps&#39;
void setPropagationConditions(double r, double z, bool firstLoop=true)
Set the propagation characteristics (rCyl, zCyl and first loop only)
double cos2ThetaV() const
Definition: RawParticle.h:268
bool first
Definition: L1TdeRCT.cc:79
int propDir
The propagation direction.
void BaseParticlePropagator::resetDebug ( )
inline

Definition at line 305 of file BaseParticlePropagator.h.

References debug.

305 { debug = false; }
bool debug
The debug level.
void BaseParticlePropagator::setDebug ( )
inline

Set the debug leve;.

Definition at line 304 of file BaseParticlePropagator.h.

References debug.

304 { debug = true; }
bool debug
The debug level.
void BaseParticlePropagator::setMagneticField ( double  b)
inline

Set the magnetic field.

Definition at line 298 of file BaseParticlePropagator.h.

References b, and bField.

Referenced by ParticlePropagator::ParticlePropagator(), ParticlePropagator::propagateToBoundSurface(), ParticlePropagator::propagateToClosestApproach(), and ParticlePropagator::propagateToNominalVertex().

298 { bField=b; }
double b
Definition: hdecay.h:120
double bField
Magnetic field in the cylinder, oriented along the Z axis.
void BaseParticlePropagator::setPropagationConditions ( double  r,
double  z,
bool  firstLoop = true 
)

Set the propagation characteristics (rCyl, zCyl and first loop only)

Definition at line 350 of file BaseParticlePropagator.cc.

References f, firstLoop, RawParticle::R(), rCyl, rCyl2, RawParticle::Z(), and zCyl.

Referenced by PFTrackTransformer::addPointsAndBrems(), propagateToClosestApproach(), propagateToEcal(), propagateToEcalEntrance(), propagateToHcalEntrance(), propagateToHcalExit(), FastPixelHitMatcher::propagateToLayer(), propagateToPreshowerLayer1(), propagateToPreshowerLayer2(), propagateToVFcalEntrance(), and ParticlePropagator::setPropagationConditions().

350  {
351  rCyl = R;
352  rCyl2 = R*R;
353  zCyl = Z;
354  firstLoop = f;
355 }
double zCyl
Half-height of the cylinder (centred at 0,0,0) to which propagation is done.
double rCyl
Simulated particle that is to be resp has been propagated.
bool firstLoop
Do only the first half-loop.
double R() const
vertex radius
Definition: RawParticle.h:277
double Z() const
z of vertex
Definition: RawParticle.h:275
double f[11][100]
void BaseParticlePropagator::setProperDecayTime ( double  t)
inline

Set the proper decay time.

Definition at line 166 of file BaseParticlePropagator.h.

References properDecayTime, and RawParticle::t().

Referenced by ParticlePropagator::initProperDecayTime(), and ParticlePropagator::ParticlePropagator().

166 { properDecayTime = t; }
double t() const
vertex time
Definition: RawParticle.h:272
double properDecayTime
The proper decay time of the particle.
double BaseParticlePropagator::xyImpactParameter ( double  x0 = 0.,
double  y0 = 0. 
) const

Transverse impact parameter.

Definition at line 734 of file BaseParticlePropagator.cc.

References bField, RawParticle::charge(), helixCentreDistToAxis(), helixCentreX(), helixCentreY(), helixRadius(), helixStartPhi(), reco::tau::disc::Pt(), CosmicsPD_Skims::radius, RawParticle::X(), and RawParticle::Y().

Referenced by TrajectorySeedProducer::produce().

734  {
735 
736  double ip=0.;
737  double pT = Pt();
738 
739  if ( charge() != 0.0 && bField != 0.0 ) {
740  double radius = helixRadius(pT);
741  double phi0 = helixStartPhi();
742 
743  // The Helix centre coordinates are computed wrt to the z axis
744  double xC = helixCentreX(radius,phi0);
745  double yC = helixCentreY(radius,phi0);
746  double distz = helixCentreDistToAxis(xC-x0,yC-y0);
747  ip = distz - fabs(radius);
748  } else {
749  ip = fabs( Px() * (Y()-y0) - Py() * (X()-x0) ) / pT;
750  }
751 
752  return ip;
753 
754 }
double helixRadius() const
The helix Radius.
double helixCentreX() const
The x coordinate of the helix axis.
double helixCentreDistToAxis() const
The distance between the cylinder and the helix axes.
double Y() const
y of vertex
Definition: RawParticle.h:274
double charge() const
get the MEASURED charge
Definition: RawParticle.h:281
double helixCentreY() const
The y coordinate of the helix axis.
double X() const
x of vertex
Definition: RawParticle.h:273
double helixStartPhi() const
The azimuth of the momentum at the vertex.
double bField
Magnetic field in the cylinder, oriented along the Z axis.
double BaseParticlePropagator::zImpactParameter ( double  x0 = 0,
double  y0 = 0. 
) const
inline

Longitudinal impact parameter.

Definition at line 175 of file BaseParticlePropagator.h.

References mathSSE::sqrt(), RawParticle::X(), RawParticle::Y(), and RawParticle::Z().

Referenced by TrajectorySeedProducer::produce().

175  {
176  // Longitudinal impact parameter
177  return Z() - Pz() * std::sqrt( ((X()-x0)*(X()-x0) + (Y()-y0)*(Y()-y0) ) / Perp2());
178  }
T sqrt(T t)
Definition: SSEVec.h:28
double Y() const
y of vertex
Definition: RawParticle.h:274
double Z() const
z of vertex
Definition: RawParticle.h:275
double X() const
x of vertex
Definition: RawParticle.h:273

Member Data Documentation

double BaseParticlePropagator::bField
private

Magnetic field in the cylinder, oriented along the Z axis.

Definition at line 138 of file BaseParticlePropagator.h.

Referenced by getMagneticField(), helixRadius(), propagate(), propagateToBeamCylinder(), propagateToClosestApproach(), propagateToNominalVertex(), setMagneticField(), and xyImpactParameter().

bool BaseParticlePropagator::debug
private

The debug level.

Definition at line 142 of file BaseParticlePropagator.h.

Referenced by init(), resetDebug(), and setDebug().

bool BaseParticlePropagator::decayed
private

The particle decayed while propagated !

Definition at line 157 of file BaseParticlePropagator.h.

Referenced by hasDecayed(), init(), and propagate().

bool BaseParticlePropagator::fiducial
protected

The particle traverses some real material.

Definition at line 148 of file BaseParticlePropagator.h.

Referenced by init(), onFiducial(), and ParticlePropagator::propagateToBoundSurface().

bool BaseParticlePropagator::firstLoop
private

Do only the first half-loop.

Definition at line 155 of file BaseParticlePropagator.h.

Referenced by init(), propagate(), propagated(), ParticlePropagator::setPropagationConditions(), and setPropagationConditions().

int BaseParticlePropagator::propDir
private

The propagation direction.

Definition at line 161 of file BaseParticlePropagator.h.

Referenced by backPropagate(), init(), propagate(), propagateToHcalEntrance(), propagateToHcalExit(), and propagateToVFcalEntrance().

double BaseParticlePropagator::properDecayTime
private

The proper decay time of the particle.

Definition at line 140 of file BaseParticlePropagator.h.

Referenced by ParticlePropagator::initProperDecayTime(), propagate(), and setProperDecayTime().

double BaseParticlePropagator::properTime
private

The proper time of the particle.

Definition at line 159 of file BaseParticlePropagator.h.

Referenced by init(), and propagate().

double BaseParticlePropagator::rCyl
private

Simulated particle that is to be resp has been propagated.

Radius of the cylinder (centred at 0,0,0) to which propagation is done

Definition at line 133 of file BaseParticlePropagator.h.

Referenced by increaseRCyl(), inside(), onBarrel(), propagate(), and setPropagationConditions().

double BaseParticlePropagator::rCyl2
private
int BaseParticlePropagator::success
protected
double BaseParticlePropagator::zCyl
private

Half-height of the cylinder (centred at 0,0,0) to which propagation is done.

Definition at line 136 of file BaseParticlePropagator.h.

Referenced by inside(), onBarrel(), onEndcap(), propagate(), and setPropagationConditions().