CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
validation.SimpleValidation Class Reference

Public Member Functions

def __init__
 
def createHtmlReport
 
def doPlots
 

Private Member Functions

def _doPlots
 

Private Attributes

 _htmlReport
 
 _labels
 
 _newdir
 
 _openFiles
 
 _plotterDrawArgs
 
 _samples
 
 _subdirprefix
 

Detailed Description

Definition at line 1258 of file validation.py.

Constructor & Destructor Documentation

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

Definition at line 1259 of file validation.py.

1260  def __init__(self, samples, newdir):
1261  self._samples = samples
1262  self._newdir = newdir
1263  if not os.path.exists(newdir):
1264  os.makedirs(newdir)

Member Function Documentation

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

Definition at line 1297 of file validation.py.

References validation._findDuplicates(), DigiInvestigatorHistogramMaker._labels, SeedMultiplicityAnalyzer._labels, hitfit::Constraint_Intermed_Labels._labels, validation.SimpleValidation._labels, plotting.PlotFolder._labels, validation.SimpleValidation._openFiles, validation.Validation._plotterDrawArgs, validation.SimpleValidation._plotterDrawArgs, join(), and print().

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

Definition at line 1267 of file validation.py.

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

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

Definition at line 1273 of file validation.py.

1274  def doPlots(self, plotters, plotterDrawArgs={}, **kwargs):
1275  self._plotterDrawArgs = plotterDrawArgs
1276 
1277  for sample in self._samples:
1278  self._subdirprefix = sample.label()
1279  self._labels = sample.legendLabels()
1280  self._htmlReport.beginSample(sample)
1282  self._openFiles = []
1283  for f in sample.files():
1284  if os.path.exists(f):
1285  self._openFiles.append(ROOT.TFile.Open(f))
1286  else:
1287  print("File %s not found (from sample %s), ignoring it" % (f, sample.name()))
1288  self._openFiles.append(None)
1289 
1290  for plotter in plotters:
1291  _doPlotsForPlotter(self, plotter, sample, **kwargs)
1292 
1293  for tf in self._openFiles:
1294  if tf is not None:
1295  tf.Close()
1296  self._openFiles = []
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
def _doPlotsForPlotter
Definition: validation.py:1189

Member Data Documentation

validation.SimpleValidation._htmlReport
private

Definition at line 1265 of file validation.py.

Referenced by validation.SimpleValidation.createHtmlReport(), and validation.SeparateValidation.createHtmlReport().

validation.SimpleValidation._labels
private

Definition at line 1278 of file validation.py.

Referenced by validation.SimpleValidation._doPlots(), and validation.SeparateValidation._doPlots().

validation.SimpleValidation._newdir
private

Definition at line 1261 of file validation.py.

Referenced by validation.SimpleValidation.createHtmlReport(), and validation.SeparateValidation.createHtmlReport().

validation.SimpleValidation._openFiles
private

Definition at line 1281 of file validation.py.

Referenced by validation.SimpleValidation._doPlots(), and validation.SeparateValidation._doPlots().

validation.SimpleValidation._plotterDrawArgs
private

Definition at line 1274 of file validation.py.

Referenced by validation.SimpleValidation._doPlots(), and validation.SeparateValidation._doPlots().

validation.SimpleValidation._samples
private

Definition at line 1260 of file validation.py.

validation.SimpleValidation._subdirprefix
private

Definition at line 1277 of file validation.py.