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, nProc=0)
 
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
 
 _nProc
 
 _openFiles
 
 _plotterDrawArgs
 
 _samples
 
 _subdirprefix
 

Detailed Description

Definition at line 1332 of file validation.py.

Constructor & Destructor Documentation

◆ __init__()

def validation.SeparateValidation.__init__ (   self,
  samples,
  newdir,
  nProc = 0 
)

Definition at line 1335 of file validation.py.

1335  def __init__(self, samples, newdir, nProc=0):
1336  self._samples = samples
1337  self._newdir = newdir
1338  self._nProc = nProc
1339  if not os.path.exists(newdir):
1340  os.makedirs(newdir)
1341 
1342  self._htmlReport = html.HtmlReportDummy()
1343 
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 1374 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.

1374  def _doPlots(self, plotterFolder, dqmSubFolder, newsubdir, newdir, iProc, return_dict):
1375  fileList = plotterFolder.draw(directory=newdir, **self._plotterDrawArgs)
1376 
1377  # check if plots are produced
1378  if len(fileList) == 0:
1379  print("No object found in %s" % plotterFolder.getName())
1380 
1381  # check if there are duplicated plot
1382  dups = _findDuplicates(fileList)
1383  if len(dups) > 0:
1384  print("Plotter produced multiple files with names", ", ".join(dups))
1385  print("Typically this is a naming problem in the plotter configuration")
1386  sys.exit(1)
1387 
1388  linkList = []
1389  for f in fileList:
1390  if f[:f.rfind("/")] not in linkList :
1391  if str(f[:f.rfind("/")]) != str(newdir) :
1392  linkList.append(f[:f.rfind("/")])
1393 
1394  for tableCreator in plotterFolder.getTableCreators():
1395  self._htmlReport.addTable(tableCreator.create(self._openFiles, self._labels, dqmSubFolder))
1396 
1397  for link in linkList :
1398  if not os.path.exists("%s/res"%link):
1399  os.makedirs("%s/res"%link)
1400  downloadables = ["index.php", "res/jquery-ui.js", "res/jquery.js", "res/style.css", "res/style.js", "res/theme.css"]
1401  for d in downloadables:
1402  if not os.path.exists("%s/%s" % (link,d)):
1403  urllib.request.urlretrieve("https://raw.githubusercontent.com/rovere/php-plots/master/%s"%d, "%s/%s"%(link,d))
1404 
1405  print("Created separated plots in %s" % newdir)
1406  return_dict[iProc] = list(map(lambda n: n.replace(newdir, newsubdir), linkList))
1407 
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:1180
#define str(s)

◆ createHtmlReport()

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

Definition at line 1344 of file validation.py.

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

1344  def createHtmlReport(self, validationName=""):
1345  if hasattr(self._htmlReport, "write"):
1346  raise Exception("HTML report object already created. There is probably some logic error in the calling code.")
1347  self._htmlReport = html.HtmlReport(validationName, self._newdir)
1348  return self._htmlReport
1349 

◆ doPlots()

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

Definition at line 1350 of file validation.py.

1350  def doPlots(self, plotters, plotterDrawArgs={}, **kwargs):
1351  self._plotterDrawArgs = plotterDrawArgs
1352 
1353  for sample in self._samples:
1354  self._subdirprefix = sample.label()
1355  self._labels = sample.legendLabels()
1356  self._htmlReport.beginSample(sample)
1357 
1358  self._openFiles = []
1359  for f in sample.files():
1360  if os.path.exists(f):
1361  self._openFiles.append(ROOT.TFile.Open(f))
1362  else:
1363  print("File %s not found (from sample %s), ignoring it" % (f, sample.name()))
1364  self._openFiles.append(None)
1365 
1366  for plotter in plotters:
1367  _doPlotsForPlotter(self, plotter, sample, **kwargs)
1368 
1369  for tf in self._openFiles:
1370  if tf is not None:
1371  tf.Close()
1372  self._openFiles = []
1373 
def _doPlotsForPlotter(self, plotter, sample, limitSubFoldersOnlyTo=None)
Definition: validation.py:1190
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 1355 of file validation.py.

Referenced by validation.SeparateValidation._doPlots().

◆ _newdir

validation.SeparateValidation._newdir
private

Definition at line 1337 of file validation.py.

Referenced by validation.SeparateValidation.createHtmlReport().

◆ _nProc

validation.SeparateValidation._nProc
private

Definition at line 1338 of file validation.py.

◆ _openFiles

validation.SeparateValidation._openFiles
private

Definition at line 1358 of file validation.py.

Referenced by validation.SeparateValidation._doPlots().

◆ _plotterDrawArgs

validation.SeparateValidation._plotterDrawArgs
private

Definition at line 1351 of file validation.py.

Referenced by validation.SeparateValidation._doPlots().

◆ _samples

validation.SeparateValidation._samples
private

Definition at line 1336 of file validation.py.

◆ _subdirprefix

validation.SeparateValidation._subdirprefix
private

Definition at line 1354 of file validation.py.