HepMC3 event record library: LHEFAttributes.h Source File

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-2023 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 */
26 class HEPRUPAttribute: public Attribute {
27
28public:
29
30 /** @brief Default constructor */
31 HEPRUPAttribute() {}
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. */
57 LHEF::HEPRUP heprup;
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
70public:
71
72 /** @brief Default constructor */
73 HEPEUPAttribute() {}
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. */
113 LHEF::HEPEUP hepeup;
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
Attribute.h
Definition of class Attribute, class IntAttribute and class StringAttribute.
FourVector.h
Definition of class FourVector.
LHEF.h
This is the declaration of the Les Houches Event File classes, implementing a simple C++ parser/write...
HepMC3::Attribute::Attribute
Attribute()
Default constructor.
Definition Attribute.h:51
HepMC3::FourVector
Generic 4-vector.
Definition FourVector.h:36
HepMC3::GenRunInfo
Stores run-related information.
Definition GenRunInfo.h:33
HepMC3::HEPEUPAttribute::init
virtual bool init(const GenRunInfo &) override
Dummy function.
Definition LHEFAttributes.h:94
HepMC3::HEPEUPAttribute::init
virtual bool init() override
Parse the XML-tags.
Definition LHEFAttributes.cc:75
HepMC3::HEPEUPAttribute::hepeup
LHEF::HEPEUP hepeup
The actual HEPEUP object.
Definition LHEFAttributes.h:113
HepMC3::HEPEUPAttribute::momentum
FourVector momentum(int i) const
Get momentum.
Definition LHEFAttributes.h:104
HepMC3::HEPEUPAttribute::from_string
virtual bool from_string(const std::string &att) override
Fill class content from string.
Definition LHEFAttributes.cc:51
HepMC3::HEPEUPAttribute::HEPEUPAttribute
HEPEUPAttribute()
Default constructor.
Definition LHEFAttributes.h:73
HepMC3::HEPEUPAttribute::clear
void clear()
Clear this object.
Definition LHEFAttributes.cc:45
HepMC3::HEPEUPAttribute::tags
std::vector< LHEF::XMLTag * > tags
The parsed XML-tags.
Definition LHEFAttributes.h:116
HepMC3::HEPEUPAttribute::~HEPEUPAttribute
virtual ~HEPEUPAttribute()
Virtual destructor.
Definition LHEFAttributes.h:79
HepMC3::HEPEUPAttribute::to_string
virtual bool to_string(std::string &att) const override
Fill string from class content.
Definition LHEFAttributes.cc:62
HepMC3::HEPEUPAttribute::HEPEUPAttribute
HEPEUPAttribute(std::string s)
Constructor from string.
Definition LHEFAttributes.h:76
HepMC3::HEPRUPAttribute::HEPRUPAttribute
HEPRUPAttribute(std::string s)
Constructor from string.
Definition LHEFAttributes.h:34
HepMC3::HEPRUPAttribute::~HEPRUPAttribute
virtual ~HEPRUPAttribute()
Virtual destructor.
Definition LHEFAttributes.h:37
HepMC3::HEPRUPAttribute::from_string
virtual bool from_string(const std::string &att) override
Fill class content from string.
Definition LHEFAttributes.cc:22
HepMC3::HEPRUPAttribute::clear
void clear()
Clear this object.
Definition LHEFAttributes.cc:16
HepMC3::HEPRUPAttribute::heprup
LHEF::HEPRUP heprup
The actual HEPRUP object.
Definition LHEFAttributes.h:57
HepMC3::HEPRUPAttribute::tags
std::vector< LHEF::XMLTag * > tags
The parsed XML-tags.
Definition LHEFAttributes.h:60
HepMC3::HEPRUPAttribute::to_string
virtual bool to_string(std::string &att) const override
Fill string from class content.
Definition LHEFAttributes.cc:35
HepMC3::HEPRUPAttribute::HEPRUPAttribute
HEPRUPAttribute()
Default constructor.
Definition LHEFAttributes.h:31
LHEF::HEPEUP
Definition LHEF.h:2136
LHEF::HEPRUP
Definition LHEF.h:1646
HepMC3
HepMC3 main namespace.
Definition AnalysisExample.h:24