The Gaudi Framework  v36r1 (3e2fb5a8)
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 113 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 118 of file Persistency.py.

118  def __init__(self):
119  """
120  Constructor.
121 
122  Declare the type of supported persistencies to the base class.
123  """
124  super(RootPersistency, self).__init__(
125  ["ROOT", "POOL_ROOT", "RootCnvSvc", "Gaudi::RootCnvSvc"])
126  self.configured = False
127 

Member Function Documentation

◆ configure()

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

Definition at line 128 of file Persistency.py.

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

◆ 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 139 of file Persistency.py.

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

◆ 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 165 of file Persistency.py.

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

Member Data Documentation

◆ configured

GaudiPython.Persistency.RootPersistency.configured

Definition at line 126 of file Persistency.py.


The documentation for this class was generated from the following file:
Aida2RootEx.configure
def configure(gaudi=None)
Definition: Aida2RootEx.py:114
gaudirun.type
type
Definition: gaudirun.py:154
GaudiPython.Persistency.add
def add(instance)
Definition: Persistency.py:49