6#ifndef HEPMC3_HEPEVT_WRAPPER_H
7#define HEPMC3_HEPEVT_WRAPPER_H
24#ifndef HEPMC3_HEPEVT_NMXHEP
26#define HEPMC3_HEPEVT_NMXHEP 10000
29#ifndef HEPMC3_HEPEVT_PRECISION
31#define HEPMC3_HEPEVT_PRECISION double
71#ifndef HEPEVT_WRAPPER_HEADER_ONLY
78extern struct HEPEVT* hepevtptr;
88 static void print_hepevt( std::ostream& ostr = std::cout );
98#ifndef HEPEVT_WRAPPER_HEADER_ONLY
114 static int status(
const int& index ) {
return hepevtptr->isthep[index-1]; }
115 static int id(
const int& index ) {
return hepevtptr->idhep[index-1]; }
116 static int first_parent(
const int& index ) {
return hepevtptr->jmohep[index-1][0]; }
117 static int last_parent(
const int& index ) {
return hepevtptr->jmohep[index-1][1]; }
118 static int first_child(
const int& index ) {
return hepevtptr->jdahep[index-1][0]; }
119 static int last_child(
const int& index ) {
return hepevtptr->jdahep[index-1][1]; }
120 static double px(
const int& index ) {
return hepevtptr->phep[index-1][0]; }
121 static double py(
const int& index ) {
return hepevtptr->phep[index-1][1]; }
122 static double pz(
const int& index ) {
return hepevtptr->phep[index-1][2]; }
123 static double e(
const int& index ) {
return hepevtptr->phep[index-1][3]; }
124 static double m(
const int& index ) {
return hepevtptr->phep[index-1][4]; }
125 static double x(
const int& index ) {
return hepevtptr->vhep[index-1][0]; }
126 static double y(
const int& index ) {
return hepevtptr->vhep[index-1][1]; }
127 static double z(
const int& index ) {
return hepevtptr->vhep[index-1][2]; }
128 static double t(
const int& index ) {
return hepevtptr->vhep[index-1][3]; }
129 static int number_parents(
const int& index );
130 static int number_children(
const int& index );
131 static int number_children_exact(
const int& index );
136 static void set_id(
const int& index,
const int&
id ) { hepevtptr->idhep[index-1] =
id; }
137 static void set_parents(
const int& index,
const int& firstparent,
const int& lastparent );
138 static void set_children(
const int& index,
const int& firstchild,
const int& lastchild );
139 static void set_momentum(
const int& index,
const double& px,
const double& py,
const double& pz,
const double& e );
140 static void set_mass(
const int& index,
double mass );
141 static void set_position(
const int& index,
const double& x,
const double& y,
const double& z,
const double& t );
149 ostr <<
" Event No.: " << hepevtptr->nevhep << std::endl;
150 ostr<<
" Nr Type Parent(s) Daughter(s) Px Py Pz E Inv. M." << std::endl;
151 for(
int i=1; i<=hepevtptr->nhep; ++i )
161 sprintf(buf,
"%5i %6i",index,hepevtptr->idhep[index-1]);
163 sprintf(buf,
"%4i - %4i ",hepevtptr->jmohep[index-1][0],hepevtptr->jmohep[index-1][1]);
165 sprintf(buf,
"%4i - %4i ",hepevtptr->jdahep[index-1][0],hepevtptr->jdahep[index-1][1]);
168 sprintf(buf,
"%8.2f %8.2f %8.2f %8.2f %8.2f",hepevtptr->phep[index-1][0],hepevtptr->phep[index-1][1],hepevtptr->phep[index-1][2],hepevtptr->phep[index-1][3],hepevtptr->phep[index-1][4]);
169 ostr << buf << std::endl;
176 printf(
"HEPEVT_Wrapper::check_hepevt_consistency is not implemented!\n");
182 memset(hepevtptr,0,
sizeof(
struct HEPEVT));
187 return (hepevtptr->jmohep[index-1][0]) ? (hepevtptr->jmohep[index-1][1]) ? hepevtptr->jmohep[index-1][1]-hepevtptr->jmohep[index-1][0] : 1 : 0;
192 return (hepevtptr->jdahep[index-1][0]) ? (hepevtptr->jdahep[index-1][1]) ? hepevtptr->jdahep[index-1][1]-hepevtptr->jdahep[index-1][0] : 1 : 0;
198 for(
int i=1; i<=hepevtptr->nhep; ++i )
199 if (((hepevtptr->jmohep[i-1][0]<=index&&hepevtptr->jmohep[i-1][1]>=index))||(hepevtptr->jmohep[i-1][0]==index)||(hepevtptr->jmohep[i-1][1]==index)) nc++;
207 hepevtptr->jmohep[index-1][0] = firstparent;
208 hepevtptr->jmohep[index-1][1] = lastparent;
213 hepevtptr->jdahep[index-1][0] = firstchild;
214 hepevtptr->jdahep[index-1][1] = lastchild;
219 hepevtptr->phep[index-1][0] =
px;
220 hepevtptr->phep[index-1][1] =
py;
221 hepevtptr->phep[index-1][2] =
pz;
222 hepevtptr->phep[index-1][3] =
e;
227 hepevtptr->phep[index-1][4] = mass;
232 hepevtptr->vhep[index-1][0] =
x;
233 hepevtptr->vhep[index-1][1] =
y;
234 hepevtptr->vhep[index-1][2] =
z;
235 hepevtptr->vhep[index-1][3] =
t;
Definition of class GenEvent.
#define HEPMC3_HEPEVT_NMXHEP
HEPMC3_HEPEVT_PRECISION momentum_t
Precision of the 4-momentum, time-space position and mass.
#define HEPMC3_HEPEVT_PRECISION
static const int NMXHEP
Number of particles in the HEPEVT structure.
static double pz(const int &index)
Get Z momentum.
static int last_child(const int &index)
Get index of last daughter.
static void set_mass(const int &index, double mass)
Set mass.
static double py(const int &index)
Get Y momentum.
static void set_momentum(const int &index, const double &px, const double &py, const double &pz, const double &e)
Set 4-momentum.
static void set_number_entries(const int &noentries)
Set number of entries.
static int number_children_exact(const int &index)
Get number of children by counting.
static double m(const int &index)
Get generated mass.
static int number_parents(const int &index)
Get number of parents.
static bool GenEvent_to_HEPEVT(const GenEvent *evt)
Convert GenEvent to HEPEVT.
static void print_hepevt_particle(int index, std::ostream &ostr=std::cout)
Print particle information.
static void print_hepevt(std::ostream &ostr=std::cout)
Print information from HEPEVT common block.
static void zero_everything()
Set all entries in HEPEVT to zero.
static void set_id(const int &index, const int &id)
Set PDG particle id.
static int max_number_entries()
Block size.
static void set_status(const int &index, const int &status)
Set status code.
static bool check_hepevt_consistency(std::ostream &ostr=std::cout)
Check for problems with HEPEVT common block.
static bool fix_daughters()
Tries to fix list of daughters.
static void set_hepevt_address(char *c)
Set Fortran block address.
static double y(const int &index)
Get Y Production vertex.
static double t(const int &index)
Get production time.
static int last_parent(const int &index)
Get index of last mother.
static double e(const int &index)
Get Energy.
static double z(const int &index)
Get Z Production vertex.
static double x(const int &index)
Get X Production vertex.
static int first_child(const int &index)
Get index of 1st daughter.
static int event_number()
Get event number.
static int status(const int &index)
Get status code.
static bool HEPEVT_to_GenEvent(GenEvent *evt)
Convert HEPEVT to GenEvent.
static void set_parents(const int &index, const int &firstparent, const int &lastparent)
Set parents.
static void set_position(const int &index, const double &x, const double &y, const double &z, const double &t)
Set position in time-space.
static double px(const int &index)
Get X momentum.
static int first_parent(const int &index)
Get index of 1st mother.
static void set_children(const int &index, const int &firstchild, const int &lastchild)
Set children.
static int number_entries()
Get number of entries.
static int id(const int &index)
Get PDG particle id.
static void set_event_number(const int &evtno)
Set event number.
static int number_children(const int &index)
Get number of children from the range of daughters.
C structure representing Fortran common block HEPEVT T. Sjöstrand et al., "A proposed standard event ...