FastSimulation
MaterialEffects
src
MultipleScatteringSimulator.cc
Go to the documentation of this file.
1
#include "
FastSimulation/MaterialEffects/interface/MultipleScatteringSimulator.h
"
2
#include "
FastSimulation/Utilities/interface/RandomEngineAndDistribution.h
"
3
4
#include <cmath>
5
6
MultipleScatteringSimulator::MultipleScatteringSimulator
(
double
A
,
double
Z
,
double
density
,
double
radLen
)
7
:
MaterialEffectsSimulator
(
A
,
Z
,
density
,
radLen
) {
8
sqr12
=
std::sqrt
(12.);
9
}
10
11
void
MultipleScatteringSimulator::compute
(
ParticlePropagator
&
Particle
,
RandomEngineAndDistribution
const
* random) {
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 !
43
XYZVector
normal(
theNormalVector
.
x
(),
theNormalVector
.
y
(),
theNormalVector
.
z
());
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
}
MaterialEffectsSimulator::radLenIncm
double radLenIncm() const
One radiation length in cm.
Definition:
MaterialEffectsSimulator.h:44
SiStripOfflineCRack_cfg.p2
p2
Definition:
SiStripOfflineCRack_cfg.py:140
PV3DBase::z
T z() const
Definition:
PV3DBase.h:61
Particle
Definition:
Particle.py:1
funct::sin
Sin< T >::type sin(const T &t)
Definition:
Sin.h:22
MultipleScatteringSimulator::compute
void compute(ParticlePropagator &Particle, RandomEngineAndDistribution const *) override
The real dE/dx generation and particle update.
Definition:
MultipleScatteringSimulator.cc:11
MillePedeFileConverter_cfg.e
e
Definition:
MillePedeFileConverter_cfg.py:37
DDAxes::phi
ParticlePropagator
Definition:
ParticlePropagator.h:28
dumpMFGeometry_cfg.delta
delta
Definition:
dumpMFGeometry_cfg.py:25
PV3DBase::x
T x() const
Definition:
PV3DBase.h:59
PV3DBase::y
T y() const
Definition:
PV3DBase.h:60
fastSimProducer_cff.radLen
radLen
Definition:
fastSimProducer_cff.py:62
mathSSE::sqrt
T sqrt(T t)
Definition:
SSEVec.h:19
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
MultipleScatteringSimulator::MultipleScatteringSimulator
MultipleScatteringSimulator(double A, double Z, double density, double radLen)
Default Constructor.
Definition:
MultipleScatteringSimulator.cc:6
RandomEngineAndDistribution::gaussShoot
double gaussShoot(double mean=0.0, double sigma=1.0) const
Definition:
RandomEngineAndDistribution.h:29
MultipleScatteringSimulator.h
fastSimProducer_cff.density
density
Definition:
fastSimProducer_cff.py:61
MaterialEffectsSimulator::radLengths
double radLengths
Definition:
MaterialEffectsSimulator.h:84
callgraph.m2
m2
Definition:
callgraph.py:57
RawParticle::Rotation
ROOT::Math::AxisAngle Rotation
Definition:
RawParticle.h:44
RandomEngineAndDistribution.h
A
Definition:
APVGainStruct.h:7
RandomEngineAndDistribution::flatShoot
double flatShoot(double xmin=0.0, double xmax=1.0) const
Definition:
RandomEngineAndDistribution.h:27
dqm-mbProfile.log
log
Definition:
dqm-mbProfile.py:17
XYZVector
math::XYZVector XYZVector
Definition:
RawParticle.h:26
theta
Geom::Theta< T > theta() const
Definition:
Basic3DVectorLD.h:150
RandomEngineAndDistribution
Definition:
RandomEngineAndDistribution.h:18
BeamSpotPI::Z
Definition:
BeamSpotPayloadInspectorHelper.h:36
MaterialEffectsSimulator::theNormalVector
GlobalVector theNormalVector
Definition:
MaterialEffectsSimulator.h:92
MaterialEffectsSimulator
Definition:
MaterialEffectsSimulator.h:25
MultipleScatteringSimulator::sqr12
double sqr12
Save (a tiny bit of) time.
Definition:
MultipleScatteringSimulator.h:40
Generated for CMSSW Reference Manual by
1.8.14