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

Referenced by _copySubDir().

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

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

Referenced by validation.Validation._doPlots().

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

Definition at line 1175 of file validation.py.

References list().

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

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

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

References edm.print().

Referenced by validation.Validation.download().

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

Definition at line 463 of file validation.py.

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

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

Definition at line 352 of file validation.py.

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

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

Variable Documentation

validation._doBHadronSamples
private

Definition at line 447 of file validation.py.

validation._doConversionSamples
private

Definition at line 443 of file validation.py.

validation._doElectronSamples
private

Definition at line 438 of file validation.py.

validation._globalTags
private

Definition at line 18 of file validation.py.

validation._releasePostfixes
private

Definition at line 350 of file validation.py.

validation._relvalUrls
private

Definition at line 419 of file validation.py.

validation.IgnoreCommandLineOptions

Definition at line 12 of file validation.py.