ATLAS Offline Software
Loading...
Searching...
No Matches
TrackHelper Class Reference

#include <TrackHelper.h>

Collaboration diagram for TrackHelper:

Public Member Functions

 TrackHelper (const G4Track *t)
bool IsPrimary () const
bool IsRegeneratedPrimary () const
bool IsRegisteredSecondary () const
bool IsSecondary () const
int GetBarcode () const
 Return the truth barcode/id/status used for detector output.
int GetUniqueID () const
int GetStatus () const
HepMC::GenParticlePtr GetPrimaryGenParticle ()
 Return the primary truth particle associated with this track.
HepMC::ConstGenParticlePtr GetPrimaryGenParticle () const
TrackInformationGetTrackInformation ()
 Return concrete TrackInformation when callers need fields that are not part of the VTrackInformation interface.
HepMcParticleLink GenerateParticleLink ()
 Generates a new HepMcParticleLink object on the stack based on the generation-zero unique id, assuming that the link should point at the first GenEvent in the McEventCollection.
HepMcParticleLink GenerateParticleLink (IProxyDict *)

Private Member Functions

std::tuple< int, HepMcParticleLink::UniqueIDFlagparticleIdentifierAndFlag () const

Private Attributes

VTrackInformationm_trackInfo {}

Detailed Description

Definition at line 20 of file TrackHelper.h.

Constructor & Destructor Documentation

◆ TrackHelper()

TrackHelper::TrackHelper ( const G4Track * t)

Definition at line 27 of file TrackHelper.cxx.

28{
29 G4VUserTrackInformation* userInfo = t ? t->GetUserInformation() : nullptr;
30 m_trackInfo = dynamic_cast<VTrackInformation*>(userInfo);
31}
VTrackInformation * m_trackInfo
Definition TrackHelper.h:66

Member Function Documentation

◆ GenerateParticleLink() [1/2]

HepMcParticleLink TrackHelper::GenerateParticleLink ( )
inline

Generates a new HepMcParticleLink object on the stack based on the generation-zero unique id, assuming that the link should point at the first GenEvent in the McEventCollection.

Definition at line 75 of file TrackHelper.h.

76{
78 return HepMcParticleLink(identifier,
79 0,
81 flag);
82}
std::tuple< int, HepMcParticleLink::UniqueIDFlag > particleIdentifierAndFlag() const
Definition TrackHelper.h:70
bool flag
Definition master.py:29

◆ GenerateParticleLink() [2/2]

HepMcParticleLink TrackHelper::GenerateParticleLink ( IProxyDict * proxy)
inline

Definition at line 84 of file TrackHelper.h.

85{
87 if(!proxy) {
88 return GenerateParticleLink();
89 }
90 return HepMcParticleLink(identifier,
91 0,
93 flag,
94 proxy);
95}
HepMcParticleLink GenerateParticleLink()
Generates a new HepMcParticleLink object on the stack based on the generation-zero unique id,...
Definition TrackHelper.h:75

◆ GetBarcode()

int TrackHelper::GetBarcode ( ) const

Return the truth barcode/id/status used for detector output.

TrackInformation can keep both the generation-zero particle and the current regenerated particle. Detector hit links and track records use the generation-zero particle to preserve legacy output attribution, falling back to the current particle for older TrackInformation objects. Barcode-only track info keeps using its stored barcode/id/status values.

Definition at line 57 of file TrackHelper.cxx.

58{
59 if (const TrackInformation* concreteInfo = dynamic_cast<const TrackInformation*>(m_trackInfo)) {
60 HepMC::ConstGenParticlePtr particle = outputAttributionParticle(concreteInfo);
61 return particle ? HepMC::barcode(particle) : 0;
62 }
63 return m_trackInfo ? m_trackInfo->GetParticleBarcode() : 0;
64}
int barcode(const T *p)
Definition Barcode.h:15
HepMC3::ConstGenParticlePtr ConstGenParticlePtr
Definition GenParticle.h:20
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses

◆ GetPrimaryGenParticle() [1/2]

HepMC::GenParticlePtr TrackHelper::GetPrimaryGenParticle ( )

Return the primary truth particle associated with this track.

This is the primary-ancestor attribution stored on VTrackInformation. It may differ from the generation-zero/current particle used by the output-link helpers above, and is null when no track information or no primary attribution is attached.

Definition at line 84 of file TrackHelper.cxx.

85{
86 return m_trackInfo ? m_trackInfo->GetPrimaryGenParticle() : nullptr;
87}

◆ GetPrimaryGenParticle() [2/2]

HepMC::ConstGenParticlePtr TrackHelper::GetPrimaryGenParticle ( ) const

Definition at line 89 of file TrackHelper.cxx.

90{
91 return m_trackInfo ? std::as_const(m_trackInfo)->GetPrimaryGenParticle() : nullptr;
92}

◆ GetStatus()

int TrackHelper::GetStatus ( ) const

Definition at line 75 of file TrackHelper.cxx.

76{
77 if (const TrackInformation* concreteInfo = dynamic_cast<const TrackInformation*>(m_trackInfo)) {
78 HepMC::ConstGenParticlePtr particle = outputAttributionParticle(concreteInfo);
79 return particle ? particle->status() : 0;
80 }
81 return m_trackInfo ? m_trackInfo->GetParticleStatus() : 0;
82}

◆ GetTrackInformation()

TrackInformation * TrackHelper::GetTrackInformation ( )

Return concrete TrackInformation when callers need fields that are not part of the VTrackInformation interface.

Definition at line 33 of file TrackHelper.cxx.

34{
35 return dynamic_cast<TrackInformation*>(m_trackInfo);
36}

◆ GetUniqueID()

int TrackHelper::GetUniqueID ( ) const

Definition at line 66 of file TrackHelper.cxx.

67{
68 if (const TrackInformation* concreteInfo = dynamic_cast<const TrackInformation*>(m_trackInfo)) {
69 HepMC::ConstGenParticlePtr particle = outputAttributionParticle(concreteInfo);
70 return particle ? HepMC::uniqueID(particle) : 0;
71 }
72 return m_trackInfo ? m_trackInfo->GetParticleUniqueID() : 0;
73}
int uniqueID(const T &p)

◆ IsPrimary()

bool TrackHelper::IsPrimary ( ) const

Definition at line 37 of file TrackHelper.cxx.

38{
39 if (m_trackInfo==0) return false;
40 return m_trackInfo->GetClassification()==VTrackInformation::Primary;
41}

◆ IsRegeneratedPrimary()

bool TrackHelper::IsRegeneratedPrimary ( ) const

Definition at line 42 of file TrackHelper.cxx.

43{
44 if (m_trackInfo==0) return false;
45 return m_trackInfo->GetClassification()==VTrackInformation::RegeneratedPrimary;
46}

◆ IsRegisteredSecondary()

bool TrackHelper::IsRegisteredSecondary ( ) const

Definition at line 47 of file TrackHelper.cxx.

48{
49 if (m_trackInfo==0) return false;
50 return m_trackInfo->GetClassification()==VTrackInformation::RegisteredSecondary;
51}

◆ IsSecondary()

bool TrackHelper::IsSecondary ( ) const

Definition at line 52 of file TrackHelper.cxx.

53{
54 if (m_trackInfo==0) return true;
55 return m_trackInfo->GetClassification()==VTrackInformation::Secondary;
56}

◆ particleIdentifierAndFlag()

std::tuple< int, HepMcParticleLink::UniqueIDFlag > TrackHelper::particleIdentifierAndFlag ( ) const
inlineprivate

Definition at line 70 of file TrackHelper.h.

Member Data Documentation

◆ m_trackInfo

VTrackInformation* TrackHelper::m_trackInfo {}
private

Definition at line 66 of file TrackHelper.h.

66{};

The documentation for this class was generated from the following files: