CMS 3D CMS Logo

MultipleScatteringSimulator.cc
Go to the documentation of this file.
3 
4 #include <cmath>
5 
8  sqr12 = std::sqrt(12.);
9 }
10 
12  double p2 = Particle.particle().Vect().Mag2();
13  double m2 = Particle.particle().mass() * Particle.particle().mass();
14  double e = std::sqrt(p2 + m2);
15 
16  double pbeta = p2 / e; // This is p*beta
17 
18  // Average multiple scattering angle from Moliere radius
19  // The sqrt(2) factor is because of the *space* angle
20  double theta0 =
21  0.0136 / pbeta * Particle.particle().charge() * std::sqrt(2. * radLengths) * (1. + 0.038 * std::log(radLengths));
22 
23  // Generate multiple scattering space angle perpendicular to the particle motion
24  double theta = random->gaussShoot(0., theta0);
25  // Plus a random rotation angle around the particle motion
26  double phi = 2. * 3.14159265358979323 * random->flatShoot();
27  // The two rotations
28  RawParticle::Rotation rotation1(orthogonal(Particle.particle().Vect()), theta);
29  RawParticle::Rotation rotation2(Particle.particle().Vect(), phi);
30  // Rotate!
31  Particle.particle().rotate(rotation1);
32  Particle.particle().rotate(rotation2);
33 
34  // Generate mutiple scattering displacements in cm (assuming the detectors
35  // are silicon only to determine the thickness) in the directions orthogonal
36  // to the vector normal to the surface
37  double xp = (cos(phi) * theta / 2. + random->gaussShoot(0., theta0) / sqr12) * radLengths * radLenIncm();
38  double yp = (sin(phi) * theta / 2. + random->gaussShoot(0., theta0) / sqr12) * radLengths * radLenIncm();
39 
40  // Determine a unitary vector tangent to the surface
41  // This tangent vector is unitary because "normal" is
42  // either (0,0,1) in the Endcap or (x,y,0) in the Barrel !
44  XYZVector tangent = orthogonal(normal);
45  // The total displacement
46  XYZVector delta = xp * tangent + yp * normal.Cross(tangent);
47  // Translate!
48  Particle.particle().translate(delta);
49 }
double radLenIncm() const
One radiation length in cm.
T z() const
Definition: PV3DBase.h:61
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
void compute(ParticlePropagator &Particle, RandomEngineAndDistribution const *) override
The real dE/dx generation and particle update.
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
T sqrt(T t)
Definition: SSEVec.h:19
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
XYZVector orthogonal(const XYZVector &) const
A vector orthogonal to another one (because it&#39;s not in XYZTLorentzVector)
MultipleScatteringSimulator(double A, double Z, double density, double radLen)
Default Constructor.
double gaussShoot(double mean=0.0, double sigma=1.0) const
ROOT::Math::AxisAngle Rotation
Definition: RawParticle.h:44
Definition: APVGainStruct.h:7
double flatShoot(double xmin=0.0, double xmax=1.0) const
math::XYZVector XYZVector
Definition: RawParticle.h:26
Geom::Theta< T > theta() const
double sqr12
Save (a tiny bit of) time.