ATLAS Offline Software
Loading...
Searching...
No Matches
HepMC Namespace Reference

Namespaces

namespace  BarcodeBased
namespace  StatusBased

Classes

struct  DataPool
class  GenEventBarcodes
struct  is_smart_ptr
struct  is_smart_ptr< std::shared_ptr< T > >
struct  is_smart_ptr< std::unique_ptr< T > >
struct  is_smart_ptr< std::weak_ptr< T > >
class  Polarization
struct  remove_smart_pointer
struct  remove_smart_pointer< std::shared_ptr< T > >
struct  remove_smart_pointer< std::unique_ptr< T > >
struct  remove_smart_pointer< std::weak_ptr< T > >
class  ShadowParticle
 Attribute for linking GenParticles between GenEvents. More...
class  ShortEventAttribute

Typedefs

typedef std::shared_ptr< HepMC3::VectorIntAttribute > Flow
using Print = HepMC3::Print
using GenHeavyIon = HepMC3::GenHeavyIon
using GenEvent = HepMC3::GenEvent
typedef HepMC3::GenParticlePtr GenParticlePtr
typedef HepMC3::ConstGenParticlePtr ConstGenParticlePtr
typedef HepMC3::GenVertexPtr GenVertexPtr
typedef HepMC3::ConstGenVertexPtr ConstGenVertexPtr
typedef HepMC3::GenHeavyIonPtr GenHeavyIonPtr
typedef HepMC3::HEPEVT_Wrapper HEPEVT_Wrapper
typedef std::shared_ptr< HepMC3::GenPdfInfo > GenPdfInfoPtr
typedef HepMC3::Relatives Relatives
typedef HepMC3::FourVector FourVector
typedef HepMC3::Pythia8ToHepMC3 Pythia8ToHepMC
template<class T>
using remove_smart_pointer_t = typename remove_smart_pointer<T>::type

Functions

template<class T>
int barcode (const T *p)
int barcode (int p)
template<class T, std::enable_if_t< !std::is_pointer< T >::value &&!std::is_same< T, HepMC3::GenParticlePtr >::value &&!std::is_same< T, HepMC3::ConstGenParticlePtr >::value &&!std::is_same< T, HepMC3::GenVertexPtr >::value &&!std::is_same< T, HepMC3::ConstGenVertexPtr >::value &&!std::is_same< T, HepMC3::GenVertex >::value &&!std::is_same< T, HepMC3::GenParticle >::value &&!std::is_same< T, int >::value, bool > = true>
int barcode (const T &p)
template<class T, std::enable_if_t< std::is_same< T, HepMC3::GenParticlePtr >::value||std::is_same< T, HepMC3::ConstGenParticlePtr >::value||std::is_same< T, HepMC3::GenVertexPtr >::value||std::is_same< T, HepMC3::ConstGenVertexPtr >::value, bool > = true>
int barcode (const T &p)
template<class T, std::enable_if_t< std::is_same< T, HepMC3::GenParticle >::value||std::is_same< T, HepMC3::GenVertex >::value, bool > = true>
int barcode (const T &p)
template<class T, std::enable_if_t< std::is_same< T, HepMC3::GenParticlePtr >::value||std::is_same< T, HepMC3::ConstGenParticlePtr >::value, bool > = true>
int flow (const T &p, int i)
template<class T, std::enable_if_t< std::is_same< T, HepMC3::GenParticlePtr >::value||std::is_same< T, HepMC3::ConstGenParticlePtr >::value, bool > = true>
Flow flow (const T &p)
template<class T>
void set_flow (T &a, Flow fl)
bool set_ll_event_number (HepMC3::GenEvent *e, long long int num)
long long int get_ll_event_number (const HepMC3::GenEvent *e)
std::map< std::string, std::size_t > weights_map (const HepMC3::GenEvent *e)
std::vector< HepMC3::GenParticlePtr >::const_iterator begin (HepMC3::GenEvent &e)
std::vector< HepMC3::GenParticlePtr >::const_iterator end (HepMC3::GenEvent &e)
std::vector< HepMC3::ConstGenParticlePtr >::const_iterator begin (const HepMC3::GenEvent &e)
std::vector< HepMC3::ConstGenParticlePtr >::const_iterator end (const HepMC3::GenEvent &e)
GenEventnewGenEvent (const int signal_process_id, const int event_number)
GenEventcopyemptyGenEvent (const GenEvent *inEvt)
void fillBarcodesAttribute (GenEvent *e)
ConstGenVertexPtr barcode_to_vertex (const GenEvent *e, int id)
ConstGenParticlePtr barcode_to_particle (const GenEvent *e, int id)
GenVertexPtr barcode_to_vertex (GenEvent *e, int id)
GenParticlePtr barcode_to_particle (GenEvent *e, int id)
int mpi (const GenEvent &evt)
int mpi (const GenEvent *evt)
int signal_process_id (const GenEvent &evt)
int signal_process_id (const GenEvent *evt)
void set_signal_process_id (GenEvent *e, const int i=0)
void set_mpi (GenEvent *e, const int i=0)
void set_random_states (GenEvent *e, std::vector< long int > &a)
template<class T>
void set_signal_process_vertex (GenEvent *e, T &v)
ConstGenVertexPtr signal_process_vertex (const GenEvent *e)
GenVertexPtr signal_process_vertex (GenEvent *e)
bool valid_beam_particles (const GenEvent *e)
template<class T>
bool suggest_barcode (T &p, int i)
GenParticlePtr newGenParticlePtr (const HepMC3::FourVector &mom=HepMC3::FourVector::ZERO_VECTOR(), int pid=0, int status=0)
ConstGenParticlePtr newConstGenParticlePtr (const HepMC3::FourVector &mom=HepMC3::FourVector::ZERO_VECTOR(), int pid=0, int status=0)
GenVertexPtr newGenVertexPtr (const HepMC3::FourVector &pos=HepMC3::FourVector::ZERO_VECTOR(), const int i=0)
template<class T, std::enable_if_t< std::is_same< T, HepMC3::GenParticlePtr >::value||std::is_same< T, HepMC3::ConstGenParticlePtr >::value, bool > = true>
Polarization polarization (const T &a)
template<class T>
void set_polarization (T &a, const Polarization &b)
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 Production.
template<typename T>
int uniqueID (const T &p)
template<typename T>
int status (const T &p)
template<class T>
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.
template<class T>
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.
template<class T>
bool is_truth_suppressed_pileup (const T &p)
 Method to establish if a particle (or barcode) corresponds to truth-suppressed pile-up (TODO update to be status based).
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 (or barcode) was created during the simulation (TODO update to be status based).
template<class T>
int generations (const T &p)
 Method to return how many interactions a particle has undergone during simulation (TODO migrate to be based on status).
template<class T>
bool is_simulation_vertex (const T &v)
 Method to establish if the vertex was created during simulation (TODO migrate to be based on 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_particle (const T1 &p1, const T2 &p2)
 Method to establish if two particles in the GenEvent actually represent the same particle.
template<class T1, class T2>
bool is_same_vertex (const T1 &p1, const T2 &p2)
 Method to establish if two particles in the GenEvent actually represent the same vertex.
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.
template<class T>
void old_to_new_simulation_scheme (T &evt)
 Function that converts the old scheme of labeling the simulation particles (barcodes) into the new scheme (statuses).
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.
int old_particle_status_from_new (const int newStatus)
 Get particle status in the old scheme from the status in the new scheme.
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.
int old_vertex_status_from_new (const int newStatus)
 Get vertex status in the old scheme from the status in the new scheme.
int maxGeneratedParticleBarcode (const HepMC::GenEvent *genEvent)
 Get the maximal value of barcode of particle present in the event.
int maxGeneratedVertexBarcode (const HepMC::GenEvent *genEvent)
 Get the maximal absolute value of barcode of vertex present in the event. Returns a negative number.

Variables

constexpr int SIM_BARCODE_THRESHOLD = 200000
 Constant defining the barcode threshold for simulated particles, eg. can be used to separate generator event record entries from simulated particles.
constexpr int SIM_REGENERATION_INCREMENT = 1000000
 Constant defining the barcode threshold for regenerated particles, i.e. particles surviving an interaction.
constexpr int SIM_STATUS_INCREMENT = 100000
 Constant defining the barcode threshold for regenerated particles, i.e. particles surviving an interaction.
constexpr int SIM_STATUS_THRESHOLD = 20000
 Constant definiting the status threshold for simulated particles, eg. can be used to separate generator event record entries from simulated particles.
constexpr int FORWARD_TRANSPORT_MODEL_PROCESS = 212
 Special Forward transport Geant process for vertices.
constexpr int INVALID_PARTICLE_BARCODE = -1
constexpr int UNDEFINED_ID = 0
constexpr int INVALID_PARTICLE_ID = -1
constexpr int INVALID_VERTEX_ID = 1
template<class T>
constexpr bool is_smart_ptr_v = is_smart_ptr<T>::value

Typedef Documentation

◆ ConstGenParticlePtr

typedef HepMC3::ConstGenParticlePtr HepMC::ConstGenParticlePtr

Definition at line 20 of file GenParticle.h.

◆ ConstGenVertexPtr

typedef HepMC3::ConstGenVertexPtr HepMC::ConstGenVertexPtr

Definition at line 24 of file GenVertex.h.

◆ Flow

typedef std::shared_ptr<HepMC3::VectorIntAttribute> HepMC::Flow

Definition at line 13 of file Flow.h.

◆ FourVector

typedef HepMC3::FourVector HepMC::FourVector

Definition at line 11 of file SimpleVector.h.

◆ GenEvent

using HepMC::GenEvent = HepMC3::GenEvent

Definition at line 39 of file GenEvent.h.

◆ GenHeavyIon

using HepMC::GenHeavyIon = HepMC3::GenHeavyIon

Definition at line 38 of file GenEvent.h.

◆ GenHeavyIonPtr

typedef HepMC3::GenHeavyIonPtr HepMC::GenHeavyIonPtr

Definition at line 11 of file HeavyIon.h.

◆ GenParticlePtr

typedef HepMC3::GenParticlePtr HepMC::GenParticlePtr

Definition at line 19 of file GenParticle.h.

◆ GenPdfInfoPtr

typedef std::shared_ptr<HepMC3::GenPdfInfo> HepMC::GenPdfInfoPtr

Definition at line 11 of file PdfInfo.h.

◆ GenVertexPtr

typedef HepMC3::GenVertexPtr HepMC::GenVertexPtr

Definition at line 23 of file GenVertex.h.

◆ HEPEVT_Wrapper

typedef HepMC3::HEPEVT_Wrapper HepMC::HEPEVT_Wrapper

Definition at line 14 of file HEPEVT_Wrapper.h.

◆ Print

using HepMC::Print = HepMC3::Print

Definition at line 37 of file GenEvent.h.

◆ Pythia8ToHepMC

typedef HepMC3::Pythia8ToHepMC3 HepMC::Pythia8ToHepMC

Definition at line 20 of file Pythia8_i.h.

◆ Relatives

typedef HepMC3::Relatives HepMC::Relatives

Definition at line 10 of file Relatives.h.

◆ remove_smart_pointer_t

template<class T>
using HepMC::remove_smart_pointer_t = typename remove_smart_pointer<T>::type

Definition at line 74 of file MagicNumbers.h.

Function Documentation

◆ barcode() [1/5]

template<class T, std::enable_if_t< std::is_same< T, HepMC3::GenParticle >::value||std::is_same< T, HepMC3::GenVertex >::value, bool > = true>
int HepMC::barcode ( const T & p)
inline

Definition at line 46 of file Barcode.h.

46 {
47 const HepMC3::GenEvent* e = p.parent_event();
48 if (!e) return 0;
49 std::shared_ptr<HepMC3::IntAttribute> barcode = e->attribute<HepMC3::IntAttribute>(HepMCStr::barcode, p.id());
50 return barcode ? (barcode->value()) : p.id();
51}
int barcode(const T *p)
Definition Barcode.h:15

◆ barcode() [2/5]

template<class T, std::enable_if_t< std::is_same< T, HepMC3::GenParticlePtr >::value||std::is_same< T, HepMC3::ConstGenParticlePtr >::value||std::is_same< T, HepMC3::GenVertexPtr >::value||std::is_same< T, HepMC3::ConstGenVertexPtr >::value, bool > = true>
int HepMC::barcode ( const T & p)
inline

Definition at line 34 of file Barcode.h.

34 {
35 if (!p) return 0;
36 const HepMC3::GenEvent* e = p->parent_event();
37 if (!e) return 0;
38 std::shared_ptr<HepMC3::IntAttribute> barcode = e->attribute<HepMC3::IntAttribute>(HepMCStr::barcode, p->id());
39 return barcode ? (barcode->value()) : p->id();
40}

◆ barcode() [3/5]

template<class T, std::enable_if_t< !std::is_pointer< T >::value &&!std::is_same< T, HepMC3::GenParticlePtr >::value &&!std::is_same< T, HepMC3::ConstGenParticlePtr >::value &&!std::is_same< T, HepMC3::GenVertexPtr >::value &&!std::is_same< T, HepMC3::ConstGenVertexPtr >::value &&!std::is_same< T, HepMC3::GenVertex >::value &&!std::is_same< T, HepMC3::GenParticle >::value &&!std::is_same< T, int >::value, bool > = true>
int HepMC::barcode ( const T & p)
inline

Definition at line 26 of file Barcode.h.

26{ return p.barcode();}

◆ barcode() [4/5]

template<class T>
int HepMC::barcode ( const T * p)
inline

Definition at line 15 of file Barcode.h.

15{ return p->barcode(); }

◆ barcode() [5/5]

int HepMC::barcode ( int p)
inline

Definition at line 16 of file Barcode.h.

16{ return p; }

◆ barcode_to_particle() [1/2]

ConstGenParticlePtr HepMC::barcode_to_particle ( const GenEvent * e,
int id )
inline

Definition at line 443 of file GenEvent.h.

443 {
444 // Prefer to use optimized GenEvent barcodes attribute
445 const auto &barcodes = e->attribute<GenEventBarcodes> (HepMCStr::barcodes);
446 if (barcodes) {
447 ConstGenParticlePtr ptr = barcodes->barcode_to_particle (id);
448 if (ptr) return ptr;
449 }
450 // Fallback to unoptimized GenParticle barcode attribute
451 const auto eventAttributes = e->attributes(); // this makes a copy
452 const auto barcodeAttributeIt = eventAttributes.find(HepMCStr::barcode);
453 const bool hasBarcodeAttribute = barcodeAttributeIt != eventAttributes.end();
454
455 const auto &particles = e->particles();
456 if (hasBarcodeAttribute) {
457 for (size_t i = 1; i <= particles.size(); i++) {
458 const auto &ptrIt = barcodeAttributeIt->second.find(i);
459 if (ptrIt != barcodeAttributeIt->second.end()) {
460 const auto &ptr = ptrIt->second;
461 if (ptr->is_parsed()) {
462 if (id == static_cast<HepMC3::IntAttribute*>(ptr.get())->value()) {
463 return ptr->particle();
464 }
465 }
466 else {
467 if (id == std::atoi(ptr->unparsed_string().c_str())) {
468 return ptr->particle();
469 }
470 }
471 }
472 }
473 }
474 // No barcodes attribute, so assume that we are passing the id member variable instead of a barcode
475 if (id > 0 && id <= static_cast<int>(particles.size())) {
476 if (!particles[id-1]->attribute<HepMC3::IntAttribute>(HepMCStr::barcode)) {
477 return particles[id-1];
478 }
479 }
480 return HepMC3::ConstGenParticlePtr();
481}
HepMC3::ConstGenParticlePtr ConstGenParticlePtr
Definition GenParticle.h:20
void * ptr(T *p)
Definition SGImplSvc.cxx:74

◆ barcode_to_particle() [2/2]

GenParticlePtr HepMC::barcode_to_particle ( GenEvent * e,
int id )
inline

Definition at line 523 of file GenEvent.h.

523 {
524 // Prefer to use optimized GenEvent barcodes attribute
525 const auto &barcodes = e->attribute<GenEventBarcodes> (HepMCStr::barcodes);
526 if (barcodes) {
527 GenParticlePtr ptr = barcodes->barcode_to_particle (id);
528 if (ptr) return ptr;
529 }
530 // Fallback to unoptimized GenParticle barcode attribute
531 const auto eventAttributes = e->attributes(); // this makes a copy
532 const auto barcodeAttributeIt = eventAttributes.find(HepMCStr::barcode);
533 const bool hasBarcodeAttribute = barcodeAttributeIt != eventAttributes.end();
534
535 const auto &particles = e->particles();
536 if (hasBarcodeAttribute) {
537 for (size_t i = 1; i <= particles.size(); i++) {
538 const auto &ptrIt = barcodeAttributeIt->second.find(i);
539 if (ptrIt != barcodeAttributeIt->second.end()) {
540 const auto &ptr = ptrIt->second;
541 if (ptr->is_parsed()) {
542 if (id == static_cast<HepMC3::IntAttribute*>(ptr.get())->value()) {
543 return ptr->particle();
544 }
545 }
546 else {
547 if (id == std::atoi(ptr->unparsed_string().c_str())) {
548 return ptr->particle();
549 }
550 }
551 }
552 }
553 }
554 // No barcodes attribute, so assume that we are passing the id member variable instead of a barcode
555 if (id > 0 && id <= static_cast<int>(particles.size())) {
556 if (!particles[id-1]->attribute<HepMC3::IntAttribute>(HepMCStr::barcode)) {
557 return particles[id-1];
558 }
559 }
560 return HepMC3::GenParticlePtr();
561}
HepMC3::GenParticlePtr GenParticlePtr
Definition GenParticle.h:19

◆ barcode_to_vertex() [1/2]

ConstGenVertexPtr HepMC::barcode_to_vertex ( const GenEvent * e,
int id )
inline

Definition at line 403 of file GenEvent.h.

403 {
404 // Prefer to use optimized GenEvent barcodes attribute
405 const auto &barcodes = e->attribute<GenEventBarcodes> (HepMCStr::barcodes);
406 if (barcodes) {
407 ConstGenVertexPtr ptr = barcodes->barcode_to_vertex (id);
408 if (ptr) return ptr;
409 }
410 // Fallback to unoptimized GenVertex barcode attribute
411 const auto eventAttributes = e->attributes(); // this makes a copy
412 const auto barcodeAttributeIt = eventAttributes.find(HepMCStr::barcode);
413 const bool hasBarcodeAttribute = barcodeAttributeIt != eventAttributes.end();
414
415 const auto &vertices = e->vertices();
416 if (hasBarcodeAttribute) {
417 for (size_t i = 1; i <= vertices.size(); i++) {
418 const auto &ptrIt = barcodeAttributeIt->second.find(-i);
419 if (ptrIt != barcodeAttributeIt->second.end()) {
420 const auto &ptr = ptrIt->second;
421 if (ptr->is_parsed()) {
422 if (id == static_cast<HepMC3::IntAttribute*>(ptr.get())->value()) {
423 return ptr->vertex();
424 }
425 }
426 else {
427 if (id == std::atoi(ptr->unparsed_string().c_str())) {
428 return ptr->vertex();
429 }
430 }
431 }
432 }
433 }
434 // No barcodes attribute, so assume that we are passing the id member variable instead of a barcode
435 if (-id > 0 && -id <= static_cast<int>(vertices.size())) {
436 if (!vertices[-id-1]->attribute<HepMC3::IntAttribute>(HepMCStr::barcode)) {
437 return vertices[-id-1];
438 }
439 }
440 return HepMC3::ConstGenVertexPtr();
441}
HepMC3::ConstGenVertexPtr ConstGenVertexPtr
Definition GenVertex.h:24

◆ barcode_to_vertex() [2/2]

GenVertexPtr HepMC::barcode_to_vertex ( GenEvent * e,
int id )
inline

Definition at line 483 of file GenEvent.h.

483 {
484 // Prefer to use optimized GenEvent barcodes attribute
485 const auto &barcodes = e->attribute<GenEventBarcodes> (HepMCStr::barcodes);
486 if (barcodes) {
487 GenVertexPtr ptr = barcodes->barcode_to_vertex (id);
488 if (ptr) return ptr;
489 }
490 // Fallback to unoptimized GenVertex barcode attribute
491 const auto eventAttributes = e->attributes(); // this makes a copy
492 const auto barcodeAttributeIt = eventAttributes.find(HepMCStr::barcode);
493 const bool hasBarcodeAttribute = barcodeAttributeIt != eventAttributes.end();
494
495 const auto &vertices = e->vertices();
496 if (hasBarcodeAttribute) {
497 for (size_t i = 1; i <= vertices.size(); i++) {
498 const auto &ptrIt = barcodeAttributeIt->second.find(-i);
499 if (ptrIt != barcodeAttributeIt->second.end()) {
500 const auto &ptr = ptrIt->second;
501 if (ptr->is_parsed()) {
502 if (id == static_cast<HepMC3::IntAttribute*>(ptr.get())->value()) {
503 return ptr->vertex();
504 }
505 }
506 else {
507 if (id == std::atoi(ptr->unparsed_string().c_str())) {
508 return ptr->vertex();
509 }
510 }
511 }
512 }
513 }
514 // No barcodes attribute, so assume that we are passing the id member variable instead of a barcode
515 if (-id > 0 && -id <= static_cast<int>(vertices.size())) {
516 if (!vertices[-id-1]->attribute<HepMC3::IntAttribute>(HepMCStr::barcode)) {
517 return vertices[-id-1];
518 }
519 }
520 return HepMC3::GenVertexPtr();
521}
HepMC3::GenVertexPtr GenVertexPtr
Definition GenVertex.h:23

◆ begin() [1/2]

std::vector< HepMC3::ConstGenParticlePtr >::const_iterator HepMC::begin ( const HepMC3::GenEvent & e)
inline

Definition at line 357 of file GenEvent.h.

357{ return e.particles().begin(); }

◆ begin() [2/2]

std::vector< HepMC3::GenParticlePtr >::const_iterator HepMC::begin ( HepMC3::GenEvent & e)
inline

Definition at line 355 of file GenEvent.h.

355{ return e.particles().begin(); }

◆ copyemptyGenEvent()

GenEvent * HepMC::copyemptyGenEvent ( const GenEvent * inEvt)
inline

Definition at line 369 of file GenEvent.h.

369 {
370 GenEvent* e = new GenEvent();
371 e->set_event_number(inEvt->event_number());
372 e->weights() = inEvt->weights();
373 auto a_mpi = inEvt->attribute<HepMC3::IntAttribute>(HepMCStr::mpi);
374 if (a_mpi) e->add_attribute(HepMCStr::mpi, std::make_shared<HepMC3::IntAttribute>(*a_mpi));
375 auto a_signal_process_id = inEvt->attribute<HepMC3::IntAttribute>(HepMCStr::signal_process_id);
376 if (a_signal_process_id) e->add_attribute(HepMCStr::signal_process_id, std::make_shared<HepMC3::IntAttribute>(*a_signal_process_id));
377 auto a_event_scale = inEvt->attribute<HepMC3::DoubleAttribute>(HepMCStr::event_scale);
378 if (a_event_scale) e->add_attribute(HepMCStr::event_scale, std::make_shared<HepMC3::DoubleAttribute>(*a_event_scale));
379 auto a_alphaQCD = inEvt->attribute<HepMC3::DoubleAttribute>(HepMCStr::alphaQCD);
380 if (a_alphaQCD) e->add_attribute(HepMCStr::alphaQCD, std::make_shared<HepMC3::DoubleAttribute>(*a_alphaQCD));
381 auto a_alphaQED = inEvt->attribute<HepMC3::DoubleAttribute>(HepMCStr::alphaQED);
382 if (a_alphaQED) e->add_attribute(HepMCStr::alphaQED, std::make_shared<HepMC3::DoubleAttribute>(*a_alphaQED));
383 auto a_pi = inEvt->pdf_info();
384 if (a_pi) e->set_pdf_info(std::make_shared<HepMC3::GenPdfInfo>(*a_pi));
385 auto a_hi = inEvt->heavy_ion();
386 if (a_hi) e->set_heavy_ion(std::make_shared<HepMC3::GenHeavyIon>(*a_hi));
387 auto a_random_states = inEvt->attribute<HepMC3::VectorLongIntAttribute>(HepMCStr::random_states);
388 if (a_random_states) e->add_attribute(HepMCStr::random_states, std::make_shared<HepMC3::VectorLongIntAttribute>(*a_random_states));
389 e->add_attribute(HepMCStr::barcodes, std::make_shared<GenEventBarcodes>());
390 return e;
391}
HepMC3::GenEvent GenEvent
Definition GenEvent.h:39

◆ end() [1/2]

std::vector< HepMC3::ConstGenParticlePtr >::const_iterator HepMC::end ( const HepMC3::GenEvent & e)
inline

Definition at line 358 of file GenEvent.h.

358{ return e.particles().end(); }

◆ end() [2/2]

std::vector< HepMC3::GenParticlePtr >::const_iterator HepMC::end ( HepMC3::GenEvent & e)
inline

Definition at line 356 of file GenEvent.h.

356{ return e.particles().end(); }

◆ fillBarcodesAttribute()

void HepMC::fillBarcodesAttribute ( GenEvent * e)
inline

Definition at line 393 of file GenEvent.h.

393 {
394 auto barcodes = e->attribute<GenEventBarcodes> (HepMCStr::barcodes);
395 if (!barcodes) {
396 barcodes = std::make_shared<GenEventBarcodes>();
397 e->add_attribute(HepMCStr::barcodes, barcodes);
398 }
399 // force re-parsing as calling barcodes->is_parsed() returns true here
400 barcodes->fillAttribute(e);
401}

◆ flow() [1/2]

template<class T, std::enable_if_t< std::is_same< T, HepMC3::GenParticlePtr >::value||std::is_same< T, HepMC3::ConstGenParticlePtr >::value, bool > = true>
Flow HepMC::flow ( const T & p)
inline

Definition at line 21 of file Flow.h.

21 {
22 std::shared_ptr<HepMC3::VectorIntAttribute> vf = p->template attribute<HepMC3::VectorIntAttribute>(HepMCStr::flow);
23 if (vf) return vf;
24
25 std::vector<int> fl;
26 for (int i = 1; i <= 10; i++) {
27 std::shared_ptr<HepMC3::IntAttribute> f = p->template attribute<HepMC3::IntAttribute>("flow" + std::to_string(i)); if (f) fl.push_back(i); else break;
28 }
29 return std::make_shared<HepMC3::VectorIntAttribute>(fl);
30}

◆ flow() [2/2]

template<class T, std::enable_if_t< std::is_same< T, HepMC3::GenParticlePtr >::value||std::is_same< T, HepMC3::ConstGenParticlePtr >::value, bool > = true>
int HepMC::flow ( const T & p,
int i )
inline

Definition at line 15 of file Flow.h.

15 {
16 std::shared_ptr<HepMC3::IntAttribute> f = p->template attribute<HepMC3::IntAttribute>("flow" + std::to_string(i)); if (f) return f->value();
17 std::shared_ptr<HepMC3::VectorIntAttribute> vf = p->template attribute<HepMC3::VectorIntAttribute>(HepMCStr::flow); if (vf) if (0 < i && i < (int)(vf->value().size())) return vf->value().at(i);
18 return 0;
19}

◆ generations()

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

Method to return how many interactions a particle has undergone during simulation (TODO migrate to be based on status).

Definition at line 325 of file MagicNumbers.h.

325{ return StatusBased::generations(p);}
int generations(const T &p)
Method to return how many interactions a particle has undergone during simulation based on the status...

◆ get_ll_event_number()

long long int HepMC::get_ll_event_number ( const HepMC3::GenEvent * e)
inline

Definition at line 341 of file GenEvent.h.

341 {
342 auto at = e->attribute<HepMC3::LongLongAttribute>(HepMCStr::long_long_event_number);
343 return at ? at->value() : e->event_number();
344}

◆ get_particle_history()

template<class T>
void HepMC::get_particle_history ( const T & p,
std::deque< int > & out,
const int direction = 0 )
inline

Function to calculate all the descendants(direction=1)/ancestors(direction=-1) of the particle.

Definition at line 131 of file MagicNumbers.h.

131 {
132 if (direction < 0) {
133 if (p->status()>SIM_STATUS_INCREMENT) {
134 auto pv = p->production_vertex();
135 if (pv) {
136 for (auto pa: pv->particles_in()) {
137 if (!pa || pa->pdg_id() != p->pdg_id()) continue;
138 out.push_front(uniqueID(p));
139 get_particle_history(pa, out, -1);
140 break;
141 }
142 }
143 }
144 }
145 if (direction > 0) {
146 if (p->status()>SIM_STATUS_INCREMENT) {
147 auto pv = p->end_vertex();
148 if (pv) {
149 for (auto pa: pv->particles_out()) {
150 if (!pa || pa->pdg_id() != p->pdg_id()) continue;
151 out.push_back(uniqueID(p));
152 get_particle_history(pa, out, 1);
153 break;
154 }
155 }
156 }
157 }
158 }
int uniqueID(const T &p)
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.
constexpr int SIM_STATUS_INCREMENT
Constant defining the barcode threshold for regenerated particles, i.e. particles surviving an intera...

◆ ignoreTruthLink()

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

Helper function for SDO creation in PileUpTools.

Definition at line 312 of file MagicNumbers.h.

312 {
313 if constexpr (std::is_same_v<std::remove_const_t<remove_smart_pointer_t<std::remove_pointer_t<T>>>, HepMcParticleLink>) {
314 return StatusBased::ignoreTruthLink(p, vetoPileUp);
315 }
316 else {
317 return BarcodeBased::ignoreTruthLink(p, vetoPileUp);
318 }
319 }
bool ignoreTruthLink(const T &p, bool vetoPileUp)
Helper function for SDO creation in PileUpTools.
bool ignoreTruthLink(const T &p, bool vetoPileUp)
Helper function for SDO creation in PileUpTools.

◆ is_same_generator_particle()

template<class T1, class T2>
bool HepMC::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 331 of file MagicNumbers.h.

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.

◆ is_same_particle()

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

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

Definition at line 334 of file MagicNumbers.h.

334{ return StatusBased::is_same_object(p1, p2); }
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.

◆ is_same_vertex()

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

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

Definition at line 337 of file MagicNumbers.h.

337{ return StatusBased::is_same_object(p1, p2); }

◆ is_sim_descendant()

template<class T1, class T2>
bool HepMC::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 340 of file MagicNumbers.h.

340{ return StatusBased::is_sim_descendant(p1, p2);}
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,...

◆ is_simulation_particle()

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

Method to establish if a particle (or barcode) was created during the simulation (TODO update to be status based).

Definition at line 322 of file MagicNumbers.h.

bool is_simulation_particle(const T &p)
Method to establish if a particle was created during the simulation based on the status value.

◆ is_simulation_vertex()

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

Method to establish if the vertex was created during simulation (TODO migrate to be based on status).

Definition at line 328 of file MagicNumbers.h.

bool is_simulation_vertex(const T &v)
Method to establish if the vertex was created during simulation from the status.

◆ is_truth_suppressed_pileup()

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

Method to establish if a particle (or barcode) corresponds to truth-suppressed pile-up (TODO update to be status based).

Definition at line 299 of file MagicNumbers.h.

299 {
300 if constexpr (std::is_same_v<std::remove_const_t<remove_smart_pointer_t<std::remove_pointer_t<T>>>, HepMcParticleLink>) {
302 }
303 else {
305 }
306 }
bool is_truth_suppressed_pileup(const T &p)
Method to establish if a particle (or barcode) corresponds to truth-suppressed pile-up.
bool is_truth_suppressed_pileup(const T &p)
Method to establish if a particle corresponds to truth-suppressed pile-up.

◆ maxGeneratedParticleBarcode()

int HepMC::maxGeneratedParticleBarcode ( const HepMC::GenEvent * genEvent)
inline

Get the maximal value of barcode of particle present in the event.

Definition at line 386 of file MagicNumbers.h.

386 {
387 int maxBarcode = 0;
388 auto allbarcodes = genEvent->attribute<HepMC::GenEventBarcodes>(HepMCStr::barcodes);
389 for (const auto& bp: allbarcodes->barcode_to_particle_map()) {
390 if (!HepMC::BarcodeBased::is_simulation_particle(bp.first)) { maxBarcode=std::max(maxBarcode,bp.first); }
391 }
392 return maxBarcode;
393}
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 ...

◆ maxGeneratedVertexBarcode()

int HepMC::maxGeneratedVertexBarcode ( const HepMC::GenEvent * genEvent)
inline

Get the maximal absolute value of barcode of vertex present in the event. Returns a negative number.

Definition at line 396 of file MagicNumbers.h.

396 {
397 int maxBarcode=0;
398 auto allbarcodes = genEvent->attribute<HepMC::GenEventBarcodes>(HepMCStr::barcodes);
399 for (const auto& bp: allbarcodes->barcode_to_vertex_map()) {
400 if (!HepMC::BarcodeBased::is_simulation_vertex(bp.first)) { maxBarcode=std::min(maxBarcode,bp.first); }
401 }
402 return maxBarcode;
403}
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...

◆ mpi() [1/2]

int HepMC::mpi ( const GenEvent & evt)
inline

Definition at line 563 of file GenEvent.h.

563 {
564 std::shared_ptr<HepMC3::IntAttribute> A_mpi = evt.attribute<HepMC3::IntAttribute>(HepMCStr::mpi);
565 return A_mpi ? (A_mpi->value()) : 0;
566}

◆ mpi() [2/2]

int HepMC::mpi ( const GenEvent * evt)
inline

Definition at line 567 of file GenEvent.h.

567 {
568 std::shared_ptr<HepMC3::IntAttribute> A_mpi = evt->attribute<HepMC3::IntAttribute>(HepMCStr::mpi);
569 return A_mpi ? (A_mpi->value()) : 0;
570}

◆ new_particle_status_from_old()

int HepMC::new_particle_status_from_old ( const int oldStatus,
const int barcode )
inline

Get particle status in the new scheme from the barcode and status in the old scheme.

Definition at line 363 of file MagicNumbers.h.

363 {
364 int generations_barcode_based = (barcode/SIM_REGENERATION_INCREMENT);
365 bool is_sim_secondary_barcode_based = (barcode%SIM_REGENERATION_INCREMENT > SIM_BARCODE_THRESHOLD);
366 return oldStatus + SIM_STATUS_INCREMENT*generations_barcode_based + (is_sim_secondary_barcode_based? SIM_STATUS_THRESHOLD : 0);
367 }
constexpr int SIM_STATUS_THRESHOLD
Constant definiting the status threshold for simulated particles, eg. can be used to separate generat...
constexpr int SIM_BARCODE_THRESHOLD
Constant defining the barcode threshold for simulated particles, eg. can be used to separate generato...
constexpr int SIM_REGENERATION_INCREMENT
Constant defining the barcode threshold for regenerated particles, i.e. particles surviving an intera...

◆ new_vertex_status_from_old()

int HepMC::new_vertex_status_from_old ( const int oldStatus,
const int barcode )
inline

Get vertex status in the new scheme from the barcode and status in the old scheme.

Definition at line 373 of file MagicNumbers.h.

373 {
374 bool is_simulation_vertex_barcode_based = (barcode<-SIM_BARCODE_THRESHOLD);
375 return (is_simulation_vertex_barcode_based? SIM_STATUS_THRESHOLD : 0) + oldStatus;
376 }

◆ newConstGenParticlePtr()

ConstGenParticlePtr HepMC::newConstGenParticlePtr ( const HepMC3::FourVector & mom = HepMC3::FourVector::ZERO_VECTOR(),
int pid = 0,
int status = 0 )
inline

Definition at line 24 of file GenParticle.h.

24 {
25 return std::make_shared<const HepMC3::GenParticle>(mom, pid, status);
26}
int status(const T &p)

◆ newGenEvent()

GenEvent * HepMC::newGenEvent ( const int signal_process_id,
const int event_number )
inline

Definition at line 360 of file GenEvent.h.

360 { // TODO Update event_number to long long int?
361 GenEvent* e = new GenEvent();
362 std::shared_ptr<HepMC3::IntAttribute> signal_process_id_A = std::make_shared<HepMC3::IntAttribute>(signal_process_id);
363 e->add_attribute(HepMCStr::signal_process_id, signal_process_id_A);
364 e->add_attribute(HepMCStr::barcodes, std::make_shared<GenEventBarcodes>());
365 e->set_event_number(event_number);
366 return e;
367}
int signal_process_id(const GenEvent &evt)
Definition GenEvent.h:572

◆ newGenParticlePtr()

GenParticlePtr HepMC::newGenParticlePtr ( const HepMC3::FourVector & mom = HepMC3::FourVector::ZERO_VECTOR(),
int pid = 0,
int status = 0 )
inline

Definition at line 21 of file GenParticle.h.

21 {
22 return std::make_shared<HepMC3::GenParticle>(mom, pid, status);
23}

◆ newGenVertexPtr()

GenVertexPtr HepMC::newGenVertexPtr ( const HepMC3::FourVector & pos = HepMC3::FourVector::ZERO_VECTOR(),
const int i = 0 )
inline

Definition at line 25 of file GenVertex.h.

25 {
26 GenVertexPtr v = std::make_shared<HepMC3::GenVertex>(pos);
27 v->set_status(i);
28 return v;
29}

◆ no_truth_link()

template<class T>
bool HepMC::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 309 of file MagicNumbers.h.

309{ return StatusBased::no_truth_link(p);}
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...

◆ old_particle_status_from_new()

int HepMC::old_particle_status_from_new ( const int newStatus)
inline

Get particle status in the old scheme from the status in the new scheme.

Definition at line 370 of file MagicNumbers.h.

370{ return newStatus%SIM_STATUS_THRESHOLD; }

◆ old_to_new_simulation_scheme()

template<class T>
void HepMC::old_to_new_simulation_scheme ( T & evt)

Function that converts the old scheme of labeling the simulation particles (barcodes) into the new scheme (statuses).

Definition at line 343 of file MagicNumbers.h.

343 {
344 auto particle_status = [] (int barcode, int status) {
348 return status;
349 };
350 auto vertex_status = [] (int barcode, int status) {
352 return status;
353 };
354 for (auto p: evt->particles()) {
355 p->set_status (particle_status (HepMC::barcode(p), p->status()));
356 }
357 for (auto v: evt->vertices()) {
358 v->set_status (vertex_status (HepMC::barcode(v), v->status()));
359 }
360 }

◆ old_vertex_status_from_new()

int HepMC::old_vertex_status_from_new ( const int newStatus)
inline

Get vertex status in the old scheme from the status in the new scheme.

Definition at line 379 of file MagicNumbers.h.

379 {
380 bool is_simulation_vertex_status_based = (newStatus>SIM_STATUS_THRESHOLD);
381 return ( is_simulation_vertex_status_based ? -SIM_STATUS_THRESHOLD : 0) + newStatus; }

◆ polarization()

template<class T, std::enable_if_t< std::is_same< T, HepMC3::GenParticlePtr >::value||std::is_same< T, HepMC3::ConstGenParticlePtr >::value, bool > = true>
Polarization HepMC::polarization ( const T & a)
inline

Definition at line 28 of file Polarization.h.

28 {
29 std::shared_ptr<HepMC3::DoubleAttribute> phi_A = a->template attribute<HepMC3::DoubleAttribute>(HepMCStr::phi);
30 std::shared_ptr<HepMC3::DoubleAttribute> theta_A = a->template attribute<HepMC3::DoubleAttribute>(HepMCStr::theta);
31 const double phi = (phi_A ? phi_A->value() : 0.0);
32 const double theta = (theta_A ? theta_A->value() : 0.0);
33 const bool is_defined = phi_A && theta_A;
34 return Polarization(theta, phi, is_defined);
35}
Scalar phi() const
phi method
Scalar theta() const
theta method
static Double_t a

◆ set_flow()

template<class T>
void HepMC::set_flow ( T & a,
Flow fl )

Definition at line 31 of file Flow.h.

31 {
32 if (fl) a->add_attribute(HepMCStr::flow, std::make_shared<HepMC3::VectorIntAttribute>(*fl));
33}

◆ set_ll_event_number()

bool HepMC::set_ll_event_number ( HepMC3::GenEvent * e,
long long int num )
inline

Definition at line 337 of file GenEvent.h.

337 {
338 e->add_attribute(HepMCStr::long_long_event_number, std::make_shared<HepMC3::LongLongAttribute>(num));
339 return true;
340}

◆ set_mpi()

void HepMC::set_mpi ( GenEvent * e,
const int i = 0 )
inline

Definition at line 584 of file GenEvent.h.

584 {
585 std::shared_ptr<HepMC3::IntAttribute> mpi = std::make_shared<HepMC3::IntAttribute>(i);
586 e->add_attribute(HepMCStr::mpi, std::move(mpi));
587}
int mpi(const GenEvent &evt)
Definition GenEvent.h:563

◆ set_polarization()

template<class T>
void HepMC::set_polarization ( T & a,
const Polarization & b )
inline

Definition at line 36 of file Polarization.h.

36 {
37 a->add_attribute(HepMCStr::phi, std::make_shared<HepMC3::DoubleAttribute>(b.phi()));
38 a->add_attribute(HepMCStr::theta, std::make_shared<HepMC3::DoubleAttribute>(b.theta()));
39}

◆ set_random_states()

void HepMC::set_random_states ( GenEvent * e,
std::vector< long int > & a )
inline

Definition at line 588 of file GenEvent.h.

588 {
589 e->add_attribute(HepMCStr::random_states, std::make_shared<HepMC3::VectorLongIntAttribute>(a));
590}

◆ set_signal_process_id()

void HepMC::set_signal_process_id ( GenEvent * e,
const int i = 0 )
inline

Definition at line 580 of file GenEvent.h.

580 {
581 std::shared_ptr<HepMC3::IntAttribute> signal_process_id = std::make_shared<HepMC3::IntAttribute>(i);
582 e->add_attribute(HepMCStr::signal_process_id, std::move(signal_process_id));
583}

◆ set_signal_process_vertex()

template<class T>
void HepMC::set_signal_process_vertex ( GenEvent * e,
T & v )

Definition at line 591 of file GenEvent.h.

591 {
592 if (!v || !e) return;
593/* AV: HepMC2 adds the vertex to event */
594 e->add_vertex(v);
595 v->add_attribute(HepMCStr::signal_process_vertex, std::make_shared<HepMC3::IntAttribute>(1));
596}

◆ signal_process_id() [1/2]

int HepMC::signal_process_id ( const GenEvent & evt)
inline

Definition at line 572 of file GenEvent.h.

572 {
573 std::shared_ptr<HepMC3::IntAttribute> A_signal_process_id = evt.attribute<HepMC3::IntAttribute>(HepMCStr::signal_process_id);
574 return A_signal_process_id ? (A_signal_process_id->value()) : 0;
575}

◆ signal_process_id() [2/2]

int HepMC::signal_process_id ( const GenEvent * evt)
inline

Definition at line 576 of file GenEvent.h.

576 {
577 std::shared_ptr<HepMC3::IntAttribute> A_signal_process_id = evt->attribute<HepMC3::IntAttribute>(HepMCStr::signal_process_id);
578 return A_signal_process_id ? (A_signal_process_id->value()) : 0;
579}

◆ signal_process_vertex() [1/2]

ConstGenVertexPtr HepMC::signal_process_vertex ( const GenEvent * e)
inline

Definition at line 597 of file GenEvent.h.

597{ for (auto& v: e->vertices()) if (v->attribute<HepMC3::IntAttribute>(HepMCStr::signal_process_vertex)) return v; return nullptr; }

◆ signal_process_vertex() [2/2]

GenVertexPtr HepMC::signal_process_vertex ( GenEvent * e)
inline

Definition at line 598 of file GenEvent.h.

598{ for (auto& v: e->vertices()) if (v->attribute<HepMC3::IntAttribute>(HepMCStr::signal_process_vertex)) return v; return nullptr; }

◆ simulation_history()

template<class T>
std::deque< int > HepMC::simulation_history ( const T & p,
const int direction )
inline

Function to calculate all the descendants(direction=1)/ancestors(direction=-1) of the particle.

Definition at line 160 of file MagicNumbers.h.

160{ std::deque<int> res; res.push_back(uniqueID(p)); get_particle_history(p, res, direction); return res;}
std::pair< std::vector< unsigned int >, bool > res

◆ status()

template<typename T>
int HepMC::status ( const T & p)
inline

Definition at line 115 of file MagicNumbers.h.

115 {
116 if constexpr (std::is_integral_v<T>) {
117 return p;
118 }
119 else if constexpr (std::is_integral_v<std::remove_pointer_t<T>>) {
120 return *p;
121 }
122 else if constexpr (std::is_pointer_v<T> || is_smart_ptr_v<T>){ //T is ptr
123 return p->status();
124 }
125 else {
126 return p.status();
127 }
128 }
constexpr bool is_smart_ptr_v

◆ suggest_barcode()

template<class T>
bool HepMC::suggest_barcode ( T & p,
int i )

Definition at line 607 of file GenEvent.h.

607 {
608 if (!p->parent_event()) return false;
609 auto barcodes = p->parent_event()->template attribute<GenEventBarcodes> (HepMCStr::barcodes);
610 if (!barcodes) {
611 barcodes = std::make_shared<GenEventBarcodes>();
612 p->parent_event()->add_attribute(HepMCStr::barcodes, barcodes);
613 }
614 barcodes->remove(p);
615 const bool ret = p->add_attribute(HepMCStr::barcode, std::make_shared<HepMC3::IntAttribute>(i));
616 if (ret) barcodes->add(p);
617 return ret;
618}

◆ SUPPRESSED_PILEUP_BARCODE()

int HepMC::SUPPRESSED_PILEUP_BARCODE ( std::numeric_limits< int32_t > ::max())
constexpr

This barcode is used by objects matched to particles from pile-up interactions in standard MC Production.

◆ uniqueID()

template<typename T>
int HepMC::uniqueID ( const T & p)
inline

Definition at line 89 of file MagicNumbers.h.

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

◆ valid_beam_particles()

bool HepMC::valid_beam_particles ( const GenEvent * e)
inline

Definition at line 599 of file GenEvent.h.

599 {
600 if (!e) return false;
601 size_t nBeams = 0;
602 for (const auto& p : e->beams()) { if (p->status() == 4) ++nBeams; }
603 if (nBeams != 2) return false;
604 return true;
605}

◆ weights_map()

std::map< std::string, std::size_t > HepMC::weights_map ( const HepMC3::GenEvent * e)
inline

Definition at line 346 of file GenEvent.h.

346 {
347 std::map<std::string, std::size_t> ret;
348 auto run = e->run_info();
349 if (!run) return ret;
350 const std::vector<std::string> names = run->weight_names();
351 for (const auto& name: names) ret[name] = run->weight_index(name);
352 return ret;
353}
int run(int argc, char *argv[])

Variable Documentation

◆ FORWARD_TRANSPORT_MODEL_PROCESS

int HepMC::FORWARD_TRANSPORT_MODEL_PROCESS = 212
constexpr

Special Forward transport Geant process for vertices.

Definition at line 50 of file MagicNumbers.h.

◆ INVALID_PARTICLE_BARCODE

int HepMC::INVALID_PARTICLE_BARCODE = -1
constexpr

Definition at line 55 of file MagicNumbers.h.

◆ INVALID_PARTICLE_ID

int HepMC::INVALID_PARTICLE_ID = -1
constexpr

Definition at line 58 of file MagicNumbers.h.

◆ INVALID_VERTEX_ID

int HepMC::INVALID_VERTEX_ID = 1
constexpr

Definition at line 59 of file MagicNumbers.h.

◆ is_smart_ptr_v

template<class T>
bool HepMC::is_smart_ptr_v = is_smart_ptr<T>::value
inlineconstexpr

Definition at line 68 of file MagicNumbers.h.

◆ SIM_BARCODE_THRESHOLD

int HepMC::SIM_BARCODE_THRESHOLD = 200000
constexpr

Constant defining the barcode threshold for simulated particles, eg. can be used to separate generator event record entries from simulated particles.

Definition at line 38 of file MagicNumbers.h.

◆ SIM_REGENERATION_INCREMENT

int HepMC::SIM_REGENERATION_INCREMENT = 1000000
constexpr

Constant defining the barcode threshold for regenerated particles, i.e. particles surviving an interaction.

Definition at line 41 of file MagicNumbers.h.

◆ SIM_STATUS_INCREMENT

int HepMC::SIM_STATUS_INCREMENT = 100000
constexpr

Constant defining the barcode threshold for regenerated particles, i.e. particles surviving an interaction.

Definition at line 44 of file MagicNumbers.h.

◆ SIM_STATUS_THRESHOLD

int HepMC::SIM_STATUS_THRESHOLD = 20000
constexpr

Constant definiting the status threshold for simulated particles, eg. can be used to separate generator event record entries from simulated particles.

Definition at line 47 of file MagicNumbers.h.

◆ UNDEFINED_ID

int HepMC::UNDEFINED_ID = 0
constexpr

Definition at line 57 of file MagicNumbers.h.