Exemplo n.º 1
0
 def getRepMap(self, alignment=None):
     if alignment == None:
         alignment = self.alignmentToValidate
     try:
         result = PlottingOptions(self.config, self.valType)
     except KeyError:
         result = {}
     result.update(alignment.getRepMap())
     result.update(self.general)
     result.update({
         "workdir":
         os.path.join(self.general["workdir"], self.randomWorkdirPart),
         "datadir":
         self.general["datadir"],
         "logdir":
         self.general["logdir"],
         "CommandLineTemplate": ("#run configfile and post-proccess it\n"
                                 "cmsRun %(cfgFile)s\n"
                                 "%(postProcess)s "),
         "CMSSW_BASE":
         self.cmssw,
         "SCRAM_ARCH":
         self.scramarch,
         "CMSSW_RELEASE_BASE":
         self.cmsswreleasebase,
         "alignmentName":
         alignment.name,
         "condLoad":
         alignment.getConditions(),
         "LoadGlobalTagTemplate":
         configTemplates.loadGlobalTagTemplate,
     })
     result.update(self.packages)
     return result
Exemplo n.º 2
0
 def doRunPlots(cls, validations):
     from plottingOptions import PlottingOptions
     cls.createPlottingScript(validations)
     result = cls.runPlots(validations)
     result = replaceByMap(result, PlottingOptions(None, cls))
     if result and result[-1] != "\n": result += "\n"
     return result
Exemplo n.º 3
0
    def __init__(self, valName, config):
        self.general = config.getGeneral()
        self.name = self.general["name"] = valName
        self.config = config

        theUpdate = config.getResultingSection("preexisting"+self.valType+":"+self.name,
                                               defaultDict = self.defaults,
                                               demandPars = self.mandatories)
        self.general.update(theUpdate)

        self.title = self.general["title"]
        if "|" in self.title or "," in self.title or '"' in self.title:
            msg = "The characters '|', '\"', and ',' cannot be used in the alignment title!"
            raise AllInOneError(msg)
        self.needsproxy = boolfromstring(self.general["needsproxy"], "needsproxy")
        self.jobid = self.general["jobid"]
        if self.jobid:
            try:  #make sure it's actually a valid jobid
                output = getCommandOutput2("bjobs %(jobid)s 2>&1"%self.general)
                if "is not found" in output: raise RuntimeError
            except RuntimeError:
                raise AllInOneError("%s is not a valid jobid.\nMaybe it finished already?"%self.jobid)

        knownOpts = set(self.defaults.keys())|self.mandatories|self.optionals
        ignoreOpts = []
        config.checkInput("preexisting"+self.valType+":"+self.name,
                          knownSimpleOptions = knownOpts,
                          ignoreOptions = ignoreOpts)
        self.jobmode = None

        try:  #initialize plotting options for this validation type
            result = PlottingOptions(self.config, self.valType)
        except KeyError:
            pass
Exemplo n.º 4
0
 def doComparison(cls, validations):
     from plottingOptions import PlottingOptions
     repmap = PlottingOptions(None, cls).copy()
     repmap["compareStrings"] = " , ".join(
         v.getCompareStrings("OfflineValidation") for v in validations)
     repmap["compareStringsPlain"] = " , ".join(
         v.getCompareStrings("OfflineValidation", True)
         for v in validations)
     comparison = replaceByMap(cls.comparisontemplate(), repmap)
     return comparison
Exemplo n.º 5
0
 def createPlottingScript(cls, validations):
     from plottingOptions import PlottingOptions
     repmap = PlottingOptions(None, cls).copy()
     filename = replaceByMap(".oO[plottingscriptpath]Oo.", repmap)
     repmap["PlottingInstantiation"] = "\n".join(
         replaceByMap(v.appendToPlots(), v.getRepMap()).rstrip("\n")
         for v in validations)
     plottingscript = replaceByMap(cls.plottingscripttemplate(), repmap)
     with open(filename, 'w') as f:
         f.write(plottingscript)
Exemplo n.º 6
0
 def trackcollection(self):
     from plottingOptions import PlottingOptions
     resonance = PlottingOptions(self.config, self.valType)["resonance"]
     if resonance == "Z":
         return 'ALCARECOTkAlZMuMu'
     elif resonance == "JPsi":
         return 'ALCARECOTkAlJpsiMuMu'
     elif resonance in ("Y1S", "Y2S", "Y3S"):
         return 'ALCARECOTkAlUpsilonMuMu'
     else:
         raise AllInOneError("Unknown resonance {}!".format(resonance))
 def getRepMap(self):
     #do not call super
     try:
         result = PlottingOptions(self.config, self.valType)
     except KeyError:
         result = {}
     result.update(self.general)
     result.update({
         "color": str(parsecolor(result["color"])),
         "style": str(parsestyle(result["style"])),
     })
     return result
Exemplo n.º 8
0
 def initMerge(cls):
     from plottingOptions import PlottingOptions
     outFilePath = replaceByMap(".oO[scriptsdir]Oo./TkAlOfflineJobsMerge.C",
                                PlottingOptions(None, cls.valType))
     with open(outFilePath, "w") as theFile:
         theFile.write(
             replaceByMap(configTemplates.mergeOfflineParJobsTemplate, {}))
     result = super(OfflineValidation, cls).initMerge()
     result += (
         "cp .oO[Alignment/OfflineValidation]Oo./scripts/merge_TrackerOfflineValidation.C .\n"
         "rfcp .oO[mergeOfflineParJobsScriptPath]Oo. .\n")
     return result
Exemplo n.º 9
0
 def doInitMerge(cls):
     from plottingOptions import PlottingOptions
     result = cls.initMerge()
     result = replaceByMap(result, PlottingOptions(None, cls))
     if result and result[-1] != "\n": result += "\n"
     return result