Skip to content
Snippets Groups Projects
Commit ea7df69e authored by Frank Winklmeier's avatar Frank Winklmeier
Browse files

MCTruth: use non-const particles

This is similar to !58354 and removes unnecessary `const` qualifiers on
`GenParticle` and `ISFParticle` to avoid `const_cast` downstream for
the following classes:
- `PrimaryParticleInformation`
- `TrackBarcodeInfo`
- `TrackInformation`
- `VTrackInformation`
parent 438bd91c
6 merge requests!59674InDetPerformanceMonitoring with LumiBlock selection,!59383cppcheck in trigger code: Prefer prefix ++/-- operators for non-primitive types.,!58990Draft:Fixing bug in FTF config when running with Reco_tf,!58835DataQualityConfigurations: Modify L1Calo config for web display,!58791DataQualityConfigurations: Modify L1Calo config for web display,!58456MCTruth: use non-const particles
Showing
with 87 additions and 137 deletions
/*
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 PrimaryParticleInformation_H
......@@ -16,21 +16,23 @@ namespace ISF {
class PrimaryParticleInformation: public G4VUserPrimaryParticleInformation {
public:
PrimaryParticleInformation();
PrimaryParticleInformation(HepMC::ConstGenParticlePtr, const ISF::ISFParticle* isp=0);
HepMC::ConstGenParticlePtr GetHepMCParticle() const;
PrimaryParticleInformation(HepMC::GenParticlePtr, ISF::ISFParticle* isp=0);
HepMC::ConstGenParticlePtr GetHepMCParticle() const { return m_theParticle; }
HepMC::GenParticlePtr GetHepMCParticle() { return m_theParticle; }
int GetParticleBarcode() const;
void SuggestBarcode(int bc);
void SetParticle(HepMC::ConstGenParticlePtr);
void SetParticle(HepMC::GenParticlePtr);
void Print() const {}
int GetRegenerationNr() {return m_regenerationNr;}
void SetRegenerationNr(int i) {m_regenerationNr=i;}
void SetISFParticle(const ISF::ISFParticle* isp);
const ISF::ISFParticle* GetISFParticle() const;
void SetISFParticle(ISF::ISFParticle* isp);
const ISF::ISFParticle* GetISFParticle() const { return m_theISFParticle; }
ISF::ISFParticle* GetISFParticle() { return m_theISFParticle; }
private:
HepMC::ConstGenParticlePtr m_theParticle{};
const ISF::ISFParticle* m_theISFParticle{};
HepMC::GenParticlePtr m_theParticle{};
ISF::ISFParticle* m_theISFParticle{};
int m_regenerationNr{0};
int m_barcode{-1};
......
/*
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 TrackBarcodeInfo_H
......@@ -13,15 +13,17 @@ namespace ISF {
class TrackBarcodeInfo: public VTrackInformation {
public:
TrackBarcodeInfo(int bc, const ISF::ISFParticle* baseIsp=0);
int GetParticleBarcode() const;
const ISF::ISFParticle *GetBaseISFParticle() const;
void SetBaseISFParticle(const ISF::ISFParticle*);
void SetReturnedToISF(bool returned);
bool GetReturnedToISF() const;
TrackBarcodeInfo(int bc, ISF::ISFParticle* baseIsp=0);
virtual int GetParticleBarcode() const override {return m_barcode;}
virtual const ISF::ISFParticle *GetBaseISFParticle() const override {return m_theBaseISFParticle;}
virtual ISF::ISFParticle *GetBaseISFParticle() override {return m_theBaseISFParticle;}
virtual void SetBaseISFParticle(ISF::ISFParticle*) override;
virtual void SetReturnedToISF(bool returned) override;
virtual bool GetReturnedToISF() const override {return m_returnedToISF;}
private:
const ISF::ISFParticle *m_theBaseISFParticle;
ISF::ISFParticle *m_theBaseISFParticle;
int m_barcode;
bool m_returnedToISF;
};
......
/*
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 TrackInformation_H
......@@ -14,20 +14,22 @@ namespace ISF {
class TrackInformation: public VTrackInformation {
public:
TrackInformation();
TrackInformation(HepMC::ConstGenParticlePtr,const ISF::ISFParticle* baseIsp=0);
HepMC::ConstGenParticlePtr GetHepMCParticle() const;
const ISF::ISFParticle *GetBaseISFParticle() const;
int GetParticleBarcode() const;
void SetParticle(HepMC::ConstGenParticlePtr);
void SetBaseISFParticle(const ISF::ISFParticle*);
void SetReturnedToISF(bool returned) {m_returnedToISF=returned;};
bool GetReturnedToISF() const {return m_returnedToISF;};
void SetRegenerationNr(int i) {m_regenerationNr=i;};
int GetRegenerationNr() const {return m_regenerationNr;};
TrackInformation(HepMC::GenParticlePtr p, ISF::ISFParticle* baseIsp=0);
virtual HepMC::ConstGenParticlePtr GetHepMCParticle() const override {return m_theParticle;}
virtual HepMC::GenParticlePtr GetHepMCParticle() override {return m_theParticle;}
virtual const ISF::ISFParticle *GetBaseISFParticle() const override {return m_theBaseISFParticle;}
virtual ISF::ISFParticle *GetBaseISFParticle() override {return m_theBaseISFParticle;}
virtual int GetParticleBarcode() const override;
virtual void SetParticle(HepMC::GenParticlePtr) override;
virtual void SetBaseISFParticle(ISF::ISFParticle*) override;
virtual void SetReturnedToISF(bool returned) override {m_returnedToISF=returned;}
virtual bool GetReturnedToISF() const override {return m_returnedToISF;}
void SetRegenerationNr(int i) {m_regenerationNr=i;}
int GetRegenerationNr() const {return m_regenerationNr;}
private:
int m_regenerationNr;
HepMC::ConstGenParticlePtr m_theParticle;
const ISF::ISFParticle *m_theBaseISFParticle;
HepMC::GenParticlePtr m_theParticle;
ISF::ISFParticle *m_theBaseISFParticle;
bool m_returnedToISF;
};
......
/*
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
*/
#ifndef VTrackInformation_H
......@@ -18,21 +18,24 @@ namespace ISF {
class VTrackInformation: public G4VUserTrackInformation {
public:
VTrackInformation(TrackClassification tc=Primary);
HepMC::ConstGenParticlePtr GetPrimaryHepMCParticle() const;
void SetPrimaryHepMCParticle(HepMC::ConstGenParticlePtr);
virtual HepMC::ConstGenParticlePtr GetHepMCParticle() const;
virtual const ISF::ISFParticle *GetBaseISFParticle() const;
HepMC::ConstGenParticlePtr GetPrimaryHepMCParticle() const {return m_thePrimaryParticle;}
HepMC::GenParticlePtr GetPrimaryHepMCParticle() {return m_thePrimaryParticle;}
void SetPrimaryHepMCParticle(HepMC::GenParticlePtr);
virtual HepMC::ConstGenParticlePtr GetHepMCParticle() const {return nullptr;}
virtual HepMC::GenParticlePtr GetHepMCParticle() {return nullptr;}
virtual const ISF::ISFParticle *GetBaseISFParticle() const {return nullptr;}
virtual ISF::ISFParticle *GetBaseISFParticle() {return nullptr;}
virtual bool GetReturnedToISF() const;
virtual int GetParticleBarcode() const =0;
virtual void SetParticle(HepMC::ConstGenParticlePtr);
virtual void SetBaseISFParticle(const ISF::ISFParticle*);
virtual void SetParticle(HepMC::GenParticlePtr);
virtual void SetBaseISFParticle(ISF::ISFParticle*);
virtual void SetReturnedToISF(bool) ;
virtual void Print() const {}
void SetClassification(TrackClassification tc) {m_classify=tc;}
TrackClassification GetClassification() const {return m_classify;}
private:
TrackClassification m_classify;
HepMC::ConstGenParticlePtr m_thePrimaryParticle{};
HepMC::GenParticlePtr m_thePrimaryParticle{};
};
#endif
/*
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
*/
#include "MCTruth/PrimaryParticleInformation.h"
......@@ -8,20 +8,10 @@ PrimaryParticleInformation::PrimaryParticleInformation()
{
}
PrimaryParticleInformation::PrimaryParticleInformation(HepMC::ConstGenParticlePtr p, const ISF::ISFParticle* isp):m_theParticle(p),m_theISFParticle(isp)
PrimaryParticleInformation::PrimaryParticleInformation(HepMC::GenParticlePtr p, ISF::ISFParticle* isp):m_theParticle(p),m_theISFParticle(isp)
{
}
HepMC::ConstGenParticlePtr PrimaryParticleInformation::GetHepMCParticle() const
{
return m_theParticle;
}
const ISF::ISFParticle* PrimaryParticleInformation::GetISFParticle() const
{
return m_theISFParticle;
}
void PrimaryParticleInformation::SuggestBarcode(int bc)
{
m_barcode=bc;
......@@ -35,12 +25,12 @@ int PrimaryParticleInformation::GetParticleBarcode() const
return m_theParticle?HepMC::barcode(m_theParticle):m_barcode;
}
void PrimaryParticleInformation::SetParticle(HepMC::ConstGenParticlePtr p)
void PrimaryParticleInformation::SetParticle(HepMC::GenParticlePtr p)
{
m_theParticle=p;
}
void PrimaryParticleInformation::SetISFParticle(const ISF::ISFParticle* p)
void PrimaryParticleInformation::SetISFParticle(ISF::ISFParticle* p)
{
m_theISFParticle=p;
}
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
*/
#include "MCTruth/TrackBarcodeInfo.h"
TrackBarcodeInfo::TrackBarcodeInfo(int bc, const ISF::ISFParticle* baseIsp):VTrackInformation(BarcodeOnly),m_theBaseISFParticle(baseIsp),m_barcode(bc),m_returnedToISF(false)
TrackBarcodeInfo::TrackBarcodeInfo(int bc, ISF::ISFParticle* baseIsp):VTrackInformation(BarcodeOnly),m_theBaseISFParticle(baseIsp),m_barcode(bc),m_returnedToISF(false)
{
}
int TrackBarcodeInfo::GetParticleBarcode() const
{
return m_barcode;
}
void TrackBarcodeInfo::SetBaseISFParticle(const ISF::ISFParticle* isp)
void TrackBarcodeInfo::SetBaseISFParticle(ISF::ISFParticle* isp)
{
m_theBaseISFParticle=isp;
}
const ISF::ISFParticle* TrackBarcodeInfo::GetBaseISFParticle() const
{
return m_theBaseISFParticle;
}
void TrackBarcodeInfo::SetReturnedToISF(bool returned)
{
m_returnedToISF = returned;
}
bool TrackBarcodeInfo::GetReturnedToISF() const
{
return m_returnedToISF;
}
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
*/
#include "MCTruth/TrackHelper.h"
......@@ -31,7 +31,7 @@ bool TrackHelper::IsSecondary() const
}
int TrackHelper::GetBarcode() const
{
if (m_trackInfo==0 || m_trackInfo->GetHepMCParticle()==0) return 0;
if (m_trackInfo==0 || std::as_const(m_trackInfo)->GetHepMCParticle()==0) return 0;
return m_trackInfo->GetParticleBarcode();
}
......
/*
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
*/
#include "MCTruth/TrackInformation.h"
......@@ -11,7 +11,7 @@ TrackInformation::TrackInformation():m_regenerationNr(0),m_theParticle(0),m_theB
{
}
TrackInformation::TrackInformation(HepMC::ConstGenParticlePtr p,const ISF::ISFParticle* baseIsp):
TrackInformation::TrackInformation(HepMC::GenParticlePtr p, ISF::ISFParticle* baseIsp):
m_regenerationNr(0),
m_theParticle(p),
m_theBaseISFParticle(baseIsp),
......@@ -19,26 +19,17 @@ TrackInformation::TrackInformation(HepMC::ConstGenParticlePtr p,const ISF::ISFPa
{
}
HepMC::ConstGenParticlePtr TrackInformation::GetHepMCParticle() const
{
return m_theParticle;
}
const ISF::ISFParticle* TrackInformation::GetBaseISFParticle() const
{
return m_theBaseISFParticle;
}
int TrackInformation::GetParticleBarcode() const
{
return ( m_theParticle ? HepMC::barcode(m_theParticle) : 0 );
}
void TrackInformation::SetParticle(HepMC::ConstGenParticlePtr p)
void TrackInformation::SetParticle(HepMC::GenParticlePtr p)
{
m_theParticle=p;
}
void TrackInformation::SetBaseISFParticle(const ISF::ISFParticle* p)
void TrackInformation::SetBaseISFParticle(ISF::ISFParticle* p)
{
m_theBaseISFParticle=p;
}
/*
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
*/
#include "MCTruth/VTrackInformation.h"
......@@ -8,40 +8,24 @@ VTrackInformation::VTrackInformation(TrackClassification tc):m_classify(tc)
{
}
HepMC::ConstGenParticlePtr VTrackInformation::GetPrimaryHepMCParticle() const
{
return m_thePrimaryParticle;
}
void VTrackInformation::SetPrimaryHepMCParticle(HepMC::ConstGenParticlePtr p)
void VTrackInformation::SetPrimaryHepMCParticle(HepMC::GenParticlePtr p)
{
m_thePrimaryParticle=p;
}
HepMC::ConstGenParticlePtr VTrackInformation::GetHepMCParticle() const
{
return 0;
}
const ISF::ISFParticle* VTrackInformation::GetBaseISFParticle() const
{
return 0;
}
bool VTrackInformation::GetReturnedToISF() const
{
return false;
}
void VTrackInformation::SetParticle(HepMC::ConstGenParticlePtr /*p*/)
void VTrackInformation::SetParticle(HepMC::GenParticlePtr /*p*/)
{
// you should not call this, perhaps throw an exception?
std::cerr<<"ERROR VTrackInformation::SetParticle() not supported "<<std::endl;
}
void VTrackInformation::SetBaseISFParticle(const ISF::ISFParticle* /*p*/)
void VTrackInformation::SetBaseISFParticle(ISF::ISFParticle* /*p*/)
{
// you should not call this, perhaps throw an exception?
std::cerr<<"ERROR VTrackInformation::SetBaseISFParticle() not supported "<<std::endl;
......
......@@ -43,17 +43,8 @@ namespace G4UA
// Condition for storing the GenParticle in the AtlasG4EventUserInfo for later.
if (trackHelper.IsPrimary() || trackHelper.IsRegisteredSecondary())
{
// Why a const_cast???
// This is an ugly way to communicate the GenParticle...
#ifdef HEPMC3
HepMC::GenParticlePtr part =
std::const_pointer_cast<HepMC3::GenParticle>( trackHelper.GetTrackInformation()->
GetHepMCParticle() );
#else
HepMC::GenParticlePtr part =
const_cast<HepMC::GenParticlePtr>( trackHelper.GetTrackInformation()->
GetHepMCParticle() );
#endif
HepMC::GenParticlePtr part = trackHelper.GetTrackInformation()->GetHepMCParticle();
// Assign the GenParticle to the AtlasG4EventUserInfo.
AtlasG4EventUserInfo* atlasG4EvtUserInfo = static_cast<AtlasG4EventUserInfo*>
(G4EventManager::GetEventManager()->GetConstCurrentEvent()->GetUserInformation());
......
......@@ -112,7 +112,7 @@ namespace ISF {
inline HepMC::GenParticlePtr getHepMCTruthParticle( ISF::ISFParticle& particle ) const;
/** convert ISFParticle to GenParticle and attach to ISFParticle's TruthBinding */
inline HepMC::GenParticlePtr updateHepMCTruthParticle( ISF::ISFParticle& particle, const ISF::ISFParticle* parent=nullptr ) const;
inline HepMC::GenParticlePtr updateHepMCTruthParticle( ISF::ISFParticle& particle, ISF::ISFParticle* parent=nullptr ) const;
ISF::ISFParticle& m_parent;
const ISFParticleVector& m_children;
......
......@@ -27,7 +27,7 @@ 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::ConstGenParticlePtr primaryTruthP, HepMC::ConstGenParticlePtr genZeroTruthP);
inline TruthBinding(HepMC::GenParticlePtr truthP, HepMC::GenParticlePtr primaryTruthP, HepMC::GenParticlePtr genZeroTruthP);
/** copy constructors */
inline TruthBinding(const TruthBinding &rhs) = default;
......@@ -51,16 +51,18 @@ namespace ISF {
inline void setTruthParticle(HepMC::GenParticlePtr p);
/** pointer to the primary particle in the simulation truth */
inline HepMC::GenParticlePtr getPrimaryTruthParticle();
inline HepMC::ConstGenParticlePtr getPrimaryTruthParticle() const;
/** pointer to the simulation truth particle before any regeneration happened (eg. brem) */
inline HepMC::GenParticlePtr getGenerationZeroTruthParticle();
inline HepMC::ConstGenParticlePtr getGenerationZeroTruthParticle() const;
inline void setGenerationZeroTruthParticle(HepMC::GenParticlePtr p);
private:
HepMC::GenParticlePtr m_truthParticle{}; //!< pointer to particle in MC truth
HepMC::ConstGenParticlePtr m_primaryTruthParticle{}; //!< pointer to corresponding primary (generator) particle
HepMC::ConstGenParticlePtr m_generationZeroTruthParticle{}; //!< pointer to corresponding truth particle before any regenration
HepMC::GenParticlePtr m_primaryTruthParticle{}; //!< pointer to corresponding primary (generator) particle
HepMC::GenParticlePtr m_generationZeroTruthParticle{}; //!< pointer to corresponding truth particle before any regenration
};
} // end of namespace
......
......@@ -12,7 +12,7 @@ namespace ISF {
m_generationZeroTruthParticle(allTruthP) { }
/** constructor setting all truth particle pointers individually */
TruthBinding::TruthBinding(HepMC::GenParticlePtr truthP, HepMC::ConstGenParticlePtr primaryTruthP, HepMC::ConstGenParticlePtr genZeroTruthP) :
TruthBinding::TruthBinding(HepMC::GenParticlePtr truthP, HepMC::GenParticlePtr primaryTruthP, HepMC::GenParticlePtr genZeroTruthP) :
m_truthParticle(truthP),
m_primaryTruthParticle(primaryTruthP),
m_generationZeroTruthParticle(genZeroTruthP) { }
......@@ -80,9 +80,11 @@ namespace ISF {
void TruthBinding::setTruthParticle(HepMC::GenParticlePtr p) { m_truthParticle = p; }
/** pointer to the primary particle in the simulation truth */
HepMC::GenParticlePtr TruthBinding::getPrimaryTruthParticle() { 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() { return m_generationZeroTruthParticle; }
HepMC::ConstGenParticlePtr TruthBinding::getGenerationZeroTruthParticle() const { return m_generationZeroTruthParticle; }
void TruthBinding::setGenerationZeroTruthParticle(HepMC::GenParticlePtr p) { m_generationZeroTruthParticle = p; }
......
......@@ -177,7 +177,7 @@ HepMC::GenParticlePtr ISF::ISFTruthIncident::getHepMCTruthParticle( ISF::ISFPart
/** convert ISFParticle to GenParticle and attach to ISFParticle's TruthBinding */
HepMC::GenParticlePtr ISF::ISFTruthIncident::updateHepMCTruthParticle( ISF::ISFParticle& particle,
const ISF::ISFParticle* parent ) const {
ISF::ISFParticle* parent ) const {
auto* truthBinding = particle.getTruthBinding();
HepMC::GenParticlePtr hepTruthParticle = ParticleHelper::convert( particle );
......
......@@ -516,7 +516,7 @@ double SetProperTimeFromDetectorFrameDecayLength(G4PrimaryParticle& g4particle,c
//________________________________________________________________________
#ifdef HEPMC3
G4PrimaryParticle* ISF::InputConverter::getG4PrimaryParticle(HepMC::ConstGenParticlePtr genpart) const{
G4PrimaryParticle* ISF::InputConverter::getG4PrimaryParticle(HepMC::GenParticlePtr genpart) const{
ATH_MSG_VERBOSE("Creating G4PrimaryParticle from GenParticle.");
const G4ParticleDefinition *particleDefinition = this->getG4ParticleDefinition(genpart->pdg_id());
......@@ -601,7 +601,7 @@ G4PrimaryParticle* ISF::InputConverter::getG4PrimaryParticle(HepMC::ConstGenPart
return g4particle.release();
}
#else
G4PrimaryParticle* ISF::InputConverter::getG4PrimaryParticle(const HepMC::GenParticle& genpart) const
G4PrimaryParticle* ISF::InputConverter::getG4PrimaryParticle(HepMC::GenParticle& genpart) const
{
ATH_MSG_VERBOSE("Creating G4PrimaryParticle from GenParticle.");
......@@ -703,7 +703,7 @@ G4PrimaryParticle* ISF::InputConverter::getG4PrimaryParticle(ISF::ISFParticle& i
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::ConstGenParticlePtr primaryGenpart = truthBinding->getPrimaryTruthParticle();
HepMC::GenParticlePtr primaryGenpart = truthBinding->getPrimaryTruthParticle();
const G4ParticleDefinition *particleDefinition = this->getG4ParticleDefinition(isp.pdgCode());
......
......@@ -80,9 +80,9 @@ namespace ISF {
const G4ParticleDefinition* getG4ParticleDefinition(int pdgcode) const;
#ifdef HEPMC3
G4PrimaryParticle* getG4PrimaryParticle(HepMC::ConstGenParticlePtr gp) const;
G4PrimaryParticle* getG4PrimaryParticle(HepMC::GenParticlePtr gp) const;
#else
G4PrimaryParticle* getG4PrimaryParticle(const HepMC::GenParticle& gp) const;
G4PrimaryParticle* getG4PrimaryParticle(HepMC::GenParticle& gp) const;
#endif
G4PrimaryParticle* getG4PrimaryParticle(ISF::ISFParticle& isp, bool useHepMC) const;
......
......@@ -47,9 +47,9 @@ class ISFG4Helper {
/** attach a new TrackInformation object to the given new (!) G4Track
* (the G4Track must not have a UserInformation object attached to it) */
static TrackInformation* attachTrackInfoToNewG4Track( G4Track& aTrack,
const ISF::ISFParticle& baseIsp,
ISF::ISFParticle& baseIsp,
TrackClassification classification,
HepMC::ConstGenParticlePtr nonRegeneratedTruthParticle = nullptr);
HepMC::GenParticlePtr nonRegeneratedTruthParticle = nullptr);
/** return pointer to current AtlasG4EventUserInfo */
static AtlasG4EventUserInfo* getAtlasG4EventUserInfo();
......
......@@ -77,9 +77,9 @@ iGeant4::ISFG4Helper::getISFTrackInfo(const G4Track& aTrack)
/** link the given G4Track to the given ISFParticle */
TrackInformation*
iGeant4::ISFG4Helper::attachTrackInfoToNewG4Track( G4Track& aTrack,
const ISF::ISFParticle& baseIsp,
ISF::ISFParticle& baseIsp,
TrackClassification classification,
HepMC::ConstGenParticlePtr nonRegeneratedTruthParticle)
HepMC::GenParticlePtr nonRegeneratedTruthParticle)
{
if ( aTrack.GetUserInformation() ) {
G4ExceptionDescription description;
......
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
*/
///////////////////////////////////////////////////////////////////
......@@ -89,7 +89,7 @@ void iGeant4::ISFTrajectory::AppendStep(const G4Step* aStep)
return; //The G4Exception call above should abort the job, but Coverity does not seem to pick this up.
}
ISF::ISFParticle* baseIsp = const_cast<ISF::ISFParticle*>( trackInfo->GetBaseISFParticle() );
ISF::ISFParticle* baseIsp = trackInfo->GetBaseISFParticle();
if (!baseIsp) {
G4ExceptionDescription description;
description << G4String("AppendStep: ") + "NULL ISFParticle pointer for current G4Step (trackID "
......
......@@ -239,11 +239,7 @@ namespace G4UA{
m_scIn = creation? creation->GetProcessSubType() : -1;
VTrackInformation * trackInfo= static_cast<VTrackInformation*>(track->GetUserInformation());
#ifdef HEPMC3
HepMC::GenParticlePtr genpart=trackInfo ? std::const_pointer_cast<HepMC3::GenParticle>(trackInfo->GetHepMCParticle()):nullptr;
#else
HepMC::GenParticlePtr genpart= trackInfo ? const_cast<HepMC::GenParticlePtr>(trackInfo->GetHepMCParticle()):0;
#endif
HepMC::GenParticlePtr genpart= trackInfo ? trackInfo->GetHepMCParticle() : nullptr;
HepMC::GenVertexPtr vtx = genpart ? genpart->production_vertex() : 0;
m_gen = genpart? 0 : -1;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment