|
||||
File indexing completed on 2025-01-18 09:58:55
0001 // 0002 // ******************************************************************** 0003 // * License and Disclaimer * 0004 // * * 0005 // * The Geant4 software is copyright of the Copyright Holders of * 0006 // * the Geant4 Collaboration. It is provided under the terms and * 0007 // * conditions of the Geant4 Software License, included in the file * 0008 // * LICENSE and available at http://cern.ch/geant4/license . These * 0009 // * include a list of copyright holders. * 0010 // * * 0011 // * Neither the authors of this software system, nor their employing * 0012 // * institutes,nor the agencies providing financial support for this * 0013 // * work make any representation or warranty, express or implied, * 0014 // * regarding this software system or assume any liability for its * 0015 // * use. Please see the license in the file LICENSE and URL above * 0016 // * for the full disclaimer and the limitation of liability. * 0017 // * * 0018 // * This code implementation is the result of the scientific and * 0019 // * technical work of the GEANT4 collaboration. * 0020 // * By using, copying, modifying or distributing the software (or * 0021 // * any work based on the software) you agree to acknowledge its * 0022 // * use in resulting scientific publications, and indicate your * 0023 // * acceptance of all terms of the Geant4 Software license. * 0024 // ******************************************************************** 0025 // 0026 // G4PersistencyManager 0027 // 0028 // Class Description: 0029 // 0030 // Manager base class to handle event store and retrieve operation. 0031 // Actual persistency implementation should be handled with derived classes. 0032 // 0033 // Each persistency package should implement derived classes of 0034 // G4VHepMCIO, G4VMCTruthIO, G4VPHitIO, G4VPDigitIO, G4VPEventIO. 0035 // Concreate G4PersistencyManager should implement the methods 0036 // HepMCIO(), MCTruthIO(), HitIO(), DigitIO() and EventIO() to 0037 // return the pointers of the above classes. 0038 // G4PersistencyManager handles the sequence of the storing and 0039 // retrieving of the persistent object of each type, along with 0040 // the transaction handling. 0041 // 0042 // Retrieving a HepMC event: 0043 // 0044 // G4PersistencyManager::Retrieve( HepMC::GenEvent*& ) 0045 // | 0046 // | ... StartRead() ... 0047 // | 0048 // | ... Commit() ... 0049 // V 0050 // 0051 // Storing a Geant4 event: 0052 // 0053 // G4PersistencyManager::Store( G4Pevent* ) 0054 // | 0055 // | ... StartUpdate() ... 0056 // | 0057 // | ... MCTruthIO()->Store( MCTruth event ) ... 0058 // | 0059 // | ... HitIO()->Store( hit_collection_of_event ) ... 0060 // | 0061 // | ... DigitIO()->Store( digit_collection_of_event ) ... 0062 // | 0063 // | ... EventIO()->Store( event with hits and digits ) ... 0064 // | 0065 // | ... Commit() ... 0066 // V 0067 // 0068 // Retrieving a Geant4 event: 0069 // 0070 // G4PersistencyManager::Retrieve( event ) 0071 // | 0072 // | ... StartRead() ... 0073 // | 0074 // | ... EventIO()->Retrieve( event ) ... 0075 // | 0076 // | ... Commit() ... 0077 // V 0078 // 0079 // Hit collection and digit collection of each detector component 0080 // should be handled by detector specific I/O manager, which 0081 // should be registered to the G4PersistencyCenter with 0082 // AddHCIOmanager() and AddDCIOmanager(). Usually this is done 0083 // through a command 0084 // 0085 // /Persistency/Store/Using/HitIO <detector_io_manager_name> 0086 // 0087 // which is handled by G4PersistencyCenterMessenger. 0088 // 0089 // A static template declaration of G4HCIOentryT<class> must be 0090 // implementated for each I/O manager. 0091 0092 // Author: Youhei Morita, 17.07.2001 0093 // -------------------------------------------------------------------- 0094 #ifndef G4PERSISTENCYMANAGER_HH 0095 #define G4PERSISTENCYMANAGER_HH 1 0096 0097 #include "G4Event.hh" 0098 0099 #include "G4VMCTruthIO.hh" 0100 #include "G4HCIOcatalog.hh" 0101 #include "G4DCIOcatalog.hh" 0102 #include "G4VPEventIO.hh" 0103 #include "G4VPHitIO.hh" 0104 #include "G4VPDigitIO.hh" 0105 #include "G4VTransactionManager.hh" 0106 #include "G4VPersistencyManager.hh" 0107 0108 class G4PersistencyCenter; 0109 0110 class G4PersistencyManager : public G4VPersistencyManager 0111 { 0112 friend class G4PersistencyCenter; 0113 0114 public: 0115 0116 G4PersistencyManager(G4PersistencyCenter* pc, const G4String& n); 0117 // Constructor 0118 0119 virtual ~G4PersistencyManager(); 0120 // Destructor 0121 0122 virtual G4PersistencyManager* Create() { return nullptr; } 0123 // Create a new persistency manager. 0124 // To be used by G4PersistencyManagerT<> 0125 0126 const G4String& GetName() { return nameMgr; } 0127 // Get the name of persistency manager 0128 0129 virtual G4VPEventIO* EventIO() { return nullptr; } 0130 // Returns the current event I/O handling manager 0131 // Each derived class should return the pointer of actual manager 0132 0133 virtual G4VPHitIO* HitIO() { return nullptr; } 0134 // Returns the current hit I/O handling manager 0135 // Each derived class should return the pointer of actual manager 0136 0137 virtual G4VPDigitIO* DigitIO() { return nullptr; } 0138 // Returns the current digit I/O handling manager 0139 // Each derived class should return the pointer of actual manager 0140 0141 virtual G4VMCTruthIO* MCTruthIO() { return nullptr; } 0142 // Returns the current MCTruth I/O handling manager 0143 // Each derived class should return the pointer of actual manager 0144 0145 virtual G4VTransactionManager* TransactionManager() { return nullptr; } 0146 // Returns the current transaction manager 0147 // Each derived class should return the pointer of actual manager 0148 0149 virtual void Initialize() {} 0150 // Initialize the persistency package. 0151 // Each derived class should implement the acutal initialization sequence 0152 0153 void SetVerboseLevel(G4int v); 0154 // Set verbose level 0155 0156 G4bool Store(const G4Event* evt); 0157 // Store the G4Event and its associated objects 0158 0159 G4bool Retrieve(G4Event*& evt); 0160 // Retrieve the G4Event and its associated objects 0161 0162 G4bool Store(const G4Run*) { return false; } 0163 // Not used 0164 0165 G4bool Retrieve(G4Run*&) { return false; } 0166 // Not used 0167 0168 G4bool Store(const G4VPhysicalVolume*) { return false; } 0169 // Not used 0170 0171 G4bool Retrieve(G4VPhysicalVolume*&) { return false; } 0172 // Not used 0173 0174 protected: 0175 0176 static G4PersistencyManager* GetPersistencyManager(); 0177 // Get the instance of persistency manager 0178 0179 protected: 0180 0181 G4PersistencyCenter* f_pc = nullptr; 0182 G4int m_verbose = 0; 0183 0184 private: 0185 0186 G4String nameMgr; 0187 G4bool f_is_initialized = false; 0188 }; 0189 0190 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |