CMS 3D CMS Logo

EnergyLoss.cc
Go to the documentation of this file.
6 
7 #include <cmath>
8 #include <memory>
9 
14 
15 
17 // Author: Patrick Janot
18 // Date: 8-Jan-2004
19 //
20 // Revision: Class structure modified to match SimplifiedGeometryPropagator
21 // Fixed a bug in which particles could deposit more energy than they have
22 // S. Kurz, 29 May 2017
24 
25 
26 namespace fastsim
27 {
29 
36  {
37  public:
40 
42  ~EnergyLoss() override{;};
43 
45 
51  void interact(fastsim::Particle & particle, const SimplifiedGeometry & layer, std::vector<std::unique_ptr<fastsim::Particle> > & secondaries, const RandomEngineAndDistribution & random) override;
52 
53  private:
55  double minMomentum_;
56  double density_;
57  double radLenInCm_;
58  double A_;
59  double Z_;
60  };
61 }
62 
65 {
66  // Set the minimal momentum
67  minMomentum_ = cfg.getParameter<double>("minMomentumCut");
68  // Material properties
69  A_ = cfg.getParameter<double>("A");
70  Z_ = cfg.getParameter<double>("Z");
71  density_ = cfg.getParameter<double>("density");
72  radLenInCm_ = cfg.getParameter<double>("radLen");
73 }
74 
75 void fastsim::EnergyLoss::interact(fastsim::Particle & particle, const SimplifiedGeometry & layer,std::vector<std::unique_ptr<fastsim::Particle> > & secondaries,const RandomEngineAndDistribution & random)
76 {
77  // Reset the energy deposit in the layer
78  particle.setEnergyDeposit(0);
79 
80  //
81  // no material
82  //
83  double radLengths = layer.getThickness(particle.position(),particle.momentum());
84  if(radLengths < 1E-10)
85  {
86  return;
87  }
88 
89  //
90  // only charged particles
91  //
92  if(particle.charge()==0)
93  {
94  return;
95  }
96 
97  //
98  // minimum momentum
99  //
100  double p2 = particle.momentum().Vect().Mag2();
101  if(p2 < minMomentum_ * minMomentum_){
102  return;
103  }
104 
105  // Mean excitation energy (in GeV)
106  double excitE = 12.5E-9 * Z_;
107 
108  // The thickness in cm
109  double thick = radLengths * radLenInCm_;
110 
111  // This is a simple version (a la PDG) of a dE/dx generator.
112  // It replaces the buggy GEANT3 -> C++ former version.
113  // Author : Patrick Janot - 8-Jan-2004
114 
115  double m2 = particle.momentum().mass() * particle.momentum().mass();
116  double e2 = p2 + m2;
117 
118  double beta2 = p2 / e2;
119  double gama2 = e2 / m2;
120 
121  double charge2 = particle.charge() * particle.charge();
122 
123  // Energy loss spread in GeV
124  double eSpread = 0.1536E-3 * charge2 * (Z_ / A_) * density_ * thick / beta2;
125 
126  // Most probable energy loss (from the integrated Bethe-Bloch equation)
127  double mostProbableLoss = eSpread * (
128  log(2. * fastsim::Constants::eMass * beta2 * gama2 * eSpread / (excitE*excitE))
129  - beta2 + 0.200);
130 
131  // Generate the energy loss with Landau fluctuations
132  double dedx = mostProbableLoss + eSpread * theGenerator.landau(&random);
133 
134  // Compute the new energy and momentum
135  double newE = particle.momentum().e() - dedx;
136 
137  // Particle is stopped
138  if(newE < particle.momentum().mass()){
139  particle.momentum().SetXYZT(0.,0.,0.,0.);
140  // The energy is deposited in the detector
141  // Assigned with SimHit (if active layer) -> see TrackerSimHitProducer
142  particle.setEnergyDeposit(particle.momentum().e() - particle.momentum().mass());
143  return;
144  }
145 
146  // Relative change in momentum
147  double fac = std::sqrt((newE * newE - m2) / p2);
148 
149  // The energy is deposited in the detector
150  // Assigned with SimHit (if active layer) -> see TrackerSimHitProducer
151  particle.setEnergyDeposit(dedx);
152 
153  // Update the momentum
154  particle.momentum().SetXYZT(particle.momentum().Px() * fac,
155  particle.momentum().Py() * fac,
156  particle.momentum().Pz() * fac,
157  newE);
158 }
159 
163  "fastsim::EnergyLoss"
164  );
T getParameter(std::string const &) const
Implementation of a generic detector layer (base class for forward/barrel layers).
const math::XYZTLorentzVector & position() const
Return position of the particle.
Definition: Particle.h:142
double Z_
Atomic number of material (usually silicon Z=14)
Definition: EnergyLoss.cc:59
double radLenInCm_
Radiation length of material (usually silicon X0=9.360)
Definition: EnergyLoss.cc:57
void interact(fastsim::Particle &particle, const SimplifiedGeometry &layer, std::vector< std::unique_ptr< fastsim::Particle > > &secondaries, const RandomEngineAndDistribution &random) override
Perform the interaction.
Definition: EnergyLoss.cc:75
double A_
Atomic weight of material (usually silicon A=28.0855)
Definition: EnergyLoss.cc:58
TRandom random
Definition: MVATrainer.cc:138
static double constexpr eMass
Electron mass[GeV].
Definition: Constants.h:17
~EnergyLoss() override
Default destructor.
Definition: EnergyLoss.cc:42
EnergyLoss(const std::string &name, const edm::ParameterSet &cfg)
Constructor.
Definition: EnergyLoss.cc:63
Base class for any interaction model between a particle and a tracker layer.
LandauFluctuationGenerator theGenerator
Generator to do Landau fluctuation.
Definition: EnergyLoss.cc:54
Implementation of most probable energy loss by ionization in the tracker layers.
Definition: EnergyLoss.cc:35
T sqrt(T t)
Definition: SSEVec.h:18
double minMomentum_
Minimum momentum of incoming (charged) particle.
Definition: EnergyLoss.cc:55
double p2[4]
Definition: TauolaWrapper.h:90
double landau(RandomEngineAndDistribution const *random) const
Random generator of the dE/dX spread (Landau function)
double charge() const
Return charge of the particle.
Definition: Particle.h:139
double density_
Density of material (usually silicon rho=2.329)
Definition: EnergyLoss.cc:56
virtual const double getThickness(const math::XYZTLorentzVector &position) const =0
Return thickness of the layer at a given position.
const math::XYZTLorentzVector & momentum() const
Return momentum of the particle.
Definition: Particle.h:145
#define DEFINE_EDM_PLUGIN(factory, type, name)
Definition of a generic FastSim Particle which can be propagated through the detector (formerly Parti...
Definition: Particle.h:19
void setEnergyDeposit(double energyDeposit)
Set the energy the particle deposited in the tracker layer that was last hit (ionization).
Definition: Particle.h:92