CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
validation.SeparateValidation Class Reference

Public Member Functions

def __init__ (self, samples, newdir)
 
def createHtmlReport (self, validationName="")
 
def doPlots (self, plotters, plotterDrawArgs={}, kwargs)
 

Private Member Functions

def _doPlots (self, plotterFolder, dqmSubFolder, newsubdir, newdir, iProc, return_dict)
 

Private Attributes

 _htmlReport
 
 _labels
 
 _newdir
 
 _openFiles
 
 _plotterDrawArgs
 
 _samples
 
 _subdirprefix
 

Detailed Description

Definition at line 1323 of file validation.py.

Constructor & Destructor Documentation

◆ __init__()

def validation.SeparateValidation.__init__ (   self,
  samples,
  newdir 
)

Definition at line 1326 of file validation.py.

1326  def __init__(self, samples, newdir):
1327  self._samples = samples
1328  self._newdir = newdir
1329  if not os.path.exists(newdir):
1330  os.makedirs(newdir)
1331 
1332  self._htmlReport = html.HtmlReportDummy()
1333 
def __init__(self, dataset, job_number, job_id, job_name, isDA, isMC, applyBOWS, applyEXTRACOND, extraconditions, runboundary, lumilist, intlumi, maxevents, gt, allFromGT, alignmentDB, alignmentTAG, apeDB, apeTAG, bowDB, bowTAG, vertextype, tracktype, refittertype, ttrhtype, applyruncontrol, ptcut, CMSSW_dir, the_dir)

Member Function Documentation

◆ _doPlots()

def validation.SeparateValidation._doPlots (   self,
  plotterFolder,
  dqmSubFolder,
  newsubdir,
  newdir,
  iProc,
  return_dict 
)
private

Definition at line 1364 of file validation.py.

References validation._findDuplicates(), validation.SimpleValidation._htmlReport, validation.SeparateValidation._htmlReport, DigiInvestigatorHistogramMaker._labels, SeedMultiplicityAnalyzer._labels, hitfit::Constraint_Intermed_Labels._labels, validation.SimpleValidation._labels, validation.SeparateValidation._labels, Config.ProcessAcceleratorTest._labels, Config.ProcessAcceleratorTest2._labels, plotting.PlotFolder._labels, validation.SimpleValidation._openFiles, validation.SeparateValidation._openFiles, validation.Validation._plotterDrawArgs, validation.SimpleValidation._plotterDrawArgs, validation.SeparateValidation._plotterDrawArgs, join(), genParticles_cff.map, print(), and str.

1364  def _doPlots(self, plotterFolder, dqmSubFolder, newsubdir, newdir, iProc, return_dict):
1365  fileList = plotterFolder.draw(directory=newdir, **self._plotterDrawArgs)
1366 
1367  # check if plots are produced
1368  if len(fileList) == 0:
1369  print("No object found in %s" % plotterFolder.getName())
1370 
1371  # check if there are duplicated plot
1372  dups = _findDuplicates(fileList)
1373  if len(dups) > 0:
1374  print("Plotter produced multiple files with names", ", ".join(dups))
1375  print("Typically this is a naming problem in the plotter configuration")
1376  sys.exit(1)
1377 
1378  linkList = []
1379  for f in fileList:
1380  if f[:f.rfind("/")] not in linkList :
1381  if str(f[:f.rfind("/")]) != str(newdir) :
1382  linkList.append(f[:f.rfind("/")])
1383 
1384  for tableCreator in plotterFolder.getTableCreators():
1385  self._htmlReport.addTable(tableCreator.create(self._openFiles, self._labels, dqmSubFolder))
1386 
1387  for link in linkList :
1388  if not os.path.exists("%s/res"%link):
1389  os.makedirs("%s/res"%link)
1390  downloadables = ["index.php", "res/jquery-ui.js", "res/jquery.js", "res/style.css", "res/style.js", "res/theme.css"]
1391  for d in downloadables:
1392  if not os.path.exists("%s/%s" % (link,d)):
1393  urllib.request.urlretrieve("https://raw.githubusercontent.com/rovere/php-plots/master/%s"%d, "%s/%s"%(link,d))
1394 
1395  print("Created separated plots in %s" % newdir)
1396  return_dict[iProc] = list(map(lambda n: n.replace(newdir, newsubdir), linkList))
1397 
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
static std::string join(char **cmd)
Definition: RemoteFile.cc:19
def _findDuplicates(lst)
Definition: validation.py:1179
#define str(s)

◆ createHtmlReport()

def validation.SeparateValidation.createHtmlReport (   self,
  validationName = "" 
)

Definition at line 1334 of file validation.py.

References validation.SimpleValidation._htmlReport, validation.SeparateValidation._htmlReport, validation.SimpleValidation._newdir, and validation.SeparateValidation._newdir.

1334  def createHtmlReport(self, validationName=""):
1335  if hasattr(self._htmlReport, "write"):
1336  raise Exception("HTML report object already created. There is probably some logic error in the calling code.")
1337  self._htmlReport = html.HtmlReport(validationName, self._newdir)
1338  return self._htmlReport
1339 

◆ doPlots()

def validation.SeparateValidation.doPlots (   self,
  plotters,
  plotterDrawArgs = {},
  kwargs 
)

Definition at line 1340 of file validation.py.

1340  def doPlots(self, plotters, plotterDrawArgs={}, **kwargs):
1341  self._plotterDrawArgs = plotterDrawArgs
1342 
1343  for sample in self._samples:
1344  self._subdirprefix = sample.label()
1345  self._labels = sample.legendLabels()
1346  self._htmlReport.beginSample(sample)
1347 
1348  self._openFiles = []
1349  for f in sample.files():
1350  if os.path.exists(f):
1351  self._openFiles.append(ROOT.TFile.Open(f))
1352  else:
1353  print("File %s not found (from sample %s), ignoring it" % (f, sample.name()))
1354  self._openFiles.append(None)
1355 
1356  for plotter in plotters:
1357  _doPlotsForPlotter(self, plotter, sample, **kwargs)
1358 
1359  for tf in self._openFiles:
1360  if tf is not None:
1361  tf.Close()
1362  self._openFiles = []
1363 
def _doPlotsForPlotter(self, plotter, sample, limitSubFoldersOnlyTo=None)
Definition: validation.py:1189
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47

Member Data Documentation

◆ _htmlReport

validation.SeparateValidation._htmlReport
private

◆ _labels

validation.SeparateValidation._labels
private

Definition at line 1345 of file validation.py.

Referenced by validation.SeparateValidation._doPlots().

◆ _newdir

validation.SeparateValidation._newdir
private

Definition at line 1328 of file validation.py.

Referenced by validation.SeparateValidation.createHtmlReport().

◆ _openFiles

validation.SeparateValidation._openFiles
private

Definition at line 1348 of file validation.py.

Referenced by validation.SeparateValidation._doPlots().

◆ _plotterDrawArgs

validation.SeparateValidation._plotterDrawArgs
private

Definition at line 1341 of file validation.py.

Referenced by validation.SeparateValidation._doPlots().

◆ _samples

validation.SeparateValidation._samples
private

Definition at line 1327 of file validation.py.

◆ _subdirprefix

validation.SeparateValidation._subdirprefix
private

Definition at line 1344 of file validation.py.