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

Referenced by _copySubDir().

1097 def _copyDir(src, dst):
1098  """Copy non-TTree objects from src TDirectory to dst TDirectory."""
1099  keys = src.GetListOfKeys()
1100  for key in keys:
1101  classname = key.GetClassName()
1102  cl = ROOT.TClass.GetClass(classname)
1103  if not cl:
1104  continue
1105  if not (cl.InheritsFrom("TTree") and cl.InheritsFrom("TDirectory")):
1106  dst.cd()
1107  obj = key.ReadObj()
1108  obj.Write()
1109  obj.Delete()
1110 
def _copyDir(src, dst)
Definition: validation.py:1097
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 1062 of file validation.py.

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

Referenced by validation.Validation._doPlots().

1062 def _copySubDir(oldfile, newfile, basenames, dirname):
1063  """Copy a subdirectory from oldfile to newfile.
1064 
1065  Arguments:
1066  oldfile -- String for source TFile
1067  newfile -- String for destination TFile
1068  basenames -- List of strings for base directories, first existing one is picked
1069  dirname -- String for directory name under the base directory
1070  """
1071  oldf = ROOT.TFile.Open(oldfile)
1072 
1073  dirold = None
1074  for basename in basenames:
1075  dirold = oldf.GetDirectory(basename)
1076  if dirold:
1077  break
1078  if not dirold:
1079  raise Exception("Did not find any of %s directories from file %s" % (",".join(basenames), oldfile))
1080  if dirname:
1081  d = dirold.Get(dirname)
1082  if not d:
1083  raise Exception("Did not find directory %s under %s" % (dirname, dirold.GetPath()))
1084  dirold = d
1085 
1086  newf = ROOT.TFile.Open(newfile, "RECREATE")
1087  dirnew = newf
1088  for d in basenames[0].split("/"):
1089  dirnew = dirnew.mkdir(d)
1090  if dirname:
1091  dirnew = dirnew.mkdir(dirname)
1092  _copyDir(dirold, dirnew)
1093 
1094  oldf.Close()
1095  return newf
1096 
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
def _copyDir(src, dst)
Definition: validation.py:1097
def _copySubDir(oldfile, newfile, basenames, dirname)
Definition: validation.py:1062
double split
Definition: MVATrainer.cc:139
def validation._findDuplicates (   lst)
private

Definition at line 1111 of file validation.py.

References list().

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

1112  found = set()
1113  found2 = set()
1114  for x in lst:
1115  if x in found:
1116  found2.add(x)
1117  else:
1118  found.add(x)
1119  return list(found2)
1120 
def _findDuplicates(lst)
Definition: validation.py:1111
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 297 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().

297 def _getGlobalTag(sample, release):
298  """Get a GlobalTag.
299 
300  Arguments:
301  sample -- Sample object
302  release -- CMSSW release string
303  """
304  if not release in _globalTags:
305  print "Release %s not found from globaltag map in validation.py" % release
306  sys.exit(1)
307  gtmap = _globalTags[release]
308  selectedGT = None
309  if sample.hasOverrideGlobalTag():
310  ogt = sample.overrideGlobalTag()
311  if release in ogt:
312  gtmap = _globalTags[ogt[release]]
313  scenario = ""
314  if sample.hasScenario():
315  scenario = sample.scenario()
316  sims = []
317  if sample.fullsim():
318  if sample.pileupEnabled():
319  sim = "fullsim_"+sample.pileupType()
320  sims.extend([
321  sim+"_PU%d"%sample.pileupNumber(),
322  sim
323  ])
324  elif sample.fastsim():
325  sim = "fastsim"
326  if sample.pileupEnabled():
327  sim += "_"+sample.pileupType()
328  sims.append(sim+"_PU%d"%sample.pileupNumber())
329  sims.append(sim)
330 
331  selectedGT = None
332  # First try with scenario+simulation
333  if scenario != "":
334  for sim in sims:
335  selectedGT = gtmap.get(scenario+"_"+sim, None)
336  if selectedGT is not None:
337  break
338  # Then with scenario (but only if sample specifies a scenario)
339  if selectedGT is None:
340  selectedGT = gtmap.get(scenario, None)
341  # Then with simulation
342  if selectedGT is None:
343  for sim in sims:
344  selectedGT = gtmap.get(sim, None)
345  if selectedGT is not None:
346  break
347  # Finally default
348  if selectedGT is None:
349  selectedGT = gtmap["default"]
350 
351  if isinstance(selectedGT, dict):
352  return selectedGT.get(sample.name(), selectedGT["default"])
353  else:
354  return selectedGT
355 
356 # Mapping from release series to RelVal download URLs
def _getGlobalTag(sample, release)
Definition: validation.py:297
def validation._getRelValUrl (   release)
private
Get RelVal download URL for a given release.

Definition at line 387 of file validation.py.

Referenced by validation.Validation.download().

387 def _getRelValUrl(release):
388  """Get RelVal download URL for a given release."""
389  version_re = re.compile("CMSSW_(?P<X>\d+)_(?P<Y>\d+)")
390  m = version_re.search(release)
391  if not m:
392  raise Exception("Regex %s does not match to release version %s" % (version_re.pattern, release))
393  version = "%s_%s_X" % (m.group("X"), m.group("Y"))
394  if not version in _relvalUrls:
395  print "No RelVal URL for version %s, please update _relvalUrls" % version
396  sys.exit(1)
397  return _relvalUrls[version]
398 
def _getRelValUrl(release)
Definition: validation.py:387
def validation._processPlotsForSample (   plotterFolder,
  sample 
)
private

Definition at line 399 of file validation.py.

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

399 def _processPlotsForSample(plotterFolder, sample):
400  if plotterFolder.onlyForPileup() and not sample.pileupEnabled():
401  return False
402  if plotterFolder.onlyForElectron() and not sample.doElectron():
403  return False
404  if plotterFolder.onlyForConversion() and not sample.doConversion():
405  return False
406  if plotterFolder.onlyForBHadron() and not sample.doBHadron():
407  return False
408  return True
409 
def _processPlotsForSample(plotterFolder, sample)
Definition: validation.py:399
def validation._stripRelease (   release)
private

Definition at line 290 of file validation.py.

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

290 def _stripRelease(release):
291  for pf in _releasePostfixes:
292  if pf in release:
293  return _stripRelease(release.replace(pf, ""))
294  return release
295 
296 
def _stripRelease(release)
Definition: validation.py:290

Variable Documentation

validation._doBHadronSamples
private

Definition at line 383 of file validation.py.

validation._doConversionSamples
private

Definition at line 379 of file validation.py.

validation._doElectronSamples
private

Definition at line 374 of file validation.py.

validation._globalTags
private

Definition at line 15 of file validation.py.

validation._releasePostfixes
private

Definition at line 288 of file validation.py.

validation._relvalUrls
private

Definition at line 357 of file validation.py.

validation.IgnoreCommandLineOptions

Definition at line 9 of file validation.py.