Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:11:27

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 CERN for the benefit of the ACTS project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at https://mozilla.org/MPL/2.0/.
0008 
0009 #include "Acts/Propagator/detail/PointwiseMaterialInteraction.hpp"
0010 
0011 #include "Acts/Material/Interactions.hpp"
0012 
0013 namespace Acts::detail {
0014 
0015 void PointwiseMaterialInteraction::evaluatePointwiseMaterialInteraction(
0016     bool multipleScattering, bool energyLoss) {
0017   if (energyLoss) {
0018     Eloss = computeEnergyLossBethe(slab, mass, qOverP, absQ);
0019   }
0020   // Compute contributions from interactions
0021   if (performCovarianceTransport) {
0022     covarianceContributions(multipleScattering, energyLoss);
0023   }
0024 }
0025 
0026 void PointwiseMaterialInteraction::covarianceContributions(
0027     bool multipleScattering, bool energyLoss) {
0028   // Compute contributions from interactions
0029   if (multipleScattering) {
0030     // TODO use momentum before or after energy loss in backward mode?
0031     const float theta0 =
0032         computeMultipleScatteringTheta0(slab, absPdg, mass, qOverP, absQ);
0033     // sigmaPhi = theta0 / sin(theta)
0034     const auto sigmaPhi = theta0 * (dir.norm() / VectorHelpers::perp(dir));
0035     variancePhi = sigmaPhi * sigmaPhi;
0036     // sigmaTheta = theta0
0037     varianceTheta = theta0 * theta0;
0038   }
0039   // TODO just ionisation loss or full energy loss?
0040   if (energyLoss) {
0041     const float sigmaQoverP =
0042         computeEnergyLossLandauSigmaQOverP(slab, mass, qOverP, absQ);
0043     varianceQoverP = sigmaQoverP * sigmaQoverP;
0044   }
0045 }
0046 
0047 double PointwiseMaterialInteraction::updateVariance(
0048     double variance, double change, NoiseUpdateMode updateMode) const {
0049   // Add/Subtract the change
0050   // Protect the variance against becoming negative
0051   return std::max(0., variance + std::copysign(change, updateMode));
0052 }
0053 
0054 }  // namespace Acts::detail