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 propagateToHOLayer (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:278
double properDecayTime
The proper decay time of the particle.
double Z() const
z of vertex
Definition: RawParticle.h:276
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:278
double t() const
vertex time
Definition: RawParticle.h:273
double properDecayTime
The proper decay time of the particle.
double Z() const
z of vertex
Definition: RawParticle.h:276
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(), fileCollector::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:139
double charge() const
get the MEASURED charge
Definition: RawParticle.h:282
int propDir
The propagation direction.
double BaseParticlePropagator::c_light ( ) const
inlineprotected

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

Definition at line 153 of file BaseParticlePropagator.h.

Referenced by helixRadius(), and propagateToBeamCylinder().

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

Get the magnetic field.

Definition at line 303 of file BaseParticlePropagator.h.

References bField.

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

303 { 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 297 of file BaseParticlePropagator.h.

References success.

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

297 { 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 294 of file BaseParticlePropagator.h.

References decayed.

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

294 { 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 229 of file BaseParticlePropagator.h.

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

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

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

Definition at line 236 of file BaseParticlePropagator.h.

References mathSSE::sqrt().

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

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

Definition at line 242 of file BaseParticlePropagator.h.

References helixCentreX(), and helixCentreY().

Referenced by propagate().

242  {
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  }
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 249 of file BaseParticlePropagator.h.

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

The x coordinate of the helix axis.

Definition at line 207 of file BaseParticlePropagator.h.

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

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

207  {
208  // The x coordinate of the helix axis
209  return X() - helixRadius() * std::sin ( helixStartPhi() );
210  }
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:274
double helixStartPhi() const
The azimuth of the momentum at the vertex.
double BaseParticlePropagator::helixCentreX ( double  radius,
double  phi 
) const
inline

Definition at line 212 of file BaseParticlePropagator.h.

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

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

The y coordinate of the helix axis.

Definition at line 218 of file BaseParticlePropagator.h.

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

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

218  {
219  // The y coordinate of the helix axis
220  return Y() + helixRadius() * std::cos ( helixStartPhi() );
221 }
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:275
double helixStartPhi() const
The azimuth of the momentum at the vertex.
double BaseParticlePropagator::helixCentreY ( double  radius,
double  phi 
) const
inline

Definition at line 223 of file BaseParticlePropagator.h.

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

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

The helix Radius.

Definition at line 183 of file BaseParticlePropagator.h.

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

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

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

Definition at line 195 of file BaseParticlePropagator.h.

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

195  {
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  }
double c_light() const
The speed of light in mm/ns (!) without clhep (yeaaahhh!)
double charge() const
get the MEASURED charge
Definition: RawParticle.h:282
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 201 of file BaseParticlePropagator.h.

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

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

Just an internal trick.

Definition at line 171 of file BaseParticlePropagator.h.

References delta, rCyl, and rCyl2.

171 {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 255 of file BaseParticlePropagator.h.

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

Referenced by propagate().

255  {
256  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:279
double Z() const
z of vertex
Definition: RawParticle.h:276
bool BaseParticlePropagator::inside ( double  rPos2) const
inline

Definition at line 258 of file BaseParticlePropagator.h.

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

258  {
259  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:276
bool BaseParticlePropagator::onBarrel ( ) const
inline

Is the vertex already on the cylinder barrel ?

Definition at line 272 of file BaseParticlePropagator.h.

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

Referenced by onSurface(), and propagate().

272  {
273  double rPos2 = R2();
274  return ( fabs(rPos2-rCyl2) < 0.00001*rCyl && fabs(Z()) <= zCyl );
275  }
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:279
double Z() const
z of vertex
Definition: RawParticle.h:276
bool BaseParticlePropagator::onBarrel ( double  rPos2) const
inline

Definition at line 277 of file BaseParticlePropagator.h.

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

277  {
278  return ( fabs(rPos2-rCyl2) < 0.00001*rCyl && fabs(Z()) <= zCyl );
279  }
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:276
bool BaseParticlePropagator::onEndcap ( ) const
inline

Is the vertex already on the cylinder endcap ?

Definition at line 282 of file BaseParticlePropagator.h.

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

Referenced by onSurface(), and propagate().

282  {
283  return ( fabs(fabs(Z())-zCyl) < 0.00001 && R2() <= rCyl2 );
284  }
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:279
double Z() const
z of vertex
Definition: RawParticle.h:276
bool BaseParticlePropagator::onEndcap ( double  rPos2) const
inline

Definition at line 286 of file BaseParticlePropagator.h.

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

286  {
287  return ( fabs(fabs(Z())-zCyl) < 0.00001 && rPos2 <= rCyl2 );
288  }
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:276
bool BaseParticlePropagator::onFiducial ( ) const
inline

Is the vertex on some material ?

Definition at line 291 of file BaseParticlePropagator.h.

References fiducial.

Referenced by TrajectoryManager::propagateToLayer().

291 { 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 263 of file BaseParticlePropagator.h.

References onBarrel(), and onEndcap().

Referenced by propagate().

263  {
264  return ( onBarrel() || onEndcap() );
265  }
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 267 of file BaseParticlePropagator.h.

References onBarrel(), and onEndcap().

267  {
268  return ( onBarrel(rPos2) || onEndcap(rPos2) );
269  }
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, SiPixelRawToDigiRegional_cfi::deltaPhi, V0MonitoringClient_cfi::factor, firstLoop, helixCentreDistToAxis(), helixCentrePhi(), helixCentreX(), helixCentreY(), helixRadius(), helixStartPhi(), inside(), M_PI, RawParticle::mass(), min(), onBarrel(), onEndcap(), onSurface(), propDir, properDecayTime, properTime, reco::tau::disc::Pt(), SiStripMonitorClusterAlca_cfi::q0, 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(), propagateToHOLayer(), 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.
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
double mass() const
get the MEASURED mass
Definition: RawParticle.h:283
double R2() const
vertex radius**2
Definition: RawParticle.h:279
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:18
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
T min(T a, T b)
Definition: MathUtil.h:58
double charge() const
get the MEASURED charge
Definition: RawParticle.h:282
int propDir
The propagation direction.
#define M_PI
bool onEndcap() const
Is the vertex already on the cylinder endcap ?
bool decayed
The particle decayed while propagated !
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:274
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:277
bool onBarrel() const
Is the vertex already on the cylinder barrel ?
void setVertex(const XYZTLorentzVector &vtx)
set the vertex
Definition: RawParticle.h:288
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 630 of file BaseParticlePropagator.cc.

References a, b, bField, EnergyCorrector::c, c_light(), RawParticle::charge(), funct::cos(), gather_cfg::cout, alignCSCRings::e, helixCentreDistToAxis(), helixCentreX(), helixCentreY(), i, 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().

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

Definition at line 487 of file BaseParticlePropagator.cc.

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

Referenced by PFTrackTransformer::addPointsAndBrems(), FBaseSimEvent::fill(), ConvBremSeedProducer::GoodCluster(), 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:269
bool BaseParticlePropagator::propagateToHcalEntrance ( bool  first = true)

Definition at line 513 of file BaseParticlePropagator.cc.

References RawParticle::cos2ThetaV(), fileCollector::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:269
int propDir
The propagation direction.
bool BaseParticlePropagator::propagateToHcalExit ( bool  first = true)

Definition at line 566 of file BaseParticlePropagator.cc.

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

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

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)
int propDir
The propagation direction.
bool BaseParticlePropagator::propagateToHOLayer ( bool  first = true)

Definition at line 584 of file BaseParticlePropagator.cc.

References funct::abs(), fileCollector::done, propagate(), propDir, setPropagationConditions(), success, and RawParticle::Z().

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

584  {
585  //
586  // Propagation to Layer0 of HO (Ring-0)
587  // TODO: include proper geometry
588  // Geometry taken from CMSSW_3_1_X xml (Sunanda)
589  //
590 
591  // Approximate it to a single cylinder as it is not that crucial.
592  setPropagationConditions(387.6, 1000.0, first); //Dia is the middle of HO \sqrt{384.8**2+46.2**2}
593  // setPropagationConditions(410.2, 1000.0, first); //sqrt{406.6**2+54.2**2} //for outer layer
594  // this->rawPart().setCharge(0.0); ?? Shower Propagation ??
595  propDir = 0;
596  bool done = propagate();
597  propDir = 1;
598 
599  if ( done && abs(Z()) > 700.25) success = 0;
600 
601  return done;
602 }
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 Z() const
z of vertex
Definition: RawParticle.h:276
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int propDir
The propagation direction.
bool BaseParticlePropagator::propagateToNominalVertex ( const XYZTLorentzVector hit2 = XYZTLorentzVector(0.,0.,0.,0.))

Definition at line 606 of file BaseParticlePropagator.cc.

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

Referenced by ParticlePropagator::propagateToNominalVertex().

607 {
608 
609 
610  // Not implemented for neutrals (used for electrons only)
611  if ( charge() == 0. || bField == 0.) return false;
612 
613  // Define the proper pT direction to meet the point (vx,vy) in (x,y)
614  double dx = X()-v.X();
615  double dy = Y()-v.Y();
616  double phi = std::atan2(dy,dx) + std::asin ( std::sqrt(dx*dx+dy*dy)/(2.*helixRadius()) );
617 
618  // The absolute pT (kept to the original value)
619  double pT = pt();
620 
621  // Set the new pT
622  SetPx(pT*std::cos(phi));
623  SetPy(pT*std::sin(phi));
624 
625  return propagateToClosestApproach(v.X(),v.Y());
626 
627 }
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:18
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
double Y() const
y of vertex
Definition: RawParticle.h:275
double charge() const
get the MEASURED charge
Definition: RawParticle.h:282
double X() const
x of vertex
Definition: RawParticle.h:274
double bField
Magnetic field in the cylinder, oriented along the Z axis.
bool BaseParticlePropagator::propagateToPreshowerLayer1 ( bool  first = true)

Definition at line 446 of file BaseParticlePropagator.cc.

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

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

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:279
bool BaseParticlePropagator::propagateToPreshowerLayer2 ( bool  first = true)

Definition at line 466 of file BaseParticlePropagator.cc.

References fileCollector::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:279
bool BaseParticlePropagator::propagateToVFcalEntrance ( bool  first = true)

Definition at line 543 of file BaseParticlePropagator.cc.

References RawParticle::cos2ThetaV(), fileCollector::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:269
int propDir
The propagation direction.
void BaseParticlePropagator::resetDebug ( )
inline

Definition at line 307 of file BaseParticlePropagator.h.

References debug.

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

Set the debug leve;.

Definition at line 306 of file BaseParticlePropagator.h.

References debug.

306 { debug = true; }
bool debug
The debug level.
void BaseParticlePropagator::setMagneticField ( double  b)
inline
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(), propagateToHOLayer(), 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:278
double Z() const
z of vertex
Definition: RawParticle.h:276
double f[11][100]
void BaseParticlePropagator::setProperDecayTime ( double  t)
inline

Set the proper decay time.

Definition at line 168 of file BaseParticlePropagator.h.

References properDecayTime, and RawParticle::t().

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

168 { properDecayTime = t; }
double t() const
vertex time
Definition: RawParticle.h:273
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 755 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().

755  {
756 
757  double ip=0.;
758  double pT = Pt();
759 
760  if ( charge() != 0.0 && bField != 0.0 ) {
761  double radius = helixRadius(pT);
762  double phi0 = helixStartPhi();
763 
764  // The Helix centre coordinates are computed wrt to the z axis
765  double xC = helixCentreX(radius,phi0);
766  double yC = helixCentreY(radius,phi0);
767  double distz = helixCentreDistToAxis(xC-x0,yC-y0);
768  ip = distz - fabs(radius);
769  } else {
770  ip = fabs( Px() * (Y()-y0) - Py() * (X()-x0) ) / pT;
771  }
772 
773  return ip;
774 
775 }
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:275
double charge() const
get the MEASURED charge
Definition: RawParticle.h:282
double helixCentreY() const
The y coordinate of the helix axis.
double X() const
x of vertex
Definition: RawParticle.h:274
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 177 of file BaseParticlePropagator.h.

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

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

Member Data Documentation

double BaseParticlePropagator::bField
private

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

Definition at line 140 of file BaseParticlePropagator.h.

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

bool BaseParticlePropagator::debug
private
bool BaseParticlePropagator::decayed
private

The particle decayed while propagated !

Definition at line 159 of file BaseParticlePropagator.h.

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

bool BaseParticlePropagator::fiducial
protected

The particle traverses some real material.

Definition at line 150 of file BaseParticlePropagator.h.

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

bool BaseParticlePropagator::firstLoop
private

Do only the first half-loop.

Definition at line 157 of file BaseParticlePropagator.h.

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

int BaseParticlePropagator::propDir
private
double BaseParticlePropagator::properDecayTime
private

The proper decay time of the particle.

Definition at line 142 of file BaseParticlePropagator.h.

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

double BaseParticlePropagator::properTime
private

The proper time of the particle.

Definition at line 161 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 135 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 138 of file BaseParticlePropagator.h.

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