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 os << v->id() <<
" stat: ";
98 os <<
" (X,cT): " << pos.
x()<<
" "<<pos.
y()<<
" "<<pos.
z()<<
" "<<pos.
t();
100 else os <<
" (X,cT): 0";
104 bool printed_header =
false;
107 for(ConstGenParticlePtr p: v->particles_in() ) {
108 if( !printed_header ) {
110 printed_header =
true;
117 printed_header =
false;
120 for(ConstGenParticlePtr p: v->particles_out() ) {
121 if( !printed_header ) {
123 printed_header =
true;
136 os << p->pid() <<
" ";
138 os.setf(ios::scientific, ios::floatfield);
139 os.setf(ios_base::showpos);
144 os << momentum.
px() <<
",";
146 os << momentum.
py() <<
",";
148 os << momentum.
pz() <<
",";
150 os << momentum.
e() <<
" ";
151 os.setf(ios::fmtflags(0), ios::floatfield);
152 os.unsetf(ios_base::showpos);
156 ConstGenVertexPtr prod = p->production_vertex();
166 os <<
"GenEvent: #" <<
event.event_number();
167 if(attributes)
for (std::vector<std::string>::const_iterator s=event.
attribute_names().begin();s!=
event.attribute_names().end();++s)
171 void Print::line(std::ostream& os, ConstGenVertexPtr v,
bool attributes) {
172 os <<
"GenVertex: " << v->id() <<
" stat: ";
175 os <<
" in: " << v->particles_in().size();
177 os <<
" out: " << v->particles_out().size();
180 os <<
" has_set_position: ";
181 if( v->has_set_position() ) os <<
"true";
184 os <<
" (X,cT): " << pos.
x()<<
", "<<pos.
y()<<
", "<<pos.
z()<<
", "<<pos.
t();
185 if(attributes)
for (std::vector<std::string>::const_iterator s= v->attribute_names().begin();s!= v->attribute_names().end();++s)
186 os<<
" "<<*s<<
"="<<v->attribute_as_string(*s);
190 void Print::line(std::ostream& os, ConstGenParticlePtr p,
bool attributes) {
192 os <<
"GenParticle: ";
194 os << p->id() <<
" PDGID: ";
199 ios_base::fmtflags orig = os.flags();
201 os.setf(ios::scientific, ios::floatfield);
202 os.setf(ios_base::showpos);
203 streamsize prec = os.precision();
210 os <<
" (P,E)=" << momentum.
px()
211 <<
"," << momentum.
py()
212 <<
"," << momentum.
pz()
213 <<
"," << momentum.
e();
219 ConstGenVertexPtr prod = p->production_vertex();
220 ConstGenVertexPtr end = p->end_vertex();
221 int prod_vtx_id = (prod) ? prod->id() : 0;
222 int end_vtx_id = (end) ? end->id() : 0;
224 os <<
" Stat: " << p->status()
225 <<
" PV: " << prod_vtx_id
226 <<
" EV: " << end_vtx_id
227 <<
" Attr: " << (*p).attribute_names().size();
231 std::vector<std::string> names =p->attribute_names();
233 os<<
" "<<ss<<
"="<<(*p).attribute_as_string(ss);
237 void Print::line(std::ostream& os, shared_ptr<GenCrossSection> &cs) {
238 os <<
" GenCrossSection: " << cs->xsec(0)
239 <<
" " << cs->xsec_err(0)
240 <<
" " << cs->get_accepted_events()
241 <<
" " << cs->get_attempted_events();
245 os <<
" GenHeavyIon: " << hi->Ncoll_hard
246 <<
" " << hi->Npart_proj
247 <<
" " << hi->Npart_targ
249 <<
" " << hi->spectator_neutrons
250 <<
" " << hi->spectator_protons
251 <<
" " << hi->N_Nwounded_collisions
252 <<
" " << hi->Nwounded_N_collisions
253 <<
" " << hi->Nwounded_Nwounded_collisions
254 <<
" " << hi->impact_parameter
255 <<
" " << hi->event_plane_angle
256 <<
" " << hi->eccentricity
257 <<
" " << hi->sigma_inel_NN;
261 os <<
" GenPdfInfo: " << pi->parton_id[0]
262 <<
" " << pi->parton_id[1]
268 <<
" " << pi->pdf_id[0]
269 <<
" " << pi->pdf_id[1];
const Units::MomentumUnit & momentum_unit() const
Get momentum unit.
const Units::LengthUnit & length_unit() const
Get length unit.
double pz() const
z-component of momentum
const std::vector< ConstGenVertexPtr > & vertices() const
Get list of vertices (const)
std::vector< string > attribute_names(const int &id=0) const
Get list of attribute names.
static void listing(std::ostream &os, const GenEvent &event, unsigned short precision=2)
Print event in listing (HepMC2) format.
static std::string name(MomentumUnit u)
Get name of momentum unit.
bool is_zero() const
Check if the length of this vertex is zero.
double x() const
x-component of position/displacement
const std::vector< double > & weights() const
Get event weight values as a vector.
Stores event-related information.
std::map< string, std::map< int, shared_ptr< Attribute > > > attributes() const
Get a copy of the list of attributes.
string attribute_as_string(const string &name, const int &id=0) const
Get attribute of any type as string.
double y() const
y-component of position/displacement
double t() const
Time component of position/displacement.
const std::vector< ConstGenParticlePtr > & particles() const
Get list of particles (const)
double py() const
y-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 e() const
Energy component of momentum.
Definition of class Attribute, class IntAttribute and class StringAttribute.
double px() const
x-component of momentum
static void content(std::ostream &os, const GenEvent &event)
Print content of all GenEvent containers.
double z() const
z-component of position/displacement