CGEM BOSS 6.6.5.i
BESIII Offline Software System
Loading...
Searching...
No Matches
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.1.1.1 2013/11/22 02:11:07 juxd 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>
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);
53 void PrintHPlist();
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();
72
73public:
75 virtual ~G4HepMCInterface();
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
HepMC::GenEvent * hepmcEvent
void HepMC2G4(HepMC::GenEvent *hepmcevt, G4Event *g4event)
void Print(const HepMC::GenEvent *hepmcevt)
HepMC::GenEvent * GetHepMCGenEvent() const
void SetLogLevel(G4int level)
void Boost(HepMC::GenEvent *hepmcevt)
std::vector< G4HepMCParticle * > HPlist
virtual void GeneratePrimaryVertex(G4Event *anEvent)
virtual HepMC::GenEvent * GenerateHepMCEvent()
G4int CheckType(const HepMC::GenEvent *hepmcevt)