ATLAS Offline Software
MagicNumbers.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 /* Author: Andrii Verbytskyi andrii.verbytskyi@mpp.mpg.de */
5 
6 #ifndef TRUTHUTILS_MAGICNUMBERS_H
7 #define TRUTHUTILS_MAGICNUMBERS_H
8 
9 #include <limits>
10 #include <cstdint>
11 #include <memory>
12 #include <deque>
13 #include <type_traits>
14 #if !defined(XAOD_STANDALONE)
15 #include "AtlasHepMC/GenEvent.h"
16 #include "AtlasHepMC/GenParticle.h"
17 #include "AtlasHepMC/GenVertex.h"
18 #endif
19 namespace xAOD {
20  // Temporarily specialize for xAOD::Truth classes ahead of the barcode migration - TODO remove this
21  class TruthParticle_v1;
22  class TruthVertex_v1;
23 }
24 class TrackRecord;
25 class HepMcParticleLink;
26 class CaloCalibrationHit;
27 
28 enum EBC_SUPPRESSED_TRUTH : unsigned char {
29  EBC_UNSUPPRESSED = 0, // Truth particle expected to be found in McEventCollection
30  EBC_PU_SUPPRESSED, // Link points to a suppressed pile-up truth particle do not attempt to resolve it.
31  EBC_NSUPP
32 };
33 
34 namespace HepMC {
35 
37  constexpr int SIM_BARCODE_THRESHOLD = 200000;
38 
40  constexpr int SIM_REGENERATION_INCREMENT = 1000000;
41 
43  constexpr int SIM_STATUS_INCREMENT = 100000;
44 
46  constexpr int SIM_STATUS_THRESHOLD = 20000;
47 
49  constexpr int FORWARD_TRANSPORT_MODEL_PROCESS = 212;
50 
53 
54  constexpr int INVALID_PARTICLE_BARCODE = -1;
55 
56  constexpr int UNDEFINED_ID = 0;
57  constexpr int INVALID_PARTICLE_ID = -1;
58  constexpr int INVALID_VERTEX_ID = 1;
59 
60  // TODO The definitions of is_smart_ptr and remove_smart_pointer
61  // below are probably too generic for this header, but putting them
62  // here initially.
63  template <typename T> struct is_smart_ptr : std::false_type {};
64  template <typename T> struct is_smart_ptr<std::shared_ptr<T>> : std::true_type {};
65  template <typename T> struct is_smart_ptr<std::unique_ptr<T>> : std::true_type {};
66  template <typename T> struct is_smart_ptr<std::weak_ptr<T>> : std::true_type {};
67  template <class T> inline constexpr bool is_smart_ptr_v = is_smart_ptr<T>::value;
68 
69  template <class T> struct remove_smart_pointer { typedef T type; };
70  template <class T> struct remove_smart_pointer<std::shared_ptr<T>> { typedef T type; };
71  template <class T> struct remove_smart_pointer<std::unique_ptr<T>> { typedef T type; };
72  template <class T> struct remove_smart_pointer<std::weak_ptr<T>> { typedef T type; };
73  template <class T> using remove_smart_pointer_t = typename remove_smart_pointer<T>::type;
74 
75 #if defined(XAOD_STANDALONE)
76  // Needed as we can't pick up the helper functions from AtlasHepMC in this case
77  template <class T> inline int barcode(const T& p){
78  if constexpr (std::is_pointer_v<T> || is_smart_ptr_v<T>){ //T is ptr
79  return p->barcode();
80  }
81  else {
82  return p.barcode();
83  }
84  }
85  template <> inline int barcode(const int& p){ return p;}
86 #endif
87  // Temporarily specialize uniqueID for xAOD::Truth classes ahead of the barcode migration - TODO remove this
88 #if defined(HEPMC3)
89  template <typename T> inline int uniqueID(const T& p) {
90  if constexpr (std::is_integral_v<T>) {
91  return p;
92  }
93  else if constexpr (std::is_integral_v<std::remove_pointer_t<T>>) {
94  return *p;
95  }
96  else if constexpr (std::is_same_v<T, xAOD::TruthParticle_v1> || std::is_same_v<T, xAOD::TruthVertex_v1>) {
97  return p.barcode();
98  }
99  else if constexpr (std::is_same_v<std::remove_const_t<remove_smart_pointer_t<std::remove_pointer_t<T>>>, xAOD::TruthParticle_v1> || std::is_same_v<std::remove_const_t<remove_smart_pointer_t<std::remove_pointer_t<T>>>, xAOD::TruthVertex_v1>) {
100  return p->barcode();
101  }
102  else if constexpr (std::is_same_v<T, CaloCalibrationHit>) {
103  return p.particleUID();
104  }
105  else if constexpr (std::is_same_v<std::remove_const_t<remove_smart_pointer_t<std::remove_pointer_t<T>>>, CaloCalibrationHit>) {
106  return p->particleUID();
107  }
108  else if constexpr (std::is_pointer_v<T> || is_smart_ptr_v<T>){ //T is ptr
109  return p->id();
110  }
111  else {
112  return p.id();
113  }
114  }
115 #else
116  template <typename T> inline int uniqueID(const T& p) {
117  if constexpr (std::is_integral_v<T>) {
118  return p;
119  }
120  else if constexpr (std::is_integral_v<std::remove_pointer_t<T>>) {
121  return *p;
122  }
123  else if constexpr (std::is_same_v<T, CaloCalibrationHit>) {
124  return p.particleUID();
125  }
126  else if constexpr (std::is_same_v<std::remove_const_t<remove_smart_pointer_t<std::remove_pointer_t<T>>>, CaloCalibrationHit>) {
127  return p->particleUID();
128  }
129  else if constexpr (std::is_pointer_v<T> || is_smart_ptr_v<T>){ //T is ptr
130  return p->barcode();
131  }
132  else {
133  return p.barcode();
134  }
135  }
136 #endif
137  // Temporarily specialize status for xAOD::Truth classes ahead of the barcode migration - TODO remove this
138  template <typename T> inline int status(const T& p) {
139  if constexpr (std::is_integral_v<T>) {
140  return p;
141  }
142  else if constexpr (std::is_integral_v<std::remove_pointer_t<T>>) {
143  return *p;
144  }
145  else if constexpr (std::is_same_v<T, xAOD::TruthVertex_v1>) {
146  return p.id();
147  }
148  else if constexpr (std::is_same_v<std::remove_const_t<remove_smart_pointer_t<std::remove_pointer_t<T>>>, xAOD::TruthVertex_v1>) {
149  return p->id();
150  }
151  else if constexpr (std::is_pointer_v<T> || is_smart_ptr_v<T>){ //T is ptr
152  return p->status();
153  }
154  else {
155  return p.status();
156  }
157  }
158 #if !defined(HEPMC3) && !defined(XAOD_STANDALONE)
159  template <> inline int status(const ConstGenVertexPtr& v1){ return v1->id();}
160  template <> inline int status(const GenVertexPtr& v1){ return v1->id();}
161 #endif
162 
164  template <class T> inline void get_particle_history(const T& p, std::deque<int>& out, const int direction = 0) {
165  if (direction < 0) {
166  if (p->status()>SIM_STATUS_INCREMENT) {
167  auto pv = p->production_vertex();
168  if (pv) {
169  for (auto pa: pv->particles_in()) {
170  if (pa->pdg_id() != p->pdg_id()) continue;
171  out.push_front(uniqueID(p));
172  get_particle_history(pa, out, -1);
173  break;
174  }
175  }
176  }
177  }
178  if (direction > 0) {
179  if (p->status()>SIM_STATUS_INCREMENT) {
180  auto pv = p->end_vertex();
181  if (pv) {
182  for (auto pa: pv->particles_out()) {
183  if (pa->pdg_id() != p->pdg_id()) continue;
184  out.push_back(uniqueID(p));
185  get_particle_history(pa, out, 1);
186  break;
187  }
188  }
189  }
190  }
191  }
193  template <class T> inline std::deque<int> simulation_history(const T& p, const int direction ) { std::deque<int> res; res.push_back(uniqueID(p)); get_particle_history(p, res, direction); return res;}
194 
195  namespace BarcodeBased {
197  template <class T> inline bool is_truth_suppressed_pileup(const T& p){ return (barcode(p) == SUPPRESSED_PILEUP_BARCODE);}
198 
200  template <class T> inline bool no_truth_link(const T& p){ return (barcode(p) == UNDEFINED_ID);}
201 
203  template <class T> inline bool ignoreTruthLink(const T& p, bool vetoPileUp){ const int b = barcode(p); return no_truth_link(b) || (vetoPileUp && is_truth_suppressed_pileup(b)); }
204 
206  template <class T> inline bool is_simulation_particle(const T& p){ return (barcode(p)>SIM_BARCODE_THRESHOLD);}
207 
209  template <class T> inline bool is_sim_secondary(const T& p){ return (barcode(p)%SIM_REGENERATION_INCREMENT > SIM_BARCODE_THRESHOLD); }
210 
212  template <class T> inline int generations(const T& p){ return (barcode(p)/SIM_REGENERATION_INCREMENT);}
213 
215  template <class T> inline bool is_simulation_vertex(const T& v){ return (barcode(v)<-SIM_BARCODE_THRESHOLD);}
216 
218  template <class T1, class T2> inline bool is_same_generator_particle(const T1& p1,const T2& p2) { int b1 = barcode(p1); int b2 = barcode(p2); return b1% SIM_REGENERATION_INCREMENT == b2 % SIM_REGENERATION_INCREMENT; }
219 
221  template <class T1, class T2> inline bool is_same_object(const T1& p1,const T2& p2) { int b1 = barcode(p1); int b2 = barcode(p2); return b1 == b2; }
222 
224  template <class T1, class T2> inline bool is_sim_descendant(const T1& p1,const T2& p2) { int b1 = barcode(p1); int b2 = barcode(p2); return b1 % SIM_REGENERATION_INCREMENT == b2;}
225  }
226 
227  namespace StatusBased {
229  template <class T> inline bool is_truth_suppressed_pileup(const T& p){
230  if constexpr (std::is_same_v<std::remove_const_t<T>, HepMcParticleLink>) {
231  return p.getTruthSuppressionType() == EBC_PU_SUPPRESSED;
232  }
233  else if constexpr (std::is_same_v<std::remove_const_t<remove_smart_pointer_t<std::remove_pointer_t<T>>>, HepMcParticleLink>) {
234  return p->getTruthSuppressionType() == EBC_PU_SUPPRESSED;
235  }
236  else {
237  return p == EBC_PU_SUPPRESSED;
238  }
239  }
240 
242  template <class T> inline bool no_truth_link(const T& p){
243  if constexpr (std::is_same_v<std::remove_const_t<T>, HepMcParticleLink>) {
244  return p.linkIsNull();
245  }
246  else if constexpr (std::is_same_v<std::remove_const_t<remove_smart_pointer_t<std::remove_pointer_t<T>>>, HepMcParticleLink>) {
247  return p->linkIsNull();
248  }
249  else {
250  return (uniqueID(p) == UNDEFINED_ID);
251  }
252  }
253 
255  template <class T> inline bool ignoreTruthLink(const T& p, bool vetoPileUp){
256  if constexpr (std::is_same_v<std::remove_const_t<remove_smart_pointer_t<std::remove_pointer_t<T>>>, HepMcParticleLink>) {
257  return no_truth_link(p) || (vetoPileUp && is_truth_suppressed_pileup(p));
258  }
259  else {
260  const int u = uniqueID(p); return no_truth_link(u) || (vetoPileUp && is_truth_suppressed_pileup(u));
261  }
262  }
263 
265  template <class T> inline bool is_simulation_particle(const T& p){ return (status(p)>SIM_STATUS_THRESHOLD);}
266 
268  template <class T> inline bool is_sim_secondary(const T& p){ return (status(p)%SIM_STATUS_INCREMENT > SIM_STATUS_THRESHOLD); }
269 
271  template <class T> inline int generations(const T& p){ return (status(p)/SIM_STATUS_INCREMENT);}
272 
274  template <class T> inline bool is_simulation_vertex(const T& v){ return (status(v)>SIM_STATUS_THRESHOLD);}
275 
277  template <class T1, class T2> inline bool is_same_generator_particle(const T1& p1,const T2& p2) {
278  const int id1 = uniqueID(p1);
279  const int id2 = uniqueID(p2);
280  if (id1 == id2) { return true;} // simplest case
281  const int generations1 = generations(p1);
282  const int generations2 = generations(p2);
283  if (generations1 == generations2) { return false; } // if the id values don't match and the particles have the same generation number then they cannot be the same particle.
284  if constexpr (std::is_same_v<std::remove_const_t<remove_smart_pointer_t<std::remove_pointer_t<T1>>>, TrackRecord>) {
285  // No choice, but to get the history of one of the particles:
286  const int direction = (generations2 > generations1) ? -1 : 1;
287  std::deque<int> history2 = simulation_history( p2, direction );
288  if (std::find(history2.begin(),history2.end(), id1) == history2.end()) { return false; }
289  }
290  else {
291  // No choice, but to get the history of one of the particles:
292  const int direction = (generations1 > generations2) ? -1 : 1;
293  std::deque<int> history1 = simulation_history( p1, direction );
294  if (std::find(history1.begin(),history1.end(), id2) == history1.end()) { return false; }
295  }
296  return true;
297  }
298 
300  template <class T1, class T2> inline bool is_same_object(const T1& p1,const T2& p2) {
301  const int id1 = uniqueID(p1);
302  const int id2 = uniqueID(p2);
303  return (id1 == id2);
304  }
305 
306 
308  template <class T1, class T2> inline bool is_sim_descendant(const T1& p1,const T2& p2) {
309  const int id1 = uniqueID(p1);
310  const int id2 = uniqueID(p2);
311  if (id1 == id2) { return true;} // simplest case
312  const int generations1 = generations(p1);
313  const int generations2 = generations(p2);
314  if (generations1 == generations2) { return false; } // if the id values don't match and the particles have the same generation number then they cannot be the same particle.
315  if constexpr (std::is_same_v<std::remove_const_t<remove_smart_pointer_t<std::remove_pointer_t<T1>>>, TrackRecord>) {
316  // No choice, but to get the descendents of p2
317  constexpr int descendents = 1;
318  std::deque<int> history2 = simulation_history( p2, descendents );
319  if (std::find(history2.begin(),history2.end(), id1) == history2.end()) { return false; }
320  }
321  else {
322  // No choice, but to get the history of p1
323  constexpr int ancestors = -1;
324  std::deque<int> history1 = simulation_history( p1, ancestors );
325  if (std::find(history1.begin(),history1.end(), id2) == history1.end()) { return false; }
326  }
327  return true;
328  }
329  }
330 
332  template <class T> inline bool is_truth_suppressed_pileup(const T& p){
333  if constexpr (std::is_same_v<std::remove_const_t<remove_smart_pointer_t<std::remove_pointer_t<T>>>, HepMcParticleLink>) {
335  }
336  else {
338  }
339  }
340 
342  template <class T> inline bool no_truth_link(const T& p){ return StatusBased::no_truth_link(p);}
343 
345  template <class T> inline bool ignoreTruthLink(const T& p, bool vetoPileUp){
346  if constexpr (std::is_same_v<std::remove_const_t<remove_smart_pointer_t<std::remove_pointer_t<T>>>, HepMcParticleLink>) {
347  return StatusBased::ignoreTruthLink(p, vetoPileUp);
348  }
349  else {
350  return BarcodeBased::ignoreTruthLink(p, vetoPileUp);
351  }
352  }
353 
355  template <class T> inline bool is_simulation_particle(const T& p){ return BarcodeBased::is_simulation_particle(p);}
356 
358  template <class T> inline int generations(const T& p){ return BarcodeBased::generations(p);}
359 
361  template <class T> inline bool is_simulation_vertex(const T& v){ return BarcodeBased::is_simulation_vertex(v);}
362 
364  template <class T1,class T2> inline bool is_same_generator_particle(const T1& p1,const T2& p2) { return BarcodeBased::is_same_generator_particle(p1, p2); }
365 
367  template <class T1,class T2> inline bool is_same_particle(const T1& p1,const T2& p2) { return BarcodeBased::is_same_object(p1, p2); }
368 
370  template <class T1,class T2> inline bool is_same_vertex(const T1& p1,const T2& p2) { return BarcodeBased::is_same_object(p1, p2); }
371 
373  template <class T1,class T2> inline bool is_sim_descendant(const T1& p1,const T2& p2) { return BarcodeBased::is_sim_descendant(p1, p2);}
374 
376  template <class T> void old_to_new_simulation_scheme(T& evt) {
377  auto particle_status = [] (int barcode, int status) {
381  return status;
382  };
383  auto vertex_status = [] (int barcode, int status) {
385  return status;
386  };
387 #ifdef HEPMC3
388  for (auto p: evt->particles()) {
389  p->set_status (particle_status (HepMC::barcode(p), p->status()));
390  }
391  for (auto v: evt->vertices()) {
392  v->set_status (vertex_status (HepMC::barcode(v), v->status()));
393  }
394 #else
395  for (auto p = evt->particles_begin(); p != evt->particles_end(); ++p) {
396  (*p)->set_status (particle_status ((*p)->barcode(), (*p)->status()));
397  }
398  for (auto v = evt->vertices_begin(); v != evt->vertices_end(); ++v) {
399  (*v)->set_id (vertex_status ((*v)->barcode(), (*v)->id()));
400  }
401 #endif
402  }
403 
405  inline int new_particle_status_from_old(const int oldStatus,const int barcode) {
406  int generations_barcode_based = (barcode/SIM_REGENERATION_INCREMENT);
407  bool is_sim_secondary_barcode_based = (barcode%SIM_REGENERATION_INCREMENT > SIM_BARCODE_THRESHOLD);
408  return oldStatus + SIM_STATUS_INCREMENT*generations_barcode_based + (is_sim_secondary_barcode_based? SIM_STATUS_THRESHOLD : 0);
409  }
410 
412  inline int old_particle_status_from_new(const int newStatus) { return newStatus%SIM_STATUS_THRESHOLD; }
413 
415  inline int new_vertex_status_from_old(const int oldStatus,const int barcode) {
416  bool is_simulation_vertex_barcode_based = (barcode<-SIM_BARCODE_THRESHOLD);
417  return (is_simulation_vertex_barcode_based? SIM_STATUS_THRESHOLD : 0) + oldStatus;
418  }
419 
421  inline int old_vertex_status_from_new(const int newStatus) {
422  bool is_simulation_vertex_status_based = (newStatus>SIM_STATUS_THRESHOLD);
423  return ( is_simulation_vertex_status_based ? -SIM_STATUS_THRESHOLD : 0) + newStatus; }
424 }
425 #if !defined(XAOD_STANDALONE)
426 namespace HepMC {
428 inline int maxGeneratedParticleBarcode(const HepMC::GenEvent *genEvent) {
429  int maxBarcode = 0;
430 #ifdef HEPMC3
431  auto allbarcodes = genEvent->attribute<HepMC::GenEventBarcodes>("barcodes");
432  for (const auto& bp: allbarcodes->barcode_to_particle_map()) {
433  if (!HepMC::BarcodeBased::is_simulation_particle(bp.first)) { maxBarcode=std::max(maxBarcode,bp.first); }
434  }
435 #else
436  for (auto currentGenParticle: *genEvent) {
437  const int barcode=HepMC::barcode(currentGenParticle);
438  if (barcode > maxBarcode && !HepMC::BarcodeBased::is_simulation_particle(barcode)) { maxBarcode=barcode; }
439  }
440 #endif
441  return maxBarcode;
442 }
443 
445 inline int maxGeneratedVertexBarcode(const HepMC::GenEvent *genEvent) {
446  int maxBarcode=0;
447 #ifdef HEPMC3
448  auto allbarcodes = genEvent->attribute<HepMC::GenEventBarcodes>("barcodes");
449  for (const auto& bp: allbarcodes->barcode_to_vertex_map()) {
450  if (!HepMC::BarcodeBased::is_simulation_vertex(bp.first)) { maxBarcode=std::min(maxBarcode,bp.first); }
451  }
452 #else
453  HepMC::GenEvent::vertex_const_iterator currentGenVertexIter;
454  for (currentGenVertexIter= genEvent->vertices_begin();
455  currentGenVertexIter!= genEvent->vertices_end();
456  ++currentGenVertexIter) {
457  const int barcode((*currentGenVertexIter)->barcode());
458  if (barcode < maxBarcode && !HepMC::BarcodeBased::is_simulation_vertex(barcode)) { maxBarcode=barcode; }
459  }
460 #endif
461  return maxBarcode;
462 }
463 }
464 #endif
465 
466 #endif
HepMC::GenVertexPtr
HepMC::GenVertex * GenVertexPtr
Definition: GenVertex.h:59
HepMC::StatusBased::is_simulation_vertex
bool is_simulation_vertex(const T &v)
Method to establish if the vertex was created during simulation from the status.
Definition: MagicNumbers.h:274
EBC_SUPPRESSED_TRUTH
EBC_SUPPRESSED_TRUTH
Definition: MagicNumbers.h:28
HepMC::old_vertex_status_from_new
int old_vertex_status_from_new(const int newStatus)
Get vertex status in the old scheme from the status in the new scheme.
Definition: MagicNumbers.h:421
HepMC::SIM_BARCODE_THRESHOLD
constexpr int SIM_BARCODE_THRESHOLD
Constant defining the barcode threshold for simulated particles, eg. can be used to separate generato...
Definition: MagicNumbers.h:37
GenEvent.h
HepMC::is_same_vertex
bool is_same_vertex(const T1 &p1, const T2 &p2)
Method to establish if two particles in the GenEvent actually represent the same vertex.
Definition: MagicNumbers.h:370
HepMC::StatusBased::is_truth_suppressed_pileup
bool is_truth_suppressed_pileup(const T &p)
Method to establish if a particle corresponds to truth-suppressed pile-up.
Definition: MagicNumbers.h:229
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
HepMC::BarcodeBased::is_sim_secondary
bool is_sim_secondary(const T &p)
Method to establish if a particle (or barcode) is a new seondary created during the simulation (only ...
Definition: MagicNumbers.h:209
HepMC::StatusBased::generations
int generations(const T &p)
Method to return how many interactions a particle has undergone during simulation based on the status...
Definition: MagicNumbers.h:271
EBC_NSUPP
@ EBC_NSUPP
Definition: MagicNumbers.h:31
HepMC::BarcodeBased::ignoreTruthLink
bool ignoreTruthLink(const T &p, bool vetoPileUp)
Helper function for SDO creation in PileUpTools.
Definition: MagicNumbers.h:203
HepMC::SIM_STATUS_INCREMENT
constexpr int SIM_STATUS_INCREMENT
Constant defining the barcode threshold for regenerated particles, i.e. particles surviving an intera...
Definition: MagicNumbers.h:43
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
HepMC::BarcodeBased::is_simulation_particle
bool is_simulation_particle(const T &p)
Method to establish if a particle (or barcode) was created during the simulation (only to be used in ...
Definition: MagicNumbers.h:206
HepMC::StatusBased::is_sim_secondary
bool is_sim_secondary(const T &p)
Method to establish if a particle is a new seondary created during the simulation based on the status...
Definition: MagicNumbers.h:268
min
constexpr double min()
Definition: ap_fixedTest.cxx:26
GenVertex.h
TRTCalib_cfilter.p1
p1
Definition: TRTCalib_cfilter.py:130
HepMC::INVALID_PARTICLE_ID
constexpr int INVALID_PARTICLE_ID
Definition: MagicNumbers.h:57
python.AthDsoLogger.out
out
Definition: AthDsoLogger.py:71
HepMC::maxGeneratedVertexBarcode
int maxGeneratedVertexBarcode(const HepMC::GenEvent *genEvent)
Get the maximal absolute value of barcode of vertex present in the event. Returns a negative number.
Definition: MagicNumbers.h:445
HepMC::StatusBased::ignoreTruthLink
bool ignoreTruthLink(const T &p, bool vetoPileUp)
Helper function for SDO creation in PileUpTools.
Definition: MagicNumbers.h:255
HepMC::BarcodeBased::is_sim_descendant
bool is_sim_descendant(const T1 &p1, const T2 &p2)
Method to check if the first particle is a descendant of the second in the simulation,...
Definition: MagicNumbers.h:224
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition: ICaloAffectedTool.h:24
HepMC::StatusBased::no_truth_link
bool no_truth_link(const T &p)
Method to establish if a if the object is linked to something which was never saved to the HepMC Trut...
Definition: MagicNumbers.h:242
LArG4FSStartPointFilter.evt
evt
Definition: LArG4FSStartPointFilter.py:42
HepMC::ignoreTruthLink
bool ignoreTruthLink(const T &p, bool vetoPileUp)
Helper function for SDO creation in PileUpTools.
Definition: MagicNumbers.h:345
HepMC::INVALID_PARTICLE_BARCODE
constexpr int INVALID_PARTICLE_BARCODE
Definition: MagicNumbers.h:54
HepMC::is_smart_ptr_v
constexpr bool is_smart_ptr_v
Definition: MagicNumbers.h:67
HepMC::is_same_particle
bool is_same_particle(const T1 &p1, const T2 &p2)
Method to establish if two particles in the GenEvent actually represent the same particle.
Definition: MagicNumbers.h:367
GenParticle.h
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:77
HepMC::BarcodeBased::generations
int generations(const T &p)
Method to return how many interactions a particle has undergone during simulation (only to be used in...
Definition: MagicNumbers.h:212
HepMC::remove_smart_pointer< std::unique_ptr< T > >::type
T type
Definition: MagicNumbers.h:71
HepMC::FORWARD_TRANSPORT_MODEL_PROCESS
constexpr int FORWARD_TRANSPORT_MODEL_PROCESS
Special Forward transport Geant process for vertices.
Definition: MagicNumbers.h:49
TRTCalib_cfilter.p2
p2
Definition: TRTCalib_cfilter.py:131
HepMC::SUPPRESSED_PILEUP_BARCODE
constexpr int SUPPRESSED_PILEUP_BARCODE(std::numeric_limits< int32_t >::max())
This barcode is used by objects matched to particles from pile-up interactions in standard MC Product...
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
HepMC::is_same_generator_particle
bool is_same_generator_particle(const T1 &p1, const T2 &p2)
Method to establish if two particles in the GenEvent actually represent the same generated particle.
Definition: MagicNumbers.h:364
HepMC::StatusBased::is_same_object
bool is_same_object(const T1 &p1, const T2 &p2)
Method to establish if two particles/vertices in the GenEvent actually represent the same particle.
Definition: MagicNumbers.h:300
id2
HWIdentifier id2
Definition: LArRodBlockPhysicsV0.cxx:562
HepMC::is_simulation_particle
bool is_simulation_particle(const T &p)
Method to establish if a particle (or barcode) was created during the simulation (TODO update to be s...
Definition: MagicNumbers.h:355
HepMC::BarcodeBased::no_truth_link
bool no_truth_link(const T &p)
Method to establish if a if the object is linked to something which was never saved to the HepMC Trut...
Definition: MagicNumbers.h:200
HepMC::old_particle_status_from_new
int old_particle_status_from_new(const int newStatus)
Get particle status in the old scheme from the status in the new scheme.
Definition: MagicNumbers.h:412
HepMC::barcode
int barcode(const T *p)
Definition: Barcode.h:16
xAOD::TruthParticle_v1
Class describing a truth particle in the MC record.
Definition: TruthParticle_v1.h:37
HepMC::new_vertex_status_from_old
int new_vertex_status_from_old(const int oldStatus, const int barcode)
Get vertex status in the new scheme from the barcode and status in the old scheme.
Definition: MagicNumbers.h:415
res
std::pair< std::vector< unsigned int >, bool > res
Definition: JetGroupProductTest.cxx:14
HepMC::uniqueID
int uniqueID(const T &p)
Definition: MagicNumbers.h:116
HepMC::remove_smart_pointer::type
T type
Definition: MagicNumbers.h:69
HepMC::simulation_history
std::deque< int > simulation_history(const T &p, const int direction)
Function to calculate all the descendants(direction=1)/ancestors(direction=-1) of the particle.
Definition: MagicNumbers.h:193
HepMC::is_simulation_vertex
bool is_simulation_vertex(const T &v)
Method to establish if the vertex was created during simulation (TODO migrate to be based on status).
Definition: MagicNumbers.h:361
HepMC::StatusBased::is_same_generator_particle
bool is_same_generator_particle(const T1 &p1, const T2 &p2)
Method to establish if two particles in the GenEvent actually represent the same generated particle.
Definition: MagicNumbers.h:277
HepMC::remove_smart_pointer
Definition: MagicNumbers.h:69
HepMC::is_smart_ptr
Definition: MagicNumbers.h:63
HepMC::UNDEFINED_ID
constexpr int UNDEFINED_ID
Definition: MagicNumbers.h:56
HepMC::SIM_REGENERATION_INCREMENT
constexpr int SIM_REGENERATION_INCREMENT
Constant defining the barcode threshold for regenerated particles, i.e. particles surviving an intera...
Definition: MagicNumbers.h:40
HepMC::INVALID_VERTEX_ID
constexpr int INVALID_VERTEX_ID
Definition: MagicNumbers.h:58
HepMC::BarcodeBased::is_simulation_vertex
bool is_simulation_vertex(const T &v)
Method to establish if the vertex was created during simulation (only to be used in legacy TP convert...
Definition: MagicNumbers.h:215
xAOD::TruthVertex_v1
Class describing a truth vertex in the MC record.
Definition: TruthVertex_v1.h:37
HepMC::StatusBased::is_simulation_particle
bool is_simulation_particle(const T &p)
Method to establish if a particle was created during the simulation based on the status value.
Definition: MagicNumbers.h:265
CaloCalibrationHit
Class to store calorimeter calibration hit.
Definition: CaloCalibrationHit.h:23
HepMC::SIM_STATUS_THRESHOLD
constexpr int SIM_STATUS_THRESHOLD
Constant definiting the status threshold for simulated particles, eg. can be used to separate generat...
Definition: MagicNumbers.h:46
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
HepMC::old_to_new_simulation_scheme
void old_to_new_simulation_scheme(T &evt)
Function that converts the old scheme of labeling the simulation particles (barcodes) into the new sc...
Definition: MagicNumbers.h:376
HepMC::BarcodeBased::is_same_generator_particle
bool is_same_generator_particle(const T1 &p1, const T2 &p2)
Method to establish if two particles in the GenEvent actually represent the same generated particle.
Definition: MagicNumbers.h:218
HepMC::BarcodeBased::is_truth_suppressed_pileup
bool is_truth_suppressed_pileup(const T &p)
Method to establish if a particle (or barcode) corresponds to truth-suppressed pile-up.
Definition: MagicNumbers.h:197
TrackRecord
Definition: TrackRecord.h:12
python.PyAthena.v
v
Definition: PyAthena.py:154
HepMC::get_particle_history
void get_particle_history(const T &p, std::deque< int > &out, const int direction=0)
Function to calculate all the descendants(direction=1)/ancestors(direction=-1) of the particle.
Definition: MagicNumbers.h:164
HepMC::BarcodeBased::is_same_object
bool is_same_object(const T1 &p1, const T2 &p2)
Method to establish if two particles/vertices in the GenEvent actually represent the same generated p...
Definition: MagicNumbers.h:221
HepMC::maxGeneratedParticleBarcode
int maxGeneratedParticleBarcode(const HepMC::GenEvent *genEvent)
Get the maximal value of barcode of particle present in the event.
Definition: MagicNumbers.h:428
HepMC
Definition: Barcode.h:14
HepMC::StatusBased::is_sim_descendant
bool is_sim_descendant(const T1 &p1, const T2 &p2)
Method to check if the first particle is a descendant of the second in the simulation,...
Definition: MagicNumbers.h:308
python.changerun.pv
pv
Definition: changerun.py:81
HepMC::remove_smart_pointer_t
typename remove_smart_pointer< T >::type remove_smart_pointer_t
Definition: MagicNumbers.h:73
EBC_PU_SUPPRESSED
@ EBC_PU_SUPPRESSED
Definition: MagicNumbers.h:30
HepMC::remove_smart_pointer< std::shared_ptr< T > >::type
T type
Definition: MagicNumbers.h:70
HepMC::remove_smart_pointer< std::weak_ptr< T > >::type
T type
Definition: MagicNumbers.h:72
HepMC::is_sim_descendant
bool is_sim_descendant(const T1 &p1, const T2 &p2)
Method to check if the first particle is a descendant of the second in the simulation,...
Definition: MagicNumbers.h:373
HepMC::ConstGenVertexPtr
const HepMC::GenVertex * ConstGenVertexPtr
Definition: GenVertex.h:60
EBC_UNSUPPRESSED
@ EBC_UNSUPPRESSED
Definition: MagicNumbers.h:29
HepMC::status
int status(const T &p)
Definition: MagicNumbers.h:138
HepMC::generations
int generations(const T &p)
Method to return how many interactions a particle has undergone during simulation (TODO migrate to be...
Definition: MagicNumbers.h:358
HepMC::is_truth_suppressed_pileup
bool is_truth_suppressed_pileup(const T &p)
Method to establish if a particle (or barcode) corresponds to truth-suppressed pile-up (TODO update t...
Definition: MagicNumbers.h:332
HepMC::no_truth_link
bool no_truth_link(const T &p)
Method to establish if a if the object is linked to something which was never saved to the HepMC Trut...
Definition: MagicNumbers.h:342
HepMC::new_particle_status_from_old
int new_particle_status_from_old(const int oldStatus, const int barcode)
Get particle status in the new scheme from the barcode and status in the old scheme.
Definition: MagicNumbers.h:405