HepMC3 event record library
|
Go to the documentation of this file.
6 #ifndef HEPMC3_HEPEVT_WRAPPER_H
7 #define HEPMC3_HEPEVT_WRAPPER_H
24 #ifndef HEPMC3_HEPEVT_NMXHEP
26 #define HEPMC3_HEPEVT_NMXHEP 10000
29 #ifndef HEPMC3_HEPEVT_PRECISION
31 #define HEPMC3_HEPEVT_PRECISION double
71 #ifndef HEPEVT_WRAPPER_HEADER_ONLY
78 #ifndef NO_DECLSPEC_hepevtptr
81 #define DECLSPEC_hepevtptr __declspec(dllexport)
83 #define DECLSPEC_hepevtptr __declspec(dllimport)
86 #define NO_DECLSPEC_hepevtptr
90 #ifdef NO_DECLSPEC_hepevtptr
91 extern struct HEPEVT* hepevtptr;
93 DECLSPEC_hepevtptr
extern struct HEPEVT* hepevtptr;
104 static void print_hepevt( std::ostream& ostr = std::cout );
115 #ifndef HEPEVT_WRAPPER_HEADER_ONLY
127 static void set_hepevt_address(
char *c) { hepevtptr=(
struct HEPEVT*)c; }
128 static int max_number_entries() {
return NMXHEP; }
129 static int event_number() {
return hepevtptr->
nevhep; }
130 static int number_entries() {
return hepevtptr->
nhep; }
131 static int status(
const int& index ) {
return hepevtptr->
isthep[index-1]; }
132 static int id(
const int& index ) {
return hepevtptr->
idhep[index-1]; }
133 static int first_parent(
const int& index ) {
return hepevtptr->
jmohep[index-1][0]; }
134 static int last_parent(
const int& index ) {
return hepevtptr->
jmohep[index-1][1]; }
135 static int first_child(
const int& index ) {
return hepevtptr->
jdahep[index-1][0]; }
136 static int last_child(
const int& index ) {
return hepevtptr->
jdahep[index-1][1]; }
137 static double px(
const int& index ) {
return hepevtptr->
phep[index-1][0]; }
138 static double py(
const int& index ) {
return hepevtptr->
phep[index-1][1]; }
139 static double pz(
const int& index ) {
return hepevtptr->
phep[index-1][2]; }
140 static double e(
const int& index ) {
return hepevtptr->
phep[index-1][3]; }
141 static double m(
const int& index ) {
return hepevtptr->
phep[index-1][4]; }
142 static double x(
const int& index ) {
return hepevtptr->
vhep[index-1][0]; }
143 static double y(
const int& index ) {
return hepevtptr->
vhep[index-1][1]; }
144 static double z(
const int& index ) {
return hepevtptr->
vhep[index-1][2]; }
145 static double t(
const int& index ) {
return hepevtptr->
vhep[index-1][3]; }
150 static void set_event_number(
const int& evtno ) { hepevtptr->
nevhep = evtno; }
151 static void set_number_entries(
const int& noentries ) { hepevtptr->
nhep = noentries; }
152 static void set_status(
const int& index,
const int& status ) { hepevtptr->
isthep[index-1] = status; }
153 static void set_id(
const int& index,
const int&
id ) { hepevtptr->
idhep[index-1] = id; }
154 static void set_parents(
const int& index,
const int& firstparent,
const int& lastparent );
155 static void set_children(
const int& index,
const int& firstchild,
const int& lastchild );
156 static void set_momentum(
const int& index,
const double& px,
const double& py,
const double& pz,
const double& e );
157 static void set_mass(
const int& index,
double mass );
158 static void set_position(
const int& index,
const double& x,
const double& y,
const double& z,
const double& t );
166 ostr <<
" Event No.: " << hepevtptr->
nevhep << std::endl;
167 ostr<<
" Nr Type Parent(s) Daughter(s) Px Py Pz E Inv. M." << std::endl;
168 for(
int i=1; i<=hepevtptr->
nhep; ++i )
178 sprintf(buf,
"%5i %6i",index,hepevtptr->
idhep[index-1]);
180 sprintf(buf,
"%4i - %4i ",hepevtptr->
jmohep[index-1][0],hepevtptr->
jmohep[index-1][1]);
182 sprintf(buf,
"%4i - %4i ",hepevtptr->
jdahep[index-1][0],hepevtptr->
jdahep[index-1][1]);
185 sprintf(buf,
"%8.2f %8.2f %8.2f %8.2f %8.2f",hepevtptr->
phep[index-1][0],hepevtptr->
phep[index-1][1],hepevtptr->
phep[index-1][2],hepevtptr->
phep[index-1][3],hepevtptr->
phep[index-1][4]);
186 ostr << buf << std::endl;
201 memset(hepevtptr,0,
sizeof(
struct HEPEVT));
206 return (hepevtptr->
jmohep[index-1][0]) ? (hepevtptr->
jmohep[index-1][1]) ? hepevtptr->
jmohep[index-1][1]-hepevtptr->
jmohep[index-1][0] : 1 : 0;
211 return (hepevtptr->
jdahep[index-1][0]) ? (hepevtptr->
jdahep[index-1][1]) ? hepevtptr->
jdahep[index-1][1]-hepevtptr->
jdahep[index-1][0] : 1 : 0;
217 for(
int i=1; i<=hepevtptr->
nhep; ++i )
218 if (((hepevtptr->
jmohep[i-1][0]<=index&&hepevtptr->
jmohep[i-1][1]>=index))||(hepevtptr->
jmohep[i-1][0]==index)||(hepevtptr->
jmohep[i-1][1]==index)) nc++;
226 hepevtptr->
jmohep[index-1][0] = firstparent;
227 hepevtptr->
jmohep[index-1][1] = lastparent;
232 hepevtptr->
jdahep[index-1][0] = firstchild;
233 hepevtptr->
jdahep[index-1][1] = lastchild;
238 hepevtptr->
phep[index-1][0] = px;
239 hepevtptr->
phep[index-1][1] = py;
240 hepevtptr->
phep[index-1][2] = pz;
241 hepevtptr->
phep[index-1][3] = e;
246 hepevtptr->
phep[index-1][4] = mass;
251 hepevtptr->
vhep[index-1][0] = x;
252 hepevtptr->
vhep[index-1][1] = y;
253 hepevtptr->
vhep[index-1][2] = z;
254 hepevtptr->
vhep[index-1][3] = t;
267 for(
int i=1; i<=HEPEVT_Wrapper::number_entries(); i++ )
268 for(
int k=1; k<=HEPEVT_Wrapper::number_entries(); k++ )
if (i!=k)
269 if ((HEPEVT_Wrapper::first_parent(k)<=i)&&(i<=HEPEVT_Wrapper::last_parent(k)))
270 HEPEVT_Wrapper::set_children(i,(HEPEVT_Wrapper::first_child(i)==0?k:std::min(HEPEVT_Wrapper::first_child(i),k)),(HEPEVT_Wrapper::last_child(i)==0?k:std::max(HEPEVT_Wrapper::last_child(i),k)));
272 for(
int i=1; i<=HEPEVT_Wrapper::number_entries(); i++ )
#define HEPMC3_HEPEVT_PRECISION
HEPMC3_HEPEVT_PRECISION momentum_t
Precision of the 4-momentum, time-space position and mass.
Definition of class GenEvent.
static bool fix_daughters()
Tries to fix list of daughters.
static void print_hepevt_particle(int index, std::ostream &ostr=std::cout)
Print particle information.
int nhep
Number of entries in the event.
Stores event-related information.
An interface to HEPEVT common block.
static void set_mass(const int &index, double mass)
Set mass.
static void set_children(const int &index, const int &firstchild, const int &lastchild)
Set children.
static void set_momentum(const int &index, const double &px, const double &py, const double &pz, const double &e)
Set 4-momentum.
static int number_children_exact(const int &index)
Get number of children by counting.
C structure representing Fortran common block HEPEVT T. Sjöstrand et al., "A proposed standard event...
static int number_parents(const int &index)
Get number of parents.
#define HEPMC3_HEPEVT_NMXHEP
static void set_position(const int &index, const double &x, const double &y, const double &z, const double &t)
Set position in time-space.
static const int NMXHEP
Number of particles in the HEPEVT structure.
momentum_t vhep[NMXHEP][4]
Time-space position: x, y, z, t.
static void set_parents(const int &index, const int &firstparent, const int &lastparent)
Set parents.
int jmohep[NMXHEP][2]
Pointer to position of 1st and 2nd (or last!) mother.
static void zero_everything()
Check for problems with HEPEVT common block.
int jdahep[NMXHEP][2]
Pointer to position of 1nd and 2nd (or last!) daughter.
momentum_t phep[NMXHEP][5]
Momentum: px, py, pz, e, m.
static void print_hepevt(std::ostream &ostr=std::cout)
Print information from HEPEVT common block.
static int number_children(const int &index)
Get number of children from the range of daughters.
int isthep[NMXHEP]
Status code.
static bool GenEvent_to_HEPEVT(const GenEvent *evt)
Convert GenEvent to HEPEVT.
static bool HEPEVT_to_GenEvent(GenEvent *evt)
Convert HEPEVT to GenEvent.