ConvertMCTruthToG4.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 /// \file ConvertMCTruthToG4.h
3 /// \brief Convert MCTruth to G4Event; Geant4 event generator
4 ///
5 /// \version $Id: ConvertMCTruthToG4.h,v 1.5 2012-09-20 21:47:05 greenc Exp $
6 /// \author brebel@fnal.gov
7 ////////////////////////////////////////////////////////////////////////
8 ///
9 /// Every Geant4 simulation has to have some event generator object,
10 /// even if it's the default ParticleGun. This class is the event
11 /// generator for G4Base. It accepts a set of simb::MCTruth objects
12 /// associated with one event, converts them to Geant4's G4Event
13 /// format, and makes that information available to the G4 simulation
14 /// when it requests it.
15 
16 #ifndef G4BASE_CONVERTMCTRUTHTOG4_H
17 #define G4BASE_CONVERTMCTRUTHTOG4_H
18 
19 // G4 Includes
20 #include "Geant4/G4VUserPrimaryGeneratorAction.hh"
21 #include "Geant4/G4ParticleTable.hh"
22 #include "Geant4/globals.hh"
23 
24 // ART Includes
27 
28 // Forward declarations
29 class G4Event;
30 namespace simb {
31  class MCTruth;
32 }
33 
34 namespace g4b {
35 
36  class ConvertMCTruthToG4 : public G4VUserPrimaryGeneratorAction {
37 
38  public:
39  /// Standard constructor and destructor.
41  virtual ~ConvertMCTruthToG4();
42 
43  /// Get ready to convert a new set of MCTruth objects.
44  void Reset();
45 
46  /// Add a new MCTruth object to the list of primary particles to
47  /// be appended to the Geant4 event.
48  void Append( art::Ptr<simb::MCTruth> &mct );
49 
50  /// Add a new MCTruth object to the list of primary particles to
51  /// be appended to the Geant4 event.
52  void Append( const simb::MCTruth* mct );
53 
54  /// Required of any class that inherits from
55  /// G4VUserPrimaryGeneratorAction; append primary particles to a
56  /// G4Event object. This method is invoked by Geant4, and is not
57  /// directly called by the user application.
58  virtual void GeneratePrimaries( G4Event* );
59 
60  private:
61  static G4ParticleTable* fParticleTable; ///< Geant4's table of particle definitions.
62  std::vector<const simb::MCTruth*> fConvertList; ///< List of MCTruth objects to convert for this spill
63  std::map<G4int, G4int> fUnknownPDG; ///< map of unknown PDG codes to instances
64  };
65 
66 } // namespace g4b
67 
68 #endif // G4BASE_CONVERTMCTRUTHTOG4_H
static G4ParticleTable * fParticleTable
Geant4&#39;s table of particle definitions.
basic interface to Geant4 for ART-based software
Base utilities and modules for event generation and detector simulation.
std::map< G4int, G4int > fUnknownPDG
map of unknown PDG codes to instances
Event generator information.
Definition: MCTruth.h:32
std::vector< const simb::MCTruth * > fConvertList
List of MCTruth objects to convert for this spill.