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-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/GenVertex.h"
15 #include "HepMC3/GenParticle.h"
16 
17 namespace HepMC3 {
18 
19 
20 class GenPdfInfo;
21 class GenHeavyIon;
22 class GenCrossSection;
23 
24 
25 /// @brief Provides different printing formats
26 class Print {
27 public:
28  /// @brief Print content of all GenEvent containers
29  static void content(std::ostream& os, const GenEvent &event);
30  inline static void content(const GenEvent &event) { content(std::cout, event); }
31 
32  /// @brief Print event in listing (HepMC2) format
33  static void listing(std::ostream& os, const GenEvent &event, unsigned short precision = 2);
34  inline static void listing(const GenEvent &event, unsigned short precision = 2) {
35  listing(std::cout, event, precision);
36  }
37 
38  /// @brief Print one-line info
39  static void line(std::ostream& os, const GenEvent &event, bool attributes=false);
40  inline static void line(const GenEvent &event, bool attributes=false) {
41  line(std::cout, event, attributes); std::cout<<std::endl;
42  }
43 
44  /// @brief Print one-line info
45  static void line(std::ostream& os, ConstGenVertexPtr v, bool attributes=false);
46  inline static void line(ConstGenVertexPtr v, bool attributes=false) {
47  line(std::cout, v, attributes); std::cout << std::endl;
48  }
49 
50  /// @brief Print one-line info
51  static void line(std::ostream& os, ConstGenParticlePtr p, bool attributes=false);
52  inline static void line(ConstGenParticlePtr p, bool attributes=false) {
53  line(std::cout, p, attributes); std::cout << std::endl;
54  }
55 
56  /// @brief Print one-line info
57  static void line(std::ostream& os, shared_ptr<GenCrossSection> &cs);
58  inline static void line(shared_ptr<GenCrossSection> &cs) {
59  line(std::cout, cs); std::cout<<std::endl;
60  }
61 
62  /// @brief Print one-line info
63  static void line(std::ostream& os, shared_ptr<GenHeavyIon> &hi);
64  inline static void line(shared_ptr<GenHeavyIon> &hi) {
65  line(std::cout, hi); std::cout<<std::endl;
66  }
67 
68  /// @brief Print one-line info
69  static void line(std::ostream& os, shared_ptr<GenPdfInfo> &pi);
70  inline static void line(shared_ptr<GenPdfInfo> &pi) {
71  line(std::cout, pi); std::cout<<std::endl;
72  }
73 
74 private:
75  /// @brief Helper function for printing a vertex in listing format
76  static void listing(std::ostream& os, ConstGenVertexPtr v);
77 
78  /// @brief Helper function for printing a particle in listing format
79  static void listing(std::ostream& os, ConstGenParticlePtr p);
80 
81  virtual ~Print() {}
82 };
83 
84 
85 } // namespace HepMC3
86 
87 #endif
Provides different printing formats.
Definition: Print.h:26
HepMC3 main namespace.
Definition: WriterDOT.h:19
Definition of class GenParticle.
Definition of class GenVertex.
static void listing(std::ostream &os, const GenEvent &event, unsigned short precision=2)
Print event in listing (HepMC2) format.
Definition: Print.cc:51
Stores event-related information.
Definition: GenEvent.h:42
static void line(std::ostream &os, const GenEvent &event, bool attributes=false)
Print one-line info.
Definition: Print.cc:165
Definition of class GenEvent.
static void content(std::ostream &os, const GenEvent &event)
Print content of all GenEvent containers.
Definition: Print.cc:18