From 7c81dfa131bb3e9ae280ce7e6c76bcff3ee0877c Mon Sep 17 00:00:00 2001 From: Lena Rossel <lena.rossel@stud.uni-frankfurt.de> Date: Fri, 4 Aug 2023 11:44:27 +0000 Subject: [PATCH] Fix errors in nr. of primary ionizations calculation Add missing break statements (Dennis Spicker) Without these break statements, the resulting gamma would always be the one for the highest Bethe-Bloch value. Fix calculation of gamma (Lena Rossel) Change speed of light to 1. Momentum and mass are given in GeV, therefore speed of light does not need to be c=3e8. --- sim/detectors/trd/CbmTrdDigitizer.cxx | 2 +- sim/detectors/trd/CbmTrdModuleSimR.cxx | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/sim/detectors/trd/CbmTrdDigitizer.cxx b/sim/detectors/trd/CbmTrdDigitizer.cxx index 6e71dfa8be..023069fa2d 100644 --- a/sim/detectors/trd/CbmTrdDigitizer.cxx +++ b/sim/detectors/trd/CbmTrdDigitizer.cxx @@ -204,7 +204,7 @@ void CbmTrdDigitizer::Exec(Option_t*) else mod = imod->second; mod->SetLinkId(fCurrentInput, fCurrentMCEntry, iPoint); - Double_t gamma = TMath::Sqrt(1 + TMath::Power(track->GetP() / (3.e8 * track->GetMass()), 2)); + Double_t gamma = TMath::Sqrt(1 + TMath::Power(track->GetP() / (track->GetMass()), 2)); mod->SetGamma(gamma); mod->MakeDigi(point, fCurrentEventTime, TMath::Abs(track->GetPdgCode()) == 11); } diff --git a/sim/detectors/trd/CbmTrdModuleSimR.cxx b/sim/detectors/trd/CbmTrdModuleSimR.cxx index 8a54c57fe5..b8fb5a5dd3 100644 --- a/sim/detectors/trd/CbmTrdModuleSimR.cxx +++ b/sim/detectors/trd/CbmTrdModuleSimR.cxx @@ -2027,7 +2027,10 @@ Double_t CbmTrdModuleSimR::GetStep(Double_t dist, Int_t roll) std::make_pair(300, 1.65), std::make_pair(400, 1.675), std::make_pair(500, 1.7), std::make_pair(1000, 1.725)}; for (Int_t n = 0; n < 12; n++) { - if (fGamma < bethe[0].first) CalcGamma = bethe[0].second; + if (fGamma < bethe[0].first) { + CalcGamma = bethe[0].second; + break; + } if (n == 11) { CalcGamma = bethe[11].second; break; @@ -2066,7 +2069,10 @@ std::pair<Int_t, std::vector<Double_t>> CbmTrdModuleSimR::GetTotalSteps(Double_t std::make_pair(300, 1.65), std::make_pair(400, 1.675), std::make_pair(500, 1.7), std::make_pair(1000, 1.725)}; for (Int_t n = 0; n < 12; n++) { - if (fGamma < bethe[0].first) CalcGamma = bethe[0].second; + if (fGamma < bethe[0].first) { + CalcGamma = bethe[0].second; + break; + } if (n == 11) { CalcGamma = bethe[11].second; break; -- GitLab