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-2021 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
20namespace HepMC3 {
21
22/**
23 * @class HepMC3::HEPRUPAttribute
24 * @brief Class for storing data for LHEF run information
25 */
27
28public:
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 //
44public:
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
51public:
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 */
69
70public:
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 //
86public:
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
101public:
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
Definition of class Attribute, class IntAttribute and class StringAttribute.
Definition of class FourVector.
Base attribute class.
Definition: Attribute.h:44
Generic 4-vector.
Definition: FourVector.h:36
Stores run-related information.
Definition: GenRunInfo.h:33
Class for storing data for LHEF run information.
virtual bool init(const GenRunInfo &) override
Dummy function.
virtual bool init() override
Parse the XML-tags.
LHEF::HEPEUP hepeup
The actual HEPEUP object.
FourVector momentum(int i) const
Get momentum.
virtual bool from_string(const std::string &att) override
Fill class content from string.
HEPEUPAttribute()
Default constructor.
void clear()
Clear this object.
std::vector< LHEF::XMLTag * > tags
The parsed XML-tags.
virtual ~HEPEUPAttribute()
Virtual destructor.
virtual bool to_string(std::string &att) const override
Fill string from class content.
HEPEUPAttribute(std::string s)
Constructor from string.
Class for storing data for LHEF run information.
HEPRUPAttribute(std::string s)
Constructor from string.
virtual ~HEPRUPAttribute()
Virtual destructor.
virtual bool from_string(const std::string &att) override
Fill class content from string.
void clear()
Clear this object.
LHEF::HEPRUP heprup
The actual HEPRUP object.
std::vector< LHEF::XMLTag * > tags
The parsed XML-tags.
virtual bool to_string(std::string &att) const override
Fill string from class content.
HEPRUPAttribute()
Default constructor.
std::vector< std::vector< double > > PUP
Definition: LHEF.h:2612
HepMC3 main namespace.