The Gaudi Framework  master (bdbe7744)
Loading...
Searching...
No Matches
GaudiPython.Persistency.RootPersistency Class Reference
Inheritance diagram for GaudiPython.Persistency.RootPersistency:
Collaboration diagram for GaudiPython.Persistency.RootPersistency:

Public Member Functions

 __init__ (self)
 configure (self, appMgr)
 formatInput (self, filenames, **kwargs)
 formatOutput (self, filename, **kwargs)
Public Member Functions inherited from GaudiPython.Persistency.PersistencyHelper
 __init__ (self, types)
 handle (self, typ)

Public Attributes

bool configured = False
Public Attributes inherited from GaudiPython.Persistency.PersistencyHelper
 types = set(types)

Detailed Description

Implementation of PersistencyHelper based on Gaudi::RootCnvSvc.

Definition at line 118 of file Persistency.py.

Constructor & Destructor Documentation

◆ __init__()

GaudiPython.Persistency.RootPersistency.__init__ ( self)
Constructor.

Declare the type of supported persistencies to the base class.

Definition at line 123 of file Persistency.py.

123 def __init__(self):
124 """
125 Constructor.
126
127 Declare the type of supported persistencies to the base class.
128 """
129 super().__init__(["ROOT", "RootCnvSvc", "Gaudi::RootCnvSvc"])
130 self.configured = False
131

Member Function Documentation

◆ configure()

GaudiPython.Persistency.RootPersistency.configure ( self,
appMgr )
Basic configuration.

Definition at line 132 of file Persistency.py.

132 def configure(self, appMgr):
133 """
134 Basic configuration.
135 """
136 if not self.configured:
137 # instantiate the required services
138 appMgr.service("Gaudi::RootCnvSvc/RootCnvSvc")
139 eps = appMgr.service("EventPersistencySvc")
140 eps.CnvServices += ["RootCnvSvc"]
141 self.configured = True
142

◆ formatInput()

GaudiPython.Persistency.RootPersistency.formatInput ( self,
filenames,
** kwargs )
Translate a list of file names in a list of input descriptions.

The optional parameters 'collection', 'sel' and 'fun' should be used to
configure Event Tag Collection inputs.

@param filenames: the list of files

Definition at line 143 of file Persistency.py.

143 def formatInput(self, filenames, **kwargs):
144 """
145 Translate a list of file names in a list of input descriptions.
146
147 The optional parameters 'collection', 'sel' and 'fun' should be used to
148 configure Event Tag Collection inputs.
149
150 @param filenames: the list of files
151 """
152 if not self.configured:
153 raise PersistencyError("Persistency not configured")
154 if isinstance(filenames, str):
155 filenames = [filenames]
156 fileargs = {}
157 # check if we are accessing a collection
158 fileargs = dict(
159 [(k, kwargs[k]) for k in ["collection", "sel", "fun"] if k in kwargs]
160 )
161 if fileargs:
162 # is a collection
163 svc = "Gaudi::RootCnvSvc"
164 else:
165 svc = "Gaudi::RootEvtSelector"
166 return [str(FileDescription(f, "READ", svc, **fileargs)) for f in filenames]
167

◆ formatOutput()

GaudiPython.Persistency.RootPersistency.formatOutput ( self,
filename,
** kwargs )
Translate a filename in an output description.

@param filenames: the list of files
@param lun: Logical Unit for Event Tag Collection outputs (optional)

Definition at line 168 of file Persistency.py.

168 def formatOutput(self, filename, **kwargs):
169 """
170 Translate a filename in an output description.
171
172 @param filenames: the list of files
173 @param lun: Logical Unit for Event Tag Collection outputs (optional)
174 """
175 if not self.configured:
176 raise PersistencyError("Persistency not configured")
177 retval = str(FileDescription(filename, "RECREATE", "Gaudi::RootCnvSvc"))
178 if "lun" in kwargs:
179 retval = "{} {}".format(kwargs["lun"], retval)
180 return retval
181
182
183# Adding the know instances to the list of helpers
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
Definition MsgStream.cpp:93

Member Data Documentation

◆ configured

bool GaudiPython.Persistency.RootPersistency.configured = False

Definition at line 130 of file Persistency.py.


The documentation for this class was generated from the following file: