| # Gaudi Framework, version v25r0 |

Home |  | Generated: Mon Feb 17 2014

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Public Attributes | List of all members
GaudiPython.Persistency.RootPersistency Class Reference
Inheritance diagram for GaudiPython.Persistency.RootPersistency:
[legend]
Collaboration diagram for GaudiPython.Persistency.RootPersistency:
[legend]

## Public Member Functions
def | __init__
def | configure
def | formatInput
def | formatOutput
Public Member Functions inherited from GaudiPython.Persistency.PersistencyHelper
def | __init__
def | handle

## Public Attributes
| configured
Public Attributes inherited from GaudiPython.Persistency.PersistencyHelper
| types

## Detailed Description

    Implementation of PersistencyHelper based on Gaudi::RootCnvSvc.

Definition at line 91 of file Persistency.py.

## Constructor & Destructor Documentation

def GaudiPython.Persistency.RootPersistency.__init__ | ( |  | self | ) |

    Constructor.

    Declare the type of supported persistencies to the base class.

Definition at line 95 of file Persistency.py.

95
96 def __init__(self):
97 """
98 Constructor.
99
100 Declare the type of supported persistencies to the base class.
101 """
102 super(RootPersistency, self).__init__(["ROOT", "POOL_ROOT",
103 "RootCnvSvc", "Gaudi::RootCnvSvc"])
104 self.configured = False

## Member Function Documentation

def GaudiPython.Persistency.RootPersistency.configure | ( |  | self,
|  |  | appMgr
| ) |  |

    Basic configuration.

Definition at line 105 of file Persistency.py.

105
106 def configure(self, appMgr):
107 """
108 Basic configuration.
109 """
110 if not self.configured:
111 # instantiate the required services
112 appMgr.service('Gaudi::RootCnvSvc/RootCnvSvc')
113 eps = appMgr.service ( 'EventPersistencySvc' )
114 eps.CnvServices += ['RootCnvSvc']
115 self.configured = True

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

116
117 def formatInput(self, filenames, **kwargs):
118 '''
119 Translate a list of file names in a list of input descriptions.
120
121 The optional parameters 'collection', 'sel' and 'fun' should be used to
122 configure Event Tag Collection inputs.
123
124 @param filenames: the list of files
125 '''
126 if not self.configured:
127 raise PersistencyError("Persistency not configured")
128 if type(filenames) is str:
129 filenames = [filenames]
130 fileargs = {}
131 # check if we are accessing a collection
132 fileargs = dict([(k, kwargs[k])
133 for k in ["collection", "sel", "fun"]
134 if k in kwargs])
135 if fileargs:
136 # is a collection
137 svc = 'Gaudi::RootCnvSvc'
138 else:
139 svc = 'Gaudi::RootEvtSelector'
140 return map(str,
141 [FileDescription(f, 'READ', svc, **fileargs)
142 for f in filenames])

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

143
144 def formatOutput(self, filename, **kwargs):
145 '''
146 Translate a filename in an output description.
147
148 @param filenames: the list of files
149 @param lun: Logical Unit for Event Tag Collection outputs (optional)
150 '''
151 if not self.configured:
152 raise PersistencyError("Persistency not configured")
153 retval = str(FileDescription(filename, 'RECREATE', 'Gaudi::RootCnvSvc'))
154 if 'lun' in kwargs:
155 retval = "%s %s" % (kwargs['lun'], retval)
156 return retval
157
158 # Adding the know instances to the list of helpers
159 add(RootPersistency())

## Member Data Documentation

GaudiPython.Persistency.RootPersistency.configured

Definition at line 103 of file Persistency.py.

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

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v25r0/GaudiPython/python/GaudiPython/Persistency.py