Go to the documentation of this file.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 <ThePEG/Vectors/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
00170 void sortTopologically(tcPVector & allv);
00171 private:
00172
00176 GenEvent * geneve;
00177
00182 ParticleMap pmap;
00183
00188 FlowMap flowmap;
00189
00193 vector<Vertex> vertices;
00194
00198 VertexMap prov;
00199
00203 VertexMap decv;
00204
00208 GenVertexMap vmap;
00209
00213 Energy energyUnit;
00214
00218 Length lengthUnit;
00219
00223 tcEHPtr eh;
00224 };
00225
00226 template<> struct HepMCTraits<HepMC::GenEvent> :
00227 public HepMCTraitsBase<
00228 HepMC::GenEvent, HepMC::GenParticle,
00229 HepMC::GenVertex, HepMC::Polarization,
00230 HepMC::PdfInfo> {};
00231 }
00232
00233
00234 #endif