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 
27 enum EBC_SUPPRESSED_TRUTH : unsigned char {
28  EBC_UNSUPPRESSED = 0, // Truth particle expected to be found in McEventCollection
29  EBC_PU_SUPPRESSED, // Link points to a suppressed pile-up truth particle do not attempt to resolve it.
30  EBC_NSUPP
31 };
32 
33 namespace HepMC {
34 
36  constexpr int SIM_BARCODE_THRESHOLD = 200000;
37 
39  constexpr int SIM_REGENERATION_INCREMENT = 1000000;
40 
42  constexpr int SIM_STATUS_INCREMENT = 100000;
43 
45  constexpr int SIM_STATUS_THRESHOLD = 20000;
46 
48  constexpr int FORWARD_TRANSPORT_MODEL_PROCESS = 212;
49 
52 
53  constexpr int INVALID_PARTICLE_BARCODE = -1;
54 
55  constexpr int UNDEFINED_ID = 0;
56  constexpr int INVALID_PARTICLE_ID = -1;
57  constexpr int INVALID_VERTEX_ID = 1;
58 
59  // TODO The definitions of is_smart_ptr and remove_smart_pointer
60  // below are probably too generic for this header, but putting them
61  // here initially.
62  template <typename T> struct is_smart_ptr : std::false_type {};
63  template <typename T> struct is_smart_ptr<std::shared_ptr<T>> : std::true_type {};
64  template <typename T> struct is_smart_ptr<std::unique_ptr<T>> : std::true_type {};
65  template <typename T> struct is_smart_ptr<std::weak_ptr<T>> : std::true_type {};
66  template <class T> inline constexpr bool is_smart_ptr_v = is_smart_ptr<T>::value;
67 
68  template <class T> struct remove_smart_pointer { typedef T type; };
69  template <class T> struct remove_smart_pointer<std::shared_ptr<T>> { typedef T type; };
70  template <class T> struct remove_smart_pointer<std::unique_ptr<T>> { typedef T type; };
71  template <class T> struct remove_smart_pointer<std::weak_ptr<T>> { typedef T type; };
72  template <class T> using remove_smart_pointer_t = typename remove_smart_pointer<T>::type;
73 
74 #if defined(XAOD_STANDALONE)
75  // Needed as we can't pick up the helper functions from AtlasHepMC in this case
76  template <class T> inline int barcode(const T& p){
77  if constexpr (std::is_pointer_v<T> || is_smart_ptr_v<T>){ //T is ptr
78  return p->barcode();
79  }
80  else {
81  return p.barcode();
82  }
83  }
84  template <> inline int barcode(const int& p){ return p;}
85 #endif
86  // Temporarily specialize uniqueID for xAOD::Truth classes ahead of the barcode migration - TODO remove this
87 #if defined(HEPMC3)
88  template <typename T> inline int uniqueID(const T& p) {
89  if constexpr (std::is_integral_v<T>) {
90  return p;
91  }
92  else if constexpr (std::is_integral_v<std::remove_pointer_t<T>>) {
93  return *p;
94  }
95  else if constexpr (std::is_same_v<T, xAOD::TruthParticle_v1> || std::is_same_v<T, xAOD::TruthVertex_v1>) {
96  return p.barcode();
97  }
98  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>) {
99  return p->barcode();
100  }
101  else if constexpr (std::is_pointer_v<T> || is_smart_ptr_v<T>){ //T is ptr
102  return p->id();
103  }
104  else {
105  return p.id();
106  }
107  }
108 #else
109  template <typename T> inline int uniqueID(const T& p) {
110  if constexpr (std::is_integral_v<T>) {
111  return p;
112  }
113  else if constexpr (std::is_integral_v<std::remove_pointer_t<T>>) {
114  return *p;
115  }
116  else if constexpr (std::is_pointer_v<T> || is_smart_ptr_v<T>){ //T is ptr
117  return p->barcode();
118  }
119  else {
120  return p.barcode();
121  }
122  }
123 #endif
124  // Temporarily specialize status for xAOD::Truth classes ahead of the barcode migration - TODO remove this
125  template <typename T> inline int status(const T& p) {
126  if constexpr (std::is_integral_v<T>) {
127  return p;
128  }
129  else if constexpr (std::is_integral_v<std::remove_pointer_t<T>>) {
130  return *p;
131  }
132  else if constexpr (std::is_same_v<T, xAOD::TruthVertex_v1>) {
133  return p.id();
134  }
135  else if constexpr (std::is_same_v<std::remove_const_t<remove_smart_pointer_t<std::remove_pointer_t<T>>>, xAOD::TruthVertex_v1>) {
136  return p->id();
137  }
138  else if constexpr (std::is_pointer_v<T> || is_smart_ptr_v<T>){ //T is ptr
139  return p->status();
140  }
141  else {
142  return p.status();
143  }
144  }
145 #if !defined(HEPMC3) && !defined(XAOD_STANDALONE)
146  template <> inline int status(const ConstGenVertexPtr& v1){ return v1->id();}
147  template <> inline int status(const GenVertexPtr& v1){ return v1->id();}
148 #endif
149 
151  template <class T> inline void get_particle_history(const T& p, std::deque<int>& out, const int direction = 0) {
152  if (direction < 0) {
153  if (p->status()>SIM_STATUS_INCREMENT) {
154  auto pv = p->production_vertex();
155  if (pv) {
156  for (auto pa: pv->particles_in()) {
157  if (pa->pdg_id() != p->pdg_id()) continue;
158  out.push_front(uniqueID(p));
159  get_particle_history(pa, out, -1);
160  break;
161  }
162  }
163  }
164  }
165  if (direction > 0) {
166  if (p->status()>SIM_STATUS_INCREMENT) {
167  auto pv = p->end_vertex();
168  if (pv) {
169  for (auto pa: pv->particles_out()) {
170  if (pa->pdg_id() != p->pdg_id()) continue;
171  out.push_back(uniqueID(p));
172  get_particle_history(pa, out, 1);
173  break;
174  }
175  }
176  }
177  }
178  }
180  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;}
181 
182  namespace BarcodeBased {
184  template <class T> inline bool is_truth_suppressed_pileup(const T& p){ return (barcode(p) == SUPPRESSED_PILEUP_BARCODE);}
185 
187  template <class T> inline bool no_truth_link(const T& p){ return (barcode(p) == UNDEFINED_ID);}
188 
190  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)); }
191 
193  template <class T> inline bool is_simulation_particle(const T& p){ return (barcode(p)>SIM_BARCODE_THRESHOLD);}
194 
196  template <class T> inline bool is_sim_secondary(const T& p){ return (barcode(p)%SIM_REGENERATION_INCREMENT > SIM_BARCODE_THRESHOLD); }
197 
199  template <class T> inline int generations(const T& p){ return (barcode(p)/SIM_REGENERATION_INCREMENT);}
200 
202  template <class T> inline bool is_simulation_vertex(const T& v){ return (barcode(v)<-SIM_BARCODE_THRESHOLD);}
203 
205  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; }
206 
208  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; }
209 
211  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;}
212  }
213 
214  namespace StatusBased {
216  template <class T> inline bool is_truth_suppressed_pileup(const T& p){
217  if constexpr (std::is_same_v<std::remove_const_t<T>, HepMcParticleLink>) {
218  return p.getTruthSuppressionType() == EBC_PU_SUPPRESSED;
219  }
220  else if constexpr (std::is_same_v<std::remove_const_t<remove_smart_pointer_t<std::remove_pointer_t<T>>>, HepMcParticleLink>) {
221  return p->getTruthSuppressionType() == EBC_PU_SUPPRESSED;
222  }
223  else {
224  return p == EBC_PU_SUPPRESSED;
225  }
226  }
227 
229  template <class T> inline bool no_truth_link(const T& p){
230  if constexpr (std::is_same_v<std::remove_const_t<T>, HepMcParticleLink>) {
231  return p.linkIsNull();
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->linkIsNull();
235  }
236  else {
237  return (uniqueID(p) == UNDEFINED_ID);
238  }
239  }
240 
242  template <class T> inline bool ignoreTruthLink(const T& p, bool vetoPileUp){
243  if constexpr (std::is_same_v<std::remove_const_t<remove_smart_pointer_t<std::remove_pointer_t<T>>>, HepMcParticleLink>) {
244  return no_truth_link(p) || (vetoPileUp && is_truth_suppressed_pileup(p));
245  }
246  else {
247  const int u = uniqueID(p); return no_truth_link(u) || (vetoPileUp && is_truth_suppressed_pileup(u));
248  }
249  }
250 
252  template <class T> inline bool is_simulation_particle(const T& p){ return (status(p)>SIM_STATUS_THRESHOLD);}
253 
255  template <class T> inline bool is_sim_secondary(const T& p){ return (status(p)%SIM_STATUS_INCREMENT > SIM_STATUS_THRESHOLD); }
256 
258  template <class T> inline int generations(const T& p){ return (status(p)/SIM_STATUS_INCREMENT);}
259 
261  template <class T> inline bool is_simulation_vertex(const T& v){ return (status(v)>SIM_STATUS_THRESHOLD);}
262 
264  template <class T1, class T2> inline bool is_same_generator_particle(const T1& p1,const T2& p2) {
265  const int id1 = uniqueID(p1);
266  const int id2 = uniqueID(p2);
267  if (id1 == id2) { return true;} // simplest case
268  const int generations1 = generations(p1);
269  const int generations2 = generations(p2);
270  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.
271  if constexpr (std::is_same_v<std::remove_const_t<remove_smart_pointer_t<std::remove_pointer_t<T1>>>, TrackRecord>) {
272  // No choice, but to get the history of one of the particles:
273  const int direction = (generations2 > generations1) ? -1 : 1;
274  std::deque<int> history2 = simulation_history( p2, direction );
275  if (std::find(history2.begin(),history2.end(), id1) == history2.end()) { return false; }
276  }
277  else {
278  // No choice, but to get the history of one of the particles:
279  const int direction = (generations1 > generations2) ? -1 : 1;
280  std::deque<int> history1 = simulation_history( p1, direction );
281  if (std::find(history1.begin(),history1.end(), id2) == history1.end()) { return false; }
282  }
283  return true;
284  }
285 
287  template <class T1, class T2> inline bool is_same_object(const T1& p1,const T2& p2) {
288  const int id1 = uniqueID(p1);
289  const int id2 = uniqueID(p2);
290  return (id1 == id2);
291  }
292 
293 
295  template <class T1, class T2> inline bool is_sim_descendant(const T1& p1,const T2& p2) {
296  const int id1 = uniqueID(p1);
297  const int id2 = uniqueID(p2);
298  if (id1 == id2) { return true;} // simplest case
299  const int generations1 = generations(p1);
300  const int generations2 = generations(p2);
301  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.
302  if constexpr (std::is_same_v<std::remove_const_t<remove_smart_pointer_t<std::remove_pointer_t<T1>>>, TrackRecord>) {
303  // No choice, but to get the descendents of p2
304  constexpr int descendents = 1;
305  std::deque<int> history2 = simulation_history( p2, descendents );
306  if (std::find(history2.begin(),history2.end(), id1) == history2.end()) { return false; }
307  }
308  else {
309  // No choice, but to get the history of p1
310  constexpr int ancestors = -1;
311  std::deque<int> history1 = simulation_history( p1, ancestors );
312  if (std::find(history1.begin(),history1.end(), id2) == history1.end()) { return false; }
313  }
314  return true;
315  }
316  }
317 
319  template <class T> inline bool is_truth_suppressed_pileup(const T& p){
320  if constexpr (std::is_same_v<std::remove_const_t<remove_smart_pointer_t<std::remove_pointer_t<T>>>, HepMcParticleLink>) {
322  }
323  else {
325  }
326  }
327 
329  template <class T> inline bool no_truth_link(const T& p){ return StatusBased::no_truth_link(p);}
330 
332  template <class T> inline bool ignoreTruthLink(const T& p, bool vetoPileUp){
333  if constexpr (std::is_same_v<std::remove_const_t<remove_smart_pointer_t<std::remove_pointer_t<T>>>, HepMcParticleLink>) {
334  return StatusBased::ignoreTruthLink(p, vetoPileUp);
335  }
336  else {
337  return BarcodeBased::ignoreTruthLink(p, vetoPileUp);
338  }
339  }
340 
342  template <class T> inline bool is_simulation_particle(const T& p){ return BarcodeBased::is_simulation_particle(p);}
343 
345  template <class T> inline int generations(const T& p){ return BarcodeBased::generations(p);}
346 
348  template <class T> inline bool is_simulation_vertex(const T& v){ return BarcodeBased::is_simulation_vertex(v);}
349 
351  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); }
352 
354  template <class T1,class T2> inline bool is_same_particle(const T1& p1,const T2& p2) { return BarcodeBased::is_same_object(p1, p2); }
355 
357  template <class T1,class T2> inline bool is_same_vertex(const T1& p1,const T2& p2) { return BarcodeBased::is_same_object(p1, p2); }
358 
360  template <class T1,class T2> inline bool is_sim_descendant(const T1& p1,const T2& p2) { return BarcodeBased::is_sim_descendant(p1, p2);}
361 
363  template <class T> void old_to_new_simulation_scheme(T& evt) {
364  auto particle_status = [] (int barcode, int status) {
368  return status;
369  };
370  auto vertex_status = [] (int barcode, int status) {
372  return status;
373  };
374 #ifdef HEPMC3
375  for (auto p: evt->particles()) {
376  p->set_status (particle_status (HepMC::barcode(p), p->status()));
377  }
378  for (auto v: evt->vertices()) {
379  v->set_status (vertex_status (HepMC::barcode(v), v->status()));
380  }
381 #else
382  for (auto p = evt->particles_begin(); p != evt->particles_end(); ++p) {
383  (*p)->set_status (particle_status ((*p)->barcode(), (*p)->status()));
384  }
385  for (auto v = evt->vertices_begin(); v != evt->vertices_end(); ++v) {
386  (*v)->set_id (vertex_status ((*v)->barcode(), (*v)->id()));
387  }
388 #endif
389  }
390 
392  inline int new_particle_status_from_old(const int oldStatus,const int barcode) {
393  int generations_barcode_based = (barcode/SIM_REGENERATION_INCREMENT);
394  bool is_sim_secondary_barcode_based = (barcode%SIM_REGENERATION_INCREMENT > SIM_BARCODE_THRESHOLD);
395  return oldStatus + SIM_STATUS_INCREMENT*generations_barcode_based + (is_sim_secondary_barcode_based? SIM_STATUS_THRESHOLD : 0);
396  }
397 
399  inline int old_particle_status_from_new(const int newStatus) { return newStatus%SIM_STATUS_THRESHOLD; }
400 
402  inline int new_vertex_status_from_old(const int oldStatus,const int barcode) {
403  bool is_simulation_vertex_barcode_based = (barcode<-SIM_BARCODE_THRESHOLD);
404  return (is_simulation_vertex_barcode_based? SIM_STATUS_THRESHOLD : 0) + oldStatus;
405  }
406 
408  inline int old_vertex_status_from_new(const int newStatus) {
409  bool is_simulation_vertex_status_based = (newStatus>SIM_STATUS_THRESHOLD);
410  return ( is_simulation_vertex_status_based ? -SIM_STATUS_THRESHOLD : 0) + newStatus; }
411 }
412 #if !defined(XAOD_STANDALONE)
413 namespace HepMC {
415 inline int maxGeneratedParticleBarcode(const HepMC::GenEvent *genEvent) {
416  int maxBarcode = 0;
417 #ifdef HEPMC3
418  auto allbarcodes = genEvent->attribute<HepMC::GenEventBarcodes>("barcodes");
419  for (const auto& bp: allbarcodes->barcode_to_particle_map()) {
420  if (!HepMC::BarcodeBased::is_simulation_particle(bp.first)) { maxBarcode=std::max(maxBarcode,bp.first); }
421  }
422 #else
423  for (auto currentGenParticle: *genEvent) {
424  const int barcode=HepMC::barcode(currentGenParticle);
425  if (barcode > maxBarcode && !HepMC::BarcodeBased::is_simulation_particle(barcode)) { maxBarcode=barcode; }
426  }
427 #endif
428  return maxBarcode;
429 }
430 
432 inline int maxGeneratedVertexBarcode(const HepMC::GenEvent *genEvent) {
433  int maxBarcode=0;
434 #ifdef HEPMC3
435  auto allbarcodes = genEvent->attribute<HepMC::GenEventBarcodes>("barcodes");
436  for (const auto& bp: allbarcodes->barcode_to_vertex_map()) {
437  if (!HepMC::BarcodeBased::is_simulation_vertex(bp.first)) { maxBarcode=std::min(maxBarcode,bp.first); }
438  }
439 #else
440  HepMC::GenEvent::vertex_const_iterator currentGenVertexIter;
441  for (currentGenVertexIter= genEvent->vertices_begin();
442  currentGenVertexIter!= genEvent->vertices_end();
443  ++currentGenVertexIter) {
444  const int barcode((*currentGenVertexIter)->barcode());
445  if (barcode < maxBarcode && !HepMC::BarcodeBased::is_simulation_vertex(barcode)) { maxBarcode=barcode; }
446  }
447 #endif
448  return maxBarcode;
449 }
450 }
451 #endif
452 
453 #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:261
EBC_SUPPRESSED_TRUTH
EBC_SUPPRESSED_TRUTH
Definition: MagicNumbers.h:27
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:408
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:36
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:357
max
#define max(a, b)
Definition: cfImp.cxx:41
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:216
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:196
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:258
EBC_NSUPP
@ EBC_NSUPP
Definition: MagicNumbers.h:30
HepMC::BarcodeBased::ignoreTruthLink
bool ignoreTruthLink(const T &p, bool vetoPileUp)
Helper function for SDO creation in PileUpTools.
Definition: MagicNumbers.h:190
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:42
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:193
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:255
GenVertex.h
TRTCalib_cfilter.p1
p1
Definition: TRTCalib_cfilter.py:130
HepMC::INVALID_PARTICLE_ID
constexpr int INVALID_PARTICLE_ID
Definition: MagicNumbers.h:56
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:432
HepMC::StatusBased::ignoreTruthLink
bool ignoreTruthLink(const T &p, bool vetoPileUp)
Helper function for SDO creation in PileUpTools.
Definition: MagicNumbers.h:242
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:211
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:229
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:332
HepMC::INVALID_PARTICLE_BARCODE
constexpr int INVALID_PARTICLE_BARCODE
Definition: MagicNumbers.h:53
HepMC::is_smart_ptr_v
constexpr bool is_smart_ptr_v
Definition: MagicNumbers.h:66
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:354
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:199
HepMC::remove_smart_pointer< std::unique_ptr< T > >::type
T type
Definition: MagicNumbers.h:70
HepMC::FORWARD_TRANSPORT_MODEL_PROCESS
constexpr int FORWARD_TRANSPORT_MODEL_PROCESS
Special Forward transport Geant process for vertices.
Definition: MagicNumbers.h:48
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:351
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:287
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:342
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:187
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:399
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:402
res
std::pair< std::vector< unsigned int >, bool > res
Definition: JetGroupProductTest.cxx:14
HepMC::uniqueID
int uniqueID(const T &p)
Definition: MagicNumbers.h:109
HepMC::remove_smart_pointer::type
T type
Definition: MagicNumbers.h:68
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:180
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:348
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:264
HepMC::remove_smart_pointer
Definition: MagicNumbers.h:68
HepMC::is_smart_ptr
Definition: MagicNumbers.h:62
min
#define min(a, b)
Definition: cfImp.cxx:40
HepMC::UNDEFINED_ID
constexpr int UNDEFINED_ID
Definition: MagicNumbers.h:55
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:39
HepMC::INVALID_VERTEX_ID
constexpr int INVALID_VERTEX_ID
Definition: MagicNumbers.h:57
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:202
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:252
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:45
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:363
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:205
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:184
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:151
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:208
HepMC::maxGeneratedParticleBarcode
int maxGeneratedParticleBarcode(const HepMC::GenEvent *genEvent)
Get the maximal value of barcode of particle present in the event.
Definition: MagicNumbers.h:415
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:295
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:72
EBC_PU_SUPPRESSED
@ EBC_PU_SUPPRESSED
Definition: MagicNumbers.h:29
HepMC::remove_smart_pointer< std::shared_ptr< T > >::type
T type
Definition: MagicNumbers.h:69
HepMC::remove_smart_pointer< std::weak_ptr< T > >::type
T type
Definition: MagicNumbers.h:71
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:360
HepMC::ConstGenVertexPtr
const HepMC::GenVertex * ConstGenVertexPtr
Definition: GenVertex.h:60
EBC_UNSUPPRESSED
@ EBC_UNSUPPRESSED
Definition: MagicNumbers.h:28
HepMC::status
int status(const T &p)
Definition: MagicNumbers.h:125
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:345
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:319
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:329
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:392