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)
 
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 1258 of file validation.py.

Constructor & Destructor Documentation

◆ __init__()

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

Definition at line 1259 of file validation.py.

1259  def __init__(self, samples, newdir):
1260  self._samples = samples
1261  self._newdir = newdir
1262  if not os.path.exists(newdir):
1263  os.makedirs(newdir)
1264 
1265  self._htmlReport = html.HtmlReportDummy()
1266 
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 1297 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().

1297  def _doPlots(self, plotterFolder, dqmSubFolder, newsubdir, newdir, iProc, return_dict):
1298  fileList = plotterFolder.draw(directory=newdir, **self._plotterDrawArgs)
1299 
1300  if len(fileList) == 0:
1301  print("No object found in %s" % plotterFolder.getName())
1302 
1303  for tableCreator in plotterFolder.getTableCreators():
1304  self._htmlReport.addTable(tableCreator.create(self._openFiles, self._labels, dqmSubFolder))
1305 
1306  dups = _findDuplicates(fileList)
1307  if len(dups) > 0:
1308  print("Plotter produced multiple files with names", ", ".join(dups))
1309  print("Typically this is a naming problem in the plotter configuration")
1310  sys.exit(1)
1311 
1312  if self._plotterDrawArgs.get("separate", False):
1313  if not os.path.exists("%s/res"%newdir):
1314  os.makedirs("%s/res"%newdir)
1315  downloadables = ["index.php", "res/jquery-ui.js", "res/jquery.js", "res/style.css", "res/style.js", "res/theme.css"]
1316  for d in downloadables:
1317  if not os.path.exists("%s/%s" % (newdir,d)):
1318  urllib.request.urlretrieve("https://raw.githubusercontent.com/musella/php-plots/master/%s"%d, "%s/%s"%(newdir,d))
1319 
1320  print("Created plots in %s" % newdir)
1321  return_dict[iProc] = list(map(lambda n: n.replace(newdir, newsubdir), fileList))
1322 
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

◆ createHtmlReport()

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

Definition at line 1267 of file validation.py.

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

1267  def createHtmlReport(self, validationName=""):
1268  if hasattr(self._htmlReport, "write"):
1269  raise Exception("HTML report object already created. There is probably some logic error in the calling code.")
1270  self._htmlReport = html.HtmlReport(validationName, self._newdir)
1271  return self._htmlReport
1272 

◆ doPlots()

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

Definition at line 1273 of file validation.py.

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

◆ _labels

validation.SimpleValidation._labels
private

◆ _newdir

validation.SimpleValidation._newdir
private

◆ _openFiles

validation.SimpleValidation._openFiles
private

◆ _plotterDrawArgs

validation.SimpleValidation._plotterDrawArgs
private

◆ _samples

validation.SimpleValidation._samples
private

Definition at line 1260 of file validation.py.

◆ _subdirprefix

validation.SimpleValidation._subdirprefix
private

Definition at line 1277 of file validation.py.