File indexing completed on 2025-01-18 10:01:12
0001
0002
0003
0004
0005
0006 #ifndef HEPMC3_HEPEVT_WRAPPER_RUNTIME_H
0007 #define HEPMC3_HEPEVT_WRAPPER_RUNTIME_H
0008 #include <iostream>
0009 #include <cstdio>
0010 #include <set>
0011 #include <map>
0012 #include <cstring> // memset
0013 #include <algorithm> //min max for VS2017
0014 #include "HepMC3/GenEvent.h"
0015 #include "HepMC3/GenParticle.h"
0016 #include "HepMC3/GenVertex.h"
0017 #include "HepMC3/HEPEVT_Helpers.h"
0018
0019
0020
0021
0022
0023
0024
0025
0026 namespace HepMC3
0027 {
0028
0029 class HEPEVT_Wrapper_Runtime
0030 {
0031
0032
0033
0034 public:
0035
0036 HEPEVT_Wrapper_Runtime() {m_max_particles=0; m_hepevtptr=nullptr;};
0037
0038 ~HEPEVT_Wrapper_Runtime() {};
0039
0040 void print_hepevt( std::ostream& ostr = std::cout ) const;
0041
0042 void print_hepevt_particle( int index, std::ostream& ostr = std::cout ) const;
0043
0044 void zero_everything();
0045
0046 bool GenEvent_to_HEPEVT( const GenEvent* evt ) { return GenEvent_to_HEPEVT_nonstatic(evt, this);};
0047
0048 bool HEPEVT_to_GenEvent( GenEvent* evt ) const { return HEPEVT_to_GenEvent_nonstatic(evt, this);};
0049
0050 bool fix_daughters();
0051 private:
0052
0053 std::shared_ptr<struct HEPEVT_Pointers<double> > m_hepevtptr;
0054
0055 int m_max_particles;
0056
0057 std::vector<char> m_internal_storage;
0058
0059
0060
0061 public:
0062 void allocate_internal_storage();
0063 void copy_to_internal_storage( char *c, int N );
0064 void set_max_number_entries( unsigned int size ) { m_max_particles = size; }
0065 void set_hepevt_address(char *c);
0066 int max_number_entries() const { return m_max_particles; }
0067 int event_number() const { return *(m_hepevtptr->nevhep); }
0068 int number_entries() const { return *(m_hepevtptr->nhep); }
0069 int status(const int index ) const { return m_hepevtptr->isthep[index-1]; }
0070 int id(const int index ) const { return m_hepevtptr->idhep[index-1]; }
0071 int first_parent(const int index ) const { return m_hepevtptr->jmohep[2*(index-1)]; }
0072 int last_parent(const int index ) const { return m_hepevtptr->jmohep[2*(index-1)+1]; }
0073 int first_child(const int index ) const { return m_hepevtptr->jdahep[2*(index-1)]; }
0074 int last_child(const int index ) const { return m_hepevtptr->jdahep[2*(index-1)+1]; }
0075 double px(const int index ) const { return m_hepevtptr->phep[5*(index-1)]; }
0076 double py(const int index ) const { return m_hepevtptr->phep[5*(index-1)+1]; }
0077 double pz(const int index ) const { return m_hepevtptr->phep[5*(index-1)+2]; }
0078 double e(const int index ) const { return m_hepevtptr->phep[5*(index-1)+3]; }
0079 double m(const int index ) const { return m_hepevtptr->phep[5*(index-1)+4]; }
0080 double x(const int index ) const { return m_hepevtptr->vhep[4*(index-1)]; }
0081 double y(const int index ) const { return m_hepevtptr->vhep[4*(index-1)+1]; }
0082 double z(const int index ) const { return m_hepevtptr->vhep[4*(index-1)+2]; }
0083 double t(const int index ) const { return m_hepevtptr->vhep[4*(index-1)+3]; }
0084 int number_parents(const int index ) const;
0085 int number_children(const int index ) const;
0086 int number_children_exact(const int index ) const;
0087 void set_event_number( const int evtno ) { *(m_hepevtptr->nevhep) = evtno; }
0088 void set_number_entries( const int noentries ) { *(m_hepevtptr->nhep) = noentries; }
0089 void set_status( const int index, const int status ) { m_hepevtptr->isthep[index-1] = status; }
0090 void set_id(const int index, const int id ) { m_hepevtptr->idhep[index-1] = id; }
0091 void set_parents( const int index, const int firstparent, const int lastparent );
0092 void set_children( const int index, const int firstchild, const int lastchild );
0093 void set_momentum( const int index, const double px, const double py, const double pz, const double e );
0094 void set_mass( const int index, double mass );
0095 void set_position( const int index, const double x, const double y, const double z, const double t );
0096 };
0097
0098
0099 }
0100 #endif