From 6c087cc0cd3d8e88d9868ef9db435ea274e5e4da Mon Sep 17 00:00:00 2001 From: wiechula <11199190+wiechula@users.noreply.github.com> Date: Thu, 28 Nov 2024 15:53:15 +0100 Subject: [PATCH 1/2] TPC MC: Move hit exlusion after Track Ref creation --- Detectors/TPC/simulation/src/Detector.cxx | 36 +++++++++++------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/Detectors/TPC/simulation/src/Detector.cxx b/Detectors/TPC/simulation/src/Detector.cxx index e261424c41332..36b86d8a6e532 100644 --- a/Detectors/TPC/simulation/src/Detector.cxx +++ b/Detectors/TPC/simulation/src/Detector.cxx @@ -142,6 +142,24 @@ Bool_t Detector::ProcessHits(FairVolume* vol) // TODO: Temporary hack to process only one sector // if (sectorID != 0) return kFALSE; + // ---| momentum and beta gamma |--- + static TLorentzVector momentum; // static to make avoid creation/deletion of this expensive object + fMC->TrackMomentum(momentum); + + const float time = fMC->TrackTime() * 1.0e9; + const int trackID = fMC->GetStack()->GetCurrentTrackNumber(); + const int detID = vol->getMCid(); + o2::data::Stack* stack = (o2::data::Stack*)fMC->GetStack(); + if (fMC->IsTrackEntering() || fMC->IsTrackExiting()) { + stack->addTrackReference(o2::TrackReference(position.X(), position.Y(), position.Z(), momentum.X(), momentum.Y(), + momentum.Z(), fMC->TrackLength(), time, trackID, GetDetId())); + } + if (TMath::Abs(lastReferenceR - fMC->TrackLength()) > kMaxDistRef) { /// we can speedup + stack->addTrackReference(o2::TrackReference(position.X(), position.Y(), position.Z(), momentum.X(), momentum.Y(), + momentum.Z(), fMC->TrackLength(), time, trackID, GetDetId())); + lastReferenceR = fMC->TrackLength(); + } + // ---| remove clusters between the IFC and the FC strips |--- // those should not enter the active readout area // do coarse selection before, to limit number of transformations @@ -164,24 +182,6 @@ Bool_t Detector::ProcessHits(FairVolume* vol) } } - // ---| momentum and beta gamma |--- - static TLorentzVector momentum; // static to make avoid creation/deletion of this expensive object - fMC->TrackMomentum(momentum); - - const float time = fMC->TrackTime() * 1.0e9; - const int trackID = fMC->GetStack()->GetCurrentTrackNumber(); - const int detID = vol->getMCid(); - o2::data::Stack* stack = (o2::data::Stack*)fMC->GetStack(); - if (fMC->IsTrackEntering() || fMC->IsTrackExiting()) { - stack->addTrackReference(o2::TrackReference(position.X(), position.Y(), position.Z(), momentum.X(), momentum.Y(), - momentum.Z(), fMC->TrackLength(), time, trackID, GetDetId())); - } - if (TMath::Abs(lastReferenceR - fMC->TrackLength()) > kMaxDistRef) { /// we can speedup - stack->addTrackReference(o2::TrackReference(position.X(), position.Y(), position.Z(), momentum.X(), momentum.Y(), - momentum.Z(), fMC->TrackLength(), time, trackID, GetDetId())); - lastReferenceR = fMC->TrackLength(); - } - // ===| CONVERT THE ENERGY LOSS TO IONIZATION ELECTRONS |===================== // // The energy loss is implemented directly below and taken GEANT3, From 7f89a70402b34d75919b5a6a74c9ff11aecad78a Mon Sep 17 00:00:00 2001 From: wiechula <11199190+wiechula@users.noreply.github.com> Date: Thu, 28 Nov 2024 16:04:10 +0100 Subject: [PATCH 2/2] Add missing setting of variable --- Detectors/TPC/simulation/src/Detector.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/Detectors/TPC/simulation/src/Detector.cxx b/Detectors/TPC/simulation/src/Detector.cxx index 36b86d8a6e532..1a7c0fc25802b 100644 --- a/Detectors/TPC/simulation/src/Detector.cxx +++ b/Detectors/TPC/simulation/src/Detector.cxx @@ -153,6 +153,7 @@ Bool_t Detector::ProcessHits(FairVolume* vol) if (fMC->IsTrackEntering() || fMC->IsTrackExiting()) { stack->addTrackReference(o2::TrackReference(position.X(), position.Y(), position.Z(), momentum.X(), momentum.Y(), momentum.Z(), fMC->TrackLength(), time, trackID, GetDetId())); + lastReferenceR = fMC->TrackLength(); } if (TMath::Abs(lastReferenceR - fMC->TrackLength()) > kMaxDistRef) { /// we can speedup stack->addTrackReference(o2::TrackReference(position.X(), position.Y(), position.Z(), momentum.X(), momentum.Y(),