TrackerHit.cc
Go to the documentation of this file.
1 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
2 
3 // datamodel specific includes
4 #include "dd4pod/TrackerHit.h"
6 #include "dd4pod/TrackerHitObj.h"
9 
10 
11 #include <ostream>
12 
13 namespace dd4pod {
14 
15 
17  m_obj->acquire();
18 }
19 
20 TrackerHit::TrackerHit(long long cellID, long flag, long g4ID, dd4pod::FourVector position, dd4pod::FourVector momentum, double length, dd4pod::MonteCarloContrib truth, double energyDeposit) : m_obj(new TrackerHitObj()) {
21  m_obj->acquire();
22  m_obj->data.cellID = cellID;
23  m_obj->data.flag = flag;
24  m_obj->data.g4ID = g4ID;
25  m_obj->data.position = position;
26  m_obj->data.momentum = momentum;
27  m_obj->data.length = length;
28  m_obj->data.truth = truth;
30 }
31 
32 TrackerHit::TrackerHit(const TrackerHit& other) : m_obj(other.m_obj) {
33  m_obj->acquire();
34 }
35 
37  if (m_obj) m_obj->release();
38  m_obj = other.m_obj;
39  return *this;
40 }
41 
43  if (m_obj) m_obj->acquire();
44 }
45 
47  return {new TrackerHitObj(*m_obj)};
48 }
49 
51  if (m_obj) m_obj->release();
52 }
53 TrackerHit::operator ConstTrackerHit() const { return ConstTrackerHit(m_obj); }
54 
55 const long long& TrackerHit::cellID() const { return m_obj->data.cellID; }
56 const long& TrackerHit::flag() const { return m_obj->data.flag; }
57 const long& TrackerHit::g4ID() const { return m_obj->data.g4ID; }
58 const dd4pod::FourVector& TrackerHit::position() const { return m_obj->data.position; }
59 const dd4pod::FourVector& TrackerHit::momentum() const { return m_obj->data.momentum; }
60 const double& TrackerHit::length() const { return m_obj->data.length; }
61 const dd4pod::MonteCarloContrib& TrackerHit::truth() const { return m_obj->data.truth; }
62 const double& TrackerHit::energyDeposit() const { return m_obj->data.energyDeposit; }
63 
64 
65 void TrackerHit::cellID(long long value) { m_obj->data.cellID = value; }
66 void TrackerHit::flag(long value) { m_obj->data.flag = value; }
67 void TrackerHit::g4ID(long value) { m_obj->data.g4ID = value; }
72 void TrackerHit::length(double value) { m_obj->data.length = value; }
76 
77 
78 
79 
80 
81 
82 
84  if (m_obj) {
85  return true;
86  }
87  return false;
88 }
89 
90 const podio::ObjectID TrackerHit::getObjectID() const {
91  if (m_obj) {
92  return m_obj->id;
93  }
94  return podio::ObjectID{podio::ObjectID::invalid, podio::ObjectID::invalid};
95 }
96 
97 bool TrackerHit::operator==(const ConstTrackerHit& other) const {
98  return m_obj == other.m_obj;
99 }
100 
101 std::ostream& operator<<(std::ostream& o, const ConstTrackerHit& value) {
102  o << " id: " << value.id() << '\n';
103  o << " cellID : " << value.cellID() << '\n';
104  o << " flag : " << value.flag() << '\n';
105  o << " g4ID : " << value.g4ID() << '\n';
106  o << " position : " << value.position() << '\n';
107  o << " momentum : " << value.momentum() << '\n';
108  o << " length : " << value.length() << '\n';
109  o << " truth : " << value.truth() << '\n';
110  o << " energyDeposit : " << value.energyDeposit() << '\n';
111 
112 
113 
114  return o;
115 }
116 
117 } // namespace dd4pod
118 
parameter value(const doc_string &label, Targets &&... tgts)
makes required, blocking, repeatable value parameter; matches any non-empty string
Definition: clipp.h:2094
const long & g4ID() const
Access the Original Geant4 track identifier of the creating track (debugging)
Definition: TrackerHit.cc:57
const dd4pod::FourVector & momentum() const
Access the momentum.
Definition: TrackerHit.cc:59
bool operator==(const TrackerHit &other) const
Definition: TrackerHit.h:125
~TrackerHit()
destructor
Definition: TrackerHit.cc:50
TrackerHit clone() const
support cloning (deep-copy)
Definition: TrackerHit.cc:46
long g4ID
Original Geant4 track identifier of the creating track (debugging)
double energyDeposit
energyDeposit
const double & length() const
Access the length.
Definition: TrackerHit.cc:60
const long long & cellID() const
Access the cellID.
Definition: TrackerHit.cc:55
bool isAvailable() const
check whether the object is actually available
Definition: TrackerHit.cc:83
TrackerHit & operator=(const TrackerHit &other)
copy-assignment operator
Definition: TrackerHit.cc:36
::dd4pod::FourVector momentum
momentum
const double & energyDeposit() const
Access the energyDeposit.
Definition: TrackerHit.cc:62
::dd4pod::FourVector position
position
long long cellID
cellID
const dd4pod::MonteCarloContrib & truth() const
Access the truth.
Definition: TrackerHit.cc:61
const podio::ObjectID getObjectID() const
Definition: TrackerHit.cc:90
TrackerHitData data
Definition: TrackerHitObj.h:30
std::ostream & operator<<(std::ostream &o, const ConstCalorimeterHit &value)
const long & flag() const
Access the User flag to classify hits.
Definition: TrackerHit.cc:56
const dd4pod::FourVector & position() const
Access the position.
Definition: TrackerHit.cc:58
::dd4pod::MonteCarloContrib truth
truth
TrackerHit()
default constructor
Definition: TrackerHit.cc:16
long flag
User flag to classify hits.