12 #include "HepMC/Print.h" 13 #include "HepMC/Attribute.h" 21 cout<<
"--------------------------------"<<endl;
22 cout<<
"--------- EVENT CONTENT --------"<<endl;
23 cout<<
"--------------------------------"<<endl;
26 cout<<
"Weights (" <<
event.weights().size() <<
"): "<<endl;
27 FOREACH(
const double w, event.
weights() ) {
31 cout<<
"Attributes:"<<endl;
33 typedef map< string, map<int, shared_ptr<Attribute> > >::value_type value_type1;
34 typedef map<int, shared_ptr<Attribute> >::value_type value_type2;
36 FOREACH(
const value_type1& vt1, event.
attributes() ) {
37 FOREACH(
const value_type2& vt2, vt1.second ) {
38 cout << vt2.first <<
": " << vt1.first << endl;
42 cout<<
"GenParticlePtr ("<<
event.particles().size()<<
")"<<endl;
49 cout<<
"GenVertexPtr ("<<
event.vertices().size()<<
")"<<endl;
54 cout<<
"-----------------------------"<<endl;
57 void Print::listing(
const GenEvent &event,
unsigned short precision ) {
60 ios_base::fmtflags orig = cout.flags();
61 streamsize prec = cout.precision();
64 cout.precision( precision );
66 cout <<
"________________________________________________________________________" << endl;
67 cout <<
"GenEvent: #" <<
event.event_number() << endl;
68 cout <<
" Momentum units: " << Units::name(event.
momentum_unit())
69 <<
" Position units: " << Units::name(event.
length_unit()) << endl;
70 cout <<
" Entries in this event: " <<
event.vertices().size() <<
" vertices, " 71 <<
event.particles().size() <<
" particles, " 72 <<
event.weights().size() <<
" weights." << endl;
75 cout <<
" Position offset: " << pos.
x() <<
", " << pos.
y() <<
", " << pos.
z() <<
", " << pos.
t() << endl;
78 cout <<
" GenParticle Legend" << endl;
80 <<
"( px, py, pz, E )" 81 <<
" Stat ProdVtx" << endl;
82 cout <<
"________________________________________________________________________" << endl;
92 cout <<
"________________________________________________________________________" << endl;
98 cout << v->id() <<
" stat: ";
104 cout <<
" (X,cT): " << pos.
x()<<
" "<<pos.
y()<<
" "<<pos.
z()<<
" "<<pos.
t();
106 else cout <<
" (X,cT): 0";
110 bool printed_header =
false;
114 if( !printed_header ) {
116 printed_header =
true;
123 printed_header =
false;
127 if( !printed_header ) {
129 printed_header =
true;
142 cout << p->pid() <<
" ";
144 cout.setf(ios::scientific, ios::floatfield);
145 cout.setf(ios_base::showpos);
150 cout << momentum.
px() <<
",";
152 cout << momentum.
py() <<
",";
154 cout << momentum.
pz() <<
",";
156 cout << momentum.
e() <<
" ";
157 cout.setf(ios::fmtflags(0), ios::floatfield);
158 cout.unsetf(ios_base::showpos);
173 cout <<
"GenVertex: " << v->id() <<
" stat: ";
176 cout <<
" in: " << v->particles_in().size();
178 cout <<
" out: " << v->particles_out().size();
181 cout <<
" has_set_position: ";
182 if( v->has_set_position() ) cout <<
"true";
183 else cout <<
"false";
185 cout <<
" (X,cT): " << pos.
x()<<
", "<<pos.
y()<<
", "<<pos.
z()<<
", "<<pos.
t() << endl;
190 cout <<
"GenParticle: ";
192 cout << p->id() <<
" PDGID: ";
197 ios_base::fmtflags orig = cout.flags();
199 cout.setf(ios::scientific, ios::floatfield);
200 cout.setf(ios_base::showpos);
201 streamsize prec = cout.precision();
208 cout <<
" (P,E)=" << momentum.
px()
209 <<
"," << momentum.
py()
210 <<
"," << momentum.
pz()
211 <<
"," << momentum.
e();
215 cout.precision(prec);
219 int prod_vtx_id = (prod) ? prod->id() : 0;
220 int end_vtx_id = (end) ? end->id() : 0;
222 cout <<
" Stat: " << p->status()
223 <<
" PV: " << prod_vtx_id
224 <<
" EV: " << end_vtx_id
228 void Print::line(shared_ptr<GenCrossSection> &cs) {
229 cout <<
" GenCrossSection: " << cs->cross_section
230 <<
" " << cs->cross_section_error
234 void Print::line(shared_ptr<GenHeavyIon> &hi) {
235 cout <<
" GenHeavyIon: " << hi->Ncoll_hard
236 <<
" " << hi->Npart_proj
237 <<
" " << hi->Npart_targ
239 <<
" " << hi->spectator_neutrons
240 <<
" " << hi->spectator_protons
241 <<
" " << hi->N_Nwounded_collisions
242 <<
" " << hi->Nwounded_N_collisions
243 <<
" " << hi->Nwounded_Nwounded_collisions
244 <<
" " << hi->impact_parameter
245 <<
" " << hi->event_plane_angle
246 <<
" " << hi->eccentricity
247 <<
" " << hi->sigma_inel_NN
251 void Print::line(shared_ptr<GenPdfInfo> &pi) {
252 cout <<
" GenPdfInfo: " << pi->parton_id[0]
253 <<
" " << pi->parton_id[1]
259 <<
" " << pi->pdf_id[0]
260 <<
" " << pi->pdf_id[1]
const std::vector< GenParticlePtr > & particles() const
Get list of particles (const)
double px() const
x-component of momentum
double y() const
y-component of position/displacement
const Units::MomentumUnit & momentum_unit() const
Get momentum unit.
static void listing(const GenEvent &event, unsigned short precision=2)
Print event in listing (HepMC2) format.
const std::map< string, std::map< int, shared_ptr< Attribute > > > & attributes() const
Get list of attributes.
static void line(const GenEvent &event)
Print one-line info.
Smart pointer for HepMC objects.
bool is_zero() const
Check if the length of this vertex is zero.
double x() const
x-component of position/displacement
Stores event-related information.
double t() const
Time component of position/displacement.
double py() const
y-component of momentum
double e() const
Energy component of momentum.
const std::vector< GenVertexPtr > & vertices() const
Get list of vertices (const)
double pz() const
z-component of momentum
Definition of template class SmartPointer.
const Units::LengthUnit & length_unit() const
Get length unit.
double z() const
z-component of position/displacement
const std::vector< double > & weights() const
Get event weight values as a vector.