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)
GenEvent * newGenEvent (const int signal_process_id, const int event_number)
GenEvent * copyemptyGenEvent (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 defining 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 446 of file GenEvent.h.

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

◆ barcode_to_particle() [2/2]

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

Definition at line 526 of file GenEvent.h.

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

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

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

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

◆ begin() [2/2]

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

Definition at line 358 of file GenEvent.h.

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

◆ copyemptyGenEvent()

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

Definition at line 372 of file GenEvent.h.

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

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

◆ end() [2/2]

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

Definition at line 359 of file GenEvent.h.

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

◆ fillBarcodesAttribute()

void HepMC::fillBarcodesAttribute ( GenEvent * e)
inline

Definition at line 396 of file GenEvent.h.

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

◆ 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 344 of file GenEvent.h.

344 {
345 auto at = e->attribute<HepMC3::LongLongAttribute>(HepMCStr::long_long_event_number);
346 return at ? at->value() : e->event_number();
347}

◆ 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 566 of file GenEvent.h.

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

◆ mpi() [2/2]

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

Definition at line 570 of file GenEvent.h.

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

◆ 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 defining the status threshold for simulated particles, eg. can be used to separate generator...
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 363 of file GenEvent.h.

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

◆ 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 340 of file GenEvent.h.

340 {
341 e->add_attribute(HepMCStr::long_long_event_number, std::make_shared<HepMC3::LongLongAttribute>(num));
342 return true;
343}

◆ set_mpi()

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

Definition at line 587 of file GenEvent.h.

587 {
588 std::shared_ptr<HepMC3::IntAttribute> mpi = std::make_shared<HepMC3::IntAttribute>(i);
589 e->add_attribute(HepMCStr::mpi, std::move(mpi));
590}
int mpi(const GenEvent &evt)
Definition GenEvent.h:566

◆ 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 591 of file GenEvent.h.

591 {
592 e->add_attribute(HepMCStr::random_states, std::make_shared<HepMC3::VectorLongIntAttribute>(a));
593}

◆ set_signal_process_id()

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

Definition at line 583 of file GenEvent.h.

583 {
584 std::shared_ptr<HepMC3::IntAttribute> signal_process_id = std::make_shared<HepMC3::IntAttribute>(i);
585 e->add_attribute(HepMCStr::signal_process_id, std::move(signal_process_id));
586}

◆ set_signal_process_vertex()

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

Definition at line 594 of file GenEvent.h.

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

◆ signal_process_id() [1/2]

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

Definition at line 575 of file GenEvent.h.

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

◆ signal_process_id() [2/2]

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

Definition at line 579 of file GenEvent.h.

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

◆ signal_process_vertex() [1/2]

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

Definition at line 600 of file GenEvent.h.

600{ 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 601 of file GenEvent.h.

601{ 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 610 of file GenEvent.h.

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

◆ 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 602 of file GenEvent.h.

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

◆ weights_map()

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

Definition at line 349 of file GenEvent.h.

349 {
350 std::map<std::string, std::size_t> ret;
351 auto run = e->run_info();
352 if (!run) return ret;
353 const std::vector<std::string> names = run->weight_names();
354 for (const auto& name: names) ret[name] = run->weight_index(name);
355 return ret;
356}
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 defining 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.