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

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

Referenced by _copySubDir().

959 def _copyDir(src, dst):
960  """Copy non-TTree objects from src TDirectory to dst TDirectory."""
961  keys = src.GetListOfKeys()
962  for key in keys:
963  classname = key.GetClassName()
964  cl = ROOT.TClass.GetClass(classname)
965  if not cl:
966  continue
967  if not (cl.InheritsFrom("TTree") and cl.InheritsFrom("TDirectory")):
968  dst.cd()
969  obj = key.ReadObj()
970  obj.Write()
971  obj.Delete()
972 
def _copyDir(src, dst)
Definition: validation.py:959
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 924 of file validation.py.

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

Referenced by validation.Validation._doPlots().

924 def _copySubDir(oldfile, newfile, basenames, dirname):
925  """Copy a subdirectory from oldfile to newfile.
926 
927  Arguments:
928  oldfile -- String for source TFile
929  newfile -- String for destination TFile
930  basenames -- List of strings for base directories, first existing one is picked
931  dirname -- String for directory name under the base directory
932  """
933  oldf = ROOT.TFile.Open(oldfile)
934 
935  dirold = None
936  for basename in basenames:
937  dirold = oldf.GetDirectory(basename)
938  if dirold:
939  break
940  if not dirold:
941  raise Exception("Did not find any of %s directories from file %s" % (",".join(basenames), oldfile))
942  if dirname:
943  d = dirold.Get(dirname)
944  if not d:
945  raise Exception("Did not find directory %s under %s" % (dirname, dirold.GetPath()))
946  dirold = d
947 
948  newf = ROOT.TFile.Open(newfile, "RECREATE")
949  dirnew = newf
950  for d in basenames[0].split("/"):
951  dirnew = dirnew.mkdir(d)
952  if dirname:
953  dirnew = dirnew.mkdir(dirname)
954  _copyDir(dirold, dirnew)
955 
956  oldf.Close()
957  return newf
958 
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
def _copyDir(src, dst)
Definition: validation.py:959
def _copySubDir(oldfile, newfile, basenames, dirname)
Definition: validation.py:924
double split
Definition: MVATrainer.cc:139
def validation._findDuplicates (   lst)
private

Definition at line 973 of file validation.py.

References list().

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

974  found = set()
975  found2 = set()
976  for x in lst:
977  if x in found:
978  found2.add(x)
979  else:
980  found.add(x)
981  return list(found2)
982 
def _findDuplicates(lst)
Definition: validation.py:973
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 197 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().

197 def _getGlobalTag(sample, release):
198  """Get a GlobalTag.
199 
200  Arguments:
201  sample -- Sample object
202  release -- CMSSW release string
203  """
204  if not release in _globalTags:
205  print "Release %s not found from globaltag map in validation.py" % release
206  sys.exit(1)
207  gtmap = _globalTags[release]
208  if sample.hasOverrideGlobalTag():
209  ogt = sample.overrideGlobalTag()
210  if release in ogt:
211  gtmap = _globalTags[ogt[release]]
212  if sample.fullsim():
213  if sample.hasScenario():
214  return gtmap[sample.scenario()]
215  if sample.pileupEnabled():
216  puType = sample.pileupType()
217  if "50ns" in puType:
218  return gtmap.get("fullsim_50ns", gtmap["default"])
219  if "25ns" in puType:
220  return gtmap.get("fullsim_25ns", gtmap["default"])
221  if sample.fastsim():
222  fsgt = gtmap.get("fastsim", gtmap["default"])
223  if sample.pileupEnabled():
224  puType = sample.pileupType()
225  if "25ns" in puType:
226  return gtmap.get("fastsim_25ns", fsgt)
227  return fsgt
228  return gtmap["default"]
229 
230 # Mapping from release series to RelVal download URLs
def _getGlobalTag(sample, release)
Definition: validation.py:197
def validation._getRelValUrl (   release)
private
Get RelVal download URL for a given release.

Definition at line 254 of file validation.py.

Referenced by validation.Validation.download().

254 def _getRelValUrl(release):
255  """Get RelVal download URL for a given release."""
256  version_re = re.compile("CMSSW_(?P<X>\d+)_(?P<Y>\d+)")
257  m = version_re.search(release)
258  if not m:
259  raise Exception("Regex %s does not match to release version %s" % (version_re.pattern, release))
260  version = "%s_%s_X" % (m.group("X"), m.group("Y"))
261  if not version in _relvalUrls:
262  print "No RelVal URL for version %s, please update _relvalUrls" % version
263  sys.exit(1)
264  return _relvalUrls[version]
265 
def _getRelValUrl(release)
Definition: validation.py:254
def validation._processPlotsForSample (   plotterFolder,
  sample 
)
private

Definition at line 266 of file validation.py.

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

266 def _processPlotsForSample(plotterFolder, sample):
267  if plotterFolder.onlyForPileup() and not sample.pileupEnabled():
268  return False
269  if plotterFolder.onlyForElectron() and not sample.doElectron():
270  return False
271  if plotterFolder.onlyForConversion() and not sample.doConversion():
272  return False
273  return True
274 
def _processPlotsForSample(plotterFolder, sample)
Definition: validation.py:266
def validation._stripRelease (   release)
private

Definition at line 190 of file validation.py.

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

190 def _stripRelease(release):
191  for pf in _releasePostfixes:
192  if pf in release:
193  return release.replace(pf, "")
194  return release
195 
196 
def _stripRelease(release)
Definition: validation.py:190

Variable Documentation

validation._doConversionSamples
private

Definition at line 249 of file validation.py.

validation._doElectronSamples
private

Definition at line 244 of file validation.py.

validation._globalTags
private

Definition at line 15 of file validation.py.

validation._releasePostfixes
private

Definition at line 188 of file validation.py.

validation._relvalUrls
private

Definition at line 231 of file validation.py.

validation.IgnoreCommandLineOptions

Definition at line 9 of file validation.py.