diff --git a/Simulation/ISF/ISF_Core/ISF_Event/CMakeLists.txt b/Simulation/ISF/ISF_Core/ISF_Event/CMakeLists.txt index 9b64379cba7ff9a57d945eef28f72b87c5aa1e25..f9cebdddb05d9df617e133ab416b210ef7d5ced5 100644 --- a/Simulation/ISF/ISF_Core/ISF_Event/CMakeLists.txt +++ b/Simulation/ISF/ISF_Core/ISF_Event/CMakeLists.txt @@ -15,10 +15,10 @@ atlas_add_library( ISF_Event PUBLIC_HEADERS ISF_Event INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} DEFINITIONS ${CLHEP_DEFINITIONS} - LINK_LIBRARIES ${CLHEP_LIBRARIES} AtlasHepMCLib ${EIGEN_LIBRARIES} TestTools AthenaBaseComps AtlasDetDescr BarcodeEventLib GeoPrimitives GeneratorObjects GaudiKernel ) + LINK_LIBRARIES ${CLHEP_LIBRARIES} AtlasHepMCLib AtlasHepMCsearchLib ${EIGEN_LIBRARIES} TestTools AthenaBaseComps AtlasDetDescr BarcodeEventLib GeoPrimitives GeneratorObjects GaudiKernel ) atlas_add_test( ISFParticle_test SOURCES test/ISFParticle_test.cxx INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} - LINK_LIBRARIES ${CLHEP_LIBRARIES} AtlasHepMCLib ${EIGEN_LIBRARIES} TestTools AthenaBaseComps AtlasDetDescr GeoPrimitives GeneratorObjects GaudiKernel ISF_Event ) + LINK_LIBRARIES ${CLHEP_LIBRARIES} AtlasHepMCLib AtlasHepMCsearchLib ${EIGEN_LIBRARIES} TestTools AthenaBaseComps AtlasDetDescr GeoPrimitives GeneratorObjects GaudiKernel ISF_Event ) diff --git a/Simulation/ISF/ISF_Core/ISF_Event/ISF_Event/TruthBinding.icc b/Simulation/ISF/ISF_Core/ISF_Event/ISF_Event/TruthBinding.icc index 91c73a6f98b9244429b0e80eb907e607b97d062f..0206becfa45c434dda2b9282d28c9140d0ba3f80 100644 --- a/Simulation/ISF/ISF_Core/ISF_Event/ISF_Event/TruthBinding.icc +++ b/Simulation/ISF/ISF_Core/ISF_Event/ISF_Event/TruthBinding.icc @@ -59,21 +59,33 @@ namespace ISF { const auto rhsTruth = rhs.getTruthParticle(); if (m_truthParticle && rhsTruth) { +#ifdef HEPMC3 + pass &= (m_truthParticle == rhsTruth); +#else pass &= *m_truthParticle == *rhsTruth; +#endif } else { return false; } const auto rhsPrimary = rhs.getPrimaryTruthParticle(); if (m_primaryTruthParticle && rhsPrimary) { +#ifdef HEPMC3 + pass &= (m_primaryTruthParticle == rhsPrimary); +#else pass &= *m_primaryTruthParticle == *rhsPrimary; +#endif } else { return false; } const auto rhsGenZero = rhs.getGenerationZeroTruthParticle(); if (m_generationZeroTruthParticle && rhsGenZero) { +#ifdef HEPMC3 + pass &= (m_generationZeroTruthParticle == rhsGenZero); +#else pass &= *m_generationZeroTruthParticle == *rhsGenZero; +#endif } else { return false; } diff --git a/Simulation/ISF/ISF_Core/ISF_Event/src/ISFTruthIncident.cxx b/Simulation/ISF/ISF_Core/ISF_Event/src/ISFTruthIncident.cxx index 4c8aa3f2b174d8212a787254c2141a54cc5e74c7..68b924af61e8479986ab2c2968f5bfa80f5b6c6b 100644 --- a/Simulation/ISF/ISF_Core/ISF_Event/src/ISFTruthIncident.cxx +++ b/Simulation/ISF/ISF_Core/ISF_Event/src/ISFTruthIncident.cxx @@ -164,13 +164,17 @@ void ISF::ISFTruthIncident::setAllChildrenBarcodes(Barcode::ParticleBarcode bc) /** return attached truth particle */ HepMC::GenParticlePtr ISF::ISFTruthIncident::getHepMCTruthParticle( const ISF::ISFParticle& particle ) const { auto* truthBinding = particle.getTruthBinding(); - auto* hepTruthParticle = truthBinding ? truthBinding->getTruthParticle() : nullptr; + HepMC::GenParticlePtr hepTruthParticle = truthBinding ? truthBinding->getTruthParticle() : nullptr; // HepMC::GenParticle not in TruthBinding -> see if the HepMcParticleLink can retrieve it if (!hepTruthParticle) { const HepMcParticleLink* oldHMPL = particle.getParticleLink(); if (oldHMPL && oldHMPL->cptr()) +#ifdef HEPMC3 + hepTruthParticle = std::shared_ptr<HepMC3::GenParticle>(const_cast<HepMC3::GenParticle*>(oldHMPL->cptr())); +#else hepTruthParticle = const_cast<HepMC::GenParticlePtr>(oldHMPL->cptr()); +#endif } return hepTruthParticle; @@ -181,14 +185,14 @@ HepMC::GenParticlePtr ISF::ISFTruthIncident::getHepMCTruthParticle( const ISF::I HepMC::GenParticlePtr ISF::ISFTruthIncident::updateHepMCTruthParticle( ISF::ISFParticle& particle, const ISF::ISFParticle* parent ) const { auto* truthBinding = particle.getTruthBinding(); - auto* hepTruthParticle = ParticleHelper::convert( particle ); + HepMC::GenParticlePtr hepTruthParticle = ParticleHelper::convert( particle ); if (truthBinding) { truthBinding->setTruthParticle(hepTruthParticle); } else { - auto* parentTruthBinding = parent ? parent->getTruthBinding() : nullptr; - auto* hepPrimaryParticle = parentTruthBinding ? parentTruthBinding->getPrimaryTruthParticle() : nullptr; - auto* hepGenZeroParticle = hepTruthParticle; + auto parentTruthBinding = parent ? parent->getTruthBinding() : nullptr; + auto hepPrimaryParticle = parentTruthBinding ? parentTruthBinding->getPrimaryTruthParticle() : nullptr; + auto hepGenZeroParticle = hepTruthParticle; truthBinding = new TruthBinding( hepTruthParticle, hepPrimaryParticle, hepGenZeroParticle ); particle.setTruthBinding(truthBinding); }