12 Module to configure the persistency type in GaudiPython.
14 __author__ =
"Marco Clemencic <marco.clemencic@cern.ch>"
19 Base class for exceptions in PersistencyHelper.
26 Exception raised if the persistency type is not known to the module.
30 super(UnknownPersistency,
31 self).
__init__(
"Unknown persistency type %r" % type_)
41 Return the PersistencyHerper implementing the given persistency type.
43 for i
in _implementations:
51 Function to extend the list of known helpers.
53 New helpers are added to the top of the list.
55 _implementations.insert(0, instance)
59 def __init__(self, filename, opt, svc, sel=None, collection=None,
62 Class to hold/manipulate the file description.
64 @param filename: name of the file
65 @param opt: option (READ/CREATE/RECREATE/WRITE)
66 @param svc: conversion service (or selector)
67 @param sel: selection expression
68 @param collection: collection
69 @param fun: selection class
80 Return a list of pairs describing the instance.
82 return [(
"DATAFILE", self.
filename), (
"OPT", self.
opt),
83 (
"SVC", self.
svc), (
"SEL", self.
sel),
88 Return the string representation of the file description to be passed
91 return " ".join([
"%s='%s'" % (k, v)
for k, v
in self.
__data__()
if v])
96 Base class for extensions to persistency configuration in GaudiPython.
101 Define the type of persistencies supported by the instance.
107 Returns True if the current instance understands the requested
110 return typ
in self.
types
115 Implementation of PersistencyHelper based on Gaudi::RootCnvSvc.
122 Declare the type of supported persistencies to the base class.
124 super(RootPersistency, self).
__init__(
125 [
"ROOT",
"POOL_ROOT",
"RootCnvSvc",
"Gaudi::RootCnvSvc"])
134 appMgr.service(
'Gaudi::RootCnvSvc/RootCnvSvc')
135 eps = appMgr.service(
'EventPersistencySvc')
136 eps.CnvServices += [
'RootCnvSvc']
141 Translate a list of file names in a list of input descriptions.
143 The optional parameters 'collection', 'sel' and 'fun' should be used to
144 configure Event Tag Collection inputs.
146 @param filenames: the list of files
150 if type(filenames)
is str:
151 filenames = [filenames]
154 fileargs = dict([(k, kwargs[k])
for k
in [
"collection",
"sel",
"fun"]
158 svc =
'Gaudi::RootCnvSvc'
160 svc =
'Gaudi::RootEvtSelector'
167 Translate a filename in an output description.
169 @param filenames: the list of files
170 @param lun: Logical Unit for Event Tag Collection outputs (optional)
177 retval =
"%s %s" % (kwargs[
'lun'], retval)