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

Referenced by _copySubDir().

1158 def _copyDir(src, dst):
1159  """Copy non-TTree objects from src TDirectory to dst TDirectory."""
1160  keys = src.GetListOfKeys()
1161  for key in keys:
1162  classname = key.GetClassName()
1163  cl = ROOT.TClass.GetClass(classname)
1164  if not cl:
1165  continue
1166  if not (cl.InheritsFrom("TTree") and cl.InheritsFrom("TDirectory")):
1167  dst.cd()
1168  obj = key.ReadObj()
1169  obj.Write()
1170  obj.Delete()
1171 
def _copyDir(src, dst)
Definition: validation.py:1158
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 1123 of file validation.py.

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

Referenced by validation.Validation._doPlots().

1123 def _copySubDir(oldfile, newfile, basenames, dirname):
1124  """Copy a subdirectory from oldfile to newfile.
1125 
1126  Arguments:
1127  oldfile -- String for source TFile
1128  newfile -- String for destination TFile
1129  basenames -- List of strings for base directories, first existing one is picked
1130  dirname -- String for directory name under the base directory
1131  """
1132  oldf = ROOT.TFile.Open(oldfile)
1133 
1134  dirold = None
1135  for basename in basenames:
1136  dirold = oldf.GetDirectory(basename)
1137  if dirold:
1138  break
1139  if not dirold:
1140  raise Exception("Did not find any of %s directories from file %s" % (",".join(basenames), oldfile))
1141  if dirname:
1142  d = dirold.Get(dirname)
1143  if not d:
1144  raise Exception("Did not find directory %s under %s" % (dirname, dirold.GetPath()))
1145  dirold = d
1146 
1147  newf = ROOT.TFile.Open(newfile, "RECREATE")
1148  dirnew = newf
1149  for d in basenames[0].split("/"):
1150  dirnew = dirnew.mkdir(d)
1151  if dirname:
1152  dirnew = dirnew.mkdir(dirname)
1153  _copyDir(dirold, dirnew)
1154 
1155  oldf.Close()
1156  return newf
1157 
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
def _copyDir(src, dst)
Definition: validation.py:1158
def _copySubDir(oldfile, newfile, basenames, dirname)
Definition: validation.py:1123
double split
Definition: MVATrainer.cc:139
def validation._findDuplicates (   lst)
private

Definition at line 1172 of file validation.py.

References list().

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

1173  found = set()
1174  found2 = set()
1175  for x in lst:
1176  if x in found:
1177  found2.add(x)
1178  else:
1179  found.add(x)
1180  return list(found2)
1181 
def _findDuplicates(lst)
Definition: validation.py:1172
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 356 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().

356 def _getGlobalTag(sample, release):
357  """Get a GlobalTag.
358 
359  Arguments:
360  sample -- Sample object
361  release -- CMSSW release string
362  """
363  if not release in _globalTags:
364  print "Release %s not found from globaltag map in validation.py" % release
365  sys.exit(1)
366  gtmap = _globalTags[release]
367  selectedGT = None
368  if sample.hasOverrideGlobalTag():
369  ogt = sample.overrideGlobalTag()
370  if release in ogt:
371  gtmap = _globalTags[ogt[release]]
372  scenario = ""
373  if sample.hasScenario():
374  scenario = sample.scenario()
375  sims = []
376  if sample.fullsim():
377  if sample.pileupEnabled():
378  sim = "fullsim_"+sample.pileupType()
379  sims.extend([
380  sim+"_PU%d"%sample.pileupNumber(),
381  sim
382  ])
383  elif sample.fastsim():
384  sim = "fastsim"
385  if sample.pileupEnabled():
386  sim += "_"+sample.pileupType()
387  sims.append(sim+"_PU%d"%sample.pileupNumber())
388  sims.append(sim)
389 
390  selectedGT = None
391  # First try with scenario+simulation
392  if scenario != "":
393  for sim in sims:
394  selectedGT = gtmap.get(scenario+"_"+sim, None)
395  if selectedGT is not None:
396  break
397  # Then with scenario (but only if sample specifies a scenario)
398  if selectedGT is None:
399  selectedGT = gtmap.get(scenario, None)
400  # Then with simulation
401  if selectedGT is None:
402  for sim in sims:
403  selectedGT = gtmap.get(sim, None)
404  if selectedGT is not None:
405  break
406  # Finally default
407  if selectedGT is None:
408  selectedGT = gtmap["default"]
409 
410  if isinstance(selectedGT, dict):
411  return selectedGT.get(sample.name(), selectedGT["default"])
412  else:
413  return selectedGT
414 
415 # Mapping from release series to RelVal download URLs
def _getGlobalTag(sample, release)
Definition: validation.py:356
def validation._getRelValUrl (   release)
private
Get RelVal download URL for a given release.

Definition at line 448 of file validation.py.

Referenced by validation.Validation.download().

448 def _getRelValUrl(release):
449  """Get RelVal download URL for a given release."""
450  version_re = re.compile("CMSSW_(?P<X>\d+)_(?P<Y>\d+)")
451  m = version_re.search(release)
452  if not m:
453  raise Exception("Regex %s does not match to release version %s" % (version_re.pattern, release))
454  version = "%s_%s_X" % (m.group("X"), m.group("Y"))
455  if not version in _relvalUrls:
456  print "No RelVal URL for version %s, please update _relvalUrls" % version
457  sys.exit(1)
458  return _relvalUrls[version]
459 
def _getRelValUrl(release)
Definition: validation.py:448
def validation._processPlotsForSample (   plotterFolder,
  sample 
)
private

Definition at line 460 of file validation.py.

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

460 def _processPlotsForSample(plotterFolder, sample):
461  if plotterFolder.onlyForPileup() and not sample.pileupEnabled():
462  return False
463  if plotterFolder.onlyForElectron() and not sample.doElectron():
464  return False
465  if plotterFolder.onlyForConversion() and not sample.doConversion():
466  return False
467  if plotterFolder.onlyForBHadron() and not sample.doBHadron():
468  return False
469  return True
470 
def _processPlotsForSample(plotterFolder, sample)
Definition: validation.py:460
def validation._stripRelease (   release)
private

Definition at line 349 of file validation.py.

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

349 def _stripRelease(release):
350  for pf in _releasePostfixes:
351  if pf in release:
352  return _stripRelease(release.replace(pf, ""))
353  return release
354 
355 
def _stripRelease(release)
Definition: validation.py:349

Variable Documentation

validation._doBHadronSamples
private

Definition at line 444 of file validation.py.

validation._doConversionSamples
private

Definition at line 440 of file validation.py.

validation._doElectronSamples
private

Definition at line 435 of file validation.py.

validation._globalTags
private

Definition at line 15 of file validation.py.

validation._releasePostfixes
private

Definition at line 347 of file validation.py.

validation._relvalUrls
private

Definition at line 416 of file validation.py.

validation.IgnoreCommandLineOptions

Definition at line 9 of file validation.py.