diff --git a/spack/packages/dd4hep/geant4_particle_handler.patch b/spack/packages/dd4hep/geant4_particle_handler.patch new file mode 100644 index 0000000000000000000000000000000000000000..14ed43af49a9df373290dd02df4da5b9ee785479 --- /dev/null +++ b/spack/packages/dd4hep/geant4_particle_handler.patch @@ -0,0 +1,27 @@ +diff --git a/DDG4/src/Geant4ParticleHandler.cpp b/DDG4/src/Geant4ParticleHandler.cpp +index 82a4b702..779dd044 100644 +--- a/DDG4/src/Geant4ParticleHandler.cpp ++++ b/DDG4/src/Geant4ParticleHandler.cpp +@@ -436,11 +436,8 @@ void Geant4ParticleHandler::rebaseSimulatedTracks(int ) { + for(count = 0, iend=pm.end(), i=pm.begin(); i!=iend; ++i) { + Particle* p = (*i).second; + orgParticles[p->id] = p->id; +- finalParticles[p->id] = p; ++ finalParticles[p->id] = p->addRef(); + if ( p->id > count ) count = p->id; +- if ( (p->reason&G4PARTICLE_PRIMARY) != G4PARTICLE_PRIMARY ) { +- p->addRef(); +- } + } + // (1.1) Define the new particle mapping for the simulated tracks + for(++count, iend=m_particleMap.end(), i=m_particleMap.begin(); i!=iend; ++i) { +@@ -448,7 +445,8 @@ void Geant4ParticleHandler::rebaseSimulatedTracks(int ) { + if ( (p->reason&G4PARTICLE_PRIMARY) != G4PARTICLE_PRIMARY ) { + //if ( orgParticles.find(p->id) == orgParticles.end() ) { + orgParticles[p->id] = count; +- finalParticles[count] = p; ++ finalParticles[count]->release(); ++ finalParticles[count] = p->addRef(); + p->id = count; + ++count; + } diff --git a/spack/packages/dd4hep/package.py b/spack/packages/dd4hep/package.py index b1bfde0f556748e5050d3967aeb7af32a9b1f1e6..34336c3f7f60516e99b0b4411024acd141879120 100644 --- a/spack/packages/dd4hep/package.py +++ b/spack/packages/dd4hep/package.py @@ -53,6 +53,8 @@ class Dd4hep(CMakePackage): # hack to fix refcount underflow patch('refcount_underflow.patch', when='@1.17:') + patch('geant4_particle_handler.patch', when='@1.17:') + patch('pdg.patch', when='@1.17:') # custom hash for the 2021-07-27 version, needed to include # https://github.com/AIDASoft/DD4hep/pull/849 diff --git a/spack/packages/dd4hep/pdg.patch b/spack/packages/dd4hep/pdg.patch new file mode 100644 index 0000000000000000000000000000000000000000..44e6a006cd5773f65b4657299aa6c9e804d62bf7 --- /dev/null +++ b/spack/packages/dd4hep/pdg.patch @@ -0,0 +1,12 @@ +diff --git a/DDG4/python/DDSim/Helper/Physics.py b/DDG4/python/DDSim/Helper/Physics.py +index 4ce65959..62eb05eb 100644 +--- a/DDG4/python/DDSim/Helper/Physics.py ++++ b/DDG4/python/DDSim/Helper/Physics.py +@@ -17,7 +17,7 @@ class Physics(ConfigHelper): + self._list = "FTFP_BERT" + self._decays = False + self._pdgfile = None +- self._rejectPDGs = {1, 2, 3, 4, 5, 6, 21, 23, 24, 25} ++ self._rejectPDGs = {1, 2, 3, 4, 5, 6, 21, 23, 24, 25, 2101} + self._zeroTimePDGs = {11, 13, 15, 17} + self._userFunctions = []