CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
trackSplittingValidation.py
Go to the documentation of this file.
1 import os
2 import configTemplates
3 from genericValidation import GenericValidationData
4 from helperFunctions import replaceByMap
5 from TkAlExceptions import AllInOneError
6 
7 
9  def __init__(self, valName, alignment, config,
10  configBaseName = "TkAlTrackSplitting", scriptBaseName = "TkAlTrackSplitting", crabCfgBaseName = "TkAlTrackSplitting",
11  resultBaseName = "TrackSplitting", outputBaseName = "TrackSplitting"):
12  mandatories = ["trackcollection"]
13  self.configBaseName = configBaseName
14  self.scriptBaseName = scriptBaseName
15  self.crabCfgBaseName = crabCfgBaseName
16  self.resultBaseName = resultBaseName
17  self.outputBaseName = outputBaseName
18  self.needParentFiles = False
19  GenericValidationData.__init__(self, valName, alignment, config,
20  "split", addMandatories = mandatories)
21 
22  def createConfiguration(self, path ):
23  cfgName = "%s.%s.%s_cfg.py"%(self.configBaseName, self.name,
24  self.alignmentToValidate.name)
25  repMap = self.getRepMap()
26  cfgs = {cfgName: configTemplates.TrackSplittingTemplate}
27  self.filesToCompare[GenericValidationData.defaultReferenceName] = \
28  repMap["finalResultFile"]
29  GenericValidationData.createConfiguration(self, cfgs, path, repMap = repMap)
30 
31  def createScript(self, path):
32  return GenericValidationData.createScript(self, path)
33 
34  def createCrabCfg(self, path):
35  return GenericValidationData.createCrabCfg(self, path, self.crabCfgBaseName)
36 
37  def getRepMap( self, alignment = None ):
38  repMap = GenericValidationData.getRepMap(self)
39  repMap.update({
40  "nEvents": self.general["maxevents"],
41  "TrackCollection": self.general["trackcollection"]
42  })
43  # repMap["outputFile"] = os.path.abspath( repMap["outputFile"] )
44  # if self.jobmode.split( ',' )[0] == "crab":
45  # repMap["outputFile"] = os.path.basename( repMap["outputFile"] )
46  return repMap
47 
48 
49  def appendToExtendedValidation( self, validationsSoFar = "" ):
50  """
51  if no argument or "" is passed a string with an instantiation is
52  returned, else the validation is appended to the list
53  """
54  repMap = self.getRepMap()
55  comparestring = self.getCompareStrings("TrackSplittingValidation")
56  if validationsSoFar != "":
57  validationsSoFar += ',"\n "'
58  validationsSoFar += comparestring
59  return validationsSoFar
60 
61  def appendToMerge( self, validationsSoFar = "" ):
62  """
63  if no argument or "" is passed a string with an instantiation is returned,
64  else the validation is appended to the list
65  """
66  repMap = self.getRepMap()
67 
68  parameters = " ".join(os.path.join("root://eoscms//eos/cms", file.lstrip("/")) for file in repMap["resultFiles"])
69 
70  mergedoutputfile = os.path.join("root://eoscms//eos/cms", repMap["finalResultFile"].lstrip("/"))
71  validationsSoFar += "hadd -f %s %s\n" % (mergedoutputfile, parameters)
72  return validationsSoFar
static std::string join(char **cmd)
Definition: RemoteFile.cc:18