From 7710132c9f6bb3e16afb1af6e5caa20e53ae515b Mon Sep 17 00:00:00 2001 From: Florian Uhlig <f.uhlig@gsi.de> Date: Tue, 17 Nov 2020 11:39:22 +0100 Subject: [PATCH] Fix problem with primary particles from pluto, refs #1790 These primaries shouldn't be transported --- sim/transport/base/CbmStack.cxx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/sim/transport/base/CbmStack.cxx b/sim/transport/base/CbmStack.cxx index 79996e8bf1..ac205486bc 100644 --- a/sim/transport/base/CbmStack.cxx +++ b/sim/transport/base/CbmStack.cxx @@ -170,7 +170,10 @@ void CbmStack::PushTrack(Int_t toBeDone, // Note that for particles created by TGeant4, toBeDone is kFALSE, // meaning that particles will not be put onto the internal stack. // Geant4 seems to have a separate, internal stack administration. - if (fdoTracking && toBeDone) fStack.push(particle); + if (fdoTracking && toBeDone) { + particle->SetBit(1); + fStack.push(particle); + } } // ------------------------------------------------------------------------- @@ -212,7 +215,11 @@ TParticle* CbmStack::PopPrimaryForTracking(Int_t iPrim) { // a primary. TParticle* part = (TParticle*) fParticles->At(iPrim); assert(part->GetUniqueID() == kPPrimary); - return part; + if (!part->TestBit(1)) { + return NULL; + } else { + return part; + } } // ------------------------------------------------------------------------- -- GitLab