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
00030 template <typename HepMCEventT, typename Traits = HepMCTraits<HepMCEventT> >
00031 class HepMCConverter {
00032
00033 public:
00034
00037 struct HepMCConverterException: public Exception {};
00044 struct Vertex {
00046 tcParticleSet in;
00048 tcParticleSet out;
00049 };
00050
00052 typedef typename Traits::ParticleT GenParticle;
00054 typedef typename Traits::EventT GenEvent;
00056 typedef typename Traits::VertexT GenVertex;
00058 typedef map<tcPPtr,GenParticle*> ParticleMap;
00060 typedef map<tcColinePtr,long> FlowMap;
00062 typedef map<tcPPtr,Vertex*> VertexMap;
00064 typedef map<const Vertex *, GenVertex*> GenVertexMap;
00065
00066 public:
00067
00077 static GenEvent * convert(const Event & ev, bool nocopies = false,
00078 Energy eunit = GeV, Length lunit = millimeter);
00079
00089 static void
00090 convert(const Event & ev, GenEvent & gev, bool nocopies = false,
00091 Energy eunit = GeV, Length lunit = millimeter);
00092
00093 private:
00094
00099 HepMCConverter(const Event & ev, bool nocopies, Energy eunit, Length lunit);
00100
00105 HepMCConverter(const Event & ev, GenEvent & gev, bool nocopies,
00106 Energy eunit, Length lunit);
00107
00111 void init(const Event & ev, bool nocopies);
00112
00116 HepMCConverter();
00117
00121 HepMCConverter(const HepMCConverter &);
00122
00126 HepMCConverter & operator=(const HepMCConverter &);
00127
00128 private:
00129
00133 GenParticle * createParticle(tcPPtr p) const;
00134
00139 void join(tcPPtr parent, tcPPtr child);
00140
00144 GenVertex * createVertex(Vertex * v);
00145
00146 private:
00147
00151 GenEvent * geneve;
00152
00157 ParticleMap pmap;
00158
00163 FlowMap flowmap;
00164
00168 vector<Vertex> vertices;
00169
00173 VertexMap prov;
00174
00178 VertexMap decv;
00179
00183 GenVertexMap vmap;
00184
00188 Energy energyUnit;
00189
00193 Length lengthUnit;
00194
00198 tcEHPtr eh;
00199 };
00200
00201 template<> struct HepMCTraits<HepMC::GenEvent> :
00202 public HepMCTraitsBase<HepMC::GenEvent, HepMC::GenParticle,
00203 HepMC::GenVertex, HepMC::Polarization> {};
00204
00205 }
00206
00207 #endif