Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4PersistencyManager.hh
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// G4PersistencyManager
27//
28// Class Description:
29//
30// Manager base class to handle event store and retrieve operation.
31// Actual persistency implementation should be handled with derived classes.
32//
33// Each persistency package should implement derived classes of
34// G4VHepMCIO, G4VMCTruthIO, G4VPHitIO, G4VPDigitIO, G4VPEventIO.
35// Concreate G4PersistencyManager should implement the methods
36// HepMCIO(), MCTruthIO(), HitIO(), DigitIO() and EventIO() to
37// return the pointers of the above classes.
38// G4PersistencyManager handles the sequence of the storing and
39// retrieving of the persistent object of each type, along with
40// the transaction handling.
41//
42// Retrieving a HepMC event:
43//
44// G4PersistencyManager::Retrieve( HepMC::GenEvent*& )
45// |
46// | ... StartRead() ...
47// |
48// | ... Commit() ...
49// V
50//
51// Storing a Geant4 event:
52//
53// G4PersistencyManager::Store( G4Pevent* )
54// |
55// | ... StartUpdate() ...
56// |
57// | ... MCTruthIO()->Store( MCTruth event ) ...
58// |
59// | ... HitIO()->Store( hit_collection_of_event ) ...
60// |
61// | ... DigitIO()->Store( digit_collection_of_event ) ...
62// |
63// | ... EventIO()->Store( event with hits and digits ) ...
64// |
65// | ... Commit() ...
66// V
67//
68// Retrieving a Geant4 event:
69//
70// G4PersistencyManager::Retrieve( event )
71// |
72// | ... StartRead() ...
73// |
74// | ... EventIO()->Retrieve( event ) ...
75// |
76// | ... Commit() ...
77// V
78//
79// Hit collection and digit collection of each detector component
80// should be handled by detector specific I/O manager, which
81// should be registered to the G4PersistencyCenter with
82// AddHCIOmanager() and AddDCIOmanager(). Usually this is done
83// through a command
84//
85// /Persistency/Store/Using/HitIO <detector_io_manager_name>
86//
87// which is handled by G4PersistencyCenterMessenger.
88//
89// A static template declaration of G4HCIOentryT<class> must be
90// implementated for each I/O manager.
91
92// Author: Youhei Morita, 17.07.2001
93// --------------------------------------------------------------------
94#ifndef G4PERSISTENCYMANAGER_HH
95#define G4PERSISTENCYMANAGER_HH 1
96
97#include "G4Event.hh"
98
99#include "G4VMCTruthIO.hh"
100#include "G4HCIOcatalog.hh"
101#include "G4DCIOcatalog.hh"
102#include "G4VPEventIO.hh"
103#include "G4VPHitIO.hh"
104#include "G4VPDigitIO.hh"
107
109
111{
113
114 public:
115
117 // Constructor
118
119 virtual ~G4PersistencyManager();
120 // Destructor
121
122 virtual G4PersistencyManager* Create() { return nullptr; }
123 // Create a new persistency manager.
124 // To be used by G4PersistencyManagerT<>
125
126 const G4String& GetName() { return nameMgr; }
127 // Get the name of persistency manager
128
129 virtual G4VPEventIO* EventIO() { return nullptr; }
130 // Returns the current event I/O handling manager
131 // Each derived class should return the pointer of actual manager
132
133 virtual G4VPHitIO* HitIO() { return nullptr; }
134 // Returns the current hit I/O handling manager
135 // Each derived class should return the pointer of actual manager
136
137 virtual G4VPDigitIO* DigitIO() { return nullptr; }
138 // Returns the current digit I/O handling manager
139 // Each derived class should return the pointer of actual manager
140
141 virtual G4VMCTruthIO* MCTruthIO() { return nullptr; }
142 // Returns the current MCTruth I/O handling manager
143 // Each derived class should return the pointer of actual manager
144
145 virtual G4VTransactionManager* TransactionManager() { return nullptr; }
146 // Returns the current transaction manager
147 // Each derived class should return the pointer of actual manager
148
149 virtual void Initialize() {}
150 // Initialize the persistency package.
151 // Each derived class should implement the acutal initialization sequence
152
153 void SetVerboseLevel(G4int v);
154 // Set verbose level
155
156 G4bool Store(const G4Event* evt);
157 // Store the G4Event and its associated objects
158
159 G4bool Retrieve(G4Event*& evt);
160 // Retrieve the G4Event and its associated objects
161
162 G4bool Store(const G4Run*) { return false; }
163 // Not used
164
165 G4bool Retrieve(G4Run*&) { return false; }
166 // Not used
167
168 G4bool Store(const G4VPhysicalVolume*) { return false; }
169 // Not used
170
171 G4bool Retrieve(G4VPhysicalVolume*&) { return false; }
172 // Not used
173
174 protected:
175
177 // Get the instance of persistency manager
178
179 protected:
180
183
184 private:
185
186 G4String nameMgr;
187 G4bool f_is_initialized = false;
188};
189
190#endif
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
G4PersistencyCenter * f_pc
virtual G4VPEventIO * EventIO()
G4bool Store(const G4VPhysicalVolume *)
virtual G4PersistencyManager * Create()
G4bool Retrieve(G4Event *&evt)
G4bool Store(const G4Run *)
virtual G4VMCTruthIO * MCTruthIO()
static G4PersistencyManager * GetPersistencyManager()
virtual G4VPHitIO * HitIO()
G4bool Retrieve(G4VPhysicalVolume *&)
virtual G4VPDigitIO * DigitIO()
const G4String & GetName()
G4bool Store(const G4Event *evt)
virtual G4VTransactionManager * TransactionManager()
Definition: G4Run.hh:49