diff --git a/Simulation/G4Sim/MCTruth/MCTruth/AtlasG4EventUserInfo.h b/Simulation/G4Sim/MCTruth/MCTruth/AtlasG4EventUserInfo.h index cfda36acc877d5eda3ecf00fbeafc13dd45b08a1..c7278462b29613eabfebad19b8439fba4df41ced 100644 --- a/Simulation/G4Sim/MCTruth/MCTruth/AtlasG4EventUserInfo.h +++ b/Simulation/G4Sim/MCTruth/MCTruth/AtlasG4EventUserInfo.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ #ifndef MCTRUTH_ATLASG4EVENTUSERINFO_H @@ -27,7 +27,7 @@ public: const G4ThreeVector GetVertexPosition() const; void Print() const {} - void SetCurrentPrimary(HepMC::GenParticlePtr p) {m_currentPrimary=p;} + void SetCurrentPrimary(HepMC::ConstGenParticlePtr p) {m_currentPrimary=p;} void SetCurrentlyTraced(HepMC::GenParticlePtr p) {m_currentlyTraced=p;} @@ -51,7 +51,7 @@ private: int m_secondaryParticleBarCode; int m_secondaryVertexBarCode; HepMC::GenEvent *m_theEvent; - HepMC::GenParticlePtr m_currentPrimary; + HepMC::ConstGenParticlePtr m_currentPrimary; HepMC::GenParticlePtr m_currentlyTraced; // These two are used by calibration hits as event-level flags // They correspond to the last barcode and step processed by an SD 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 d7189eda3e04908307f7d50b5e1107de8887fbdf..9ffdd4a962ba509f1572ea3e7c4aa223ed6ed01f 100644 --- a/Simulation/ISF/ISF_Core/ISF_Event/ISF_Event/ISFTruthIncident.h +++ b/Simulation/ISF/ISF_Core/ISF_Event/ISF_Event/ISFTruthIncident.h @@ -51,7 +51,7 @@ namespace ISF { ~ISFTruthIncident(); /** Return HepMC position of the truth vertex */ - const HepMC::FourVector& position() const override final; + const HepMC::FourVector& position() override final; /** Return category of the physics process represented by the truth incident (eg hadronic, em, ..) */ int physicsProcessCategory() const override final; /** Return specific physics process code of the truth incident (eg ionisation, bremsstrahlung, ..)*/ @@ -112,7 +112,7 @@ namespace ISF { const ISFParticleVector& m_children; const Barcode::PhysicsProcessCode m_process; const ISF::KillPrimary m_killsPrimary; - mutable const HepMC::FourVector *m_position; + const HepMC::FourVector* m_position; }; } // end of namespace 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 27254707a2edffda8635034f49c8d85822551a08..f0800ef8ef23304ee821b87429077a09c98bee59 100644 --- a/Simulation/ISF/ISF_Core/ISF_Event/ISF_Event/ITruthIncident.h +++ b/Simulation/ISF/ISF_Core/ISF_Event/ISF_Event/ITruthIncident.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -57,7 +57,7 @@ namespace ISF { AtlasDetDescr::AtlasRegion geoID() { return m_geoID; }; /** Return HepMC position of the truth vertex */ - virtual const HepMC::FourVector& position() const = 0; + virtual const HepMC::FourVector& position() = 0; /** Return category of the physics process represented by the truth incident (eg hadronic, em, ..) */ virtual int physicsProcessCategory() const = 0; diff --git a/Simulation/ISF/ISF_Core/ISF_Event/ISF_Event/TruthBinding.h b/Simulation/ISF/ISF_Core/ISF_Event/ISF_Event/TruthBinding.h index e5352b5c7fa81a5d59b1108b121b06f9eca6cd85..b5d819a635eae8978684e78e01d09d23b114f09c 100644 --- a/Simulation/ISF/ISF_Core/ISF_Event/ISF_Event/TruthBinding.h +++ b/Simulation/ISF/ISF_Core/ISF_Event/ISF_Event/TruthBinding.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -27,15 +27,15 @@ namespace ISF { /** constructor setting all truth particle pointers to the given particle */ inline TruthBinding(HepMC::GenParticlePtr allTruthP); /** constructor setting all truth particle pointers individually */ - inline TruthBinding(HepMC::GenParticlePtr truthP, HepMC::GenParticlePtr primaryTruthP, HepMC::GenParticlePtr genZeroTruthP); + inline TruthBinding(HepMC::GenParticlePtr truthP, HepMC::ConstGenParticlePtr primaryTruthP, HepMC::ConstGenParticlePtr genZeroTruthP); /** copy constructors */ - inline TruthBinding(const TruthBinding &rhs); - inline TruthBinding(TruthBinding&& rhs); + inline TruthBinding(const TruthBinding &rhs) = default; + inline TruthBinding(TruthBinding&& rhs) = default; //** assignment operators */ - inline TruthBinding& operator=(const TruthBinding &rhs); - inline TruthBinding& operator=(TruthBinding&& rhs); + inline TruthBinding& operator=(const TruthBinding &rhs) = default; + inline TruthBinding& operator=(TruthBinding&& rhs) = default; /** comparisons */ inline bool operator==(const TruthBinding& rhs) const; @@ -50,16 +50,16 @@ namespace ISF { inline void setTruthParticle(HepMC::GenParticlePtr p); /** pointer to the primary particle in the simulation truth */ - inline HepMC::GenParticlePtr getPrimaryTruthParticle() const; + inline HepMC::ConstGenParticlePtr getPrimaryTruthParticle() const; /** pointer to the simulation truth particle before any regeneration happened (eg. brem) */ - inline HepMC::GenParticlePtr getGenerationZeroTruthParticle() const; + inline HepMC::ConstGenParticlePtr getGenerationZeroTruthParticle() const; inline void setGenerationZeroTruthParticle(HepMC::GenParticlePtr p); private: HepMC::GenParticlePtr m_truthParticle{}; //!< pointer to particle in MC truth - HepMC::GenParticlePtr m_primaryTruthParticle{}; //!< pointer to corresponding primary (generator) particle - HepMC::GenParticlePtr m_generationZeroTruthParticle{}; //!< pointer to corresponding truth particle before any regenration + HepMC::ConstGenParticlePtr m_primaryTruthParticle{}; //!< pointer to corresponding primary (generator) particle + HepMC::ConstGenParticlePtr m_generationZeroTruthParticle{}; //!< pointer to corresponding truth particle before any regenration }; } // end of namespace 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 0206becfa45c434dda2b9282d28c9140d0ba3f80..b3c9edc0cc41b76a2765833b4a020763dd02bcef 100644 --- a/Simulation/ISF/ISF_Core/ISF_Event/ISF_Event/TruthBinding.icc +++ b/Simulation/ISF/ISF_Core/ISF_Event/ISF_Event/TruthBinding.icc @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ // this file contains all ITruthBinding inline methods @@ -12,41 +12,13 @@ namespace ISF { m_generationZeroTruthParticle(allTruthP) { } /** constructor setting all truth particle pointers individually */ - TruthBinding::TruthBinding(HepMC::GenParticlePtr truthP, HepMC::GenParticlePtr primaryTruthP, HepMC::GenParticlePtr genZeroTruthP) : + TruthBinding::TruthBinding(HepMC::GenParticlePtr truthP, HepMC::ConstGenParticlePtr primaryTruthP, HepMC::ConstGenParticlePtr genZeroTruthP) : m_truthParticle(truthP), m_primaryTruthParticle(primaryTruthP), m_generationZeroTruthParticle(genZeroTruthP) { } - /** copy constructor */ - TruthBinding::TruthBinding(const TruthBinding &rhs) : - m_truthParticle(rhs.getTruthParticle()), - m_primaryTruthParticle(rhs.getPrimaryTruthParticle()), - m_generationZeroTruthParticle(rhs.getGenerationZeroTruthParticle()) { } - - /** move copy constructor */ - TruthBinding::TruthBinding(TruthBinding&& rhs) : - m_truthParticle(rhs.getTruthParticle()), - m_primaryTruthParticle(rhs.getPrimaryTruthParticle()), - m_generationZeroTruthParticle(rhs.getGenerationZeroTruthParticle()) { } - - /** assignment operator */ - TruthBinding& TruthBinding::operator=(const TruthBinding &rhs) { - m_truthParticle=rhs.getTruthParticle(); - m_primaryTruthParticle=rhs.getPrimaryTruthParticle(); - m_generationZeroTruthParticle=rhs.getGenerationZeroTruthParticle(); - return *this; - } - - /** move assignment operator */ - TruthBinding& TruthBinding::operator=(TruthBinding&& rhs) { - m_truthParticle=rhs.getTruthParticle(); - m_primaryTruthParticle=rhs.getPrimaryTruthParticle(); - m_generationZeroTruthParticle=rhs.getGenerationZeroTruthParticle(); - return *this; - } - /** destructor */ - TruthBinding::~TruthBinding() { } + TruthBinding::~TruthBinding() = default; /** comparison operator */ bool TruthBinding::operator==(const TruthBinding& rhs) const { @@ -107,10 +79,10 @@ namespace ISF { void TruthBinding::setTruthParticle(HepMC::GenParticlePtr p) { m_truthParticle = p; } /** pointer to the primary particle in the simulation truth */ - HepMC::GenParticlePtr TruthBinding::getPrimaryTruthParticle() const { return m_primaryTruthParticle; } + HepMC::ConstGenParticlePtr TruthBinding::getPrimaryTruthParticle() const { return m_primaryTruthParticle; } /** pointer to the simulation truth particle before any regeneration (eg. brem) */ - HepMC::GenParticlePtr TruthBinding::getGenerationZeroTruthParticle() const { return m_generationZeroTruthParticle; } + HepMC::ConstGenParticlePtr TruthBinding::getGenerationZeroTruthParticle() const { return m_generationZeroTruthParticle; } void TruthBinding::setGenerationZeroTruthParticle(HepMC::GenParticlePtr p) { m_generationZeroTruthParticle = p; } } // end ISF namespace diff --git a/Simulation/ISF/ISF_Core/ISF_Event/src/ISFTruthIncident.cxx b/Simulation/ISF/ISF_Core/ISF_Event/src/ISFTruthIncident.cxx index dbcbfe1042e577c9d5fdd354fb66c5704e2e7d05..90bf16810fb3d72295293398a84fd63aca9b3e0d 100644 --- a/Simulation/ISF/ISF_Core/ISF_Event/src/ISFTruthIncident.cxx +++ b/Simulation/ISF/ISF_Core/ISF_Event/src/ISFTruthIncident.cxx @@ -36,7 +36,7 @@ ISF::ISFTruthIncident::~ISFTruthIncident() { delete m_position; } -const HepMC::FourVector& ISF::ISFTruthIncident::position() const { +const HepMC::FourVector& ISF::ISFTruthIncident::position() { if ( !m_position) { // no position was given, compute it diff --git a/Simulation/ISF/ISF_Core/ISF_Services/src/InputConverter.cxx b/Simulation/ISF/ISF_Core/ISF_Services/src/InputConverter.cxx index b3b141eb9e7bc7f91bdfeadb0a7e5495e40830f7..566658ed8f32f0ab24bbf815c0ae2bec8950f6c9 100644 --- a/Simulation/ISF/ISF_Core/ISF_Services/src/InputConverter.cxx +++ b/Simulation/ISF/ISF_Core/ISF_Services/src/InputConverter.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -712,8 +712,8 @@ G4PrimaryParticle* ISF::InputConverter::getG4PrimaryParticle(const ISF::ISFParti G4Exception("iGeant4::TransportTool", "NoISFTruthBinding", FatalException, description); return nullptr; //The G4Exception call above should abort the job, but Coverity does not seem to pick this up. } - HepMC::GenParticlePtr genpart = truthBinding->getTruthParticle(); - HepMC::GenParticlePtr primaryGenpart = truthBinding->getPrimaryTruthParticle(); + HepMC::GenParticlePtr genpart = truthBinding->getTruthParticle(); + HepMC::ConstGenParticlePtr primaryGenpart = truthBinding->getPrimaryTruthParticle(); const G4ParticleDefinition *particleDefinition = this->getG4ParticleDefinition(isp.pdgCode()); 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 3e9dc637bd5efa5b6d1fd7566d891dc6ac2637a6..ec798a4a6da714c7b1e4951abd9069cc6d087a21 100644 --- a/Simulation/ISF/ISF_Core/ISF_Services/test/TruthSvc_test.cxx +++ b/Simulation/ISF/ISF_Core/ISF_Services/test/TruthSvc_test.cxx @@ -75,7 +75,7 @@ namespace ISFTesting { { }; virtual ~DummyTruthIncident() {}; - virtual const HepMC::FourVector& position() const {return m_myPosition;}; + virtual const HepMC::FourVector& position() {return m_myPosition;}; virtual int physicsProcessCategory() const { return 1;}; virtual Barcode::PhysicsProcessCode physicsProcessCode() const {return 1;}; virtual double parentP2() const {return 1.0;}; 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 d6f8e150b04176495c7eca7149f149331d3626b9..22b325b6a2f5e718823c419ecabcf246004b8ded 100644 --- a/Simulation/ISF/ISF_Geant4/ISF_Geant4Event/ISF_Geant4Event/Geant4TruthIncident.h +++ b/Simulation/ISF/ISF_Geant4/ISF_Geant4Event/ISF_Geant4Event/Geant4TruthIncident.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ #ifndef ISF_GEANT4TOOLS_Geant4TruthIncident_H @@ -45,7 +45,7 @@ namespace iGeant4 { virtual ~Geant4TruthIncident() {}; /** Return HepMC position of the truth vertex */ - const HepMC::FourVector& position() const override final; + const HepMC::FourVector& position() override final; /** Return category of the physics process represented by the truth incident (eg hadronic, em, ..) */ int physicsProcessCategory() const override final; diff --git a/Simulation/ISF/ISF_Geant4/ISF_Geant4Event/ISF_Geant4Event/ISFG4Helper.h b/Simulation/ISF/ISF_Geant4/ISF_Geant4Event/ISF_Geant4Event/ISFG4Helper.h index 11a5fe483086c297f2dc7694504d5c87232c0d8b..0223978d62946e7c017a841d6815b4dc4bfaf61d 100644 --- a/Simulation/ISF/ISF_Geant4/ISF_Geant4Event/ISF_Geant4Event/ISFG4Helper.h +++ b/Simulation/ISF/ISF_Geant4/ISF_Geant4Event/ISF_Geant4Event/ISFG4Helper.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ #ifndef ISF_GEANT4TOOLS_ISFG4HELPER_H @@ -49,7 +49,7 @@ class ISFG4Helper { static TrackInformation* attachTrackInfoToNewG4Track( G4Track& aTrack, const ISF::ISFParticle& baseIsp, TrackClassification classification, - HepMC::GenParticlePtr nonRegeneratedTruthParticle = nullptr); + HepMC::ConstGenParticlePtr nonRegeneratedTruthParticle = nullptr); /** return pointer to current AtlasG4EventUserInfo */ static AtlasG4EventUserInfo* getAtlasG4EventUserInfo(); diff --git a/Simulation/ISF/ISF_Geant4/ISF_Geant4Event/src/Geant4TruthIncident.cxx b/Simulation/ISF/ISF_Geant4/ISF_Geant4Event/src/Geant4TruthIncident.cxx index bbbd98ff4b9c89ef966aebc3f3473a8d93d5033b..9bb3438db77b283cdad5ef9c76967b40aacb59ab 100644 --- a/Simulation/ISF/ISF_Geant4/ISF_Geant4Event/src/Geant4TruthIncident.cxx +++ b/Simulation/ISF/ISF_Geant4/ISF_Geant4Event/src/Geant4TruthIncident.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ // class header @@ -75,7 +75,7 @@ iGeant4::Geant4TruthIncident::Geant4TruthIncident( const G4Step *step, { } -const HepMC::FourVector& iGeant4::Geant4TruthIncident::position() const { +const HepMC::FourVector& iGeant4::Geant4TruthIncident::position() { if (!m_positionSet) { // post step processes: const G4StepPoint *postStepPoint = m_step->GetPostStepPoint(); diff --git a/Simulation/ISF/ISF_Geant4/ISF_Geant4Event/src/ISFG4Helper.cxx b/Simulation/ISF/ISF_Geant4/ISF_Geant4Event/src/ISFG4Helper.cxx index 33f155a795ca2757468cec3526657ea7b3ab494c..029cdcd9e78473f9d49943efcd0d181f036a34e5 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-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ // class header @@ -79,7 +79,7 @@ TrackInformation* iGeant4::ISFG4Helper::attachTrackInfoToNewG4Track( G4Track& aTrack, const ISF::ISFParticle& baseIsp, TrackClassification classification, - HepMC::GenParticlePtr nonRegeneratedTruthParticle) + HepMC::ConstGenParticlePtr nonRegeneratedTruthParticle) { if ( aTrack.GetUserInformation() ) { G4ExceptionDescription description; diff --git a/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/src/TrackProcessorUserActionBase.cxx b/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/src/TrackProcessorUserActionBase.cxx index 6e496908dd31cabe19f632359e954b9f67d2c569..4d7ecfbf4dab639936f77553a10f897a7cf3dc5e 100644 --- a/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/src/TrackProcessorUserActionBase.cxx +++ b/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/src/TrackProcessorUserActionBase.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -214,7 +214,7 @@ void TrackProcessorUserActionBase::setupSecondary(const G4Track& aTrack) } void TrackProcessorUserActionBase::setCurrentParticle(ISF::ISFParticle* baseISFParticle, - HepMC::GenParticlePtr truthPrimary, + HepMC::ConstGenParticlePtr truthPrimary, HepMC::GenParticlePtr truthCurrentlyTraced) { m_curBaseISP = baseISFParticle; diff --git a/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/src/TrackProcessorUserActionBase.h b/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/src/TrackProcessorUserActionBase.h index 8ee7d046c7d4b97ca642671deae19bcc588f174b..295339279f0e8ea17c1d3da8112cb45e58a2aefe 100644 --- a/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/src/TrackProcessorUserActionBase.h +++ b/Simulation/ISF/ISF_Geant4/ISF_Geant4Tools/src/TrackProcessorUserActionBase.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration */ #ifndef ISF_GEANT4TOOLS_TRACKPROCESSORUSERACTIONBASE_H @@ -64,7 +64,7 @@ private: /// Set the following information as the currently traced particle void setCurrentParticle(ISF::ISFParticle* baseISFParticle, - HepMC::GenParticlePtr truthPrimary, + HepMC::ConstGenParticlePtr truthPrimary, HepMC::GenParticlePtr truthCurrentlyTraced); /// Classify the particle represented by the given set of truth links