HepMC3 event record library
Print.h
Go to the documentation of this file.
1// -*- C++ -*-
2//
3// This file is part of HepMC
4// Copyright (C) 2014-2021 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
18namespace HepMC3 {
19
20
21class GenPdfInfo;
22class GenHeavyIon;
23class GenCrossSection;
24
25
26/// @brief Provides different printing formats
27class Print {
28public:
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, std::shared_ptr<GenCrossSection> &cs);
100 /// @brief Print one-line info to std::cout
101 inline static void line(std::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, std::shared_ptr<GenHeavyIon> &hi);
108 /// @brief Print one-line info to std::cout
109 inline static void line(std::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, std::shared_ptr<GenPdfInfo> &pi);
116 /// @brief Print one-line info to std::cout
117 inline static void line(std::shared_ptr<GenPdfInfo> &pi) {
118 line(std::cout, pi);
119 std::cout<<std::endl;
120 }
121///deleted copy assignment operator
122 Print& operator = (const Print &) = delete;
123
124private:
125 /// @brief Helper function for printing a vertex in listing format
126 static void listing(std::ostream& os, ConstGenVertexPtr v);
127
128 /// @brief Helper function for printing a particle in listing format
129 static void listing(std::ostream& os, ConstGenParticlePtr p);
130
131 /// @brief Destructor
132 virtual ~Print() {}
133};
134} // namespace HepMC3
135
136#endif
Definition of class GenEvent.
Definition of class GenParticle.
Definition of class GenRunInfo.
Definition of class GenVertex.
Generic 4-vector.
Definition: FourVector.h:36
Stores event-related information.
Definition: GenEvent.h:41
Stores run-related information.
Definition: GenRunInfo.h:33
Provides different printing formats.
Definition: Print.h:27
virtual ~Print()
Destructor.
Definition: Print.h:132
static void listing(const GenRunInfo &ri, unsigned short precision=2)
Print runinfo in listing to std::cout.
Definition: Print.h:44
static void line(ConstGenVertexPtr v, bool attributes=false)
Print one-line info to std::cout.
Definition: Print.h:77
Print & operator=(const Print &)=delete
deleted copy assignment operator
static void line(const GenRunInfo &RunInfo, bool attributes=false)
Print one-line info to std::cout.
Definition: Print.h:59
static void content(std::ostream &os, const GenEvent &event)
Print content of all GenEvent containers.
Definition: Print.cc:17
static void line(ConstGenParticlePtr p, bool attributes=false)
Print one-line info to std::cout.
Definition: Print.h:93
static void line(std::shared_ptr< GenCrossSection > &cs)
Print one-line info to std::cout.
Definition: Print.h:101
static void listing(std::ostream &os, const GenEvent &event, unsigned short precision=2)
Print event in listing (HepMC2) format.
Definition: Print.cc:50
static void line(std::ostream &os, const GenEvent &event, bool attributes=false)
Print one-line info.
Definition: Print.cc:202
static void line(std::shared_ptr< GenPdfInfo > &pi)
Print one-line info to std::cout.
Definition: Print.h:117
static void content(const GenEvent &event)
Print content of all GenEvent containers to std::cout.
Definition: Print.h:32
static void listing(const GenEvent &event, unsigned short precision=2)
Print event in listing (HepMC2) format to std::cout.
Definition: Print.h:37
static void line(const FourVector &p)
Print one-line info to std::cout.
Definition: Print.h:85
static void line(const GenRunInfo::ToolInfo &t)
Print one-line info to std::cout.
Definition: Print.h:67
static void line(std::shared_ptr< GenHeavyIon > &hi)
Print one-line info to std::cout.
Definition: Print.h:109
static void line(const GenEvent &event, bool attributes=false)
Print one-line info to std::cout.
Definition: Print.h:51
HepMC3 main namespace.
Interrnal struct for keeping track of tools.
Definition: GenRunInfo.h:38