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 }
MultipleScatteringSimulator::MultipleScatteringSimulator
MultipleScatteringSimulator(double A, double Z, double density, double radLen)
Default Constructor.
Definition: MultipleScatteringSimulator.cc:6
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
MaterialEffectsSimulator::theNormalVector
GlobalVector theNormalVector
Definition: MaterialEffectsSimulator.h:92
XYZVector
math::XYZVector XYZVector
Definition: RawParticle.h:26
RandomEngineAndDistribution.h
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
MaterialEffectsSimulator::orthogonal
XYZVector orthogonal(const XYZVector &) const
A vector orthogonal to another one (because it's not in XYZTLorentzVector)
Definition: MaterialEffectsSimulator.cc:30
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
p2
double p2[4]
Definition: TauolaWrapper.h:90
theta
Geom::Theta< T > theta() const
Definition: Basic3DVectorLD.h:150
fastSimProducer_cff.radLen
radLen
Definition: fastSimProducer_cff.py:62
MaterialEffectsSimulator
Definition: MaterialEffectsSimulator.h:25
MaterialEffectsSimulator::radLengths
double radLengths
Definition: MaterialEffectsSimulator.h:84
dumpMFGeometry_cfg.delta
delta
Definition: dumpMFGeometry_cfg.py:25
A
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
ParticlePropagator
Definition: ParticlePropagator.h:28
RandomEngineAndDistribution::flatShoot
double flatShoot(double xmin=0.0, double xmax=1.0) const
Definition: RandomEngineAndDistribution.h:27
MultipleScatteringSimulator::sqr12
double sqr12
Save (a tiny bit of) time.
Definition: MultipleScatteringSimulator.h:40
DDAxes::phi
MultipleScatteringSimulator::compute
void compute(ParticlePropagator &Particle, RandomEngineAndDistribution const *) override
The real dE/dx generation and particle update.
Definition: MultipleScatteringSimulator.cc:11
MultipleScatteringSimulator.h
RawParticle::Rotation
ROOT::Math::AxisAngle Rotation
Definition: RawParticle.h:44
Particle
Definition: Particle.py:1
dqm-mbProfile.log
log
Definition: dqm-mbProfile.py:17
BeamSpotPI::Z
Definition: BeamSpotPayloadInspectorHelper.h:33
RandomEngineAndDistribution::gaussShoot
double gaussShoot(double mean=0.0, double sigma=1.0) const
Definition: RandomEngineAndDistribution.h:29
fastSimProducer_cff.density
density
Definition: fastSimProducer_cff.py:61
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
MaterialEffectsSimulator::radLenIncm
double radLenIncm() const
One radiation length in cm.
Definition: MaterialEffectsSimulator.h:44
RandomEngineAndDistribution
Definition: RandomEngineAndDistribution.h:18