HepMC3 event record library
LHEFAttributes.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // This file is part of HepMC
4 // Copyright (C) 2014-2020 The HepMC collaboration (see AUTHORS for details)
5 //
6 #ifndef HEPMC3_LHEFATTRIBUTES_H
7 #define HEPMC3_LHEFATTRIBUTES_H
8 /**
9  * @file LHEFAttributes.h
10  * @brief Definition of \b class HEPRUPAttribute and \b class HEPEUAttribute
11  *
12  * @ingroup attributes
13  *
14  */
15 
16 #include "HepMC3/Attribute.h"
17 #include "LHEF.h"
18 #include "FourVector.h"
19 
20 namespace HepMC3 {
21 
22 /**
23  * @class HepMC3::HEPRUPAttribute
24  * @brief Class for storing data for LHEF run information
25  */
26 class HEPRUPAttribute: public Attribute {
27 
28 public:
29 
30  /** @brief Default constructor */
32 
33  /** @brief Constructor from string*/
34  HEPRUPAttribute(std::string s): Attribute(s) {}
35 
36  /** @brief Virtual destructor */
37  virtual ~HEPRUPAttribute() {
38  clear();
39  }
40 
41  //
42  // Virtual Functions
43  //
44 public:
45  /** @brief Fill class content from string */
46  virtual bool from_string(const std::string &att) override;
47 
48  /** @brief Fill string from class content */
49  virtual bool to_string(std::string &att) const override;
50 
51 public:
52 
53  /** @brief Clear this object. */
54  void clear();
55 
56  /** @brief The actual HEPRUP object. */
58 
59  /** @brief The parsed XML-tags. */
60  std::vector<LHEF::XMLTag*> tags;
61 
62 };
63 
64 /**
65  * @class HepMC3::HEPEUPAttribute
66  * @brief Class for storing data for LHEF run information
67  */
68 class HEPEUPAttribute: public Attribute {
69 
70 public:
71 
72  /** @brief Default constructor */
74 
75  /** @brief Constructor from string*/
76  HEPEUPAttribute(std::string s): Attribute(s) {}
77 
78  /** @brief Virtual destructor */
79  virtual ~HEPEUPAttribute() {
80  clear();
81  }
82 
83  //
84  // Virtual Functions
85  //
86 public:
87  /** @brief Fill class content from string */
88  virtual bool from_string(const std::string &att) override;
89 
90  /** @brief Parse the XML-tags. */
91  virtual bool init() override;
92 
93  /** @brief Dummy function. */
94  virtual bool init(const GenRunInfo & /*runinfo*/) override{
95  return true;
96  }
97 
98  /** @brief Fill string from class content */
99  virtual bool to_string(std::string &att) const override;
100 
101 public:
102 
103  /** @brief Get momentum */
104  FourVector momentum(int i) const {
105  return FourVector(hepeup.PUP[i][0], hepeup.PUP[i][1],
106  hepeup.PUP[i][2], hepeup.PUP[i][3]);
107  }
108 
109  /** @brief Clear this object. */
110  void clear();
111 
112  /** @brief The actual HEPEUP object. */
114 
115  /** @brief The parsed XML-tags. */
116  std::vector<LHEF::XMLTag*> tags;
117 
118 
119 };
120 
121 } // namespace HepMC3
122 
123 #endif
124 
125 
126 
127 
virtual bool to_string(std::string &att) const override
Fill string from class content.
Forward declaration of GenParticle.
Definition: Attribute.h:45
virtual bool to_string(std::string &att) const override
Fill string from class content.
virtual bool init(const GenRunInfo &) override
Dummy function.
HEPEUPAttribute(std::string s)
Constructor from string.
HEPRUPAttribute(std::string s)
Constructor from string.
Stores run-related information.
Definition: GenRunInfo.h:33
Class for storing data for LHEF run information.
Class for storing data for LHEF run information.
virtual ~HEPRUPAttribute()
Virtual destructor.
virtual bool from_string(const std::string &att) override
Fill class content from string.
virtual bool from_string(const std::string &att) override
Fill class content from string.
LHEF::HEPRUP heprup
The actual HEPRUP object.
std::vector< LHEF::XMLTag * > tags
The parsed XML-tags.
FourVector momentum(int i) const
Get momentum.
Generic 4-vector.
Definition: FourVector.h:35
LHEF::HEPEUP hepeup
The actual HEPEUP object.
std::vector< std::vector< double > > PUP
Definition: LHEF.h:2612
HEPEUPAttribute()
Default constructor.
void clear()
Clear this object.
virtual bool init() override
Parse the XML-tags.
std::vector< LHEF::XMLTag * > tags
The parsed XML-tags.
virtual ~HEPEUPAttribute()
Virtual destructor.
HEPRUPAttribute()
Default constructor.
Definition of class Attribute, class IntAttribute and class StringAttribute.
void clear()
Clear this object.
Definition of class FourVector.