CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Static Public Member Functions | Static Protected Member Functions | Static Private Attributes
EPOS::EPOS_Wrapper Class Reference

Generic Wrapper for the fortran EPOS common block. More...

#include <EPOS_Wrapper.h>

Static Public Member Functions

static double e (int index)
 Energy. More...
 
static int event_number ()
 event number More...
 
static int first_child (int index)
 index of 1st daughter More...
 
static int first_parent (int index)
 index of 1st mother More...
 
static int id (int index)
 PDG particle id. More...
 
static int last_child (int index)
 index of last daughter More...
 
static int last_parent (int index)
 index of last mother More...
 
static double m (int index)
 generated mass More...
 
static int max_number_entries ()
 size of common block More...
 
static int number_children (int index)
 number of children More...
 
static int number_entries ()
 num entries in current evt More...
 
static int number_parents (int index)
 number of parents More...
 
static void print_hepcom (std::ostream &ostr=std::cout)
 write information from EPOS common block More...
 
static void print_hepcom_particle (int index, std::ostream &ostr=std::cout)
 write particle information to ostr More...
 
static double px (int index)
 X momentum. More...
 
static double py (int index)
 Y momentum. More...
 
static double pz (int index)
 Z momentum. More...
 
static void set_children (int index, int firstchild, int lastchild)
 define children of a particle More...
 
static void set_event_number (int evtno)
 set event number More...
 
static void set_id (int index, int id)
 set particle ID More...
 
static void set_mass (int index, double mass)
 set particle mass More...
 
static void set_max_number_entries (unsigned int)
 define size of common block More...
 
static void set_momentum (int index, double px, double py, double pz, double e)
 set particle momentum More...
 
static void set_number_entries (int noentries)
 set number of entries in EPOS More...
 
static void set_parents (int index, int firstparent, int lastparent)
 define parents of a particle More...
 
static void set_position (int index, double x, double y, double z, double t)
 set particle production vertex More...
 
static void set_sizeof_int (unsigned int)
 define size of integer More...
 
static void set_sizeof_real (unsigned int)
 define size of real More...
 
static void set_status (int index, int status)
 set particle status More...
 
static unsigned int sizeof_int ()
 size of integer in bytes More...
 
static unsigned int sizeof_real ()
 size of real in bytes More...
 
static int status (int index)
 status code More...
 
static double t (int index)
 production time More...
 
static double x (int index)
 X Production vertex. More...
 
static double y (int index)
 Y Production vertex. More...
 
static double z (int index)
 Z Production vertex. More...
 
static void zero_everything ()
 set all entries in EPOS to zero More...
 

Static Protected Member Functions

static double byte_num_to_double (unsigned int)
 navigate a byte array More...
 
static int byte_num_to_int (unsigned int)
 navigate a byte array More...
 
static void print_legend (std::ostream &ostr=std::cout)
 print output legend More...
 
static void write_byte_num (double, unsigned int)
 pretend common block is an array of bytes More...
 
static void write_byte_num (int, unsigned int)
 pretend common block is an array of bytes More...
 

Static Private Attributes

static unsigned int s_max_number_entries = 99900
 
static unsigned int s_sizeof_int = 4
 
static unsigned int s_sizeof_real = sizeof(double)
 

Detailed Description

Generic Wrapper for the fortran EPOS common block.

This class is intended for static use only - it makes no sense to instantiate it.

Definition at line 131 of file EPOS_Wrapper.h.

Member Function Documentation

double EPOS::EPOS_Wrapper::byte_num_to_double ( unsigned int  b)
inlinestaticprotected

navigate a byte array

Definition at line 251 of file EPOS_Wrapper.h.

References ecal_dqm_sourceclient-live_cfg::cerr, epos_bytes_allocation, hepcom, mathSSE::return(), and s_sizeof_real.

Referenced by e(), m(), px(), py(), pz(), t(), x(), y(), and z().

251  {
253  << "EPOS_Wrapper: requested hepcom data exceeds allocation"
254  << std::endl;
255  if ( s_sizeof_real == sizeof(float) ) {
256  float* myfloat = (float*)&hepcom.data[b];
257  return (double)(*myfloat);
258  } else if ( s_sizeof_real == sizeof(double) ) {
259  double* mydouble = (double*)&hepcom.data[b];
260  return (*mydouble);
261  } else {
262  std::cerr
263  << "EPOS_Wrapper: illegal floating point number length."
264  << s_sizeof_real << std::endl;
265  }
266  return 0;
267  }
return((rh^lh)&mask)
#define hepcom
Definition: EPOS_Wrapper.h:85
double b
Definition: hdecay.h:120
static unsigned int s_sizeof_real
Definition: EPOS_Wrapper.h:213
const unsigned int epos_bytes_allocation
Definition: EPOS_Wrapper.h:67
int EPOS::EPOS_Wrapper::byte_num_to_int ( unsigned int  b)
inlinestaticprotected

navigate a byte array

Definition at line 269 of file EPOS_Wrapper.h.

References ecal_dqm_sourceclient-live_cfg::cerr, epos_bytes_allocation, hepcom, mathSSE::return(), and s_sizeof_int.

Referenced by event_number(), first_child(), first_parent(), id(), last_child(), last_parent(), number_entries(), and status().

269  {
271  << "EPOS_Wrapper: requested hepcom data exceeds allocation"
272  << std::endl;
273  if ( s_sizeof_int == sizeof(short int) ) {
274  short int* myshortint = (short int*)&hepcom.data[b];
275  return (int)(*myshortint);
276  } else if ( s_sizeof_int == sizeof(long int) ) {
277  long int* mylongint = (long int*)&hepcom.data[b];
278  return (*mylongint);
279  // on some 64 bit machines, int, short, and long are all different
280  } else if ( s_sizeof_int == sizeof(int) ) {
281  int* myint = (int*)&hepcom.data[b];
282  return (*myint);
283  } else {
284  std::cerr
285  << "EPOS_Wrapper: illegal integer number length."
286  << s_sizeof_int << std::endl;
287  }
288  return 0;
289  }
return((rh^lh)&mask)
#define hepcom
Definition: EPOS_Wrapper.h:85
double b
Definition: hdecay.h:120
const unsigned int epos_bytes_allocation
Definition: EPOS_Wrapper.h:67
static unsigned int s_sizeof_int
Definition: EPOS_Wrapper.h:212
double EPOS::EPOS_Wrapper::e ( int  index)
inlinestatic

Energy.

Definition at line 436 of file EPOS_Wrapper.h.

References byte_num_to_double(), max_number_entries(), sizeof_int(), and sizeof_real().

Referenced by EPOS::IO_EPOS::build_particle(), and print_hepcom_particle().

437  {
439  + (5*(index-1)+3) *sizeof_real() );
440  }
static unsigned int sizeof_int()
size of integer in bytes
Definition: EPOS_Wrapper.h:221
static double byte_num_to_double(unsigned int)
navigate a byte array
Definition: EPOS_Wrapper.h:251
static int max_number_entries()
size of common block
Definition: EPOS_Wrapper.h:225
static unsigned int sizeof_real()
size of real in bytes
Definition: EPOS_Wrapper.h:223
int EPOS::EPOS_Wrapper::event_number ( )
inlinestatic

event number

Definition at line 333 of file EPOS_Wrapper.h.

References byte_num_to_int().

Referenced by EPOS::IO_EPOS::build_end_vertex(), EPOS::IO_EPOS::build_production_vertex(), EPOS::IO_EPOS::fill_next_event(), and print_hepcom().

334  { return byte_num_to_int(0); }
static int byte_num_to_int(unsigned int)
navigate a byte array
Definition: EPOS_Wrapper.h:269
int EPOS::EPOS_Wrapper::first_child ( int  index)
inlinestatic

index of 1st daughter

Definition at line 384 of file EPOS_Wrapper.h.

References byte_num_to_int(), max_number_entries(), number_entries(), and sizeof_int().

Referenced by EPOS::IO_EPOS::build_end_vertex(), last_child(), number_children(), and print_hepcom_particle().

385  {
386  int child = byte_num_to_int( (2+4*max_number_entries()+2*(index-1))
387  * sizeof_int() );
388  return ( child > 0 && child <= number_entries() ) ?
389  child : 0;
390  }
static unsigned int sizeof_int()
size of integer in bytes
Definition: EPOS_Wrapper.h:221
static int number_entries()
num entries in current evt
Definition: EPOS_Wrapper.h:336
static int byte_num_to_int(unsigned int)
navigate a byte array
Definition: EPOS_Wrapper.h:269
static int max_number_entries()
size of common block
Definition: EPOS_Wrapper.h:225
int EPOS::EPOS_Wrapper::first_parent ( int  index)
inlinestatic

index of 1st mother

Definition at line 352 of file EPOS_Wrapper.h.

References byte_num_to_int(), max_number_entries(), number_entries(), dbtoconf::parent, and sizeof_int().

Referenced by EPOS::IO_EPOS::build_production_vertex(), last_parent(), number_parents(), and print_hepcom_particle().

353  {
354  int parent = byte_num_to_int( (2+2*max_number_entries()+2*(index-1))
355  * sizeof_int() );
356  return ( parent > 0 && parent <= number_entries() ) ?
357  parent : 0;
358  }
list parent
Definition: dbtoconf.py:74
static unsigned int sizeof_int()
size of integer in bytes
Definition: EPOS_Wrapper.h:221
static int number_entries()
num entries in current evt
Definition: EPOS_Wrapper.h:336
static int byte_num_to_int(unsigned int)
navigate a byte array
Definition: EPOS_Wrapper.h:269
static int max_number_entries()
size of common block
Definition: EPOS_Wrapper.h:225
int EPOS::EPOS_Wrapper::id ( int  index)
inlinestatic

PDG particle id.

Definition at line 346 of file EPOS_Wrapper.h.

References byte_num_to_int(), max_number_entries(), and sizeof_int().

Referenced by EPOS::IO_EPOS::build_particle().

347  {
348  return byte_num_to_int( (2+max_number_entries()+index-1)
349  * sizeof_int() );
350  }
static unsigned int sizeof_int()
size of integer in bytes
Definition: EPOS_Wrapper.h:221
static int byte_num_to_int(unsigned int)
navigate a byte array
Definition: EPOS_Wrapper.h:269
static int max_number_entries()
size of common block
Definition: EPOS_Wrapper.h:225
int EPOS::EPOS_Wrapper::last_child ( int  index)
inlinestatic

index of last daughter

Definition at line 392 of file EPOS_Wrapper.h.

References byte_num_to_int(), first_child(), max_number_entries(), number_entries(), and sizeof_int().

Referenced by EPOS::IO_EPOS::build_end_vertex(), number_children(), and print_hepcom_particle().

393  {
394  // Returns the Index of the LAST child in the EPOS record
395  // for particle with Index index.
396  // If there is only one child, the last child is forced to
397  // be the same as the first child.
398  // If there are no children for this particle, both the first_child
399  // and the last_child with return 0.
400  // Error checking is done to ensure the child is always
401  // within range ( 0 <= parent <= nhep )
402  //
403  int firstchild = first_child(index);
404  int child = byte_num_to_int( (2+4*max_number_entries()+2*(index-1)+1)
405  * sizeof_int() );
406  return ( child > firstchild && child <= number_entries() )
407  ? child : firstchild;
408  }
static int first_child(int index)
index of 1st daughter
Definition: EPOS_Wrapper.h:384
static unsigned int sizeof_int()
size of integer in bytes
Definition: EPOS_Wrapper.h:221
static int number_entries()
num entries in current evt
Definition: EPOS_Wrapper.h:336
static int byte_num_to_int(unsigned int)
navigate a byte array
Definition: EPOS_Wrapper.h:269
static int max_number_entries()
size of common block
Definition: EPOS_Wrapper.h:225
int EPOS::EPOS_Wrapper::last_parent ( int  index)
inlinestatic

index of last mother

Definition at line 360 of file EPOS_Wrapper.h.

References byte_num_to_int(), first_parent(), max_number_entries(), number_entries(), dbtoconf::parent, and sizeof_int().

Referenced by EPOS::IO_EPOS::build_production_vertex(), number_parents(), and print_hepcom_particle().

361  {
362  // Returns the Index of the LAST parent in the EPOS record
363  // for particle with Index index.
364  // If there is only one parent, the last parent is forced to
365  // be the same as the first parent.
366  // If there are no parents for this particle, both the first_parent
367  // and the last_parent with return 0.
368  // Error checking is done to ensure the parent is always
369  // within range ( 0 <= parent <= nhep )
370  //
371  int firstparent = first_parent(index);
372  int parent = byte_num_to_int( (2+2*max_number_entries()+2*(index-1)+1)
373  * sizeof_int() );
374  return ( parent > firstparent && parent <= number_entries() )
375  ? parent : firstparent;
376  }
list parent
Definition: dbtoconf.py:74
static int first_parent(int index)
index of 1st mother
Definition: EPOS_Wrapper.h:352
static unsigned int sizeof_int()
size of integer in bytes
Definition: EPOS_Wrapper.h:221
static int number_entries()
num entries in current evt
Definition: EPOS_Wrapper.h:336
static int byte_num_to_int(unsigned int)
navigate a byte array
Definition: EPOS_Wrapper.h:269
static int max_number_entries()
size of common block
Definition: EPOS_Wrapper.h:225
double EPOS::EPOS_Wrapper::m ( int  index)
inlinestatic

generated mass

Definition at line 442 of file EPOS_Wrapper.h.

References byte_num_to_double(), max_number_entries(), sizeof_int(), and sizeof_real().

Referenced by EPOS::IO_EPOS::build_particle(), and print_hepcom_particle().

443  {
445  + (5*(index-1)+4) *sizeof_real() );
446  }
static unsigned int sizeof_int()
size of integer in bytes
Definition: EPOS_Wrapper.h:221
static double byte_num_to_double(unsigned int)
navigate a byte array
Definition: EPOS_Wrapper.h:251
static int max_number_entries()
size of common block
Definition: EPOS_Wrapper.h:225
static unsigned int sizeof_real()
size of real in bytes
Definition: EPOS_Wrapper.h:223
int EPOS::EPOS_Wrapper::max_number_entries ( )
inlinestatic
int EPOS::EPOS_Wrapper::number_children ( int  index)
inlinestatic

number of children

Definition at line 410 of file EPOS_Wrapper.h.

References first_child(), and last_child().

Referenced by EPOS::IO_EPOS::build_end_vertex().

411  {
412  int firstchild = first_child(index);
413  return ( firstchild>0 ) ?
414  ( 1+last_child(index)-firstchild ) : 0;
415  }
static int first_child(int index)
index of 1st daughter
Definition: EPOS_Wrapper.h:384
static int last_child(int index)
index of last daughter
Definition: EPOS_Wrapper.h:392
int EPOS::EPOS_Wrapper::number_entries ( )
inlinestatic

num entries in current evt

Definition at line 336 of file EPOS_Wrapper.h.

References byte_num_to_int(), max_number_entries(), and sizeof_int().

Referenced by EPOS::IO_EPOS::fill_next_event(), first_child(), first_parent(), last_child(), last_parent(), and print_hepcom().

337  {
338  int nhep = byte_num_to_int( 1*sizeof_int() );
339  return ( nhep <= max_number_entries() ?
340  nhep : max_number_entries() );
341  }
static unsigned int sizeof_int()
size of integer in bytes
Definition: EPOS_Wrapper.h:221
static int byte_num_to_int(unsigned int)
navigate a byte array
Definition: EPOS_Wrapper.h:269
static int max_number_entries()
size of common block
Definition: EPOS_Wrapper.h:225
int EPOS::EPOS_Wrapper::number_parents ( int  index)
inlinestatic

number of parents

Definition at line 378 of file EPOS_Wrapper.h.

References first_parent(), and last_parent().

Referenced by EPOS::IO_EPOS::build_production_vertex().

378  {
379  int firstparent = first_parent(index);
380  return ( firstparent>0 ) ?
381  ( 1+last_parent(index)-firstparent ) : 0;
382  }
static int first_parent(int index)
index of 1st mother
Definition: EPOS_Wrapper.h:352
static int last_parent(int index)
index of last mother
Definition: EPOS_Wrapper.h:360
void EPOS::EPOS_Wrapper::print_hepcom ( std::ostream &  ostr = std::cout)
inlinestatic

write information from EPOS common block

Definition at line 568 of file EPOS_Wrapper.h.

References event_number(), i, max_number_entries(), number_entries(), print_hepcom_particle(), print_legend(), sizeof_int(), and sizeof_real().

569  {
570  ostr << "________________________________________"
571  << "________________________________________" << std::endl;
572  ostr << "***** HEPEVT Common Event#: "
573  << event_number()
574  << ", " << number_entries() << " particles (max "
575  << max_number_entries() << ") *****";
576  ostr << sizeof_int() << "-byte integers, "
577  << sizeof_real() << "-byte floating point numbers, "
578  << max_number_entries() << "-allocated entries."
579  << std::endl;
580  print_legend(ostr);
581  ostr << "________________________________________"
582  << "________________________________________" << std::endl;
583  for ( int i=1; i <= number_entries(); ++i ) {
584  print_hepcom_particle( i, ostr );
585  }
586  ostr << "________________________________________"
587  << "________________________________________" << std::endl;
588  }
int i
Definition: DBlmapReader.cc:9
static unsigned int sizeof_int()
size of integer in bytes
Definition: EPOS_Wrapper.h:221
static int event_number()
event number
Definition: EPOS_Wrapper.h:333
static int number_entries()
num entries in current evt
Definition: EPOS_Wrapper.h:336
static void print_hepcom_particle(int index, std::ostream &ostr=std::cout)
write particle information to ostr
Definition: EPOS_Wrapper.h:590
static int max_number_entries()
size of common block
Definition: EPOS_Wrapper.h:225
static void print_legend(std::ostream &ostr=std::cout)
print output legend
Definition: EPOS_Wrapper.h:605
static unsigned int sizeof_real()
size of real in bytes
Definition: EPOS_Wrapper.h:223
void EPOS::EPOS_Wrapper::print_hepcom_particle ( int  index,
std::ostream &  ostr = std::cout 
)
inlinestatic

write particle information to ostr

Definition at line 590 of file EPOS_Wrapper.h.

References e(), first_child(), first_parent(), last_child(), last_parent(), m(), dbtoconf::outline, px(), py(), pz(), status(), t(), x(), y(), and z().

Referenced by print_hepcom().

591  {
592  char outline[81];
593  sprintf( outline,
594  "%4d %+4d %4d %4d (%9.3g, %9.3g, %9.3g, %9.3g, %9.3g)"
596  px(i), py(i), pz(i), e(i), m(i) );
597  ostr << outline << "\n";
598  sprintf( outline,"%+9d %4d %4d (%9.3g, %9.3g, %9.3g, %9.3g)",
599  // old version was:" (%+9.2e, %+9.2e, %+9.2e, %+9.2e)"
600  id(i), last_parent(i), last_child(i),
601  x(i), y(i), z(i), t(i) );
602  ostr << outline << std::endl;
603  }
static double m(int index)
generated mass
Definition: EPOS_Wrapper.h:442
int i
Definition: DBlmapReader.cc:9
static double e(int index)
Energy.
Definition: EPOS_Wrapper.h:436
static double t(int index)
production time
Definition: EPOS_Wrapper.h:469
static int first_child(int index)
index of 1st daughter
Definition: EPOS_Wrapper.h:384
static int first_parent(int index)
index of 1st mother
Definition: EPOS_Wrapper.h:352
static double y(int index)
Y Production vertex.
Definition: EPOS_Wrapper.h:455
static double py(int index)
Y momentum.
Definition: EPOS_Wrapper.h:423
static int status(int index)
status code
Definition: EPOS_Wrapper.h:343
string outline
Definition: dbtoconf.py:196
static double pz(int index)
Z momentum.
Definition: EPOS_Wrapper.h:430
static double z(int index)
Z Production vertex.
Definition: EPOS_Wrapper.h:462
static int last_child(int index)
index of last daughter
Definition: EPOS_Wrapper.h:392
static int last_parent(int index)
index of last mother
Definition: EPOS_Wrapper.h:360
static double x(int index)
X Production vertex.
Definition: EPOS_Wrapper.h:448
static double px(int index)
X momentum.
Definition: EPOS_Wrapper.h:417
void EPOS::EPOS_Wrapper::print_legend ( std::ostream &  ostr = std::cout)
inlinestaticprotected

print output legend

Definition at line 605 of file EPOS_Wrapper.h.

References dbtoconf::outline.

Referenced by print_hepcom().

606  {
607  char outline[81];
608  sprintf( outline,"%4s %4s %4s %5s %10s, %9s, %9s, %9s, %10s",
609  "Indx","Stat","Par-","chil-",
610  "( P_x","P_y","P_z","Energy","M ) ");
611  ostr << outline << std::endl;
612  sprintf( outline,"%9s %4s %4s %10s, %9s, %9s, %9s) %9s",
613  "ID ","ents","dren",
614  "Prod ( X","Y","Z","cT", "[mm]");
615  ostr << outline << std::endl;
616  }
string outline
Definition: dbtoconf.py:196
double EPOS::EPOS_Wrapper::px ( int  index)
inlinestatic

X momentum.

Definition at line 417 of file EPOS_Wrapper.h.

References byte_num_to_double(), max_number_entries(), sizeof_int(), and sizeof_real().

Referenced by EPOS::IO_EPOS::build_particle(), and print_hepcom_particle().

418  {
420  + (5*(index-1)+0) *sizeof_real() );
421  }
static unsigned int sizeof_int()
size of integer in bytes
Definition: EPOS_Wrapper.h:221
static double byte_num_to_double(unsigned int)
navigate a byte array
Definition: EPOS_Wrapper.h:251
static int max_number_entries()
size of common block
Definition: EPOS_Wrapper.h:225
static unsigned int sizeof_real()
size of real in bytes
Definition: EPOS_Wrapper.h:223
double EPOS::EPOS_Wrapper::py ( int  index)
inlinestatic

Y momentum.

Definition at line 423 of file EPOS_Wrapper.h.

References byte_num_to_double(), max_number_entries(), sizeof_int(), and sizeof_real().

Referenced by EPOS::IO_EPOS::build_particle(), and print_hepcom_particle().

424  {
426  + (5*(index-1)+1) *sizeof_real() );
427  }
static unsigned int sizeof_int()
size of integer in bytes
Definition: EPOS_Wrapper.h:221
static double byte_num_to_double(unsigned int)
navigate a byte array
Definition: EPOS_Wrapper.h:251
static int max_number_entries()
size of common block
Definition: EPOS_Wrapper.h:225
static unsigned int sizeof_real()
size of real in bytes
Definition: EPOS_Wrapper.h:223
double EPOS::EPOS_Wrapper::pz ( int  index)
inlinestatic

Z momentum.

Definition at line 430 of file EPOS_Wrapper.h.

References byte_num_to_double(), max_number_entries(), sizeof_int(), and sizeof_real().

Referenced by EPOS::IO_EPOS::build_particle(), and print_hepcom_particle().

431  {
433  + (5*(index-1)+2) *sizeof_real() );
434  }
static unsigned int sizeof_int()
size of integer in bytes
Definition: EPOS_Wrapper.h:221
static double byte_num_to_double(unsigned int)
navigate a byte array
Definition: EPOS_Wrapper.h:251
static int max_number_entries()
size of common block
Definition: EPOS_Wrapper.h:225
static unsigned int sizeof_real()
size of real in bytes
Definition: EPOS_Wrapper.h:223
void EPOS::EPOS_Wrapper::set_children ( int  index,
int  firstchild,
int  lastchild 
)
inlinestatic

define children of a particle

Definition at line 504 of file EPOS_Wrapper.h.

References max_number_entries(), sizeof_int(), and write_byte_num().

Referenced by EPOS::IO_EPOS::write_event(), and zero_everything().

506  {
507  if ( index <= 0 || index > max_number_entries() ) return;
508  write_byte_num( firstchild, (2+4*max_number_entries()+2*(index-1))
509  *sizeof_int() );
510  write_byte_num( lastchild, (2+4*max_number_entries()+2*(index-1)+1)
511  *sizeof_int() );
512  }
static void write_byte_num(double, unsigned int)
pretend common block is an array of bytes
Definition: EPOS_Wrapper.h:291
static unsigned int sizeof_int()
size of integer in bytes
Definition: EPOS_Wrapper.h:221
static int max_number_entries()
size of common block
Definition: EPOS_Wrapper.h:225
void EPOS::EPOS_Wrapper::set_event_number ( int  evtno)
inlinestatic

set event number

Definition at line 476 of file EPOS_Wrapper.h.

References write_byte_num().

Referenced by EPOS::IO_EPOS::write_event(), and zero_everything().

477  { write_byte_num( evtno, 0 ); }
static void write_byte_num(double, unsigned int)
pretend common block is an array of bytes
Definition: EPOS_Wrapper.h:291
void EPOS::EPOS_Wrapper::set_id ( int  index,
int  id 
)
inlinestatic

set particle ID

Definition at line 488 of file EPOS_Wrapper.h.

References max_number_entries(), sizeof_int(), and write_byte_num().

Referenced by EPOS::IO_EPOS::write_event(), and zero_everything().

489  {
490  if ( index <= 0 || index > max_number_entries() ) return;
492  }
static void write_byte_num(double, unsigned int)
pretend common block is an array of bytes
Definition: EPOS_Wrapper.h:291
static unsigned int sizeof_int()
size of integer in bytes
Definition: EPOS_Wrapper.h:221
static int max_number_entries()
size of common block
Definition: EPOS_Wrapper.h:225
void EPOS::EPOS_Wrapper::set_mass ( int  index,
double  mass 
)
inlinestatic

set particle mass

Definition at line 528 of file EPOS_Wrapper.h.

References max_number_entries(), sizeof_int(), sizeof_real(), and write_byte_num().

Referenced by EPOS::IO_EPOS::write_event(), and zero_everything().

529  {
530  if ( index <= 0 || index > max_number_entries() ) return;
532  + (5*(index-1)+4) *sizeof_real() );
533  }
static void write_byte_num(double, unsigned int)
pretend common block is an array of bytes
Definition: EPOS_Wrapper.h:291
static unsigned int sizeof_int()
size of integer in bytes
Definition: EPOS_Wrapper.h:221
static int max_number_entries()
size of common block
Definition: EPOS_Wrapper.h:225
static unsigned int sizeof_real()
size of real in bytes
Definition: EPOS_Wrapper.h:223
void EPOS::EPOS_Wrapper::set_max_number_entries ( unsigned int  size)
inlinestatic

define size of common block

Definition at line 247 of file EPOS_Wrapper.h.

References s_max_number_entries, and findQualityFiles::size.

247  {
249  }
static unsigned int s_max_number_entries
Definition: EPOS_Wrapper.h:214
tuple size
Write out results.
void EPOS::EPOS_Wrapper::set_momentum ( int  index,
double  px,
double  py,
double  pz,
double  e 
)
inlinestatic

set particle momentum

Definition at line 514 of file EPOS_Wrapper.h.

References max_number_entries(), sizeof_int(), sizeof_real(), and write_byte_num().

Referenced by EPOS::IO_EPOS::write_event(), and zero_everything().

516  {
517  if ( index <= 0 || index > max_number_entries() ) return;
519  + (5*(index-1)+0) *sizeof_real() );
521  + (5*(index-1)+1) *sizeof_real() );
523  + (5*(index-1)+2) *sizeof_real() );
525  + (5*(index-1)+3) *sizeof_real() );
526  }
static void write_byte_num(double, unsigned int)
pretend common block is an array of bytes
Definition: EPOS_Wrapper.h:291
static double e(int index)
Energy.
Definition: EPOS_Wrapper.h:436
static double py(int index)
Y momentum.
Definition: EPOS_Wrapper.h:423
static unsigned int sizeof_int()
size of integer in bytes
Definition: EPOS_Wrapper.h:221
static double pz(int index)
Z momentum.
Definition: EPOS_Wrapper.h:430
static int max_number_entries()
size of common block
Definition: EPOS_Wrapper.h:225
static unsigned int sizeof_real()
size of real in bytes
Definition: EPOS_Wrapper.h:223
static double px(int index)
X momentum.
Definition: EPOS_Wrapper.h:417
void EPOS::EPOS_Wrapper::set_number_entries ( int  noentries)
inlinestatic

set number of entries in EPOS

Definition at line 479 of file EPOS_Wrapper.h.

References sizeof_int(), and write_byte_num().

Referenced by EPOS::IO_EPOS::write_event(), and zero_everything().

480  { write_byte_num( noentries, 1*sizeof_int() ); }
static void write_byte_num(double, unsigned int)
pretend common block is an array of bytes
Definition: EPOS_Wrapper.h:291
static unsigned int sizeof_int()
size of integer in bytes
Definition: EPOS_Wrapper.h:221
void EPOS::EPOS_Wrapper::set_parents ( int  index,
int  firstparent,
int  lastparent 
)
inlinestatic

define parents of a particle

Definition at line 494 of file EPOS_Wrapper.h.

References max_number_entries(), sizeof_int(), and write_byte_num().

Referenced by EPOS::IO_EPOS::write_event(), and zero_everything().

496  {
497  if ( index <= 0 || index > max_number_entries() ) return;
498  write_byte_num( firstparent, (2+2*max_number_entries()+2*(index-1))
499  *sizeof_int() );
500  write_byte_num( lastparent, (2+2*max_number_entries()+2*(index-1)+1)
501  * sizeof_int() );
502  }
static void write_byte_num(double, unsigned int)
pretend common block is an array of bytes
Definition: EPOS_Wrapper.h:291
static unsigned int sizeof_int()
size of integer in bytes
Definition: EPOS_Wrapper.h:221
static int max_number_entries()
size of common block
Definition: EPOS_Wrapper.h:225
void EPOS::EPOS_Wrapper::set_position ( int  index,
double  x,
double  y,
double  z,
double  t 
)
inlinestatic

set particle production vertex

Definition at line 535 of file EPOS_Wrapper.h.

References max_number_entries(), sizeof_int(), sizeof_real(), and write_byte_num().

Referenced by EPOS::IO_EPOS::write_event(), and zero_everything().

537  {
538  if ( index <= 0 || index > max_number_entries() ) return;
540  + ( 5*max_number_entries()
541  + (4*(index-1)+0) ) *sizeof_real() );
543  + ( 5*max_number_entries()
544  + (4*(index-1)+1) ) *sizeof_real() );
546  + ( 5*max_number_entries()
547  + (4*(index-1)+2) ) *sizeof_real() );
549  + ( 5*max_number_entries()
550  + (4*(index-1)+3) ) *sizeof_real() );
551  }
static void write_byte_num(double, unsigned int)
pretend common block is an array of bytes
Definition: EPOS_Wrapper.h:291
static double t(int index)
production time
Definition: EPOS_Wrapper.h:469
static double y(int index)
Y Production vertex.
Definition: EPOS_Wrapper.h:455
static unsigned int sizeof_int()
size of integer in bytes
Definition: EPOS_Wrapper.h:221
static double z(int index)
Z Production vertex.
Definition: EPOS_Wrapper.h:462
static int max_number_entries()
size of common block
Definition: EPOS_Wrapper.h:225
static unsigned int sizeof_real()
size of real in bytes
Definition: EPOS_Wrapper.h:223
static double x(int index)
X Production vertex.
Definition: EPOS_Wrapper.h:448
void EPOS::EPOS_Wrapper::set_sizeof_int ( unsigned int  size)
inlinestatic

define size of integer

Definition at line 228 of file EPOS_Wrapper.h.

References ecal_dqm_sourceclient-live_cfg::cerr, s_sizeof_int, and findQualityFiles::size.

229  {
230  if ( size != sizeof(short int) && size != sizeof(long int) && size != sizeof(int) ) {
231  std::cerr << "HepMC is not able to handle integers "
232  << " of size other than 2 or 4."
233  << " You requested: " << size << std::endl;
234  }
235  s_sizeof_int = size;
236  }
tuple size
Write out results.
static unsigned int s_sizeof_int
Definition: EPOS_Wrapper.h:212
void EPOS::EPOS_Wrapper::set_sizeof_real ( unsigned int  size)
inlinestatic

define size of real

Definition at line 238 of file EPOS_Wrapper.h.

References ecal_dqm_sourceclient-live_cfg::cerr, s_sizeof_real, and findQualityFiles::size.

238  {
239  if ( size != sizeof(float) && size != sizeof(double) ) {
240  std::cerr << "HepMC is not able to handle floating point numbers"
241  << " of size other than 4 or 8."
242  << " You requested: " << size << std::endl;
243  }
245  }
static unsigned int s_sizeof_real
Definition: EPOS_Wrapper.h:213
tuple size
Write out results.
void EPOS::EPOS_Wrapper::set_status ( int  index,
int  status 
)
inlinestatic

set particle status

Definition at line 482 of file EPOS_Wrapper.h.

References max_number_entries(), sizeof_int(), and write_byte_num().

Referenced by EPOS::IO_EPOS::write_event(), and zero_everything().

483  {
484  if ( index <= 0 || index > max_number_entries() ) return;
485  write_byte_num( status, (2+index-1) * sizeof_int() );
486  }
static void write_byte_num(double, unsigned int)
pretend common block is an array of bytes
Definition: EPOS_Wrapper.h:291
static unsigned int sizeof_int()
size of integer in bytes
Definition: EPOS_Wrapper.h:221
static int status(int index)
status code
Definition: EPOS_Wrapper.h:343
static int max_number_entries()
size of common block
Definition: EPOS_Wrapper.h:225
unsigned int EPOS::EPOS_Wrapper::sizeof_int ( )
inlinestatic
unsigned int EPOS::EPOS_Wrapper::sizeof_real ( )
inlinestatic

size of real in bytes

Definition at line 223 of file EPOS_Wrapper.h.

References s_sizeof_real.

Referenced by e(), m(), print_hepcom(), px(), py(), pz(), set_mass(), set_momentum(), set_position(), t(), x(), y(), and z().

223 { return s_sizeof_real; }
static unsigned int s_sizeof_real
Definition: EPOS_Wrapper.h:213
int EPOS::EPOS_Wrapper::status ( int  index)
inlinestatic

status code

Definition at line 343 of file EPOS_Wrapper.h.

References byte_num_to_int(), and sizeof_int().

Referenced by EPOS::IO_EPOS::build_particle(), and print_hepcom_particle().

344  { return byte_num_to_int( (2+index-1) * sizeof_int() ); }
static unsigned int sizeof_int()
size of integer in bytes
Definition: EPOS_Wrapper.h:221
static int byte_num_to_int(unsigned int)
navigate a byte array
Definition: EPOS_Wrapper.h:269
double EPOS::EPOS_Wrapper::t ( int  index)
inlinestatic

production time

Definition at line 469 of file EPOS_Wrapper.h.

References byte_num_to_double(), max_number_entries(), sizeof_int(), and sizeof_real().

Referenced by EPOS::IO_EPOS::build_end_vertex(), EPOS::IO_EPOS::build_production_vertex(), and print_hepcom_particle().

470  {
472  + ( 5*max_number_entries()
473  + (4*(index-1)+3) ) *sizeof_real() );
474  }
static unsigned int sizeof_int()
size of integer in bytes
Definition: EPOS_Wrapper.h:221
static double byte_num_to_double(unsigned int)
navigate a byte array
Definition: EPOS_Wrapper.h:251
static int max_number_entries()
size of common block
Definition: EPOS_Wrapper.h:225
static unsigned int sizeof_real()
size of real in bytes
Definition: EPOS_Wrapper.h:223
void EPOS::EPOS_Wrapper::write_byte_num ( double  in,
unsigned int  b 
)
inlinestaticprotected

pretend common block is an array of bytes

Definition at line 291 of file EPOS_Wrapper.h.

References ecal_dqm_sourceclient-live_cfg::cerr, epos_bytes_allocation, hepcom, and s_sizeof_real.

Referenced by set_children(), set_event_number(), set_id(), set_mass(), set_momentum(), set_number_entries(), set_parents(), set_position(), and set_status().

291  {
293  << "EPOS_Wrapper: requested hepcom data exceeds allocation"
294  << std::endl;
295  if ( s_sizeof_real == sizeof(float) ) {
296  float* myfloat = (float*)&hepcom.data[b];
297  (*myfloat) = (float)in;
298  } else if ( s_sizeof_real == sizeof(double) ) {
299  double* mydouble = (double*)&hepcom.data[b];
300  (*mydouble) = (double)in;
301  } else {
302  std::cerr
303  << "EPOS_Wrapper: illegal floating point number length."
304  << s_sizeof_real << std::endl;
305  }
306  }
#define hepcom
Definition: EPOS_Wrapper.h:85
double b
Definition: hdecay.h:120
static unsigned int s_sizeof_real
Definition: EPOS_Wrapper.h:213
const unsigned int epos_bytes_allocation
Definition: EPOS_Wrapper.h:67
void EPOS::EPOS_Wrapper::write_byte_num ( int  in,
unsigned int  b 
)
inlinestaticprotected

pretend common block is an array of bytes

Definition at line 308 of file EPOS_Wrapper.h.

References ecal_dqm_sourceclient-live_cfg::cerr, epos_bytes_allocation, hepcom, and s_sizeof_int.

308  {
310  << "EPOS_Wrapper: requested hepcom data exceeds allocation"
311  << std::endl;
312  if ( s_sizeof_int == sizeof(short int) ) {
313  short int* myshortint = (short int*)&hepcom.data[b];
314  (*myshortint) = (short int)in;
315  } else if ( s_sizeof_int == sizeof(long int) ) {
316  long int* mylongint = (long int*)&hepcom.data[b];
317  (*mylongint) = (int)in;
318  // on some 64 bit machines, int, short, and long are all different
319  } else if ( s_sizeof_int == sizeof(int) ) {
320  int* myint = (int*)&hepcom.data[b];
321  (*myint) = (int)in;
322  } else {
323  std::cerr
324  << "EPOS_Wrapper: illegal integer number length."
325  << s_sizeof_int << std::endl;
326  }
327  }
#define hepcom
Definition: EPOS_Wrapper.h:85
double b
Definition: hdecay.h:120
const unsigned int epos_bytes_allocation
Definition: EPOS_Wrapper.h:67
static unsigned int s_sizeof_int
Definition: EPOS_Wrapper.h:212
double EPOS::EPOS_Wrapper::x ( int  index)
inlinestatic
double EPOS::EPOS_Wrapper::y ( int  index)
inlinestatic

Y Production vertex.

Definition at line 455 of file EPOS_Wrapper.h.

References byte_num_to_double(), max_number_entries(), sizeof_int(), and sizeof_real().

Referenced by svgfig.Ellipse::__repr__(), Vispa.Gui.WidgetContainer.WidgetContainer::autosize(), Vispa.Gui.VispaWidget.VispaWidget::boundingRect(), EPOS::IO_EPOS::build_end_vertex(), EPOS::IO_EPOS::build_production_vertex(), geometryXMLparser.Alignable::pos(), Vispa.Gui.ConnectableWidget.ConnectableWidget::positionizeMenuWidget(), and print_hepcom_particle().

456  {
458  + ( 5*max_number_entries()
459  + (4*(index-1)+1) ) *sizeof_real() );
460  }
static unsigned int sizeof_int()
size of integer in bytes
Definition: EPOS_Wrapper.h:221
static double byte_num_to_double(unsigned int)
navigate a byte array
Definition: EPOS_Wrapper.h:251
static int max_number_entries()
size of common block
Definition: EPOS_Wrapper.h:225
static unsigned int sizeof_real()
size of real in bytes
Definition: EPOS_Wrapper.h:223
double EPOS::EPOS_Wrapper::z ( int  index)
inlinestatic

Z Production vertex.

Definition at line 462 of file EPOS_Wrapper.h.

References byte_num_to_double(), max_number_entries(), sizeof_int(), and sizeof_real().

Referenced by EPOS::IO_EPOS::build_end_vertex(), EPOS::IO_EPOS::build_production_vertex(), geometryXMLparser.Alignable::pos(), and print_hepcom_particle().

463  {
465  + ( 5*max_number_entries()
466  + (4*(index-1)+2) ) *sizeof_real() );
467  }
static unsigned int sizeof_int()
size of integer in bytes
Definition: EPOS_Wrapper.h:221
static double byte_num_to_double(unsigned int)
navigate a byte array
Definition: EPOS_Wrapper.h:251
static int max_number_entries()
size of common block
Definition: EPOS_Wrapper.h:225
static unsigned int sizeof_real()
size of real in bytes
Definition: EPOS_Wrapper.h:223
void EPOS::EPOS_Wrapper::zero_everything ( )
inlinestatic

set all entries in EPOS to zero

Definition at line 553 of file EPOS_Wrapper.h.

References i, max_number_entries(), set_children(), set_event_number(), set_id(), set_mass(), set_momentum(), set_number_entries(), set_parents(), set_position(), and set_status().

554  {
555  set_event_number( 0 );
556  set_number_entries( 0 );
557  for ( int i = 1; i<=max_number_entries(); ++i ) {
558  set_status( i, 0 );
559  set_id( i, 0 );
560  set_parents( i, 0, 0 );
561  set_children( i, 0, 0 );
562  set_momentum( i, 0, 0, 0, 0 );
563  set_mass( i, 0 );
564  set_position( i, 0, 0, 0, 0 );
565  }
566  }
static void set_children(int index, int firstchild, int lastchild)
define children of a particle
Definition: EPOS_Wrapper.h:504
static void set_mass(int index, double mass)
set particle mass
Definition: EPOS_Wrapper.h:528
int i
Definition: DBlmapReader.cc:9
static void set_status(int index, int status)
set particle status
Definition: EPOS_Wrapper.h:482
static void set_id(int index, int id)
set particle ID
Definition: EPOS_Wrapper.h:488
static void set_number_entries(int noentries)
set number of entries in EPOS
Definition: EPOS_Wrapper.h:479
static void set_event_number(int evtno)
set event number
Definition: EPOS_Wrapper.h:476
static void set_momentum(int index, double px, double py, double pz, double e)
set particle momentum
Definition: EPOS_Wrapper.h:514
static void set_position(int index, double x, double y, double z, double t)
set particle production vertex
Definition: EPOS_Wrapper.h:535
static int max_number_entries()
size of common block
Definition: EPOS_Wrapper.h:225
static void set_parents(int index, int firstparent, int lastparent)
define parents of a particle
Definition: EPOS_Wrapper.h:494

Member Data Documentation

unsigned int EPOS::EPOS_Wrapper::s_max_number_entries = 99900
staticprivate

Definition at line 214 of file EPOS_Wrapper.h.

Referenced by max_number_entries(), and set_max_number_entries().

unsigned int EPOS::EPOS_Wrapper::s_sizeof_int = 4
staticprivate

Definition at line 212 of file EPOS_Wrapper.h.

Referenced by byte_num_to_int(), set_sizeof_int(), sizeof_int(), and write_byte_num().

unsigned int EPOS::EPOS_Wrapper::s_sizeof_real = sizeof(double)
staticprivate

Definition at line 213 of file EPOS_Wrapper.h.

Referenced by byte_num_to_double(), set_sizeof_real(), sizeof_real(), and write_byte_num().