1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
|
// -*- C++ -*-
//
// HepMCConverter.h is a part of ThePEG - Toolkit for HEP Event Generation
// Copyright (C) 1999-2019 Leif Lonnblad
//
// ThePEG is licenced under version 3 of the GPL, see COPYING for details.
// Please respect the MCnet academic guidelines, see GUIDELINES for details.
//
#ifndef ThePEG_HepMC3Converter_H
#define ThePEG_HepMC3Converter_H
// This is the declaration of the HepMCConverter class.
#include "ThePEG/Config/ThePEG.h"
#include "ThePEG/EventRecord/Event.h"
#include "GeneratorInterface/Herwig7Interface/interface/HepMC3Traits.h"
namespace ThePEG {
template <typename HepMCEventT, typename Traits = HepMCTraits<HepMCEventT> >
class HepMCConverter {
public:
struct HepMCConverterException : public Exception {};
struct Vertex {
/** Particles going in to the vertex. */
tcParticleSet in;
/** Particles going out of the vertex. */
tcParticleSet out;
};
/** Forward typedefs from Traits class. */
typedef typename Traits::ParticleT GenParticle;
/** Forward typedefs from Traits class. */
typedef typename Traits::ParticlePtrT GenParticlePtrT;
/** Forward typedefs from Traits class. */
typedef typename Traits::EventT GenEvent;
/** Forward typedefs from Traits class. */
typedef typename Traits::VertexT GenVertex;
/** Forward typedefs from Traits class. */
typedef typename Traits::VertexPtrT GenVertexPtrT;
/** Forward typedefs from Traits class. */
typedef typename Traits::PdfInfoT PdfInfo;
/** Map ThePEG particles to HepMC particles. */
typedef map<tcPPtr, GenParticlePtrT> ParticleMap;
/** Map ThePEG colour lines to HepMC colour indices. */
typedef map<tcColinePtr, long> FlowMap;
/** Map ThePEG particles to vertices. */
typedef map<tcPPtr, Vertex *> VertexMap;
/** Map vertices to GenVertex */
typedef map<const Vertex *, GenVertexPtrT> GenVertexMap;
public:
/**
* Convert a ThePEG::Event to a HepMC::GenEvent. The caller is
* responsible for deleting the constructed GenEvent object. If \a
* nocopies is true, only final copies of particles connected with
* Particle::previous() and Particle::next() will be entered in the
* HepMC::GenEvent. In the GenEvent object, the energy/momentum
* variables will be in units of \a eunit and lengths variables in
* units of \a lunit.
*/
static GenEvent *convert(const Event &ev,
bool nocopies = false,
Energy eunit = Traits::defaultEnergyUnit(),
Length lunit = Traits::defaultLengthUnit());
/**
* Convert a ThePEG::Event to a HepMC::GenEvent. The caller supplies
* a GenEvent object, \a gev, which will be filled. If \a nocopies
* is true, only final copies of particles connected with
* Particle::previous() and Particle::next() will be entered in the
* HepMC::GenEvent. In the GenEvent object, the energy/momentum
* variables will be in units of \a eunit and lengths variables in
* units of \a lunit.
*/
static void convert(const Event &ev, GenEvent &gev, bool nocopies, Energy eunit, Length lunit);
/**
* Convert a ThePEG::Event to a HepMC::GenEvent. The caller supplies
* a GenEvent object, \a gev, which will be filled. If \a nocopies
* is true, only final copies of particles connected with
* Particle::previous() and Particle::next() will be entered in the
* HepMC::GenEvent. In the GenEvent object, the energy/momentum
* variables will be in units of \a eunit and lengths variables in
* units of \a lunit.
*/
static void convert(const Event &ev, GenEvent &gev, bool nocopies = false);
private:
/**
* The proper constructors are private. The class is only
* instantiated within the convert method.
*/
HepMCConverter(const Event &ev, bool nocopies, Energy eunit, Length lunit);
/**
* The proper constructors are private. The class is only
* instantiated within the convert method.
*/
HepMCConverter(const Event &ev, GenEvent &gev, bool nocopies, Energy eunit, Length lunit);
/**
* Common init function used by the constructors.
*/
void init(const Event &ev, bool nocopies);
/**
* Default constructor is unimplemented and private and should never be used.
*/
HepMCConverter() = delete;
/**
* Copy constructor is unimplemented and private and should never be used.
*/
HepMCConverter(const HepMCConverter &) = delete;
/**
* Assignment is unimplemented and private and should never be used.
*/
HepMCConverter &operator=(const HepMCConverter &) = delete;
private:
/**
* Create a GenParticle from a ThePEG Particle.
*/
GenParticlePtrT createParticle(tcPPtr p) const;
/**
* Join the decay vertex of the parent with the decay vertex of the
* child.
*/
void join(tcPPtr parent, tcPPtr child);
/**
* Create a GenVertex from a temporary Vertex.
*/
GenVertexPtrT createVertex(Vertex *v);
/**
* Create and set a PdfInfo object for the event
*/
void setPdfInfo(const Event &e);
private:
/**
* The constructed GenEvent.
*/
GenEvent *geneve;
/**
* The translation table between the ThePEG particles and the
* GenParticles.
*/
ParticleMap pmap;
/**
* The translation table between ThePEG ColourLine objects and HepMC
* Flow indices.
*/
FlowMap flowmap;
/**
* All temporary vertices created.
*/
vector<Vertex> vertices;
/**
* The mapping of particles to their production vertices.
*/
VertexMap prov;
/**
* The mapping of particles to their decy vertices.
*/
VertexMap decv;
/**
* The mapping between temporary vertices and the created GenVertex Objects.
*/
GenVertexMap vmap;
/**
* The energy unit to be used in the GenEvent.
*/
Energy energyUnit;
/**
* The length unit to be used in the GenEvent.
*/
Length lengthUnit;
};
} // namespace ThePEG
#include "ThePEG/Vectors/HepMCConverter.tcc"
#endif /* ThePEG_HepMCConverter_H */
|