00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef ThePEG_HepMCConverter_H
00010 #define ThePEG_HepMCConverter_H
00011
00012
00013 #include "ThePEG/Config/ThePEG.h"
00014 #include "ThePEG/EventRecord/Event.h"
00015 #include "HepMCTraits.h"
00016
00017 namespace ThePEG {
00018
00019
00031 template <typename HepMCEventT, typename Traits = HepMCTraits<HepMCEventT> >
00032 class HepMCConverter {
00033
00034 public:
00035
00038 struct HepMCConverterException: public Exception {};
00045 struct Vertex {
00047 tcParticleSet in;
00049 tcParticleSet out;
00050 };
00051
00053 typedef typename Traits::ParticleT GenParticle;
00055 typedef typename Traits::EventT GenEvent;
00057 typedef typename Traits::VertexT GenVertex;
00059 typedef typename Traits::PdfInfoT PdfInfo;
00061 typedef map<tcPPtr,GenParticle*> ParticleMap;
00063 typedef map<tcColinePtr,long> FlowMap;
00065 typedef map<tcPPtr,Vertex*> VertexMap;
00067 typedef map<const Vertex *, GenVertex*> GenVertexMap;
00068
00069 public:
00070
00080 static GenEvent * convert(const Event & ev, bool nocopies = false,
00081 Energy eunit = Traits::defaultEnergyUnit(),
00082 Length lunit = Traits::defaultLengthUnit());
00083
00093 static void
00094 convert(const Event & ev, GenEvent & gev, bool nocopies,
00095 Energy eunit, Length lunit);
00096
00106 static void
00107 convert(const Event & ev, GenEvent & gev, bool nocopies = false);
00108
00109 private:
00110
00115 HepMCConverter(const Event & ev, bool nocopies, Energy eunit, Length lunit);
00116
00121 HepMCConverter(const Event & ev, GenEvent & gev, bool nocopies,
00122 Energy eunit, Length lunit);
00123
00127 void init(const Event & ev, bool nocopies);
00128
00132 HepMCConverter();
00133
00137 HepMCConverter(const HepMCConverter &);
00138
00142 HepMCConverter & operator=(const HepMCConverter &);
00143
00144 private:
00145
00149 GenParticle * createParticle(tcPPtr p) const;
00150
00155 void join(tcPPtr parent, tcPPtr child);
00156
00160 GenVertex * createVertex(Vertex * v);
00161
00165 void setPdfInfo(const Event & e);
00166
00167 private:
00168
00172 GenEvent * geneve;
00173
00178 ParticleMap pmap;
00179
00184 FlowMap flowmap;
00185
00189 vector<Vertex> vertices;
00190
00194 VertexMap prov;
00195
00199 VertexMap decv;
00200
00204 GenVertexMap vmap;
00205
00209 Energy energyUnit;
00210
00214 Length lengthUnit;
00215
00216 };
00217
00218 }
00219
00220 #include "HepMCConverter.tcc"
00221
00222 #endif