File indexing completed on 2024-04-06 12:11:16
0001 #include "FastSimulation/MaterialEffects/interface/MultipleScatteringSimulator.h"
0002 #include "FastSimulation/Utilities/interface/RandomEngineAndDistribution.h"
0003
0004 #include <cmath>
0005
0006 MultipleScatteringSimulator::MultipleScatteringSimulator(double A, double Z, double density, double radLen)
0007 : MaterialEffectsSimulator(A, Z, density, radLen) {
0008 sqr12 = std::sqrt(12.);
0009 }
0010
0011 void MultipleScatteringSimulator::compute(ParticlePropagator& Particle, RandomEngineAndDistribution const* random) {
0012 double p2 = Particle.particle().Vect().Mag2();
0013 double m2 = Particle.particle().mass() * Particle.particle().mass();
0014 double e = std::sqrt(p2 + m2);
0015
0016 double pbeta = p2 / e;
0017
0018
0019
0020 double theta0 =
0021 0.0136 / pbeta * Particle.particle().charge() * std::sqrt(2. * radLengths) * (1. + 0.038 * std::log(radLengths));
0022
0023
0024 double theta = random->gaussShoot(0., theta0);
0025
0026 double phi = 2. * 3.14159265358979323 * random->flatShoot();
0027
0028 RawParticle::Rotation rotation1(orthogonal(Particle.particle().Vect()), theta);
0029 RawParticle::Rotation rotation2(Particle.particle().Vect(), phi);
0030
0031 Particle.particle().rotate(rotation1);
0032 Particle.particle().rotate(rotation2);
0033
0034
0035
0036
0037 double xp = (cos(phi) * theta / 2. + random->gaussShoot(0., theta0) / sqr12) * radLengths * radLenIncm();
0038 double yp = (sin(phi) * theta / 2. + random->gaussShoot(0., theta0) / sqr12) * radLengths * radLenIncm();
0039
0040
0041
0042
0043 XYZVector normal(theNormalVector.x(), theNormalVector.y(), theNormalVector.z());
0044 XYZVector tangent = orthogonal(normal);
0045
0046 XYZVector delta = xp * tangent + yp * normal.Cross(tangent);
0047
0048 Particle.particle().translate(delta);
0049 }