コード例 #1
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 = bool(int(self.general["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
コード例 #2
0
ファイル: preexistingValidation.py プロジェクト: zleba/cmssw
    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
コード例 #3
0
    def __init__(self, valName, config, valType,
                 addDefaults = {}, addMandatories=[]):
        self.name = valName
        self.general = config.getGeneral()
        self.config = config
        self.filesToCompare = {}

        defaults = {"title": self.name, "jobid": "", "subdetector": "BPIX"}
        defaults.update(addDefaults)
        mandatories = ["file", "color", "style"]
        mandatories += addMandatories

        theUpdate = config.getResultingSection("preexisting"+valType+":"+self.name,
                                               defaultDict = defaults,
                                               demandPars = 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.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)

        self.filesToCompare[GenericValidationData.defaultReferenceName] = \
            self.general["file"]

        knownOpts = defaults.keys()+mandatories
        ignoreOpts = []
        config.checkInput("preexisting"+valType+":"+self.name,
                          knownSimpleOptions = knownOpts,
                          ignoreOptions = ignoreOpts)
        self.jobmode = None
コード例 #4
0
ファイル: genericValidation.py プロジェクト: tseva/cmssw
    def __init__(self,
                 valName,
                 alignment,
                 config,
                 valType,
                 addDefaults={},
                 addMandatories=[],
                 addneedpackages=[]):
        import random
        self.name = valName
        self.valType = valType
        self.alignmentToValidate = alignment
        self.general = config.getGeneral()
        self.randomWorkdirPart = "%0i" % random.randint(1, 10e9)
        self.configFiles = []
        self.filesToCompare = {}
        self.config = config
        self.jobid = ""

        defaults = {
            "jobmode": self.general["jobmode"],
            "cmssw": os.environ['CMSSW_BASE'],
            "parallelJobs": "1",
            "jobid": "",
        }
        defaults.update(addDefaults)
        mandatories = []
        mandatories += addMandatories
        needpackages = ["Alignment/OfflineValidation"]
        needpackages += addneedpackages
        theUpdate = config.getResultingSection(valType + ":" + self.name,
                                               defaultDict=defaults,
                                               demandPars=mandatories)
        self.general.update(theUpdate)
        self.jobmode = self.general["jobmode"]
        self.NJobs = int(self.general["parallelJobs"])

        # limit maximum number of parallel jobs to 40
        # (each output file is approximately 20MB)
        maximumNumberJobs = 40
        if self.NJobs > maximumNumberJobs:
            msg = ("Maximum allowed number of parallel jobs " +
                   str(maximumNumberJobs) + " exceeded!!!")
            raise AllInOneError(msg)

        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)

        self.cmssw = self.general["cmssw"]
        badcharacters = r"\'"
        for character in badcharacters:
            if character in self.cmssw:
                raise AllInOneError(
                    "The bad characters " + badcharacters +
                    " are not allowed in the cmssw\n"
                    "path name.  If you really have it in such a ridiculously named location,\n"
                    "try making a symbolic link somewhere with a decent name.")
        try:
            os.listdir(self.cmssw)
        except OSError:
            raise AllInOneError("Your cmssw release " + self.cmssw +
                                ' does not exist')

        if self.cmssw == os.environ["CMSSW_BASE"]:
            self.scramarch = os.environ["SCRAM_ARCH"]
            self.cmsswreleasebase = os.environ["CMSSW_RELEASE_BASE"]
        else:
            command = (
                "cd '" + self.cmssw + "' && eval `scramv1 ru -sh 2> /dev/null`"
                ' && echo "$CMSSW_BASE\n$SCRAM_ARCH\n$CMSSW_RELEASE_BASE"')
            commandoutput = getCommandOutput2(command).split('\n')
            self.cmssw = commandoutput[0]
            self.scramarch = commandoutput[1]
            self.cmsswreleasebase = commandoutput[2]

        self.packages = {}
        for package in needpackages:
            for placetolook in self.cmssw, self.cmsswreleasebase:
                pkgpath = os.path.join(placetolook, "src", package)
                if os.path.exists(pkgpath):
                    self.packages[package] = pkgpath
                    break
            else:
                raise AllInOneError(
                    "Package {} does not exist in {} or {}!".format(
                        package, self.cmssw, self.cmsswreleasebase))

        self.AutoAlternates = True
        if config.has_option("alternateTemplates", "AutoAlternates"):
            try:
                self.AutoAlternates = json.loads(
                    config.get("alternateTemplates", "AutoAlternates").lower())
            except ValueError:
                raise AllInOneError(
                    "AutoAlternates needs to be true or false, not %s" %
                    config.get("alternateTemplates", "AutoAlternates"))

        knownOpts = defaults.keys() + mandatories
        ignoreOpts = []
        config.checkInput(valType + ":" + self.name,
                          knownSimpleOptions=knownOpts,
                          ignoreOptions=ignoreOpts)
コード例 #5
0
    def __init__(self, config, valType):
        import random
        self.type = valType
        self.general = config.getGeneral()
        self.randomWorkdirPart = "%0i"%random.randint(1,10e9)
        self.config = config

        theUpdate = config.getResultingSection("plots:"+self.type,
                                               defaultDict = self.defaults,
                                               demandPars = self.mandatories)
        self.general.update(theUpdate)

        self.cmssw = self.general["cmssw"]
        badcharacters = r"\'"
        for character in badcharacters:
            if character in self.cmssw:
                raise AllInOneError("The bad characters " + badcharacters + " are not allowed in the cmssw\n"
                                    "path name.  If you really have it in such a ridiculously named location,\n"
                                    "try making a symbolic link somewhere with a decent name.")
        try:
            os.listdir(self.cmssw)
        except OSError:
            raise AllInOneError("Your cmssw release " + self.cmssw + ' does not exist')

        if self.cmssw == os.environ["CMSSW_BASE"]:
            self.scramarch = os.environ["SCRAM_ARCH"]
            self.cmsswreleasebase = os.environ["CMSSW_RELEASE_BASE"]
        else:
            command = ("cd '" + self.cmssw + "' && eval `scramv1 ru -sh 2> /dev/null`"
                       ' && echo "$CMSSW_BASE\n$SCRAM_ARCH\n$CMSSW_RELEASE_BASE"')
            commandoutput = getCommandOutput2(command).split('\n')
            self.cmssw = commandoutput[0]
            self.scramarch = commandoutput[1]
            self.cmsswreleasebase = commandoutput[2]

        for package in self.needpackages:
            for placetolook in self.cmssw, self.cmsswreleasebase:
                pkgpath = os.path.join(placetolook, "src", package)
                if os.path.exists(pkgpath):
                    self.general[package] = pkgpath
                    break
            else:
                raise AllInOneError("Package {} does not exist in {} or {}!".format(package, self.cmssw, self.cmsswreleasebase))

        self.general["publicationstatus"] = self.general["publicationstatus"].upper()
        self.general["era"] = self.general["era"].upper()

        if not self.general["publicationstatus"] and not self.general["customtitle"]:
            self.general["publicationstatus"] = "INTERNAL"
        if self.general["customtitle"] and not self.general["publicationstatus"]:
            self.general["publicationstatus"] = "CUSTOM"

        if self.general["publicationstatus"] != "CUSTOM" and self.general["customtitle"]:
            raise AllInOneError("If you would like to use a custom title, please leave out the 'publicationstatus' parameter")
        if self.general["publicationstatus"] == "CUSTOM" and not self.general["customtitle"]:
            raise AllInOneError("If you want to use a custom title, you should provide it using 'customtitle' in the [plots:%s] section" % valType)

        if self.general["era"] != "NONE" and self.general["customrighttitle"]:
            raise AllInOneError("If you would like to use a custom right title, please leave out the 'era' parameter")

        publicationstatusenum = ["INTERNAL", "INTERNAL_SIMULATION", "PRELIMINARY", "PUBLIC", "SIMULATION", "UNPUBLISHED", "CUSTOM"]
        eraenum = ["NONE", "CRUZET15", "CRAFT15", "COLL0T15"]
        if self.general["publicationstatus"] not in publicationstatusenum:
            raise AllInOneError("Publication status must be one of " + ", ".join(publicationstatusenum) + "!")
        if self.general["era"] not in eraenum:
            raise AllInOneError("Era must be one of " + ", ".join(eraenum) + "!")

        knownOpts = set(self.defaults.keys())|self.mandatories|self.optionals
        ignoreOpts = []
        config.checkInput("plots:"+self.type,
                          knownSimpleOptions = knownOpts,
                          ignoreOptions = ignoreOpts)
コード例 #6
0
    def __init__(self, valName, alignment, config):
        import random
        self.name = valName
        self.alignmentToValidate = alignment
        self.general = config.getGeneral()
        self.randomWorkdirPart = "%0i"%random.randint(1,10e9)
        self.configFiles = []
        self.config = config
        self.jobid = ""

        theUpdate = config.getResultingSection(self.valType+":"+self.name,
                                               defaultDict = self.defaults,
                                               demandPars = self.mandatories)
        self.general.update(theUpdate)
        self.jobmode = self.general["jobmode"]
        self.NJobs = int(self.general["parallelJobs"])
        self.needsproxy = boolfromstring(self.general["needsproxy"], "needsproxy")

        # limit maximum number of parallel jobs to 40
        # (each output file is approximately 20MB)
        maximumNumberJobs = 40
        if self.NJobs > maximumNumberJobs:
            msg = ("Maximum allowed number of parallel jobs "
                   +str(maximumNumberJobs)+" exceeded!!!")
            raise AllInOneError(msg)
        if self.NJobs > 1 and not isinstance(self, ParallelValidation):
            raise AllInOneError("Parallel jobs not implemented for {}!\n"
                                "Please set parallelJobs = 1.".format(type(self).__name__))

        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)

        self.cmssw = self.general["cmssw"]
        badcharacters = r"\'"
        for character in badcharacters:
            if character in self.cmssw:
                raise AllInOneError("The bad characters " + badcharacters + " are not allowed in the cmssw\n"
                                    "path name.  If you really have it in such a ridiculously named location,\n"
                                    "try making a symbolic link somewhere with a decent name.")
        try:
            os.listdir(self.cmssw)
        except OSError:
            raise AllInOneError("Your cmssw release " + self.cmssw + ' does not exist')

        if self.cmssw == os.environ["CMSSW_BASE"]:
            self.scramarch = os.environ["SCRAM_ARCH"]
            self.cmsswreleasebase = os.environ["CMSSW_RELEASE_BASE"]
        else:
            command = ("cd '" + self.cmssw + "' && eval `scramv1 ru -sh 2> /dev/null`"
                       ' && echo "$CMSSW_BASE\n$SCRAM_ARCH\n$CMSSW_RELEASE_BASE"')
            commandoutput = getCommandOutput2(command).split('\n')
            self.cmssw = commandoutput[0]
            self.scramarch = commandoutput[1]
            self.cmsswreleasebase = commandoutput[2]

        self.packages = {}
        for package in self.needpackages:
            for placetolook in self.cmssw, self.cmsswreleasebase:
                pkgpath = os.path.join(placetolook, "src", package)
                if os.path.exists(pkgpath):
                    self.packages[package] = pkgpath
                    break
            else:
                raise AllInOneError("Package {} does not exist in {} or {}!".format(package, self.cmssw, self.cmsswreleasebase))

        self.AutoAlternates = True
        if config.has_option("alternateTemplates","AutoAlternates"):
            try:
                self.AutoAlternates = json.loads(config.get("alternateTemplates","AutoAlternates").lower())
            except ValueError:
                raise AllInOneError("AutoAlternates needs to be true or false, not %s" % config.get("alternateTemplates","AutoAlternates"))

        knownOpts = set(self.defaults.keys())|self.mandatories|self.optionals
        ignoreOpts = []
        config.checkInput(self.valType+":"+self.name,
                          knownSimpleOptions = knownOpts,
                          ignoreOptions = ignoreOpts)
コード例 #7
0
    def __init__(self, valName, alignment, config, valType,
                 addDefaults = {}, addMandatories=[]):
        import random
        self.name = valName
        self.alignmentToValidate = alignment
        self.general = config.getGeneral()
        self.randomWorkdirPart = "%0i"%random.randint(1,10e9)
        self.configFiles = []
        self.filesToCompare = {}
        self.config = config

        defaults = {"jobmode":      self.general["jobmode"],
                    "cmssw":        os.environ['CMSSW_BASE'],
                    "parallelJobs": "1"
                   }
        defaults.update(addDefaults)
        mandatories = []
        mandatories += addMandatories
        theUpdate = config.getResultingSection(valType+":"+self.name,
                                               defaultDict = defaults,
                                               demandPars = mandatories)
        self.general.update(theUpdate)
        self.jobmode = self.general["jobmode"]
        self.NJobs = int(self.general["parallelJobs"])

        # limit maximum number of parallel jobs to 40
        # (each output file is approximately 20MB)
        maximumNumberJobs = 40
        if self.NJobs > maximumNumberJobs:
            msg = ("Maximum allowed number of parallel jobs "
                   +str(maximumNumberJobs)+" exceeded!!!")
            raise AllInOneError(msg)

        self.cmssw = self.general["cmssw"]
        badcharacters = r"\'"
        for character in badcharacters:
            if character in self.cmssw:
                raise AllInOneError("The bad characters " + badcharacters + " are not allowed in the cmssw\n"
                                    "path name.  If you really have it in such a ridiculously named location,\n"
                                    "try making a symbolic link somewhere with a decent name.")
        try:
            os.listdir(self.cmssw)
        except OSError:
            raise AllInOneError("Your cmssw release " + self.cmssw + ' does not exist')

        if self.cmssw == os.environ["CMSSW_BASE"]:
            self.scramarch = os.environ["SCRAM_ARCH"]
            self.cmsswreleasebase = os.environ["CMSSW_RELEASE_BASE"]
        else:
            self.scramarch = None
            self.cmsswreleasebase = None
            command = ("cd '" + self.cmssw + "' && eval `scramv1 ru -sh 2> /dev/null`"
                       ' && echo "$SCRAM_ARCH\n$CMSSW_RELEASE_BASE"')
            commandoutput = getCommandOutput2(command).split('\n')
            self.scramarch = commandoutput[0]
            self.cmsswreleasebase = commandoutput[1]

        self.AutoAlternates = True
        if config.has_option("alternateTemplates","AutoAlternates"):
            try:
                self.AutoAlternates = json.loads(config.get("alternateTemplates","AutoAlternates").lower())
            except ValueError:
                raise AllInOneError("AutoAlternates needs to be true or false, not %s" % config.get("alternateTemplates","AutoAlternates"))

        knownOpts = defaults.keys()+mandatories
        ignoreOpts = []
        config.checkInput(valType+":"+self.name,
                          knownSimpleOptions = knownOpts,
                          ignoreOptions = ignoreOpts)
コード例 #8
0
    def createScript(self, path):
        repMap = self.getRepMap()
        repMap["runComparisonScripts"] = ""
        scriptName = replaceByMap(
            ("TkAlGeomCompare.%s..oO[name]Oo..sh" % self.name), repMap)

        y_ranges = ""
        plottedDifferences = [
            "dx", "dy", "dz", "dr", "rdphi", "dalpha", "dbeta", "dgamma"
        ]
        for diff in plottedDifferences:
            y_ranges += "," + repMap["%s_min" % diff]
            y_ranges += "," + repMap["%s_max" % diff]

        for name in self.__compares:
            if '"DetUnit"' in self.__compares[name][0].split(","):
                repMap["outputFile"] = (".oO[name]Oo..Comparison_common" +
                                        name + ".root")
                repMap["nIndex"] = ("")
                repMap["runComparisonScripts"] += \
                    ("rfcp .oO[Alignment/OfflineValidation]Oo."
                     "/scripts/comparisonScript.C .\n"
                     "rfcp .oO[Alignment/OfflineValidation]Oo."
                     "/scripts/GeometryComparisonPlotter.h .\n"
                     "rfcp .oO[Alignment/OfflineValidation]Oo."
                     "/scripts/GeometryComparisonPlotter.cc .\n"
                     "root -b -q 'comparisonScript.C+(\""
                     ".oO[name]Oo..Comparison_common"+name+".root\",\""
                     "./\",\".oO[modulesToPlot]Oo.\",\".oO[alignmentName]Oo.\",\".oO[reference]Oo.\",.oO[useDefaultRange]Oo.,.oO[plotOnlyGlobal]Oo.,.oO[plotPng]Oo.,.oO[makeProfilePlots]Oo."+y_ranges+")'\n"
                     "rfcp "+path+"/TkAl3DVisualization_.oO[common]Oo._.oO[name]Oo..C .\n"
                     "root -l -b -q TkAl3DVisualization_.oO[common]Oo._.oO[name]Oo..C+\n")
                if self.copyImages:
                    repMap["runComparisonScripts"] += \
                        ("rfmkdir -p .oO[datadir]Oo./.oO[name]Oo."
                         ".Comparison_common"+name+"_Images\n")
                    repMap["runComparisonScripts"] += \
                        ("rfmkdir -p .oO[datadir]Oo./.oO[name]Oo."
                         ".Comparison_common"+name+"_Images/Translations\n")
                    repMap["runComparisonScripts"] += \
                        ("rfmkdir -p .oO[datadir]Oo./.oO[name]Oo."
                         ".Comparison_common"+name+"_Images/Rotations\n")

                    ### At the moment translations are images with suffix _1 and _2, rotations _3 and _4
                    ### The numeration depends on the order of the MakePlots(x, y) commands in comparisonScript.C
                    ### If comparisonScript.C is changed, check if the following lines need to be changed as well

                    if repMap["plotPng"] == "true":
                        repMap["runComparisonScripts"] += \
                            ("find . -maxdepth 1 -name \"*_1*\" "
                             "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo."
                             "/.oO[name]Oo..Comparison_common"+name+"_Images/Translations/\" \n")
                        repMap["runComparisonScripts"] += \
                            ("find . -maxdepth 1 -name \"*_2*\" "
                             "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo."
                             "/.oO[name]Oo..Comparison_common"+name+"_Images/Translations/\" \n")

                        repMap["runComparisonScripts"] += \
                            ("find . -maxdepth 1 -name \"*_3*\" "
                             "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo."
                             "/.oO[name]Oo..Comparison_common"+name+"_Images/Rotations/\" \n")
                        repMap["runComparisonScripts"] += \
                            ("find . -maxdepth 1 -name \"*_4*\" "
                             "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo."
                             "/.oO[name]Oo..Comparison_common"+name+"_Images/Rotations/\" \n")

                    else:
                        repMap["runComparisonScripts"] += \
                            ("find . -maxdepth 1 -name \"*_1*\" "
                             "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo."
                             "/.oO[name]Oo..Comparison_common"+name+"_Images/Translations/\" \n")

                        repMap["runComparisonScripts"] += \
                            ("find . -maxdepth 1 -name \"*_2*\" "
                             "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo."
                             "/.oO[name]Oo..Comparison_common"+name+"_Images/Rotations/\" \n")

                    repMap["runComparisonScripts"] += \
                        ("find . -maxdepth 1 -name "
                         "\"*.tex\" -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"] += \
                        ("rfcp .oO[Alignment/OfflineValidation]Oo."
                         "/macros/makeArrowPlots.C "
                         ".\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")
                    repMap["runComparisonScripts"] += \
                        ("find .oO[name]Oo.."+name+"_ArrowPlots "
                         "-maxdepth 1 -name \"*.pdf\" -print | xargs -I {} bash "
                         "-c \"rfcp {} .oO[datadir]Oo./.oO[name]Oo."
                         ".Comparison_common"+name+"_Images/ArrowPlots\"\n")
                    repMap["runComparisonScripts"] += \
                        ("find . "
                         "-maxdepth 1 -name \".oO[common]Oo._.oO[name]Oo..Visualization_rotated.gif\" -print | xargs -I {} bash "
                         "-c \"rfcp {} .oO[datadir]Oo./.oO[name]Oo."
                         ".Comparison_common"+name+"_Images/.oO[common]Oo._.oO[name]Oo..Visualization.gif\"\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)
                resultingFile = "root://eoscms//eos/cms" + resultingFile  #needs to be AFTER abspath so that it doesn't eat the //
                self.__filesToCompare[name] = resultingFile

            else:
                raise AllInOneError("Need to have DetUnit in levels!")

        repMap["CommandLine"] = ""
        repMap["CommandLine"]+= \
                 "# copy module list required for comparison script \n"
        if repMap["moduleList"].startswith("/store"):
            repMap["CommandLine"]+= \
                 "xrdcp root://eoscms//eos/cms.oO[moduleList]Oo. .\n"
        elif repMap["moduleList"].startswith("root://"):
            repMap["CommandLine"]+= \
                 "xrdcp .oO[moduleList]Oo. .\n"
        else:
            repMap["CommandLine"]+= \
                     "rfcp .oO[moduleList]Oo. .\n"

        try:
            getCommandOutput2(
                replaceByMap(
                    "cd $(mktemp -d)\n.oO[CommandLine]Oo.\ncat .oO[moduleListBase]Oo.",
                    repMap))
        except RuntimeError:
            raise AllInOneError(
                replaceByMap(".oO[moduleList]Oo. does not exist!", repMap))

        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"
            postProcess = ""
            repMap["CommandLine"]+= \
                repMap["CommandLineTemplate"]%{"cfgFile":cfg,
                                               "postProcess":postProcess}
        repMap["CommandLine"] += ("# overall postprocessing\n"
                                  ".oO[runComparisonScripts]Oo.\n")

        #~ print configTemplates.scriptTemplate
        scripts = {
            scriptName: replaceByMap(configTemplates.scriptTemplate, repMap)
        }
        files = {
            replaceByMap("TkAl3DVisualization_.oO[common]Oo._.oO[name]Oo..C", repMap):
            replaceByMap(configTemplates.visualizationTrackerTemplate, repMap)
        }
        self.createFiles(files, path)
        return super(GeometryComparison, self).createScript(scripts, path)
コード例 #9
0
ファイル: geometryComparison.py プロジェクト: kkotov/cmssw
    def createScript(self, path):
        repMap = self.getRepMap()
        repMap["runComparisonScripts"] = ""
        scriptName = replaceByMap(("TkAlGeomCompare.%s..oO[name]Oo..sh"
                                   %self.name), repMap)
        
        y_ranges = ""
        plottedDifferences = ["dx","dy","dz","dr","rdphi","dalpha","dbeta","dgamma"]
        for diff in plottedDifferences:
			y_ranges += ","+repMap["%s_min"%diff]
			y_ranges += ","+repMap["%s_max"%diff]
			
        for name in self.__compares:
            if  '"DetUnit"' in self.__compares[name][0].split(","):
                repMap["outputFile"] = (".oO[name]Oo..Comparison_common"+name+".root")
                repMap["nIndex"] = ("")
                repMap["runComparisonScripts"] += \
                    ("rfcp .oO[CMSSW_BASE]Oo./src/Alignment/OfflineValidation"
                     "/scripts/comparisonScript.C .\n"
                     "rfcp .oO[CMSSW_BASE]Oo./src/Alignment/OfflineValidation"
                     "/scripts/GeometryComparisonPlotter.h .\n"
                     "rfcp .oO[CMSSW_BASE]Oo./src/Alignment/OfflineValidation"
                     "/scripts/GeometryComparisonPlotter.cc .\n"
                     "root -b -q 'comparisonScript.C+(\""
                     ".oO[name]Oo..Comparison_common"+name+".root\",\""
                     "./\",\".oO[modulesToPlot]Oo.\",\".oO[alignmentName]Oo.\",\".oO[reference]Oo.\",\".oO[useDefaultRange]Oo.\",\".oO[plotOnlyGlobal]Oo.\",\".oO[plotPng]Oo.\""+y_ranges+")'\n"
		     "rfcp "+path+"/TkAl3DVisualization_.oO[common]Oo._.oO[name]Oo..C .\n"
		     "root -l -b -q TkAl3DVisualization_.oO[common]Oo._.oO[name]Oo..C+\n")
                if  self.copyImages:
                   repMap["runComparisonScripts"] += \
                       ("rfmkdir -p .oO[datadir]Oo./.oO[name]Oo."
                        ".Comparison_common"+name+"_Images\n")
                   repMap["runComparisonScripts"] += \
                       ("rfmkdir -p .oO[datadir]Oo./.oO[name]Oo."
                        ".Comparison_common"+name+"_Images/Translations\n")
                   repMap["runComparisonScripts"] += \
                       ("rfmkdir -p .oO[datadir]Oo./.oO[name]Oo."
                        ".Comparison_common"+name+"_Images/Rotations\n")


                   ### At the moment translations are images with suffix _1 and _2, rotations _3 and _4
                   ### The numeration depends on the order of the MakePlots(x, y) commands in comparisonScript.C
                   ### If comparisonScript.C is changed, check if the following lines need to be changed as well
                   
                   if repMap["plotPng"] == "true":
	                   repMap["runComparisonScripts"] += \
	                       ("find . -maxdepth 1 -name \"*_1*\" "
	                        "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo."
	                        "/.oO[name]Oo..Comparison_common"+name+"_Images/Translations/\" \n")
	                   repMap["runComparisonScripts"] += \
	                       ("find . -maxdepth 1 -name \"*_2*\" "
	                        "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo."
	                        "/.oO[name]Oo..Comparison_common"+name+"_Images/Translations/\" \n")
	                   
	                   repMap["runComparisonScripts"] += \
	                       ("find . -maxdepth 1 -name \"*_3*\" "
	                        "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo."
	                        "/.oO[name]Oo..Comparison_common"+name+"_Images/Rotations/\" \n")
	                   repMap["runComparisonScripts"] += \
	                       ("find . -maxdepth 1 -name \"*_4*\" "
	                        "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo."
	                        "/.oO[name]Oo..Comparison_common"+name+"_Images/Rotations/\" \n")
	                        
                   else:
	                   repMap["runComparisonScripts"] += \
	                       ("find . -maxdepth 1 -name \"*_1*\" "
	                        "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo."
	                        "/.oO[name]Oo..Comparison_common"+name+"_Images/Translations/\" \n")
	                   
	                   repMap["runComparisonScripts"] += \
	                       ("find . -maxdepth 1 -name \"*_2*\" "
	                        "-print | xargs -I {} bash -c \"rfcp {} .oO[datadir]Oo."
	                        "/.oO[name]Oo..Comparison_common"+name+"_Images/Rotations/\" \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.C "
                        ".\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")
		   repMap["runComparisonScripts"] += \
                       ("find . "
                        "-maxdepth 1 -name \".oO[common]Oo._.oO[name]Oo..Visualization_rotated.gif\" -print | xargs -I {} bash "
                        "-c \"rfcp {} .oO[datadir]Oo./.oO[name]Oo."
                        ".Comparison_common"+name+"_Images/.oO[common]Oo._.oO[name]Oo..Visualization.gif\"\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 )
                resultingFile = "root://eoscms//eos/cms" + resultingFile   #needs to be AFTER abspath so that it doesn't eat the //
                repMap["runComparisonScripts"] += \
                    ("xrdcp -f OUTPUT_comparison.root %s\n"
                     %resultingFile)
                self.filesToCompare[ name ] = resultingFile

            else:
                raise AllInOneError("Need to have DetUnit in levels!")

        repMap["CommandLine"]=""
        repMap["CommandLine"]+= \
                 "# copy module list required for comparison script \n"
        if repMap["moduleList"].startswith("/store"):
            repMap["CommandLine"]+= \
                 "xrdcp root://eoscms//eos/cms.oO[moduleList]Oo. .\n"
        elif repMap["moduleList"].startswith("root://"):
            repMap["CommandLine"]+= \
                 "xrdcp .oO[moduleList]Oo. .\n"
        else:
            repMap["CommandLine"]+= \
                     "rfcp .oO[moduleList]Oo. .\n"

        try:
            getCommandOutput2(replaceByMap("cd $(mktemp -d)\n.oO[CommandLine]Oo.\ncat .oO[moduleListBase]Oo.", repMap))
        except RuntimeError:
            raise AllInOneError(replaceByMap(".oO[moduleList]Oo. does not exist!", repMap))

        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"
            postProcess = ""
            repMap["CommandLine"]+= \
                repMap["CommandLineTemplate"]%{"cfgFile":cfg,
                                               "postProcess":postProcess}
        repMap["CommandLine"]+= ("# overall postprocessing\n"
                                 ".oO[runComparisonScripts]Oo.\n"
                                 )

        #~ print configTemplates.scriptTemplate
        scripts = {scriptName: replaceByMap( configTemplates.scriptTemplate, repMap )}
	files = {replaceByMap("TkAl3DVisualization_.oO[common]Oo._.oO[name]Oo..C", repMap ): replaceByMap(configTemplates.visualizationTrackerTemplate, repMap )}
	self.createFiles(files, path)
        return GenericValidation.createScript(self, scripts, path)
コード例 #10
0
import os
import re
import sys

import Utilities.General.cmssw_das_client as das_client
from FWCore.PythonUtilities.LumiList import LumiList

from helperFunctions import cache
from TkAlExceptions import AllInOneError

#####################################################################
#can remove this section and others below once dasgoclient is updated
#(search for olddas)
from helperFunctions import getCommandOutput2
try:
    dasgoversion = getCommandOutput2("dasgoclient --version")
except RuntimeError:
    olddas = True
    #could be no proxy inited, but this will pop up later in any case
else:
    dasgoversion = dasgoversion.split()[1].split("git=v")[1]
    dasgoversion = tuple(int(_) for _ in dasgoversion.split("."))
    if dasgoversion < (1, 0, 5):
        olddas = True
    else:
        olddas = False
#####################################################################


class Dataset(object):
    def __init__(self,