CMS 3D CMS Logo

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 127 of file EPOS_Wrapper.h.

Member Function Documentation

◆ byte_num_to_double()

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

navigate a byte array

Definition at line 238 of file EPOS_Wrapper.h.

References b, DMR_cfg::cerr, epos_bytes_allocation, hepcom, mathSSE::return(), and s_sizeof_real.

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

238  {
239  if (b >= epos_bytes_allocation)
240  std::cerr << "EPOS_Wrapper: requested hepcom data exceeds allocation" << std::endl;
241  if (s_sizeof_real == sizeof(float)) {
242  float* myfloat = (float*)&hepcom.data[b];
243  return (double)(*myfloat);
244  } else if (s_sizeof_real == sizeof(double)) {
245  double* mydouble = (double*)&hepcom.data[b];
246  return (*mydouble);
247  } else {
248  std::cerr << "EPOS_Wrapper: illegal floating point number length." << s_sizeof_real << std::endl;
249  }
250  return 0;
251  }
return((rh ^ lh) &mask)
#define hepcom
Definition: EPOS_Wrapper.h:81
double b
Definition: hdecay.h:118
static unsigned int s_sizeof_real
Definition: EPOS_Wrapper.h:205
const unsigned int epos_bytes_allocation
Definition: EPOS_Wrapper.h:67

◆ byte_num_to_int()

int EPOS::EPOS_Wrapper::byte_num_to_int ( unsigned int  b)
inlinestaticprotected

navigate a byte array

Definition at line 253 of file EPOS_Wrapper.h.

References b, DMR_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().

253  {
254  if (b >= epos_bytes_allocation)
255  std::cerr << "EPOS_Wrapper: requested hepcom data exceeds allocation" << std::endl;
256  if (s_sizeof_int == sizeof(short int)) {
257  short int* myshortint = (short int*)&hepcom.data[b];
258  return (int)(*myshortint);
259  } else if (s_sizeof_int == sizeof(long int)) {
260  long int* mylongint = (long int*)&hepcom.data[b];
261  return (*mylongint);
262  // on some 64 bit machines, int, short, and long are all different
263  } else if (s_sizeof_int == sizeof(int)) {
264  int* myint = (int*)&hepcom.data[b];
265  return (*myint);
266  } else {
267  std::cerr << "EPOS_Wrapper: illegal integer number length." << s_sizeof_int << std::endl;
268  }
269  return 0;
270  }
return((rh ^ lh) &mask)
#define hepcom
Definition: EPOS_Wrapper.h:81
double b
Definition: hdecay.h:118
const unsigned int epos_bytes_allocation
Definition: EPOS_Wrapper.h:67
static unsigned int s_sizeof_int
Definition: EPOS_Wrapper.h:204

◆ e()

double EPOS::EPOS_Wrapper::e ( int  index)
inlinestatic

Energy.

Definition at line 383 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(), print_hepcom_particle(), and set_momentum().

383  {
384  return byte_num_to_double((2 + 6 * max_number_entries()) * sizeof_int() + (5 * (index - 1) + 3) * sizeof_real());
385  }
static unsigned int sizeof_int()
size of integer in bytes
Definition: EPOS_Wrapper.h:212
static double byte_num_to_double(unsigned int)
navigate a byte array
Definition: EPOS_Wrapper.h:238
static int max_number_entries()
size of common block
Definition: EPOS_Wrapper.h:216
static unsigned int sizeof_real()
size of real in bytes
Definition: EPOS_Wrapper.h:214

◆ event_number()

int EPOS::EPOS_Wrapper::event_number ( )
inlinestatic

event number

Definition at line 308 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().

308 { return byte_num_to_int(0); }
static int byte_num_to_int(unsigned int)
navigate a byte array
Definition: EPOS_Wrapper.h:253

◆ first_child()

int EPOS::EPOS_Wrapper::first_child ( int  index)
inlinestatic

index of 1st daughter

Definition at line 346 of file EPOS_Wrapper.h.

References byte_num_to_int(), submitPVValidationJobs::child, max_number_entries(), number_entries(), and sizeof_int().

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

346  {
347  int child = byte_num_to_int((2 + 4 * max_number_entries() + 2 * (index - 1)) * sizeof_int());
348  return (child > 0 && child <= number_entries()) ? child : 0;
349  }
static unsigned int sizeof_int()
size of integer in bytes
Definition: EPOS_Wrapper.h:212
static int number_entries()
num entries in current evt
Definition: EPOS_Wrapper.h:310
static int byte_num_to_int(unsigned int)
navigate a byte array
Definition: EPOS_Wrapper.h:253
static int max_number_entries()
size of common block
Definition: EPOS_Wrapper.h:216

◆ first_parent()

int EPOS::EPOS_Wrapper::first_parent ( int  index)
inlinestatic

index of 1st mother

Definition at line 321 of file EPOS_Wrapper.h.

References byte_num_to_int(), max_number_entries(), number_entries(), class-composition::parent, and sizeof_int().

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

321  {
322  int parent = byte_num_to_int((2 + 2 * max_number_entries() + 2 * (index - 1)) * sizeof_int());
323  return (parent > 0 && parent <= number_entries()) ? parent : 0;
324  }
static unsigned int sizeof_int()
size of integer in bytes
Definition: EPOS_Wrapper.h:212
static int number_entries()
num entries in current evt
Definition: EPOS_Wrapper.h:310
static int byte_num_to_int(unsigned int)
navigate a byte array
Definition: EPOS_Wrapper.h:253
static int max_number_entries()
size of common block
Definition: EPOS_Wrapper.h:216

◆ id()

int EPOS::EPOS_Wrapper::id ( int  index)
inlinestatic

PDG particle id.

Definition at line 317 of file EPOS_Wrapper.h.

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

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

317  {
318  return byte_num_to_int((2 + max_number_entries() + index - 1) * sizeof_int());
319  }
static unsigned int sizeof_int()
size of integer in bytes
Definition: EPOS_Wrapper.h:212
static int byte_num_to_int(unsigned int)
navigate a byte array
Definition: EPOS_Wrapper.h:253
static int max_number_entries()
size of common block
Definition: EPOS_Wrapper.h:216

◆ last_child()

int EPOS::EPOS_Wrapper::last_child ( int  index)
inlinestatic

index of last daughter

Definition at line 351 of file EPOS_Wrapper.h.

References byte_num_to_int(), submitPVValidationJobs::child, first_child(), max_number_entries(), number_entries(), and sizeof_int().

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

351  {
352  // Returns the Index of the LAST child in the EPOS record
353  // for particle with Index index.
354  // If there is only one child, the last child is forced to
355  // be the same as the first child.
356  // If there are no children for this particle, both the first_child
357  // and the last_child with return 0.
358  // Error checking is done to ensure the child is always
359  // within range ( 0 <= parent <= nhep )
360  //
361  int firstchild = first_child(index);
362  int child = byte_num_to_int((2 + 4 * max_number_entries() + 2 * (index - 1) + 1) * sizeof_int());
363  return (child > firstchild && child <= number_entries()) ? child : firstchild;
364  }
static int first_child(int index)
index of 1st daughter
Definition: EPOS_Wrapper.h:346
static unsigned int sizeof_int()
size of integer in bytes
Definition: EPOS_Wrapper.h:212
static int number_entries()
num entries in current evt
Definition: EPOS_Wrapper.h:310
static int byte_num_to_int(unsigned int)
navigate a byte array
Definition: EPOS_Wrapper.h:253
static int max_number_entries()
size of common block
Definition: EPOS_Wrapper.h:216

◆ last_parent()

int EPOS::EPOS_Wrapper::last_parent ( int  index)
inlinestatic

index of last mother

Definition at line 326 of file EPOS_Wrapper.h.

References byte_num_to_int(), first_parent(), max_number_entries(), number_entries(), class-composition::parent, and sizeof_int().

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

326  {
327  // Returns the Index of the LAST parent in the EPOS record
328  // for particle with Index index.
329  // If there is only one parent, the last parent is forced to
330  // be the same as the first parent.
331  // If there are no parents for this particle, both the first_parent
332  // and the last_parent with return 0.
333  // Error checking is done to ensure the parent is always
334  // within range ( 0 <= parent <= nhep )
335  //
336  int firstparent = first_parent(index);
337  int parent = byte_num_to_int((2 + 2 * max_number_entries() + 2 * (index - 1) + 1) * sizeof_int());
338  return (parent > firstparent && parent <= number_entries()) ? parent : firstparent;
339  }
static int first_parent(int index)
index of 1st mother
Definition: EPOS_Wrapper.h:321
static unsigned int sizeof_int()
size of integer in bytes
Definition: EPOS_Wrapper.h:212
static int number_entries()
num entries in current evt
Definition: EPOS_Wrapper.h:310
static int byte_num_to_int(unsigned int)
navigate a byte array
Definition: EPOS_Wrapper.h:253
static int max_number_entries()
size of common block
Definition: EPOS_Wrapper.h:216

◆ m()

double EPOS::EPOS_Wrapper::m ( int  index)
inlinestatic

generated mass

Definition at line 387 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().

387  {
388  return byte_num_to_double((2 + 6 * max_number_entries()) * sizeof_int() + (5 * (index - 1) + 4) * sizeof_real());
389  }
static unsigned int sizeof_int()
size of integer in bytes
Definition: EPOS_Wrapper.h:212
static double byte_num_to_double(unsigned int)
navigate a byte array
Definition: EPOS_Wrapper.h:238
static int max_number_entries()
size of common block
Definition: EPOS_Wrapper.h:216
static unsigned int sizeof_real()
size of real in bytes
Definition: EPOS_Wrapper.h:214

◆ max_number_entries()

int EPOS::EPOS_Wrapper::max_number_entries ( )
inlinestatic

◆ number_children()

int EPOS::EPOS_Wrapper::number_children ( int  index)
inlinestatic

number of children

Definition at line 366 of file EPOS_Wrapper.h.

References first_child(), and last_child().

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

366  {
367  int firstchild = first_child(index);
368  return (firstchild > 0) ? (1 + last_child(index) - firstchild) : 0;
369  }
static int first_child(int index)
index of 1st daughter
Definition: EPOS_Wrapper.h:346
static int last_child(int index)
index of last daughter
Definition: EPOS_Wrapper.h:351

◆ number_entries()

int EPOS::EPOS_Wrapper::number_entries ( )
inlinestatic

num entries in current evt

Definition at line 310 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().

310  {
311  int nhep = byte_num_to_int(1 * sizeof_int());
312  return (nhep <= max_number_entries() ? nhep : max_number_entries());
313  }
static unsigned int sizeof_int()
size of integer in bytes
Definition: EPOS_Wrapper.h:212
static int byte_num_to_int(unsigned int)
navigate a byte array
Definition: EPOS_Wrapper.h:253
static int max_number_entries()
size of common block
Definition: EPOS_Wrapper.h:216

◆ number_parents()

int EPOS::EPOS_Wrapper::number_parents ( int  index)
inlinestatic

number of parents

Definition at line 341 of file EPOS_Wrapper.h.

References first_parent(), and last_parent().

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

341  {
342  int firstparent = first_parent(index);
343  return (firstparent > 0) ? (1 + last_parent(index) - firstparent) : 0;
344  }
static int first_parent(int index)
index of 1st mother
Definition: EPOS_Wrapper.h:321
static int last_parent(int index)
index of last mother
Definition: EPOS_Wrapper.h:326

◆ print_hepcom()

void EPOS::EPOS_Wrapper::print_hepcom ( std::ostream &  ostr = std::cout)
inlinestatic

write information from EPOS common block

Definition at line 487 of file EPOS_Wrapper.h.

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

487  {
488  ostr << "________________________________________"
489  << "________________________________________" << std::endl;
490  ostr << "***** HEPEVT Common Event#: " << event_number() << ", " << number_entries() << " particles (max "
491  << max_number_entries() << ") *****";
492  ostr << sizeof_int() << "-byte integers, " << sizeof_real() << "-byte floating point numbers, "
493  << max_number_entries() << "-allocated entries." << std::endl;
494  print_legend(ostr);
495  ostr << "________________________________________"
496  << "________________________________________" << std::endl;
497  for (int i = 1; i <= number_entries(); ++i) {
498  print_hepcom_particle(i, ostr);
499  }
500  ostr << "________________________________________"
501  << "________________________________________" << std::endl;
502  }
static unsigned int sizeof_int()
size of integer in bytes
Definition: EPOS_Wrapper.h:212
static int event_number()
event number
Definition: EPOS_Wrapper.h:308
static int number_entries()
num entries in current evt
Definition: EPOS_Wrapper.h:310
static void print_hepcom_particle(int index, std::ostream &ostr=std::cout)
write particle information to ostr
Definition: EPOS_Wrapper.h:504
static int max_number_entries()
size of common block
Definition: EPOS_Wrapper.h:216
static void print_legend(std::ostream &ostr=std::cout)
print output legend
Definition: EPOS_Wrapper.h:531
static unsigned int sizeof_real()
size of real in bytes
Definition: EPOS_Wrapper.h:214

◆ print_hepcom_particle()

void EPOS::EPOS_Wrapper::print_hepcom_particle ( int  index,
std::ostream &  ostr = std::cout 
)
inlinestatic

write particle information to ostr

Definition at line 504 of file EPOS_Wrapper.h.

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

Referenced by print_hepcom().

504  {
505  char outline[81];
506  sprintf(outline,
507  "%4d %+4d %4d %4d (%9.3g, %9.3g, %9.3g, %9.3g, %9.3g)",
508  i,
509  status(i),
510  first_parent(i),
511  first_child(i),
512  px(i),
513  py(i),
514  pz(i),
515  e(i),
516  m(i));
517  ostr << outline << "\n";
518  sprintf(outline,
519  "%+9d %4d %4d (%9.3g, %9.3g, %9.3g, %9.3g)",
520  // old version was:" (%+9.2e, %+9.2e, %+9.2e, %+9.2e)"
521  id(i),
522  last_parent(i),
523  last_child(i),
524  x(i),
525  y(i),
526  z(i),
527  t(i));
528  ostr << outline << std::endl;
529  }
static double m(int index)
generated mass
Definition: EPOS_Wrapper.h:387
static double e(int index)
Energy.
Definition: EPOS_Wrapper.h:383
static double t(int index)
production time
Definition: EPOS_Wrapper.h:406
static int first_child(int index)
index of 1st daughter
Definition: EPOS_Wrapper.h:346
static int first_parent(int index)
index of 1st mother
Definition: EPOS_Wrapper.h:321
static double y(int index)
Y Production vertex.
Definition: EPOS_Wrapper.h:396
static double py(int index)
Y momentum.
Definition: EPOS_Wrapper.h:375
static int status(int index)
status code
Definition: EPOS_Wrapper.h:315
static double pz(int index)
Z momentum.
Definition: EPOS_Wrapper.h:379
static double z(int index)
Z Production vertex.
Definition: EPOS_Wrapper.h:401
static int last_child(int index)
index of last daughter
Definition: EPOS_Wrapper.h:351
static int last_parent(int index)
index of last mother
Definition: EPOS_Wrapper.h:326
static double x(int index)
X Production vertex.
Definition: EPOS_Wrapper.h:391
static double px(int index)
X momentum.
Definition: EPOS_Wrapper.h:371

◆ print_legend()

void EPOS::EPOS_Wrapper::print_legend ( std::ostream &  ostr = std::cout)
inlinestaticprotected

print output legend

Definition at line 531 of file EPOS_Wrapper.h.

Referenced by print_hepcom().

531  {
532  char outline[81];
533  sprintf(outline,
534  "%4s %4s %4s %5s %10s, %9s, %9s, %9s, %10s",
535  "Indx",
536  "Stat",
537  "Par-",
538  "chil-",
539  "( P_x",
540  "P_y",
541  "P_z",
542  "Energy",
543  "M ) ");
544  ostr << outline << std::endl;
545  sprintf(
546  outline, "%9s %4s %4s %10s, %9s, %9s, %9s) %9s", "ID ", "ents", "dren", "Prod ( X", "Y", "Z", "cT", "[mm]");
547  ostr << outline << std::endl;
548  }

◆ px()

double EPOS::EPOS_Wrapper::px ( int  index)
inlinestatic

X momentum.

Definition at line 371 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(), print_hepcom_particle(), and set_momentum().

371  {
372  return byte_num_to_double((2 + 6 * max_number_entries()) * sizeof_int() + (5 * (index - 1) + 0) * sizeof_real());
373  }
static unsigned int sizeof_int()
size of integer in bytes
Definition: EPOS_Wrapper.h:212
static double byte_num_to_double(unsigned int)
navigate a byte array
Definition: EPOS_Wrapper.h:238
static int max_number_entries()
size of common block
Definition: EPOS_Wrapper.h:216
static unsigned int sizeof_real()
size of real in bytes
Definition: EPOS_Wrapper.h:214

◆ py()

double EPOS::EPOS_Wrapper::py ( int  index)
inlinestatic

Y momentum.

Definition at line 375 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(), print_hepcom_particle(), and set_momentum().

375  {
376  return byte_num_to_double((2 + 6 * max_number_entries()) * sizeof_int() + (5 * (index - 1) + 1) * sizeof_real());
377  }
static unsigned int sizeof_int()
size of integer in bytes
Definition: EPOS_Wrapper.h:212
static double byte_num_to_double(unsigned int)
navigate a byte array
Definition: EPOS_Wrapper.h:238
static int max_number_entries()
size of common block
Definition: EPOS_Wrapper.h:216
static unsigned int sizeof_real()
size of real in bytes
Definition: EPOS_Wrapper.h:214

◆ pz()

double EPOS::EPOS_Wrapper::pz ( int  index)
inlinestatic

Z momentum.

Definition at line 379 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(), print_hepcom_particle(), and set_momentum().

379  {
380  return byte_num_to_double((2 + 6 * max_number_entries()) * sizeof_int() + (5 * (index - 1) + 2) * sizeof_real());
381  }
static unsigned int sizeof_int()
size of integer in bytes
Definition: EPOS_Wrapper.h:212
static double byte_num_to_double(unsigned int)
navigate a byte array
Definition: EPOS_Wrapper.h:238
static int max_number_entries()
size of common block
Definition: EPOS_Wrapper.h:216
static unsigned int sizeof_real()
size of real in bytes
Definition: EPOS_Wrapper.h:214

◆ set_children()

void EPOS::EPOS_Wrapper::set_children ( int  index,
int  firstchild,
int  lastchild 
)
inlinestatic

define children of a particle

Definition at line 434 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().

434  {
435  if (index <= 0 || index > max_number_entries())
436  return;
437  write_byte_num(firstchild, (2 + 4 * max_number_entries() + 2 * (index - 1)) * sizeof_int());
438  write_byte_num(lastchild, (2 + 4 * max_number_entries() + 2 * (index - 1) + 1) * sizeof_int());
439  }
static void write_byte_num(double, unsigned int)
pretend common block is an array of bytes
Definition: EPOS_Wrapper.h:272
static unsigned int sizeof_int()
size of integer in bytes
Definition: EPOS_Wrapper.h:212
static int max_number_entries()
size of common block
Definition: EPOS_Wrapper.h:216

◆ set_event_number()

void EPOS::EPOS_Wrapper::set_event_number ( int  evtno)
inlinestatic

set event number

Definition at line 411 of file EPOS_Wrapper.h.

References write_byte_num().

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

411 { 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:272

◆ set_id()

void EPOS::EPOS_Wrapper::set_id ( int  index,
int  id 
)
inlinestatic

set particle ID

Definition at line 421 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().

421  {
422  if (index <= 0 || index > max_number_entries())
423  return;
424  write_byte_num(id, (2 + max_number_entries() + index - 1) * sizeof_int());
425  }
static void write_byte_num(double, unsigned int)
pretend common block is an array of bytes
Definition: EPOS_Wrapper.h:272
static unsigned int sizeof_int()
size of integer in bytes
Definition: EPOS_Wrapper.h:212
static int max_number_entries()
size of common block
Definition: EPOS_Wrapper.h:216

◆ set_mass()

void EPOS::EPOS_Wrapper::set_mass ( int  index,
double  mass 
)
inlinestatic

set particle mass

Definition at line 450 of file EPOS_Wrapper.h.

References EgHLTOffHistBins_cfi::mass, max_number_entries(), sizeof_int(), sizeof_real(), and write_byte_num().

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

450  {
451  if (index <= 0 || index > max_number_entries())
452  return;
453  write_byte_num(mass, (2 + 6 * max_number_entries()) * sizeof_int() + (5 * (index - 1) + 4) * sizeof_real());
454  }
static void write_byte_num(double, unsigned int)
pretend common block is an array of bytes
Definition: EPOS_Wrapper.h:272
static unsigned int sizeof_int()
size of integer in bytes
Definition: EPOS_Wrapper.h:212
static int max_number_entries()
size of common block
Definition: EPOS_Wrapper.h:216
static unsigned int sizeof_real()
size of real in bytes
Definition: EPOS_Wrapper.h:214

◆ set_max_number_entries()

void EPOS::EPOS_Wrapper::set_max_number_entries ( unsigned int  size)
inlinestatic

define size of common block

Definition at line 236 of file EPOS_Wrapper.h.

References s_max_number_entries, and findQualityFiles::size.

size
Write out results.
static unsigned int s_max_number_entries
Definition: EPOS_Wrapper.h:206

◆ set_momentum()

void EPOS::EPOS_Wrapper::set_momentum ( int  index,
double  px,
double  py,
double  pz,
double  e 
)
inlinestatic

set particle momentum

Definition at line 441 of file EPOS_Wrapper.h.

References e(), max_number_entries(), px(), py(), pz(), sizeof_int(), sizeof_real(), and write_byte_num().

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

441  {
442  if (index <= 0 || index > max_number_entries())
443  return;
444  write_byte_num(px, (2 + 6 * max_number_entries()) * sizeof_int() + (5 * (index - 1) + 0) * sizeof_real());
445  write_byte_num(py, (2 + 6 * max_number_entries()) * sizeof_int() + (5 * (index - 1) + 1) * sizeof_real());
446  write_byte_num(pz, (2 + 6 * max_number_entries()) * sizeof_int() + (5 * (index - 1) + 2) * sizeof_real());
447  write_byte_num(e, (2 + 6 * max_number_entries()) * sizeof_int() + (5 * (index - 1) + 3) * sizeof_real());
448  }
static void write_byte_num(double, unsigned int)
pretend common block is an array of bytes
Definition: EPOS_Wrapper.h:272
static double e(int index)
Energy.
Definition: EPOS_Wrapper.h:383
static double py(int index)
Y momentum.
Definition: EPOS_Wrapper.h:375
static unsigned int sizeof_int()
size of integer in bytes
Definition: EPOS_Wrapper.h:212
static double pz(int index)
Z momentum.
Definition: EPOS_Wrapper.h:379
static int max_number_entries()
size of common block
Definition: EPOS_Wrapper.h:216
static unsigned int sizeof_real()
size of real in bytes
Definition: EPOS_Wrapper.h:214
static double px(int index)
X momentum.
Definition: EPOS_Wrapper.h:371

◆ set_number_entries()

void EPOS::EPOS_Wrapper::set_number_entries ( int  noentries)
inlinestatic

set number of entries in EPOS

Definition at line 413 of file EPOS_Wrapper.h.

References sizeof_int(), and write_byte_num().

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

413 { 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:272
static unsigned int sizeof_int()
size of integer in bytes
Definition: EPOS_Wrapper.h:212

◆ set_parents()

void EPOS::EPOS_Wrapper::set_parents ( int  index,
int  firstparent,
int  lastparent 
)
inlinestatic

define parents of a particle

Definition at line 427 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().

427  {
428  if (index <= 0 || index > max_number_entries())
429  return;
430  write_byte_num(firstparent, (2 + 2 * max_number_entries() + 2 * (index - 1)) * sizeof_int());
431  write_byte_num(lastparent, (2 + 2 * max_number_entries() + 2 * (index - 1) + 1) * sizeof_int());
432  }
static void write_byte_num(double, unsigned int)
pretend common block is an array of bytes
Definition: EPOS_Wrapper.h:272
static unsigned int sizeof_int()
size of integer in bytes
Definition: EPOS_Wrapper.h:212
static int max_number_entries()
size of common block
Definition: EPOS_Wrapper.h:216

◆ set_position()

void EPOS::EPOS_Wrapper::set_position ( int  index,
double  x,
double  y,
double  z,
double  t 
)
inlinestatic

set particle production vertex

Definition at line 456 of file EPOS_Wrapper.h.

References max_number_entries(), sizeof_int(), sizeof_real(), t(), write_byte_num(), x(), y(), and z().

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

456  {
457  if (index <= 0 || index > max_number_entries())
458  return;
460  (2 + 6 * max_number_entries()) * sizeof_int() +
461  (5 * max_number_entries() + (4 * (index - 1) + 0)) * sizeof_real());
463  (2 + 6 * max_number_entries()) * sizeof_int() +
464  (5 * max_number_entries() + (4 * (index - 1) + 1)) * sizeof_real());
466  (2 + 6 * max_number_entries()) * sizeof_int() +
467  (5 * max_number_entries() + (4 * (index - 1) + 2)) * sizeof_real());
469  (2 + 6 * max_number_entries()) * sizeof_int() +
470  (5 * max_number_entries() + (4 * (index - 1) + 3)) * sizeof_real());
471  }
static void write_byte_num(double, unsigned int)
pretend common block is an array of bytes
Definition: EPOS_Wrapper.h:272
static double t(int index)
production time
Definition: EPOS_Wrapper.h:406
static double y(int index)
Y Production vertex.
Definition: EPOS_Wrapper.h:396
static unsigned int sizeof_int()
size of integer in bytes
Definition: EPOS_Wrapper.h:212
static double z(int index)
Z Production vertex.
Definition: EPOS_Wrapper.h:401
static int max_number_entries()
size of common block
Definition: EPOS_Wrapper.h:216
static unsigned int sizeof_real()
size of real in bytes
Definition: EPOS_Wrapper.h:214
static double x(int index)
X Production vertex.
Definition: EPOS_Wrapper.h:391

◆ set_sizeof_int()

void EPOS::EPOS_Wrapper::set_sizeof_int ( unsigned int  size)
inlinestatic

define size of integer

Definition at line 218 of file EPOS_Wrapper.h.

References DMR_cfg::cerr, s_sizeof_int, and findQualityFiles::size.

218  {
219  if (size != sizeof(short int) && size != sizeof(long int) && size != sizeof(int)) {
220  std::cerr << "HepMC is not able to handle integers "
221  << " of size other than 2 or 4."
222  << " You requested: " << size << std::endl;
223  }
224  s_sizeof_int = size;
225  }
size
Write out results.
static unsigned int s_sizeof_int
Definition: EPOS_Wrapper.h:204

◆ set_sizeof_real()

void EPOS::EPOS_Wrapper::set_sizeof_real ( unsigned int  size)
inlinestatic

define size of real

Definition at line 227 of file EPOS_Wrapper.h.

References DMR_cfg::cerr, s_sizeof_real, and findQualityFiles::size.

227  {
228  if (size != sizeof(float) && size != sizeof(double)) {
229  std::cerr << "HepMC is not able to handle floating point numbers"
230  << " of size other than 4 or 8."
231  << " You requested: " << size << std::endl;
232  }
234  }
size
Write out results.
static unsigned int s_sizeof_real
Definition: EPOS_Wrapper.h:205

◆ set_status()

void EPOS::EPOS_Wrapper::set_status ( int  index,
int  status 
)
inlinestatic

set particle status

Definition at line 415 of file EPOS_Wrapper.h.

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

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

415  {
416  if (index <= 0 || index > max_number_entries())
417  return;
418  write_byte_num(status, (2 + index - 1) * sizeof_int());
419  }
static void write_byte_num(double, unsigned int)
pretend common block is an array of bytes
Definition: EPOS_Wrapper.h:272
static unsigned int sizeof_int()
size of integer in bytes
Definition: EPOS_Wrapper.h:212
static int status(int index)
status code
Definition: EPOS_Wrapper.h:315
static int max_number_entries()
size of common block
Definition: EPOS_Wrapper.h:216

◆ sizeof_int()

unsigned int EPOS::EPOS_Wrapper::sizeof_int ( )
inlinestatic

◆ sizeof_real()

unsigned int EPOS::EPOS_Wrapper::sizeof_real ( )
inlinestatic

size of real in bytes

Definition at line 214 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().

214 { return s_sizeof_real; }
static unsigned int s_sizeof_real
Definition: EPOS_Wrapper.h:205

◆ status()

int EPOS::EPOS_Wrapper::status ( int  index)
inlinestatic

status code

Definition at line 315 of file EPOS_Wrapper.h.

References byte_num_to_int(), and sizeof_int().

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

315 { return byte_num_to_int((2 + index - 1) * sizeof_int()); }
static unsigned int sizeof_int()
size of integer in bytes
Definition: EPOS_Wrapper.h:212
static int byte_num_to_int(unsigned int)
navigate a byte array
Definition: EPOS_Wrapper.h:253

◆ t()

double EPOS::EPOS_Wrapper::t ( int  index)
inlinestatic

production time

Definition at line 406 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(), print_hepcom_particle(), and set_position().

406  {
407  return byte_num_to_double((2 + 6 * max_number_entries()) * sizeof_int() +
408  (5 * max_number_entries() + (4 * (index - 1) + 3)) * sizeof_real());
409  }
static unsigned int sizeof_int()
size of integer in bytes
Definition: EPOS_Wrapper.h:212
static double byte_num_to_double(unsigned int)
navigate a byte array
Definition: EPOS_Wrapper.h:238
static int max_number_entries()
size of common block
Definition: EPOS_Wrapper.h:216
static unsigned int sizeof_real()
size of real in bytes
Definition: EPOS_Wrapper.h:214

◆ write_byte_num() [1/2]

void EPOS::EPOS_Wrapper::write_byte_num ( double  in,
unsigned int  b 
)
inlinestaticprotected

pretend common block is an array of bytes

Definition at line 272 of file EPOS_Wrapper.h.

References b, DMR_cfg::cerr, epos_bytes_allocation, dqmMemoryStats::float, hepcom, recoMuon::in, 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().

272  {
273  if (b >= epos_bytes_allocation)
274  std::cerr << "EPOS_Wrapper: requested hepcom data exceeds allocation" << std::endl;
275  if (s_sizeof_real == sizeof(float)) {
276  float* myfloat = (float*)&hepcom.data[b];
277  (*myfloat) = (float)in;
278  } else if (s_sizeof_real == sizeof(double)) {
279  double* mydouble = (double*)&hepcom.data[b];
280  (*mydouble) = (double)in;
281  } else {
282  std::cerr << "EPOS_Wrapper: illegal floating point number length." << s_sizeof_real << std::endl;
283  }
284  }
#define hepcom
Definition: EPOS_Wrapper.h:81
double b
Definition: hdecay.h:118
static unsigned int s_sizeof_real
Definition: EPOS_Wrapper.h:205
const unsigned int epos_bytes_allocation
Definition: EPOS_Wrapper.h:67

◆ write_byte_num() [2/2]

void EPOS::EPOS_Wrapper::write_byte_num ( int  in,
unsigned int  b 
)
inlinestaticprotected

pretend common block is an array of bytes

Definition at line 286 of file EPOS_Wrapper.h.

References b, DMR_cfg::cerr, epos_bytes_allocation, hepcom, recoMuon::in, createfilelist::int, and s_sizeof_int.

286  {
287  if (b >= epos_bytes_allocation)
288  std::cerr << "EPOS_Wrapper: requested hepcom data exceeds allocation" << std::endl;
289  if (s_sizeof_int == sizeof(short int)) {
290  short int* myshortint = (short int*)&hepcom.data[b];
291  (*myshortint) = (short int)in;
292  } else if (s_sizeof_int == sizeof(long int)) {
293  long int* mylongint = (long int*)&hepcom.data[b];
294  (*mylongint) = (int)in;
295  // on some 64 bit machines, int, short, and long are all different
296  } else if (s_sizeof_int == sizeof(int)) {
297  int* myint = (int*)&hepcom.data[b];
298  (*myint) = (int)in;
299  } else {
300  std::cerr << "EPOS_Wrapper: illegal integer number length." << s_sizeof_int << std::endl;
301  }
302  }
#define hepcom
Definition: EPOS_Wrapper.h:81
double b
Definition: hdecay.h:118
const unsigned int epos_bytes_allocation
Definition: EPOS_Wrapper.h:67
static unsigned int s_sizeof_int
Definition: EPOS_Wrapper.h:204

◆ x()

double EPOS::EPOS_Wrapper::x ( int  index)
inlinestatic

X Production vertex.

Definition at line 391 of file EPOS_Wrapper.h.

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

Referenced by svgfig.Curve.Sample::__repr__(), svgfig.Ellipse::__repr__(), EPOS::IO_EPOS::build_end_vertex(), EPOS::IO_EPOS::build_production_vertex(), geometryXMLparser.Alignable::pos(), print_hepcom_particle(), ntupleDataFormat._HitObject::r(), ntupleDataFormat._HitObject::r3D(), and set_position().

391  {
392  return byte_num_to_double((2 + 6 * max_number_entries()) * sizeof_int() +
393  (5 * max_number_entries() + (4 * (index - 1) + 0)) * sizeof_real());
394  }
static unsigned int sizeof_int()
size of integer in bytes
Definition: EPOS_Wrapper.h:212
static double byte_num_to_double(unsigned int)
navigate a byte array
Definition: EPOS_Wrapper.h:238
static int max_number_entries()
size of common block
Definition: EPOS_Wrapper.h:216
static unsigned int sizeof_real()
size of real in bytes
Definition: EPOS_Wrapper.h:214

◆ y()

double EPOS::EPOS_Wrapper::y ( int  index)
inlinestatic

Y Production vertex.

Definition at line 396 of file EPOS_Wrapper.h.

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

Referenced by svgfig.Ellipse::__repr__(), EPOS::IO_EPOS::build_end_vertex(), EPOS::IO_EPOS::build_production_vertex(), geometryXMLparser.Alignable::pos(), print_hepcom_particle(), ntupleDataFormat._HitObject::r(), ntupleDataFormat._HitObject::r3D(), and set_position().

396  {
397  return byte_num_to_double((2 + 6 * max_number_entries()) * sizeof_int() +
398  (5 * max_number_entries() + (4 * (index - 1) + 1)) * sizeof_real());
399  }
static unsigned int sizeof_int()
size of integer in bytes
Definition: EPOS_Wrapper.h:212
static double byte_num_to_double(unsigned int)
navigate a byte array
Definition: EPOS_Wrapper.h:238
static int max_number_entries()
size of common block
Definition: EPOS_Wrapper.h:216
static unsigned int sizeof_real()
size of real in bytes
Definition: EPOS_Wrapper.h:214

◆ z()

double EPOS::EPOS_Wrapper::z ( int  index)
inlinestatic

Z Production vertex.

Definition at line 401 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(), print_hepcom_particle(), ntupleDataFormat._HitObject::r3D(), and set_position().

401  {
402  return byte_num_to_double((2 + 6 * max_number_entries()) * sizeof_int() +
403  (5 * max_number_entries() + (4 * (index - 1) + 2)) * sizeof_real());
404  }
static unsigned int sizeof_int()
size of integer in bytes
Definition: EPOS_Wrapper.h:212
static double byte_num_to_double(unsigned int)
navigate a byte array
Definition: EPOS_Wrapper.h:238
static int max_number_entries()
size of common block
Definition: EPOS_Wrapper.h:216
static unsigned int sizeof_real()
size of real in bytes
Definition: EPOS_Wrapper.h:214

◆ zero_everything()

void EPOS::EPOS_Wrapper::zero_everything ( )
inlinestatic

set all entries in EPOS to zero

Definition at line 473 of file EPOS_Wrapper.h.

References mps_fire::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().

473  {
474  set_event_number(0);
476  for (int i = 1; i <= max_number_entries(); ++i) {
477  set_status(i, 0);
478  set_id(i, 0);
479  set_parents(i, 0, 0);
480  set_children(i, 0, 0);
481  set_momentum(i, 0, 0, 0, 0);
482  set_mass(i, 0);
483  set_position(i, 0, 0, 0, 0);
484  }
485  }
static void set_children(int index, int firstchild, int lastchild)
define children of a particle
Definition: EPOS_Wrapper.h:434
static void set_mass(int index, double mass)
set particle mass
Definition: EPOS_Wrapper.h:450
static void set_status(int index, int status)
set particle status
Definition: EPOS_Wrapper.h:415
static void set_id(int index, int id)
set particle ID
Definition: EPOS_Wrapper.h:421
static void set_number_entries(int noentries)
set number of entries in EPOS
Definition: EPOS_Wrapper.h:413
static void set_event_number(int evtno)
set event number
Definition: EPOS_Wrapper.h:411
static void set_momentum(int index, double px, double py, double pz, double e)
set particle momentum
Definition: EPOS_Wrapper.h:441
static void set_position(int index, double x, double y, double z, double t)
set particle production vertex
Definition: EPOS_Wrapper.h:456
static int max_number_entries()
size of common block
Definition: EPOS_Wrapper.h:216
static void set_parents(int index, int firstparent, int lastparent)
define parents of a particle
Definition: EPOS_Wrapper.h:427

Member Data Documentation

◆ s_max_number_entries

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

Definition at line 206 of file EPOS_Wrapper.h.

Referenced by max_number_entries(), and set_max_number_entries().

◆ s_sizeof_int

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

Definition at line 204 of file EPOS_Wrapper.h.

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

◆ s_sizeof_real

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

Definition at line 205 of file EPOS_Wrapper.h.

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