CMS 3D CMS Logo

Classes | Functions | Variables
validation Namespace Reference

Classes

class  Sample
 
class  SimpleSample
 
class  SimpleValidation
 
class  Validation
 

Functions

def _copyDir (src, dst)
 
def _copySubDir (oldfile, newfile, basenames, dirname)
 
def _findDuplicates (lst)
 
def _getGlobalTag (sample, release)
 
def _getRelValUrl (release)
 
def _processPlotsForSample (plotterFolder, sample)
 
def _stripRelease (release)
 

Variables

 _doBHadronSamples
 
 _doConversionSamples
 
 _doElectronSamples
 
 _globalTags
 
 _releasePostfixes
 
 _relvalUrls
 
 IgnoreCommandLineOptions
 

Function Documentation

def validation._copyDir (   src,
  dst 
)
private
Copy non-TTree objects from src TDirectory to dst TDirectory.

Definition at line 1127 of file validation.py.

Referenced by _copySubDir().

1127 def _copyDir(src, dst):
1128  """Copy non-TTree objects from src TDirectory to dst TDirectory."""
1129  keys = src.GetListOfKeys()
1130  for key in keys:
1131  classname = key.GetClassName()
1132  cl = ROOT.TClass.GetClass(classname)
1133  if not cl:
1134  continue
1135  if not (cl.InheritsFrom("TTree") and cl.InheritsFrom("TDirectory")):
1136  dst.cd()
1137  obj = key.ReadObj()
1138  obj.Write()
1139  obj.Delete()
1140 
def _copyDir(src, dst)
Definition: validation.py:1127
def validation._copySubDir (   oldfile,
  newfile,
  basenames,
  dirname 
)
private
Copy a subdirectory from oldfile to newfile.

Arguments:
oldfile   -- String for source TFile
newfile   -- String for destination TFile
basenames -- List of strings for base directories, first existing one is picked
dirname   -- String for directory name under the base directory

Definition at line 1092 of file validation.py.

References _copyDir(), join(), and split.

Referenced by validation.Validation._doPlots().

1092 def _copySubDir(oldfile, newfile, basenames, dirname):
1093  """Copy a subdirectory from oldfile to newfile.
1094 
1095  Arguments:
1096  oldfile -- String for source TFile
1097  newfile -- String for destination TFile
1098  basenames -- List of strings for base directories, first existing one is picked
1099  dirname -- String for directory name under the base directory
1100  """
1101  oldf = ROOT.TFile.Open(oldfile)
1102 
1103  dirold = None
1104  for basename in basenames:
1105  dirold = oldf.GetDirectory(basename)
1106  if dirold:
1107  break
1108  if not dirold:
1109  raise Exception("Did not find any of %s directories from file %s" % (",".join(basenames), oldfile))
1110  if dirname:
1111  d = dirold.Get(dirname)
1112  if not d:
1113  raise Exception("Did not find directory %s under %s" % (dirname, dirold.GetPath()))
1114  dirold = d
1115 
1116  newf = ROOT.TFile.Open(newfile, "RECREATE")
1117  dirnew = newf
1118  for d in basenames[0].split("/"):
1119  dirnew = dirnew.mkdir(d)
1120  if dirname:
1121  dirnew = dirnew.mkdir(dirname)
1122  _copyDir(dirold, dirnew)
1123 
1124  oldf.Close()
1125  return newf
1126 
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
def _copyDir(src, dst)
Definition: validation.py:1127
def _copySubDir(oldfile, newfile, basenames, dirname)
Definition: validation.py:1092
double split
Definition: MVATrainer.cc:139
def validation._findDuplicates (   lst)
private

Definition at line 1141 of file validation.py.

References list().

Referenced by validation.Validation._doPlots(), validation.SimpleValidation._doPlots(), validation.Validation._doPlotsFastFull(), and validation.Validation._doPlotsPileup().

1142  found = set()
1143  found2 = set()
1144  for x in lst:
1145  if x in found:
1146  found2.add(x)
1147  else:
1148  found.add(x)
1149  return list(found2)
1150 
def _findDuplicates(lst)
Definition: validation.py:1141
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run
def validation._getGlobalTag (   sample,
  release 
)
private
Get a GlobalTag.

Arguments:
sample  -- Sample object
release -- CMSSW release string

Definition at line 326 of file validation.py.

Referenced by validation.Validation._doPlots(), validation.Validation._doPlotsFastFull(), validation.Validation._doPlotsPileup(), validation.Validation._getRefFileAndSelection(), validation.Sample.datasetpattern(), and validation.Sample.filename().

326 def _getGlobalTag(sample, release):
327  """Get a GlobalTag.
328 
329  Arguments:
330  sample -- Sample object
331  release -- CMSSW release string
332  """
333  if not release in _globalTags:
334  print "Release %s not found from globaltag map in validation.py" % release
335  sys.exit(1)
336  gtmap = _globalTags[release]
337  selectedGT = None
338  if sample.hasOverrideGlobalTag():
339  ogt = sample.overrideGlobalTag()
340  if release in ogt:
341  gtmap = _globalTags[ogt[release]]
342  scenario = ""
343  if sample.hasScenario():
344  scenario = sample.scenario()
345  sims = []
346  if sample.fullsim():
347  if sample.pileupEnabled():
348  sim = "fullsim_"+sample.pileupType()
349  sims.extend([
350  sim+"_PU%d"%sample.pileupNumber(),
351  sim
352  ])
353  elif sample.fastsim():
354  sim = "fastsim"
355  if sample.pileupEnabled():
356  sim += "_"+sample.pileupType()
357  sims.append(sim+"_PU%d"%sample.pileupNumber())
358  sims.append(sim)
359 
360  selectedGT = None
361  # First try with scenario+simulation
362  if scenario != "":
363  for sim in sims:
364  selectedGT = gtmap.get(scenario+"_"+sim, None)
365  if selectedGT is not None:
366  break
367  # Then with scenario (but only if sample specifies a scenario)
368  if selectedGT is None:
369  selectedGT = gtmap.get(scenario, None)
370  # Then with simulation
371  if selectedGT is None:
372  for sim in sims:
373  selectedGT = gtmap.get(sim, None)
374  if selectedGT is not None:
375  break
376  # Finally default
377  if selectedGT is None:
378  selectedGT = gtmap["default"]
379 
380  if isinstance(selectedGT, dict):
381  return selectedGT.get(sample.name(), selectedGT["default"])
382  else:
383  return selectedGT
384 
385 # Mapping from release series to RelVal download URLs
def _getGlobalTag(sample, release)
Definition: validation.py:326
def validation._getRelValUrl (   release)
private
Get RelVal download URL for a given release.

Definition at line 417 of file validation.py.

Referenced by validation.Validation.download().

417 def _getRelValUrl(release):
418  """Get RelVal download URL for a given release."""
419  version_re = re.compile("CMSSW_(?P<X>\d+)_(?P<Y>\d+)")
420  m = version_re.search(release)
421  if not m:
422  raise Exception("Regex %s does not match to release version %s" % (version_re.pattern, release))
423  version = "%s_%s_X" % (m.group("X"), m.group("Y"))
424  if not version in _relvalUrls:
425  print "No RelVal URL for version %s, please update _relvalUrls" % version
426  sys.exit(1)
427  return _relvalUrls[version]
428 
def _getRelValUrl(release)
Definition: validation.py:417
def validation._processPlotsForSample (   plotterFolder,
  sample 
)
private

Definition at line 429 of file validation.py.

Referenced by validation.Validation._doFastsimFastVsFullPlots(), validation.Validation._doPhase2PileupPlots(), and validation.SimpleValidation._doPlotsForPlotter().

429 def _processPlotsForSample(plotterFolder, sample):
430  if plotterFolder.onlyForPileup() and not sample.pileupEnabled():
431  return False
432  if plotterFolder.onlyForElectron() and not sample.doElectron():
433  return False
434  if plotterFolder.onlyForConversion() and not sample.doConversion():
435  return False
436  if plotterFolder.onlyForBHadron() and not sample.doBHadron():
437  return False
438  return True
439 
def _processPlotsForSample(plotterFolder, sample)
Definition: validation.py:429
def validation._stripRelease (   release)
private

Definition at line 319 of file validation.py.

Referenced by validation.Validation._doPlots(), validation.Validation._doPlotsFastFull(), validation.Validation._doPlotsPileup(), and validation.Sample.filename().

319 def _stripRelease(release):
320  for pf in _releasePostfixes:
321  if pf in release:
322  return _stripRelease(release.replace(pf, ""))
323  return release
324 
325 
def _stripRelease(release)
Definition: validation.py:319

Variable Documentation

validation._doBHadronSamples
private

Definition at line 413 of file validation.py.

validation._doConversionSamples
private

Definition at line 409 of file validation.py.

validation._doElectronSamples
private

Definition at line 404 of file validation.py.

validation._globalTags
private

Definition at line 15 of file validation.py.

validation._releasePostfixes
private

Definition at line 317 of file validation.py.

validation._relvalUrls
private

Definition at line 386 of file validation.py.

validation.IgnoreCommandLineOptions

Definition at line 9 of file validation.py.