CMS 3D CMS Logo

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