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

Namespaces

namespace  BarcodeBased
namespace  Print
namespace  StatusBased

Classes

struct  DataPool
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 > >
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 > >

Typedefs

typedef GenParticleGenParticlePtr
typedef const GenParticleConstGenParticlePtr
typedef HepMC::GenVertex * GenVertexPtr
typedef const HepMC::GenVertex * ConstGenVertexPtr
typedef HepMC::PdfInfo * GenPdfInfoPtr
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, int >::value, bool > = true>
int barcode (const T &p)
template<class T>
int flow (const T &a, int i)
template<class T>
Flow flow (const T &a)
bool set_ll_event_number (HepMC::GenEvent *e, long long int num)
long long int get_ll_event_number (const HepMC::GenEvent *e)
GenEvent::particle_iterator begin (HepMC::GenEvent &e)
GenEvent::particle_iterator end (HepMC::GenEvent &e)
GenEvent::particle_const_iterator begin (const HepMC::GenEvent &e)
GenEvent::particle_const_iterator end (const HepMC::GenEvent &e)
GenEvent * newGenEvent (const int a, const int b)
GenVertex * signal_process_vertex (const GenEvent *e)
void fillBarcodesAttribute (GenEvent *)
GenVertex * barcode_to_vertex (const GenEvent *e, int id)
GenParticlebarcode_to_particle (const GenEvent *e, int id)
int mpi (const GenEvent &e)
int mpi (const GenEvent *e)
int signal_process_id (const GenEvent &e)
int signal_process_id (const GenEvent *e)
void set_signal_process_id (GenEvent *e, const int i)
void set_mpi (GenEvent *e, const int i)
template<class T>
void set_random_states (GenEvent *e, std::vector< T > a)
template<class T>
void set_signal_process_vertex (GenEvent *e, T v)
GenEvent * copyemptyGenEvent (const GenEvent *inEvt)
template<class T>
bool suggest_barcode (T &p, int i)
template<class T>
bool suggest_barcode (T *p, int i)
template<>
bool suggest_barcode< std::unique_ptr< HepMC::GenParticle > > (std::unique_ptr< HepMC::GenParticle > &p, int i)
bool valid_beam_particles (const GenEvent *e)
GenParticlePtr newGenParticlePtr (const HepMC::FourVector &mom=HepMC::FourVector(0.0, 0.0, 0.0, 0.0), int pid=0, int status=0)
int barcode_or_id (const ConstGenParticlePtr &p)
std::ostream & operator<< (std::ostream &os, const GenParticle *p)
GenVertex::particles_out_const_iterator begin (const HepMC::GenVertex &v)
GenVertex::particles_out_const_iterator end (const HepMC::GenVertex &v)
GenVertexPtr newGenVertexPtr (const HepMC::FourVector &pos=HepMC::FourVector(0.0, 0.0, 0.0, 0.0), const int i=0)
int barcode_or_id (const ConstGenVertexPtr &p)
std::ostream & operator<< (std::ostream &os, const GenVertex *v)
template<class T>
void set_polarization (T &a, const Polarization &b)
template<class T>
Polarization polarization (const T &a)
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<>
int status (const ConstGenVertexPtr &v1)
template<>
int status (const GenVertexPtr &v1)
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

Definition at line 38 of file GenParticle.h.

◆ ConstGenVertexPtr

typedef const HepMC::GenVertex * HepMC::ConstGenVertexPtr

Definition at line 60 of file GenVertex.h.

◆ GenParticlePtr

Definition at line 37 of file GenParticle.h.

◆ GenPdfInfoPtr

typedef HepMC::PdfInfo* HepMC::GenPdfInfoPtr

Definition at line 17 of file PdfInfo.h.

◆ GenVertexPtr

typedef HepMC::GenVertex * HepMC::GenVertexPtr

Definition at line 59 of file GenVertex.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/3]

template<class T, std::enable_if_t<!std::is_pointer< T >::value &&!std::is_same< T, int >::value, bool > = true>
int HepMC::barcode ( const T & p)
inline

Definition at line 57 of file Barcode.h.

57{ return p.barcode();}

◆ barcode() [2/3]

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

Definition at line 16 of file Barcode.h.

16{ return p->barcode(); }

◆ barcode() [3/3]

int HepMC::barcode ( int p)
inline

Definition at line 17 of file Barcode.h.

17{ return p; }

◆ barcode_or_id() [1/2]

int HepMC::barcode_or_id ( const ConstGenParticlePtr & p)
inline

Definition at line 42 of file GenParticle.h.

42{ return p->barcode();}

◆ barcode_or_id() [2/2]

int HepMC::barcode_or_id ( const ConstGenVertexPtr & p)
inline

Definition at line 71 of file GenVertex.h.

71{ return p->barcode();}

◆ barcode_to_particle()

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

Definition at line 629 of file GenEvent.h.

629{return e->barcode_to_particle(id);}

◆ barcode_to_vertex()

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

Definition at line 628 of file GenEvent.h.

628{return e->barcode_to_vertex(id);}

◆ begin() [1/3]

GenEvent::particle_const_iterator HepMC::begin ( const HepMC::GenEvent & e)
inline

Definition at line 623 of file GenEvent.h.

623{ return e.particles_begin(); }

◆ begin() [2/3]

GenVertex::particles_out_const_iterator HepMC::begin ( const HepMC::GenVertex & v)
inline

Definition at line 61 of file GenVertex.h.

61{ return v.particles_out_const_begin(); }

◆ begin() [3/3]

GenEvent::particle_iterator HepMC::begin ( HepMC::GenEvent & e)
inline

Definition at line 621 of file GenEvent.h.

621{ return e.particles_begin(); }

◆ copyemptyGenEvent()

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

Definition at line 654 of file GenEvent.h.

654 {
655 HepMC::GenEvent* outEvt = new HepMC::GenEvent( inEvt->signal_process_id(), inEvt->event_number() );
656 outEvt->set_mpi ( inEvt->mpi() );
657 outEvt->set_event_scale ( inEvt->event_scale() );
658 outEvt->set_alphaQCD ( inEvt->alphaQCD() );
659 outEvt->set_alphaQED ( inEvt->alphaQED() );
660 outEvt->weights() = inEvt->weights();
661 outEvt->set_random_states( inEvt->random_states() );
662 if ( nullptr != inEvt->heavy_ion() ) {
663 outEvt->set_heavy_ion ( *inEvt->heavy_ion() );
664 }
665 if ( nullptr != inEvt->pdf_info() ) {
666 outEvt->set_pdf_info ( *inEvt->pdf_info() );
667 }
668 return outEvt;
669}

◆ end() [1/3]

GenEvent::particle_const_iterator HepMC::end ( const HepMC::GenEvent & e)
inline

Definition at line 624 of file GenEvent.h.

624{ return e.particles_end(); }

◆ end() [2/3]

GenVertex::particles_out_const_iterator HepMC::end ( const HepMC::GenVertex & v)
inline

Definition at line 62 of file GenVertex.h.

62{ return v.particles_out_const_end(); }

◆ end() [3/3]

GenEvent::particle_iterator HepMC::end ( HepMC::GenEvent & e)
inline

Definition at line 622 of file GenEvent.h.

622{ return e.particles_end(); }

◆ fillBarcodesAttribute()

void HepMC::fillBarcodesAttribute ( GenEvent * )
inline

Definition at line 627 of file GenEvent.h.

627{ }

◆ flow() [1/2]

template<class T>
Flow HepMC::flow ( const T & a)

Definition at line 52 of file Flow.h.

52{return a->flow();}
static Double_t a

◆ flow() [2/2]

template<class T>
int HepMC::flow ( const T & a,
int i )

Definition at line 51 of file Flow.h.

51{return a->flow(i);}

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

358{ 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 HepMC::GenEvent * e)
inline

Definition at line 618 of file GenEvent.h.

618 {
619 return e->event_number();
620}

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

164 {
165 if (direction < 0) {
166 if (p->status()>SIM_STATUS_INCREMENT) {
167 auto pv = p->production_vertex();
168 if (pv) {
169 for (auto pa: pv->particles_in()) {
170 if (!pa || pa->pdg_id() != p->pdg_id()) continue;
171 out.push_front(uniqueID(p));
172 get_particle_history(pa, out, -1);
173 break;
174 }
175 }
176 }
177 }
178 if (direction > 0) {
179 if (p->status()>SIM_STATUS_INCREMENT) {
180 auto pv = p->end_vertex();
181 if (pv) {
182 for (auto pa: pv->particles_out()) {
183 if (!pa || pa->pdg_id() != p->pdg_id()) continue;
184 out.push_back(uniqueID(p));
185 get_particle_history(pa, out, 1);
186 break;
187 }
188 }
189 }
190 }
191 }
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 345 of file MagicNumbers.h.

345 {
346 if constexpr (std::is_same_v<std::remove_const_t<remove_smart_pointer_t<std::remove_pointer_t<T>>>, HepMcParticleLink>) {
347 return StatusBased::ignoreTruthLink(p, vetoPileUp);
348 }
349 else {
350 return BarcodeBased::ignoreTruthLink(p, vetoPileUp);
351 }
352 }
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 364 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 367 of file MagicNumbers.h.

367{ 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 370 of file MagicNumbers.h.

370{ 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 373 of file MagicNumbers.h.

373{ 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 355 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 361 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 332 of file MagicNumbers.h.

332 {
333 if constexpr (std::is_same_v<std::remove_const_t<remove_smart_pointer_t<std::remove_pointer_t<T>>>, HepMcParticleLink>) {
335 }
336 else {
338 }
339 }
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 428 of file MagicNumbers.h.

428 {
429 int maxBarcode = 0;
430#ifdef HEPMC3
431 auto allbarcodes = genEvent->attribute<HepMC::GenEventBarcodes>("barcodes");
432 for (const auto& bp: allbarcodes->barcode_to_particle_map()) {
433 if (!HepMC::BarcodeBased::is_simulation_particle(bp.first)) { maxBarcode=std::max(maxBarcode,bp.first); }
434 }
435#else
436 for (auto currentGenParticle: *genEvent) {
437 const int barcode=HepMC::barcode(currentGenParticle);
438 if (barcode > maxBarcode && !HepMC::BarcodeBased::is_simulation_particle(barcode)) { maxBarcode=barcode; }
439 }
440#endif
441 return maxBarcode;
442}
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 ...
int barcode(const T *p)
Definition Barcode.h:16

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

445 {
446 int maxBarcode=0;
447#ifdef HEPMC3
448 auto allbarcodes = genEvent->attribute<HepMC::GenEventBarcodes>("barcodes");
449 for (const auto& bp: allbarcodes->barcode_to_vertex_map()) {
450 if (!HepMC::BarcodeBased::is_simulation_vertex(bp.first)) { maxBarcode=std::min(maxBarcode,bp.first); }
451 }
452#else
453 HepMC::GenEvent::vertex_const_iterator currentGenVertexIter;
454 for (currentGenVertexIter= genEvent->vertices_begin();
455 currentGenVertexIter!= genEvent->vertices_end();
456 ++currentGenVertexIter) {
457 const int barcode((*currentGenVertexIter)->barcode());
458 if (barcode < maxBarcode && !HepMC::BarcodeBased::is_simulation_vertex(barcode)) { maxBarcode=barcode; }
459 }
460#endif
461 return maxBarcode;
462}
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 & e)
inline

Definition at line 630 of file GenEvent.h.

630 {
631 return e.mpi();
632}

◆ mpi() [2/2]

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

Definition at line 633 of file GenEvent.h.

633 {
634 return e->mpi();
635}

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

405 {
406 int generations_barcode_based = (barcode/SIM_REGENERATION_INCREMENT);
407 bool is_sim_secondary_barcode_based = (barcode%SIM_REGENERATION_INCREMENT > SIM_BARCODE_THRESHOLD);
408 return oldStatus + SIM_STATUS_INCREMENT*generations_barcode_based + (is_sim_secondary_barcode_based? SIM_STATUS_THRESHOLD : 0);
409 }
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 415 of file MagicNumbers.h.

415 {
416 bool is_simulation_vertex_barcode_based = (barcode<-SIM_BARCODE_THRESHOLD);
417 return (is_simulation_vertex_barcode_based? SIM_STATUS_THRESHOLD : 0) + oldStatus;
418 }

◆ newGenEvent()

GenEvent * HepMC::newGenEvent ( const int a,
const int b )
inline

Definition at line 625 of file GenEvent.h.

625{ return new GenEvent(a,b); }

◆ newGenParticlePtr()

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

Definition at line 39 of file GenParticle.h.

39 {
40 return new HepMC::GenParticle(mom,pid,status);
41}
int status(const T &p)

◆ newGenVertexPtr()

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

Definition at line 64 of file GenVertex.h.

64 {
65 return new HepMC::GenVertex(pos,i);
66}

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

342{ 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 412 of file MagicNumbers.h.

412{ 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 376 of file MagicNumbers.h.

376 {
377 auto particle_status = [] (int barcode, int status) {
381 return status;
382 };
383 auto vertex_status = [] (int barcode, int status) {
385 return status;
386 };
387#ifdef HEPMC3
388 for (auto p: evt->particles()) {
389 p->set_status (particle_status (HepMC::barcode(p), p->status()));
390 }
391 for (auto v: evt->vertices()) {
392 v->set_status (vertex_status (HepMC::barcode(v), v->status()));
393 }
394#else
395 for (auto p = evt->particles_begin(); p != evt->particles_end(); ++p) {
396 (*p)->set_status (particle_status ((*p)->barcode(), (*p)->status()));
397 }
398 for (auto v = evt->vertices_begin(); v != evt->vertices_end(); ++v) {
399 (*v)->set_id (vertex_status ((*v)->barcode(), (*v)->id()));
400 }
401#endif
402 }

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

421 {
422 bool is_simulation_vertex_status_based = (newStatus>SIM_STATUS_THRESHOLD);
423 return ( is_simulation_vertex_status_based ? -SIM_STATUS_THRESHOLD : 0) + newStatus; }

◆ operator<<() [1/2]

std::ostream & HepMC::operator<< ( std::ostream & os,
const GenParticle * p )
inline

Definition at line 47 of file GenParticle.h.

47{ if (p) return os<<(*p); else return os;}

◆ operator<<() [2/2]

std::ostream & HepMC::operator<< ( std::ostream & os,
const GenVertex * v )
inline

Definition at line 72 of file GenVertex.h.

72{ if (v) return os<<(*v); else return os;}

◆ polarization()

template<class T>
Polarization HepMC::polarization ( const T & a)
inline

Definition at line 47 of file Polarization.h.

47 {
48 return a->polarization();
49}

◆ set_ll_event_number()

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

Definition at line 613 of file GenEvent.h.

613 {
614 if (num > std::numeric_limits<int>::max()) return false;
615 e->set_event_number((int)num);
616 return true;
617}

◆ set_mpi()

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

Definition at line 645 of file GenEvent.h.

645 {
646 e->set_mpi(i);
647}

◆ set_polarization()

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

Definition at line 44 of file Polarization.h.

44 {
45 a->set_polarization(b);
46}

◆ set_random_states()

template<class T>
void HepMC::set_random_states ( GenEvent * e,
std::vector< T > a )

Definition at line 648 of file GenEvent.h.

648 {
649 e->set_random_states(a);
650}

◆ set_signal_process_id()

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

Definition at line 642 of file GenEvent.h.

642 {
643 e->set_signal_process_id(i);
644}

◆ set_signal_process_vertex()

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

Definition at line 651 of file GenEvent.h.

651 {
652 e->set_signal_process_vertex(v);
653}

◆ signal_process_id() [1/2]

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

Definition at line 636 of file GenEvent.h.

636 {
637 return e.signal_process_id();
638}

◆ signal_process_id() [2/2]

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

Definition at line 639 of file GenEvent.h.

639 {
640 return e->signal_process_id();
641}

◆ signal_process_vertex()

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

Definition at line 626 of file GenEvent.h.

626{ return e->signal_process_vertex(); }

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

193{ 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() [1/3]

template<>
int HepMC::status ( const ConstGenVertexPtr & v1)
inline

Definition at line 159 of file MagicNumbers.h.

159{ return v1->id();}

◆ status() [2/3]

template<>
int HepMC::status ( const GenVertexPtr & v1)
inline

Definition at line 160 of file MagicNumbers.h.

160{ return v1->id();}

◆ status() [3/3]

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

Definition at line 144 of file MagicNumbers.h.

144 {
145 if constexpr (std::is_integral_v<T>) {
146 return p;
147 }
148 else if constexpr (std::is_integral_v<std::remove_pointer_t<T>>) {
149 return *p;
150 }
151 else if constexpr (std::is_pointer_v<T> || is_smart_ptr_v<T>){ //T is ptr
152 return p->status();
153 }
154 else {
155 return p.status();
156 }
157 }
constexpr bool is_smart_ptr_v

◆ suggest_barcode() [1/2]

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

Definition at line 671 of file GenEvent.h.

671{return p.suggest_barcode(i);}

◆ suggest_barcode() [2/2]

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

Definition at line 672 of file GenEvent.h.

672{return p->suggest_barcode(i);}

◆ suggest_barcode< std::unique_ptr< HepMC::GenParticle > >()

template<>
bool HepMC::suggest_barcode< std::unique_ptr< HepMC::GenParticle > > ( std::unique_ptr< HepMC::GenParticle > & p,
int i )
inline

Definition at line 674 of file GenEvent.h.

674{return p->suggest_barcode(i);}

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

117 {
118 if constexpr (std::is_integral_v<T>) {
119 return p;
120 }
121 else if constexpr (std::is_integral_v<std::remove_pointer_t<T>>) {
122 return *p;
123 }
124 else if constexpr (std::is_same_v<T, xAOD::TruthParticle_v1> || std::is_same_v<T, xAOD::TruthVertex_v1>) {
125 return p.uid();
126 }
127 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>) {
128 return p->uid();
129 }
130 else if constexpr (std::is_same_v<T, CaloCalibrationHit>) {
131 return p.particleUID();
132 }
133 else if constexpr (std::is_same_v<std::remove_const_t<remove_smart_pointer_t<std::remove_pointer_t<T>>>, CaloCalibrationHit>) {
134 return p->particleUID();
135 }
136 else if constexpr (std::is_pointer_v<T> || is_smart_ptr_v<T>){ //T is ptr
137 return p->barcode();
138 }
139 else {
140 return p.barcode();
141 }
142 }

◆ valid_beam_particles()

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

Definition at line 682 of file GenEvent.h.

682{return e->valid_beam_particles();}

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.