ATLAS Offline Software
TrackRecord.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef TRACKRECORD_TRACKRECORD_H
6 #define TRACKRECORD_TRACKRECORD_H
7 
8 #include "CLHEP/Vector/ThreeVector.h"
11 
12 class TrackRecord {
13 public:
15  TrackRecord() = default;
16 
18  virtual ~TrackRecord() = default;
19 
22  int pdg,
23  int status,
24  double energy,
25  const CLHEP::Hep3Vector& momentum,
26  const CLHEP::Hep3Vector& postition,
27  double time,
28  int barcode,
29  int id,
30  const std::string& volumeName)
31  : m_pdgCode(pdg)
32  , m_status(status)
33  , m_energy(energy)
35  , m_position(postition)
36  , m_time(time)
38  , m_id(id)
39  , m_volName(volumeName)
40  {
42  m_partLink = std::make_unique<HepMcParticleLink>(m_barcode, 0, HepMcParticleLink::IS_POSITION, HepMcParticleLink::IS_BARCODE); // FIXME is barcode-based
43  }
44  }
45 
48  : m_pdgCode(trc.m_pdgCode)
49  , m_status(trc.m_status)
50  , m_energy(trc.m_energy)
51  , m_momentum(trc.m_momentum)
52  , m_position(trc.m_position)
53  , m_time(trc.m_time)
54  , m_barcode(trc.m_barcode)
55  , m_id(trc.m_id)
56  , m_volName(trc.m_volName){
58  m_id = trc.id(); // Try a look-up via HepMcParticleLink
59  }
60 }
61 
64  if (this != &trc) {
65  m_pdgCode = trc.m_pdgCode;
66  m_status = trc.m_status;
67  m_energy = trc.m_energy;
68  m_momentum = trc.m_momentum;
69  m_position = trc.m_position;
70  m_time = trc.m_time;
71  m_barcode = trc.m_barcode;
72  m_id = trc.m_id;
74  m_id = trc.id(); // Try a look-up via HepMcParticleLink
75  }
76  m_volName = trc.m_volName;
77  }
78  return *this;
79  }
80 
82  double GetEnergy() const {return m_energy;}
83 
85  void SetEnergy(double e) {m_energy = e;}
86 
88  CLHEP::Hep3Vector GetPosition() const {return m_position;}
89 
91  void SetPosition(CLHEP::Hep3Vector p) {m_position = p;}
92 
94  CLHEP::Hep3Vector GetMomentum() const {return m_momentum;}
95 
97  void SetMomentum(CLHEP::Hep3Vector e) {m_momentum = e;}
98 
100  int GetPDGCode() const {return m_pdgCode;}
101 
103  void SetPDGCode(int pcode) {m_pdgCode = pcode;}
104 
106  double GetTime() const {return m_time;}
107 
109  void SetTime(double time) {m_time = time;}
110 
112  const std::string& GetVolName() const {return m_volName;}
113 
115  void SetVolName(const std::string& theName){m_volName = theName;}
116 
118  int status() const {return m_status;}
119 
122 
124  int id() const {if (m_id == HepMC::INVALID_PARTICLE_ID && m_partLink) { return m_partLink->id(); } else { return m_id; } }
125 
127  void SetID(int uniqueID){
128  m_id = uniqueID;
130  m_partLink = std::make_unique<HepMcParticleLink>(m_barcode, 0, HepMcParticleLink::IS_POSITION, HepMcParticleLink::IS_BARCODE); // FIXME is barcode-based
131  }
132  }
133 
135  int barcode() const {return m_barcode;}
136 
138  void SetBarcode(int barcode){
139  m_barcode = barcode;
141  m_partLink = std::make_unique<HepMcParticleLink>(m_barcode, 0, HepMcParticleLink::IS_POSITION, HepMcParticleLink::IS_BARCODE); // FIXME is barcode-based
142  }
143  }
144 
145 private:
146  int m_pdgCode{0};
147  int m_status{0};
148  double m_energy{0};
149  CLHEP::Hep3Vector m_momentum{0,0,0};
150  CLHEP::Hep3Vector m_position{0,0,0};
151  double m_time{0.};
154  std::string m_volName{""};
155  std::unique_ptr<HepMcParticleLink> m_partLink{}; // nullptr unless object was produced by reading TrackRecord_p1.
156 };
157 
158 #endif // TRACKRECORD_TRACKRECORD_H
TrackRecord::SetID
void SetID(int uniqueID)
Set uniqueID.
Definition: TrackRecord.h:127
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
TrackRecord::m_time
double m_time
Definition: TrackRecord.h:151
TrackRecord::TrackRecord
TrackRecord(const TrackRecord &trc)
Constructor.
Definition: TrackRecord.h:47
TrackRecord::id
int id() const
unique ID - fall back to HepMcParticeLink if m_id has not been set directly
Definition: TrackRecord.h:124
HepMC::INVALID_PARTICLE_ID
constexpr int INVALID_PARTICLE_ID
Definition: MagicNumbers.h:57
TrackRecord::m_position
CLHEP::Hep3Vector m_position
Definition: TrackRecord.h:150
TrackRecord::operator=
TrackRecord & operator=(const TrackRecord &trc)
Assignement Operator.
Definition: TrackRecord.h:63
TrackRecord::status
int status() const
status.
Definition: TrackRecord.h:118
TrackRecord::m_barcode
int m_barcode
Definition: TrackRecord.h:152
TrackRecord::SetPDGCode
void SetPDGCode(int pcode)
Set PDG code.
Definition: TrackRecord.h:103
TrackRecord::m_partLink
std::unique_ptr< HepMcParticleLink > m_partLink
Definition: TrackRecord.h:155
TrackRecord::SetVolName
void SetVolName(const std::string &theName)
Set Volume name.
Definition: TrackRecord.h:115
TrackRecord::~TrackRecord
virtual ~TrackRecord()=default
Default destructor.
TrackRecord::m_status
int m_status
Definition: TrackRecord.h:147
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
TrackRecord::GetTime
double GetTime() const
Time.
Definition: TrackRecord.h:106
ParticleGun_FastCalo_ChargeFlip_Config.energy
energy
Definition: ParticleGun_FastCalo_ChargeFlip_Config.py:78
ParticleGun_EoverP_Config.momentum
momentum
Definition: ParticleGun_EoverP_Config.py:63
TrackRecord::m_momentum
CLHEP::Hep3Vector m_momentum
Definition: TrackRecord.h:149
TrackRecord::GetPosition
CLHEP::Hep3Vector GetPosition() const
Position.
Definition: TrackRecord.h:88
TrackRecord::SetTime
void SetTime(double time)
Set time.
Definition: TrackRecord.h:109
HepMC::uniqueID
int uniqueID(const T &p)
Definition: MagicNumbers.h:116
TrackRecord::SetPosition
void SetPosition(CLHEP::Hep3Vector p)
Set position.
Definition: TrackRecord.h:91
TrackRecord::SetBarcode
void SetBarcode(int barcode)
Set barcode.
Definition: TrackRecord.h:138
TrackRecord::m_volName
std::string m_volName
Definition: TrackRecord.h:154
HepMC::UNDEFINED_ID
constexpr int UNDEFINED_ID
Definition: MagicNumbers.h:56
TrackRecord::TrackRecord
TrackRecord()=default
Default constructor.
TrackRecord::SetMomentum
void SetMomentum(CLHEP::Hep3Vector e)
Set momentum.
Definition: TrackRecord.h:97
MagicNumbers.h
TrackRecord::GetEnergy
double GetEnergy() const
Energy.
Definition: TrackRecord.h:82
TrackRecord::GetMomentum
CLHEP::Hep3Vector GetMomentum() const
Momentum.
Definition: TrackRecord.h:94
TrackRecord::m_id
int m_id
Definition: TrackRecord.h:153
TrackRecord
Definition: TrackRecord.h:12
TrackRecord::TrackRecord
TrackRecord(int pdg, int status, double energy, const CLHEP::Hep3Vector &momentum, const CLHEP::Hep3Vector &postition, double time, int barcode, int id, const std::string &volumeName)
Constructor.
Definition: TrackRecord.h:21
TrackRecord::SetStatus
void SetStatus(int status)
Set status.
Definition: TrackRecord.h:121
TrackRecord::GetVolName
const std::string & GetVolName() const
Volume name.
Definition: TrackRecord.h:112
TrackRecord::barcode
int barcode() const
bar code.
Definition: TrackRecord.h:135
CaloSwCorrections.time
def time(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:242
TrackRecord::m_energy
double m_energy
Definition: TrackRecord.h:148
TrackRecord::SetEnergy
void SetEnergy(double e)
Set energy.
Definition: TrackRecord.h:85
TrackRecord::GetPDGCode
int GetPDGCode() const
PDG Code.
Definition: TrackRecord.h:100
TrackRecord::m_pdgCode
int m_pdgCode
Definition: TrackRecord.h:146