EDepSimRootPersistencyManager.hh
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////
2 // $Id: EDepSim::RootPersistencyManager.hh,v 1.31 2011/09/06 18:58:35 mcgrew Exp $
3 //
4 #ifndef EDepSim_RootPersistencyManager_hh_seen
5 #define EDepSim_RootPersistencyManager_hh_seen
6 
7 #include <string>
8 #include <vector>
9 #include <map>
10 
11 class TFile;
12 class TTree;
13 class TGeoManager;
14 
16 
17 /// Provide a root output for the geant 4 events. This just takes the summary
18 /// from EDepSim::PersistencyManager and dumps it as a tree.
19 namespace EDepSim {class RootPersistencyManager;}
21 public:
22  /// Creates a root persistency manager. Through the "magic" of
23  /// G4VPersistencyManager the ultimate base class, this declared to the G4
24  /// persistency management system. You can only have one active
25  /// persistency class at any give moment.
27  virtual ~RootPersistencyManager();
28 
29  /// Return true if the ROOT output file is active. This means that the
30  /// output file is open and ready to accept data.
31  bool IsOpen();
32 
33  /// Return a pointer to the current TFile.
34  TFile* GetTFile() const {return fOutput;}
35 
36  /// Stores an event to the output file.
37  virtual G4bool Store(const G4Event* anEvent);
38  virtual G4bool Store(const G4Run* aRun);
39  virtual G4bool Store(const G4VPhysicalVolume* aWorld);
40 
41  /// Retrieve information from a file. These are not implemented.
42  virtual G4bool Retrieve(G4Event *&e) {e=NULL; return false;}
43  virtual G4bool Retrieve(G4Run* &r) {r=NULL; return false;}
44  virtual G4bool Retrieve(G4VPhysicalVolume* &w) {w=NULL; return false;}
45 
46  /// Interface with PersistencyMessenger (open and close the
47  /// database).
48  virtual G4bool Open(G4String dbname);
49  virtual G4bool Close(void);
50 
51 private:
52  /// Make the MC Header and add it to truth.
53  void MakeMCHeader(const G4Event* src);
54 
55 private:
56  /// The ROOT output file that events are saved into.
57  TFile *fOutput;
58 
59  /// The event tree that contains the output events.
60  TTree *fEventTree;
61 
62  /// The number of events saved to the output file since the last write.
64 
65 };
66 #endif
int fEventsNotSaved
The number of events saved to the output file since the last write.
virtual G4bool Open(G4String dbname)
virtual G4bool Retrieve(G4VPhysicalVolume *&w)
const double e
void MakeMCHeader(const G4Event *src)
Make the MC Header and add it to truth.
virtual G4bool Store(const G4Event *anEvent)
Stores an event to the output file.
Construct a module from components.
Definition: TG4HitSegment.h:10
TFile * GetTFile() const
Return a pointer to the current TFile.
TFile * fOutput
The ROOT output file that events are saved into.
virtual G4bool Close(void)
Make sure the output file is closed.
virtual G4bool Retrieve(G4Event *&e)
Retrieve information from a file. These are not implemented.
TTree * fEventTree
The event tree that contains the output events.