Skip to content

Commit

Permalink
Refactored the code. Refs #7112.
Browse files Browse the repository at this point in the history
  • Loading branch information
wdzhou committed May 20, 2013
1 parent 9881a58 commit c23b7f5
Showing 1 changed file with 19 additions and 5 deletions.
Expand Up @@ -292,6 +292,7 @@ def PyExec(self):
preserveEvents = self.getProperty("PreserveEvents").value
normbycurrent = self.getProperty("NormalizeByCurrent").value
self._info = None
self._infodict = {}
self._chunks = self.getProperty("MaxChunkSize").value

self._splitws = self.getProperty("SplittersWorkspace").value
Expand Down Expand Up @@ -360,8 +361,6 @@ def PyExec(self):
returned = self._focusChunks(samRun, SUFFIX, filterWall, calib, self._splitws,
preserveEvents=preserveEvents, normByCurrent=normbycurrent)

self.log().information("DBx213: self._info.van = %d" % (self._info.van))

if returned.__class__.__name__ == "list":
# Returned with a list of workspaces
focusedwksplist = returned
Expand Down Expand Up @@ -389,8 +388,20 @@ def PyExec(self):
self.log().information("[DBx1136] Sample Run %s: number of events = %d" % (str(samRun), samRun.getNumberEvents()))
except Exception as e:
self.log().information("[DBx1136] Unable to get number of events of sample run %s. Error message: %s" % (str(samRun), str(e)))

self._info = self._getinfo(samRun)

# Get run number
samRunName = str(samRun)
if samRunName.count("_") > 0:
runnumber = int(samRunName.split("_")[1])
else:
runnumber = int(samRunName)

if self._infodict.has_key(runnumber):
self.log().information("[DB1022A] Found run number %d in info dict." % (runnumber))
self._info = self._infodict[runnumber]
else:
self.log().information("[DB1022B] Unable to find _info for run number %d in info dict. "% (runnumber))
self._info = self._getinfo(samRun)

# process the container
canRun = self.getProperty("BackgroundNumber").value
Expand Down Expand Up @@ -695,7 +706,10 @@ def _focusChunks(self, runnumber, extension, filterWall, calib, splitwksp=None,
temp.getNumberEvents(), str(temp)))

if self._info is None:
self._info = self._getinfo(temp)
if not self._infodict.has_key(int(runnumber)):
self._info = self._getinfo(temp)
self._infodict[int(runnumber)] = self._info
self.log().information("[DB1012] Add info for run number %d." % (int(runnumber)))

# Filtering...
tempwslist = []
Expand Down

0 comments on commit c23b7f5

Please sign in to comment.