2 Module to configure the persistency type in GaudiPython.
4 __author__ =
"Marco Clemencic <marco.clemencic@cern.ch>"
8 Base class for exceptions in PersistencyHelper.
14 Exception raised if the persistency type is not known to the module.
17 super(UnknownPersistency, self).
__init__(
"Unknown persistency type %r" % type_)
25 Return the PersistencyHerper implementing the given persistency type.
27 for i
in _implementations:
34 Function to extend the list of known helpers.
36 New helpers are added to the top of the list.
38 _implementations.insert(0, instance)
41 def __init__(self, filename, opt, svc, sel=None, collection=None, fun=None):
43 Class to hold/manipulate the file description.
45 @param filename: name of the file
46 @param opt: option (READ/CREATE/RECREATE/WRITE)
47 @param svc: conversion service (or selector)
48 @param sel: selection expression
49 @param collection: collection
50 @param fun: selection class
60 Return a list of pairs describing the instance.
70 Return the string representation of the file description to be passed
73 return " ".join([
"%s='%s'" % (k, v)
for k, v
in self.
__data__()
if v])
77 Base class for extensions to persistency configuration in GaudiPython.
81 Define the type of persistencies supported by the instance.
86 Returns True if the current instance understands the requested
89 return typ
in self.
types
93 Implementation of PersistencyHelper based on Gaudi::RootCnvSvc.
99 Declare the type of supported persistencies to the base class.
101 super(RootPersistency, self).
__init__([
"ROOT",
"POOL_ROOT",
102 "RootCnvSvc",
"Gaudi::RootCnvSvc"])
111 appMgr.service(
'Gaudi::RootCnvSvc/RootCnvSvc')
112 eps = appMgr.service (
'EventPersistencySvc' )
113 eps.CnvServices += [
'RootCnvSvc']
118 Translate a list of file names in a list of input descriptions.
120 The optional parameters 'collection', 'sel' and 'fun' should be used to
121 configure Event Tag Collection inputs.
123 @param filenames: the list of files
127 if type(filenames)
is str:
128 filenames = [filenames]
131 fileargs = dict([(k, kwargs[k])
132 for k
in [
"collection",
"sel",
"fun"]
136 svc =
'Gaudi::RootCnvSvc'
138 svc =
'Gaudi::RootEvtSelector'
145 Translate a filename in an output description.
147 @param filenames: the list of files
148 @param lun: Logical Unit for Event Tag Collection outputs (optional)
152 retval = str(
FileDescription(filename,
'RECREATE',
'Gaudi::RootCnvSvc'))
154 retval =
"%s %s" % (kwargs[
'lun'], retval)
struct GAUDI_API map
Parametrisation class for map-like implementation.