hepmc - Diff between revs 42 and 65
Subversion Repositories:
| Rev 42 | Rev 65 | |||
|---|---|---|---|---|
| Line 119... | Line 119... | |||
| 119 | #include <iostream> | 119 | #include <iostream> | |
| 120 | #include <cstdio> // needed for formatted output using sprintf | 120 | #include <cstdio> // needed for formatted output using sprintf | |
| 121 | 121 | |||
| 122 | namespace HepMC { | 122 | namespace HepMC { | |
| 123 | 123 | |||
| - | 124 | //! Generic Wrapper for the fortran HEPEVT common block | ||
| - | 125 | |||
| - | 126 | /// \class HEPEVT_Wrapper | ||
| - | 127 | /// This class is intended for static use only - it makes no sense to | ||
| - | 128 | /// instantiate it. | ||
| - | 129 | /// | ||
| 124 | class HEPEVT_Wrapper { | 130 | class HEPEVT_Wrapper { | |
| 125 | public: | 131 | public: | |
| 126 | 132 | |||
| 127 | static void print_hepevt( std::ostream& ostr = std::cout ); | 133 | static void print_hepevt( std::ostream& ostr = std::cout ); | |
| 128 | static void print_hepevt_particle( int index, | 134 | static void print_hepevt_particle( int index, | |
| 129 | std::ostream& ostr = std::cout ); | 135 | std::ostream& ostr = std::cout ); | |
| 130 | static bool is_double_precision(); // True if common block uses double | - | ||
| - | 136 | static bool is_double_precision(); //!< True if common block uses double | ||
| 131 | 137 | |||
| 132 | static bool check_hepevt_consistency( std::ostream& ostr = std::cout ); | 138 | static bool check_hepevt_consistency( std::ostream& ostr = std::cout ); | |
| 133 | 139 | |||
| - | 140 | /// set all entries in HEPEVT to zero | ||
| 134 | static void zero_everything(); | 141 | static void zero_everything(); | |
| 135 | 142 | |||
| 136 | //////////////////// | 143 | //////////////////// | |
| 137 | // Access Methods // | 144 | // Access Methods // | |
| 138 | //////////////////// | 145 | //////////////////// | |
| 139 | static int event_number(); // event number | - | ||
| 140 | static int number_entries(); // num entries in current evt | - | ||
| 141 | static int status( int index ); // status code | - | ||
| 142 | static int id( int index ); // PDG particle id | - | ||
| 143 | static int first_parent( int index ); // index of 1st mother | - | ||
| 144 | static int last_parent( int index ); // index of last mother | - | ||
| 145 | static int number_parents( int index ); | - | ||
| 146 | static int first_child( int index ); // index of 1st daughter | - | ||
| 147 | static int last_child( int index ); // index of last daughter | - | ||
| 148 | static int number_children( int index ); | - | ||
| 149 | static double px( int index ); // X momentum | - | ||
| 150 | static double py( int index ); | - | ||
| 151 | static double pz( int index ); | - | ||
| 152 | static double e( int index ); // Energy | - | ||
| 153 | static double m( int index ); // generated mass | - | ||
| 154 | static double x( int index ); // X Production vertex | - | ||
| 155 | static double y( int index ); | - | ||
| 156 | static double z( int index ); | - | ||
| 157 | static double t( int index ); // production time | - | ||
| - | 146 | static int event_number(); //!< event number | ||
| - | 147 | static int number_entries(); //!< num entries in current evt | ||
| - | 148 | static int status( int index ); //!< status code | ||
| - | 149 | static int id( int index ); //!< PDG particle id | ||
| - | 150 | static int first_parent( int index ); //!< index of 1st mother | ||
| - | 151 | static int last_parent( int index ); //!< index of last mother | ||
| - | 152 | static int number_parents( int index ); //!< number of parents | ||
| - | 153 | static int first_child( int index ); //!< index of 1st daughter | ||
| - | 154 | static int last_child( int index ); //!< index of last daughter | ||
| - | 155 | static int number_children( int index ); //!< number of children | ||
| - | 156 | static double px( int index ); //!< X momentum | ||
| - | 157 | static double py( int index ); //!< Y momentum | ||
| - | 158 | static double pz( int index ); //!< Z momentum | ||
| - | 159 | static double e( int index ); //!< Energy | ||
| - | 160 | static double m( int index ); //!< generated mass | ||
| - | 161 | static double x( int index ); //!< X Production vertex | ||
| - | 162 | static double y( int index ); //!< Y Production vertex | ||
| - | 163 | static double z( int index ); //!< Z Production vertex | ||
| - | 164 | static double t( int index ); //!< production time | ||
| 158 | 165 | |||
| 159 | //////////////////// | 166 | //////////////////// | |
| 160 | // Set Methods // | 167 | // Set Methods // | |
| 161 | //////////////////// | 168 | //////////////////// | |
| - | 169 | |||
| - | 170 | /// set event number | ||
| 162 | static void set_event_number( int evtno ); | 171 | static void set_event_number( int evtno ); | |
| - | 172 | /// set number of entries in HEPEVT | ||
| 163 | static void set_number_entries( int noentries ); | 173 | static void set_number_entries( int noentries ); | |
| - | 174 | /// set particle status | ||
| 164 | static void set_status( int index, int status ); | 175 | static void set_status( int index, int status ); | |
| - | 176 | /// set particle ID | ||
| 165 | static void set_id( int index, int id ); | 177 | static void set_id( int index, int id ); | |
| - | 178 | /// define parents of a particle | ||
| 166 | static void set_parents( int index, int firstparent, int lastparent ); | 179 | static void set_parents( int index, int firstparent, int lastparent ); | |
| - | 180 | /// define children of a particle | ||
| 167 | static void set_children( int index, int firstchild, int lastchild ); | 181 | static void set_children( int index, int firstchild, int lastchild ); | |
| - | 182 | /// set particle momentum | ||
| 168 | static void set_momentum( int index, double px, double py, | 183 | static void set_momentum( int index, double px, double py, | |
| 169 | double pz, double e ); | 184 | double pz, double e ); | |
| - | 185 | /// set particle mass | ||
| 170 | static void set_mass( int index, double mass ); | 186 | static void set_mass( int index, double mass ); | |
| - | 187 | /// set particle production vertex | ||
| 171 | static void set_position( int index, double x, double y, double z, | 188 | static void set_position( int index, double x, double y, double z, | |
| 172 | double t ); | 189 | double t ); | |
| 173 | ////////////////////// | 190 | ////////////////////// | |
| 174 | // HEPEVT Floorplan // | 191 | // HEPEVT Floorplan // | |
| 175 | ////////////////////// | 192 | ////////////////////// | |
| 176 | static unsigned int sizeof_int(); | - | ||
| 177 | static unsigned int sizeof_real(); | - | ||
| 178 | static int max_number_entries(); | - | ||
| 179 | static void set_sizeof_int(unsigned int); | - | ||
| 180 | static void set_sizeof_real(unsigned int); | - | ||
| 181 | static void set_max_number_entries(unsigned int); | - | ||
| - | 193 | static unsigned int sizeof_int(); //!< size of integer in bytes | ||
| - | 194 | static unsigned int sizeof_real(); //!< size of real in bytes | ||
| - | 195 | static int max_number_entries(); //!< size of common block | ||
| - | 196 | static void set_sizeof_int(unsigned int); //!< define size of integer | ||
| - | 197 | static void set_sizeof_real(unsigned int); //!< define size of real | ||
| - | 198 | static void set_max_number_entries(unsigned int); //!< define size of common block | ||
| 182 | 199 | |||
| 183 | protected: | 200 | protected: | |
| - | 201 | /// navigate a byte array | ||
| 184 | static double byte_num_to_double( unsigned int ); | 202 | static double byte_num_to_double( unsigned int ); | |
| - | 203 | /// navigate a byte array | ||
| 185 | static int byte_num_to_int( unsigned int ); | 204 | static int byte_num_to_int( unsigned int ); | |
| - | 205 | /// pretend common block is an array of bytes | ||
| 186 | static void write_byte_num( double, unsigned int ); | 206 | static void write_byte_num( double, unsigned int ); | |
| - | 207 | /// pretend common block is an array of bytes | ||
| 187 | static void write_byte_num( int, unsigned int ); | 208 | static void write_byte_num( int, unsigned int ); | |
| - | 209 | /// print output legend | ||
| 188 | static void print_legend( std::ostream& ostr = std::cout ); | 210 | static void print_legend( std::ostream& ostr = std::cout ); | |
| 189 | 211 | |||
| 190 | private: | 212 | private: | |
| 191 | static unsigned int s_sizeof_int; | 213 | static unsigned int s_sizeof_int; | |
| 192 | static unsigned int s_sizeof_real; | 214 | static unsigned int s_sizeof_real; | |
