diff --git a/ForwardDetectors/ForwardTransport/src/ForwardTransportModel.cxx b/ForwardDetectors/ForwardTransport/src/ForwardTransportModel.cxx index 3f87db196d45e059c26e5f14186345797001d2c7..762660ef0e6e15cd543f6be24b4c1bbed649e77b 100644 --- a/ForwardDetectors/ForwardTransport/src/ForwardTransportModel.cxx +++ b/ForwardDetectors/ForwardTransport/src/ForwardTransportModel.cxx @@ -188,6 +188,7 @@ void ForwardTransportModel::DoIt(const G4FastTrack& fastTrack, G4FastStep& fastS { // Create postTransportISP if required. const auto pBarcode = HepMC::barcode(gParticle); + const auto particleID = HepMC::uniqueID(gParticle); auto tBinding = std::make_unique<ISF::TruthBinding>(gParticle); auto hmpl = std::make_unique<HepMcParticleLink>(pBarcode, gEvent->event_number(), HepMcParticleLink::IS_EVENTNUM, HepMcParticleLink::IS_BARCODE); // FIXME barcode-based const Amg::Vector3D pos(postTransportPosition.x(), postTransportPosition.y(), postTransportPosition.z()); @@ -200,6 +201,7 @@ void ForwardTransportModel::DoIt(const G4FastTrack& fastTrack, G4FastStep& fastS initialISP->status(), // For now leave particle status unchanged - TODO potentially revisit this in the future. time, // TODO Update?? *initialISP, + particleID, pBarcode, tBinding.release(), hmpl.release()); diff --git a/Simulation/G4Sim/MCTruthBase/CMakeLists.txt b/Simulation/G4Sim/MCTruthBase/CMakeLists.txt index b33a77cfd908f3c7e14b05788e09439a9def6f59..34943ed4bd794267acd6f0d5408db9fe961a539e 100644 --- a/Simulation/G4Sim/MCTruthBase/CMakeLists.txt +++ b/Simulation/G4Sim/MCTruthBase/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration # Declare the package name: atlas_subdir( MCTruthBase ) @@ -18,7 +18,7 @@ atlas_add_library( MCTruthBaseLib LINK_LIBRARIES ${GEANT4_LIBRARIES} ${XERCESC_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib AthenaKernel CxxUtils GaudiKernel StoreGateLib G4AtlasToolsLib TrackRecordLib PRIVATE_LINK_LIBRARIES AthenaBaseComps G4AtlasInterfaces MCTruth SimHelpers ISF_InterfacesLib - AtlasDetDescr ISF_Geant4Event + AtlasDetDescr ISF_Geant4Event TruthUtils ) atlas_add_library(MCTruthBase diff --git a/Simulation/G4Sim/MCTruthBase/src/RecordingEnvelope.cxx b/Simulation/G4Sim/MCTruthBase/src/RecordingEnvelope.cxx index 27b8e70d0b25f747ffb0a6f9e5ef2edb6b5d0124..c001f0fc7a244222afc24bc6e8a325074b69c636 100644 --- a/Simulation/G4Sim/MCTruthBase/src/RecordingEnvelope.cxx +++ b/Simulation/G4Sim/MCTruthBase/src/RecordingEnvelope.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ // class header diff --git a/Simulation/G4Sim/MCTruthBase/src/TruthStrategyManager.cxx b/Simulation/G4Sim/MCTruthBase/src/TruthStrategyManager.cxx index a8ec2a6f6b9100fd181cc3c790e297a086da2933..bdcd96e152b6ffb9b95e5e60d8f5d2403f8c0d66 100644 --- a/Simulation/G4Sim/MCTruthBase/src/TruthStrategyManager.cxx +++ b/Simulation/G4Sim/MCTruthBase/src/TruthStrategyManager.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ // class header @@ -8,6 +8,8 @@ // Framework includes #include "AthenaBaseComps/AthMsgStreamMacros.h" +#include "TruthUtils/MagicNumbers.h" + // Geant4 Includes #include "G4Event.hh" #include "G4EventManager.hh" @@ -70,13 +72,14 @@ bool TruthStrategyManager::CreateTruthIncident(const G4Step* aStep, int subDetVo // TODO: cleanup Geant4TruthIncident to not require an ISFParticle instance any longer const Amg::Vector3D myPos(0,0,0); const Amg::Vector3D myMom(0,0,0); - double myMass = 0.0; - double myCharge = 0.0; - int myPdgCode = 0; - int mystatus = 3333; - double myTime =0.; + const double myMass = 0.0; + const double myCharge = 0.0; + const int myPdgCode = 0; + const int mystatus = 3333; + const double myTime =0.; + const int myID = HepMC::UNDEFINED_ID; const ISF::DetRegionSvcIDPair origin(geoID, ISF::fUndefinedSimID); - ISF::ISFParticle myISFParticle(myPos, myMom, myMass, myCharge, myPdgCode, mystatus, myTime, origin); + ISF::ISFParticle myISFParticle(myPos, myMom, myMass, myCharge, myPdgCode, mystatus, myTime, origin, myID); iGeant4::Geant4TruthIncident truth(aStep, myISFParticle, geoID, atlasG4EvtUserInfo); diff --git a/Simulation/G4Utilities/G4UserActions/src/CosmicPerigeeAction.cxx b/Simulation/G4Utilities/G4UserActions/src/CosmicPerigeeAction.cxx index cc86469c38fef516aa7c996781a76977621d61d8..57af0849b85e8cdf00594db78bd834c771dbfc79 100644 --- a/Simulation/G4Utilities/G4UserActions/src/CosmicPerigeeAction.cxx +++ b/Simulation/G4Utilities/G4UserActions/src/CosmicPerigeeAction.cxx @@ -113,10 +113,18 @@ namespace G4UA // Create the TimedTrackRecord TrackHelper trHelp(aStep->GetTrack()); - int barcode = trHelp.GetBarcode(); - int id = trHelp.GetUniqueID(); + const int barcode = trHelp.GetBarcode(); // FIXME barcode based + const int id = trHelp.GetUniqueID(); const int status = trHelp.GetStatus(); - m_trackRecordCollection->Emplace(pdgcode, status, ener, mom, pos, time, barcode, id, + m_trackRecordCollection->Emplace( + pdgcode, + status, + ener, + mom, + pos, + time, + barcode, // FIXME barcode based + id, preVol->GetName()); } diff --git a/Simulation/G4Utilities/TrackWriteFastSim/src/TrackFastSimSD.cxx b/Simulation/G4Utilities/TrackWriteFastSim/src/TrackFastSimSD.cxx index 1d16550540f4734e076e514c30dd163bb61e1fbb..2883f6a93085b1c37b9813127abfad36d4b0c957 100644 --- a/Simulation/G4Utilities/TrackWriteFastSim/src/TrackFastSimSD.cxx +++ b/Simulation/G4Utilities/TrackWriteFastSim/src/TrackFastSimSD.cxx @@ -75,12 +75,21 @@ G4bool TrackFastSimSD::ProcessHits(G4Step* aStep,G4TouchableHistory* ) // Barcode TrackHelper trHelp(track); - const int barcode = trHelp.GetBarcode(); + const int barcode = trHelp.GetBarcode(); // FIXME barcode based const int id = trHelp.GetUniqueID(); const int status = trHelp.GetStatus(); //create the TimedTrackRecord - m_trackRecordCollection->Emplace(pdgcode,status,ener,mom,pos,time,barcode,id,preVol->GetName()); + m_trackRecordCollection->Emplace( + pdgcode, + status, + ener, + mom, + pos, + time, + barcode, // FIXME barcode based + id, + preVol->GetName()); return true; } @@ -103,11 +112,20 @@ void TrackFastSimSD::WriteTrack(const G4Track* track, const bool originPos, cons const double time=track->GetGlobalTime(); TrackHelper trHelp(track); - const int barcode = trHelp.GetBarcode(); + const int barcode = trHelp.GetBarcode(); // FIXME barcode based const int id = trHelp.GetUniqueID(); const int status = trHelp.GetStatus(); //create the TimedTrackRecord - m_trackRecordCollection->Emplace(pdgcode,status,ener,mom,pos,time,barcode,id,preVol?preVol->GetName():"Unknown"); + m_trackRecordCollection->Emplace( + pdgcode, + status, + ener, + mom, + pos, + time, + barcode, // FIXME barcode based + id, + preVol?preVol->GetName():"Unknown"); } diff --git a/Simulation/ISF/ISF_Acts/ISF_ActsTools/CMakeLists.txt b/Simulation/ISF/ISF_Acts/ISF_ActsTools/CMakeLists.txt index f080c3ef88c165b4628582d5711626f2fff214b6..e97e565a94987dc5d1a9fb87faf9932ef3fa2ea1 100644 --- a/Simulation/ISF/ISF_Acts/ISF_ActsTools/CMakeLists.txt +++ b/Simulation/ISF/ISF_Acts/ISF_ActsTools/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration # Declare the package name: atlas_subdir( ISF_ActsTools ) @@ -15,7 +15,7 @@ atlas_add_component( ISF_ActsTools LINK_LIBRARIES ActsCore ActsFatras AthenaBaseComps CxxUtils TrkTrack ISF_Event AthenaKernel AtlasDetDescr GeoPrimitives GaudiKernel GeneratorObjects ISF_Event StoreGateLib - GeoModelUtilities ActsInteropLib ActsGeometryLib + GeoModelUtilities ActsInteropLib ActsGeometryLib TruthUtils ISF_InterfacesLib ActsPluginJson ISF_FatrasInterfaces ) # Install files from the package: diff --git a/Simulation/ISF/ISF_Acts/ISF_ActsTools/src/ActsFatrasSimTool.cxx b/Simulation/ISF/ISF_Acts/ISF_ActsTools/src/ActsFatrasSimTool.cxx index a497e10676969c95b60625356cd1cdf74bdda438..fa7596f62938f724b4c55070bed3a56ff2420ca5 100644 --- a/Simulation/ISF/ISF_Acts/ISF_ActsTools/src/ActsFatrasSimTool.cxx +++ b/Simulation/ISF/ISF_Acts/ISF_ActsTools/src/ActsFatrasSimTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ #include <algorithm> #include <random> @@ -9,6 +9,8 @@ #include "CLHEP/Random/RandFlat.h" #include "CLHEP/Random/RandomEngine.h" +#include "TruthUtils/MagicNumbers.h" + using namespace Acts::UnitLiterals; ISF::ActsFatrasSimTool::ActsFatrasSimTool(const std::string& type, @@ -164,7 +166,9 @@ StatusCode ISF::ActsFatrasSimTool::simulateVector( pdgid, 1, //status properTime, - *isfp); + *isfp, + HepMC::UNDEFINED_ID // id + ); secondaries.push_back(secisfp.release()); } diff --git a/Simulation/ISF/ISF_Core/ISF_Algorithms/CMakeLists.txt b/Simulation/ISF/ISF_Core/ISF_Algorithms/CMakeLists.txt index c16122b08cb0f8ce4653c08c72c2e89982395b86..a92875c543ab18672f19a2478909d36d31d1007f 100644 --- a/Simulation/ISF/ISF_Core/ISF_Algorithms/CMakeLists.txt +++ b/Simulation/ISF/ISF_Core/ISF_Algorithms/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration # Declare the package name: atlas_subdir( ISF_Algorithms ) @@ -44,7 +44,7 @@ atlas_add_test( SimKernelMT_test ${GMOCK_INCLUDE_DIRS} LINK_LIBRARIES ${GMOCK_LIBRARIES} ${GTEST_LIBRARIES} AthenaBaseComps AtlasDetDescr AtlasHepMCLib CxxUtils GaudiKernel GeneratorObjects GeoPrimitives HepMC_InterfacesLib ISF_Event ISF_InterfacesLib - StoreGateLib TrackRecordLib + StoreGateLib TrackRecordLib TruthUtils POST_EXEC_SCRIPT nopost.sh ENVIRONMENT "JOBOPTSEARCHPATH=${CMAKE_CURRENT_SOURCE_DIR}/test" diff --git a/Simulation/ISF/ISF_Core/ISF_Algorithms/test/SimKernelMT_test.cxx b/Simulation/ISF/ISF_Core/ISF_Algorithms/test/SimKernelMT_test.cxx index dcb3f3227221dd7b38cf62328b0c1b0100b3716b..0bf17e926444604ad0a8e9b700a6226447af27e8 100644 --- a/Simulation/ISF/ISF_Core/ISF_Algorithms/test/SimKernelMT_test.cxx +++ b/Simulation/ISF/ISF_Core/ISF_Algorithms/test/SimKernelMT_test.cxx @@ -37,6 +37,7 @@ ATLAS_NO_CHECK_FILE_THREAD_SAFETY; #include "gmock/gmock.h" #include "AtlasHepMC/Operators.h" +#include "TruthUtils/MagicNumbers.h" #if __GNUC__ >= 12 // gcc12 gives maybe-uninitialized warnings about uses of testing::_. @@ -703,7 +704,8 @@ protected: 11, // PDG code 1, ///status 0.2*Gaudi::Units::second, // time - particleOrigin + particleOrigin, // parent + HepMC::UNDEFINED_ID // id ); ASSERT_NE( m_mockSimulationSelector, nullptr ); @@ -736,7 +738,8 @@ protected: 11, // PDG code 1, ///status 0.2*Gaudi::Units::second, // time - particleOrigin + particleOrigin, // parent + HepMC::UNDEFINED_ID // id ); ASSERT_NE( m_mockSimulationSelector, nullptr ); @@ -766,7 +769,8 @@ protected: 11, // PDG code 1, ///status 0.2*Gaudi::Units::second, // time - particleOrigin + particleOrigin, // parent + HepMC::UNDEFINED_ID // id ); ASSERT_NE( m_mockSimulationSelector, nullptr ); @@ -796,7 +800,8 @@ protected: 11, // PDG code 1, ///status 0.2*Gaudi::Units::second, // time - particleOrigin + particleOrigin, // parent + HepMC::UNDEFINED_ID // id ); ASSERT_NE( m_mockSimulationSelector, nullptr ); @@ -856,7 +861,8 @@ protected: 11, // e- PDG code 1, ///status 678.9/Gaudi::Units::c_light*Gaudi::Units::ns, // time - particleOrigin, + particleOrigin, // parent + HepMC::UNDEFINED_ID, // id 10001, // barcode truthBinding ); diff --git a/Simulation/ISF/ISF_Core/ISF_Event/CMakeLists.txt b/Simulation/ISF/ISF_Core/ISF_Event/CMakeLists.txt index ccecbbac535ca12cc3806c91711e98310a3f3a5a..a3be1678d82c9b9e2f2c2d62fca007f8136ecc16 100644 --- a/Simulation/ISF/ISF_Core/ISF_Event/CMakeLists.txt +++ b/Simulation/ISF/ISF_Core/ISF_Event/CMakeLists.txt @@ -27,5 +27,3 @@ atlas_add_test( ISFTruthIncident_test INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} ${GTEST_INCLUDE_DIRS} LINK_LIBRARIES ${CLHEP_LIBRARIES} AtlasHepMCLib AtlasHepMCsearchLib ${EIGEN_LIBRARIES} ${GTEST_LIBRARIES} CxxUtils GeneratorObjects TestTools AthenaBaseComps AtlasDetDescr GeoPrimitives GeneratorObjects GaudiKernel ISF_Event CxxUtils POST_EXEC_SCRIPT nopost.sh ) - - diff --git a/Simulation/ISF/ISF_Core/ISF_Event/ISF_Event/ISFParticle.h b/Simulation/ISF/ISF_Core/ISF_Event/ISF_Event/ISFParticle.h index 45fa7a3e5cb79fca1d6fa5ea17409c830281a17f..51254cdd111ed830841b8c4f8fa81146fa2f89af 100644 --- a/Simulation/ISF/ISF_Core/ISF_Event/ISF_Event/ISFParticle.h +++ b/Simulation/ISF/ISF_Core/ISF_Event/ISF_Event/ISFParticle.h @@ -54,6 +54,7 @@ namespace ISF { int status, double time, const ISFParticle &parent, + int id, Barcode::ParticleBarcode barcode = Barcode::fUndefinedBarcode, TruthBinding* truth = nullptr, const HepMcParticleLink * partLink = nullptr ); @@ -67,6 +68,7 @@ namespace ISF { int status, double time, const ISFParticle &parent, + int id, Barcode::ParticleBarcode barcode = Barcode::fUndefinedBarcode, TruthBinding* truth = nullptr, const HepMcParticleLink * partLink = nullptr ); @@ -77,9 +79,10 @@ namespace ISF { double mass, double charge, int pdgCode, - int status, + int status, double time, const DetRegionSvcIDPair &origin, + int id, Barcode::ParticleBarcode barcode = Barcode::fUndefinedBarcode, TruthBinding* truth = nullptr, const HepMcParticleLink * partLink = nullptr ); @@ -151,12 +154,16 @@ namespace ISF { void setNextSimID(SimSvcID simID); /** the barcode */ - Barcode::ParticleBarcode barcode() const; - + Barcode::ParticleBarcode barcode() const; // FIXME barcode-based /** set a new barcode */ - void setBarcode(Barcode::ParticleBarcode bc); + void setBarcode(Barcode::ParticleBarcode bc); // FIXME barcode-based /** set a new barcode and update the HepMcParticleLink */ - void setBarcodeAndUpdateHepMcParticleLink(Barcode::ParticleBarcode bc); + void setBarcodeAndUpdateHepMcParticleLink(Barcode::ParticleBarcode bc); // FIXME barcode-based TODO Update this method to use the unique ID rather than the barcode. + + /** unique ID */ + int id() const; + /** set a new unique ID */ + void setId(int id); /** pointer to the simulation truth - optional, can be 0 */ const TruthBinding* getTruthBinding() const; @@ -192,7 +199,8 @@ namespace ISF { int m_status; double m_tstamp; ParticleHistory m_history; - Barcode::ParticleBarcode m_barcode; + Barcode::ParticleBarcode m_barcode; //!< barcode TODO remove in favour of m_status + m_uid + int m_uid; //! < unique ID TruthBinding* m_truth; ParticleOrder m_order; //!< particle simulation order ParticleUserInformation* m_userInfo; //!< user information stored with the ISFParticle diff --git a/Simulation/ISF/ISF_Core/ISF_Event/ISF_Event/ISFParticle.icc b/Simulation/ISF/ISF_Core/ISF_Event/ISF_Event/ISFParticle.icc index 87da606cf143cdf3fc05226deebd5709de942f8f..6074a47f83e6ec9a168803f41c406a333d558d53 100644 --- a/Simulation/ISF/ISF_Core/ISF_Event/ISF_Event/ISFParticle.icc +++ b/Simulation/ISF/ISF_Core/ISF_Event/ISF_Event/ISFParticle.icc @@ -34,8 +34,13 @@ namespace ISF { // barcode methods // - inline Barcode::ParticleBarcode ISFParticle::barcode() const { return m_barcode; } - inline void ISFParticle::setBarcode(Barcode::ParticleBarcode bc) { m_barcode = bc; } + inline Barcode::ParticleBarcode ISFParticle::barcode() const { return m_barcode; } // FIXME barcode-based + inline void ISFParticle::setBarcode(Barcode::ParticleBarcode bc) { m_barcode = bc; } // FIXME-barcode-based + + // id methods + // + inline int ISFParticle::id() const { return m_uid; } + inline void ISFParticle::setId(int id) { m_uid = id; } // truth methods // diff --git a/Simulation/ISF/ISF_Core/ISF_Event/ISF_Event/ISFTruthIncident.h b/Simulation/ISF/ISF_Core/ISF_Event/ISF_Event/ISFTruthIncident.h index d03c59191a87c74ac96b44ec39a1423488096bc9..02ce6313c23a1f07f8f9d398702fa506c69bc768 100644 --- a/Simulation/ISF/ISF_Core/ISF_Event/ISF_Event/ISFTruthIncident.h +++ b/Simulation/ISF/ISF_Core/ISF_Event/ISF_Event/ISFTruthIncident.h @@ -2,10 +2,6 @@ Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// ISFTruthIncident.h, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - #ifndef ISF_ISFEVENT_ISFTRUTHINCIDENT_H #define ISF_ISFEVENT_ISFTRUTHINCIDENT_H @@ -73,7 +69,9 @@ namespace ISF { HepMC::GenParticlePtr parentParticle() override final; int parentStatus() override final; /** Return the barcode of the parent particle */ - Barcode::ParticleBarcode parentBarcode() override final; + Barcode::ParticleBarcode parentBarcode() override final; // TODO Remove this method + /** Return the unique ID of the parent particle */ + int parentUniqueID() override final; /** Return a boolean whether or not the parent particle survives the incident */ bool parentSurvivesIncident() const override final; /** Return the parent particle after the TruthIncident vertex (and give diff --git a/Simulation/ISF/ISF_Core/ISF_Event/ISF_Event/ITruthIncident.h b/Simulation/ISF/ISF_Core/ISF_Event/ISF_Event/ITruthIncident.h index f33ba2602e21f9d38952735601464a69dc02b166..76996260876b3936e2715eb8b1e926bca1b9f293 100644 --- a/Simulation/ISF/ISF_Core/ISF_Event/ISF_Event/ITruthIncident.h +++ b/Simulation/ISF/ISF_Core/ISF_Event/ISF_Event/ITruthIncident.h @@ -74,7 +74,9 @@ namespace ISF { virtual HepMC::GenParticlePtr parentParticle() = 0; virtual int parentStatus() = 0; /** Return the barcode of the parent particle */ - virtual Barcode::ParticleBarcode parentBarcode() = 0; + virtual Barcode::ParticleBarcode parentBarcode() = 0; // TODO Remove this method + /** Return the unique ID of the parent particle */ + virtual int parentUniqueID() = 0; /** Return a boolean whether or not the parent particle survives the incident */ virtual bool parentSurvivesIncident() const = 0; /** Return the parent particle after the TruthIncident vertex (and assign diff --git a/Simulation/ISF/ISF_Core/ISF_Event/src/ISFParticle.cxx b/Simulation/ISF/ISF_Core/ISF_Event/src/ISFParticle.cxx index 25eb78e2a61c53b1e500d6dd47210216d07b1bfe..2a1b00766efba59e4feb502f2d9f52531e076b60 100644 --- a/Simulation/ISF/ISF_Core/ISF_Event/src/ISFParticle.cxx +++ b/Simulation/ISF/ISF_Core/ISF_Event/src/ISFParticle.cxx @@ -15,7 +15,8 @@ ISF::ISFParticle::ISFParticle( int status, double time, const ISFParticle &parent, - Barcode::ParticleBarcode barcode, + int id, + Barcode::ParticleBarcode barcode, TruthBinding* truth, const HepMcParticleLink* partLink): m_position(pos), @@ -26,7 +27,8 @@ ISF::ISFParticle::ISFParticle( m_status(status), m_tstamp(time), m_history(parent.history()), - m_barcode(barcode), + m_barcode(barcode), // TODO drop this soon + m_uid(id), m_truth(truth), m_order(ISF::DefaultParticleOrder), m_userInfo(nullptr), @@ -44,6 +46,7 @@ ISF::ISFParticle::ISFParticle( int status, double time, const ISFParticle &parent, + int id, Barcode::ParticleBarcode barcode, TruthBinding* truth, const HepMcParticleLink* partLink): @@ -55,7 +58,8 @@ ISF::ISFParticle::ISFParticle( m_status(status), m_tstamp(time), m_history(parent.history()), - m_barcode(barcode), + m_barcode(barcode), // TODO drop this soon + m_uid(id), m_truth(truth), m_order(ISF::DefaultParticleOrder), m_userInfo(nullptr), @@ -73,6 +77,7 @@ ISF::ISFParticle::ISFParticle( int status, double time, const DetRegionSvcIDPair &origin, + int id, Barcode::ParticleBarcode barcode, TruthBinding* truth, const HepMcParticleLink* partLink): @@ -84,7 +89,8 @@ ISF::ISFParticle::ISFParticle( m_status(status), m_tstamp(time), m_history(1, origin), - m_barcode(barcode), + m_barcode(barcode), // TODO drop this soon + m_uid(id), m_truth(truth), m_order(ISF::DefaultParticleOrder), m_userInfo(nullptr), @@ -102,7 +108,8 @@ ISF::ISFParticle::ISFParticle(const ISFParticle& isfp): m_status(isfp.status()), m_tstamp(isfp.timeStamp()), m_history(isfp.history()), - m_barcode(isfp.barcode()), + m_barcode(isfp.barcode()), // TODO drop this soon + m_uid(isfp.id()), m_truth(nullptr), m_order(ISF::DefaultParticleOrder), m_userInfo(nullptr) @@ -123,7 +130,8 @@ ISF::ISFParticle::ISFParticle(ISFParticle&& isfp): m_status(isfp.status()), m_tstamp(isfp.timeStamp()), m_history(isfp.history()), - m_barcode(isfp.barcode()), + m_barcode(isfp.barcode()), // TODO drop this soon + m_uid(isfp.id()), m_truth(isfp.getTruthBinding()), m_order(isfp.getOrder()), m_userInfo(isfp.getUserInformation()), @@ -150,7 +158,8 @@ ISF::ISFParticle& ISF::ISFParticle::operator=(const ISF::ISFParticle& rhs) m_status = rhs.status(); m_tstamp = rhs.timeStamp(); m_history = rhs.history(); - m_barcode = rhs.barcode(); + m_barcode = rhs.barcode(); // TODO drop this soon + m_uid = rhs.id(); delete m_truth; m_truth = nullptr; @@ -179,7 +188,8 @@ ISF::ISFParticle& ISF::ISFParticle::operator=(ISF::ISFParticle&& rhs) m_status = rhs.status(); m_tstamp = rhs.timeStamp(); m_history = rhs.history(); - m_barcode = rhs.barcode(); + m_barcode = rhs.barcode(); // TODO drop this soon + m_uid = rhs.id(); delete m_truth; m_truth = rhs.getTruthBinding(); delete m_userInfo; @@ -208,7 +218,8 @@ bool ISF::ISFParticle::isEqual(const ISF::ISFParticle& rhs) const pass &= m_status == rhs.status(); pass &= std::fabs(m_tstamp-rhs.timeStamp()) < epsilon; pass &= m_history == rhs.history(); - pass &= m_barcode == rhs.barcode(); + pass &= m_barcode == rhs.barcode(); // TODO drop this soon + pass &= m_uid == rhs.id(); { const auto rhsTruthPtr = rhs.getTruthBinding(); if (m_truth && rhsTruthPtr) { @@ -249,7 +260,8 @@ bool ISF::ISFParticle::isIdent(const ISF::ISFParticle& rhs) const pass &= m_status == rhs.status(); pass &= m_tstamp == rhs.timeStamp(); pass &= m_history == rhs.history(); - pass &= m_barcode == rhs.barcode(); + pass &= m_barcode == rhs.barcode(); // TODO drop this soon + pass &= m_uid == rhs.id(); pass &= m_truth && rhs.getTruthBinding(); pass &= m_userInfo == rhs.getUserInformation(); pass &= m_partLink == rhs.getParticleLink(); diff --git a/Simulation/ISF/ISF_Core/ISF_Event/src/ISFTruthIncident.cxx b/Simulation/ISF/ISF_Core/ISF_Event/src/ISFTruthIncident.cxx index ffb1ece903d401bc9a1cb356c38dbcfb89076281..86a148d1aa45e301b2fecd7b7179fec226a79af5 100644 --- a/Simulation/ISF/ISF_Core/ISF_Event/src/ISFTruthIncident.cxx +++ b/Simulation/ISF/ISF_Core/ISF_Event/src/ISFTruthIncident.cxx @@ -95,10 +95,14 @@ HepMC::GenParticlePtr ISF::ISFTruthIncident::parentParticle() { return getHepMCTruthParticle(m_parent); } -Barcode::ParticleBarcode ISF::ISFTruthIncident::parentBarcode() { +Barcode::ParticleBarcode ISF::ISFTruthIncident::parentBarcode() { // TODO Remove this method return m_parent.barcode(); } +int ISF::ISFTruthIncident::parentUniqueID() { + return m_parent.id(); +} + bool ISF::ISFTruthIncident::parentSurvivesIncident() const { return !(m_killsPrimary == ISF::fKillsPrimary); } diff --git a/Simulation/ISF/ISF_Core/ISF_Event/test/ISFParticle_test.cxx b/Simulation/ISF/ISF_Core/ISF_Event/test/ISFParticle_test.cxx index c8e61d7e61c9a03a42dbe22cd8582c5f1d08e133..dff36f75565c90e6a723437f7785dd8a9a3f356e 100644 --- a/Simulation/ISF/ISF_Core/ISF_Event/test/ISFParticle_test.cxx +++ b/Simulation/ISF/ISF_Core/ISF_Event/test/ISFParticle_test.cxx @@ -21,6 +21,7 @@ void testConstructors() { double time = 923.; const ISF::DetRegionSvcIDPair origin( AtlasDetDescr::fAtlasCalo, 2 ); Barcode::ParticleBarcode bc = Barcode::fUndefinedBarcode; + int id = 0; ISF::TruthBinding *truth = 0; // @@ -35,6 +36,7 @@ void testConstructors() { time, origin, bc, + id, truth ); assert( pos == isp1.position() ); @@ -48,6 +50,7 @@ void testConstructors() { assert( 1 == history1.size() ); assert( origin == history1[0] ); assert( bc == isp1.barcode() ); + assert( id == isp1.id() ); assert( truth == isp1.getTruthBinding() ); // @@ -62,6 +65,7 @@ void testConstructors() { time, isp1, // parent bc, + id, truth ); assert( pos == isp2.position() ); @@ -75,6 +79,7 @@ void testConstructors() { assert( 1 == history2.size() ); assert( origin == history2[0] ); assert( bc == isp2.barcode() ); + assert( id == isp2.id() ); assert( truth == isp2.getTruthBinding() ); // @@ -91,6 +96,7 @@ void testConstructors() { time, isp2, // parent bc, + id, truth ); assert( pos == isp3.position() ); @@ -104,6 +110,7 @@ void testConstructors() { assert( 1 == history3.size() ); assert( origin == history3[0] ); assert( bc == isp3.barcode() ); + assert( id == isp3.id() ); assert( truth == isp3.getTruthBinding() ); } diff --git a/Simulation/ISF/ISF_Core/ISF_Event/test/ISFTruthIncident_test.cxx b/Simulation/ISF/ISF_Core/ISF_Event/test/ISFTruthIncident_test.cxx index 6cf98a3b21108ed06d4e592de75d17d3c225205e..095eddbe2a08a6ae0eca26346abe19f7eb6a3421 100644 --- a/Simulation/ISF/ISF_Core/ISF_Event/test/ISFTruthIncident_test.cxx +++ b/Simulation/ISF/ISF_Core/ISF_Event/test/ISFTruthIncident_test.cxx @@ -174,8 +174,10 @@ namespace MCTesting { int status = 200045; double time = 923.; Barcode::ParticleBarcode partBC = 1; + Barcode::ParticleBarcode partID = 1; ISF::TruthBinding *truth = 0; Barcode::ParticleBarcode part2BC = 2; + Barcode::ParticleBarcode part2ID = 2; m_isp1 = std::make_unique<ISF::ISFParticle>( pos, mom, @@ -185,6 +187,7 @@ namespace MCTesting { status, time, test::origin, + partID, partBC, truth ); m_isp2 = std::make_unique<ISF::ISFParticle>( @@ -196,6 +199,7 @@ namespace MCTesting { status, time, *(m_isp1.get()), // parent + part2ID, part2BC, truth ); @@ -237,6 +241,10 @@ namespace MCTesting { } + TEST_F(ISFTruthIncident_test, testParentUniqueID) { + ASSERT_EQ(m_isp1->id(), m_truthIncident->parentUniqueID()); + } + TEST_F(ISFTruthIncident_test, testNumberOfChildren) { const unsigned int nChildren = m_truthIncident->numberOfChildren(); // returns unsigned short ASSERT_EQ(m_pvec_children->size(), nChildren); diff --git a/Simulation/ISF/ISF_Core/ISF_Interfaces/ISF_Interfaces/IParticleHelper.h b/Simulation/ISF/ISF_Core/ISF_Interfaces/ISF_Interfaces/IParticleHelper.h index 78c1a5b97e2bd19e7ed2e4eec0956b0c774e3976..a255e3a0a333f829247eb7c4ccca36ab311016cc 100644 --- a/Simulation/ISF/ISF_Core/ISF_Interfaces/ISF_Interfaces/IParticleHelper.h +++ b/Simulation/ISF/ISF_Core/ISF_Interfaces/ISF_Interfaces/IParticleHelper.h @@ -1,11 +1,7 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// IParticleHelper.h, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - #ifndef ISF_INTERFACES_IPARTICLEHELPER_H #define ISF_INTERFACES_IPARTICLEHELPER_H 1 @@ -32,7 +28,7 @@ namespace ISF { class ISFParticle; class TruthBinding; - + /** @class IParticleHelper @@ -45,64 +41,67 @@ namespace ISF { */ class IParticleHelper : virtual public IAlgTool { - public: - - /** Virtual destructor */ - virtual ~IParticleHelper(){} - - /// Creates the InterfaceID and interfaceID() method - DeclareInterfaceID(IParticleHelper, 1, 0); - - /** Create a new particle */ - virtual ISFParticle* createParticle(double x, double y, double z, - double px, double py, double pz, - double pMass, - double pCharge, - int pPdgId, - int status, - double pTime, - const ISFParticle &parent, - Barcode::ParticleBarcode bc = Barcode::fUndefinedBarcode, - TruthBinding* tBinding = nullptr, - const HepMcParticleLink * partLink = nullptr) const = 0; - - /** Create a new particle */ - virtual ISFParticle* createParticle( const Amg::Vector3D& x, - const Amg::Vector3D& p, - double pMass, - double pCharge, - int pPdgId, - int status, - double pTime, - const ISFParticle &parent, - Barcode::ParticleBarcode bc = Barcode::fUndefinedBarcode, - TruthBinding* tBinding = nullptr, + public: + + /** Virtual destructor */ + virtual ~IParticleHelper(){} + + /// Creates the InterfaceID and interfaceID() method + DeclareInterfaceID(IParticleHelper, 1, 0); + + /** Create a new particle */ + virtual ISFParticle* createParticle(double x, double y, double z, + double px, double py, double pz, + double pMass, + double pCharge, + int pPdgId, + int status, + double pTime, + const ISFParticle &parent, + Barcode::ParticleBarcode bc = Barcode::fUndefinedBarcode, + int id = 0, + TruthBinding* tBinding = nullptr, + const HepMcParticleLink * partLink = nullptr) const = 0; + + /** Create a new particle */ + virtual ISFParticle* createParticle( const Amg::Vector3D& x, + const Amg::Vector3D& p, + double pMass, + double pCharge, + int pPdgId, + int status, + double pTime, + const ISFParticle &parent, + Barcode::ParticleBarcode bc = Barcode::fUndefinedBarcode, + int id = 0, + TruthBinding* tBinding = nullptr, const HepMcParticleLink * partLink = nullptr) const = 0; - /** Create a new particle */ - virtual ISFParticle* createParticle( const HepGeom::Point3D<double>& x, - const HepGeom::Vector3D<double>& p, - double pMass, - double pCharge, - int pPdgId, - int status, - double pTime, - const ISFParticle &parent, - Barcode::ParticleBarcode bc = Barcode::fUndefinedBarcode, - TruthBinding* tBinding = nullptr, + /** Create a new particle */ + virtual ISFParticle* createParticle( const HepGeom::Point3D<double>& x, + const HepGeom::Vector3D<double>& p, + double pMass, + double pCharge, + int pPdgId, + int status, + double pTime, + const ISFParticle &parent, + Barcode::ParticleBarcode bc = Barcode::fUndefinedBarcode, + int id = 0, + TruthBinding* tBinding = nullptr, const HepMcParticleLink * partLink = nullptr) const = 0; - /** An updated particle (e.g. after transport) */ - virtual ISFParticle* updatedParticle( const ISFParticle& origIsp, - const Amg::Vector3D& updatedPos, - const Amg::Vector3D& updatedMom, - double deltaTime = 0.) const = 0; - - /** An updated particle (e.g. after transport) */ - virtual ISFParticle* updatedParticle( const ISFParticle& origIsp, - const HepGeom::Point3D<double>& updatedPos, - const HepGeom::Vector3D<double>& updatedMom, - double deltaTime = 0.) const = 0; + /** An updated particle (e.g. after transport) */ + virtual ISFParticle* updatedParticle( const ISFParticle& origIsp, + const Amg::Vector3D& updatedPos, + const Amg::Vector3D& updatedMom, + double deltaTime = 0.) const = 0; + + /** An updated particle (e.g. after transport) */ + virtual ISFParticle* updatedParticle( const ISFParticle& origIsp, + const HepGeom::Point3D<double>& updatedPos, + const HepGeom::Vector3D<double>& updatedMom, + double deltaTime = 0.) const = 0; }; diff --git a/Simulation/ISF/ISF_Core/ISF_Services/src/InputConverter.cxx b/Simulation/ISF/ISF_Core/ISF_Services/src/InputConverter.cxx index fcfda1fa450bfc66bff2e2858c1899728cc72d88..57ea347b28e5d0980e4aa957d3fc6f86e3279059 100644 --- a/Simulation/ISF/ISF_Core/ISF_Services/src/InputConverter.cxx +++ b/Simulation/ISF/ISF_Core/ISF_Services/src/InputConverter.cxx @@ -339,9 +339,10 @@ ISF::InputConverter::convertParticle(const HepMC::GenParticlePtr& genPartPtr) co /// particle origin (TODO: add proper GeoID, collision/cosmics) DetRegionSvcIDPair origin(AtlasDetDescr::fUndefinedAtlasRegion, ISF::fEventGeneratorSimID); const auto pBarcode = HepMC::barcode(genPartPtr); + const auto particleID = HepMC::uniqueID(genPartPtr); auto tBinding = std::make_unique<ISF::TruthBinding>(genPartPtr); - auto hmpl = std::make_unique<HepMcParticleLink>(pBarcode, parentEvent->event_number(), HepMcParticleLink::IS_EVENTNUM, HepMcParticleLink::IS_BARCODE); + auto hmpl = std::make_unique<HepMcParticleLink>(particleID, parentEvent->event_number(), HepMcParticleLink::IS_EVENTNUM, HepMcParticleLink::IS_ID); auto sParticle = std::make_unique<ISF::ISFParticle>( std::move(pos), std::move(mom), @@ -351,6 +352,7 @@ ISF::InputConverter::convertParticle(const HepMC::GenParticlePtr& genPartPtr) co genPartPtr->status(), pTime, origin, + particleID, pBarcode, tBinding.release(), hmpl.release() ); diff --git a/Simulation/ISF/ISF_Core/ISF_Services/src/TruthSvc.cxx b/Simulation/ISF/ISF_Core/ISF_Services/src/TruthSvc.cxx index 969b1efa1c7f4b9556f4ba02fca73664d524e547..8dd37c861c7c8ca49d14a7ffdc84e5f09da7f4f7 100644 --- a/Simulation/ISF/ISF_Core/ISF_Services/src/TruthSvc.cxx +++ b/Simulation/ISF/ISF_Core/ISF_Services/src/TruthSvc.cxx @@ -180,8 +180,8 @@ void ISF::TruthSvc::registerTruthIncident( ISF::ITruthIncident& ti, bool saveAll } // the parent particle -> get its barcode - Barcode::ParticleBarcode parentBC = ti.parentBarcode(); - if ( m_skipIfNoParentBarcode && (parentBC==Barcode::fUndefinedBarcode) ) { + Barcode::ParticleBarcode parentBC = ti.parentBarcode(); // FIXME barcode-based + if ( m_skipIfNoParentBarcode && (parentBC==Barcode::fUndefinedBarcode) ) { // TODO switch to using ti.parentUniqueID() ATH_MSG_VERBOSE( "Parent particle in TruthIncident does not have a barcode," << " will not record this TruthIncident."); return; diff --git a/Simulation/ISF/ISF_Core/ISF_Services/test/InputConverter_test.cxx b/Simulation/ISF/ISF_Core/ISF_Services/test/InputConverter_test.cxx index 86bd050012a582c6d4d60223c888823c64ed3e70..c34ff0c53dafdf3585d8546d9b31f8f399087c61 100644 --- a/Simulation/ISF/ISF_Core/ISF_Services/test/InputConverter_test.cxx +++ b/Simulation/ISF/ISF_Core/ISF_Services/test/InputConverter_test.cxx @@ -225,6 +225,7 @@ TEST_F(InputConverter_test, convertParticle_using_generated_mass) { 1, ///status 0.321/Gaudi::Units::c_light, // time expectedHistory, + genPart->id(), // id particleBarcode, // barcode expectedTruthBinding, trackLink); @@ -279,6 +280,7 @@ TEST_F(InputConverter_test, convertParticle_using_particleDataTable_photon) { 1, ///status 0.321/Gaudi::Units::c_light, // time expectedHistory, + genPart->id(), // id particleBarcode, // barcode expectedTruthBinding, trackLink @@ -333,6 +335,7 @@ TEST_F(InputConverter_test, convertParticle_using_particleDataTable_electron) { 1, ///status 0.321/Gaudi::Units::c_light, // time expectedHistory, + genPart->id(), // id particleBarcode, // barcode expectedTruthBinding, trackLink diff --git a/Simulation/ISF/ISF_Core/ISF_Services/test/TruthSvc_test.cxx b/Simulation/ISF/ISF_Core/ISF_Services/test/TruthSvc_test.cxx index b368f6430c877e56edeba1581082236f05a92b28..7b3a23169e677af5c7fa6956536fa111163c4285 100644 --- a/Simulation/ISF/ISF_Core/ISF_Services/test/TruthSvc_test.cxx +++ b/Simulation/ISF/ISF_Core/ISF_Services/test/TruthSvc_test.cxx @@ -98,6 +98,8 @@ namespace ISFTesting { virtual HepMC::GenParticlePtr parentParticle() override {return nullptr;}; /** Return the barcode of the parent particle */ virtual Barcode::ParticleBarcode parentBarcode() override {return 1;}; + /** Return the unique ID of the parent particle */ + virtual int parentUniqueID() override {return 1;} /** Return a boolean whether or not the parent particle survives the incident */ virtual bool parentSurvivesIncident() const override {return false;}; /** Return the parent particle after the TruthIncident vertex (and assign diff --git a/Simulation/ISF/ISF_Core/ISF_Tools/src/ParticleHelper.cxx b/Simulation/ISF/ISF_Core/ISF_Tools/src/ParticleHelper.cxx index ad1a4324e806f4c0140cd199380364872740f1c8..8b9855c375c3fe7b4fa238da9bdb198225ad9593 100644 --- a/Simulation/ISF/ISF_Core/ISF_Tools/src/ParticleHelper.cxx +++ b/Simulation/ISF/ISF_Core/ISF_Tools/src/ParticleHelper.cxx @@ -1,11 +1,7 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// ParticleHelper.cxx, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - // class header include #include "ParticleHelper.h" @@ -41,8 +37,9 @@ ISF::ISFParticle* ISF::ParticleHelper::createParticle(double x, double y, double double pTime, const ISFParticle &parent, Barcode::ParticleBarcode bc, + int id, TruthBinding* tBinding, - const HepMcParticleLink * partLink) const { + const HepMcParticleLink * partLink) const { return new ISF::ISFParticle( Amg::Vector3D(x,y,z), Amg::Vector3D(px,py,pz), pMass, @@ -52,8 +49,9 @@ ISF::ISFParticle* ISF::ParticleHelper::createParticle(double x, double y, double pTime, parent, bc, + id, tBinding, - partLink); + partLink); } @@ -67,8 +65,9 @@ ISF::ISFParticle* ISF::ParticleHelper::createParticle( const Amg::Vector3D& x, double pTime, const ISFParticle &parent, Barcode::ParticleBarcode bc, + int id, TruthBinding* tBinding, - const HepMcParticleLink * partLink) const { + const HepMcParticleLink * partLink) const { return new ISF::ISFParticle( x, p, pMass, @@ -77,9 +76,10 @@ ISF::ISFParticle* ISF::ParticleHelper::createParticle( const Amg::Vector3D& x, status, pTime, parent, + id, bc, tBinding, - partLink); + partLink); } /** Create a new particle */ @@ -92,8 +92,9 @@ ISF::ISFParticle* ISF::ParticleHelper::createParticle( const HepGeom::Point3D<do double pTime, const ISFParticle &parent, Barcode::ParticleBarcode bc, + int id, TruthBinding* tBinding, - const HepMcParticleLink * partLink) const { + const HepMcParticleLink * partLink) const { return createParticle( pos.x(), pos.y(), pos.z(), mom.x(), mom.y(), mom.z(), pMass, @@ -102,9 +103,10 @@ ISF::ISFParticle* ISF::ParticleHelper::createParticle( const HepGeom::Point3D<do status, pTime, parent, + id, bc, tBinding, - partLink); + partLink); } /** Returns the Particle Stack, should register truth */ @@ -121,9 +123,10 @@ ISF::ISFParticle* ISF::ParticleHelper::updatedParticle(const ISFParticle& origIs origIsp.status(), origIsp.timeStamp()+deltaTime, origIsp, + origIsp.id(), origIsp.barcode(), origIsp.getTruthBinding() ? new TruthBinding(*origIsp.getTruthBinding()) : nullptr, - origIsp.getParticleLink() ? new HepMcParticleLink(*origIsp.getParticleLink()) : nullptr); + origIsp.getParticleLink() ? new HepMcParticleLink(*origIsp.getParticleLink()) : nullptr); } /** Returns the Particle Stack, should register truth */ @@ -140,9 +143,10 @@ ISF::ISFParticle* ISF::ParticleHelper::updatedParticle(const ISFParticle& origIs origIsp.status(), origIsp.timeStamp()+deltaTime, origIsp, + origIsp.id(), origIsp.barcode(), origIsp.getTruthBinding() ? new TruthBinding(*origIsp.getTruthBinding()) : nullptr, - origIsp.getParticleLink() ? new HepMcParticleLink(*origIsp.getParticleLink()) : nullptr); + origIsp.getParticleLink() ? new HepMcParticleLink(*origIsp.getParticleLink()) : nullptr); } diff --git a/Simulation/ISF/ISF_Core/ISF_Tools/src/ParticleHelper.h b/Simulation/ISF/ISF_Core/ISF_Tools/src/ParticleHelper.h index 2f876bb8dcd67a4922dd2c16a937f00c5fe90055..4f79c05da94699bfebd79d0a66b14a439e65e584 100644 --- a/Simulation/ISF/ISF_Core/ISF_Tools/src/ParticleHelper.h +++ b/Simulation/ISF/ISF_Core/ISF_Tools/src/ParticleHelper.h @@ -1,11 +1,7 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// ParticleHelper.h, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - #ifndef ISF_TOOLS_PARTICLEHELPER_H #define ISF_TOOLS_PARTICLEHELPER_H 1 @@ -23,79 +19,82 @@ namespace ISF { - class ISFParticle; - class TruthBinding; - + class ISFParticle; + class TruthBinding; + /** @class ParticleHelper - + A helper tool for the creation or update of an ISF::ISFParticle objects - + @author Andreas.Salzburger -at- cern.ch - */ + */ class ParticleHelper : public extends<AthAlgTool, IParticleHelper> { - - public: - //** Constructor with parameters */ - ParticleHelper( const std::string& t, const std::string& n, const IInterface* p ); - - // Athena algtool's Hooks - virtual StatusCode initialize() override; - virtual StatusCode finalize() override; - - /** Create a new particle */ - virtual ISFParticle* createParticle( double x, double y, double z, - double px, double py, double pz, - double pMass, - double pCharge, - int pPdgId, - int status, - double pTime, - const ISFParticle &parent, - Barcode::ParticleBarcode bc, - TruthBinding* tBinding = nullptr, - const HepMcParticleLink * partLink = nullptr) const override final; - - /** Create a new particle */ - virtual ISFParticle* createParticle( const Amg::Vector3D& x, - const Amg::Vector3D& p, - double pMass, - double pCharge, - int pPdgId, - int status, - double pTime, - const ISFParticle &parent, - Barcode::ParticleBarcode bc, - TruthBinding* tBinding = nullptr, - const HepMcParticleLink * partLink = nullptr) const override final; - - /** Create a new particle */ - virtual ISFParticle* createParticle( const HepGeom::Point3D<double>& x, - const HepGeom::Vector3D<double>& p, - double pMass, - double pCharge, - int pPdgId, - int status, - double pTime, - const ISFParticle &parent, - Barcode::ParticleBarcode bc, - TruthBinding* tBinding = nullptr, - const HepMcParticleLink * partLink = nullptr) const override final; - - /** An updated particle (e.g. after transport) */ - virtual ISFParticle* updatedParticle( const ISFParticle& origIsp, - const Amg::Vector3D& updatedPos, - const Amg::Vector3D& updatedMom, - double deltaTime = 0.) const override final; - - /** An updated particle (e.g. after transport) */ - virtual ISFParticle* updatedParticle( const ISFParticle& origIsp, - const HepGeom::Point3D<double>& updatedPos, - const HepGeom::Vector3D<double>& updatedMom, - double deltaTime = 0.) const override final; - - - }; - + + public: + //** Constructor with parameters */ + ParticleHelper( const std::string& t, const std::string& n, const IInterface* p ); + + // Athena algtool's Hooks + virtual StatusCode initialize() override; + virtual StatusCode finalize() override; + + /** Create a new particle */ + virtual ISFParticle* createParticle( double x, double y, double z, + double px, double py, double pz, + double pMass, + double pCharge, + int pPdgId, + int status, + double pTime, + const ISFParticle &parent, + Barcode::ParticleBarcode bc, + int id, + TruthBinding* tBinding = nullptr, + const HepMcParticleLink * partLink = nullptr) const override final; + + /** Create a new particle */ + virtual ISFParticle* createParticle( const Amg::Vector3D& x, + const Amg::Vector3D& p, + double pMass, + double pCharge, + int pPdgId, + int status, + double pTime, + const ISFParticle &parent, + Barcode::ParticleBarcode bc, + int id, + TruthBinding* tBinding = nullptr, + const HepMcParticleLink * partLink = nullptr) const override final; + + /** Create a new particle */ + virtual ISFParticle* createParticle( const HepGeom::Point3D<double>& x, + const HepGeom::Vector3D<double>& p, + double pMass, + double pCharge, + int pPdgId, + int status, + double pTime, + const ISFParticle &parent, + Barcode::ParticleBarcode bc, + int id, + TruthBinding* tBinding = nullptr, + const HepMcParticleLink * partLink = nullptr) const override final; + + /** An updated particle (e.g. after transport) */ + virtual ISFParticle* updatedParticle( const ISFParticle& origIsp, + const Amg::Vector3D& updatedPos, + const Amg::Vector3D& updatedMom, + double deltaTime = 0.) const override final; + + /** An updated particle (e.g. after transport) */ + virtual ISFParticle* updatedParticle( const ISFParticle& origIsp, + const HepGeom::Point3D<double>& updatedPos, + const HepGeom::Vector3D<double>& updatedMom, + double deltaTime = 0.) const override final; + + + }; + } diff --git a/Simulation/ISF/ISF_Fatras/ISF_FatrasTools/src/HadIntProcessorParametric.cxx b/Simulation/ISF/ISF_Fatras/ISF_FatrasTools/src/HadIntProcessorParametric.cxx index ce659539589253ebb6588207630a47f9c28253fe..882be168fa00efc4302dd2aa3afb0abedabde6af 100644 --- a/Simulation/ISF/ISF_Fatras/ISF_FatrasTools/src/HadIntProcessorParametric.cxx +++ b/Simulation/ISF/ISF_Fatras/ISF_FatrasTools/src/HadIntProcessorParametric.cxx @@ -1,11 +1,7 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// HadIntProcessorParametric.cxx, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - // class header #include "HadIntProcessorParametric.h" @@ -620,7 +616,9 @@ ISF::ISFParticleVector iFatras::HadIntProcessorParametric::getHadState(const ISF pdgid[i], 1 + HepMC::SIM_STATUS_THRESHOLD, time, - *parent ); + *parent, + 0 // FIXME hardcoded id + ); // in the validation mode, add process info if (m_validationMode) { ISF::ParticleUserInformation* validInfo = new ISF::ParticleUserInformation(); diff --git a/Simulation/ISF/ISF_Fatras/ISF_FatrasTools/src/McMaterialEffectsUpdator.cxx b/Simulation/ISF/ISF_Fatras/ISF_FatrasTools/src/McMaterialEffectsUpdator.cxx index 98ccd168a4b48d8ca2138a27be2c0c0dff4bae0a..ec3a4cc9d641f1520d52df130adaee1370d23f10 100644 --- a/Simulation/ISF/ISF_Fatras/ISF_FatrasTools/src/McMaterialEffectsUpdator.cxx +++ b/Simulation/ISF/ISF_Fatras/ISF_FatrasTools/src/McMaterialEffectsUpdator.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ // class header @@ -500,7 +500,9 @@ iFatras::McMaterialEffectsUpdator::updateInLay( isp->status(), isp->timeStamp(), *m_isp, - isp->barcode()); + isp->id(), + isp->barcode() // FIXME barcode-based + ); // add presampled process info if (isp->getUserInformation() && isp->getUserInformation()->materialLimit()) { const ISF::MaterialPathInfo* matLim = isp->getUserInformation()->materialLimit(); @@ -689,7 +691,9 @@ iFatras::McMaterialEffectsUpdator::updateInLay( isp->status(), isp->timeStamp(), *m_isp, - isp->barcode()); + isp->id(), + isp->barcode() // FIXME barcode-based + ); // add presampled process info if (isp->getUserInformation() && isp->getUserInformation()->materialLimit()) { const ISF::MaterialPathInfo* matLim = isp->getUserInformation()->materialLimit(); @@ -1289,7 +1293,9 @@ void iFatras::McMaterialEffectsUpdator::recordBremPhoton(double time, 22, //!< pdg code 1 + HepMC::SIM_STATUS_THRESHOLD, //!< status time, //!< time - *parent ); + *parent, + 0 // FIXME hard-coded id + ); // in the validation mode, add process info if (m_validationMode) { @@ -1417,7 +1423,9 @@ void iFatras::McMaterialEffectsUpdator::recordBremPhotonLay(const ISF::ISFPartic 22, //!< pdg code 1, //!< status timeLim.time, //!< time - *parent ); + *parent, + 0 // FIXME hard-coded id + ); // in the validation mode, add process info @@ -1594,7 +1602,9 @@ iFatras::McMaterialEffectsUpdator::interact(double time, 22, 1, time, - *parent ); + *parent, + 0 // FIXME hard-coded id + ); children[1] = new ISF::ISFParticle( position, (1-fr)*momentum, @@ -1603,7 +1613,9 @@ iFatras::McMaterialEffectsUpdator::interact(double time, 22, 1, time, - *parent ); + *parent, + 0 // FIXME hard-coded id + ); // in the validation mode, add process info if (m_validationMode) { @@ -1709,7 +1721,9 @@ ISF::ISFParticleVector iFatras::McMaterialEffectsUpdator::interactLay(const ISF 22, 1, time, - *parent ); + *parent, + 0 // FIXME hard-coded id + ); children[1] = new ISF::ISFParticle( position, (1-fr)*momentum, @@ -1718,7 +1732,9 @@ ISF::ISFParticleVector iFatras::McMaterialEffectsUpdator::interactLay(const ISF 22, 1, time, - *parent ); + *parent, + 0 // FIXME hard-coded id + ); // in the validation mode, add process info if (m_validationMode) { diff --git a/Simulation/ISF/ISF_Fatras/ISF_FatrasTools/src/PhotonConversionTool.cxx b/Simulation/ISF/ISF_Fatras/ISF_FatrasTools/src/PhotonConversionTool.cxx index 0393f7a1fb9b59546589a442a1b77093142465ae..b5fd3dd9ae8915819dd91bcdc0aca16d7d47dc1c 100755 --- a/Simulation/ISF/ISF_Fatras/ISF_FatrasTools/src/PhotonConversionTool.cxx +++ b/Simulation/ISF/ISF_Fatras/ISF_FatrasTools/src/PhotonConversionTool.cxx @@ -1,11 +1,7 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// PhotonConversionTool.cxx, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - // class header #include "PhotonConversionTool.h" @@ -254,7 +250,9 @@ void iFatras::PhotonConversionTool::recordChilds(double time, pdg1, 1 + HepMC::SIM_STATUS_THRESHOLD, time, - *parent ); + *parent, + 0 // FIXME hard-coded id + ); // in the validation mode, add process info if (m_validationMode) { ISF::ParticleUserInformation* validInfo = new ISF::ParticleUserInformation(); @@ -279,7 +277,9 @@ void iFatras::PhotonConversionTool::recordChilds(double time, pdg2, 1 + HepMC::SIM_STATUS_THRESHOLD, time, - *parent ); + *parent, + 0 // FIXME hard-coded id + ); // in the validation mode, add process info if (m_validationMode) { @@ -358,7 +358,9 @@ ISF::ISFParticleVector iFatras::PhotonConversionTool::getChilds(const ISF::ISFPa pdg1, 1, time, - *parent)); + *parent, + 0 // FIXME hard-coded id + )); std::unique_ptr<ISF::ISFParticle> ch2(new ISF::ISFParticle(vertex, p2*childDirection, @@ -367,7 +369,9 @@ ISF::ISFParticleVector iFatras::PhotonConversionTool::getChilds(const ISF::ISFPa pdg2, 1, time, - *parent)); + *parent, + 0 // FIXME hard-coded id + )); ISF::ISFParticleVector children{ch1.release(), ch2.release()}; diff --git a/Simulation/ISF/ISF_Fatras/ISF_FatrasTools/src/ProcessSamplingTool.cxx b/Simulation/ISF/ISF_Fatras/ISF_FatrasTools/src/ProcessSamplingTool.cxx index 3ed89f3a6c8378a3b0c0127d2f454f35a9bcc2c7..9a9a2bd3b88abda4e9bc67ffbc11604d11fc7ad7 100644 --- a/Simulation/ISF/ISF_Fatras/ISF_FatrasTools/src/ProcessSamplingTool.cxx +++ b/Simulation/ISF/ISF_Fatras/ISF_FatrasTools/src/ProcessSamplingTool.cxx @@ -266,7 +266,9 @@ ISF::ISFParticleVector iFatras::ProcessSamplingTool::interact(const ISF::ISFPar 22, 1 + HepMC::SIM_STATUS_THRESHOLD, eCell.time, - *parent ); + *parent, + 0 // FIXME hard-coded id + ); ISF::ISFParticle* child2 = new ISF::ISFParticle( position, (1-fr)*momentum, @@ -275,7 +277,9 @@ ISF::ISFParticleVector iFatras::ProcessSamplingTool::interact(const ISF::ISFPar 22, 1 + HepMC::SIM_STATUS_THRESHOLD, eCell.time, - *parent ); + *parent, + 0 // FIXME hard-coded id + ); childVector.push_back(child1); childVector.push_back(child2); diff --git a/Simulation/ISF/ISF_Fatras/ISF_FatrasToolsG4/src/G4HadIntProcessor.cxx b/Simulation/ISF/ISF_Fatras/ISF_FatrasToolsG4/src/G4HadIntProcessor.cxx index 525e224aad03a5def23256ba060a5b033436d737..673c7db543f8e3207049676111e3abb3095dbb23 100644 --- a/Simulation/ISF/ISF_Fatras/ISF_FatrasToolsG4/src/G4HadIntProcessor.cxx +++ b/Simulation/ISF/ISF_Fatras/ISF_FatrasToolsG4/src/G4HadIntProcessor.cxx @@ -2,10 +2,6 @@ Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// G4HadIntProcessor.cxx, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - // Class Header #include "ISF_FatrasToolsG4/G4HadIntProcessor.h" @@ -512,6 +508,7 @@ ISF::ISFParticleVector iFatras::G4HadIntProcessor::getHadState(const ISF::ISFPar 1, //status time, *parent, + 0, // undefined id Barcode::fUndefinedBarcode, truthBinding ); cParticle->setNextGeoID( parent->nextGeoID() ); diff --git a/Simulation/ISF/ISF_Fatras/ISF_FatrasToolsG4/src/G4ParticleDecayHelper.cxx b/Simulation/ISF/ISF_Fatras/ISF_FatrasToolsG4/src/G4ParticleDecayHelper.cxx index f637c33121b9f210b8dad2bc5f73ea5966b693c5..16cefedab175944c82b19bb0a5a23a3e9075a93f 100644 --- a/Simulation/ISF/ISF_Fatras/ISF_FatrasToolsG4/src/G4ParticleDecayHelper.cxx +++ b/Simulation/ISF/ISF_Fatras/ISF_FatrasToolsG4/src/G4ParticleDecayHelper.cxx @@ -1,11 +1,7 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// G4ParticleDecayHelper.cxx, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - // class header // iFatras #include "ISF_FatrasToolsG4/G4ParticleDecayHelper.h" @@ -386,6 +382,7 @@ iFatras::G4ParticleDecayHelper::decayParticle(const ISF::ISFParticle& parent, 1 + HepMC::SIM_STATUS_THRESHOLD, //status timeStamp, parent, + 0, // undefined id Barcode::fUndefinedBarcode, truthBinding ); diff --git a/Simulation/ISF/ISF_Geant4/ISF_Geant4CommonTools/src/EntryLayerTool.cxx b/Simulation/ISF/ISF_Geant4/ISF_Geant4CommonTools/src/EntryLayerTool.cxx index cf25e6c3439766aa333c1136b0938f12aec2e226..922d8c4720e6498b515b0b8f906b5e2c4d061351 100644 --- a/Simulation/ISF/ISF_Geant4/ISF_Geant4CommonTools/src/EntryLayerTool.cxx +++ b/Simulation/ISF/ISF_Geant4/ISF_Geant4CommonTools/src/EntryLayerTool.cxx @@ -188,7 +188,7 @@ ISF::EntryLayer ISF::EntryLayerTool::registerParticle(const ISF::ISFParticle& pa auto truthBinding = particle.getTruthBinding(); auto generationZeroTruthParticle = truthBinding ? truthBinding->getGenerationZeroTruthParticle() : nullptr; const int barcode = generationZeroTruthParticle ? HepMC::barcode(generationZeroTruthParticle) : particle.barcode(); // FIXME barcode-based - const int id = generationZeroTruthParticle ? HepMC::uniqueID(generationZeroTruthParticle) : HepMC::UNDEFINED_ID; //particle.id(); // FIXME uncomment when ISFParticle has an id() method. + const int id = generationZeroTruthParticle ? HepMC::uniqueID(generationZeroTruthParticle) : particle.id(); const int status = generationZeroTruthParticle ? generationZeroTruthParticle->status() : particle.status(); m_collection[layerHit]->Emplace(particle.pdgCode(), @@ -197,7 +197,7 @@ ISF::EntryLayer ISF::EntryLayerTool::registerParticle(const ISF::ISFParticle& pa hepMom, hepPos, particle.timeStamp(), - barcode, + barcode, // FIXME barcode-based id, m_volumeName[layerHit] ); } diff --git a/Simulation/ISF/ISF_Geant4/ISF_Geant4CommonTools/src/EntryLayerToolMT.cxx b/Simulation/ISF/ISF_Geant4/ISF_Geant4CommonTools/src/EntryLayerToolMT.cxx index 48be51f7603999d528711fff5abc0204d9f4d5ef..331834e99c88ab4f699498a4d2bdecb02b4f0613 100644 --- a/Simulation/ISF/ISF_Geant4/ISF_Geant4CommonTools/src/EntryLayerToolMT.cxx +++ b/Simulation/ISF/ISF_Geant4/ISF_Geant4CommonTools/src/EntryLayerToolMT.cxx @@ -136,7 +136,7 @@ ISF::EntryLayer ISF::EntryLayerToolMT::registerParticle(const ISF::ISFParticle& auto truthBinding = particle.getTruthBinding(); auto generationZeroTruthParticle = truthBinding ? truthBinding->getGenerationZeroTruthParticle() : nullptr; const int barcode = generationZeroTruthParticle ? HepMC::barcode(generationZeroTruthParticle) : particle.barcode(); // FIXME barcode-based - const int id = generationZeroTruthParticle ? HepMC::uniqueID(generationZeroTruthParticle) : HepMC::UNDEFINED_ID; //particle.id(); // FIXME uncomment when ISFParticle has an id() method. + const int id = generationZeroTruthParticle ? HepMC::uniqueID(generationZeroTruthParticle) : particle.id(); const int status = generationZeroTruthParticle ? generationZeroTruthParticle->status() : particle.status(); (*m_collectionHolder.get())[layerHit]->Emplace(particle.pdgCode(), @@ -145,7 +145,7 @@ ISF::EntryLayer ISF::EntryLayerToolMT::registerParticle(const ISF::ISFParticle& hepMom, hepPos, particle.timeStamp(), - barcode, + barcode, // FIXME barcode-based id, m_volumeName[layerHit] ); } diff --git a/Simulation/ISF/ISF_Geant4/ISF_Geant4Event/ISF_Geant4Event/Geant4TruthIncident.h b/Simulation/ISF/ISF_Geant4/ISF_Geant4Event/ISF_Geant4Event/Geant4TruthIncident.h index ac19734f7d48e94581ad8f5d666bae4d0ff0509e..2b811fb787ea555bd2fb596e0b09064e0d421958 100644 --- a/Simulation/ISF/ISF_Geant4/ISF_Geant4Event/ISF_Geant4Event/Geant4TruthIncident.h +++ b/Simulation/ISF/ISF_Geant4/ISF_Geant4Event/ISF_Geant4Event/Geant4TruthIncident.h @@ -63,7 +63,9 @@ namespace iGeant4 { /** Return the PDG Code of the parent particle */ int parentPdgCode() const override final; /** Return the barcode of the parent particle */ - Barcode::ParticleBarcode parentBarcode() override final; + Barcode::ParticleBarcode parentBarcode() override final; // TODO Remove this method + /** Return the unique ID of the parent particle */ + int parentUniqueID() override final; /** Return the status of the parent particle */ int parentStatus() override final; /** Return a boolean whether or not the parent particle survives the incident */ diff --git a/Simulation/ISF/ISF_Geant4/ISF_Geant4Event/src/Geant4TruthIncident.cxx b/Simulation/ISF/ISF_Geant4/ISF_Geant4Event/src/Geant4TruthIncident.cxx index 80e4801796326982cf5703b6635c383a55d0f40b..130a9ad848da09aef432541afce70a670d012173 100644 --- a/Simulation/ISF/ISF_Geant4/ISF_Geant4Event/src/Geant4TruthIncident.cxx +++ b/Simulation/ISF/ISF_Geant4/ISF_Geant4Event/src/Geant4TruthIncident.cxx @@ -114,12 +114,18 @@ int iGeant4::Geant4TruthIncident::parentPdgCode() const { return m_step->GetTrack()->GetDefinition()->GetPDGEncoding(); } -Barcode::ParticleBarcode iGeant4::Geant4TruthIncident::parentBarcode() { +Barcode::ParticleBarcode iGeant4::Geant4TruthIncident::parentBarcode() { // TODO Remove this method auto parent = parentParticle(); return (parent) ? HepMC::barcode(parent) : Barcode::fUndefinedBarcode; } +int iGeant4::Geant4TruthIncident::parentUniqueID() { + auto parent = parentParticle(); + + return (parent) ? HepMC::uniqueID(parent) : Barcode::fUndefinedBarcode; +} + int iGeant4::Geant4TruthIncident::parentStatus() { auto parent = parentParticle(); diff --git a/Simulation/ISF/ISF_Geant4/ISF_Geant4Event/src/ISFG4Helper.cxx b/Simulation/ISF/ISF_Geant4/ISF_Geant4Event/src/ISFG4Helper.cxx index 6ca23ac764ecd78032752abf742f9ebf30df3285..5f00bea9571497d333858ad0ee3d98fc78568f30 100644 --- a/Simulation/ISF/ISF_Geant4/ISF_Geant4Event/src/ISFG4Helper.cxx +++ b/Simulation/ISF/ISF_Geant4/ISF_Geant4Event/src/ISFG4Helper.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ // class header @@ -12,6 +12,7 @@ #include "G4Event.hh" #include "AtlasHepMC/GenParticle.h" +#include "TruthUtils/MagicNumbers.h" // G4Atlas includes #include "MCTruth/AtlasG4EventUserInfo.h" @@ -33,16 +34,17 @@ iGeant4::ISFG4Helper::convertG4TrackToISFParticle(const G4Track& aTrack, const G4ThreeVector& g4pos = aTrack.GetPosition(); const double gTime = aTrack.GetGlobalTime(); const Amg::Vector3D position(g4pos.x(),g4pos.y(),g4pos.z()); - + const G4ThreeVector& g4mom = aTrack.GetMomentum(); const Amg::Vector3D momentum(g4mom.x(),g4mom.y(),g4mom.z()); - + const G4ParticleDefinition &particleDefinition = *aTrack.GetDefinition(); double mass = particleDefinition.GetPDGMass(); double charge = particleDefinition.GetPDGCharge(); int pdgID = particleDefinition.GetPDGEncoding(); - Barcode::ParticleBarcode barcode = (truth && truth->getTruthParticle() ) ? HepMC::barcode(truth->getTruthParticle()) : Barcode::fUndefinedBarcode; + Barcode::ParticleBarcode barcode = (truth && truth->getTruthParticle() ) ? HepMC::barcode(truth->getTruthParticle()) : Barcode::fUndefinedBarcode; // FIXME barcode-based + const int id = (truth && truth->getTruthParticle() ) ? HepMC::uniqueID(truth->getTruthParticle()) : HepMC::UNDEFINED_ID; ISF::ISFParticle *isp = new ISF::ISFParticle( position, momentum, @@ -52,7 +54,8 @@ iGeant4::ISFG4Helper::convertG4TrackToISFParticle(const G4Track& aTrack, 1, gTime, parent, - barcode, + id, + barcode, // FIXME barcode-based truth ); @@ -62,7 +65,7 @@ iGeant4::ISFG4Helper::convertG4TrackToISFParticle(const G4Track& aTrack, /** return a valid UserInformation object of the G4Track for use within the ISF */ VTrackInformation * -iGeant4::ISFG4Helper::getISFTrackInfo(const G4Track& aTrack) +iGeant4::ISFG4Helper::getISFTrackInfo(const G4Track& aTrack) { VTrackInformation* trackInfo = static_cast<VTrackInformation*>(aTrack.GetUserInformation()); return trackInfo; @@ -113,4 +116,3 @@ iGeant4::ISFG4Helper::getAtlasG4EventUserInfo() { return ( static_cast<AtlasG4EventUserInfo*> (G4EventManager::GetEventManager()->GetConstCurrentEvent()->GetUserInformation()) ); } - diff --git a/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/src/ISFTrajectory.cxx b/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/src/ISFTrajectory.cxx index df574632384ae761e1600d630c621418ab97d69d..1bf6ed1aff3b0853c710c311f9791b4183caa67d 100644 --- a/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/src/ISFTrajectory.cxx +++ b/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/src/ISFTrajectory.cxx @@ -1,11 +1,7 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// ISFTrajectory.cxx, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - // class header #include "ISFTrajectory.h" @@ -115,8 +111,10 @@ void iGeant4::ISFTrajectory::AppendStep(const G4Step* aStep) // ITruthSvc::registerTruthIncident call above auto currentGenPart = atlasG4EvtUserInfo->GetCurrentlyTraced(); baseIsp->getTruthBinding()->setTruthParticle( currentGenPart ); - Barcode::ParticleBarcode newBarcode = HepMC::barcode(currentGenPart); - baseIsp->setBarcode( newBarcode ); + Barcode::ParticleBarcode newBarcode = HepMC::barcode(currentGenPart); // FIXME barcode-based + baseIsp->setBarcode( newBarcode ); // FIXME barcode-based + int id = HepMC::uniqueID(currentGenPart); + baseIsp->setId( id ); } } else { diff --git a/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/src/TrackProcessorUserActionFullG4.cxx b/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/src/TrackProcessorUserActionFullG4.cxx index a4a923582752660b9587b29795a02b23614f8c5f..b267c47fbfd43c718e01c5dd53c79cc56ee70a26 100644 --- a/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/src/TrackProcessorUserActionFullG4.cxx +++ b/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/src/TrackProcessorUserActionFullG4.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ // class header @@ -148,8 +148,10 @@ namespace G4UA{ tmpISP->setNextGeoID(nextGeoID); tmpISP->setNextSimID(ISF::fUndefinedSimID); - auto generationZeroBarcode = tHelp.GetBarcode(); - tmpISP->setBarcode(generationZeroBarcode); + auto generationZeroBarcode = tHelp.GetBarcode(); // FIXME barcode-based + tmpISP->setBarcode(generationZeroBarcode); // FIXME barcode-based + auto generationZeroID = tHelp.GetUniqueID(); + tmpISP->setId(generationZeroID); tmpISP->setNextGeoID( nextGeoID ); diff --git a/Simulation/ISF/ISF_Tracking/ISF_TrackingTools/src/TrkExtrapolator.cxx b/Simulation/ISF/ISF_Tracking/ISF_TrackingTools/src/TrkExtrapolator.cxx index cf637aed9239f237d23f3b15a186091d470c186a..287866afc9d9a082df70db5bad0f2c3859251f68 100644 --- a/Simulation/ISF/ISF_Tracking/ISF_TrackingTools/src/TrkExtrapolator.cxx +++ b/Simulation/ISF/ISF_Tracking/ISF_TrackingTools/src/TrkExtrapolator.cxx @@ -1,11 +1,7 @@ /* - Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration */ -/////////////////////////////////////////////////////////////////// -// TrkExtrapolator.cxx, (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - // class header include #include "TrkExtrapolator.h" @@ -119,7 +115,9 @@ ISF::ISFParticle* ISF::TrkExtrapolator::extrapolate( const ISF::ISFParticle &par particle.pdgCode(), particle.status(), particle.timeStamp(), - particle ); + particle, + particle.id() // FIXME should this be undefined instead? + ); // cleanup delete extrapolatedPars;