ATLAS Offline Software
Loading...
Searching...
No Matches
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.
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.
template<class T>
bool ignoreTruthLink (const T &p, bool vetoPileUp)
 Helper function for SDO creation in PileUpTools.
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.
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.
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.
template<class T>
bool is_simulation_vertex (const T &v)
 Method to establish if the vertex was created during simulation from the status.
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.
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.
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.

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 238 of file MagicNumbers.h.

238{ return (status(p)/SIM_STATUS_INCREMENT);}
constexpr int SIM_STATUS_INCREMENT
Constant defining the barcode threshold for regenerated particles, i.e. particles surviving an intera...
int status(const T &p)

◆ ignoreTruthLink()

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

Helper function for SDO creation in PileUpTools.

Definition at line 222 of file MagicNumbers.h.

222 {
223 if constexpr (std::is_same_v<std::remove_const_t<remove_smart_pointer_t<std::remove_pointer_t<T>>>, HepMcParticleLink>) {
224 return no_truth_link(p) || (vetoPileUp && is_truth_suppressed_pileup(p));
225 }
226 else {
227 const int u = uniqueID(p); return no_truth_link(u) || (vetoPileUp && is_truth_suppressed_pileup(u));
228 }
229 }
bool is_truth_suppressed_pileup(const T &p)
Method to establish if a particle corresponds to truth-suppressed pile-up.
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...
int uniqueID(const T &p)

◆ 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 244 of file MagicNumbers.h.

244 {
245 const int id1 = uniqueID(p1);
246 const int id2 = uniqueID(p2);
247 if (id1 == id2) { return true;} // simplest case
248 const int generations1 = generations(p1);
249 const int generations2 = generations(p2);
250 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.
251 if constexpr (std::is_same_v<std::remove_const_t<remove_smart_pointer_t<std::remove_pointer_t<T1>>>, TrackRecord>) {
252 // No choice, but to get the history of one of the particles:
253 const int direction = (generations2 > generations1) ? -1 : 1;
254 std::deque<int> history2 = simulation_history( p2, direction );
255 if (std::find(history2.begin(),history2.end(), id1) == history2.end()) { return false; }
256 }
257 else {
258 // No choice, but to get the history of one of the particles:
259 const int direction = (generations1 > generations2) ? -1 : 1;
260 std::deque<int> history1 = simulation_history( p1, direction );
261 if (std::find(history1.begin(),history1.end(), id2) == history1.end()) { return false; }
262 }
263 return true;
264 }
int generations(const T &p)
Method to return how many interactions a particle has undergone during simulation based on the status...
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.
const Amg::Vector3D & direction() const
Method to retrieve the direction at the Intersection.

◆ 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 267 of file MagicNumbers.h.

267 {
268 const int id1 = uniqueID(p1);
269 const int id2 = uniqueID(p2);
270 return (id1 == id2);
271 }

◆ 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 275 of file MagicNumbers.h.

275 {
276 const int id1 = uniqueID(p1);
277 const int id2 = uniqueID(p2);
278 if (id1 == id2) { return true;} // simplest case
279 const int generations1 = generations(p1);
280 const int generations2 = generations(p2);
281 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.
282 if constexpr (std::is_same_v<std::remove_const_t<remove_smart_pointer_t<std::remove_pointer_t<T1>>>, TrackRecord>) {
283 // No choice, but to get the descendents of p2
284 constexpr int descendents = 1;
285 std::deque<int> history2 = simulation_history( p2, descendents );
286 if (std::find(history2.begin(),history2.end(), id1) == history2.end()) { return false; }
287 }
288 else {
289 // No choice, but to get the history of p1
290 constexpr int ancestors = -1;
291 std::deque<int> history1 = simulation_history( p1, ancestors );
292 if (std::find(history1.begin(),history1.end(), id2) == history1.end()) { return false; }
293 }
294 return true;
295 }

◆ 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 235 of file MagicNumbers.h.

constexpr int SIM_STATUS_THRESHOLD
Constant definiting the status threshold for simulated particles, eg. can be used to separate generat...

◆ 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 232 of file MagicNumbers.h.

232{ 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 241 of file MagicNumbers.h.

241{ 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 196 of file MagicNumbers.h.

196 {
197 if constexpr (std::is_same_v<std::remove_const_t<T>, HepMcParticleLink>) {
198 return p.getTruthSuppressionType() == EBC_PU_SUPPRESSED;
199 }
200 else if constexpr (std::is_same_v<std::remove_const_t<remove_smart_pointer_t<std::remove_pointer_t<T>>>, HepMcParticleLink>) {
201 return p->getTruthSuppressionType() == EBC_PU_SUPPRESSED;
202 }
203 else {
204 return p == EBC_PU_SUPPRESSED;
205 }
206 }
@ EBC_PU_SUPPRESSED

◆ 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 209 of file MagicNumbers.h.

209 {
210 if constexpr (std::is_same_v<std::remove_const_t<T>, HepMcParticleLink>) {
211 return p.linkIsNull();
212 }
213 else if constexpr (std::is_same_v<std::remove_const_t<remove_smart_pointer_t<std::remove_pointer_t<T>>>, HepMcParticleLink>) {
214 return p->linkIsNull();
215 }
216 else {
217 return (uniqueID(p) == UNDEFINED_ID);
218 }
219 }
constexpr int UNDEFINED_ID