The Gaudi Framework  v32r2 (46d42edc)
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 103 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 108 of file Persistency.py.

108  def __init__(self):
109  """
110  Constructor.
111 
112  Declare the type of supported persistencies to the base class.
113  """
114  super(RootPersistency, self).__init__(
115  ["ROOT", "POOL_ROOT", "RootCnvSvc", "Gaudi::RootCnvSvc"])
116  self.configured = False
117 

Member Function Documentation

◆ configure()

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

Definition at line 118 of file Persistency.py.

118  def configure(self, appMgr):
119  """
120  Basic configuration.
121  """
122  if not self.configured:
123  # instantiate the required services
124  appMgr.service('Gaudi::RootCnvSvc/RootCnvSvc')
125  eps = appMgr.service('EventPersistencySvc')
126  eps.CnvServices += ['RootCnvSvc']
127  self.configured = True
128 

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

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

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

155  def formatOutput(self, filename, **kwargs):
156  '''
157  Translate a filename in an output description.
158 
159  @param filenames: the list of files
160  @param lun: Logical Unit for Event Tag Collection outputs (optional)
161  '''
162  if not self.configured:
163  raise PersistencyError("Persistency not configured")
164  retval = str(
165  FileDescription(filename, 'RECREATE', 'Gaudi::RootCnvSvc'))
166  if 'lun' in kwargs:
167  retval = "%s %s" % (kwargs['lun'], retval)
168  return retval
169 
170 
171 # Adding the know instances to the list of helpers
172 add(RootPersistency())

Member Data Documentation

◆ configured

GaudiPython.Persistency.RootPersistency.configured

Definition at line 116 of file Persistency.py.


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