/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Simulation/G4Svc/G4Svc-00-01-52/G4Svc/G4HepMCInterface.h

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 // ====================================================================
00027 //
00028 //   G4HepMCInterface.hh
00029 //   $Id: G4HepMCInterface.h,v 1.5 2011/02/15 01:05:25 dengzy Exp $
00030 //
00031 //   A base class for primary generation via HepMC object.
00032 //   This class is derived from G4VPrimaryGenerator.
00033 //
00034 // ====================================================================
00035 #ifndef G4_HEPMC_INTERFACE_H
00036 #define G4_HEPMC_INTERFACE_H
00037 
00038 #include <vector>
00039 #include "G4VPrimaryGenerator.hh"
00040 #include <HepMC/GenEvent.h>
00041 #include "G4Svc/G4HepMCParticle.h"
00042 #include "RealizationSvc/RealizationSvc.h"
00043 #include "RealizationSvc/IRealizationSvc.h"
00044 
00045 class G4HepMCInterface : public G4VPrimaryGenerator
00046 {
00047 public:
00048   // static service method for conversion from HepMC::GenEvent to G4Event
00049   void HepMC2G4( HepMC::GenEvent* hepmcevt, G4Event* g4event);
00050   void Print(const HepMC::GenEvent* hepmcevt);
00051   G4int CheckType(const HepMC::GenEvent* hepmcevt);
00052   void Boost( HepMC::GenEvent* hepmcevt);
00053   void PrintHPlist();
00054 
00055   G4int GetLogLevel() {return m_logLevel;}
00056   void SetLogLevel(G4int level) {m_logLevel = level;}
00057 
00058   // static service method for checking a point is included in the (current) world
00059   // static G4bool CheckVertexInsideWorld(const G4ThreeVector& pos);
00060   // ------------> This method has been moved to the base class
00061 
00062 protected:
00063   // Note that the life of HepMC event object must be handled by users.
00064   // In the default implementation, a current HepMC event will be
00065   // deleted at GeneratePrimaryVertex() in the next event.
00066   HepMC::GenEvent* hepmcEvent; // (care for single event case only)
00067 
00068   // Implement this method in his/her own concrete class.
00069   // An empty event will be created in default.
00070   virtual HepMC::GenEvent* GenerateHepMCEvent();
00071   G4int m_logLevel;
00072 
00073 public: 
00074   G4HepMCInterface();
00075   virtual ~G4HepMCInterface();
00076 
00077   // set/get methods
00078   HepMC::GenEvent* GetHepMCGenEvent() const;
00079 
00080   // The default behavior is that a single HepMC event generated by
00081   // GenerateHepMCEvent() will be converted to G4Event through HepMC2G4().
00082   virtual void GeneratePrimaryVertex(G4Event* anEvent);
00083 
00084   std::vector<G4HepMCParticle*> HPlist;
00085 
00086 private:
00087   RealizationSvc* m_RealizationSvc;
00088 };
00089 
00090 // ====================================================================
00091 // inline functions
00092 // ====================================================================
00093 
00094 inline HepMC::GenEvent* G4HepMCInterface::GetHepMCGenEvent() const 
00095 { 
00096   return hepmcEvent; 
00097 }
00098 
00099 #endif

Generated on Tue Nov 29 23:14:33 2016 for BOSS_7.0.2 by  doxygen 1.4.7