Geant4Particle.cc
Go to the documentation of this file.
1 // AUTOMATICALLY GENERATED FILE - DO NOT EDIT
2 
3 // datamodel specific includes
9 
10 
11 #include <ostream>
12 
13 namespace dd4pod {
14 
15 
17  m_obj->acquire();
18 }
19 
20 Geant4Particle::Geant4Particle(int ID, int g4Parent, int reason, int mask, int steps, int secondaries, int pdgID, int status, std::array<int, 2> colorFlow, int genStatus, int charge, std::array<int, 1> spare, std::array<float, 3> spin, double vsx, double vsy, double vsz, double vex, double vey, double vez, double psx, double psy, double psz, double pex, double pey, double pez, double mass, double time, double properTime) : m_obj(new Geant4ParticleObj()) {
21  m_obj->acquire();
22  m_obj->data.ID = ID;
23  m_obj->data.g4Parent = g4Parent;
24  m_obj->data.reason = reason;
25  m_obj->data.mask = mask;
26  m_obj->data.steps = steps;
27  m_obj->data.secondaries = secondaries;
28  m_obj->data.pdgID = pdgID;
29  m_obj->data.status = status;
30  m_obj->data.colorFlow = colorFlow;
31  m_obj->data.genStatus = genStatus;
32  m_obj->data.charge = charge;
33  m_obj->data.spare = spare;
34  m_obj->data.spin = spin;
35  m_obj->data.vsx = vsx;
36  m_obj->data.vsy = vsy;
37  m_obj->data.vsz = vsz;
38  m_obj->data.vex = vex;
39  m_obj->data.vey = vey;
40  m_obj->data.vez = vez;
41  m_obj->data.psx = psx;
42  m_obj->data.psy = psy;
43  m_obj->data.psz = psz;
44  m_obj->data.pex = pex;
45  m_obj->data.pey = pey;
46  m_obj->data.pez = pez;
47  m_obj->data.mass = mass;
48  m_obj->data.time = time;
49  m_obj->data.properTime = properTime;
50 }
51 
52 Geant4Particle::Geant4Particle(const Geant4Particle& other) : m_obj(other.m_obj) {
53  m_obj->acquire();
54 }
55 
57  if (m_obj) m_obj->release();
58  m_obj = other.m_obj;
59  return *this;
60 }
61 
63  if (m_obj) m_obj->acquire();
64 }
65 
67  return {new Geant4ParticleObj(*m_obj)};
68 }
69 
71  if (m_obj) m_obj->release();
72 }
73 Geant4Particle::operator ConstGeant4Particle() const { return ConstGeant4Particle(m_obj); }
74 
75 const int& Geant4Particle::ID() const { return m_obj->data.ID; }
76 const int& Geant4Particle::g4Parent() const { return m_obj->data.g4Parent; }
77 const int& Geant4Particle::reason() const { return m_obj->data.reason; }
78 const int& Geant4Particle::mask() const { return m_obj->data.mask; }
79 const int& Geant4Particle::steps() const { return m_obj->data.steps; }
80 const int& Geant4Particle::secondaries() const { return m_obj->data.secondaries; }
81 const int& Geant4Particle::pdgID() const { return m_obj->data.pdgID; }
82 const int& Geant4Particle::status() const { return m_obj->data.status; }
83 const std::array<int, 2>& Geant4Particle::colorFlow() const { return m_obj->data.colorFlow; }
84 const int& Geant4Particle::colorFlow(size_t i) const { return m_obj->data.colorFlow.at(i); }
85 const int& Geant4Particle::genStatus() const { return m_obj->data.genStatus; }
86 const int& Geant4Particle::charge() const { return m_obj->data.charge; }
87 const std::array<int, 1>& Geant4Particle::spare() const { return m_obj->data.spare; }
88 const int& Geant4Particle::spare(size_t i) const { return m_obj->data.spare.at(i); }
89 const std::array<float, 3>& Geant4Particle::spin() const { return m_obj->data.spin; }
90 const float& Geant4Particle::spin(size_t i) const { return m_obj->data.spin.at(i); }
91 const double& Geant4Particle::vsx() const { return m_obj->data.vsx; }
92 const double& Geant4Particle::vsy() const { return m_obj->data.vsy; }
93 const double& Geant4Particle::vsz() const { return m_obj->data.vsz; }
94 const double& Geant4Particle::vex() const { return m_obj->data.vex; }
95 const double& Geant4Particle::vey() const { return m_obj->data.vey; }
96 const double& Geant4Particle::vez() const { return m_obj->data.vez; }
97 const double& Geant4Particle::psx() const { return m_obj->data.psx; }
98 const double& Geant4Particle::psy() const { return m_obj->data.psy; }
99 const double& Geant4Particle::psz() const { return m_obj->data.psz; }
100 const double& Geant4Particle::pex() const { return m_obj->data.pex; }
101 const double& Geant4Particle::pey() const { return m_obj->data.pey; }
102 const double& Geant4Particle::pez() const { return m_obj->data.pez; }
103 const double& Geant4Particle::mass() const { return m_obj->data.mass; }
104 const double& Geant4Particle::time() const { return m_obj->data.time; }
105 const double& Geant4Particle::properTime() const { return m_obj->data.properTime; }
106 
107 
108 void Geant4Particle::ID(int value) { m_obj->data.ID = value; }
111 void Geant4Particle::mask(int value) { m_obj->data.mask = value; }
112 void Geant4Particle::steps(int value) { m_obj->data.steps = value; }
114 void Geant4Particle::pdgID(int value) { m_obj->data.pdgID = value; }
116 void Geant4Particle::colorFlow(std::array<int, 2> value) { m_obj->data.colorFlow = value; }
117 void Geant4Particle::colorFlow(size_t i, int value) { m_obj->data.colorFlow.at(i) = value; }
118 std::array<int, 2>& Geant4Particle::colorFlow() { return m_obj->data.colorFlow; }
121 void Geant4Particle::spare(std::array<int, 1> value) { m_obj->data.spare = value; }
122 void Geant4Particle::spare(size_t i, int value) { m_obj->data.spare.at(i) = value; }
123 std::array<int, 1>& Geant4Particle::spare() { return m_obj->data.spare; }
124 void Geant4Particle::spin(std::array<float, 3> value) { m_obj->data.spin = value; }
125 void Geant4Particle::spin(size_t i, float value) { m_obj->data.spin.at(i) = value; }
126 std::array<float, 3>& Geant4Particle::spin() { return m_obj->data.spin; }
127 void Geant4Particle::vsx(double value) { m_obj->data.vsx = value; }
128 void Geant4Particle::vsy(double value) { m_obj->data.vsy = value; }
129 void Geant4Particle::vsz(double value) { m_obj->data.vsz = value; }
130 void Geant4Particle::vex(double value) { m_obj->data.vex = value; }
131 void Geant4Particle::vey(double value) { m_obj->data.vey = value; }
132 void Geant4Particle::vez(double value) { m_obj->data.vez = value; }
133 void Geant4Particle::psx(double value) { m_obj->data.psx = value; }
134 void Geant4Particle::psy(double value) { m_obj->data.psy = value; }
135 void Geant4Particle::psz(double value) { m_obj->data.psz = value; }
136 void Geant4Particle::pex(double value) { m_obj->data.pex = value; }
137 void Geant4Particle::pey(double value) { m_obj->data.pey = value; }
138 void Geant4Particle::pez(double value) { m_obj->data.pez = value; }
139 void Geant4Particle::mass(double value) { m_obj->data.mass = value; }
140 void Geant4Particle::time(double value) { m_obj->data.time = value; }
142 
143 
144 void Geant4Particle::addparents(int component) {
145  m_obj->m_parents->push_back(component);
146  m_obj->data.parents_end++;
147 }
148 
149 std::vector<int>::const_iterator Geant4Particle::parents_begin() const {
150  auto ret_value = m_obj->m_parents->begin();
151  std::advance(ret_value, m_obj->data.parents_begin);
152  return ret_value;
153 }
154 
155 std::vector<int>::const_iterator Geant4Particle::parents_end() const {
156  auto ret_value = m_obj->m_parents->begin();
157  std::advance(ret_value, m_obj->data.parents_end);
158  return ret_value;
159 }
160 
161 unsigned int Geant4Particle::parents_size() const {
162  return m_obj->data.parents_end - m_obj->data.parents_begin;
163 }
164 
165 int Geant4Particle::parents(unsigned int index) const {
166  if (parents_size() > index) {
167  return m_obj->m_parents->at(m_obj->data.parents_begin + index);
168  }
169  throw std::out_of_range("index out of bounds for existing references");
170 }
171 
172 podio::RelationRange<int> Geant4Particle::parents() const {
173  auto begin = m_obj->m_parents->begin();
174  std::advance(begin, m_obj->data.parents_begin);
175  auto end = m_obj->m_parents->begin();
176  std::advance(end, m_obj->data.parents_end);
177  return {begin, end};
178 }
179 
180 void Geant4Particle::adddaughters(int component) {
181  m_obj->m_daughters->push_back(component);
182  m_obj->data.daughters_end++;
183 }
184 
185 std::vector<int>::const_iterator Geant4Particle::daughters_begin() const {
186  auto ret_value = m_obj->m_daughters->begin();
187  std::advance(ret_value, m_obj->data.daughters_begin);
188  return ret_value;
189 }
190 
191 std::vector<int>::const_iterator Geant4Particle::daughters_end() const {
192  auto ret_value = m_obj->m_daughters->begin();
193  std::advance(ret_value, m_obj->data.daughters_end);
194  return ret_value;
195 }
196 
197 unsigned int Geant4Particle::daughters_size() const {
198  return m_obj->data.daughters_end - m_obj->data.daughters_begin;
199 }
200 
201 int Geant4Particle::daughters(unsigned int index) const {
202  if (daughters_size() > index) {
203  return m_obj->m_daughters->at(m_obj->data.daughters_begin + index);
204  }
205  throw std::out_of_range("index out of bounds for existing references");
206 }
207 
208 podio::RelationRange<int> Geant4Particle::daughters() const {
209  auto begin = m_obj->m_daughters->begin();
210  std::advance(begin, m_obj->data.daughters_begin);
211  auto end = m_obj->m_daughters->begin();
212  std::advance(end, m_obj->data.daughters_end);
213  return {begin, end};
214 }
215 
216 
217 
218 
219 
220 
222  if (m_obj) {
223  return true;
224  }
225  return false;
226 }
227 
228 const podio::ObjectID Geant4Particle::getObjectID() const {
229  if (m_obj) {
230  return m_obj->id;
231  }
232  return podio::ObjectID{podio::ObjectID::invalid, podio::ObjectID::invalid};
233 }
234 
236  return m_obj == other.m_obj;
237 }
238 
239 std::ostream& operator<<(std::ostream& o, const ConstGeant4Particle& value) {
240  o << " id: " << value.id() << '\n';
241  o << " ID : " << value.ID() << '\n';
242  o << " g4Parent : " << value.g4Parent() << '\n';
243  o << " reason : " << value.reason() << '\n';
244  o << " mask : " << value.mask() << '\n';
245  o << " steps : " << value.steps() << '\n';
246  o << " secondaries : " << value.secondaries() << '\n';
247  o << " pdgID : " << value.pdgID() << '\n';
248  o << " status : " << value.status() << '\n';
249  o << " colorFlow : ";
250  for (size_t i = 0; i < 2; ++i) {
251  o << value.colorFlow()[i] << "|";
252  }
253  o << '\n';
254  o << " genStatus : " << value.genStatus() << '\n';
255  o << " charge : " << value.charge() << '\n';
256  o << " spare : ";
257  for (size_t i = 0; i < 1; ++i) {
258  o << value.spare()[i] << "|";
259  }
260  o << '\n';
261  o << " spin : ";
262  for (size_t i = 0; i < 3; ++i) {
263  o << value.spin()[i] << "|";
264  }
265  o << '\n';
266  o << " vsx : " << value.vsx() << '\n';
267  o << " vsy : " << value.vsy() << '\n';
268  o << " vsz : " << value.vsz() << '\n';
269  o << " vex : " << value.vex() << '\n';
270  o << " vey : " << value.vey() << '\n';
271  o << " vez : " << value.vez() << '\n';
272  o << " psx : " << value.psx() << '\n';
273  o << " psy : " << value.psy() << '\n';
274  o << " psz : " << value.psz() << '\n';
275  o << " pex : " << value.pex() << '\n';
276  o << " pey : " << value.pey() << '\n';
277  o << " pez : " << value.pez() << '\n';
278  o << " mass : " << value.mass() << '\n';
279  o << " time : " << value.time() << '\n';
280  o << " properTime : " << value.properTime() << '\n';
281 
282 
283  o << " parents : ";
284  for (unsigned i = 0; i < value.parents_size(); ++i) {
285  o << value.parents(i) << " ";
286  }
287  o << '\n';
288  o << " daughters : ";
289  for (unsigned i = 0; i < value.daughters_size(); ++i) {
290  o << value.daughters(i) << " ";
291  }
292  o << '\n';
293 
294  return o;
295 }
296 
297 } // namespace dd4pod
298 
unsigned int daughters_size() const
const double & vex() const
Access the endpoint x.
Geant4Particle & operator=(const Geant4Particle &other)
copy-assignment operator
podio::RelationRange< int > daughters() const
parameter value(const doc_string &label, Targets &&... tgts)
makes required, blocking, repeatable value parameter; matches any non-empty string
Definition: clipp.h:2094
const int & steps() const
Access the x.
const int & genStatus() const
Access the x.
const std::array< int, 2 > & colorFlow() const
Access the x.
const double & pey() const
Access the endpoint x.
const double & vez() const
Access the endpoint x.
const int & reason() const
Access the x.
const podio::ObjectID getObjectID() const
bool operator==(const Geant4Particle &other) const
const int & g4Parent() const
Access the x.
const int & charge() const
Access the x.
const double & mass() const
Access the x.
std::array< int, 2 > colorFlow
x
podio::RelationRange< int > parents() const
const double & psy() const
Access the startpoint py.
const double & psx() const
Access the startpoint x.
const double & vey() const
Access the endpoint x.
Geant4Particle()
default constructor
const double & properTime() const
Access the x.
const int & secondaries() const
Access the x.
const double & vsy() const
Access the startpoint x.
Geant4Particle clone() const
support cloning (deep-copy)
const double & vsz() const
Access the startpoint x.
std::vector< int >::const_iterator daughters_end() const
const int & pdgID() const
Access the x.
const std::array< float, 3 > & spin() const
Access the x.
const int & mask() const
Access the x.
std::vector< int > * m_parents
std::vector< int >::const_iterator parents_end() const
const std::array< int, 1 > & spare() const
Access the x.
bool isAvailable() const
check whether the object is actually available
const double & psz() const
Access the startpoint pz.
std::vector< int >::const_iterator parents_begin() const
std::ostream & operator<<(std::ostream &o, const ConstCalorimeterHit &value)
const double & time() const
Access the x.
const double & pex() const
Access the endpoint x.
const int & ID() const
Access the x.
std::array< int, 1 > spare
x
std::array< float, 3 > spin
x
const double & vsx() const
Access the startpoint x.
std::vector< int > * m_daughters
const int & status() const
Access the x.
std::vector< int >::const_iterator daughters_begin() const
unsigned int parents_size() const
const double & pez() const
Access the endpoint pz.