#include <HEPEVT_Wrapper.h>
Static Public Member Functions | |
static void | print_hepevt (std::ostream &ostr=std::cout) |
write information from HEPEVT common block | |
static void | print_hepevt_particle (int index, std::ostream &ostr=std::cout) |
write particle information to ostr | |
static bool | is_double_precision () |
True if common block uses double. | |
static bool | check_hepevt_consistency (std::ostream &ostr=std::cout) |
check for problems with HEPEVT common block | |
static void | zero_everything () |
set all entries in HEPEVT to zero | |
static int | event_number () |
event number | |
static int | number_entries () |
num entries in current evt | |
static int | status (int index) |
status code | |
static int | id (int index) |
PDG particle id. | |
static int | first_parent (int index) |
index of 1st mother | |
static int | last_parent (int index) |
index of last mother | |
static int | number_parents (int index) |
number of parents | |
static int | first_child (int index) |
index of 1st daughter | |
static int | last_child (int index) |
index of last daughter | |
static int | number_children (int index) |
number of children | |
static double | px (int index) |
X momentum. | |
static double | py (int index) |
Y momentum. | |
static double | pz (int index) |
Z momentum. | |
static double | e (int index) |
Energy. | |
static double | m (int index) |
generated mass | |
static double | x (int index) |
X Production vertex. | |
static double | y (int index) |
Y Production vertex. | |
static double | z (int index) |
Z Production vertex. | |
static double | t (int index) |
production time | |
static void | set_event_number (int evtno) |
set event number | |
static void | set_number_entries (int noentries) |
set number of entries in HEPEVT | |
static void | set_status (int index, int status) |
set particle status | |
static void | set_id (int index, int id) |
set particle ID | |
static void | set_parents (int index, int firstparent, int lastparent) |
define parents of a particle | |
static void | set_children (int index, int firstchild, int lastchild) |
define children of a particle | |
static void | set_momentum (int index, double px, double py, double pz, double e) |
set particle momentum | |
static void | set_mass (int index, double mass) |
set particle mass | |
static void | set_position (int index, double x, double y, double z, double t) |
set particle production vertex | |
static unsigned int | sizeof_int () |
size of integer in bytes | |
static unsigned int | sizeof_real () |
size of real in bytes | |
static int | max_number_entries () |
size of common block | |
static void | set_sizeof_int (unsigned int) |
define size of integer | |
static void | set_sizeof_real (unsigned int) |
define size of real | |
static void | set_max_number_entries (unsigned int) |
define size of common block | |
Static Protected Member Functions | |
static double | byte_num_to_double (unsigned int) |
navigate a byte array | |
static int | byte_num_to_int (unsigned int) |
navigate a byte array | |
static void | write_byte_num (double, unsigned int) |
pretend common block is an array of bytes | |
static void | write_byte_num (int, unsigned int) |
pretend common block is an array of bytes | |
static void | print_legend (std::ostream &ostr=std::cout) |
print output legend | |
Static Private Attributes | |
static unsigned int | s_sizeof_int |
static unsigned int | s_sizeof_real |
static unsigned int | s_max_number_entries |
Definition at line 130 of file HEPEVT_Wrapper.h.
static void HepMC::HEPEVT_Wrapper::print_hepevt | ( | std::ostream & | ostr = std::cout |
) | [static] |
write information from HEPEVT common block
static void HepMC::HEPEVT_Wrapper::print_hepevt_particle | ( | int | index, | |
std::ostream & | ostr = std::cout | |||
) | [static] |
write particle information to ostr
bool HepMC::HEPEVT_Wrapper::is_double_precision | ( | ) | [inline, static] |
True if common block uses double.
Definition at line 337 of file HEPEVT_Wrapper.h.
00338 { 00339 // true if 8byte floating point numbers are used in the HepEVT common. 00340 return ( sizeof(double) == sizeof_real() ); 00341 }
static bool HepMC::HEPEVT_Wrapper::check_hepevt_consistency | ( | std::ostream & | ostr = std::cout |
) | [static] |
check for problems with HEPEVT common block
static void HepMC::HEPEVT_Wrapper::zero_everything | ( | ) | [static] |
set all entries in HEPEVT to zero
int HepMC::HEPEVT_Wrapper::event_number | ( | ) | [inline, static] |
int HepMC::HEPEVT_Wrapper::number_entries | ( | ) | [inline, static] |
num entries in current evt
Definition at line 346 of file HEPEVT_Wrapper.h.
00347 { 00348 int nhep = byte_num_to_int( 1*sizeof_int() ); 00349 return ( nhep <= max_number_entries() ? 00350 nhep : max_number_entries() ); 00351 }
int HepMC::HEPEVT_Wrapper::status | ( | int | index | ) | [inline, static] |
status code
Definition at line 353 of file HEPEVT_Wrapper.h.
00354 { return byte_num_to_int( (2+index-1) * sizeof_int() ); }
int HepMC::HEPEVT_Wrapper::id | ( | int | index | ) | [inline, static] |
PDG particle id.
Definition at line 356 of file HEPEVT_Wrapper.h.
00357 { 00358 return byte_num_to_int( (2+max_number_entries()+index-1) 00359 * sizeof_int() ); 00360 }
int HepMC::HEPEVT_Wrapper::first_parent | ( | int | index | ) | [inline, static] |
index of 1st mother
Definition at line 362 of file HEPEVT_Wrapper.h.
00363 { 00364 int parent = byte_num_to_int( (2+2*max_number_entries()+2*(index-1)) 00365 * sizeof_int() ); 00366 return ( parent > 0 && parent <= number_entries() ) ? 00367 parent : 0; 00368 }
int HepMC::HEPEVT_Wrapper::last_parent | ( | int | index | ) | [inline, static] |
index of last mother
Definition at line 370 of file HEPEVT_Wrapper.h.
00371 { 00372 // Returns the Index of the LAST parent in the HEPEVT record 00373 // for particle with Index index. 00374 // If there is only one parent, the last parent is forced to 00375 // be the same as the first parent. 00376 // If there are no parents for this particle, both the first_parent 00377 // and the last_parent with return 0. 00378 // Error checking is done to ensure the parent is always 00379 // within range ( 0 <= parent <= nhep ) 00380 // 00381 int firstparent = first_parent(index); 00382 int parent = byte_num_to_int( (2+2*max_number_entries()+2*(index-1)+1) 00383 * sizeof_int() ); 00384 return ( parent > firstparent && parent <= number_entries() ) 00385 ? parent : firstparent; 00386 }
int HepMC::HEPEVT_Wrapper::number_parents | ( | int | index | ) | [inline, static] |
number of parents
Definition at line 388 of file HEPEVT_Wrapper.h.
00388 { 00389 int firstparent = first_parent(index); 00390 return ( firstparent>0 ) ? 00391 ( 1+last_parent(index)-firstparent ) : 0; 00392 }
int HepMC::HEPEVT_Wrapper::first_child | ( | int | index | ) | [inline, static] |
index of 1st daughter
Definition at line 394 of file HEPEVT_Wrapper.h.
00395 { 00396 int child = byte_num_to_int( (2+4*max_number_entries()+2*(index-1)) 00397 * sizeof_int() ); 00398 return ( child > 0 && child <= number_entries() ) ? 00399 child : 0; 00400 }
int HepMC::HEPEVT_Wrapper::last_child | ( | int | index | ) | [inline, static] |
index of last daughter
Definition at line 402 of file HEPEVT_Wrapper.h.
00403 { 00404 // Returns the Index of the LAST child in the HEPEVT record 00405 // for particle with Index index. 00406 // If there is only one child, the last child is forced to 00407 // be the same as the first child. 00408 // If there are no children for this particle, both the first_child 00409 // and the last_child with return 0. 00410 // Error checking is done to ensure the child is always 00411 // within range ( 0 <= parent <= nhep ) 00412 // 00413 int firstchild = first_child(index); 00414 int child = byte_num_to_int( (2+4*max_number_entries()+2*(index-1)+1) 00415 * sizeof_int() ); 00416 return ( child > firstchild && child <= number_entries() ) 00417 ? child : firstchild; 00418 }
int HepMC::HEPEVT_Wrapper::number_children | ( | int | index | ) | [inline, static] |
number of children
Definition at line 420 of file HEPEVT_Wrapper.h.
00421 { 00422 int firstchild = first_child(index); 00423 return ( firstchild>0 ) ? 00424 ( 1+last_child(index)-firstchild ) : 0; 00425 }
double HepMC::HEPEVT_Wrapper::px | ( | int | index | ) | [inline, static] |
X momentum.
Definition at line 427 of file HEPEVT_Wrapper.h.
00428 { 00429 return byte_num_to_double( (2+6*max_number_entries())*sizeof_int() 00430 + (5*(index-1)+0) *sizeof_real() ); 00431 }
double HepMC::HEPEVT_Wrapper::py | ( | int | index | ) | [inline, static] |
Y momentum.
Definition at line 433 of file HEPEVT_Wrapper.h.
00434 { 00435 return byte_num_to_double( (2+6*max_number_entries())*sizeof_int() 00436 + (5*(index-1)+1) *sizeof_real() ); 00437 }
double HepMC::HEPEVT_Wrapper::pz | ( | int | index | ) | [inline, static] |
Z momentum.
Definition at line 440 of file HEPEVT_Wrapper.h.
00441 { 00442 return byte_num_to_double( (2+6*max_number_entries())*sizeof_int() 00443 + (5*(index-1)+2) *sizeof_real() ); 00444 }
double HepMC::HEPEVT_Wrapper::e | ( | int | index | ) | [inline, static] |
Energy.
Definition at line 446 of file HEPEVT_Wrapper.h.
00447 { 00448 return byte_num_to_double( (2+6*max_number_entries())*sizeof_int() 00449 + (5*(index-1)+3) *sizeof_real() ); 00450 }
double HepMC::HEPEVT_Wrapper::m | ( | int | index | ) | [inline, static] |
generated mass
Definition at line 452 of file HEPEVT_Wrapper.h.
00453 { 00454 return byte_num_to_double( (2+6*max_number_entries())*sizeof_int() 00455 + (5*(index-1)+4) *sizeof_real() ); 00456 }
double HepMC::HEPEVT_Wrapper::x | ( | int | index | ) | [inline, static] |
X Production vertex.
Definition at line 458 of file HEPEVT_Wrapper.h.
00459 { 00460 return byte_num_to_double( (2+6*max_number_entries())*sizeof_int() 00461 + ( 5*max_number_entries() 00462 + (4*(index-1)+0) ) *sizeof_real() ); 00463 }
double HepMC::HEPEVT_Wrapper::y | ( | int | index | ) | [inline, static] |
Y Production vertex.
Definition at line 465 of file HEPEVT_Wrapper.h.
00466 { 00467 return byte_num_to_double( (2+6*max_number_entries())*sizeof_int() 00468 + ( 5*max_number_entries() 00469 + (4*(index-1)+1) ) *sizeof_real() ); 00470 }
double HepMC::HEPEVT_Wrapper::z | ( | int | index | ) | [inline, static] |
Z Production vertex.
Definition at line 472 of file HEPEVT_Wrapper.h.
00473 { 00474 return byte_num_to_double( (2+6*max_number_entries())*sizeof_int() 00475 + ( 5*max_number_entries() 00476 + (4*(index-1)+2) ) *sizeof_real() ); 00477 }
double HepMC::HEPEVT_Wrapper::t | ( | int | index | ) | [inline, static] |
production time
Definition at line 479 of file HEPEVT_Wrapper.h.
00480 { 00481 return byte_num_to_double( (2+6*max_number_entries())*sizeof_int() 00482 + ( 5*max_number_entries() 00483 + (4*(index-1)+3) ) *sizeof_real() ); 00484 }
void HepMC::HEPEVT_Wrapper::set_event_number | ( | int | evtno | ) | [inline, static] |
set event number
Definition at line 486 of file HEPEVT_Wrapper.h.
00487 { write_byte_num( evtno, 0 ); }
void HepMC::HEPEVT_Wrapper::set_number_entries | ( | int | noentries | ) | [inline, static] |
set number of entries in HEPEVT
Definition at line 489 of file HEPEVT_Wrapper.h.
00490 { write_byte_num( noentries, 1*sizeof_int() ); }
void HepMC::HEPEVT_Wrapper::set_status | ( | int | index, | |
int | status | |||
) | [inline, static] |
set particle status
Definition at line 492 of file HEPEVT_Wrapper.h.
00493 { 00494 if ( index <= 0 || index > max_number_entries() ) return; 00495 write_byte_num( status, (2+index-1) * sizeof_int() ); 00496 }
void HepMC::HEPEVT_Wrapper::set_id | ( | int | index, | |
int | id | |||
) | [inline, static] |
set particle ID
Definition at line 498 of file HEPEVT_Wrapper.h.
00499 { 00500 if ( index <= 0 || index > max_number_entries() ) return; 00501 write_byte_num( id, (2+max_number_entries()+index-1) *sizeof_int() ); 00502 }
void HepMC::HEPEVT_Wrapper::set_parents | ( | int | index, | |
int | firstparent, | |||
int | lastparent | |||
) | [inline, static] |
define parents of a particle
Definition at line 504 of file HEPEVT_Wrapper.h.
00506 { 00507 if ( index <= 0 || index > max_number_entries() ) return; 00508 write_byte_num( firstparent, (2+2*max_number_entries()+2*(index-1)) 00509 *sizeof_int() ); 00510 write_byte_num( lastparent, (2+2*max_number_entries()+2*(index-1)+1) 00511 * sizeof_int() ); 00512 }
void HepMC::HEPEVT_Wrapper::set_children | ( | int | index, | |
int | firstchild, | |||
int | lastchild | |||
) | [inline, static] |
define children of a particle
Definition at line 514 of file HEPEVT_Wrapper.h.
00516 { 00517 if ( index <= 0 || index > max_number_entries() ) return; 00518 write_byte_num( firstchild, (2+4*max_number_entries()+2*(index-1)) 00519 *sizeof_int() ); 00520 write_byte_num( lastchild, (2+4*max_number_entries()+2*(index-1)+1) 00521 *sizeof_int() ); 00522 }
void HepMC::HEPEVT_Wrapper::set_momentum | ( | int | index, | |
double | px, | |||
double | py, | |||
double | pz, | |||
double | e | |||
) | [inline, static] |
set particle momentum
Definition at line 524 of file HEPEVT_Wrapper.h.
00526 { 00527 if ( index <= 0 || index > max_number_entries() ) return; 00528 write_byte_num( px, (2+6*max_number_entries()) *sizeof_int() 00529 + (5*(index-1)+0) *sizeof_real() ); 00530 write_byte_num( py, (2+6*max_number_entries())*sizeof_int() 00531 + (5*(index-1)+1) *sizeof_real() ); 00532 write_byte_num( pz, (2+6*max_number_entries())*sizeof_int() 00533 + (5*(index-1)+2) *sizeof_real() ); 00534 write_byte_num( e, (2+6*max_number_entries())*sizeof_int() 00535 + (5*(index-1)+3) *sizeof_real() ); 00536 }
void HepMC::HEPEVT_Wrapper::set_mass | ( | int | index, | |
double | mass | |||
) | [inline, static] |
set particle mass
Definition at line 538 of file HEPEVT_Wrapper.h.
00539 { 00540 if ( index <= 0 || index > max_number_entries() ) return; 00541 write_byte_num( mass, (2+6*max_number_entries())*sizeof_int() 00542 + (5*(index-1)+4) *sizeof_real() ); 00543 }
void HepMC::HEPEVT_Wrapper::set_position | ( | int | index, | |
double | x, | |||
double | y, | |||
double | z, | |||
double | t | |||
) | [inline, static] |
set particle production vertex
Definition at line 545 of file HEPEVT_Wrapper.h.
00547 { 00548 if ( index <= 0 || index > max_number_entries() ) return; 00549 write_byte_num( x, (2+6*max_number_entries())*sizeof_int() 00550 + ( 5*max_number_entries() 00551 + (4*(index-1)+0) ) *sizeof_real() ); 00552 write_byte_num( y, (2+6*max_number_entries())*sizeof_int() 00553 + ( 5*max_number_entries() 00554 + (4*(index-1)+1) ) *sizeof_real() ); 00555 write_byte_num( z, (2+6*max_number_entries())*sizeof_int() 00556 + ( 5*max_number_entries() 00557 + (4*(index-1)+2) ) *sizeof_real() ); 00558 write_byte_num( t, (2+6*max_number_entries())*sizeof_int() 00559 + ( 5*max_number_entries() 00560 + (4*(index-1)+3) ) *sizeof_real() ); 00561 }
unsigned int HepMC::HEPEVT_Wrapper::sizeof_int | ( | ) | [inline, static] |
size of integer in bytes
Definition at line 225 of file HEPEVT_Wrapper.h.
00225 { return s_sizeof_int; }
unsigned int HepMC::HEPEVT_Wrapper::sizeof_real | ( | ) | [inline, static] |
size of real in bytes
Definition at line 227 of file HEPEVT_Wrapper.h.
00227 { return s_sizeof_real; }
int HepMC::HEPEVT_Wrapper::max_number_entries | ( | ) | [inline, static] |
size of common block
Definition at line 229 of file HEPEVT_Wrapper.h.
00230 { return (int)s_max_number_entries; }
void HepMC::HEPEVT_Wrapper::set_sizeof_int | ( | unsigned | int | ) | [inline, static] |
define size of integer
Definition at line 232 of file HEPEVT_Wrapper.h.
00233 { 00234 if ( size != sizeof(short int) && size != sizeof(long int) && size != sizeof(int) ) { 00235 std::cerr << "HepMC is not able to handle integers " 00236 << " of size other than 2 or 4." 00237 << " You requested: " << size << std::endl; 00238 } 00239 s_sizeof_int = size; 00240 }
void HepMC::HEPEVT_Wrapper::set_sizeof_real | ( | unsigned | int | ) | [inline, static] |
define size of real
Definition at line 242 of file HEPEVT_Wrapper.h.
00242 { 00243 if ( size != sizeof(float) && size != sizeof(double) ) { 00244 std::cerr << "HepMC is not able to handle floating point numbers" 00245 << " of size other than 4 or 8." 00246 << " You requested: " << size << std::endl; 00247 } 00248 s_sizeof_real = size; 00249 }
void HepMC::HEPEVT_Wrapper::set_max_number_entries | ( | unsigned | int | ) | [inline, static] |
define size of common block
Definition at line 251 of file HEPEVT_Wrapper.h.
00251 { 00252 s_max_number_entries = size; 00253 }
double HepMC::HEPEVT_Wrapper::byte_num_to_double | ( | unsigned | int | ) | [inline, static, protected] |
navigate a byte array
Definition at line 255 of file HEPEVT_Wrapper.h.
00255 { 00256 if ( b >= hepevt_bytes_allocation ) std::cerr 00257 << "HEPEVT_Wrapper: requested hepevt data exceeds allocation" 00258 << std::endl; 00259 if ( s_sizeof_real == sizeof(float) ) { 00260 float* myfloat = (float*)&hepevt.data[b]; 00261 return (double)(*myfloat); 00262 } else if ( s_sizeof_real == sizeof(double) ) { 00263 double* mydouble = (double*)&hepevt.data[b]; 00264 return (*mydouble); 00265 } else { 00266 std::cerr 00267 << "HEPEVT_Wrapper: illegal floating point number length." 00268 << s_sizeof_real << std::endl; 00269 } 00270 return 0; 00271 }
int HepMC::HEPEVT_Wrapper::byte_num_to_int | ( | unsigned | int | ) | [inline, static, protected] |
navigate a byte array
Definition at line 273 of file HEPEVT_Wrapper.h.
00273 { 00274 if ( b >= hepevt_bytes_allocation ) std::cerr 00275 << "HEPEVT_Wrapper: requested hepevt data exceeds allocation" 00276 << std::endl; 00277 if ( s_sizeof_int == sizeof(short int) ) { 00278 short int* myshortint = (short int*)&hepevt.data[b]; 00279 return (int)(*myshortint); 00280 } else if ( s_sizeof_int == sizeof(long int) ) { 00281 long int* mylongint = (long int*)&hepevt.data[b]; 00282 return (*mylongint); 00283 // on some 64 bit machines, int, short, and long are all different 00284 } else if ( s_sizeof_int == sizeof(int) ) { 00285 int* myint = (int*)&hepevt.data[b]; 00286 return (*myint); 00287 } else { 00288 std::cerr 00289 << "HEPEVT_Wrapper: illegal integer number length." 00290 << s_sizeof_int << std::endl; 00291 } 00292 return 0; 00293 }
void HepMC::HEPEVT_Wrapper::write_byte_num | ( | double | , | |
unsigned | int | |||
) | [inline, static, protected] |
pretend common block is an array of bytes
Definition at line 295 of file HEPEVT_Wrapper.h.
00295 { 00296 if ( b >= hepevt_bytes_allocation ) std::cerr 00297 << "HEPEVT_Wrapper: requested hepevt data exceeds allocation" 00298 << std::endl; 00299 if ( s_sizeof_real == sizeof(float) ) { 00300 float* myfloat = (float*)&hepevt.data[b]; 00301 (*myfloat) = (float)in; 00302 } else if ( s_sizeof_real == sizeof(double) ) { 00303 double* mydouble = (double*)&hepevt.data[b]; 00304 (*mydouble) = (double)in; 00305 } else { 00306 std::cerr 00307 << "HEPEVT_Wrapper: illegal floating point number length." 00308 << s_sizeof_real << std::endl; 00309 } 00310 }
void HepMC::HEPEVT_Wrapper::write_byte_num | ( | int | , | |
unsigned | int | |||
) | [inline, static, protected] |
pretend common block is an array of bytes
Definition at line 312 of file HEPEVT_Wrapper.h.
00312 { 00313 if ( b >= hepevt_bytes_allocation ) std::cerr 00314 << "HEPEVT_Wrapper: requested hepevt data exceeds allocation" 00315 << std::endl; 00316 if ( s_sizeof_int == sizeof(short int) ) { 00317 short int* myshortint = (short int*)&hepevt.data[b]; 00318 (*myshortint) = (short int)in; 00319 } else if ( s_sizeof_int == sizeof(long int) ) { 00320 long int* mylongint = (long int*)&hepevt.data[b]; 00321 (*mylongint) = (int)in; 00322 // on some 64 bit machines, int, short, and long are all different 00323 } else if ( s_sizeof_int == sizeof(int) ) { 00324 int* myint = (int*)&hepevt.data[b]; 00325 (*myint) = (int)in; 00326 } else { 00327 std::cerr 00328 << "HEPEVT_Wrapper: illegal integer number length." 00329 << s_sizeof_int << std::endl; 00330 } 00331 }
static void HepMC::HEPEVT_Wrapper::print_legend | ( | std::ostream & | ostr = std::cout |
) | [static, protected] |
print output legend
unsigned int HepMC::HEPEVT_Wrapper::s_sizeof_int [static, private] |
Definition at line 216 of file HEPEVT_Wrapper.h.
unsigned int HepMC::HEPEVT_Wrapper::s_sizeof_real [static, private] |
Definition at line 217 of file HEPEVT_Wrapper.h.
unsigned int HepMC::HEPEVT_Wrapper::s_max_number_entries [static, private] |
Definition at line 218 of file HEPEVT_Wrapper.h.