The Gaudi Framework  v41r0 (bdbe7744)
Loading...
Searching...
No Matches
GaudiMP.GMPBase.MiniWriter Class Reference

Public Member Functions

 __init__ (self, writer, wType, config)
 getNewName (self, replaceThis, withThis, extra="")
 getItemLists (self, config)
 set (self, key, output)
 __repr__ (self)

Public Attributes

 w = writer
 wType = wType
 key = None
 output = None
 ItemList = None
 OptItemList = None
 wName = writer.getName()
 woutput = None
 datasvcName = None
 svcOutput = None

Detailed Description

A class to represent a writer in the GaudiPython configuration
It can be non-trivial to access the name of the output file; it may be
specified in the DataSvc, or just on the writer, may be a list, or string
Also, there are three different types of writer (events, records, tuples)
so this bootstrap class provides easy access to this info while configuring

Definition at line 110 of file GMPBase.py.

Constructor & Destructor Documentation

◆ __init__()

GaudiMP.GMPBase.MiniWriter.__init__ ( self,
writer,
wType,
config )

Definition at line 119 of file GMPBase.py.

119 def __init__(self, writer, wType, config):
120 self.w = writer
121 self.wType = wType
122 # set parameters for directly accessing the correct
123 # part of the configuration, so that later, we can do
124 # config[ key ].Output = modified(output)
125 self.key = None
126 self.output = None
127 self.ItemList = None
128 self.OptItemList = None
129 #
130 self.wName = writer.getName()
131 # Now process the Writer, find where the output is named
132 self.woutput = None
133 self.datasvcName = None
134 self.svcOutput = None
135 if hasattr(self.w, "Output"):
136 self.woutput = self.w.Output
137 self.getItemLists(config)
138 self.set(self.wName, self.w.Output)
139 return
140 else:
141 # if there is no output file, get it via the datasvc
142 # (every writer always has a datasvc property)
143 self.datasvcName = self.w.EvtDataSvc
144 datasvc = config[self.datasvcName]
145 if hasattr(datasvc, "Output"):
146 self.getItemLists(config)
147 self.set(self.datasvcName, datasvc.Output)
148 return
149

Member Function Documentation

◆ __repr__()

GaudiMP.GMPBase.MiniWriter.__repr__ ( self)

Definition at line 193 of file GMPBase.py.

193 def __repr__(self):
194 s = ""
195 line = "-" * 80
196 s += line + "\n"
197 s += f"Writer : {self.wName}\n"
198 s += f"Writer Type : {self.wType}\n"
199 s += f"Writer Output : {self.output}\n"
200 s += f"DataSvc : {self.datasvcName}\n"
201 s += f"DataSvc Output : {self.svcOutput}\n"
202 s += "\n"
203 s += f"Key for config : {self.key}\n"
204 s += f"Output File : {self.output}\n"
205 s += f"ItemList : {self.ItemList}\n"
206 s += f"OptItemList : {self.OptItemList}\n"
207 s += line + "\n"
208 return s
209
210
211# =============================================================================
212
213

◆ getItemLists()

GaudiMP.GMPBase.MiniWriter.getItemLists ( self,
config )

Definition at line 171 of file GMPBase.py.

171 def getItemLists(self, config):
172 # the item list
173 if hasattr(self.w, "ItemList"):
174 self.ItemList = self.w.ItemList
175 else:
176 datasvc = config[self.w.EvtDataSvc]
177 if hasattr(datasvc, "ItemList"):
178 self.ItemList = datasvc.ItemList
179 # The option item list; possibly not a valid variable
180 if hasattr(self.w, "OptItemList"):
181 self.OptItemList = self.w.OptItemList
182 else:
183 datasvc = config[self.w.EvtDataSvc]
184 if hasattr(datasvc, "OptItemList"):
185 self.OptItemList = datasvc.OptItemList
186 return
187

◆ getNewName()

GaudiMP.GMPBase.MiniWriter.getNewName ( self,
replaceThis,
withThis,
extra = "" )

Definition at line 150 of file GMPBase.py.

150 def getNewName(self, replaceThis, withThis, extra=""):
151 # replace one pattern in the output name string
152 # with another, and return the Output name
153 # It *might* be in a list, so check for this
154 #
155 # @param extra : might need to add ROOT flags
156 # i.e.: OPT='RECREATE', or such
157 assert replaceThis.__class__.__name__ == "str"
158 assert withThis.__class__.__name__ == "str"
159 old = self.output
160 lst = False
161 if old.__class__.__name__ == "list":
162 old = self.output[0]
163 lst = True
164 new = old.replace(replaceThis, withThis)
165 new += extra
166 if lst:
167 return [new]
168 else:
169 return new
170

◆ set()

GaudiMP.GMPBase.MiniWriter.set ( self,
key,
output )

Definition at line 188 of file GMPBase.py.

188 def set(self, key, output):
189 self.key = key
190 self.output = output
191 return
192

Member Data Documentation

◆ datasvcName

GaudiMP.GMPBase.MiniWriter.datasvcName = None

Definition at line 133 of file GMPBase.py.

◆ ItemList

GaudiMP.GMPBase.MiniWriter.ItemList = None

Definition at line 127 of file GMPBase.py.

◆ key

GaudiMP.GMPBase.MiniWriter.key = None

Definition at line 125 of file GMPBase.py.

◆ OptItemList

GaudiMP.GMPBase.MiniWriter.OptItemList = None

Definition at line 128 of file GMPBase.py.

◆ output

GaudiMP.GMPBase.MiniWriter.output = None

Definition at line 126 of file GMPBase.py.

◆ svcOutput

GaudiMP.GMPBase.MiniWriter.svcOutput = None

Definition at line 134 of file GMPBase.py.

◆ w

GaudiMP.GMPBase.MiniWriter.w = writer

Definition at line 120 of file GMPBase.py.

◆ wName

GaudiMP.GMPBase.MiniWriter.wName = writer.getName()

Definition at line 130 of file GMPBase.py.

◆ woutput

GaudiMP.GMPBase.MiniWriter.woutput = None

Definition at line 132 of file GMPBase.py.

◆ wType

GaudiMP.GMPBase.MiniWriter.wType = wType

Definition at line 121 of file GMPBase.py.


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