HepMC3 event record library: Print.h Source File

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-2023 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
27 class 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, GenVertexPtr v, bool attributes=false);
84 /// @brief Print one-line info to std::cout
85 inline static void line(GenVertexPtr v, bool attributes=false) {
86 line(std::cout, v, attributes);
87 std::cout << std::endl;
88 }
89
90 /// @brief Print one-line info
91 static void line(std::ostream& os, const FourVector& p);
92 /// @brief Print one-line info to std::cout
93 inline static void line(const FourVector& p) {
94 line(std::cout, p);
95 std::cout << std::endl;
96 }
97
98 /// @brief Print one-line info
99 static void line(std::ostream& os, ConstGenParticlePtr p, bool attributes=false);
100 /// @brief Print one-line info to std::cout
101 inline static void line(ConstGenParticlePtr p, bool attributes=false) {
102 line(std::cout, p, attributes);
103 std::cout << std::endl;
104 }
105
106 /// @brief Print one-line info
107 static void line(std::ostream& os, GenParticlePtr p, bool attributes=false);
108 /// @brief Print one-line info to std::cout
109 inline static void line(GenParticlePtr p, bool attributes=false) {
110 line(std::cout, p, attributes);
111 std::cout << std::endl;
112 }
113
114
115 /// @brief Print one-line info
116 static void line(std::ostream& os, std::shared_ptr<GenCrossSection> &cs);
117 /// @brief Print one-line info to std::cout
118 inline static void line(std::shared_ptr<GenCrossSection> &cs) {
119 line(std::cout, cs);
120 std::cout<<std::endl;
121 }
122
123 /// @brief Print one-line info
124 static void line(std::ostream& os, std::shared_ptr<GenHeavyIon> &hi);
125 /// @brief Print one-line info to std::cout
126 inline static void line(std::shared_ptr<GenHeavyIon> &hi) {
127 line(std::cout, hi);
128 std::cout<<std::endl;
129 }
130
131 /// @brief Print one-line info
132 static void line(std::ostream& os, std::shared_ptr<GenPdfInfo> &pi);
133 /// @brief Print one-line info to std::cout
134 inline static void line(std::shared_ptr<GenPdfInfo> &pi) {
135 line(std::cout, pi);
136 std::cout<<std::endl;
137 }
138///deleted copy assignment operator
139 Print& operator = (const Print &) = delete;
140
141private:
142 /// @brief Helper function for printing a vertex in listing format
143 static void listing(std::ostream& os, ConstGenVertexPtr v);
144
145
146 /// @brief Helper function for printing a particle in listing format
147 static void listing(std::ostream& os, ConstGenParticlePtr p);
148
149 /// @brief Destructor
150 virtual ~Print() {}
151};
152} // namespace HepMC3
153
154#endif
GenEvent.h
Definition of class GenEvent.
GenParticle.h
Definition of class GenParticle.
GenRunInfo.h
Definition of class GenRunInfo.
GenVertex.h
Definition of class GenVertex.
HepMC3::FourVector
Generic 4-vector.
Definition FourVector.h:36
HepMC3::GenCrossSection
Stores additional information about cross-section.
Definition GenCrossSection.h:42
HepMC3::GenEvent
Stores event-related information.
Definition GenEvent.h:47
HepMC3::GenHeavyIon
Stores additional information about Heavy Ion generator.
Definition GenHeavyIon.h:26
HepMC3::GenPdfInfo
Stores additional information about PDFs.
Definition GenPdfInfo.h:32
HepMC3::GenRunInfo
Stores run-related information.
Definition GenRunInfo.h:33
HepMC3::Print
Provides different printing formats.
Definition Print.h:27
HepMC3::Print::~Print
virtual ~Print()
Destructor.
Definition Print.h:150
HepMC3::Print::line
static void line(GenParticlePtr p, bool attributes=false)
Print one-line info to std::cout.
Definition Print.h:109
HepMC3::Print::listing
static void listing(const GenRunInfo &ri, unsigned short precision=2)
Print runinfo in listing to std::cout.
Definition Print.h:44
HepMC3::Print::line
static void line(ConstGenVertexPtr v, bool attributes=false)
Print one-line info to std::cout.
Definition Print.h:77
HepMC3::Print::operator=
Print & operator=(const Print &)=delete
deleted copy assignment operator
HepMC3::Print::line
static void line(const GenRunInfo &RunInfo, bool attributes=false)
Print one-line info to std::cout.
Definition Print.h:59
HepMC3::Print::line
static void line(GenVertexPtr v, bool attributes=false)
Print one-line info to std::cout.
Definition Print.h:85
HepMC3::Print::content
static void content(std::ostream &os, const GenEvent &event)
Print content of all GenEvent containers.
Definition Print.cc:17
HepMC3::Print::line
static void line(ConstGenParticlePtr p, bool attributes=false)
Print one-line info to std::cout.
Definition Print.h:101
HepMC3::Print::line
static void line(std::shared_ptr< GenCrossSection > &cs)
Print one-line info to std::cout.
Definition Print.h:118
HepMC3::Print::listing
static void listing(std::ostream &os, const GenEvent &event, unsigned short precision=2)
Print event in listing (HepMC2) format.
Definition Print.cc:52
HepMC3::Print::line
static void line(std::ostream &os, const GenEvent &event, bool attributes=false)
Print one-line info.
Definition Print.cc:204
HepMC3::Print::line
static void line(std::shared_ptr< GenPdfInfo > &pi)
Print one-line info to std::cout.
Definition Print.h:134
HepMC3::Print::content
static void content(const GenEvent &event)
Print content of all GenEvent containers to std::cout.
Definition Print.h:32
HepMC3::Print::listing
static void listing(const GenEvent &event, unsigned short precision=2)
Print event in listing (HepMC2) format to std::cout.
Definition Print.h:37
HepMC3::Print::line
static void line(const FourVector &p)
Print one-line info to std::cout.
Definition Print.h:93
HepMC3::Print::line
static void line(const GenRunInfo::ToolInfo &t)
Print one-line info to std::cout.
Definition Print.h:67
HepMC3::Print::line
static void line(std::shared_ptr< GenHeavyIon > &hi)
Print one-line info to std::cout.
Definition Print.h:126
HepMC3::Print::line
static void line(const GenEvent &event, bool attributes=false)
Print one-line info to std::cout.
Definition Print.h:51
HepMC3
HepMC3 main namespace.
Definition AnalysisExample.h:24
HepMC3::GenRunInfo::ToolInfo
Interrnal struct for keeping track of tools.
Definition GenRunInfo.h:38