Skip to content

Commit

Permalink
Merge pull request #35319 from lecriste/parallelValidation
Browse files Browse the repository at this point in the history
[MultiTrackValidator] Fix #35225
  • Loading branch information
cmsbuild committed Sep 21, 2021
2 parents 9b78054 + c85ee6e commit 6a1fe83
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
9 changes: 4 additions & 5 deletions Validation/RecoTrack/python/plotting/plotting.py
Expand Up @@ -49,8 +49,7 @@ def _setStyle():
def _getObject(tdirectory, name):
obj = tdirectory.Get(name)
if not obj:
if verbose:
print("Did not find {obj} from {dir}".format(obj=name, dir=tdirectory.GetPath()))
print("Did not find {obj} from {dir}".format(obj=name, dir=tdirectory.GetPath()))
return None
return obj

Expand Down Expand Up @@ -1073,7 +1072,7 @@ def create(self, tdirectory):
return result

class AggregateHistos:
"""Class to create a histogram by aggregaging integrals of another histoggrams."""
"""Class to create a histogram by aggregating integrals of another histogram."""
def __init__(self, name, mapping, normalizeTo=None):
"""Constructor.
Expand Down Expand Up @@ -1935,7 +1934,7 @@ def _modifyHisto(th1, profileX):
if self._fallback is not None:
self._histograms = list(map(_modifyHisto, self._histograms, profileX))
else:
self._histograms =list(map(lambda h: _modifyHisto(h, self._profileX), self._histograms))
self._histograms = list(map(lambda h: _modifyHisto(h, self._profileX), self._histograms))
if requireAllHistograms and None in self._histograms:
self._histograms = [None]*len(self._histograms)

Expand Down Expand Up @@ -2497,7 +2496,7 @@ def _save(self, canvas, saveFormat, prefix=None, postfix=None, single=False, dir
# Save the canvas to file and clear
name = self._name
if not os.path.exists(directory+'/'+name):
os.makedirs(directory+'/'+name)
os.makedirs(directory+'/'+name, exist_ok=True)
if prefix is not None:
name = prefix+name
if postfix is not None:
Expand Down
12 changes: 7 additions & 5 deletions Validation/RecoTrack/python/plotting/validation.py
Expand Up @@ -978,6 +978,7 @@ def _doPlots(self, sample, harvestedFile, plotterFolder, dqmSubFolder, htmlRepor
refValFile.Close()

if len(fileList) == 0:
print("No object found in %s" % plotterFolder.getName())
return []

dups = _findDuplicates(fileList)
Expand Down Expand Up @@ -1044,6 +1045,7 @@ def _doPlotsFastFull(self, fastSample, fullSample, plotterFolder, dqmSubFolder,
fastValFile.Close()

if len(fileList) == 0:
print("No object found in %s" % plotterFolder.getName())
return []

dups = _findDuplicates(fileList)
Expand Down Expand Up @@ -1111,6 +1113,7 @@ def _doPlotsPileup(self, pu140Sample, pu200Sample, plotterFolder, dqmSubFolder,
pu140ValFile.Close()

if len(fileList) == 0:
print("No object found in %s" % plotterFolder.getName())
return []

dups = _findDuplicates(fileList)
Expand Down Expand Up @@ -1294,13 +1297,12 @@ def _doPlots(self, plotterFolder, dqmSubFolder, newsubdir, newdir, iProc, return
plotterFolder.create(self._openFiles, self._labels, dqmSubFolder)
fileList = plotterFolder.draw(directory=newdir, **self._plotterDrawArgs)

if len(fileList) == 0:
print("No object found in %s" % plotterFolder.getName())

for tableCreator in plotterFolder.getTableCreators():
self._htmlReport.addTable(tableCreator.create(self._openFiles, self._labels, dqmSubFolder))


if len(fileList) == 0:
return fileList

dups = _findDuplicates(fileList)
if len(dups) > 0:
print("Plotter produced multiple files with names", ", ".join(dups))
Expand Down Expand Up @@ -1365,7 +1367,7 @@ def _doPlots(self, plotterFolder, dqmSubFolder, newsubdir, newdir, iProc, return

# check if plots are produced
if len(fileList) == 0:
return fileList
print("No object found in %s" % plotterFolder.getName())

# check if there are duplicated plot
dups = _findDuplicates(fileList)
Expand Down

0 comments on commit 6a1fe83

Please sign in to comment.