Skip to content

Commit 067808e

Browse files
sawenzelclaude
andcommitted
Take the TPC charge of a stopping step from the energy deposit
This fixes a problem in the TPC ionisation of a step that ends below the validity of the collision model. - The collision model took beta*gamma from the momentum after the step and clamped it at 7e-3. - For a track that ranged out in the step this gave up to 3.5e4 electrons for a 1 mm step, more than its energy allows. - A finite step ending below beta*gamma 7e-3 now takes its charge from Edep / Wion. - Zero-length steps (tracking-cut kills, capture at rest) still give no charge. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent fe07b07 commit 067808e

1 file changed

Lines changed: 11 additions & 8 deletions

File tree

‎Detectors/TPC/simulation/src/Detector.cxx‎

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,11 @@ Bool_t Detector::ProcessHits(FairVolume* vol)
210210
Int_t numberOfElectrons = 0;
211211
// I.H. - the type expected in addHit is float
212212

213+
// ---| Stepsize in cm and beta*gamma after the step |---
214+
const double stepSize = fMC->TrackStep();
215+
const double betaGamma = momentum.P() / fMC->TrackMass();
216+
constexpr double minBetaGamma = 7.e-3; // validity limit of the collision model below
217+
213218
// use Geant4 energy deposit directly for ionisation (Kr-83m calibration simulations)
214219
if (detParam.UseGeant4Edep) {
215220
// We have multiple collisions and add fluctuations: smear nel using
@@ -229,16 +234,14 @@ Bool_t Detector::ProcessHits(FairVolume* vol)
229234
// The number of electrons is stored as a float in the HitGroup: maximum cap at
230235
// 2^24 (16777216) ==> largest integer a IEEE-754 float can represent exactly
231236
numberOfElectrons = TMath::Min(numberOfElectrons, 16777216);
237+
} else if (betaGamma < minBetaGamma && stepSize > 0.) {
238+
// a finite step ending below the validity limit, e.g. a track that ranged out:
239+
// ionisation electrons from the energy deposited in this step, Nel = Edep / Wion
240+
numberOfElectrons = static_cast<int>(fMC->Edep() / static_cast<double>(gasParam.Wion));
232241
} else {
233-
// ---| Stepsize in cm |---
234-
const double stepSize = fMC->TrackStep();
235-
236-
double betaGamma = momentum.P() / fMC->TrackMass();
237-
betaGamma = TMath::Max(betaGamma, 7.e-3); // protection against too small bg
238-
239-
// ---| number of primary ionisations per cm |---
242+
// ---| number of primary ionisations per cm (zero-length steps give no collisions) |---
240243
const double primaryElectronsPerCM =
241-
gasParam.Nprim * BetheBlochAleph(static_cast<float>(betaGamma), gasParam.BetheBlochParam[0],
244+
gasParam.Nprim * BetheBlochAleph(static_cast<float>(TMath::Max(betaGamma, minBetaGamma)), gasParam.BetheBlochParam[0],
242245
gasParam.BetheBlochParam[1], gasParam.BetheBlochParam[2],
243246
gasParam.BetheBlochParam[3], gasParam.BetheBlochParam[4]);
244247

0 commit comments

Comments
 (0)