19 os<<
"--------------------------------"<<endl;
20 os<<
"--------- EVENT CONTENT --------"<<endl;
21 os<<
"--------------------------------"<<endl;
24 os<<
"Weights (" <<
event.weights().size() <<
"): "<<endl;
25 for (std::vector<double>::const_iterator w=event.
weights().begin(); w!=
event.weights().end(); ++w )
29 os<<
"Attributes:"<<endl;
32 for(
auto vt2: vt1.second ) {
33 os << vt2.first <<
": " << vt1.first << endl;
37 os<<
"GenParticlePtr ("<<
event.particles().size()<<
")"<<endl;
39 for( ConstGenParticlePtr p: event.
particles()) {
43 os<<
"GenVertexPtr ("<<
event.vertices().size()<<
")"<<endl;
44 for( ConstGenVertexPtr v: event.
vertices() ) {
48 os<<
"-----------------------------"<<endl;
54 ios_base::fmtflags orig = os.flags();
55 streamsize prec = os.precision();
58 os.precision( precision );
60 os <<
"________________________________________________________________________" << endl;
61 os <<
"GenEvent: #" <<
event.event_number() << endl;
64 os <<
" Entries in this event: " <<
event.vertices().size() <<
" vertices, "
65 <<
event.particles().size() <<
" particles, "
66 <<
event.weights().size() <<
" weights." << endl;
69 os <<
" Position offset: " << pos.
x() <<
", " << pos.
y() <<
", " << pos.
z() <<
", " << pos.
t() << endl;
72 os <<
" GenParticle Legend" << endl;
74 <<
"( px, py, pz, E )"
75 <<
" Stat ProdVtx" << endl;
76 os <<
"________________________________________________________________________" << endl;
79 for(ConstGenVertexPtr v: event.
vertices() ) {
86 os <<
"________________________________________________________________________" << endl;
92 ios_base::fmtflags orig = os.flags();
93 streamsize prec = os.precision();
96 os.precision( precision );
98 os <<
"________________________________________________________________________" << endl;
99 os <<
"GenRunInfo:" << endl;
103 for (
auto n: names) os<<n;
106 os <<
" Tools: "<< endl;
108 for(
auto t: ri.
tools()) {
111 os<<
"Attributes:"<<endl;
114 if ( ! att.second->to_string(st) ) {
115 HEPMC3_WARNING (
"Print::listing: problem serializing attribute: "<< att.first )
117 else { os<<att.first<<
" "<<att.second->to_string(st);}
124 os <<
"________________________________________________________________________" << endl;
130 os << v->id() <<
" stat: ";
136 os <<
" (X,cT): " << pos.
x()<<
" "<<pos.
y()<<
" "<<pos.
z()<<
" "<<pos.
t();
138 else os <<
" (X,cT): 0";
142 bool printed_header =
false;
145 for(ConstGenParticlePtr p: v->particles_in() ) {
146 if( !printed_header ) {
148 printed_header =
true;
155 printed_header =
false;
158 for(ConstGenParticlePtr p: v->particles_out() ) {
159 if( !printed_header ) {
161 printed_header =
true;
174 os << p->pid() <<
" ";
176 os.setf(ios::scientific, ios::floatfield);
177 os.setf(ios_base::showpos);
182 os << momentum.
px() <<
",";
184 os << momentum.
py() <<
",";
186 os << momentum.
pz() <<
",";
188 os << momentum.
e() <<
" ";
189 os.setf(ios::fmtflags(0), ios::floatfield);
190 os.unsetf(ios_base::showpos);
194 ConstGenVertexPtr prod = p->production_vertex();
204 os <<
"GenEvent: #" <<
event.event_number();
205 if(attributes)
for (std::vector<std::string>::const_iterator s=event.
attribute_names().begin(); s!=
event.attribute_names().end(); ++s)
210 os <<
"GenRunInfo: Number of tools:" << RunInfo.
tools().size();
219 void Print::line(std::ostream& os, ConstGenVertexPtr v,
bool attributes) {
220 os <<
"GenVertex: " << v->id() <<
" stat: ";
223 os <<
" in: " << v->particles_in().size();
225 os <<
" out: " << v->particles_out().size();
228 os <<
" has_set_position: ";
229 if( v->has_set_position() ) os <<
"true";
232 os <<
" (X,cT): " << pos.
x()<<
", "<<pos.
y()<<
", "<<pos.
z()<<
", "<<pos.
t();
233 if(attributes)
for (std::vector<std::string>::const_iterator s= v->attribute_names().begin(); s!= v->attribute_names().end(); ++s)
234 os<<
" "<<*s<<
"="<<v->attribute_as_string(*s);
240 os <<
"FourVector: ";
242 ios_base::fmtflags orig = os.flags();
243 os.setf(ios::scientific, ios::floatfield);
244 os.setf(ios_base::showpos);
245 streamsize prec = os.precision();
248 os <<
" (P,E)=" << p.
x()
258 void Print::line(std::ostream& os, ConstGenParticlePtr p,
bool attributes) {
260 os <<
"GenParticle: ";
262 os << p->id() <<
" PDGID: ";
267 ios_base::fmtflags orig = os.flags();
269 os.setf(ios::scientific, ios::floatfield);
270 os.setf(ios_base::showpos);
271 streamsize prec = os.precision();
278 os <<
" (P,E)=" << momentum.
px()
279 <<
"," << momentum.
py()
280 <<
"," << momentum.
pz()
281 <<
"," << momentum.
e();
287 ConstGenVertexPtr prod = p->production_vertex();
288 ConstGenVertexPtr end = p->end_vertex();
289 int prod_vtx_id = (prod) ? prod->id() : 0;
290 int end_vtx_id = (end) ? end->id() : 0;
292 os <<
" Stat: " << p->status()
293 <<
" PV: " << prod_vtx_id
294 <<
" EV: " << end_vtx_id
295 <<
" Attr: " << (*p).attribute_names().size();
299 std::vector<std::string> names =p->attribute_names();
301 os<<
" "<<ss<<
"="<<(*p).attribute_as_string(ss);
305 void Print::line(std::ostream& os, shared_ptr<GenCrossSection> &cs) {
306 os <<
" GenCrossSection: " << cs->xsec(0)
307 <<
" " << cs->xsec_err(0)
308 <<
" " << cs->get_accepted_events()
309 <<
" " << cs->get_attempted_events();
313 os <<
" GenHeavyIon: " << hi->Ncoll_hard
314 <<
" " << hi->Npart_proj
315 <<
" " << hi->Npart_targ
317 <<
" " << hi->spectator_neutrons
318 <<
" " << hi->spectator_protons
319 <<
" " << hi->N_Nwounded_collisions
320 <<
" " << hi->Nwounded_N_collisions
321 <<
" " << hi->Nwounded_Nwounded_collisions
322 <<
" " << hi->impact_parameter
323 <<
" " << hi->event_plane_angle
324 <<
" " << hi->eccentricity
325 <<
" " << hi->sigma_inel_NN;
329 os <<
" GenPdfInfo: " << pi->parton_id[0]
330 <<
" " << pi->parton_id[1]
336 <<
" " << pi->pdf_id[0]
337 <<
" " << pi->pdf_id[1];
const std::vector< ConstGenVertexPtr > & vertices() const
Get list of vertices (const)
string attribute_as_string(const string &name) const
Get attribute of any type as string.
#define HEPMC3_WARNING(MESSAGE)
Macro for printing HEPMC3_HEPMC3_WARNING messages.
double t() const
Time component of position/displacement.
std::vector< string > attribute_names() const
Get list of attribute names.
Stores run-related information.
bool is_zero() const
Check if the length of this vertex is zero.
const Units::LengthUnit & length_unit() const
Get length unit.
const std::vector< std::string > & weight_names() const
Get the vector of weight names.
const std::vector< ToolInfo > & tools() const
The vector of tools used to produce this run.
static void listing(std::ostream &os, const GenEvent &event, unsigned short precision=2)
Print event in listing (HepMC2) format.
double z() const
z-component of position/displacement
double x() const
x-component of position/displacement
static std::string name(MomentumUnit u)
Get name of momentum unit.
const Units::MomentumUnit & momentum_unit() const
Get momentum unit.
double e() const
Energy component of momentum.
Stores event-related information.
double px() const
x-component of momentum
static void line(std::ostream &os, const GenEvent &event, bool attributes=false)
Print one-line info.
string attribute_as_string(const string &name, const int &id=0) const
Get attribute of any type as string.
std::map< std::string, shared_ptr< Attribute > > attributes() const
Get a copy of the list of attributes.
std::map< string, std::map< int, shared_ptr< Attribute > > > attributes() const
Get a copy of the list of attributes.
Definition of static class Print.
double y() const
y-component of position/displacement
const std::vector< double > & weights() const
Get event weight values as a vector.
double pz() const
z-component of momentum
double py() const
y-component of momentum
std::vector< string > attribute_names(const int &id=0) const
Get list of attribute names.
Definition of class Attribute, class IntAttribute and class StringAttribute.
const std::vector< ConstGenParticlePtr > & particles() const
Get list of particles (const)
static void content(std::ostream &os, const GenEvent &event)
Print content of all GenEvent containers.