27 if (lx->pid() != rx->pid())
return (lx->pid() < rx->pid());
28 if (lx->status() != rx->status())
return (lx->status() < rx->status());
30 return (lx->momentum().e() < rx->momentum().e());
37 if (lx.second != rx.second)
return (lx.second < rx.second);
38 if (lx.first->particles_in().size() != rx.first->particles_in().size())
return (lx.first->particles_in().size() < rx.first->particles_in().size());
39 if (lx.first->particles_out().size() != rx.first->particles_out().size())
return (lx.first->particles_out().size() < rx.first->particles_out().size());
41 std::vector<int> lx_id_in;
42 lx_id_in.reserve(lx.first->particles_in().size());
43 std::vector<int> rx_id_in;
44 rx_id_in.reserve(rx.first->particles_in().size());
45 for (
const ConstGenParticlePtr& pp: lx.first->particles_in()) lx_id_in.emplace_back(pp->pid());
46 for (
const ConstGenParticlePtr& pp: rx.first->particles_in()) rx_id_in.emplace_back(pp->pid());
47 std::sort(lx_id_in.begin(), lx_id_in.end());
48 std::sort(rx_id_in.begin(), rx_id_in.end());
49 for (
unsigned int i = 0; i < lx_id_in.size(); i++)
if (lx_id_in[i] != rx_id_in[i])
return (lx_id_in[i] < rx_id_in[i]);
51 std::vector<int> lx_id_out;
52 lx_id_out.reserve(lx.first->particles_out().size());
53 std::vector<int> rx_id_out;
54 rx_id_out.reserve(rx.first->particles_out().size());
55 for (
const ConstGenParticlePtr& pp: lx.first->particles_in()) lx_id_out.emplace_back(pp->pid());
56 for (
const ConstGenParticlePtr& pp: rx.first->particles_in()) rx_id_out.emplace_back(pp->pid());
57 std::sort(lx_id_out.begin(), lx_id_out.end());
58 std::sort(rx_id_out.begin(), rx_id_out.end());
59 for (
unsigned int i = 0; i < lx_id_out.size(); i++)
if (lx_id_out[i] != rx_id_out[i])
return (lx_id_out[i] < rx_id_out[i]);
61 std::vector<double> lx_mom_in;
62 std::vector<double> rx_mom_in;
63 for (
const ConstGenParticlePtr& pp: lx.first->particles_in()) lx_mom_in.emplace_back(pp->momentum().e());
64 for (
const ConstGenParticlePtr& pp: rx.first->particles_in()) rx_mom_in.emplace_back(pp->momentum().e());
65 std::sort(lx_mom_in.begin(), lx_mom_in.end());
66 std::sort(rx_mom_in.begin(), rx_mom_in.end());
67 for (
unsigned int i = 0; i < lx_mom_in.size(); i++)
if (lx_mom_in[i] != rx_mom_in[i])
return (lx_mom_in[i] < rx_mom_in[i]);
69 std::vector<double> lx_mom_out;
70 std::vector<double> rx_mom_out;
71 for (
const ConstGenParticlePtr& pp: lx.first->particles_in()) lx_mom_out.emplace_back(pp->momentum().e());
72 for (
const ConstGenParticlePtr& pp: rx.first->particles_in()) rx_mom_out.emplace_back(pp->momentum().e());
73 std::sort(lx_mom_out.begin(), lx_mom_out.end());
74 std::sort(rx_mom_out.begin(), rx_mom_out.end());
75 for (
unsigned int i = 0; i < lx_mom_out.size(); i++)
if (lx_mom_out[i] != rx_mom_out[i])
return (lx_mom_out[i] < rx_mom_out[i]);
85 for (
const ConstGenParticlePtr& pp: v->particles_in()) {
86 ConstGenVertexPtr v2 = pp->production_vertex();
87 if (v2 == v)
continue;
88 if (!v2) { p = std::max(p, 1); }
102 m_hepevtptr = std::make_shared<struct HEPEVT_Pointers<double> >();
124 ostr <<
" Event No.: " << *(
m_hepevtptr->nevhep) << std::endl;
125 ostr <<
" Nr Type Parent(s) Daughter(s) Px Py Pz E Inv. M." << std::endl;
135 std::array<char, 255> buf;
137 snprintf(buf.data(), buf.size(),
"%5i %6i%4i - %4i %4i - %4i %8.2f %8.2f %8.2f %8.2f %8.2f",
142 ostr << buf.data() << std::endl;
174 for (
int i = 1; i <= *(
m_hepevtptr->nhep); ++i ) {
234 bool is_fixed =
true;
253 memcpy(dest, src, 2*
sizeof(
int));
254 src += 2*
sizeof(int);
255 dest += 2*
sizeof(int);
256 memcpy(dest, src, N*
sizeof(
int));
257 src += N*
sizeof(int);
259 memcpy(dest, src, N*
sizeof(
int));
260 src += N*
sizeof(int);
262 memcpy(dest, src, 2*N*
sizeof(
int));
263 src += 2*N*
sizeof(int);
265 memcpy(dest, src, 2*N*
sizeof(
int));
266 src += 2*N*
sizeof(int);
268 memcpy(dest, src, 5*N*
sizeof(
double));
269 src += 5*N*
sizeof(double);
271 memcpy(dest, src, 4*N*
sizeof(
double));
Helper functions used to manipulate with HEPEVT block.
Definition of class HEPEVT_Wrapper.
Definition of class HEPEVT_Wrapper_Runtime.
Definition of class HEPEVT_Wrapper_Runtime_Static.
static HEPMC3_EXPORT_API int m_max_particles
Block size.
static HEPMC3_EXPORT_API std::shared_ptr< struct HEPEVT_Pointers< double > > m_hepevtptr
Fortran common block HEPEVT.
int first_child(const int index) const
Get index of 1st daughter.
int last_parent(const int index) const
Get index of last mother.
int last_child(const int index) const
Get index of last daughter.
void allocate_internal_storage()
Allocates m_internal_storage storage in smart pointer to hold HEPEVT of fixed size.
int first_parent(const int index) const
Get index of 1st mother.
double pz(const int index) const
Get Z momentum.
void zero_everything()
Set all entries in HEPEVT to zero.
double py(const int index) const
Get Y momentum.
void set_parents(const int index, const int firstparent, const int lastparent)
Set parents.
int number_children_exact(const int index) const
Get number of children by counting.
void print_hepevt_particle(int index, std::ostream &ostr=std::cout) const
Print particle information.
double t(const int index) const
Get production time.
void set_momentum(const int index, const double px, const double py, const double pz, const double e)
Set 4-momentum.
void set_children(const int index, const int firstchild, const int lastchild)
Set children.
int number_parents(const int index) const
Get number of parents.
void set_position(const int index, const double x, const double y, const double z, const double t)
Set position in time-space.
double y(const int index) const
Get Y Production vertex.
bool fix_daughters()
Tries to fix list of daughters.
int number_entries() const
Get number of entries.
void set_hepevt_address(char *c)
Set Fortran block address.
int m_max_particles
Block size.
double px(const int index) const
Get X momentum.
std::vector< char > m_internal_storage
Internalstorage storage. Optional.
int number_children(const int index) const
Get number of children from the range of daughters.
double z(const int index) const
Get Z Production vertex.
void print_hepevt(std::ostream &ostr=std::cout) const
Print information from HEPEVT common block.
void set_mass(const int index, double mass)
Set mass.
double x(const int index) const
Get X Production vertex.
void copy_to_internal_storage(char *c, int N)
Copies the content of foreign common block into the internal storage.
std::shared_ptr< struct HEPEVT_Pointers< double > > m_hepevtptr
Fortran common block HEPEVT.
double e(const int index) const
Get Energy.
void calculate_longest_path_to_top(ConstGenVertexPtr v, std::map< ConstGenVertexPtr, int > &pathl)
Calculates the path to the top (beam) particles.
HEPMC3_EXPORT_API struct HEPEVT * hepevtptr
pointer to the common block
Fortran common block HEPEVT.
bool operator()(ConstGenParticlePtr lx, ConstGenParticlePtr rx) const
comparison of two particles
bool operator()(const std::pair< ConstGenVertexPtr, int > &lx, const std::pair< ConstGenVertexPtr, int > &rx) const
Order vertices with equal paths. If the paths are equal, order in other quantities....