18    os << 
"--------------------------------" << std::endl;
 
   19    os << 
"--------- EVENT CONTENT --------" << std::endl;
 
   20    os << 
"--------------------------------" << std::endl;
 
   23    os << 
"Weights (" << 
event.weights().size() << 
"): " << std::endl;
 
   24    for (
const auto& w: event.
weights()) {
 
   28    os << 
"Attributes:" << std::endl;
 
   31        for (
const auto& vt2: vt1.second) {
 
   32            os << vt2.first << 
": " << vt1.first << std::endl;
 
   36    os << 
"GenParticlePtr (" << 
event.particles().size() << 
")" << std::endl;
 
   38    for (
const ConstGenParticlePtr& p: event.
particles()) {
 
   43    os << 
"GenVertexPtr (" << 
event.vertices().size() << 
")" << std::endl;
 
   44    for ( 
const ConstGenVertexPtr& v: event.
vertices() ) {
 
   49    os << 
"-----------------------------" << std::endl;
 
 
   54    std::ios_base::fmtflags orig = os.flags();
 
   55    std::streamsize         prec = os.precision();
 
   58    os.precision(precision);
 
   60    os << 
"________________________________________________________________________" << std::endl;
 
   61    os << 
"GenEvent: #" << 
event.event_number() << std::endl;
 
   64    os << 
" Entries in this event: " << 
event.vertices().size() << 
" vertices, " 
   65       << 
event.particles().size() << 
" particles, " 
   66       << 
event.weights().size()   << 
" weights." << std::endl;
 
   69    os << 
" Position offset: " << pos.
x() << 
", " << pos.
y() << 
", " << pos.
z() << 
", " << pos.
t() << std::endl;
 
   72    os << 
"                                    GenParticle Legend" << std::endl;
 
   74       << 
"( px,       py,       pz,     E )" 
   75       << 
"   Stat ProdVtx" << std::endl;
 
   76    os << 
"________________________________________________________________________" << std::endl;
 
   79    for (
const ConstGenVertexPtr& v: event.
vertices()) {
 
   86    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 (
const auto& n: names) os << n;
 
  103    os << 
" )" << std::endl;
 
  105    os << 
" Tools: " << std::endl;
 
  107    for (
const 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 << 
" " << st;}
 
  123    os << 
"________________________________________________________________________" << std::endl;
 
 
  127    if (!v) { os << 
"Vtx: Empty vertex" << std::endl; 
return;}
 
  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 (
const ConstGenParticlePtr& p: v->particles_in()) {
 
  146        if ( !printed_header ) {
 
  148            printed_header = 
true;
 
  155    printed_header = 
false;
 
  158    for (
const ConstGenParticlePtr& p: v->particles_out()) {
 
  159        if ( !printed_header ) {
 
  161            printed_header = 
true;
 
 
  170    if (!p) { os << 
" Empty particle" << std::endl; 
return;}
 
  175    os << p->pid() << 
" ";
 
  177    os.setf(std::ios::scientific, std::ios::floatfield);
 
  178    os.setf(std::ios_base::showpos);
 
  183    os << momentum.
px() << 
",";
 
  185    os << momentum.
py() << 
",";
 
  187    os << momentum.
pz() << 
",";
 
  189    os << momentum.
e() << 
" ";
 
  190    os.setf(std::ios::fmtflags(0), std::ios::floatfield);
 
  191    os.unsetf(std::ios_base::showpos);
 
  195    ConstGenVertexPtr prod = p->production_vertex();
 
 
  205    os << 
"GenEvent: #" << 
event.event_number();
 
  208            os << 
" " << s << 
"=" <<
event.attribute_as_string(s);
 
 
  214    os <<
"GenRunInfo: Number of tools:" << RunInfo.
tools().size();
 
 
  227void Print::line(std::ostream& os, ConstGenVertexPtr v, 
bool attributes) {
 
  228    if (!v) { os << 
"GenVertex: Empty" << std::endl; 
return;}
 
  229    os << 
"GenVertex:  " << v->id() << 
" stat: ";
 
  232    os << 
" in: "  << v->particles_in().size();
 
  234    os << 
" out: " << v->particles_out().size();
 
  237    os << 
" has_set_position: ";
 
  238    if ( v->has_set_position() ) { os << 
"true"; }
 
  239    else  { os << 
"false"; }
 
  241    os << 
" (X,cT): " << pos.
x() << 
", " <<pos.
y() << 
", " << pos.
z() << 
", " << pos.
t();
 
  244        std::vector<std::string> names     = v->attribute_names();
 
  245        for (
const auto& ss: names) {
 
  246            os << 
" " << ss << 
"=" << (*v).attribute_as_string(ss);
 
 
  252    os << 
"FourVector: ";
 
  254    std::ios_base::fmtflags orig = os.flags();
 
  255    os.setf(std::ios::scientific, std::ios::floatfield);
 
  256    os.setf(std::ios_base::showpos);
 
  257    std::streamsize prec = os.precision();
 
  260    os << 
" (P,E)=" << p.
x()
 
 
  270void Print::line(std::ostream& os, ConstGenParticlePtr p, 
bool attributes) {
 
  271    if (!p) { os << 
"GenParticle: Empty" << std::endl; 
return;}
 
  272    os << 
"GenParticle: ";
 
  274    os << p->id() <<
" PDGID: ";
 
  279    std::ios_base::fmtflags orig = os.flags();
 
  281    os.setf(std::ios::scientific, std::ios::floatfield);
 
  282    os.setf(std::ios_base::showpos);
 
  283    std::streamsize prec = os.precision();
 
  290    os << 
" (P,E)=" << momentum.
px()
 
  291       << 
"," << momentum.
py()
 
  292       << 
"," << momentum.
pz()
 
  293       << 
"," << momentum.
e();
 
  299    const ConstGenVertexPtr prod = p->production_vertex();
 
  300    const ConstGenVertexPtr end  = p->end_vertex();
 
  301    int prod_vtx_id   = (prod) ? prod->id() : 0;
 
  302    int end_vtx_id    = (end)  ? end->id()  : 0;
 
  304    os << 
" Stat: " << p->status()
 
  305       << 
" PV: " << prod_vtx_id
 
  306       << 
" EV: " << end_vtx_id
 
  307       << 
" Attr: " << (*p).attribute_names().size();
 
  311        std::vector<std::string> names     = p->attribute_names();
 
  312        for (
const auto& ss: names) {
 
  313            os << 
" " << ss << 
"=" << (*p).attribute_as_string(ss);
 
 
  318void Print::line(std::ostream& os, std::shared_ptr<GenCrossSection> &cs) {
 
  319    if (!cs) {os << 
" GenCrossSection: Empty"; 
return;}
 
  320    os << 
" GenCrossSection: " << cs->xsec(0)
 
  321       << 
" " << cs->xsec_err(0)
 
  322       << 
" " << cs->get_accepted_events()
 
  323       << 
" " << cs->get_attempted_events();
 
 
  326void Print::line(std::ostream& os, std::shared_ptr<GenHeavyIon> &hi) {
 
  327    if (!hi) {os << 
" GenHeavyIon: Empty"; 
return;}
 
  328    os << 
" GenHeavyIon: " << hi->Ncoll_hard
 
  329       << 
" " << hi->Npart_proj
 
  330       << 
" " << hi->Npart_targ
 
  332       << 
" " << hi->spectator_neutrons
 
  333       << 
" " << hi->spectator_protons
 
  334       << 
" " << hi->N_Nwounded_collisions
 
  335       << 
" " << hi->Nwounded_N_collisions
 
  336       << 
" " << hi->Nwounded_Nwounded_collisions
 
  337       << 
" " << hi->impact_parameter
 
  338       << 
" " << hi->event_plane_angle
 
  339       << 
" " << hi->eccentricity
 
  340       << 
" " << hi->sigma_inel_NN;
 
 
  343void Print::line(std::ostream& os, std::shared_ptr<GenPdfInfo> &pi) {
 
  344    if (!pi) {os << 
" GenPdfInfo: Empty"; 
return;}
 
  345    os << 
" GenPdfInfo: " << pi->parton_id[0]
 
  346       << 
" " << pi->parton_id[1]
 
  352       << 
" " << pi->pdf_id[0]
 
  353       << 
" " << pi->pdf_id[1];
 
 
Definition of class Attribute, class IntAttribute and class StringAttribute.
#define HEPMC3_WARNING(MESSAGE)
Macro for printing HEPMC3_HEPMC3_WARNING messages.
Definition of static class Print.
double e() const
Energy component of momentum.
double pz() const
z-component of momentum
double t() const
Time component of position/displacement.
bool is_zero() const
Check if the length of this vertex is zero.
double px() const
x-component of momentum
double py() const
y-component of momentum
double x() const
x-component of position/displacement
double y() const
y-component of position/displacement
double z() const
z-component of position/displacement
Stores event-related information.
std::vector< std::string > attribute_names(const int &id=0) const
Get list of attribute names.
const std::vector< ConstGenVertexPtr > & vertices() const
Get list of vertices (const)
const Units::MomentumUnit & momentum_unit() const
Get momentum unit.
const Units::LengthUnit & length_unit() const
Get length unit.
std::map< std::string, std::map< int, std::shared_ptr< Attribute > > > attributes() const
Get a copy of the list of attributes.
const std::vector< double > & weights() const
Get event weight values as a vector.
const std::vector< ConstGenParticlePtr > & particles() const
Get list of particles (const)
Stores run-related information.
std::map< std::string, std::shared_ptr< Attribute > > attributes() const
Get a copy of the list of attributes.
std::vector< std::string > attribute_names() const
Get list of attribute names.
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.
std::string attribute_as_string(const std::string &name) const
Get attribute of any type as string.
static void content(std::ostream &os, const GenEvent &event)
Print content of all GenEvent containers.
static void listing(std::ostream &os, const GenEvent &event, unsigned short precision=2)
Print event in listing (HepMC2) format.
static void line(std::ostream &os, const GenEvent &event, bool attributes=false)
Print one-line info.
static std::string name(MomentumUnit u)
Get name of momentum unit.