ATLAS Offline Software
Functions
HepMC::StatusBased Namespace Reference

Functions

template<class T >
bool is_truth_suppressed_pileup (const T &p)
 Method to establish if a particle corresponds to truth-suppressed pile-up. More...
 
template<class T >
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 Truth - for example particle was too low energy to be recorded. More...
 
template<class T >
bool ignoreTruthLink (const T &p, bool vetoPileUp)
 Helper function for SDO creation in PileUpTools. More...
 
template<class T >
bool is_simulation_particle (const T &p)
 Method to establish if a particle was created during the simulation based on the status value. More...
 
template<class T >
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 value. More...
 
template<class T >
int generations (const T &p)
 Method to return how many interactions a particle has undergone during simulation based on the status value. More...
 
template<class T >
bool is_simulation_vertex (const T &v)
 Method to establish if the vertex was created during simulation from the status. More...
 
template<class T1 , class T2 >
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. More...
 
template<class T1 , class T2 >
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. More...
 
template<class T1 , class T2 >
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, i.e. particle p1 was produced simulations particle p2. More...
 

Function Documentation

◆ generations()

template<class T >
int HepMC::StatusBased::generations ( const T &  p)
inline

Method to return how many interactions a particle has undergone during simulation based on the status value.

Definition at line 270 of file MagicNumbers.h.

270 { return (status(p)/SIM_STATUS_INCREMENT);}

◆ ignoreTruthLink()

template<class T >
bool HepMC::StatusBased::ignoreTruthLink ( const T &  p,
bool  vetoPileUp 
)
inline

Helper function for SDO creation in PileUpTools.

Definition at line 254 of file MagicNumbers.h.

254  {
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  }

◆ is_same_generator_particle()

template<class T1 , class T2 >
bool HepMC::StatusBased::is_same_generator_particle ( const T1 &  p1,
const T2 &  p2 
)
inline

Method to establish if two particles in the GenEvent actually represent the same generated particle.

Definition at line 276 of file MagicNumbers.h.

276  {
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  }

◆ is_same_object()

template<class T1 , class T2 >
bool HepMC::StatusBased::is_same_object ( const T1 &  p1,
const T2 &  p2 
)
inline

Method to establish if two particles/vertices in the GenEvent actually represent the same particle.

Definition at line 299 of file MagicNumbers.h.

299  {
300  const int id1 = uniqueID(p1);
301  const int id2 = uniqueID(p2);
302  return (id1 == id2);
303  }

◆ is_sim_descendant()

template<class T1 , class T2 >
bool HepMC::StatusBased::is_sim_descendant ( const T1 &  p1,
const T2 &  p2 
)
inline

Method to check if the first particle is a descendant of the second in the simulation, i.e. particle p1 was produced simulations particle p2.

Definition at line 307 of file MagicNumbers.h.

307  {
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  }

◆ is_sim_secondary()

template<class T >
bool HepMC::StatusBased::is_sim_secondary ( const T &  p)
inline

Method to establish if a particle is a new seondary created during the simulation based on the status value.

Definition at line 267 of file MagicNumbers.h.

◆ is_simulation_particle()

template<class T >
bool HepMC::StatusBased::is_simulation_particle ( const T &  p)
inline

Method to establish if a particle was created during the simulation based on the status value.

Definition at line 264 of file MagicNumbers.h.

264 { return (status(p)>SIM_STATUS_THRESHOLD);}

◆ is_simulation_vertex()

template<class T >
bool HepMC::StatusBased::is_simulation_vertex ( const T &  v)
inline

Method to establish if the vertex was created during simulation from the status.

Definition at line 273 of file MagicNumbers.h.

273 { return (status(v)>SIM_STATUS_THRESHOLD);}

◆ is_truth_suppressed_pileup()

template<class T >
bool HepMC::StatusBased::is_truth_suppressed_pileup ( const T &  p)
inline

Method to establish if a particle corresponds to truth-suppressed pile-up.

Definition at line 228 of file MagicNumbers.h.

228  {
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  }

◆ no_truth_link()

template<class T >
bool HepMC::StatusBased::no_truth_link ( const T &  p)
inline

Method to establish if a if the object is linked to something which was never saved to the HepMC Truth - for example particle was too low energy to be recorded.

Definition at line 241 of file MagicNumbers.h.

241  {
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  }
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
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
TRTCalib_cfilter.p1
p1
Definition: TRTCalib_cfilter.py:130
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:77
TRTCalib_cfilter.p2
p2
Definition: TRTCalib_cfilter.py:131
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:209
id2
HWIdentifier id2
Definition: LArRodBlockPhysicsV0.cxx:562
HepMC::uniqueID
int uniqueID(const T &p)
Definition: MagicNumbers.h:116
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::UNDEFINED_ID
constexpr int UNDEFINED_ID
Definition: MagicNumbers.h:56
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
HepMC::status
int status(const GenVertexPtr &v1)
Definition: MagicNumbers.h:159
TrackRecord
Definition: TrackRecord.h:12
python.PyAthena.v
v
Definition: PyAthena.py:154
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::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