Example #1
0
 def getRepMap(self, alignment = None):
     repMap = GenericValidationData.getRepMap(self, alignment)
     repMap.update({
         "nEvents": self.general["maxevents"],
         "outputFile": replaceByMap( (".oO[workdir]Oo./AlignmentValidation_"
                                      + self.name +
                                      "_.oO[name]Oo..root"), repMap ),
         "resultFile": replaceByMap( (".oO[datadir]Oo./AlignmentValidation_"
                                      + self.name +
                                      "_.oO[name]Oo..root"), repMap ),
         "TrackSelectionTemplate": configTemplates.TrackSelectionTemplate,
         "LorentzAngleTemplate": configTemplates.LorentzAngleTemplate,
         "offlineValidationMode": "Standalone",
         "offlineValidationFileOutput":
         configTemplates.offlineStandaloneFileOutputTemplate,
         "TrackCollection": self.general["trackcollection"]
         })
     repMap["outputFile"] = os.path.expandvars( repMap["outputFile"] )
     repMap["outputFile"] = os.path.abspath( repMap["outputFile"] )
     repMap["resultFile"] = os.path.expandvars( repMap["resultFile"] )
     repMap["resultFile"] = os.path.abspath( repMap["resultFile"] )
     if self.jobmode.split( ',' )[0] == "crab":
         repMap["outputFile"] = os.path.basename( repMap["outputFile"] )
         repMap["resultFile"] = os.path.basename( repMap["resultFile"] )
     return repMap
Example #2
0
 def createScript(self, path, scriptBaseName = "TkAlOfflineValidation"):
     # A separate script is created for each parallel jobs.
     # Since only one cfg is saved a bit ugly solution is needed in the loop.
     returnValue = []
     numJobs = int( self.general["parallelJobs"] )
     for index in range(numJobs):
         scriptName = "%s.%s.%s_%s.sh"%(scriptBaseName, self.name, 
                                        self.alignmentToValidate.name,
                                        str(index))
         repMap = self.getRepMap()
         repMap["nIndex"]=""
         repMap["nIndex"]=str(index)
         repMap["CommandLine"]=""
         repMap.update({
             "outputFile": replaceByMap("AlignmentValidation_"
                                        + self.name +
                                        "_.oO[name]Oo._.oO[nIndex]Oo..root",
                                        repMap )
             })
         for cfg in self.configFiles:
             # The ugly solution here is to change the name for each parallel job 
             cfgtemp = cfg.replace(str(numJobs-1)+"_cfg.py",
                                   str(index)+"_cfg.py")
             repMap["CommandLine"]+= repMap["CommandLineTemplate"]%{"cfgFile":cfgtemp,
                                                                    "postProcess":""
                                                                    }
             scripts = {scriptName: replaceByMap(configTemplates.parallelScriptTemplate,
                                                 repMap ) }
             returnValue.extend(GenericValidationData.createScript(self,
                                                                   scripts,
                                                                   path) )
     return returnValue
Example #3
0
 def getRepMap(self, alignment=None):
     repMap = GenericValidationData.getRepMap(self, alignment)
     repMap.update({
         "nEvents":
         self.general["maxevents"],
         "outputFile":
         replaceByMap(
             ("AlignmentValidation_" + self.name + "_.oO[name]Oo..root"),
             repMap),
         "resultFile":
         replaceByMap(
             ("/store/caf/user/$USER/.oO[eosdir]Oo."
              "/AlignmentValidation_" + self.name + "_.oO[name]Oo..root"),
             repMap),
         "TrackSelectionTemplate":
         configTemplates.TrackSelectionTemplate,
         "LorentzAngleTemplate":
         configTemplates.LorentzAngleTemplate,
         "offlineValidationMode":
         "Standalone",
         "offlineValidationFileOutput":
         configTemplates.offlineStandaloneFileOutputTemplate,
         "TrackCollection":
         self.general["trackcollection"]
     })
     repMap["outputFile"] = os.path.expandvars(repMap["outputFile"])
     repMap["resultFile"] = os.path.expandvars(repMap["resultFile"])
     return repMap
Example #4
0
 def getRepMap(self, alignment=None):
     result = super(GenericValidationData, self).getRepMap(alignment)
     outputfile = os.path.expandvars(
         replaceByMap(
             "%s_%s_.oO[name]Oo..root" % (self.outputBaseName, self.name),
             result))
     resultfile = os.path.expandvars(
         replaceByMap(
             ("/store/caf/user/$USER/.oO[eosdir]Oo./" +
              "%s_%s_.oO[name]Oo..root" % (self.resultBaseName, self.name)),
             result))
     result.update({
         "resultFile": ".oO[resultFiles[.oO[nIndex]Oo.]]Oo.",
         "resultFiles": addIndex(resultfile, self.NJobs),
         "finalResultFile": resultfile,
         "outputFile": ".oO[outputFiles[.oO[nIndex]Oo.]]Oo.",
         "outputFiles": addIndex(outputfile, self.NJobs),
         "finalOutputFile": outputfile,
         "ProcessName": self.ProcessName,
         "Bookkeeping": self.Bookkeeping,
         "LoadBasicModules": self.LoadBasicModules,
         "TrackSelectionRefitting": self.TrackSelectionRefitting,
         "ValidationConfig": self.ValidationTemplate,
         "FileOutputTemplate": self.FileOutputTemplate,
         "DefinePath": self.DefinePath,
     })
     return result
Example #5
0
    def createConfiguration(self, path ):
        # self.__compares
        repMap = self.getRepMap()
        cfgs = { "TkAlCompareToNTuple.%s.%s_cfg.py"%(
            self.alignmentToValidate.name, self.randomWorkdirPart ):
                replaceByMap( configTemplates.intoNTuplesTemplate, repMap)}
        if not self.referenceAlignment == "IDEAL":
            referenceRepMap = self.getRepMap( self.referenceAlignment )
            cfgFileName = "TkAlCompareToNTuple.%s.%s_cfg.py"%(
                self.referenceAlignment.name, self.randomWorkdirPart )
            cfgs[cfgFileName] = replaceByMap(configTemplates.intoNTuplesTemplate,
                                             referenceRepMap)

        cfgSchedule = cfgs.keys()
        for common in self.__compares:
            repMap.update({"common": common,
                           "levels": self.__compares[common][0],
                           "dbOutput": self.__compares[common][1]
                           })
            if self.__compares[common][1].split()[0] == "true":
                repMap["dbOutputService"] = configTemplates.dbOutputTemplate
            else:
                repMap["dbOutputService"] = ""
            cfgName = replaceByMap(("TkAlCompareCommon.oO[common]Oo.."
                                    ".oO[name]Oo._cfg.py"),repMap)
            cfgs[cfgName] = replaceByMap(configTemplates.compareTemplate, repMap)
            
            cfgSchedule.append( cfgName )
        GenericValidation.createConfiguration(self, cfgs, path, cfgSchedule)
Example #6
0
 def getRepMap(self, alignment=None):
     repMap = GenericValidationData.getRepMap(self, alignment)
     repMap.update({
         "nEvents":
         self.general["maxevents"],
         "outputFile":
         replaceByMap((".oO[workdir]Oo./AlignmentValidation_" + self.name +
                       "_.oO[name]Oo..root"), repMap),
         "resultFile":
         replaceByMap((".oO[datadir]Oo./AlignmentValidation_" + self.name +
                       "_.oO[name]Oo..root"), repMap),
         "TrackSelectionTemplate":
         configTemplates.TrackSelectionTemplate,
         "LorentzAngleTemplate":
         configTemplates.LorentzAngleTemplate,
         "offlineValidationMode":
         "Standalone",
         "offlineValidationFileOutput":
         configTemplates.offlineStandaloneFileOutputTemplate,
         "TrackCollection":
         self.general["trackcollection"]
     })
     repMap["outputFile"] = os.path.expandvars(repMap["outputFile"])
     repMap["outputFile"] = os.path.abspath(repMap["outputFile"])
     repMap["resultFile"] = os.path.expandvars(repMap["resultFile"])
     repMap["resultFile"] = os.path.abspath(repMap["resultFile"])
     if self.jobmode.split(',')[0] == "crab":
         repMap["outputFile"] = os.path.basename(repMap["outputFile"])
         repMap["resultFile"] = os.path.basename(repMap["resultFile"])
     return repMap
Example #7
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
Example #8
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)
 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)
Example #10
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
Example #11
0
    def createConfiguration(self,
                            path,
                            configBaseName="TkAlOfflineValidation"):
        # if offline validation uses N parallel jobs, we create here N cfg files
        numberParallelJobs = int(self.general["parallelJobs"])
        # limit maximum number of parallel jobs to 40
        # (each output file is approximately 20MB)
        maximumNumberJobs = 40
        if numberParallelJobs > maximumNumberJobs:
            msg = ("Maximum allowed number of parallel jobs " +
                   str(maximumNumberJobs) + " exceeded!!!")
            raise AllInOneError(msg)
        # if maxevents is not specified, cannot calculate number of events for
        # each parallel job, and therefore running only a single job
        if int(self.general["maxevents"]) == -1:
            msg = ("Maximum number of events (maxevents) not specified: "
                   "cannot use parallel jobs in offline validation")
            raise AllInOneError(msg)
        if numberParallelJobs > 1:
            if self.general["offlineModuleLevelHistsTransient"] == "True":
                msg = (
                    "To be able to merge results when running parallel jobs,"
                    " set offlineModuleLevelHistsTransient to false.")
                raise AllInOneError(msg)
        for index in range(numberParallelJobs):
            cfgName = "%s.%s.%s_%s_cfg.py" % (configBaseName, self.name,
                                              self.alignmentToValidate.name,
                                              str(index))
            repMap = self.getRepMap()
            # in this parallel job, skip index*(maxEvents/nJobs) events from
            # the beginning
            # (first index is zero, so no skipping for a single job)
            # and use _index_ in the name of the output file
            repMap.update({"nIndex": str(index)})
            # Create the result file directly to datadir since should not use /tmp/
            # see https://cern.service-now.com/service-portal/article.do?n=KB0000484
            repMap.update({
                "outputFile":
                replaceByMap(
                    ".oO[datadir]Oo./AlignmentValidation_" + self.name +
                    "_.oO[name]Oo._.oO[nIndex]Oo..root", repMap)
            })
            repMap["outputFile"] = os.path.expandvars(repMap["outputFile"])
            repMap["outputFile"] = os.path.abspath(repMap["outputFile"])

            cfgs = {
                cfgName:
                replaceByMap(configTemplates.offlineParallelTemplate, repMap)
            }
            self.filesToCompare[GenericValidationData.
                                defaultReferenceName] = repMap["resultFile"]
            GenericValidationData.createConfiguration(self, cfgs, path)
 def getRepMap( self, alignment = None ):
     repMap = GenericValidationData.getRepMap(self, alignment)
     repMap.update({
         "resultFile": replaceByMap(("/store/caf/user/$USER/.oO[eosdir]Oo."
                                     "/McValidation_"
                                     + self.name +
                                     "_.oO[name]Oo..root"), repMap ),
         "outputFile": replaceByMap(("McValidation_"
                                     + self.name +
                                     "_.oO[name]Oo..root"), repMap ),
         "nEvents": self.general["maxevents"]
         })
     repMap["outputFile"] = os.path.expandvars( repMap["outputFile"] )
     repMap["resultFile"] = os.path.expandvars( repMap["resultFile"] )
     return repMap
Example #13
0
 def appendToPlots(self):
     """
     if no argument or "" is passed a string with an instantiation is
     returned, else the validation is appended to the list
     """
     repMap = self.getRepMap()
     return replaceByMap('    filenames.push_back("root://eoscms//eos/cms/store/caf/user/$USER/.oO[eosdir]Oo./BiasCheck.root");  titles.push_back(".oO[title]Oo.");  colors.push_back(.oO[color]Oo.);  linestyles.push_back(.oO[style]Oo.);\n', repMap)
Example #14
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
Example #15
0
 def createConfiguration(self, path, configBaseName = "TkAlZMuMuValidation" ):
     cfgName = "%s.%s.%s_cfg.py"%( configBaseName, self.name,
                                   self.alignmentToValidate.name )
     repMap = self.getRepMap()
     cfgs = {cfgName:replaceByMap(configTemplates.ZMuMuValidationTemplate,
                                  repMap)}
     GenericValidationData.createConfiguration(self, cfgs, path)
Example #16
0
 def getRepMap(self, alignment=None):
     repMap = GenericValidationData.getRepMap(self, alignment)
     repMap.update({
         "resultFile":
         replaceByMap(("/store/caf/user/$USER/.oO[eosdir]Oo."
                       "/McValidation_" + self.name + "_.oO[name]Oo..root"),
                      repMap),
         "outputFile":
         replaceByMap(("McValidation_" + self.name + "_.oO[name]Oo..root"),
                      repMap),
         "nEvents":
         self.general["maxevents"]
     })
     repMap["outputFile"] = os.path.expandvars(repMap["outputFile"])
     repMap["resultFile"] = os.path.expandvars(repMap["resultFile"])
     return repMap
Example #17
0
 def appendToPlots(self):
     """
     if no argument or "" is passed a string with an instantiation is
     returned, else the validation is appended to the list
     """
     repMap = self.getRepMap()
     return replaceByMap('    filenames.push_back("root://eoscms//eos/cms/store/group/alca_trackeralign/AlignmentValidation/.oO[eosdir]Oo./BiasCheck.root");  titles.push_back(".oO[title]Oo.");  colors.push_back(.oO[color]Oo.);  linestyles.push_back(.oO[style]Oo.);\n', repMap)
 def createCrabCfg(self, path, crabCfgBaseName):
     """
     Method which creates a `crab.cfg` for a validation on datasets.
     
     Arguments:
     - `path`: Path at which the file will be stored.
     - `crabCfgBaseName`: String which depends on the actual type of
                          validation calling this method.
     """
     crabCfgName = "crab.%s.%s.%s.cfg"%( crabCfgBaseName, self.name,
                                         self.alignmentToValidate.name )
     repMap = self.getRepMap()
     repMap["script"] = "dummy_script.sh"
     # repMap["crabOutputDir"] = os.path.basename( path )
     repMap["crabWorkingDir"] = crabCfgName.split( '.cfg' )[0]
     self.crabWorkingDir = repMap["crabWorkingDir"]
     repMap["numberOfJobs"] = self.general["parallelJobs"]
     repMap["cfgFile"] = self.configFiles[0]
     repMap["queue"] = self.jobmode.split( ',' )[1].split( '-q' )[1]
     if self.dataset.dataType() == "mc":
         repMap["McOrData"] = "events = .oO[nEvents]Oo."
     elif self.dataset.dataType() == "data":
         repMap["McOrData"] = "lumis = -1"
         if self.jobmode.split( ',' )[0] == "crab":
             print ("For jobmode 'crab' the parameter 'maxevents' will be "
                    "ignored and all events will be processed.")
     else:
         raise AllInOneError("Unknown data type!  Can't run in crab mode")
     crabCfg = {crabCfgName: replaceByMap( configTemplates.crabCfgTemplate,
                                           repMap ) }
     return super(GenericValidationData, self).createCrabCfg( crabCfg, path )
    def validsubdets(self):
        filename = replaceByMap(".oO[Alignment/CommonAlignmentProducer]Oo./python/AlignmentTrackSelector_cfi.py", self.getRepMap())
        with open(filename) as f:
            trackselector = f.read()

        minhitspersubdet = trackselector.split("minHitsPerSubDet")[1].split("(",1)[1]

        parenthesesdepth = 0
        i = 0
        for character in minhitspersubdet:
            if character == "(":
                parenthesesdepth += 1
            if character == ")":
                parenthesesdepth -= 1
            if parenthesesdepth < 0:
                break
            i += 1
        minhitspersubdet = minhitspersubdet[0:i]

        results = minhitspersubdet.split(",")
        empty = []
        for i in range(len(results)):
            results[i] = results[i].split("=")[0].strip().replace("in", "", 1)

        results.append("none")

        return [a for a in results if a]
Example #20
0
    def createConfiguration(self, path ):
        # self.__compares
        repMap = self.getRepMap()
        cfgFileName = "TkAlCompareToNTuple.%s_cfg.py"%(
            self.alignmentToValidate.name)
        cfgs = {cfgFileName: configTemplates.intoNTuplesTemplate}
        repMaps = {cfgFileName: repMap}
        if not self.referenceAlignment == "IDEAL":
            referenceRepMap = self.getRepMap( self.referenceAlignment )
            cfgFileName = "TkAlCompareToNTuple.%s_cfg.py"%(
                self.referenceAlignment.name )
            cfgs[cfgFileName] = configTemplates.intoNTuplesTemplate
            repMaps[cfgFileName] = referenceRepMap

        cfgSchedule = cfgs.keys()
        for common in self.__compares:
            repMap.update({
                           "levels": self.__compares[common][0],
                           "dbOutput": pythonboolstring(self.__compares[common][1], "dbOutput")
                           })
            if self.__compares[common][1].split()[0] == "true":
                repMap["dbOutputService"] = configTemplates.dbOutputTemplate
            else:
                repMap["dbOutputService"] = ""
            cfgName = replaceByMap(("TkAlCompareCommon.oO[common]Oo.."
                                    ".oO[name]Oo._cfg.py"),repMap)
            cfgs[cfgName] = configTemplates.compareTemplate
            repMaps[cfgName] = repMap

            cfgSchedule.append( cfgName )
        super(GeometryComparison, self).createConfiguration(cfgs, path, cfgSchedule, repMaps = repMaps)
Example #21
0
 def createCrabCfg(self, path, crabCfgBaseName):
     """
     Method which creates a `crab.cfg` for a validation on datasets.
     
     Arguments:
     - `path`: Path at which the file will be stored.
     - `crabCfgBaseName`: String which depends on the actual type of
                          validation calling this method.
     """
     crabCfgName = "crab.%s.%s.%s.cfg" % (crabCfgBaseName, self.name,
                                          self.alignmentToValidate.name)
     repMap = self.getRepMap()
     repMap["script"] = "dummy_script.sh"
     # repMap["crabOutputDir"] = os.path.basename( path )
     repMap["crabWorkingDir"] = crabCfgName.split('.cfg')[0]
     self.crabWorkingDir = repMap["crabWorkingDir"]
     repMap["numberOfJobs"] = self.general["parallelJobs"]
     repMap["cfgFile"] = self.configFiles[0]
     repMap["queue"] = self.jobmode.split(',')[1].split('-q')[1]
     if self.dataset.dataType() == "mc":
         repMap["McOrData"] = "events = .oO[nEvents]Oo."
     elif self.dataset.dataType() == "data":
         repMap["McOrData"] = "lumis = -1"
         if self.jobmode.split(',')[0] == "crab":
             print(
                 "For jobmode 'crab' the parameter 'maxevents' will be "
                 "ignored and all events will be processed.")
     else:
         raise AllInOneError("Unknown data type!  Can't run in crab mode")
     crabCfg = {
         crabCfgName: replaceByMap(configTemplates.crabCfgTemplate, repMap)
     }
     return GenericValidation.createCrabCfg(self, crabCfg, path)
 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
 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
Example #24
0
 def createScript(self, path, scriptBaseName="TkAlOfflineValidation"):
     # A separate script is created for each parallel jobs.
     # Since only one cfg is saved a bit ugly solution is needed in the loop.
     returnValue = []
     numJobs = int(self.general["parallelJobs"])
     for index in range(numJobs):
         scriptName = "%s.%s.%s_%s.sh" % (scriptBaseName, self.name,
                                          self.alignmentToValidate.name,
                                          str(index))
         repMap = self.getRepMap()
         repMap["nIndex"] = ""
         repMap["nIndex"] = str(index)
         repMap["CommandLine"] = ""
         repMap.update({"outputFile": self.outputFiles[index]})
         for cfg in self.configFiles:
             # The ugly solution here is to change the name for each parallel job
             cfgtemp = cfg.replace(
                 str(numJobs - 1) + "_cfg.py",
                 str(index) + "_cfg.py")
             repMap["CommandLine"] += repMap["CommandLineTemplate"] % {
                 "cfgFile": cfgtemp,
                 "postProcess": ""
             }
             scripts = {
                 scriptName:
                 replaceByMap(configTemplates.parallelScriptTemplate,
                              repMap)
             }
             returnValue.extend(
                 GenericValidationData.createScript(self, scripts, path))
     return returnValue
Example #25
0
 def createConfiguration(self, path):
     cfgName = "%s.%s.%s_cfg.py"%( self.configBaseName, self.name,
                                   self.alignmentToValidate.name )
     repMap = self.getRepMap()
     self.filesToCompare[GenericValidationData.defaultReferenceName] = \
         replaceByMap(".oO[eosdir]Oo./0_zmumuHisto.root", repMap)
     cfgs = {cfgName: configTemplates.ZMuMuValidationTemplate}
     GenericValidationData.createConfiguration(self, cfgs, path, repMap = repMap)
Example #26
0
    def createConfiguration(self, path, configBaseName = "TkAlOfflineValidation"):
        # if offline validation uses N parallel jobs, we create here N cfg files
        numberParallelJobs = int( self.general["parallelJobs"] )
        # limit maximum number of parallel jobs to 40
        # (each output file is approximately 20MB)
        maximumNumberJobs = 40
        if numberParallelJobs > maximumNumberJobs:
            msg = ("Maximum allowed number of parallel jobs "
                   +str(maximumNumberJobs)+" exceeded!!!")
            raise AllInOneError(msg)
        # if maxevents is not specified, cannot calculate number of events for
        # each parallel job, and therefore running only a single job
        if int( self.general["maxevents"] ) == -1:
            msg = ("Maximum number of events (maxevents) not specified: "
                   "cannot use parallel jobs in offline validation")
            raise AllInOneError(msg)
        if numberParallelJobs > 1:    
            if self.general["offlineModuleLevelHistsTransient"] == "True":
                msg = ("To be able to merge results when running parallel jobs,"
                       " set offlineModuleLevelHistsTransient to false.")
                raise AllInOneError(msg)
        for index in range(numberParallelJobs):
            cfgName = "%s.%s.%s_%s_cfg.py"%(configBaseName, self.name,
                                            self.alignmentToValidate.name,
                                            str(index))
            repMap = self.getRepMap()
            # in this parallel job, skip index*(maxEvents/nJobs) events from
            # the beginning
            # (first index is zero, so no skipping for a single job)
            # and use _index_ in the name of the output file
            repMap.update({"nIndex": str(index)})
            # Create the result file directly to datadir since should not use /tmp/
            # see https://cern.service-now.com/service-portal/article.do?n=KB0000484
            repMap.update({
                "outputFile": replaceByMap(".oO[datadir]Oo./AlignmentValidation_"
                                           + self.name +
                                           "_.oO[name]Oo._.oO[nIndex]Oo..root",
                                           repMap )
                })
            repMap["outputFile"] = os.path.expandvars( repMap["outputFile"] )
            repMap["outputFile"] = os.path.abspath( repMap["outputFile"] )

            cfgs = {cfgName:replaceByMap(configTemplates.offlineParallelTemplate,
                                         repMap)}
            self.filesToCompare[GenericValidationData.defaultReferenceName] = repMap["resultFile"] 
            GenericValidationData.createConfiguration(self, cfgs, path)
Example #27
0
 def createScript(self, path, scriptBaseName="TkAlZMuMuValidation"):
     scriptName = "%s.%s.%s.sh" % (scriptBaseName, self.name, self.alignmentToValidate.name)
     repMap = self.getRepMap()
     repMap["CommandLine"] = ""
     for cfg in self.configFiles:
         repMap["CommandLine"] += repMap["CommandLineTemplate"] % {"cfgFile": cfg, "postProcess": ""}
     scripts = {scriptName: replaceByMap(configTemplates.zMuMuScriptTemplate, repMap)}
     return GenericValidationData.createScript(self, scripts, path)
Example #28
0
 def getRepMap(self, alignment = None):
     result = GenericValidation.getRepMap(self, alignment)
     outputfile = os.path.expandvars(replaceByMap(
                        "%s_%s_.oO[name]Oo..root" % (self.outputBaseName, self.name)
                              , result))
     resultfile = os.path.expandvars(replaceByMap(("/store/caf/user/$USER/.oO[eosdir]Oo./" +
                        "%s_%s_.oO[name]Oo..root" % (self.resultBaseName, self.name))
                              , result))
     result.update({
             "resultFile": ".oO[resultFiles[.oO[nIndex]Oo.]]Oo.",
             "resultFiles": addIndex(resultfile, self.NJobs),
             "finalResultFile": resultfile,
             "outputFile": ".oO[outputFiles[.oO[nIndex]Oo.]]Oo.",
             "outputFiles": addIndex(outputfile, self.NJobs),
             "finalOutputFile": outputfile
             })
     return result
Example #29
0
 def appendToMerge(self, mergesSoFar=""):
     """
     append all merges here
     """
     repMap = self.getRepMap()
     mergesSoFar += replaceByMap(
         configTemplates.mergeOfflineParallelResults, repMap)
     return mergesSoFar
Example #30
0
 def getRepMap(self, alignment = None):
     result = GenericValidation.getRepMap(self, alignment)
     outputfile = os.path.expandvars(replaceByMap(
                        "%s_%s_.oO[name]Oo..root" % (self.outputBaseName, self.name)
                              , result))
     resultfile = os.path.expandvars(replaceByMap(("/store/caf/user/$USER/.oO[eosdir]Oo./" +
                        "%s_%s_.oO[name]Oo..root" % (self.resultBaseName, self.name))
                              , result))
     result.update({
             "resultFile": ".oO[resultFiles[.oO[nIndex]Oo.]]Oo.",
             "resultFiles": addIndex(resultfile, self.NJobs),
             "finalResultFile": resultfile,
             "outputFile": ".oO[outputFiles[.oO[nIndex]Oo.]]Oo.",
             "outputFiles": addIndex(outputfile, self.NJobs),
             "finalOutputFile": outputfile
             })
     return result
Example #31
0
 def appendToMerge( self, mergesSoFar = "" ):
     """
     append all merges here
     """
     repMap = self.getRepMap()
     mergesSoFar += replaceByMap(configTemplates.mergeOfflineParallelResults,
                                 repMap)
     return mergesSoFar
 def createConfiguration(self, path ):
     cfgName = "TkAlMcValidate.%s.%s_cfg.py"%(self.name,
                                              self.alignmentToValidate.name)
     repMap = self.getRepMap()
     cfgs = {cfgName:replaceByMap(configTemplates.mcValidateTemplate,
                                  repMap)}
     self.filesToCompare[GenericValidationData.defaultReferenceName] = \
         repMap["resultFile"]
     GenericValidationData.createConfiguration(self, cfgs, path)
Example #33
0
 def createConfiguration(self, path,
                         configBaseName = "TkAlOfflineValidation" ):
     cfgName = "%s.%s.%s_cfg.py"%( configBaseName, self.name,
                                   self.alignmentToValidate.name )
     repMap = self.getRepMap()
       
     cfgs = {cfgName:replaceByMap( configTemplates.offlineTemplate, repMap)}
     self.filesToCompare[
         GenericValidationData.defaultReferenceName ] = repMap["resultFile"]
     GenericValidationData.createConfiguration(self, cfgs, path)
Example #34
0
 def createConfiguration(self, path):
     cfgName = "TkAlMcValidate.%s.%s_cfg.py" % (
         self.name, self.alignmentToValidate.name)
     repMap = self.getRepMap()
     cfgs = {
         cfgName: replaceByMap(configTemplates.mcValidateTemplate, repMap)
     }
     self.filesToCompare[GenericValidationData.defaultReferenceName] = \
         repMap["outputFile"]
     GenericValidationData.createConfiguration(self, cfgs, path)
Example #35
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
Example #36
0
 def createConfiguration(self, path):
     cfgName = "%s.%s.%s_cfg.py" % (self.configBaseName, self.name,
                                    self.alignmentToValidate.name)
     repMap = self.getRepMap()
     self.filesToCompare[GenericValidationData.defaultReferenceName] = \
         replaceByMap(".oO[eosdir]Oo./0_zmumuHisto.root", repMap)
     cfgs = {cfgName: configTemplates.ZMuMuValidationTemplate}
     GenericValidationData.createConfiguration(self,
                                               cfgs,
                                               path,
                                               repMap=repMap)
 def doMerge(self):
     result = self.appendToMerge()
     if result[-1] != "\n": result += "\n"
     result += ("if [[ tmpMergeRetCode -eq 0 ]]; then\n"
                "  xrdcp -f .oO[finalOutputFile]Oo. root://eoscms//eos/cms.oO[finalResultFile]Oo.\n"
                "fi\n"
                "if [[ ${tmpMergeRetCode} -gt ${mergeRetCode} ]]; then\n"
                "  mergeRetCode=${tmpMergeRetCode}\n"
                "fi\n")
     result = replaceByMap(result, self.getRepMap())
     return result
Example #38
0
 def createScript(self, path, scriptBaseName = "TkAlZMuMuValidation"):
     scriptName = "%s.%s.%s.sh"%(scriptBaseName, self.name,
                                 self.alignmentToValidate.name )
     repMap = self.getRepMap()
     repMap["CommandLine"]=""
     for cfg in self.configFiles:
         repMap["CommandLine"]+= repMap["CommandLineTemplate"]%{"cfgFile":cfg,
                                               "postProcess":""
                                               }
     scripts = {scriptName: replaceByMap(configTemplates.zMuMuScriptTemplate,
                                         repMap ) }
     return GenericValidationData.createScript(self, scripts, path)
Example #39
0
 def doMerge(self):
     result = self.appendToMerge()
     if result[-1] != "\n": result += "\n"
     result += (
         "if [[ tmpMergeRetCode -eq 0 ]]; then\n"
         "  xrdcp -f .oO[finalOutputFile]Oo. root://eoscms//eos/cms.oO[finalResultFile]Oo.\n"
         "fi\n"
         "if [[ ${tmpMergeRetCode} -gt ${mergeRetCode} ]]; then\n"
         "  mergeRetCode=${tmpMergeRetCode}\n"
         "fi\n")
     result = replaceByMap(result, self.getRepMap())
     return result
Example #40
0
 def appendToExtendedValidation(self, validationsSoFar=""):
     """
     if no argument or "" is passed a string with an instantiation is
     returned, else the validation is appended to the list
     """
     repMap = self.getRepMap()
     if validationsSoFar != "":
         validationsSoFar += '    '
     validationsSoFar += replaceByMap(
         'filenames.push_back("root://eoscms//eos/cms/store/caf/user/$USER/.oO[eosdir]Oo./BiasCheck.root");  titles.push_back(".oO[title]Oo.");  colors.push_back(.oO[color]Oo.);  linestyles.push_back(.oO[style]Oo.);\n',
         repMap)
     return validationsSoFar
 def getRepMap( self, alignment = None ):
     repMap = GenericValidationData.getRepMap(self)
     repMap.update({ 
         "resultFile": replaceByMap( ("/store/caf/user/$USER/.oO[eosdir]Oo."
                                      "/TrackSplitting_"
                                      + self.name +
                                      "_.oO[name]Oo..root"),
                                     repMap ),
         "outputFile": replaceByMap( ("TrackSplitting_"
                                      + self.name +
                                      "_.oO[name]Oo..root"),
                                     repMap ),
         "nEvents": self.general["maxevents"],
         "TrackCollection": self.general["trackcollection"]
         })
     repMap["outputFile"] = os.path.expandvars( repMap["outputFile"] )
     repMap["resultFile"] = os.path.expandvars( repMap["resultFile"] )
     # repMap["outputFile"] = os.path.abspath( repMap["outputFile"] )
     # if self.jobmode.split( ',' )[0] == "crab":
     #     repMap["outputFile"] = os.path.basename( repMap["outputFile"] )
     return repMap
Example #42
0
 def getRepMap(self, alignment = None):
     repMap = GenericValidationData.getRepMap(self, alignment)
     repMap.update({
         "nEvents": self.general["maxevents"],
         "outputFile": replaceByMap( ("AlignmentValidation_"
                                      + self.name +
                                      "_.oO[name]Oo..root"), repMap ),
         "resultFile": replaceByMap( ("/store/caf/user/$USER/.oO[eosdir]Oo."
                                      "/AlignmentValidation_"
                                      + self.name +
                                      "_.oO[name]Oo..root"), repMap ),
         "TrackSelectionTemplate": configTemplates.TrackSelectionTemplate,
         "LorentzAngleTemplate": configTemplates.LorentzAngleTemplate,
         "offlineValidationMode": "Standalone",
         "offlineValidationFileOutput":
         configTemplates.offlineStandaloneFileOutputTemplate,
         "TrackCollection": self.general["trackcollection"]
         })
     repMap["outputFile"] = os.path.expandvars( repMap["outputFile"] )
     repMap["resultFile"] = os.path.expandvars( repMap["resultFile"] )
     return repMap
 def getRepMap( self, alignment = None ):
     repMap = GenericValidationData.getRepMap(self, alignment)
     repMap.update({
         "outputFile": replaceByMap((".oO[workdir]Oo./McValidation_"
                                     + self.name +
                                     "_.oO[name]Oo..root"), repMap ),
         "nEvents": self.general["maxevents"]
         })
     repMap["outputFile"] = os.path.expandvars( repMap["outputFile"] )
     repMap["outputFile"] = os.path.abspath( repMap["outputFile"] )
     if self.jobmode.split( ',' )[0] == "crab":
         repMap["outputFile"] = os.path.basename( repMap["outputFile"] )
     return repMap
Example #44
0
 def __init__(self, valName, alignment, config):
     OfflineValidation.__init__(self, valName, alignment, config)
     defaults = {"parallelJobs": "1", "jobmode": self.jobmode}
     offline = config.getResultingSection("offline:" + self.name,
                                          defaultDict=defaults)
     self.general.update(offline)
     self.__NJobs = self.general["parallelJobs"]
     self.outputFiles = []
     for index in range(int(self.general["parallelJobs"])):
         fName = replaceByMap(
             "AlignmentValidation_" + self.name + "_.oO[name]Oo._%d.root" %
             (index), self.getRepMap())
         self.outputFiles.append(fName)
Example #45
0
 def getRepMap(self, alignment=None):
     repMap = GenericValidationData.getRepMap(self, alignment)
     repMap.update({
         "outputFile":
         replaceByMap((".oO[workdir]Oo./McValidation_" + self.name +
                       "_.oO[name]Oo..root"), repMap),
         "nEvents":
         self.general["maxevents"]
     })
     repMap["outputFile"] = os.path.expandvars(repMap["outputFile"])
     repMap["outputFile"] = os.path.abspath(repMap["outputFile"])
     if self.jobmode.split(',')[0] == "crab":
         repMap["outputFile"] = os.path.basename(repMap["outputFile"])
     return repMap
Example #46
0
 def getRepMap(self, alignment=None):
     repMap = GenericValidationData.getRepMap(self)
     repMap.update({
         "resultFile":
         replaceByMap(
             ("/store/caf/user/$USER/.oO[eosdir]Oo."
              "/TrackSplitting_" + self.name + "_.oO[name]Oo..root"),
             repMap),
         "outputFile":
         replaceByMap(
             ("TrackSplitting_" + self.name + "_.oO[name]Oo..root"),
             repMap),
         "nEvents":
         self.general["maxevents"],
         "TrackCollection":
         self.general["trackcollection"]
     })
     repMap["outputFile"] = os.path.expandvars(repMap["outputFile"])
     repMap["resultFile"] = os.path.expandvars(repMap["resultFile"])
     # repMap["outputFile"] = os.path.abspath( repMap["outputFile"] )
     # if self.jobmode.split( ',' )[0] == "crab":
     #     repMap["outputFile"] = os.path.basename( repMap["outputFile"] )
     return repMap
 def getRepMap(self, alignment = None):
     result = super(GenericValidationData, self).getRepMap(alignment)
     outputfile = os.path.expandvars(replaceByMap(
                        "%s_%s_.oO[name]Oo..root" % (self.outputBaseName, self.name)
                              , result))
     resultfile = os.path.expandvars(replaceByMap(("/store/caf/user/$USER/.oO[eosdir]Oo./" +
                        "%s_%s_.oO[name]Oo..root" % (self.resultBaseName, self.name))
                              , result))
     result.update({
             "resultFile": ".oO[resultFiles[.oO[nIndex]Oo.]]Oo.",
             "resultFiles": addIndex(resultfile, self.NJobs),
             "finalResultFile": resultfile,
             "outputFile": ".oO[outputFiles[.oO[nIndex]Oo.]]Oo.",
             "outputFiles": addIndex(outputfile, self.NJobs),
             "finalOutputFile": outputfile,
             "ProcessName": self.ProcessName,
             "Bookkeeping": self.Bookkeeping,
             "LoadBasicModules": self.LoadBasicModules,
             "TrackSelectionRefitting": self.TrackSelectionRefitting,
             "ValidationConfig": self.ValidationTemplate,
             "FileOutputTemplate": self.FileOutputTemplate,
             "DefinePath": self.DefinePath,
             })
     return result
 def __init__(self, valName, alignment,config):
     OfflineValidation.__init__(self, valName, alignment, config)
     defaults = {
         "parallelJobs":"1",
         "jobmode":self.jobmode
         }
     offline = config.getResultingSection( "offline:"+self.name, 
                                           defaultDict = defaults )
     self.general.update( offline )
     self.__NJobs = self.general["parallelJobs"]
     self.outputFiles = []
     for index in range(int(self.general["parallelJobs"])):
         fName = replaceByMap("AlignmentValidation_"+self.name
                              +"_.oO[name]Oo._%d.root"%(index),
                              self.getRepMap())
         self.outputFiles.append(fName)
Example #49
0
 def getConditions(self):
     """This function creates the configuration snippet to override
        global tag conditions.
        """
     if len( self.conditions ):
         loadCond = ("\nimport CalibTracker.Configuration."
                     "Common.PoolDBESSource_cfi\n")
         for cond in self.conditions:
             if not cond["labelName"] == "":
                 temp = configTemplates.conditionsTemplate.replace(
                     "tag = cms.string('.oO[tagName]Oo.')",
                     ("tag = cms.string('.oO[tagName]Oo.'),"
                      "\nlabel = cms.untracked.string('.oO[labelName]Oo.')"))
             else:
                 temp = configTemplates.conditionsTemplate
             loadCond += replaceByMap( temp, cond )
     else:
         loadCond = ""
     return loadCond
Example #50
0
    def createFiles(self, fileContents, path, repMap = None, repMaps = None):
        """repMap: single map for all files
           repMaps: a dict, with the filenames as the keys"""
        if repMap is not None and repMaps is not None:
            raise AllInOneError("createFiles can only take repMap or repMaps (or neither), not both")
        result = []
        for fileName in fileContents:
            filePath = os.path.join(path, fileName)
            result.append(filePath)

            for (i, filePathi) in enumerate(addIndex(filePath, self.NJobs)):
                theFile = open( filePathi, "w" )
                fileContentsi = fileContents[ fileName ]
                if repMaps is not None:
                    repMap = repMaps[fileName]
                if repMap is not None:
                    repMap.update({"nIndex": str(i)})
                    fileContentsi = replaceByMap(fileContentsi, repMap)
                theFile.write( fileContentsi )
                theFile.close()

        return result
    def createFiles(self, fileContents, path, repMap = None, repMaps = None):
        """repMap: single map for all files
           repMaps: a dict, with the filenames as the keys"""
        if repMap is not None and repMaps is not None:
            raise AllInOneError("createFiles can only take repMap or repMaps (or neither), not both")
        result = []
        for fileName in fileContents:
            filePath = os.path.join(path, fileName)
            result.append(filePath)

            for (i, filePathi) in enumerate(addIndex(filePath, self.NJobs)):
                theFile = open( filePathi, "w" )
                fileContentsi = fileContents[ fileName ]
                if repMaps is not None:
                    repMap = repMaps[fileName]
                if repMap is not None:
                    repMap.update({"nIndex": str(i)})
                    fileContentsi = replaceByMap(fileContentsi, repMap)
                theFile.write( fileContentsi )
                theFile.close()

        return result
Example #52
0
    def createConfiguration(self, path):
        # self.__compares
        repMap = self.getRepMap()
        cfgFileName = "TkAlCompareToNTuple.%s_cfg.py" % (
            self.alignmentToValidate.name)
        cfgs = {cfgFileName: configTemplates.intoNTuplesTemplate}
        repMaps = {cfgFileName: repMap}
        if not self.referenceAlignment == "IDEAL":
            referenceRepMap = self.getRepMap(self.referenceAlignment)
            cfgFileName = "TkAlCompareToNTuple.%s_cfg.py" % (
                self.referenceAlignment.name)
            cfgs[cfgFileName] = configTemplates.intoNTuplesTemplate
            repMaps[cfgFileName] = referenceRepMap

        cfgSchedule = cfgs.keys()
        for common in self.__compares:
            repMap.update({
                "levels":
                self.__compares[common][0],
                "dbOutput":
                pythonboolstring(self.__compares[common][1], "dbOutput")
            })
            if self.__compares[common][1].split()[0] == "true":
                repMap["dbOutputService"] = configTemplates.dbOutputTemplate
            else:
                repMap["dbOutputService"] = ""
            cfgName = replaceByMap(("TkAlCompareCommon.oO[common]Oo.."
                                    ".oO[name]Oo._cfg.py"), repMap)
            cfgs[cfgName] = configTemplates.compareTemplate
            repMaps[cfgName] = repMap

            cfgSchedule.append(cfgName)
        super(GeometryComparison, self).createConfiguration(cfgs,
                                                            path,
                                                            cfgSchedule,
                                                            repMaps=repMaps)
Example #53
0
    def createScript(self, path):    
        repMap = self.getRepMap()    
        repMap["runComparisonScripts"] = ""
        scriptName = replaceByMap(("TkAlGeomCompare.%s..oO[name]Oo..sh"
                                   %self.name), repMap)
        for name in self.__compares:
            if  '"DetUnit"' in self.__compares[name][0].split(","):
                repMap["runComparisonScripts"] += \
                    ("rfcp .oO[CMSSW_BASE]Oo./src/Alignment/OfflineValidation"
                     "/scripts/comparisonScript.C .\n"
                     "rfcp .oO[CMSSW_BASE]Oo./src/Alignment/OfflineValidation"
                     "/scripts/comparisonPlots.h .\n"
                     "rfcp .oO[CMSSW_BASE]Oo./src/Alignment/OfflineValidation"
                     "/scripts/comparisonPlots.cc .\n"
                     "root -b -q 'comparisonScript.C(\""
                     ".oO[name]Oo..Comparison_common"+name+".root\",\""
                     "./\")'\n")
                if  self.copyImages:
                   repMap["runComparisonScripts"] += \
                       ("rfmkdir -p .oO[datadir]Oo./.oO[name]Oo."
                        ".Comparison_common"+name+"_Images\n")
                   repMap["runComparisonScripts"] += \
                       ("find . -maxdepth 1 -name \"plot*.eps\" "
                        "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo."
                        "/.oO[name]Oo..Comparison_common"+name+"_Images/\" \n")
                   repMap["runComparisonScripts"] += \
                       ("find . -maxdepth 1 -name \"plot*.pdf\" "
                        "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo."
                        "/.oO[name]Oo..Comparison_common"+name+"_Images/\" \n")
                   repMap["runComparisonScripts"] += \
                       ("find . -maxdepth 1 -name "
                        "\"TkMap_SurfDeform*.pdf\" -print | xargs -I {} bash -c"
                        " \"rfcp {} .oO[datadir]Oo./.oO[name]Oo."
                        ".Comparison_common"+name+"_Images/\" \n")
                   repMap["runComparisonScripts"] += \
                       ("find . -maxdepth 1 -name "
                        "\"TkMap_SurfDeform*.png\" -print | xargs -I {} bash -c"
                        " \"rfcp {} .oO[datadir]Oo./.oO[name]Oo."
                        ".Comparison_common"+name+"_Images/\" \n")
                   repMap["runComparisonScripts"] += \
                       ("if [[ $HOSTNAME = lxplus[0-9]*\.cern\.ch ]]\n"
                        "then\n"
                        "    rfmkdir -p .oO[workdir]Oo./.oO[name]Oo.."+name
                        +"_ArrowPlots\n"
                        "else\n"
                        "    mkdir -p $CWD/TkAllInOneTool/.oO[name]Oo.."+name
                        +"_ArrowPlots\n"
                        "fi\n")
                   repMap["runComparisonScripts"] += \
                       ("rfcp .oO[CMSSW_BASE]Oo./src/Alignment"
                        "/OfflineValidation/scripts/makeArrowPlots "
                        "$CWD/TkAllInOneTool\n"
                        "root -b -q 'makeArrowPlots.C(\""
                        ".oO[name]Oo..Comparison_common"+name
                        +".root\",\".oO[name]Oo.."
                        +name+"_ArrowPlots\")'\n")
                   repMap["runComparisonScripts"] += \
                       ("rfmkdir -p .oO[datadir]Oo./.oO[name]Oo."
                        ".Comparison_common"+name+"_Images/ArrowPlots\n")
                   repMap["runComparisonScripts"] += \
                       ("find .oO[name]Oo.."+name+"_ArrowPlots "
                        "-maxdepth 1 -name \"*.png\" -print | xargs -I {} bash "
                        "-c \"rfcp {} .oO[datadir]Oo./.oO[name]Oo."
                        ".Comparison_common"+name+"_Images/ArrowPlots\"\n")

                resultingFile = replaceByMap(("/store/caf/user/$USER/.oO[eosdir]Oo./compared%s_"
                                              ".oO[name]Oo..root"%name), repMap)
                resultingFile = os.path.expandvars( resultingFile )
                resultingFile = os.path.abspath( resultingFile )
                repMap["runComparisonScripts"] += \
                    ("cmsStage -f OUTPUT_comparison.root %s\n"
                     %resultingFile)
                self.filesToCompare[ name ] = resultingFile
                
        repMap["CommandLine"]=""

        for cfg in self.configFiles:
            # FIXME: produce this line only for enabled dbOutput
            # postProcess = "rfcp .oO[workdir]Oo./*.db .oO[datadir]Oo.\n"
            postProcess = "rfcp *.db .oO[datadir]Oo.\n"
            repMap["CommandLine"]+= \
                repMap["CommandLineTemplate"]%{"cfgFile":cfg,
                                               "postProcess":postProcess}
        repMap["CommandLine"]+= ("# overall postprocessing\n"
                                 ".oO[runComparisonScripts]Oo.\n"
                                 )

        scripts = {scriptName: replaceByMap( configTemplates.scriptTemplate, repMap ) }  
        return GenericValidation.createScript(self, scripts, path)
Example #54
0
    def createScript(self, path):    
        repMap = self.getRepMap()    
        repMap["runComparisonScripts"] = ""
        scriptName = replaceByMap(("TkAlGeomCompare.%s..oO[name]Oo..sh"
                                   %self.name), repMap)
        for name in self.__compares:
            if  '"DetUnit"' in self.__compares[name][0].split(","):
                repMap["runComparisonScripts"] += \
                    ("root -b -q 'comparisonScript.C(\".oO[workdir]Oo."
                     "/.oO[name]Oo..Comparison_common"+name+".root\",\""
                     ".oO[workdir]Oo./\")'\n")
                if  self.copyImages:
                   repMap["runComparisonScripts"] += \
                       ("rfmkdir -p .oO[datadir]Oo./.oO[name]Oo."
                        ".Comparison_common"+name+"_Images\n")
                   repMap["runComparisonScripts"] += \
                       ("find .oO[workdir]Oo. -maxdepth 1 -name \"plot*.eps\" "
                        "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo."
                        "/.oO[name]Oo..Comparison_common"+name+"_Images/\" \n")
                   repMap["runComparisonScripts"] += \
                       ("find .oO[workdir]Oo. -maxdepth 1 -name \"plot*.pdf\" "
                        "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo."
                        "/.oO[name]Oo..Comparison_common"+name+"_Images/\" \n")
                   repMap["runComparisonScripts"] += \
                       ("find .oO[workdir]Oo. -maxdepth 1 -name "
                        "\"TkMap_SurfDeform*.pdf\" -print | xargs -I {} bash -c"
                        " \"rfcp {} .oO[datadir]Oo./.oO[name]Oo."
                        ".Comparison_common"+name+"_Images/\" \n")
                   repMap["runComparisonScripts"] += \
                       ("find .oO[workdir]Oo. -maxdepth 1 -name "
                        "\"TkMap_SurfDeform*.png\" -print | xargs -I {} bash -c"
                        " \"rfcp {} .oO[datadir]Oo./.oO[name]Oo."
                        ".Comparison_common"+name+"_Images/\" \n")
                   repMap["runComparisonScripts"] += \
                       ("rfmkdir -p .oO[workdir]Oo./.oO[name]Oo.."+name
                        +"_ArrowPlots\n")
                   repMap["runComparisonScripts"] += \
                       ("root -b -q 'makeArrowPlots.C(\".oO[workdir]Oo."
                        "/.oO[name]Oo..Comparison_common"+name
                        +".root\",\".oO[workdir]Oo./.oO[name]Oo.."
                        +name+"_ArrowPlots\")'\n")
                   repMap["runComparisonScripts"] += \
                       ("rfmkdir -p .oO[datadir]Oo./.oO[name]Oo."
                        ".Comparison_common"+name+"_Images/ArrowPlots\n")
                   repMap["runComparisonScripts"] += \
                       ("find .oO[workdir]Oo./.oO[name]Oo.."+name+"_ArrowPlots "
                        "-maxdepth 1 -name \"*.png\" -print | xargs -I {} bash "
                        "-c \"rfcp {} .oO[datadir]Oo./.oO[name]Oo."
                        ".Comparison_common"+name+"_Images/ArrowPlots\"\n")
                   
                resultingFile = replaceByMap((".oO[datadir]Oo./compared%s_"
                                              ".oO[name]Oo..root"%name), repMap)
                resultingFile = os.path.expandvars( resultingFile )
                resultingFile = os.path.abspath( resultingFile )
                repMap["runComparisonScripts"] += \
                    ("rfcp .oO[workdir]Oo./OUTPUT_comparison.root %s\n"
                     %resultingFile)
                self.filesToCompare[ name ] = resultingFile
                
        repMap["CommandLine"]=""

        for cfg in self.configFiles:
            postProcess = "rfcp .oO[workdir]Oo./*.db .oO[datadir]Oo.\n"
            repMap["CommandLine"]+= \
                repMap["CommandLineTemplate"]%{"cfgFile":cfg,
                                               "postProcess":postProcess}
        # FIXME: It would be better to copy the needed scripts and run them in
        #        the workdir.
        repMap["CommandLine"]+= ("# overall postprocessing\n"
                                 "cd .oO[CMSSW_BASE]Oo./src/Alignment"
                                 "/OfflineValidation/scripts/\n"
                                 ".oO[runComparisonScripts]Oo.\n"
                                 "cd .oO[workdir]Oo.\n")

        scripts = {scriptName: replaceByMap( configTemplates.scriptTemplate, repMap ) }  
        return GenericValidation.createScript(self, scripts, path)
Example #55
0
 def filesToCompare(self):
     return {self.defaultReferenceName: replaceByMap(".oO[eosdir]Oo./0_zmumuHisto.root", self.getRepMap())}
Example #56
0
 def filesToCompare(self):
     return {self.defaultReferenceName: replaceByMap(".oO[eosdir]Oo./0_zmumuHisto.root", self.getRepMap())}