| 1 |
// -*- C++ -*- |
| 2 |
// |
| 3 |
// This file is part of HepMC |
| 4 |
// Copyright (C) 2014-2019 The HepMC collaboration (see AUTHORS for details) |
| 5 |
// |
| 6 |
#ifndef HEPMC3_PRINT_H |
| 7 |
#define HEPMC3_PRINT_H |
| 8 |
/// |
| 9 |
/// @file Print.h |
| 10 |
/// @brief Definition of static \b class Print |
| 11 |
/// |
| 12 |
|
| 13 |
#include "HepMC3/GenEvent.h" |
| 14 |
#include "HepMC3/GenRunInfo.h" |
| 15 |
#include "HepMC3/GenVertex.h" |
| 16 |
#include "HepMC3/GenParticle.h" |
| 17 |
|
| 18 |
namespace HepMC3 { |
| 19 |
|
| 20 |
|
| 21 |
class GenPdfInfo; |
| 22 |
class GenHeavyIon; |
| 23 |
class GenCrossSection; |
| 24 |
|
| 25 |
|
| 26 |
/// @brief Provides different printing formats |
| 27 |
class Print { |
| 28 |
public: |
| 29 |
/// @brief Print content of all GenEvent containers |
| 30 |
static void content(std::ostream& os, const GenEvent &event); |
| 31 |
/// @brief Print content of all GenEvent containers to std::cout |
| 32 |
inline static void content(const GenEvent &event) { content(std::cout, event); } |
| 33 |
|
| 34 |
/// @brief Print event in listing (HepMC2) format |
| 35 |
static void listing(std::ostream& os, const GenEvent &event, unsigned short precision = 2); |
| 36 |
/// @brief Print event in listing (HepMC2) format to std::cout |
| 37 |
inline static void listing(const GenEvent &event, unsigned short precision = 2) { |
| 38 |
listing(std::cout, event, precision); |
| 39 |
} |
| 40 |
|
| 41 |
/// @brief Print runinfo in listing |
| 42 |
static void listing(std::ostream& os, const GenRunInfo &ri, unsigned short precision = 2); |
| 43 |
/// @brief Print runinfo in listing to std::cout |
| 44 |
inline static void listing(const GenRunInfo &ri, unsigned short precision = 2) { |
| 45 |
listing(std::cout, ri, precision); |
| 46 |
} |
| 47 |
|
| 48 |
/// @brief Print one-line info |
| 49 |
static void line(std::ostream& os, const GenEvent &event, bool attributes=false); |
| 50 |
/// @brief Print one-line info to std::cout |
| 51 |
inline static void line(const GenEvent &event, bool attributes=false) { |
| 52 |
line(std::cout, event, attributes); |
| 53 |
std::cout<<std::endl; |
| 54 |
} |
| 55 |
|
| 56 |
/// @brief Print one-line info |
| 57 |
static void line(std::ostream& os, const GenRunInfo &RunInfo, bool attributes=false); |
| 58 |
/// @brief Print one-line info to std::cout |
| 59 |
inline static void line(const GenRunInfo &RunInfo, bool attributes=false) { |
| 60 |
line(std::cout, RunInfo, attributes); |
| 61 |
std::cout<<std::endl; |
| 62 |
} |
| 63 |
|
| 64 |
/// @brief Print one-line info |
| 65 |
static void line(std::ostream& os, const GenRunInfo::ToolInfo& t); |
| 66 |
/// @brief Print one-line info to std::cout |
| 67 |
inline static void line(const GenRunInfo::ToolInfo& t) { |
| 68 |
line(std::cout, t); |
| 69 |
std::cout << std::endl; |
| 70 |
} |
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
/// @brief Print one-line info |
| 75 |
static void line(std::ostream& os, ConstGenVertexPtr v, bool attributes=false); |
| 76 |
/// @brief Print one-line info to std::cout |
| 77 |
inline static void line(ConstGenVertexPtr v, bool attributes=false) { |
| 78 |
line(std::cout, v, attributes); |
| 79 |
std::cout << std::endl; |
| 80 |
} |
| 81 |
|
| 82 |
/// @brief Print one-line info |
| 83 |
static void line(std::ostream& os, const FourVector& p); |
| 84 |
/// @brief Print one-line info to std::cout |
| 85 |
inline static void line(const FourVector& p) { |
| 86 |
line(std::cout, p); |
| 87 |
std::cout << std::endl; |
| 88 |
} |
| 89 |
|
| 90 |
/// @brief Print one-line info |
| 91 |
static void line(std::ostream& os, ConstGenParticlePtr p, bool attributes=false); |
| 92 |
/// @brief Print one-line info to std::cout |
| 93 |
inline static void line(ConstGenParticlePtr p, bool attributes=false) { |
| 94 |
line(std::cout, p, attributes); |
| 95 |
std::cout << std::endl; |
| 96 |
} |
| 97 |
|
| 98 |
/// @brief Print one-line info |
| 99 |
static void line(std::ostream& os, shared_ptr<GenCrossSection> &cs); |
| 100 |
/// @brief Print one-line info to std::cout |
| 101 |
inline static void line(shared_ptr<GenCrossSection> &cs) { |
| 102 |
line(std::cout, cs); |
| 103 |
std::cout<<std::endl; |
| 104 |
} |
| 105 |
|
| 106 |
/// @brief Print one-line info |
| 107 |
static void line(std::ostream& os, shared_ptr<GenHeavyIon> &hi); |
| 108 |
/// @brief Print one-line info to std::cout |
| 109 |
inline static void line(shared_ptr<GenHeavyIon> &hi) { |
| 110 |
line(std::cout, hi); |
| 111 |
std::cout<<std::endl; |
| 112 |
} |
| 113 |
|
| 114 |
/// @brief Print one-line info |
| 115 |
static void line(std::ostream& os, shared_ptr<GenPdfInfo> &pi); |
| 116 |
/// @brief Print one-line info to std::cout |
| 117 |
inline static void line(shared_ptr<GenPdfInfo> &pi) { |
| 118 |
line(std::cout, pi); |
| 119 |
std::cout<<std::endl; |
| 120 |
} |
| 121 |
|
| 122 |
private: |
| 123 |
/// @brief Helper function for printing a vertex in listing format |
| 124 |
static void listing(std::ostream& os, ConstGenVertexPtr v); |
| 125 |
|
| 126 |
/// @brief Helper function for printing a particle in listing format |
| 127 |
static void listing(std::ostream& os, ConstGenParticlePtr p); |
| 128 |
|
| 129 |
/// @brief Destructor |
| 130 |
virtual ~Print() {} |
| 131 |
}; |
| 132 |
} // namespace HepMC3 |
| 133 |
|
| 134 |
#endif |