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

Referenced by _copySubDir().

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

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

Referenced by validation.Validation._doPlots().

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

Definition at line 1173 of file validation.py.

References list().

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

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

References edm.print().

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

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

Definition at line 449 of file validation.py.

References edm.print().

Referenced by validation.Validation.download().

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

Definition at line 461 of file validation.py.

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

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

Definition at line 350 of file validation.py.

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

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

Variable Documentation

validation._doBHadronSamples
private

Definition at line 445 of file validation.py.

validation._doConversionSamples
private

Definition at line 441 of file validation.py.

validation._doElectronSamples
private

Definition at line 436 of file validation.py.

validation._globalTags
private

Definition at line 16 of file validation.py.

validation._releasePostfixes
private

Definition at line 348 of file validation.py.

validation._relvalUrls
private

Definition at line 417 of file validation.py.

validation.IgnoreCommandLineOptions

Definition at line 10 of file validation.py.