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

Referenced by _copySubDir().

779 def _copyDir(src, dst):
780  """Copy non-TTree objects from src TDirectory to dst TDirectory."""
781  keys = src.GetListOfKeys()
782  for key in keys:
783  classname = key.GetClassName()
784  cl = ROOT.TClass.GetClass(classname)
785  if not cl:
786  continue
787  if not (cl.InheritsFrom("TTree") and cl.InheritsFrom("TDirectory")):
788  dst.cd()
789  obj = key.ReadObj()
790  obj.Write()
791  obj.Delete()
def _copyDir
Definition: validation.py:778
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 743 of file validation.py.

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

Referenced by validation.Validation._doPlots().

744 def _copySubDir(oldfile, newfile, basenames, dirname):
745  """Copy a subdirectory from oldfile to newfile.
746 
747  Arguments:
748  oldfile -- String for source TFile
749  newfile -- String for destination TFile
750  basenames -- List of strings for base directories, first existing one is picked
751  dirname -- String for directory name under the base directory
752  """
753  oldf = ROOT.TFile.Open(oldfile)
754 
755  dirold = None
756  for basename in basenames:
757  dirold = oldf.GetDirectory(basename)
758  if dirold:
759  break
760  if not dirold:
761  raise Exception("Did not find any of %s directories from file %s" % (",".join(basenames), oldfile))
762  if dirname:
763  d = dirold.Get(dirname)
764  if not d:
765  raise Exception("Did not find directory %s under %s" % (dirname, dirold.GetPath()))
766  dirold = d
767 
768  newf = ROOT.TFile.Open(newfile, "RECREATE")
769  dirnew = newf
770  for d in basenames[0].split("/"):
771  dirnew = dirnew.mkdir(d)
772  if dirname:
773  dirnew = dirnew.mkdir(dirname)
774  _copyDir(dirold, dirnew)
775 
776  oldf.Close()
777  return newf
def _copySubDir
Definition: validation.py:743
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
double split
Definition: MVATrainer.cc:139
def _copyDir
Definition: validation.py:778
def validation._getGlobalTag (   sample,
  release 
)
private
Get a GlobalTag.

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

Definition at line 133 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().

134 def _getGlobalTag(sample, release):
135  """Get a GlobalTag.
136 
137  Arguments:
138  sample -- Sample object
139  release -- CMSSW release string
140  """
141  if not release in _globalTags:
142  print "Release %s not found from globaltag map in validation.py" % release
143  sys.exit(1)
144  gtmap = _globalTags[release]
145  if sample.hasOverrideGlobalTag():
146  ogt = sample.overrideGlobalTag()
147  if release in ogt:
148  gtmap = _globalTags[ogt[release]]
149  if sample.fullsim():
150  if sample.hasScenario():
151  return gtmap[sample.scenario()]
152  if sample.hasPileup():
153  puType = sample.pileupType()
154  if "50ns" in puType:
155  return gtmap.get("fullsim_50ns", gtmap["default"])
156  if "25ns" in puType:
157  return gtmap.get("fullsim_25ns", gtmap["default"])
158  if sample.fastsim():
159  if sample.hasPileup():
160  puType = sample.pileupType()
161  if "25ns" in puType:
162  return gtmap.get("fastsim_25ns", gtmap["default"])
163  return gtmap.get("fastsim", gtmap["default"])
164  return gtmap["default"]
165 
# Mapping from release series to RelVal download URLs
def _getGlobalTag
Definition: validation.py:133
def validation._getRelValUrl (   release)
private
Get RelVal download URL for a given release.

Definition at line 178 of file validation.py.

Referenced by validation.Validation.download().

179 def _getRelValUrl(release):
180  """Get RelVal download URL for a given release."""
181  version_re = re.compile("CMSSW_(?P<X>\d+)_(?P<Y>\d+)")
182  m = version_re.search(release)
183  if not m:
184  raise Exception("Regex %s does not match to release version %s" % (version_re.pattern, release))
185  version = "%s_%s_X" % (m.group("X"), m.group("Y"))
186  if not version in _relvalUrls:
187  print "No RelVal URL for version %s, please update _relvalUrls" % version
188  sys.exit(1)
189  return _relvalUrls[version]
def _getRelValUrl
Definition: validation.py:178
def validation._stripRelease (   release)
private

Definition at line 126 of file validation.py.

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

127 def _stripRelease(release):
128  for pf in _releasePostfixes:
129  if pf in release:
130  return release.replace(pf, "")
131  return release
132 
def _stripRelease
Definition: validation.py:126

Variable Documentation

dictionary validation._globalTags

Definition at line 15 of file validation.py.

list validation._releasePostfixes
Initial value:
1 = ["_AlcaCSA14", "_PHYS14", "_TEST", "_71XGENSIM_pmx", "_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", "_phase1_rereco", "_phase1_pythia8", "_phase1_13TeV", "_phase1", "_ecal15fb", "_ecal30fb"]

Definition at line 124 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  "8_0_X": "https://cmsweb.cern.ch/dqm/relval/data/browse/ROOT/RelVal/CMSSW_8_0_x/",
11 }

Definition at line 166 of file validation.py.