Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
BetheBloch.hpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file BetheBloch.hpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2018-2020 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
9 #pragma once
10 
15 
16 #include <array>
17 
18 namespace ActsFatras {
19 
25 struct BetheBloch {
27  double scaleFactorMPV = 1.;
29  double scaleFactorSigma = 1.;
30 
39  template <typename generator_t>
40  std::array<Particle, 0> operator()(generator_t &generator,
41  const Acts::MaterialSlab &slab,
42  Particle &particle) const {
43  // compute energy loss distribution parameters
44  const float m = particle.mass();
45  const float qOverP = particle.qOverP();
46  const float absQ = particle.absoluteCharge();
47  // most probable value
48  const float energyLoss =
49  Acts::computeEnergyLossLandau(slab, m, qOverP, absQ);
50  // Gaussian-equivalent sigma
51  const float energyLossSigma =
52  Acts::computeEnergyLossLandauSigma(slab, m, qOverP, absQ);
53 
54  // Simulate the energy loss
55  // TODO landau location and scale parameters are not identical to the most
56  // probable value and the Gaussian-equivalent sigma
57  LandauDistribution lossDistribution(scaleFactorMPV * energyLoss,
58  scaleFactorSigma * energyLossSigma);
59  const auto loss = lossDistribution(generator);
60 
61  // Apply the energy loss
62  particle.correctEnergy(-loss);
63 
64  // Generates no new particles
65  return {};
66  }
67 };
68 
69 } // namespace ActsFatras