9 #include "HepMC/HEPEVT_Wrapper.h"
17 unsigned int HEPEVT_Wrapper::s_sizeof_int = 4;
19 unsigned int HEPEVT_Wrapper::s_sizeof_real =
sizeof(double);
21 unsigned int HEPEVT_Wrapper::s_max_number_entries = 4000;
30 ostr <<
"________________________________________"
31 <<
"________________________________________" << std::endl;
32 ostr <<
"***** HEPEVT Common Event#: "
37 ostr <<
" Double Precision" << std::endl;
39 ostr <<
" Single Precision" << std::endl;
42 <<
sizeof_real() <<
"-byte floating point numbers, "
46 ostr <<
"________________________________________"
47 <<
"________________________________________" << std::endl;
51 ostr <<
"________________________________________"
52 <<
"________________________________________" << std::endl;
58 sprintf( outline,
"%4s %4s %4s %5s %10s, %9s, %9s, %9s, %10s",
59 "Indx",
"Stat",
"Par-",
"chil-",
60 "( P_x",
"P_y",
"P_z",
"Energy",
"M ) ");
61 ostr << outline << std::endl;
62 sprintf( outline,
"%9s %4s %4s %10s, %9s, %9s, %9s) %9s",
64 "Prod ( X",
"Y",
"Z",
"cT",
"[mm]");
65 ostr << outline << std::endl;
76 "%4d %+4d %4d %4d (%9.3g, %9.3g, %9.3g, %9.3g, %9.3g)"
79 ostr << outline <<
"\n";
80 sprintf( outline,
"%+9d %4d %4d (%9.3g, %9.3g, %9.3g, %9.3g)",
83 x(i),
y(i),
z(i),
t(i) );
84 ostr << outline << std::endl;
92 bool isConsistent=
true;
95 "\n\n\t**** WARNINGInconsistent HEPEVT input, Event %10d ****"
103 if ( isConsistent ) {
104 os << header << std::endl;
105 isConsistent =
false;
108 os <<
"Inconsistent entry " << i
109 <<
" first parent > last parent " << std::endl;
112 for (
int m = moth1;
m<=moth2 &&
m!=0; ++
m ) {
114 if ( isConsistent ) {
115 os << header << std::endl;
116 isConsistent =
false;
119 os <<
"Inconsistent entry " << i
120 <<
" mother points out of range " << std::endl;
126 if ( mChild1==0 && mChild2==0 )
continue;
127 if ( i<mChild1 || i>mChild2 ) {
128 if ( isConsistent ) {
129 os << header << std::endl;
130 isConsistent =
false;
133 os <<
"Inconsistent mother-daughter relationship between "
135 <<
" (try !trust_mother)" << std::endl;
144 if ( isConsistent ) {
145 os << header << std::endl;
146 isConsistent =
false;
149 os <<
"Inconsistent entry " << i
150 <<
" first child > last child " << std::endl;
153 for (
int d = dau1; d<=dau2 && d!=0; ++d ) {
155 if ( isConsistent ) {
156 os << header << std::endl;
157 isConsistent =
false;
160 os <<
"Inconsistent entry " << i
161 <<
" child points out of range " << std::endl;
167 if ( d_moth1==0 && d_moth2==0 )
continue;
168 if ( i<d_moth1 || i>d_moth2 ) {
169 if ( isConsistent ) {
170 os << header << std::endl;
171 isConsistent =
false;
174 os <<
"Inconsistent mother-daughter relationship between "
176 <<
" (try trust_mothers)"<< std::endl;
183 os <<
"Above lists all the inconsistencies in the HEPEVT common "
184 <<
"\n block which has been provided as input to HepMC. "
185 <<
"\n HepMC WILL have trouble interpreting the mother-daughter"
186 <<
"\n relationships ... but all other information "
187 <<
"\n (4-vectors etc) will be correctly transferred."
188 <<
"\n In order for HepMC to be able to interpret the mother/"
189 <<
"\n daughter hierachy, it MUST be given consistent input."
190 <<
"\n This is one of the design criteria of HepMC: "
191 <<
"\n consistency is enforced by the code.";
192 os <<
"\nThere is a switch in IO_HEPEVT, set-able using "
193 <<
"\n IO_HEPEVT::set_trust_mothers_before_daughters( bool )"
194 <<
"\n which you may want to try.";
195 os <<
"\nNote: if HEPEVT common block has been filled by pythia"
196 <<
"\n pyhepc, then the switch MSTP(128)=2 should be used in"
197 <<
"\n pythia, which instructs pythia not to put multiple "
198 <<
"\n copies of resonances in the event record.\n";
199 os <<
"To obtain a file summarizing the inconsistency, you should:"
200 <<
"\n\t ofstream myFile(\"myInconsistentEvent.txt\"); "
201 <<
"\n\t HEPEVT_Wrapper::check_hepevt_consistency(myFile); "
202 <<
"\n\t HEPEVT_Wrapper::print_hepevt(myFile); "
203 <<
"\n[now write the event to HepMC using something like"
204 <<
"\n\t\t myIO_HEPEVT->write_event(myEvent); ]"
205 <<
"\n\t myEvent->print( myFile ); "
206 <<
" // print event as HepMC sees it"
207 <<
"\n ------------------------- Thank-you. \n\n" << std::endl;
static void set_children(int index, int firstchild, int lastchild)
define children of a particle
static double y(int index)
Y Production vertex.
static void set_mass(int index, double mass)
set particle mass
static double z(int index)
Z Production vertex.
static int status(int index)
status code
static void set_number_entries(int noentries)
set number of entries in HEPEVT
static int first_parent(int index)
index of 1st mother
static void print_hepevt(std::ostream &ostr=std::cout)
write information from HEPEVT common block
static double x(int index)
X Production vertex.
static int event_number()
event number
static void set_momentum(int index, double px, double py, double pz, double e)
set particle momentum
static void print_hepevt_particle(int index, std::ostream &ostr=std::cout)
write particle information to ostr
static double e(int index)
Energy.
static unsigned int sizeof_int()
size of integer in bytes
static int last_parent(int index)
index of last mother
static void print_legend(std::ostream &ostr=std::cout)
print output legend
static unsigned int sizeof_real()
size of real in bytes
static double px(int index)
X momentum.
static bool check_hepevt_consistency(std::ostream &ostr=std::cout)
check for problems with HEPEVT common block
static double t(int index)
production time
static int last_child(int index)
index of last daughter
static void set_parents(int index, int firstparent, int lastparent)
define parents of a particle
static void set_status(int index, int status)
set particle status
static int number_entries()
num entries in current evt
static int first_child(int index)
index of 1st daughter
static double py(int index)
Y momentum.
static double pz(int index)
Z momentum.
static void set_event_number(int evtno)
set event number
static bool is_double_precision()
True if common block uses double.
static void zero_everything()
set all entries in HEPEVT to zero
static int max_number_entries()
size of common block
static void set_id(int index, int id)
set particle ID
static double m(int index)
generated mass
static void set_position(int index, double x, double y, double z, double t)
set particle production vertex