CMS 3D CMS Logo

HepMCConverter.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // HepMCConverter.h is a part of ThePEG - Toolkit for HEP Event Generation
00004 // Copyright (C) 1999-2007 Leif Lonnblad
00005 //
00006 // ThePEG is licenced under version 2 of the GPL, see COPYING for details.
00007 // Please respect the MCnet academic guidelines, see GUIDELINES for details.
00008 //
00009 #ifndef ThePEG_HepMCConverter_H
00010 #define ThePEG_HepMCConverter_H
00011 // This is the declaration of the HepMCConverter class.
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 } // namespace ThePEG
00206 
00207 #endif /* ThePEG_HepMCConverter_H */

Generated on Tue Jun 9 17:37:09 2009 for CMSSW by  doxygen 1.5.4