CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
MultipleScatteringSimulator Class Reference

#include <MultipleScatteringSimulator.h>

Inheritance diagram for MultipleScatteringSimulator:
MaterialEffectsSimulator

Public Member Functions

 MultipleScatteringSimulator (double A, double Z, double density, double radLen)
 Default Constructor. More...
 
 ~MultipleScatteringSimulator () override
 Default Destructor. More...
 
- Public Member Functions inherited from MaterialEffectsSimulator
RHEP_const_iter beginDaughters () const
 Returns const iterator to the beginning of the daughters list. More...
 
int closestDaughterId ()
 The id of the closest charged daughter (filled for nuclear interactions only) More...
 
double eMass () const
 Electron mass in GeV/c2. More...
 
RHEP_const_iter endDaughters () const
 Returns const iterator to the end of the daughters list. More...
 
double excitE () const
 Mean excitation energy (in GeV) More...
 
 MaterialEffectsSimulator (double A=28.0855, double Z=14.0000, double density=2.329, double radLen=9.360)
 
unsigned nDaughters () const
 Returns the number of daughters. More...
 
XYZVector orthogonal (const XYZVector &) const
 A vector orthogonal to another one (because it's not in XYZTLorentzVector) More...
 
double radLenIncm () const
 One radiation length in cm. More...
 
double rho () const
 Density in g/cm3. More...
 
virtual void save ()
 Used by NuclearInteractionSimulator to save last sampled event. More...
 
void setNormalVector (const GlobalVector &normal)
 Sets the vector normal to the surface traversed. More...
 
double theA () const
 A. More...
 
double theZ () const
 Z. More...
 
void updateState (ParticlePropagator &myTrack, double radlen, RandomEngineAndDistribution const *)
 Compute the material effect (calls the sub class) More...
 
virtual ~MaterialEffectsSimulator ()
 

Private Member Functions

void compute (ParticlePropagator &Particle, RandomEngineAndDistribution const *) override
 The real dE/dx generation and particle update. More...
 

Private Attributes

double sqr12
 Save (a tiny bit of) time. More...
 

Additional Inherited Members

- Public Types inherited from MaterialEffectsSimulator
typedef std::vector< RawParticle >::const_iterator RHEP_const_iter
 
- Protected Attributes inherited from MaterialEffectsSimulator
std::vector< RawParticle_theUpdatedState
 
double A
 
double density
 
double radLen
 
double radLengths
 
int theClosestChargedDaughterId
 
GlobalVector theNormalVector
 
double Z
 

Detailed Description

Definition at line 26 of file MultipleScatteringSimulator.h.

Constructor & Destructor Documentation

◆ MultipleScatteringSimulator()

MultipleScatteringSimulator::MultipleScatteringSimulator ( double  A,
double  Z,
double  density,
double  radLen 
)

Default Constructor.

Definition at line 6 of file MultipleScatteringSimulator.cc.

References sqr12, and mathSSE::sqrt().

8  sqr12 = std::sqrt(12.);
9 }
T sqrt(T t)
Definition: SSEVec.h:23
MaterialEffectsSimulator(double A=28.0855, double Z=14.0000, double density=2.329, double radLen=9.360)
double sqr12
Save (a tiny bit of) time.

◆ ~MultipleScatteringSimulator()

MultipleScatteringSimulator::~MultipleScatteringSimulator ( )
inlineoverride

Default Destructor.

Definition at line 32 of file MultipleScatteringSimulator.h.

32 {}

Member Function Documentation

◆ compute()

void MultipleScatteringSimulator::compute ( ParticlePropagator Particle,
RandomEngineAndDistribution const *  random 
)
overrideprivatevirtual

The real dE/dx generation and particle update.

Implements MaterialEffectsSimulator.

Definition at line 11 of file MultipleScatteringSimulator.cc.

References funct::cos(), dumpMFGeometry_cfg::delta, MillePedeFileConverter_cfg::e, RandomEngineAndDistribution::flatShoot(), RandomEngineAndDistribution::gaussShoot(), CrabHelper::log, callgraph::m2, normal, MaterialEffectsSimulator::orthogonal(), SiStripOfflineCRack_cfg::p2, phi, MaterialEffectsSimulator::radLengths, MaterialEffectsSimulator::radLenIncm(), funct::sin(), sqr12, mathSSE::sqrt(), MaterialEffectsSimulator::theNormalVector, tauSpinnerTable_cfi::theta, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

11  {
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.
static const char * normal
Definition: DMRtrends.cc:35
T z() const
Definition: PV3DBase.h:61
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
T sqrt(T t)
Definition: SSEVec.h:23
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)
ROOT::Math::AxisAngle Rotation
Definition: RawParticle.h:44
math::XYZVector XYZVector
Definition: RawParticle.h:26
double sqr12
Save (a tiny bit of) time.

Member Data Documentation

◆ sqr12

double MultipleScatteringSimulator::sqr12
private

Save (a tiny bit of) time.

Definition at line 40 of file MultipleScatteringSimulator.h.

Referenced by compute(), and MultipleScatteringSimulator().