ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4PersistencyCenter.hh
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4PersistencyCenter.hh
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 // File: G4PersistencyCenter.hh
27 //
28 // History:
29 // '01.08.10 Youhei Morita Initial creation (with "fadsclass3")
30 
31 #ifndef PERSISTENCY_CENTER_HH
32 #define PERSISTENCY_CENTER_HH 1
33 
34 #include "G4Types.hh"
35 #include <string>
36 #include <vector>
37 #include <map>
38 #include "G4HCIOcatalog.hh"
39 #include "G4DCIOcatalog.hh"
40 
41 #ifndef WIN32
42  #include "G4FileUtilities.hh"
43 #endif
44 
45 // Forward Declaration to avoid circular dependencies.
47 
48 typedef std::map<std::string, G4PersistencyManager*,std::less<std::string> > PMap;
49 typedef std::map<int, std::string, std::less<int> > ObjMap;
50 typedef std::map<std::string, std::string, std::less<std::string> > FileMap;
51 
53 
54 typedef std::map<std::string, StoreMode, std::less<std::string> > StoreMap;
55 typedef std::map<std::string, G4bool, std::less<std::string> > BoolMap;
56 
57 // Forward Declarations:
59 
60 // Class Description:
61 // Class to handle loading of the G4PersistencyManager.
62 
64 {
65  public: // With description
66 
68  // returns the pointer of singleton G4PersistencyCenter
69 
70  void SelectSystem(std::string systemName);
71  // Select the persistency package
72 
73  const std::string CurrentSystem() { return f_currentSystemName; };
74  // returns the current persistent package name
75 
76  void SetHepMCObjyReaderFile(std::string file);
77  // Sets the name of HepMCObjyReader file name. To be called by generator.
78 
79  std::string CurrentHepMCObjyReaderFile();
80  // Sets the name of HepMCObjyReader file name. To be called by generator.
81 
82  void SetStoreMode(std::string objName, StoreMode mode);
83  // Sets the object store mode. Modes are kOn, kOff or kRecycle.
84 
85  void SetRetrieveMode(std::string objName, G4bool mode);
86  // Sets the object retrieve mode. Modes are true or false.
87 
88  StoreMode CurrentStoreMode(std::string objName);
89  // returns the current object store mode.
90 
91  G4bool CurrentRetrieveMode(std::string objName);
92  // returns the current object store mode.
93 
94  G4bool SetWriteFile(std::string objName, std::string writeFileName);
95  // Sets the output filename.
96 
97  G4bool SetReadFile(std::string objName, std::string readFileName);
98  // Sets the input filename.
99 
100  std::string CurrentWriteFile(std::string objName);
101  // returns the current output filename.
102 
103  std::string CurrentReadFile(std::string objName);
104  // returns the current input filename.
105 
106  std::string CurrentObject(std::string file);
107  // returns the current object type
108 
109  void AddHCIOmanager(std::string detName, std::string colName);
110  // add a hits colleciton I/O manager to the catalog
111 
112  std::string CurrentHCIOmanager();
113  // Returns a list of registered hits colleciton I/O managers
114 
115  void AddDCIOmanager(std::string detName);
116  // add a digits colleciton I/O manager to the catalog
117 
118  std::string CurrentDCIOmanager();
119  // Returns a list of registered digits colleciton I/O managers
120 
121  void PrintAll();
122  // prints the current G4PersistencyCenter settings.
123 
125  // returns the pointer of the currnet G4PersistencyManager.
126 
128  // returns the pointer of the currnet G4PersistencyManager.
129 
131  // returns the pointer of the currnet G4PersistencyManager with name.
132 
134  // registers the persistency manager to the runtime catalog.
135 
137  // deletes the current G4PersistencyManager.
138 
139  void SetVerboseLevel(int v);
140  // Set verbose level.
141 
142  int VerboseLevel() { return m_verbose; };
143  // Return verbose level.
144 
145  private:
146 
148  // Constructor
149 
151  // Destructor
152 
153  std::string PadString(std::string name, unsigned int width);
154  // truncate or pad a string up to the width.
155 
156  private:
160  std::string f_currentSystemName;
169 #ifndef WIN32
171 #endif
172 }; // End of class G4PersistencyCenter
173 
174 #endif
175