18 os<<
"--------------------------------"<<std::endl;
19 os<<
"--------- EVENT CONTENT --------"<<std::endl;
20 os<<
"--------------------------------"<<std::endl;
23 os<<
"Weights (" <<
event.weights().size() <<
"): "<<std::endl;
24 for (std::vector<double>::const_iterator w=event.
weights().begin(); w!=
event.weights().end(); ++w )
28 os<<
"Attributes:"<<std::endl;
31 for(
auto vt2: vt1.second ) {
32 os << vt2.first <<
": " << vt1.first << std::endl;
36 os<<
"GenParticlePtr ("<<
event.particles().size()<<
")"<<std::endl;
38 for( ConstGenParticlePtr p: event.
particles()) {
42 os<<
"GenVertexPtr ("<<
event.vertices().size()<<
")"<<std::endl;
43 for( ConstGenVertexPtr v: event.
vertices() ) {
47 os<<
"-----------------------------"<<std::endl;
53 std::ios_base::fmtflags orig = os.flags();
54 std::streamsize prec = os.precision();
57 os.precision( precision );
59 os <<
"________________________________________________________________________" << std::endl;
60 os <<
"GenEvent: #" <<
event.event_number() << std::endl;
63 os <<
" Entries in this event: " <<
event.vertices().size() <<
" vertices, "
64 <<
event.particles().size() <<
" particles, "
65 <<
event.weights().size() <<
" weights." << std::endl;
68 os <<
" Position offset: " << pos.
x() <<
", " << pos.
y() <<
", " << pos.
z() <<
", " << pos.
t() << std::endl;
71 os <<
" GenParticle Legend" << std::endl;
73 <<
"( px, py, pz, E )"
74 <<
" Stat ProdVtx" << std::endl;
75 os <<
"________________________________________________________________________" << std::endl;
78 for(ConstGenVertexPtr v: event.
vertices() ) {
85 os <<
"________________________________________________________________________" << std::endl;
91 std::ios_base::fmtflags orig = os.flags();
92 std::streamsize prec = os.precision();
95 os.precision( precision );
97 os <<
"________________________________________________________________________" << std::endl;
98 os <<
"GenRunInfo:" << std::endl;
102 for (
auto n: names) os<<n;
103 os<<
" )"<< std::endl;
105 os <<
" Tools: "<< std::endl;
107 for(
auto t: ri.
tools()) {
110 os<<
"Attributes:"<<std::endl;
113 if ( ! att.second->to_string(st) ) {
114 HEPMC3_WARNING (
"Print::listing: problem serializing attribute: "<< att.first )
116 else { os<<att.first<<
" "<<att.second->to_string(st);}
123 os <<
"________________________________________________________________________" << std::endl;
129 os << v->id() <<
" stat: ";
135 os <<
" (X,cT): " << pos.
x()<<
" "<<pos.
y()<<
" "<<pos.
z()<<
" "<<pos.
t();
137 else os <<
" (X,cT): 0";
141 bool printed_header =
false;
144 for(ConstGenParticlePtr p: v->particles_in() ) {
145 if( !printed_header ) {
147 printed_header =
true;
154 printed_header =
false;
157 for(ConstGenParticlePtr p: v->particles_out() ) {
158 if( !printed_header ) {
160 printed_header =
true;
173 os << p->pid() <<
" ";
175 os.setf(std::ios::scientific, std::ios::floatfield);
176 os.setf(std::ios_base::showpos);
181 os << momentum.
px() <<
",";
183 os << momentum.
py() <<
",";
185 os << momentum.
pz() <<
",";
187 os << momentum.
e() <<
" ";
188 os.setf(std::ios::fmtflags(0), std::ios::floatfield);
189 os.unsetf(std::ios_base::showpos);
193 ConstGenVertexPtr prod = p->production_vertex();
203 os <<
"GenEvent: #" <<
event.event_number();
209 os <<
"GenRunInfo: Number of tools:" << RunInfo.
tools().size();
218 void Print::line(std::ostream& os, ConstGenVertexPtr v,
bool attributes) {
219 os <<
"GenVertex: " << v->id() <<
" stat: ";
222 os <<
" in: " << v->particles_in().size();
224 os <<
" out: " << v->particles_out().size();
227 os <<
" has_set_position: ";
228 if( v->has_set_position() ) os <<
"true";
231 os <<
" (X,cT): " << pos.
x()<<
", "<<pos.
y()<<
", "<<pos.
z()<<
", "<<pos.
t();
232 if(attributes)
for (std::vector<std::string>::const_iterator s= v->attribute_names().begin(); s!= v->attribute_names().end(); ++s)
233 os<<
" "<<*s<<
"="<<v->attribute_as_string(*s);
239 os <<
"FourVector: ";
241 std::ios_base::fmtflags orig = os.flags();
242 os.setf(std::ios::scientific, std::ios::floatfield);
243 os.setf(std::ios_base::showpos);
244 std::streamsize prec = os.precision();
247 os <<
" (P,E)=" << p.
x()
257 void Print::line(std::ostream& os, ConstGenParticlePtr p,
bool attributes) {
259 os <<
"GenParticle: ";
261 os << p->id() <<
" PDGID: ";
266 std::ios_base::fmtflags orig = os.flags();
268 os.setf(std::ios::scientific, std::ios::floatfield);
269 os.setf(std::ios_base::showpos);
270 std::streamsize prec = os.precision();
277 os <<
" (P,E)=" << momentum.
px()
278 <<
"," << momentum.
py()
279 <<
"," << momentum.
pz()
280 <<
"," << momentum.
e();
286 ConstGenVertexPtr prod = p->production_vertex();
287 ConstGenVertexPtr end = p->end_vertex();
288 int prod_vtx_id = (prod) ? prod->id() : 0;
289 int end_vtx_id = (end) ? end->id() : 0;
291 os <<
" Stat: " << p->status()
292 <<
" PV: " << prod_vtx_id
293 <<
" EV: " << end_vtx_id
294 <<
" Attr: " << (*p).attribute_names().size();
298 std::vector<std::string> names =p->attribute_names();
300 os<<
" "<<ss<<
"="<<(*p).attribute_as_string(ss);
304 void Print::line(std::ostream& os, std::shared_ptr<GenCrossSection> &cs) {
305 os <<
" GenCrossSection: " << cs->xsec(0)
306 <<
" " << cs->xsec_err(0)
307 <<
" " << cs->get_accepted_events()
308 <<
" " << cs->get_attempted_events();
311 void Print::line(std::ostream& os, std::shared_ptr<GenHeavyIon> &hi) {
312 os <<
" GenHeavyIon: " << hi->Ncoll_hard
313 <<
" " << hi->Npart_proj
314 <<
" " << hi->Npart_targ
316 <<
" " << hi->spectator_neutrons
317 <<
" " << hi->spectator_protons
318 <<
" " << hi->N_Nwounded_collisions
319 <<
" " << hi->Nwounded_N_collisions
320 <<
" " << hi->Nwounded_Nwounded_collisions
321 <<
" " << hi->impact_parameter
322 <<
" " << hi->event_plane_angle
323 <<
" " << hi->eccentricity
324 <<
" " << hi->sigma_inel_NN;
327 void Print::line(std::ostream& os, std::shared_ptr<GenPdfInfo> &pi) {
328 os <<
" GenPdfInfo: " << pi->parton_id[0]
329 <<
" " << pi->parton_id[1]
335 <<
" " << pi->pdf_id[0]
336 <<
" " << pi->pdf_id[1];
const std::vector< ConstGenVertexPtr > & vertices() const
Get list of vertices (const)
#define HEPMC3_WARNING(MESSAGE)
Macro for printing HEPMC3_HEPMC3_WARNING messages.
double t() const
Time component of position/displacement.
std::vector< std::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
std::map< std::string, std::shared_ptr< Attribute > > attributes() const
Get a copy of the list of attributes.
static std::string name(MomentumUnit u)
Get name of momentum unit.
std::string attribute_as_string(const std::string &name) const
Get attribute of any type as string.
std::string attribute_as_string(const std::string &name, const int &id=0) const
Get attribute of any type as string.
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.
Definition of static class Print.
double y() const
y-component of position/displacement
std::vector< std::string > attribute_names(const int &id=0) const
Get list of attribute names.
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::map< std::string, std::map< int, std::shared_ptr< Attribute > > > attributes() const
Get a copy of the list of attributes.
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.