The Gaudi Framework  v39r3 (979e3109)
GaudiPython.Persistency.RootPersistency Class Reference
Inheritance diagram for GaudiPython.Persistency.RootPersistency:
Collaboration diagram for GaudiPython.Persistency.RootPersistency:

Public Member Functions

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

Public Attributes

 configured
 
- Public Attributes inherited from GaudiPython.Persistency.PersistencyHelper
 types
 

Detailed Description

Implementation of PersistencyHelper based on Gaudi::RootCnvSvc.

Definition at line 118 of file Persistency.py.

Constructor & Destructor Documentation

◆ __init__()

def 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(RootPersistency, self).__init__(
130  ["ROOT", "POOL_ROOT", "RootCnvSvc", "Gaudi::RootCnvSvc"]
131  )
132  self.configured = False
133 

Member Function Documentation

◆ configure()

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

Definition at line 134 of file Persistency.py.

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

◆ formatInput()

def 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 145 of file Persistency.py.

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

◆ formatOutput()

def 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 170 of file Persistency.py.

170  def formatOutput(self, filename, **kwargs):
171  """
172  Translate a filename in an output description.
173 
174  @param filenames: the list of files
175  @param lun: Logical Unit for Event Tag Collection outputs (optional)
176  """
177  if not self.configured:
178  raise PersistencyError("Persistency not configured")
179  retval = str(FileDescription(filename, "RECREATE", "Gaudi::RootCnvSvc"))
180  if "lun" in kwargs:
181  retval = "%s %s" % (kwargs["lun"], retval)
182  return retval
183 
184 
185 # Adding the know instances to the list of helpers
186 add(RootPersistency())

Member Data Documentation

◆ configured

GaudiPython.Persistency.RootPersistency.configured

Definition at line 132 of file Persistency.py.


The documentation for this class was generated from the following file:
ExtendedProperties.configure
def configure(gaudi=None)
Definition: ExtendedProperties.py:40
GaudiPython.Persistency.add
def add(instance)
Definition: Persistency.py:50