CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HepMCConverter.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // HepMCConverter.h is a part of ThePEG - Toolkit for HEP Event Generation
4 // Copyright (C) 1999-2007 Leif Lonnblad
5 //
6 // ThePEG is licenced under version 2 of the GPL, see COPYING for details.
7 // Please respect the MCnet academic guidelines, see GUIDELINES for details.
8 //
9 #ifndef ThePEG_HepMCConverter_H
10 #define ThePEG_HepMCConverter_H
11 // This is the declaration of the HepMCConverter class.
12 
13 #include <ThePEG/Config/ThePEG.h>
14 #include <ThePEG/EventRecord/Event.h>
15 #include <ThePEG/Vectors/HepMCTraits.h>
16 
17 namespace ThePEG {
18 
19 
31 template <typename HepMCEventT, typename Traits = HepMCTraits<HepMCEventT> >
33 
34 public:
35 
38  struct HepMCConverterException: public Exception {};
45  struct Vertex {
47  tcParticleSet in;
49  tcParticleSet out;
50  };
51 
53  typedef typename Traits::ParticleT GenParticle;
55  typedef typename Traits::EventT GenEvent;
57  typedef typename Traits::VertexT GenVertex;
59  typedef typename Traits::PdfInfoT PdfInfo;
61  typedef map<tcPPtr,GenParticle*> ParticleMap;
63  typedef map<tcColinePtr,long> FlowMap;
65  typedef map<tcPPtr,Vertex*> VertexMap;
67  typedef map<const Vertex *, GenVertex*> GenVertexMap;
68 
69 public:
70 
80  static GenEvent * convert(const Event & ev, bool nocopies = false,
81  Energy eunit = Traits::defaultEnergyUnit(),
82  Length lunit = Traits::defaultLengthUnit());
83 
93  static void
94  convert(const Event & ev, GenEvent & gev, bool nocopies,
95  Energy eunit, Length lunit);
96 
106  static void
107  convert(const Event & ev, GenEvent & gev, bool nocopies = false);
108 
109 private:
110 
115  HepMCConverter(const Event & ev, bool nocopies, Energy eunit, Length lunit);
116 
121  HepMCConverter(const Event & ev, GenEvent & gev, bool nocopies,
122  Energy eunit, Length lunit);
123 
127  void init(const Event & ev, bool nocopies);
128 
132  HepMCConverter();
133 
138 
143 
144 private:
145 
149  GenParticle * createParticle(tcPPtr p) const;
150 
155  void join(tcPPtr parent, tcPPtr child);
156 
161 
165  void setPdfInfo(const Event & e);
166 
170  void sortTopologically(tcPVector & allv);
171 private:
172 
177 
183 
189 
193  vector<Vertex> vertices;
194 
199 
204 
209 
213  Energy energyUnit;
214 
218  Length lengthUnit;
219 
223  tcEHPtr eh;
224 };
225 
226  template<> struct HepMCTraits<HepMC::GenEvent> :
227  public HepMCTraitsBase<
228  HepMC::GenEvent, HepMC::GenParticle,
229  HepMC::GenVertex, HepMC::Polarization,
230  HepMC::PdfInfo> {};
231 }
232 
233 
234 #endif /* ThePEG_HepMCConverter_H */
Traits::PdfInfoT PdfInfo
map< tcColinePtr, long > FlowMap
void join(tcPPtr parent, tcPPtr child)
list parent
Definition: dbtoconf.py:74
GenParticle * createParticle(tcPPtr p) const
bool ev
Traits::EventT GenEvent
HepMCConverter & operator=(const HepMCConverter &)
GenVertex * createVertex(Vertex *v)
map< tcPPtr, Vertex * > VertexMap
vector< Vertex > vertices
static GenEvent * convert(const Event &ev, bool nocopies=false, Energy eunit=Traits::defaultEnergyUnit(), Length lunit=Traits::defaultLengthUnit())
void setPdfInfo(const Event &e)
void sortTopologically(tcPVector &allv)
void init(const Event &ev, bool nocopies)
map< tcPPtr, GenParticle * > ParticleMap
map< const Vertex *, GenVertex * > GenVertexMap
Traits::ParticleT GenParticle
Traits::VertexT GenVertex