CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Classes | Functions | Variables
validation Namespace Reference

Classes

class  Sample
 
class  SimpleSample
 
class  SimpleValidation
 
class  Validation
 

Functions

def _copyDir
 
def _copySubDir
 
def _getGlobalTag
 
def _getRelValUrl
 
def _stripRelease
 

Variables

dictionary _globalTags
 
list _releasePostfixes
 
dictionary _relvalUrls
 

Function Documentation

def validation._copyDir (   src,
  dst 
)
private
Copy non-TTree objects from src TDirectory to dst TDirectory.

Definition at line 734 of file validation.py.

Referenced by _copySubDir().

735 def _copyDir(src, dst):
736  """Copy non-TTree objects from src TDirectory to dst TDirectory."""
737  keys = src.GetListOfKeys()
738  for key in keys:
739  classname = key.GetClassName()
740  cl = ROOT.TClass.GetClass(classname)
741  if not cl:
742  continue
743  if not (cl.InheritsFrom("TTree") and cl.InheritsFrom("TDirectory")):
744  dst.cd()
745  obj = key.ReadObj()
746  obj.Write()
747  obj.Delete()
def _copyDir
Definition: validation.py:734
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 699 of file validation.py.

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

Referenced by validation.Validation._doPlots().

700 def _copySubDir(oldfile, newfile, basenames, dirname):
701  """Copy a subdirectory from oldfile to newfile.
702 
703  Arguments:
704  oldfile -- String for source TFile
705  newfile -- String for destination TFile
706  basenames -- List of strings for base directories, first existing one is picked
707  dirname -- String for directory name under the base directory
708  """
709  oldf = ROOT.TFile.Open(oldfile)
710 
711  dirold = None
712  for basename in basenames:
713  dirold = oldf.GetDirectory(basename)
714  if dirold:
715  break
716  if not dirold:
717  raise Exception("Did not find any of %s directories from file %s" % (",".join(basenames), oldfile))
718  if dirname:
719  d = dirold.Get(dirname)
720  if not d:
721  raise Exception("Did not find directory %s under %s" % (dirname, dirold.GetPath()))
722  dirold = d
723 
724  newf = ROOT.TFile.Open(newfile, "RECREATE")
725  dirnew = newf
726  for d in basenames[0].split("/"):
727  dirnew = dirnew.mkdir(d)
728  if dirname:
729  dirnew = dirnew.mkdir(dirname)
730  _copyDir(dirold, dirnew)
731 
732  oldf.Close()
733  return newf
def _copySubDir
Definition: validation.py:699
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
double split
Definition: MVATrainer.cc:139
def _copyDir
Definition: validation.py:734
def validation._getGlobalTag (   sample,
  release 
)
private
Get a GlobalTag.

Arguments:
sample  -- Sample object
release -- CMSSW release string

Definition at line 115 of file validation.py.

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

116 def _getGlobalTag(sample, release):
117  """Get a GlobalTag.
118 
119  Arguments:
120  sample -- Sample object
121  release -- CMSSW release string
122  """
123  if not release in _globalTags:
124  print "Release %s not found from globaltag map in validation.py" % release
125  sys.exit(1)
126  gtmap = _globalTags[release]
127  if sample.hasOverrideGlobalTag():
128  ogt = sample.overrideGlobalTag()
129  if release in ogt:
130  gtmap = _globalTags[ogt[release]]
131  if sample.fullsim():
132  if sample.hasScenario():
133  return gtmap[sample.scenario()]
134  if sample.hasPileup():
135  puType = sample.pileupType()
136  if "50ns" in puType:
137  return gtmap.get("fullsim_50ns", gtmap["default"])
138  if "25ns" in puType:
139  return gtmap.get("fullsim_25ns", gtmap["default"])
140  if sample.fastsim():
141  if sample.hasPileup():
142  puType = sample.pileupType()
143  if "25ns" in puType:
144  return gtmap.get("fastsim_25ns", gtmap["default"])
145  return gtmap.get("fastsim", gtmap["default"])
146  return gtmap["default"]
147 
# Mapping from release series to RelVal download URLs
def _getGlobalTag
Definition: validation.py:115
def validation._getRelValUrl (   release)
private
Get RelVal download URL for a given release.

Definition at line 159 of file validation.py.

Referenced by validation.Validation.download().

160 def _getRelValUrl(release):
161  """Get RelVal download URL for a given release."""
162  version_re = re.compile("CMSSW_(?P<X>\d+)_(?P<Y>\d+)")
163  m = version_re.search(release)
164  if not m:
165  raise Exception("Regex %s does not match to release version %s" % (version_re.pattern, release))
166  version = "%s_%s_X" % (m.group("X"), m.group("Y"))
167  if not version in _relvalUrls:
168  print "No RelVal URL for version %s, please update _relvalUrls" % version
169  sys.exit(1)
170  return _relvalUrls[version]
def _getRelValUrl
Definition: validation.py:159
def validation._stripRelease (   release)
private

Definition at line 108 of file validation.py.

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

109 def _stripRelease(release):
110  for pf in _releasePostfixes:
111  if pf in release:
112  return release.replace(pf, "")
113  return release
114 
def _stripRelease
Definition: validation.py:108

Variable Documentation

dictionary validation._globalTags

Definition at line 15 of file validation.py.

list validation._releasePostfixes
Initial value:
1 = ["_AlcaCSA14", "_PHYS14", "_TEST", "_pmx_v2", "_pmx_v3", "_pmx", "_Fall14DR", "_71XGENSIM_FIXGT", "_71XGENSIM_PU", "_71XGENSIM_PXbest", "_71XGENSIM_PXworst", "_71XGENSIM", "_73XGENSIM", "_BS", "_GenSim_7113", "_extended",
2  "_25ns_asymptotic", "_50ns_startup", "_50ns_asympref", "_50ns_asymptotic", "_minimal", "_0T", "_unsch", "_noCCC_v3", "_noCCC", "_MT"]

Definition at line 106 of file validation.py.

dictionary validation._relvalUrls
Initial value:
1 = {
2  "6_2_X": "https://cmsweb.cern.ch/dqm/relval/data/browse/ROOT/RelVal/CMSSW_6_2_x/",
3  "7_0_X": "https://cmsweb.cern.ch/dqm/relval/data/browse/ROOT/RelVal/CMSSW_7_0_x/",
4  "7_1_X": "https://cmsweb.cern.ch/dqm/relval/data/browse/ROOT/RelVal/CMSSW_7_1_x/",
5  "7_2_X": "https://cmsweb.cern.ch/dqm/relval/data/browse/ROOT/RelVal/CMSSW_7_2_x/",
6  "7_3_X": "https://cmsweb.cern.ch/dqm/relval/data/browse/ROOT/RelVal/CMSSW_7_3_x/",
7  "7_4_X": "https://cmsweb.cern.ch/dqm/relval/data/browse/ROOT/RelVal/CMSSW_7_4_x/",
8  "7_5_X": "https://cmsweb.cern.ch/dqm/relval/data/browse/ROOT/RelVal/CMSSW_7_5_x/",
9  "7_6_X": "https://cmsweb.cern.ch/dqm/relval/data/browse/ROOT/RelVal/CMSSW_7_6_x/",
10 }

Definition at line 148 of file validation.py.