CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules 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 129 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 240 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().

240  {
241  if (b >= epos_bytes_allocation)
242  std::cerr << "EPOS_Wrapper: requested hepcom data exceeds allocation" << std::endl;
243  if (s_sizeof_real == sizeof(float)) {
244  float* myfloat = (float*)&hepcom.data[b];
245  return (double)(*myfloat);
246  } else if (s_sizeof_real == sizeof(double)) {
247  double* mydouble = (double*)&hepcom.data[b];
248  return (*mydouble);
249  } else {
250  std::cerr << "EPOS_Wrapper: illegal floating point number length." << s_sizeof_real << std::endl;
251  }
252  return 0;
253  }
return((rh ^ lh) &mask)
#define hepcom
Definition: EPOS_Wrapper.h:83
double b
Definition: hdecay.h:120
static unsigned int s_sizeof_real
Definition: EPOS_Wrapper.h:207
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 255 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().

255  {
256  if (b >= epos_bytes_allocation)
257  std::cerr << "EPOS_Wrapper: requested hepcom data exceeds allocation" << std::endl;
258  if (s_sizeof_int == sizeof(short int)) {
259  short int* myshortint = (short int*)&hepcom.data[b];
260  return (int)(*myshortint);
261  } else if (s_sizeof_int == sizeof(long int)) {
262  long int* mylongint = (long int*)&hepcom.data[b];
263  return (*mylongint);
264  // on some 64 bit machines, int, short, and long are all different
265  } else if (s_sizeof_int == sizeof(int)) {
266  int* myint = (int*)&hepcom.data[b];
267  return (*myint);
268  } else {
269  std::cerr << "EPOS_Wrapper: illegal integer number length." << s_sizeof_int << std::endl;
270  }
271  return 0;
272  }
return((rh ^ lh) &mask)
#define hepcom
Definition: EPOS_Wrapper.h:83
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:206

◆ e()

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

Energy.

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

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

◆ event_number()

int EPOS::EPOS_Wrapper::event_number ( )
inlinestatic

event number

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

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

◆ first_child()

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

index of 1st daughter

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

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

◆ first_parent()

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

index of 1st mother

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

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

◆ id()

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

PDG particle id.

Definition at line 319 of file EPOS_Wrapper.h.

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

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

319  {
320  return byte_num_to_int((2 + max_number_entries() + index - 1) * sizeof_int());
321  }
static unsigned int sizeof_int()
size of integer in bytes
Definition: EPOS_Wrapper.h:214
static int byte_num_to_int(unsigned int)
navigate a byte array
Definition: EPOS_Wrapper.h:255
static int max_number_entries()
size of common block
Definition: EPOS_Wrapper.h:218

◆ last_child()

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

index of last daughter

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

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

◆ last_parent()

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

index of last mother

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

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

◆ m()

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

generated mass

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

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

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

References first_child(), and last_child().

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

368  {
369  int firstchild = first_child(index);
370  return (firstchild > 0) ? (1 + last_child(index) - firstchild) : 0;
371  }
static int first_child(int index)
index of 1st daughter
Definition: EPOS_Wrapper.h:348
static int last_child(int index)
index of last daughter
Definition: EPOS_Wrapper.h:353

◆ number_entries()

int EPOS::EPOS_Wrapper::number_entries ( )
inlinestatic

num entries in current evt

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

312  {
313  int nhep = byte_num_to_int(1 * sizeof_int());
314  return (nhep <= max_number_entries() ? nhep : max_number_entries());
315  }
static unsigned int sizeof_int()
size of integer in bytes
Definition: EPOS_Wrapper.h:214
static int byte_num_to_int(unsigned int)
navigate a byte array
Definition: EPOS_Wrapper.h:255
static int max_number_entries()
size of common block
Definition: EPOS_Wrapper.h:218

◆ number_parents()

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

number of parents

Definition at line 343 of file EPOS_Wrapper.h.

References first_parent(), and last_parent().

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

343  {
344  int firstparent = first_parent(index);
345  return (firstparent > 0) ? (1 + last_parent(index) - firstparent) : 0;
346  }
static int first_parent(int index)
index of 1st mother
Definition: EPOS_Wrapper.h:323
static int last_parent(int index)
index of last mother
Definition: EPOS_Wrapper.h:328

◆ print_hepcom()

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

write information from EPOS common block

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

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

◆ 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 506 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().

506  {
507  char outline[81];
508  sprintf(outline,
509  "%4d %+4d %4d %4d (%9.3g, %9.3g, %9.3g, %9.3g, %9.3g)",
510  i,
511  status(i),
512  first_parent(i),
513  first_child(i),
514  px(i),
515  py(i),
516  pz(i),
517  e(i),
518  m(i));
519  ostr << outline << "\n";
520  sprintf(outline,
521  "%+9d %4d %4d (%9.3g, %9.3g, %9.3g, %9.3g)",
522  // old version was:" (%+9.2e, %+9.2e, %+9.2e, %+9.2e)"
523  id(i),
524  last_parent(i),
525  last_child(i),
526  x(i),
527  y(i),
528  z(i),
529  t(i));
530  ostr << outline << std::endl;
531  }
static double m(int index)
generated mass
Definition: EPOS_Wrapper.h:389
static double e(int index)
Energy.
Definition: EPOS_Wrapper.h:385
static double t(int index)
production time
Definition: EPOS_Wrapper.h:408
static int first_child(int index)
index of 1st daughter
Definition: EPOS_Wrapper.h:348
static int first_parent(int index)
index of 1st mother
Definition: EPOS_Wrapper.h:323
static double y(int index)
Y Production vertex.
Definition: EPOS_Wrapper.h:398
static double py(int index)
Y momentum.
Definition: EPOS_Wrapper.h:377
static int status(int index)
status code
Definition: EPOS_Wrapper.h:317
static double pz(int index)
Z momentum.
Definition: EPOS_Wrapper.h:381
static double z(int index)
Z Production vertex.
Definition: EPOS_Wrapper.h:403
static int last_child(int index)
index of last daughter
Definition: EPOS_Wrapper.h:353
static int last_parent(int index)
index of last mother
Definition: EPOS_Wrapper.h:328
static double x(int index)
X Production vertex.
Definition: EPOS_Wrapper.h:393
static double px(int index)
X momentum.
Definition: EPOS_Wrapper.h:373

◆ print_legend()

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

print output legend

Definition at line 533 of file EPOS_Wrapper.h.

Referenced by print_hepcom().

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

◆ px()

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

X momentum.

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

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

◆ py()

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

Y momentum.

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

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

◆ pz()

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

Z momentum.

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

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

◆ set_children()

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

define children of a particle

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

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

◆ set_event_number()

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

set event number

Definition at line 413 of file EPOS_Wrapper.h.

References write_byte_num().

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

413 { 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:274

◆ set_id()

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

set particle ID

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

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

◆ set_mass()

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

set particle mass

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

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

◆ set_max_number_entries()

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

define size of common block

Definition at line 238 of file EPOS_Wrapper.h.

References s_max_number_entries.

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

◆ 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 443 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().

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

◆ set_number_entries()

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

set number of entries in EPOS

Definition at line 415 of file EPOS_Wrapper.h.

References sizeof_int(), and write_byte_num().

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

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

◆ set_parents()

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

define parents of a particle

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

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

◆ 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 458 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().

458  {
459  if (index <= 0 || index > max_number_entries())
460  return;
462  (2 + 6 * max_number_entries()) * sizeof_int() +
463  (5 * max_number_entries() + (4 * (index - 1) + 0)) * sizeof_real());
465  (2 + 6 * max_number_entries()) * sizeof_int() +
466  (5 * max_number_entries() + (4 * (index - 1) + 1)) * sizeof_real());
468  (2 + 6 * max_number_entries()) * sizeof_int() +
469  (5 * max_number_entries() + (4 * (index - 1) + 2)) * sizeof_real());
471  (2 + 6 * max_number_entries()) * sizeof_int() +
472  (5 * max_number_entries() + (4 * (index - 1) + 3)) * sizeof_real());
473  }
static void write_byte_num(double, unsigned int)
pretend common block is an array of bytes
Definition: EPOS_Wrapper.h:274
static double t(int index)
production time
Definition: EPOS_Wrapper.h:408
static double y(int index)
Y Production vertex.
Definition: EPOS_Wrapper.h:398
static unsigned int sizeof_int()
size of integer in bytes
Definition: EPOS_Wrapper.h:214
static double z(int index)
Z Production vertex.
Definition: EPOS_Wrapper.h:403
static int max_number_entries()
size of common block
Definition: EPOS_Wrapper.h:218
static unsigned int sizeof_real()
size of real in bytes
Definition: EPOS_Wrapper.h:216
static double x(int index)
X Production vertex.
Definition: EPOS_Wrapper.h:393

◆ set_sizeof_int()

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

define size of integer

Definition at line 220 of file EPOS_Wrapper.h.

References DMR_cfg::cerr, and s_sizeof_int.

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

◆ set_sizeof_real()

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

define size of real

Definition at line 229 of file EPOS_Wrapper.h.

References DMR_cfg::cerr, and s_sizeof_real.

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

◆ set_status()

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

set particle status

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

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

◆ 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 216 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().

216 { return s_sizeof_real; }
static unsigned int s_sizeof_real
Definition: EPOS_Wrapper.h:207

◆ status()

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

status code

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

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

◆ t()

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

production time

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

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

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

References b, DMR_cfg::cerr, epos_bytes_allocation, nano_mu_digi_cff::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().

274  {
275  if (b >= epos_bytes_allocation)
276  std::cerr << "EPOS_Wrapper: requested hepcom data exceeds allocation" << std::endl;
277  if (s_sizeof_real == sizeof(float)) {
278  float* myfloat = (float*)&hepcom.data[b];
279  (*myfloat) = (float)in;
280  } else if (s_sizeof_real == sizeof(double)) {
281  double* mydouble = (double*)&hepcom.data[b];
282  (*mydouble) = (double)in;
283  } else {
284  std::cerr << "EPOS_Wrapper: illegal floating point number length." << s_sizeof_real << std::endl;
285  }
286  }
#define hepcom
Definition: EPOS_Wrapper.h:83
double b
Definition: hdecay.h:120
static unsigned int s_sizeof_real
Definition: EPOS_Wrapper.h:207
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 288 of file EPOS_Wrapper.h.

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

288  {
289  if (b >= epos_bytes_allocation)
290  std::cerr << "EPOS_Wrapper: requested hepcom data exceeds allocation" << std::endl;
291  if (s_sizeof_int == sizeof(short int)) {
292  short int* myshortint = (short int*)&hepcom.data[b];
293  (*myshortint) = (short int)in;
294  } else if (s_sizeof_int == sizeof(long int)) {
295  long int* mylongint = (long int*)&hepcom.data[b];
296  (*mylongint) = (int)in;
297  // on some 64 bit machines, int, short, and long are all different
298  } else if (s_sizeof_int == sizeof(int)) {
299  int* myint = (int*)&hepcom.data[b];
300  (*myint) = (int)in;
301  } else {
302  std::cerr << "EPOS_Wrapper: illegal integer number length." << s_sizeof_int << std::endl;
303  }
304  }
#define hepcom
Definition: EPOS_Wrapper.h:83
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:206

◆ x()

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

X Production vertex.

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

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

◆ y()

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

Y Production vertex.

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

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

◆ z()

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

Z Production vertex.

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

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

◆ zero_everything()

void EPOS::EPOS_Wrapper::zero_everything ( )
inlinestatic

set all entries in EPOS to zero

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

475  {
476  set_event_number(0);
478  for (int i = 1; i <= max_number_entries(); ++i) {
479  set_status(i, 0);
480  set_id(i, 0);
481  set_parents(i, 0, 0);
482  set_children(i, 0, 0);
483  set_momentum(i, 0, 0, 0, 0);
484  set_mass(i, 0);
485  set_position(i, 0, 0, 0, 0);
486  }
487  }
static void set_children(int index, int firstchild, int lastchild)
define children of a particle
Definition: EPOS_Wrapper.h:436
static void set_mass(int index, double mass)
set particle mass
Definition: EPOS_Wrapper.h:452
static void set_status(int index, int status)
set particle status
Definition: EPOS_Wrapper.h:417
static void set_id(int index, int id)
set particle ID
Definition: EPOS_Wrapper.h:423
static void set_number_entries(int noentries)
set number of entries in EPOS
Definition: EPOS_Wrapper.h:415
static void set_event_number(int evtno)
set event number
Definition: EPOS_Wrapper.h:413
static void set_momentum(int index, double px, double py, double pz, double e)
set particle momentum
Definition: EPOS_Wrapper.h:443
static void set_position(int index, double x, double y, double z, double t)
set particle production vertex
Definition: EPOS_Wrapper.h:458
static int max_number_entries()
size of common block
Definition: EPOS_Wrapper.h:218
static void set_parents(int index, int firstparent, int lastparent)
define parents of a particle
Definition: EPOS_Wrapper.h:429

Member Data Documentation

◆ s_max_number_entries

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

Definition at line 208 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 206 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 207 of file EPOS_Wrapper.h.

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