6#ifndef HEPMC3_HEPEVT_WRAPPER_TEMPLATE_H 
    7#define HEPMC3_HEPEVT_WRAPPER_TEMPLATE_H 
   30template <
int max_particles, 
typename momentum_type = 
double>
 
   64    void   set_max_number_entries( 
unsigned int size ) { 
if (size != max_particles) printf(
"This implementation does not support change of the block size.\n"); assert(size == max_particles); }
 
   75    double px(
const int index )
    const        { 
return m_hepevtptr->phep[index-1][0];   } 
 
   76    double py(
const int index )
    const        { 
return m_hepevtptr->phep[index-1][1];   } 
 
   77    double pz(
const int index )
    const        { 
return m_hepevtptr->phep[index-1][2];   } 
 
   78    double e(
const int index )
     const        { 
return m_hepevtptr->phep[index-1][3];   } 
 
   79    double m(
const int index )
     const        { 
return m_hepevtptr->phep[index-1][4];   } 
 
   80    double x(
const int index )
     const        { 
return m_hepevtptr->vhep[index-1][0];   } 
 
   81    double y(
const int index )
     const        { 
return m_hepevtptr->vhep[index-1][1];   } 
 
   82    double z(
const int index )
      const       { 
return m_hepevtptr->vhep[index-1][2];   } 
 
   83    double t(
const int index )
      const       { 
return m_hepevtptr->vhep[index-1][3];   } 
 
   91    void set_parents( 
const int index, 
const int firstparent, 
const int lastparent );              
 
   92    void set_children( 
const int index, 
const int firstchild, 
const int lastchild );               
 
   93    void set_momentum( 
const int index, 
const double px, 
const double py, 
const double pz, 
const double e );   
 
   95    void set_position( 
const int index, 
const double x, 
const double y, 
const double z, 
const double t );      
 
  101template <
int max_particles, 
typename momentum_type>
 
  104    ostr << 
" Event No.: " << 
m_hepevtptr->nevhep << std::endl;
 
  105    ostr << 
"  Nr   Type   Parent(s)  Daughter(s)      Px       Py       Pz       E    Inv. M." << std::endl;
 
 
  111template <
int max_particles, 
typename momentum_type>
 
  116    sprintf(buf, 
"%5i %6i", index, 
m_hepevtptr->idhep[index-1]);
 
  123    ostr << buf << std::endl;
 
 
  126template <
int max_particles, 
typename momentum_type>
 
  129    m_internal_storage = std::make_shared<struct HEPEVT_Templated<max_particles, momentum_type>>();
 
 
  133template <
int max_particles, 
typename momentum_type>
 
  136    if ( N < 1 || N > max_particles) 
return;
 
  137    m_internal_storage = std::make_shared<struct HEPEVT_Templated<max_particles, momentum_type>>();
 
  149    x += 
sizeof(int)*N*2;
 
  151    x += 
sizeof(int)*N*2;
 
  152    memcpy(
m_hepevtptr->phep, 
x, 5*N*
sizeof(momentum_type));
 
  153    x += 
sizeof(momentum_type)*N*5;
 
  154    memcpy(
m_hepevtptr->vhep, 
x, 4*N*
sizeof(momentum_type));
 
 
  157template <
int max_particles, 
typename momentum_type>
 
  163template <
int max_particles, 
typename momentum_type>
 
  169template <
int max_particles, 
typename momentum_type>
 
  175template <
int max_particles, 
typename momentum_type>
 
  184template <
int max_particles, 
typename momentum_type>
 
  191template <
int max_particles, 
typename momentum_type>
 
  198template <
int max_particles, 
typename momentum_type>
 
  207template <
int max_particles, 
typename momentum_type>
 
  213template <
int max_particles, 
typename momentum_type>
 
 
  222template <
int max_particles, 
typename momentum_type>
 
  234    bool is_fixed = 
true;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Definition of class GenEvent.
Definition of class GenParticle.
Definition of class GenVertex.
Helper functions used to manipulate with HEPEVT block.
Stores event-related information.
int first_child(const int index) const
Get index of 1st daughter.
int last_parent(const int index) const
Get index of last mother.
~HEPEVT_Wrapper_Template()
Default destructor.
void set_id(const int index, const int id)
Set PDG particle id.
int event_number() const
Get event number.
bool HEPEVT_to_GenEvent(GenEvent *evt) const
Convert HEPEVT to GenEvent.
bool GenEvent_to_HEPEVT(const GenEvent *evt)
Convert GenEvent to HEPEVT.
int last_child(const int index) const
Get index of last daughter.
void allocate_internal_storage()
Allocates m_internal_storage storage in smart pointer to hold HEPEVT of fixed size.
int first_parent(const int index) const
Get index of 1st mother.
double pz(const int index) const
Get Z momentum.
void zero_everything()
Set all entries in HEPEVT to zero.
double py(const int index) const
Get Y momentum.
void set_parents(const int index, const int firstparent, const int lastparent)
Set parents.
int number_children_exact(const int index) const
Get number of children by counting.
void print_hepevt_particle(int index, std::ostream &ostr=std::cout) const
Print particle information.
int id(const int index) const
Get PDG particle id.
double t(const int index) const
Get production time.
void set_momentum(const int index, const double px, const double py, const double pz, const double e)
Set 4-momentum.
void set_children(const int index, const int firstchild, const int lastchild)
Set children.
int number_parents(const int index) const
Get number of parents.
void set_position(const int index, const double x, const double y, const double z, const double t)
Set position in time-space.
double y(const int index) const
Get Y Production vertex.
bool fix_daughters()
Tries to fix list of daughters.
void set_max_number_entries(unsigned int size)
Set block size.
int number_entries() const
Get number of entries.
void set_hepevt_address(char *c)
Set Fortran block address.
double m(const int index) const
Get generated mass.
int status(const int index) const
Get status code.
std::shared_ptr< struct HEPEVT_Templated< max_particles, momentum_type > > m_internal_storage
Internalstorage storage. Optional.
double px(const int index) const
Get X momentum.
int number_children(const int index) const
Get number of children from the range of daughters.
double z(const int index) const
Get Z Production vertex.
struct HEPEVT_Templated< max_particles, momentum_type > * m_hepevtptr
Fortran common block HEPEVT.
void print_hepevt(std::ostream &ostr=std::cout) const
Print information from HEPEVT common block.
void set_mass(const int index, double mass)
Set mass.
int max_number_entries() const
Block size.
double x(const int index) const
Get X Production vertex.
void set_event_number(const int evtno)
Set event number.
void copy_to_internal_storage(char *c, int N)
Copies the content of foreign common block into the internal storage.
void set_status(const int index, const int status)
Set status code.
HEPEVT_Wrapper_Template()
Default constructor.
void set_number_entries(const int noentries)
Set number of entries.
double e(const int index) const
Get Energy.
bool HEPEVT_to_GenEvent_nonstatic(GenEvent *evt, T *A)
Converts HEPEVT into GenEvent.
bool GenEvent_to_HEPEVT_nonstatic(const GenEvent *evt, T *A)
Converts GenEvent into HEPEVT.
C structure representing Fortran common block HEPEVT T. Sjöstrand et al., "A proposed standard event ...