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 _findDuplicates
 
def _getGlobalTag
 
def _getRelValUrl
 
def _processPlotsForSample
 
def _stripRelease
 

Variables

list _doConversionSamples
 
list _doElectronSamples
 
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 959 of file validation.py.

Referenced by _copySubDir().

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

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

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

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

267 def _processPlotsForSample(plotterFolder, sample):
268  if plotterFolder.onlyForPileup() and not sample.pileupEnabled():
269  return False
270  if plotterFolder.onlyForElectron() and not sample.doElectron():
271  return False
272  if plotterFolder.onlyForConversion() and not sample.doConversion():
273  return False
274  return True
def _processPlotsForSample
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().

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

Variable Documentation

list validation._doConversionSamples
Initial value:
1 = [
2  "RelValTTbar",
3  "RelValH125GGgluonfusion",
4 ]

Definition at line 249 of file validation.py.

list validation._doElectronSamples
Initial value:
1 = [
2  "RelValTTbar",
3  "RelValSingleElectronPt35",
4  "RelValSingleElectronPt10",
5 ]

Definition at line 244 of file validation.py.

dictionary validation._globalTags

Definition at line 15 of file validation.py.

list validation._releasePostfixes
Initial value:
1 = ["_AlcaCSA14", "_PHYS14", "_TEST", "_71XGENSIM_pmx", "_gcc530_pmx", "_pmx_v2", "_pmx_v3", "_pmx", "_Fall14DR", "_71XGENSIM_FIXGT", "_71XGENSIM_PU", "_71XGENSIM_PXbest", "_71XGENSIM_PXworst", "_71XGENSIM_hcal", "_71XGENSIM_tec", "_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_realGT", "_phase1_newGT2", "_phase1_newGT", "_phase1", "_phase2", "_ecal15fb", "_ecal30fb", "_pixDynIneff", "_gcc530", "_Tranche4GT"]

Definition at line 188 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  "8_1_X": "https://cmsweb.cern.ch/dqm/relval/data/browse/ROOT/RelVal/CMSSW_8_1_x/",
12 }

Definition at line 231 of file validation.py.