6 #ifndef HEPMC_HEPEVT_WRAPPER_H 7 #define HEPMC_HEPEVT_WRAPPER_H 25 #ifndef HEPMC_HEPEVT_NMXHEP 27 #define HEPMC_HEPEVT_NMXHEP 10000 30 #ifndef HEPMC_HEPEVT_PRECISION 32 #define HEPMC_HEPEVT_PRECISION double 44 static const int NMXHEP = HEPMC_HEPEVT_NMXHEP;
45 typedef HEPMC_HEPEVT_PRECISION momentum_t;
62 momentum_t
phep [NMXHEP][5];
63 momentum_t
vhep [NMXHEP][4];
71 #ifndef HEPEVT_WRAPPER_HEADER_ONLY 72 #include "HepMC/GenEvent.h" 78 extern struct HEPEVT* hepevtptr;
88 static void print_hepevt( std::ostream& ostr = std::cout );
98 #ifndef HEPEVT_WRAPPER_HEADER_ONLY 115 static int id(
int index ) {
return hepevtptr->
idhep[index-1]; }
120 static double px(
int index ) {
return hepevtptr->
phep[index-1][0]; }
121 static double py(
int index ) {
return hepevtptr->
phep[index-1][1]; }
122 static double pz(
int index ) {
return hepevtptr->
phep[index-1][2]; }
123 static double e(
int index ) {
return hepevtptr->
phep[index-1][3]; }
124 static double m(
int index ) {
return hepevtptr->
phep[index-1][4]; }
125 static double x(
int index ) {
return hepevtptr->
vhep[index-1][0]; }
126 static double y(
int index ) {
return hepevtptr->
vhep[index-1][1]; }
127 static double z(
int index ) {
return hepevtptr->
vhep[index-1][2]; }
128 static double t(
int index ) {
return hepevtptr->
vhep[index-1][3]; }
137 static void set_parents(
int index,
int firstparent,
int lastparent );
138 static void set_children(
int index,
int firstchild,
int lastchild );
140 static void set_mass(
int index,
double mass );
141 static void set_position(
int index,
double x,
double y,
double z,
double t );
149 ostr <<
" Event No.: " << hepevtptr->
nevhep << endl;
150 ostr<<
" Nr Type Parent(s) Daughter(s) Px Py Pz E Inv. M." << 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]);
176 printf(
"HEPEVT_Wrapper::check_hepevt_consistency unimplemented!\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;
static double py(int index)
Get Y momentum.
static void set_number_entries(int noentries)
Set number of entries.
static int status(int index)
Get status code.
static bool GenEvent_to_HEPEVT(const GenEvent *evt)
Convert GenEvent to HEPEVT.
static void set_status(int index, int status)
Set status code.
static double y(int index)
Get Y Production vertex.
static double e(int index)
Get Energy.
static double px(int index)
Get X momentum.
static void set_parents(int index, int firstparent, int lastparent)
Set parents.
static double pz(int index)
Get Z momentum.
static void set_hepevt_address(char *c)
Set Fortran block address.
static int first_child(int index)
Get index of 1st daughter.
momentum_t phep[NMXHEP][5]
Momentum: px, py, pz, e, m.
int nhep
Number of entries in the event.
static double z(int index)
Get Z Production vertex.
static int max_number_entries()
Block size.
momentum_t vhep[NMXHEP][4]
Time-space position: x, y, z, t.
An interface to HEPEVT common block.
int jmohep[NMXHEP][2]
Pointer to position of 1st and 2nd (or last!) mother.
int isthep[NMXHEP]
Status code.
static void print_hepevt(std::ostream &ostr=std::cout)
Print information from HEPEVT common block.
static int number_parents(int index)
Get number of parents.
static double t(int index)
Get production time.
Stores event-related information.
static void set_id(int index, int id)
Set PDG particle id.
static int last_child(int index)
Get index of last daughter.
static bool check_hepevt_consistency(std::ostream &ostr=std::cout)
Check for problems with HEPEVT common block.
Fortran common block HEPEVT.
static int event_number()
Get event number.
static void set_event_number(int evtno)
Set event number.
static double x(int index)
Get X Production vertex.
static int first_parent(int index)
Get index of 1st mother.
static int id(int index)
Get PDG particle id.
static double m(int index)
Get generated mass.
static void print_hepevt_particle(int index, std::ostream &ostr=std::cout)
Print particle information.
static void set_children(int index, int firstchild, int lastchild)
Set children.
static void set_mass(int index, double mass)
Set mass.
static int number_entries()
Get number of entries.
static int last_parent(int index)
Get index of last mother.
static int number_children(int index)
Get number of children from the range of daughters.
static bool fix_daughters()
Tries to fix list of daughters.
Definition of template class SmartPointer.
static int number_children_exact(int index)
Get number of children by counting.
static void zero_everything()
Set all entries in HEPEVT to zero.
static void set_position(int index, double x, double y, double z, double t)
Set position in time-space.
static void set_momentum(int index, double px, double py, double pz, double e)
Set 4-momentum.
static bool HEPEVT_to_GenEvent(GenEvent *evt)
Convert HEPEVT to GenEvent.
int jdahep[NMXHEP][2]
Pointer to position of 1nd and 2nd (or last!) daughter.