3 #ifndef HEPEVT_EntriesAllocation
4 #define HEPEVT_EntriesAllocation 10000
5 #endif // HEPEVT_EntriesAllocation
8 #ifndef HEPMC_HEPEVT_COMMON_H
9 #define HEPMC_HEPEVT_COMMON_H
66 const unsigned int hepevt_bytes_allocation =
67 sizeof(
long int) * ( 2 + 6 * HEPEVT_EntriesAllocation )
68 +
sizeof(double) * ( 9 * HEPEVT_EntriesAllocation );
71 #ifdef _WIN32 // Platform: Windows MS Visual C++
73 char data[hepevt_bytes_allocation];
75 extern "C" HEPEVT_DEF
HEPEVT;
81 char data[hepevt_bytes_allocation];
84 #define hepevt hepevt_
88 #endif // HEPMC_HEPEVT_COMMON_H
91 #ifndef HEPMC_HEPEVT_WRAPPER_H
92 #define HEPMC_HEPEVT_WRAPPER_H
134 static void print_hepevt( std::ostream& ostr = std::cout );
137 std::ostream& ostr = std::cout );
151 static int status(
int index );
152 static int id(
int index );
159 static double px(
int index );
160 static double py(
int index );
161 static double pz(
int index );
162 static double e(
int index );
163 static double m(
int index );
164 static double x(
int index );
165 static double y(
int index );
166 static double z(
int index );
167 static double t(
int index );
178 static void set_status(
int index,
int status );
180 static void set_id(
int index,
int id );
182 static void set_parents(
int index,
int firstparent,
int lastparent );
184 static void set_children(
int index,
int firstchild,
int lastchild );
186 static void set_momentum(
int index,
double px,
double py,
187 double pz,
double e );
189 static void set_mass(
int index,
double mass );
191 static void set_position(
int index,
double x,
double y,
double z,
213 static void print_legend( std::ostream& ostr = std::cout );
216 static unsigned int s_sizeof_int;
217 static unsigned int s_sizeof_real;
218 static unsigned int s_max_number_entries;
230 {
return (
int)s_max_number_entries; }
234 if ( size !=
sizeof(
short int) && size !=
sizeof(
long int) && size !=
sizeof(
int) ) {
235 std::cerr <<
"HepMC is not able to handle integers "
236 <<
" of size other than 2 or 4."
237 <<
" You requested: " << size << std::endl;
243 if ( size !=
sizeof(
float) && size !=
sizeof(
double) ) {
244 std::cerr <<
"HepMC is not able to handle floating point numbers"
245 <<
" of size other than 4 or 8."
246 <<
" You requested: " << size << std::endl;
248 s_sizeof_real = size;
252 s_max_number_entries = size;
256 if ( b >= hepevt_bytes_allocation ) std::cerr
257 <<
"HEPEVT_Wrapper: requested hepevt data exceeds allocation"
259 if ( s_sizeof_real ==
sizeof(
float) ) {
260 float* myfloat = (
float*)&hepevt.data[b];
261 return (
double)(*myfloat);
262 }
else if ( s_sizeof_real ==
sizeof(
double) ) {
263 double* mydouble = (
double*)&hepevt.data[b];
267 <<
"HEPEVT_Wrapper: illegal floating point number length."
268 << s_sizeof_real << std::endl;
274 if ( b >= hepevt_bytes_allocation ) std::cerr
275 <<
"HEPEVT_Wrapper: requested hepevt data exceeds allocation"
277 if ( s_sizeof_int ==
sizeof(
short int) ) {
278 short int* myshortint = (
short int*)&hepevt.data[b];
279 return (
int)(*myshortint);
280 }
else if ( s_sizeof_int ==
sizeof(
long int) ) {
281 long int* mylongint = (
long int*)&hepevt.data[b];
284 }
else if ( s_sizeof_int ==
sizeof(
int) ) {
285 int* myint = (
int*)&hepevt.data[b];
289 <<
"HEPEVT_Wrapper: illegal integer number length."
290 << s_sizeof_int << std::endl;
296 if ( b >= hepevt_bytes_allocation ) std::cerr
297 <<
"HEPEVT_Wrapper: requested hepevt data exceeds allocation"
299 if ( s_sizeof_real ==
sizeof(
float) ) {
300 float* myfloat = (
float*)&hepevt.data[b];
301 (*myfloat) = (float)in;
302 }
else if ( s_sizeof_real ==
sizeof(
double) ) {
303 double* mydouble = (
double*)&hepevt.data[b];
304 (*mydouble) = (double)in;
307 <<
"HEPEVT_Wrapper: illegal floating point number length."
308 << s_sizeof_real << std::endl;
313 if ( b >= hepevt_bytes_allocation ) std::cerr
314 <<
"HEPEVT_Wrapper: requested hepevt data exceeds allocation"
316 if ( s_sizeof_int ==
sizeof(
short int) ) {
317 short int* myshortint = (
short int*)&hepevt.data[b];
318 (*myshortint) = (
short int)in;
319 }
else if ( s_sizeof_int ==
sizeof(
long int) ) {
320 long int* mylongint = (
long int*)&hepevt.data[b];
321 (*mylongint) = (int)in;
323 }
else if ( s_sizeof_int ==
sizeof(
int) ) {
324 int* myint = (
int*)&hepevt.data[b];
328 <<
"HEPEVT_Wrapper: illegal integer number length."
329 << s_sizeof_int << std::endl;
385 ? parent : firstparent;
390 return ( firstparent>0 ) ?
417 ? child : firstchild;
423 return ( firstchild>0 ) ?
525 double py,
double pz,
double e )
565 #endif // HEPMC_HEPEVT_WRAPPER_H
static void set_children(int index, int firstchild, int lastchild)
define children of a particle
static double y(int index)
Y Production vertex.
static void set_mass(int index, double mass)
set particle mass
static double z(int index)
Z Production vertex.
static int id(int index)
PDG particle id.
static int status(int index)
status code
static void set_number_entries(int noentries)
set number of entries in HEPEVT
static int first_parent(int index)
index of 1st mother
static int byte_num_to_int(unsigned int)
navigate a byte array
static void set_sizeof_int(unsigned int)
define size of integer
static int number_parents(int index)
number of parents
static void print_hepevt(std::ostream &ostr=std::cout)
write information from HEPEVT common block
static double x(int index)
X Production vertex.
Generic Wrapper for the fortran HEPEVT common block.
static int event_number()
event number
static void set_momentum(int index, double px, double py, double pz, double e)
set particle momentum
static void print_hepevt_particle(int index, std::ostream &ostr=std::cout)
write particle information to ostr
static double e(int index)
Energy.
static unsigned int sizeof_int()
size of integer in bytes
static void set_max_number_entries(unsigned int)
define size of common block
static int last_parent(int index)
index of last mother
static void print_legend(std::ostream &ostr=std::cout)
print output legend
static unsigned int sizeof_real()
size of real in bytes
static double px(int index)
X momentum.
static bool check_hepevt_consistency(std::ostream &ostr=std::cout)
check for problems with HEPEVT common block
static double t(int index)
production time
static int last_child(int index)
index of last daughter
static void set_parents(int index, int firstparent, int lastparent)
define parents of a particle
static void set_status(int index, int status)
set particle status
static void set_sizeof_real(unsigned int)
define size of real
static int number_entries()
num entries in current evt
static void write_byte_num(double, unsigned int)
pretend common block is an array of bytes
static double byte_num_to_double(unsigned int)
navigate a byte array
static int first_child(int index)
index of 1st daughter
static double py(int index)
Y momentum.
static double pz(int index)
Z momentum.
static void set_event_number(int evtno)
set event number
static bool is_double_precision()
True if common block uses double.
static void zero_everything()
set all entries in HEPEVT to zero
static int max_number_entries()
size of common block
static int number_children(int index)
number of children
static void set_id(int index, int id)
set particle ID
static double m(int index)
generated mass
static void set_position(int index, double x, double y, double z, double t)
set particle production vertex