CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
validation.SimpleValidation 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 1266 of file validation.py.

Constructor & Destructor Documentation

◆ __init__()

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

Definition at line 1267 of file validation.py.

1267  def __init__(self, samples, newdir, nProc=0):
1268  self._samples = samples
1269  self._newdir = newdir
1270  self._nProc = nProc
1271  if not os.path.exists(newdir):
1272  os.makedirs(newdir)
1273 
1274  self._htmlReport = html.HtmlReportDummy()
1275 
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.SimpleValidation._doPlots (   self,
  plotterFolder,
  dqmSubFolder,
  newsubdir,
  newdir,
  iProc,
  return_dict 
)
private

Definition at line 1306 of file validation.py.

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

1306  def _doPlots(self, plotterFolder, dqmSubFolder, newsubdir, newdir, iProc, return_dict):
1307  fileList = plotterFolder.draw(directory=newdir, **self._plotterDrawArgs)
1308 
1309  if len(fileList) == 0:
1310  print("No object found in %s" % plotterFolder.getName())
1311 
1312  for tableCreator in plotterFolder.getTableCreators():
1313  self._htmlReport.addTable(tableCreator.create(self._openFiles, self._labels, dqmSubFolder))
1314 
1315  dups = _findDuplicates(fileList)
1316  if len(dups) > 0:
1317  print("Plotter produced multiple files with names", ", ".join(dups))
1318  print("Typically this is a naming problem in the plotter configuration")
1319  sys.exit(1)
1320 
1321  if self._plotterDrawArgs.get("separate", False):
1322  if not os.path.exists("%s/res"%newdir):
1323  os.makedirs("%s/res"%newdir)
1324  downloadables = ["index.php", "res/jquery-ui.js", "res/jquery.js", "res/style.css", "res/style.js", "res/theme.css"]
1325  for d in downloadables:
1326  if not os.path.exists("%s/%s" % (newdir,d)):
1327  urllib.request.urlretrieve("https://raw.githubusercontent.com/musella/php-plots/master/%s"%d, "%s/%s"%(newdir,d))
1328 
1329  print("Created plots in %s" % newdir)
1330  return_dict[iProc] = list(map(lambda n: n.replace(newdir, newsubdir), fileList))
1331 
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
static std::string join(char **cmd)
Definition: RemoteFile.cc:21
def _findDuplicates(lst)
Definition: validation.py:1180

◆ createHtmlReport()

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

Definition at line 1276 of file validation.py.

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

1276  def createHtmlReport(self, validationName=""):
1277  if hasattr(self._htmlReport, "write"):
1278  raise Exception("HTML report object already created. There is probably some logic error in the calling code.")
1279  self._htmlReport = html.HtmlReport(validationName, self._newdir)
1280  return self._htmlReport
1281 

◆ doPlots()

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

Definition at line 1282 of file validation.py.

1282  def doPlots(self, plotters, plotterDrawArgs={}, **kwargs):
1283  self._plotterDrawArgs = plotterDrawArgs
1284 
1285  for sample in self._samples:
1286  self._subdirprefix = sample.label()
1287  self._labels = sample.legendLabels()
1288  self._htmlReport.beginSample(sample)
1289 
1290  self._openFiles = []
1291  for f in sample.files():
1292  if os.path.exists(f):
1293  self._openFiles.append(ROOT.TFile.Open(f))
1294  else:
1295  print("File %s not found (from sample %s), ignoring it" % (f, sample.name()))
1296  self._openFiles.append(None)
1297 
1298  for plotter in plotters:
1299  _doPlotsForPlotter(self, plotter, sample, **kwargs)
1300 
1301  for tf in self._openFiles:
1302  if tf is not None:
1303  tf.Close()
1304  self._openFiles = []
1305 
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.SimpleValidation._htmlReport
private

◆ _labels

validation.SimpleValidation._labels
private

◆ _newdir

validation.SimpleValidation._newdir
private

◆ _nProc

validation.SimpleValidation._nProc
private

Definition at line 1270 of file validation.py.

◆ _openFiles

validation.SimpleValidation._openFiles
private

◆ _plotterDrawArgs

validation.SimpleValidation._plotterDrawArgs
private

◆ _samples

validation.SimpleValidation._samples
private

Definition at line 1268 of file validation.py.

◆ _subdirprefix

validation.SimpleValidation._subdirprefix
private

Definition at line 1286 of file validation.py.