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.uid();
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->uid();
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, xAOD::TruthParticle_v1> || std::is_same_v<T, xAOD::TruthVertex_v1>) {
124  return p.uid();
125  }
126  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>) {
127  return p->uid();
128  }
129  else if constexpr (std::is_same_v<T, CaloCalibrationHit>) {
130  return p.particleUID();
131  }
132  else if constexpr (std::is_same_v<std::remove_const_t<remove_smart_pointer_t<std::remove_pointer_t<T>>>, CaloCalibrationHit>) {
133  return p->particleUID();
134  }
135  else if constexpr (std::is_pointer_v<T> || is_smart_ptr_v<T>){ //T is ptr
136  return p->barcode();
137  }
138  else {
139  return p.barcode();
140  }
141  }
142 #endif
143  template <typename T> inline int status(const T& p) {
144  if constexpr (std::is_integral_v<T>) {
145  return p;
146  }
147  else if constexpr (std::is_integral_v<std::remove_pointer_t<T>>) {
148  return *p;
149  }
150  else if constexpr (std::is_pointer_v<T> || is_smart_ptr_v<T>){ //T is ptr
151  return p->status();
152  }
153  else {
154  return p.status();
155  }
156  }
157 #if !defined(HEPMC3) && !defined(XAOD_STANDALONE)
158  template <> inline int status(const ConstGenVertexPtr& v1){ return v1->id();}
159  template <> inline int status(const GenVertexPtr& v1){ return v1->id();}
160 #endif
161 
163  template <class T> inline void get_particle_history(const T& p, std::deque<int>& out, const int direction = 0) {
164  if (direction < 0) {
165  if (p->status()>SIM_STATUS_INCREMENT) {
166  auto pv = p->production_vertex();
167  if (pv) {
168  for (auto pa: pv->particles_in()) {
169  if (!pa || pa->pdg_id() != p->pdg_id()) continue;
170  out.push_front(uniqueID(p));
171  get_particle_history(pa, out, -1);
172  break;
173  }
174  }
175  }
176  }
177  if (direction > 0) {
178  if (p->status()>SIM_STATUS_INCREMENT) {
179  auto pv = p->end_vertex();
180  if (pv) {
181  for (auto pa: pv->particles_out()) {
182  if (!pa || pa->pdg_id() != p->pdg_id()) continue;
183  out.push_back(uniqueID(p));
184  get_particle_history(pa, out, 1);
185  break;
186  }
187  }
188  }
189  }
190  }
192  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;}
193 
194  namespace BarcodeBased {
196  template <class T> inline bool is_truth_suppressed_pileup(const T& p){ return (barcode(p) == SUPPRESSED_PILEUP_BARCODE);}
197 
199  template <class T> inline bool no_truth_link(const T& p){ return (barcode(p) == UNDEFINED_ID);}
200 
202  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)); }
203 
205  template <class T> inline bool is_simulation_particle(const T& p){ return (barcode(p)>SIM_BARCODE_THRESHOLD);}
206 
208  template <class T> inline bool is_sim_secondary(const T& p){ return (barcode(p)%SIM_REGENERATION_INCREMENT > SIM_BARCODE_THRESHOLD); }
209 
211  template <class T> inline int generations(const T& p){ return (barcode(p)/SIM_REGENERATION_INCREMENT);}
212 
214  template <class T> inline bool is_simulation_vertex(const T& v){ return (barcode(v)<-SIM_BARCODE_THRESHOLD);}
215 
217  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; }
218 
220  template <class T1, class T2> inline bool is_same_object(const T1& p1,const T2& p2) { int b1 = uniqueID(p1); int b2 = uniqueID(p2); return b1 == b2; } // NB Still need to adapt CaloCalibrationHits
221 
223  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;}
224  }
225 
226  namespace StatusBased {
228  template <class T> inline bool is_truth_suppressed_pileup(const T& p){
229  if constexpr (std::is_same_v<std::remove_const_t<T>, HepMcParticleLink>) {
230  return p.getTruthSuppressionType() == EBC_PU_SUPPRESSED;
231  }
232  else if constexpr (std::is_same_v<std::remove_const_t<remove_smart_pointer_t<std::remove_pointer_t<T>>>, HepMcParticleLink>) {
233  return p->getTruthSuppressionType() == EBC_PU_SUPPRESSED;
234  }
235  else {
236  return p == EBC_PU_SUPPRESSED;
237  }
238  }
239 
241  template <class T> inline bool no_truth_link(const T& p){
242  if constexpr (std::is_same_v<std::remove_const_t<T>, HepMcParticleLink>) {
243  return p.linkIsNull();
244  }
245  else if constexpr (std::is_same_v<std::remove_const_t<remove_smart_pointer_t<std::remove_pointer_t<T>>>, HepMcParticleLink>) {
246  return p->linkIsNull();
247  }
248  else {
249  return (uniqueID(p) == UNDEFINED_ID);
250  }
251  }
252 
254  template <class T> inline bool ignoreTruthLink(const T& p, bool vetoPileUp){
255  if constexpr (std::is_same_v<std::remove_const_t<remove_smart_pointer_t<std::remove_pointer_t<T>>>, HepMcParticleLink>) {
256  return no_truth_link(p) || (vetoPileUp && is_truth_suppressed_pileup(p));
257  }
258  else {
259  const int u = uniqueID(p); return no_truth_link(u) || (vetoPileUp && is_truth_suppressed_pileup(u));
260  }
261  }
262 
264  template <class T> inline bool is_simulation_particle(const T& p){ return (status(p)>SIM_STATUS_THRESHOLD);}
265 
267  template <class T> inline bool is_sim_secondary(const T& p){ return (status(p)%SIM_STATUS_INCREMENT > SIM_STATUS_THRESHOLD); }
268 
270  template <class T> inline int generations(const T& p){ return (status(p)/SIM_STATUS_INCREMENT);}
271 
273  template <class T> inline bool is_simulation_vertex(const T& v){ return (status(v)>SIM_STATUS_THRESHOLD);}
274 
276  template <class T1, class T2> inline bool is_same_generator_particle(const T1& p1,const T2& p2) {
277  const int id1 = uniqueID(p1);
278  const int id2 = uniqueID(p2);
279  if (id1 == id2) { return true;} // simplest case
280  const int generations1 = generations(p1);
281  const int generations2 = generations(p2);
282  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.
283  if constexpr (std::is_same_v<std::remove_const_t<remove_smart_pointer_t<std::remove_pointer_t<T1>>>, TrackRecord>) {
284  // No choice, but to get the history of one of the particles:
285  const int direction = (generations2 > generations1) ? -1 : 1;
286  std::deque<int> history2 = simulation_history( p2, direction );
287  if (std::find(history2.begin(),history2.end(), id1) == history2.end()) { return false; }
288  }
289  else {
290  // No choice, but to get the history of one of the particles:
291  const int direction = (generations1 > generations2) ? -1 : 1;
292  std::deque<int> history1 = simulation_history( p1, direction );
293  if (std::find(history1.begin(),history1.end(), id2) == history1.end()) { return false; }
294  }
295  return true;
296  }
297 
299  template <class T1, class T2> inline bool is_same_object(const T1& p1,const T2& p2) {
300  const int id1 = uniqueID(p1);
301  const int id2 = uniqueID(p2);
302  return (id1 == id2);
303  }
304 
305 
307  template <class T1, class T2> inline bool is_sim_descendant(const T1& p1,const T2& p2) {
308  const int id1 = uniqueID(p1);
309  const int id2 = uniqueID(p2);
310  if (id1 == id2) { return true;} // simplest case
311  const int generations1 = generations(p1);
312  const int generations2 = generations(p2);
313  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.
314  if constexpr (std::is_same_v<std::remove_const_t<remove_smart_pointer_t<std::remove_pointer_t<T1>>>, TrackRecord>) {
315  // No choice, but to get the descendents of p2
316  constexpr int descendents = 1;
317  std::deque<int> history2 = simulation_history( p2, descendents );
318  if (std::find(history2.begin(),history2.end(), id1) == history2.end()) { return false; }
319  }
320  else {
321  // No choice, but to get the history of p1
322  constexpr int ancestors = -1;
323  std::deque<int> history1 = simulation_history( p1, ancestors );
324  if (std::find(history1.begin(),history1.end(), id2) == history1.end()) { return false; }
325  }
326  return true;
327  }
328  }
329 
331  template <class T> inline bool is_truth_suppressed_pileup(const T& p){
332  if constexpr (std::is_same_v<std::remove_const_t<remove_smart_pointer_t<std::remove_pointer_t<T>>>, HepMcParticleLink>) {
334  }
335  else {
337  }
338  }
339 
341  template <class T> inline bool no_truth_link(const T& p){ return StatusBased::no_truth_link(p);}
342 
344  template <class T> inline bool ignoreTruthLink(const T& p, bool vetoPileUp){
345  if constexpr (std::is_same_v<std::remove_const_t<remove_smart_pointer_t<std::remove_pointer_t<T>>>, HepMcParticleLink>) {
346  return StatusBased::ignoreTruthLink(p, vetoPileUp);
347  }
348  else {
349  return BarcodeBased::ignoreTruthLink(p, vetoPileUp);
350  }
351  }
352 
354  template <class T> inline bool is_simulation_particle(const T& p){ return StatusBased::is_simulation_particle(p);}
355 
357  template <class T> inline int generations(const T& p){ return StatusBased::generations(p);}
358 
360  template <class T> inline bool is_simulation_vertex(const T& v){ return StatusBased::is_simulation_vertex(v);}
361 
363  template <class T1,class T2> inline bool is_same_generator_particle(const T1& p1,const T2& p2) { return StatusBased::is_same_generator_particle(p1, p2); }
364 
366  template <class T1,class T2> inline bool is_same_particle(const T1& p1,const T2& p2) { return StatusBased::is_same_object(p1, p2); }
367 
369  template <class T1,class T2> inline bool is_same_vertex(const T1& p1,const T2& p2) { return StatusBased::is_same_object(p1, p2); }
370 
372  template <class T1,class T2> inline bool is_sim_descendant(const T1& p1,const T2& p2) { return StatusBased::is_sim_descendant(p1, p2);}
373 
375  template <class T> void old_to_new_simulation_scheme(T& evt) {
376  auto particle_status = [] (int barcode, int status) {
380  return status;
381  };
382  auto vertex_status = [] (int barcode, int status) {
384  return status;
385  };
386 #ifdef HEPMC3
387  for (auto p: evt->particles()) {
388  p->set_status (particle_status (HepMC::barcode(p), p->status()));
389  }
390  for (auto v: evt->vertices()) {
391  v->set_status (vertex_status (HepMC::barcode(v), v->status()));
392  }
393 #else
394  for (auto p = evt->particles_begin(); p != evt->particles_end(); ++p) {
395  (*p)->set_status (particle_status ((*p)->barcode(), (*p)->status()));
396  }
397  for (auto v = evt->vertices_begin(); v != evt->vertices_end(); ++v) {
398  (*v)->set_id (vertex_status ((*v)->barcode(), (*v)->id()));
399  }
400 #endif
401  }
402 
404  inline int new_particle_status_from_old(const int oldStatus,const int barcode) {
405  int generations_barcode_based = (barcode/SIM_REGENERATION_INCREMENT);
406  bool is_sim_secondary_barcode_based = (barcode%SIM_REGENERATION_INCREMENT > SIM_BARCODE_THRESHOLD);
407  return oldStatus + SIM_STATUS_INCREMENT*generations_barcode_based + (is_sim_secondary_barcode_based? SIM_STATUS_THRESHOLD : 0);
408  }
409 
411  inline int old_particle_status_from_new(const int newStatus) { return newStatus%SIM_STATUS_THRESHOLD; }
412 
414  inline int new_vertex_status_from_old(const int oldStatus,const int barcode) {
415  bool is_simulation_vertex_barcode_based = (barcode<-SIM_BARCODE_THRESHOLD);
416  return (is_simulation_vertex_barcode_based? SIM_STATUS_THRESHOLD : 0) + oldStatus;
417  }
418 
420  inline int old_vertex_status_from_new(const int newStatus) {
421  bool is_simulation_vertex_status_based = (newStatus>SIM_STATUS_THRESHOLD);
422  return ( is_simulation_vertex_status_based ? -SIM_STATUS_THRESHOLD : 0) + newStatus; }
423 }
424 #if !defined(XAOD_STANDALONE)
425 namespace HepMC {
427 inline int maxGeneratedParticleBarcode(const HepMC::GenEvent *genEvent) {
428  int maxBarcode = 0;
429 #ifdef HEPMC3
430  auto allbarcodes = genEvent->attribute<HepMC::GenEventBarcodes>("barcodes");
431  for (const auto& bp: allbarcodes->barcode_to_particle_map()) {
432  if (!HepMC::BarcodeBased::is_simulation_particle(bp.first)) { maxBarcode=std::max(maxBarcode,bp.first); }
433  }
434 #else
435  for (auto currentGenParticle: *genEvent) {
436  const int barcode=HepMC::barcode(currentGenParticle);
437  if (barcode > maxBarcode && !HepMC::BarcodeBased::is_simulation_particle(barcode)) { maxBarcode=barcode; }
438  }
439 #endif
440  return maxBarcode;
441 }
442 
444 inline int maxGeneratedVertexBarcode(const HepMC::GenEvent *genEvent) {
445  int maxBarcode=0;
446 #ifdef HEPMC3
447  auto allbarcodes = genEvent->attribute<HepMC::GenEventBarcodes>("barcodes");
448  for (const auto& bp: allbarcodes->barcode_to_vertex_map()) {
449  if (!HepMC::BarcodeBased::is_simulation_vertex(bp.first)) { maxBarcode=std::min(maxBarcode,bp.first); }
450  }
451 #else
452  HepMC::GenEvent::vertex_const_iterator currentGenVertexIter;
453  for (currentGenVertexIter= genEvent->vertices_begin();
454  currentGenVertexIter!= genEvent->vertices_end();
455  ++currentGenVertexIter) {
456  const int barcode((*currentGenVertexIter)->barcode());
457  if (barcode < maxBarcode && !HepMC::BarcodeBased::is_simulation_vertex(barcode)) { maxBarcode=barcode; }
458  }
459 #endif
460  return maxBarcode;
461 }
462 }
463 #endif
464 
465 #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:273
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:420
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:369
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:228
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:208
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:270
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:202
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:205
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:267
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:70
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:444
HepMC::StatusBased::ignoreTruthLink
bool ignoreTruthLink(const T &p, bool vetoPileUp)
Helper function for SDO creation in PileUpTools.
Definition: MagicNumbers.h:254
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:223
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:241
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:344
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:366
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:211
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:209
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:363
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:299
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:354
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:199
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:411
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:414
res
std::pair< std::vector< unsigned int >, bool > res
Definition: JetGroupProductTest.cxx:11
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:192
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:360
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:276
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:214
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:264
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:76
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:375
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:217
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:196
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:163
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:220
HepMC::maxGeneratedParticleBarcode
int maxGeneratedParticleBarcode(const HepMC::GenEvent *genEvent)
Get the maximal value of barcode of particle present in the event.
Definition: MagicNumbers.h:427
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:307
python.changerun.pv
pv
Definition: changerun.py:79
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:372
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:143
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:357
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:331
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:341
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:404