The Gaudi Framework  v36r11 (bdb84f5f)
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 117 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 122 of file Persistency.py.

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

Member Function Documentation

◆ configure()

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

Definition at line 133 of file Persistency.py.

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

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

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

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

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

Member Data Documentation

◆ configured

GaudiPython.Persistency.RootPersistency.configured

Definition at line 131 of file Persistency.py.


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