BOSS 7.0.2
BESIII Offline Software System
Loading...
Searching...
No Matches
Simulation/G4Svc/G4Svc-00-01-52/G4Svc/G4HepMCInterface.h
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26// ====================================================================
27//
28// G4HepMCInterface.hh
29// $Id: G4HepMCInterface.h,v 1.5 2011/02/15 01:05:25 dengzy Exp $
30//
31// A base class for primary generation via HepMC object.
32// This class is derived from G4VPrimaryGenerator.
33//
34// ====================================================================
35#ifndef G4_HEPMC_INTERFACE_H
36#define G4_HEPMC_INTERFACE_H
37
38#include <vector>
39#include "G4VPrimaryGenerator.hh"
40#include <HepMC/GenEvent.h>
41#include "G4Svc/G4HepMCParticle.h"
42#include "RealizationSvc/RealizationSvc.h"
43#include "RealizationSvc/IRealizationSvc.h"
44
45class G4HepMCInterface : public G4VPrimaryGenerator
46{
47public:
48 // static service method for conversion from HepMC::GenEvent to G4Event
49 void HepMC2G4( HepMC::GenEvent* hepmcevt, G4Event* g4event);
50 void Print(const HepMC::GenEvent* hepmcevt);
51 G4int CheckType(const HepMC::GenEvent* hepmcevt);
52 void Boost( HepMC::GenEvent* hepmcevt);
54
55 G4int GetLogLevel() {return m_logLevel;}
56 void SetLogLevel(G4int level) {m_logLevel = level;}
57
58 // static service method for checking a point is included in the (current) world
59 // static G4bool CheckVertexInsideWorld(const G4ThreeVector& pos);
60 // ------------> This method has been moved to the base class
61
62protected:
63 // Note that the life of HepMC event object must be handled by users.
64 // In the default implementation, a current HepMC event will be
65 // deleted at GeneratePrimaryVertex() in the next event.
66 HepMC::GenEvent* hepmcEvent; // (care for single event case only)
67
68 // Implement this method in his/her own concrete class.
69 // An empty event will be created in default.
70 virtual HepMC::GenEvent* GenerateHepMCEvent();
71 G4int m_logLevel;
72
73public:
76
77 // set/get methods
78 HepMC::GenEvent* GetHepMCGenEvent() const;
79
80 // The default behavior is that a single HepMC event generated by
81 // GenerateHepMCEvent() will be converted to G4Event through HepMC2G4().
82 virtual void GeneratePrimaryVertex(G4Event* anEvent);
83
84 std::vector<G4HepMCParticle*> HPlist;
85
86private:
87 RealizationSvc* m_RealizationSvc;
88};
89
90// ====================================================================
91// inline functions
92// ====================================================================
93
94inline HepMC::GenEvent* G4HepMCInterface::GetHepMCGenEvent() const
95{
96 return hepmcEvent;
97}
98
99#endif
virtual void GeneratePrimaryVertex(G4Event *anEvent)
void HepMC2G4(HepMC::GenEvent *hepmcevt, G4Event *g4event)
void Print(const HepMC::GenEvent *hepmcevt)
virtual ~G4HepMCInterface()
HepMC::GenEvent * GetHepMCGenEvent() const
void Boost(HepMC::GenEvent *hepmcevt)
virtual HepMC::GenEvent * GenerateHepMCEvent()
G4int CheckType(const HepMC::GenEvent *hepmcevt)