CMS 3D CMS Logo

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