HepMC event record
build/outputs/include/HepMC/LHEFAttributes.h
1 // -*- C++ -*-
2 //
3 // This file is part of HepMC
4 // Copyright (C) 2014-2015 The HepMC collaboration (see AUTHORS for details)
5 //
6 #ifndef HEPMC_LHEFATTRIBUTES_H
7 #define HEPMC_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 "HepMC/Attribute.h"
17 #include "LHEF.h"
18 #include "FourVector.h"
19 
20 namespace HepMC {
21 
22 /**
23  * @class HepMC::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 string &att);
47 
48  /** @brief Fill string from class content */
49  virtual bool to_string(string &att) const;
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 HepMC::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 string &att);
89 
90  /** @brief Parse the XML-tags. */
91  virtual bool init(const GenEvent & geneve);
92 
93  /** @brief Dummy function. */
94  virtual bool init(const GenRunInfo & /*runinfo*/) {
95  return true;
96  }
97 
98  /** @brief Fill string from class content */
99  virtual bool to_string(string &att) const;
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 HepMC
122 
123 #endif
124 
125 
126 
127 
virtual ~HEPRUPAttribute()
Virtual destructor.
HEPEUPAttribute(std::string s)
Constructor from string.
Stores run-related information.
virtual bool from_string(const string &att)
Fill class content from string.
std::vector< LHEF::XMLTag * > tags
The parsed XML-tags.
Stores event-related information.
Class for storing data for LHEF run information.
virtual bool to_string(string &att) const
Fill string from class content.
void clear()
Clear this object.
Class for storing data for LHEF run information.
HEPRUPAttribute(std::string s)
Constructor from string.
std::vector< std::vector< double > > PUP
LHEF::HEPEUP hepeup
The actual HEPEUP object.
virtual bool init(const GenEvent &geneve)
Parse the XML-tags.
virtual bool init(const GenRunInfo &)
Dummy function.
virtual ~HEPEUPAttribute()
Virtual destructor.
virtual bool from_string(const string &att)
Fill class content from string.
Base class for all attributes.
Definition of template class SmartPointer.
LHEF::HEPRUP heprup
The actual HEPRUP object.
virtual bool to_string(string &att) const
Fill string from class content.
FourVector momentum(int i) const
Get momentum.
std::vector< LHEF::XMLTag * > tags
The parsed XML-tags.
void clear()
Clear this object.