コード例 #1
0
ファイル: dstar.py プロジェクト: AtlasBID/CalibrationResults
    def Execute (self, html, configInfo):
        fList = self._sf.ResolveToFiles(html)
        files = listToString(fList)

        files += ' outputAna "%s" DStarAna %s' % (self._outputAna, self._dstar)

        baseOutputName = "%s-%s" % (configInfo.name, hash(files))
        outputFile = "%s-sf.txt" % baseOutputName
        cmdLog = "%s-cmd-log.txt" % baseOutputName
        files += " output %s" % outputFile

        title = "Calculating D* from template %s" % self._dstar

        dumpTitle(html, title)
        if rerunCommand(fList, outputFile, files, html):

            errcod = dumpCommandResult(html, "FTDStarCalc %s" % files, store=cmdLog)
            if errcod != 0:
                print >> html, "Failed to calculate D*! Command line: %s" % files
                raise BaseException("Unable to calc D*")

        else:
            dumpFile(html, cmdLog)
            print >> html, "<p>D* calc previously run, and no inputs have been changed. Using results from last run.</p>"

        print >> html, '<p><a href="%s">Scale Factor File</a></p>' % outputFile

        #
        # File used for later stages in the analysis.
        #
        
        self._ff.SetFName("%s" % outputFile)
コード例 #2
0
    def Execute (self, html, configInfo):
        fList = self._sf.ResolveToFiles(html)
        files = listToString(fList)

        files += ' outputAna "%s" calcRelDiff "%s" "%s" "%s"' % (self._newAna, self._baseAna, self._deltaAna, self._sys)

        baseOutputName = "%s-%s" % (configInfo.name, hash(files))
        outputFile = "%s-sf.txt" % baseOutputName
        cmdLog = "%s-cmd-log.txt" % baseOutputName
        files += " output %s" % outputFile

        title = "Calculating Relative Difference between %s and %s to create %s" % (self._baseAna, self._deltaAna, self._newAna)

        dumpTitle(html, title)
        if rerunCommand(fList, outputFile, files, html):

            errcod = dumpCommandResult(html, "FTManipSys %s" % files, store=cmdLog)
            if errcod != 0:
                print >> html, "Failed to calc new systematic error! Command line: %s" % files
                raise BaseException("Unable to calculate new systematic error")

        else:
            dumpFile(html, cmdLog)
            print >> html, "<p>Recalc previously run, and no inputs have been changed. Using results from last run.</p>"

        print >> html, '<p><a href="%s">Scale Factor File</a></p>' % outputFile

        #
        # File used for later stages in the analysis.
        #
        
        self._ff.SetFName("%s" % outputFile)
コード例 #3
0
ファイル: plot.py プロジェクト: AtlasBID/CalibrationResults
    def Execute(self, html, configInfo):
        fList = self._sf.ResolveToFiles(html)
        files = listToString(fList)

        outFile = "%s-plots-%s.root" % (configInfo.name, self._name)
        cmdLog = "%s-plots-%s-cmd-log.txt" % (configInfo.name, self._name)

        title = "Plots for %s" % self._name

        if self._byCalibEff:
            files += " --ByCalibEff"

        if self._byTaggerEff:
            files += " --ByCalibTaggerJet"
			
        if self._effOnly:
            files += " --EffOnly"

        dumpTitle(html, title)
        if rerunCommand(fList, outFile, files, html):
            errcode = dumpCommandResult(html, "FTPlot %s" % files, store=cmdLog)
            if errcode == 0:
                shutil.copy ("plots.root", outFile)
            else:
                print >> html, "<b>Plotting failed with error code %s</b>" % errcode
                print >> html, "Command line: FTPlot %s" % files
        
        else:
            dumpFile(html, cmdLog)
            print >> html, "<p>Inputs have not changed, resuing results from last run</p>"
            print >> html, "Command line: FTPlot %s" % files

        print >> html, '<a href="%s">Scale Factor Plots</a>' % outFile
コード例 #4
0
ファイル: save.py プロジェクト: AtlasBID/CalibrationResults
    def Execute (self, html, configInfo):
        fList = self._sf.ResolveToFiles(html)
        files = listToString(fList)

        outputFile = "%s-%s.txt" % (configInfo.name, self._outputName)
        baseOutputName = "%s-%s" % (configInfo.name, hash(files))
        cmdLog = "%s-cmd-log.txt" % baseOutputName

        files += " --asInput output %s" % outputFile

        title = "Saving all files as %s" % outputFile

        dumpTitle(html, title)
        if rerunCommand(fList, self._outputName, files, html):

            errcod = dumpCommandResult(html, "FTDump %s" % files, store=cmdLog)
            if errcod != 0:
                print >> html, "Failed to dump output files. Command line: %s" % files
                raise BaseException("Unable to dump SF's")

        else:
            dumpFile(html, cmdLog)
            print >> html, "<p>Dump previously run, and no inputs have been changed. Using results from last run.</p>"

        print >> html, '<p><a href="%s">Scale Factor File</a></p>' % self._outputName

        self._ff.SetFName(outputFile)
コード例 #5
0
ファイル: filter.py プロジェクト: AtlasBID/CalibrationResults
    def Execute (self, html, configInfo):
        fList = self._sf.ResolveToFiles(html)
        files = listToString(fList)

        for a in self._anas:
            files += " --analysis '%s'" % a

        for t in self._taggers:
            files += " --tagger '%s' --operatingPoint '%s'" % (t[0], t[1])

        for i in self._ignore:
            files += " --ignore '%s'" % i

        for j in self._jets:
            files += " --jetAlgorithm '%s'" % j

        files += " --asInput"

        baseOutputName = "%s-%s" % (configInfo.name, hash(files))
        outputName = "%s-sf.txt" % baseOutputName
        cmdLog = "%s-cmd-log.txt" % baseOutputName
        files += " output %s" % outputName

        title = "Filtering for %s" % listToString(self._anas + self._taggers + self._ignore + self._jets)

        dumpTitle(html, title)
        print >> html, "<b>Command line: FTDump %s</b>" % files
        if rerunCommand(fList, outputName, files, html):
            errcod = dumpCommandResult(html, "FTDump %s" % files, store=cmdLog)
            if errcod != 0:
                print >> html, "Failed to filter! Command line: %s" % files
                raise BaseException("Unable to filter")

        else:
            print >> html, "<p>Using results of last filter command as no inputs have changed.</p>"
            dumpFile(html, cmdLog)

        print >> html, '<p><a href="%s">Scale Factor File</a></p>' % outputName
        
        self._ff.SetFName(outputName)
コード例 #6
0
ファイル: dump.py プロジェクト: AtlasBID/CalibrationResults
    def Execute(self, html, configInfo):
        files = listToString(self._sf.ResolveToFiles(html))

        ftype = ""
        args = ""
        title = ""

        if self._check:
            ftype = ".txt"
            title = "Names of anslyses in input files"
            args = "--names --check"

        if self._sysErrors:
            ftype = ".html"
            title = "systematic error table"
            args = "--sysErrorTable"

        if self._metadata:
            ftype = ".txt"
            title = "metadata"
            args = "--meta"

        if self._linage:
            ftype = "txt"
            title = "linage"
            args = "--linage"

        if self._cnames:
            title = "Check OPs"
            ftype = ".txt"
            args = "--cnames --inputfile=%s" % self._cnames

        # Run it

        if len(self._name) > 0:
            title += " (%s)" % self._name

        outputFileCmd = ""
        outputFile = ""
        if len(self._name) > 0:
            outputFileCmd = "output %s-%s.%s" % (configInfo.name, self._name, ftype)
            outputFile = "%s-%s.%s" % (configInfo.name, self._name, ftype)

        errcod = dumpCommandResult(html, "FTDump %s %s %s" % (args, files, outputFileCmd), title)
        if errcod != 0:
            print >> html, "Failed to run check! Command line: %s" % files
        else:
            if len(outputFile) > 0:
                print >> html, '<a href="%s">%s</a>' % (outputFile, title)
コード例 #7
0
    def Execute (self, html, configInfo):
        fList = self._sf.ResolveToFiles(html)
        files = listToString(fList)

        files += ' addSysError "%s" %s' % (self._newSys, self._newSysValue)
        if self._newFlavor:
            files += " outputFlavor %s" % self._newFlavor
        if self._outputAna:
            files += " outputAna %s" % self._outputAna
            
        baseOutputName = "%s-%s" % (configInfo.name, hash(files))
        outputFile = "%s-sf.txt" % baseOutputName
        cmdLog = "%s-cmd-log.txt" % baseOutputName
        files += " output %s" % outputFile

        title = "Adding systematic error %s" % self._newSys

        dumpTitle(html, title)
        if rerunCommand(fList, outputFile, files, html):

            errcod = dumpCommandResult(html, "FTManipSys %s" % files, store=cmdLog)
            if errcod != 0:
                print >> html, "Failed to add systematice error! Command line: %s" % files
                raise BaseException("Unable to add systematic error")

        else:
            dumpFile(html, cmdLog)
            print >> html, "<p>sys error previously run, and no inputs have been changed. Using results from last run.</p>"

        print >> html, '<p><a href="%s">Scale Factor File</a></p>' % outputFile

        #
        # File used for later stages in the analysis.
        #
        
        self._ff.SetFName("%s" % outputFile)
コード例 #8
0
    def Execute(self, html, configInfo):
        fList = self._sf.ResolveToFiles(html)
        files = listToString(fList)

        outFile = "%s-%s.root" % (configInfo.name, self._name)
        cmdLog = "%s-%s-cmd-log.txt" % (configInfo.name, self._name)
        cmdLogCopy = "%s-%s-cmd-copy-log.txt" % (configInfo.name, self._name)
        cmdCopyOut = "%s-%s-defaults-sf.txt" % (configInfo.name, self._name)

        title = "Building CDI %s" % self._name

        versionInfo = "--config-info FileName %s" % outFile
        if "BuildNumber" in os.environ.keys():
            versionInfo += " --config-info BuildNumber %s" % os.environ["BuildNumber"]
        else:
            versionInfo += " --config-info BuildNumber Custom"

        lfiles = files
        if self._defaults_file:
            lfiles += " %s" % listToString(self._defaults_file.ResolveToFiles(html))
            fList += self._defaults_file.ResolveToFiles(html)

        if self._ttbar:
            lfiles += " %s" % listToString(["--copy%s" % l for l in self._ttbar.ResolveToFiles(html)])
            fList += self._ttbar.ResolveToFiles(html)

        if self._wp:
            lfiles += " %s" % listToString(["--copySlim%s" % l for l in self._wp.ResolveToFiles(html)])
            fList += self._wp.ResolveToFiles(html)

        if self._continuous:
            lfiles += " %s" % listToString(["--copy%s" % l for l in self._continuous.ResolveToFiles(html)])
            fList += self._continuous.ResolveToFiles(html)

        if self._slim:
            lfiles += " %s" % listToString(["--inputSlim../Combination/inputdata/FTCopySlim-%s.txt" %self._slim])

        dumpTitle(html, title)
        print >> html, "Command line: FTConvertToCDI %s" % lfiles
        if rerunCommand(fList, "output.root", lfiles, html):
            errcode = dumpCommandResult(html, "FTConvertToCDI %s %s" % (lfiles, versionInfo), store=cmdLog)
            if errcode == 0:
                shutil.copy ("output.root", outFile)
            else:
                print >> html, "<b>CDI building failed with error code %s</b>" % errcode

        else:
            dumpFile(html, cmdLog)
            print >> html, "<p>Inputs have not changed, reusing results from last run</p>"

        print >> html, "Command line: FTCopyDefaults %s" % files
        if rerunCommand(fList, cmdCopyOut, lfiles, html):
            errcode = dumpCommandResult(html, "FTCopyDefaults %s output %s" % (lfiles, cmdCopyOut), store=cmdLogCopy)
            if errcode <> 0:
                print >> html, "<b>Default building failed with error code %s</b>" % errcode

        else:
            dumpFile(html, cmdLogCopy)
            print >> html, "<p>Inputs have not changed, reusing results from last run</p>"

        print >> html, '<a href="%s">CDI File</a>' % outFile
        print >> html, '<a href="%s">Defaults</a>' % cmdCopyOut

        self._rf.SetFName(cmdCopyOut)

        cmdLog = "%s-%s-check-cmd-log.txt" % (configInfo.name, self._name)
        if self._check:
            print >> html, "<p>Running a check on the CDI file</p>"
            if rerunCommand(fList, cmdLog, outFile, html):
                errcode = dumpCommandResult(html, "FTCheckOutput %s" % outFile, store=cmdLog)

            else:
                dumpFile(html, cmdLog)
                print >> html, "<p>Inputs have not changed, reusing results from last run</p>"
            
            dumpROOTFile(html, outFile)
コード例 #9
0
ファイル: fit.py プロジェクト: AtlasBID/CalibrationResults
    def Execute (self, html, configInfo):
        fList = self._sf.ResolveToFiles(html)
        if not (self._extraFiles is None):
            fList = fList + self._extraFiles.ResolveToFiles(html)
        files = listToString(fList)
        files += " --combinedName %s" % self._fitAna

        if self._bbb:
            files += " --binbybin"

        baseOutputName = "%s-%s" % (configInfo.name, hash(files))
        outputSFName = "%s-sf.txt" % baseOutputName
        cmdLog = "%s-cmd-log.txt" % baseOutputName

        ftype = "profile"
        if self._bbb:
            ftype = "bin by bin"
        title = "Fitting to %s (%s)" % (self._fitAna, ftype)

        #
        # Next, see if we have done this command already
        #

        dumpTitle(html, title)
        if rerunCommand(fList, outputSFName, files, html):

            cmdout = open("%s-cmd.txt" % baseOutputName, "w")
            print >>cmdout, files
            cmdout.close()
        
            errcod = dumpCommandResult(html, "FTCombine %s" % files, store=cmdLog)
            if errcod == 0:
                if not os.path.exists("combined.txt"):
                    errcode = -1000

            if errcod == 0:
                shutil.move("combined.txt", outputSFName)
            else:
                print >> html, "<b>Combination failed with error code %s</b><p>" % errcod
                print >> html, "Command line arguments: %s" % files
                print "The Combination failed"
                
        else:
            print >> html, "<p>Dumping file from last run of combination and including those results in our calculations as"
            print >> html, "the inputs have not changed since last run.</p>"

            dumpFile(html, cmdLog)


        #
        # Ok, regardless of having re-run, dump all the info.
        #

        self._ff.SetFName(outputSFName)
        print >> html, '<a href="%s">Scale Factor text file</a>' % outputSFName
        print >> html, '<a href="%s-cmd.txt">Command Line Args</a>' % baseOutputName

        if os.path.exists("output.root"):
            shutil.move("output.root", "%s-diagnostics.root" % baseOutputName)
            print >> html, '<a href="%s-diagnostics.root">Diagnostics root file</a>' % baseOutputName
        if os.path.exists("combined.dot"):
            shutil.move("combined.dot", "%s-combined.dot" % baseOutputName)
            print >> html, '<a href="%s-combined.dot">graphviz input file</a>' % baseOutputName
        print >> html, "<p>"