コード例 #1
0
ファイル: other.py プロジェクト: elaird/supy
    def mergeFuncHadd(self, products):
        def printComment(lines) :
            if self.quietMode : return
            skip = ['Source file','Target path','Found subdirectory']
            line = next(L for L in lines.split('\n') if not any(item in L for item in skip))
            print line.replace("Target","The output") + " has been written."

        def cleanUp(stderr, files) :
            okList = configuration.haddErrorsToIgnore()
            assert (stderr in okList), "hadd had this stderr: '%s'"%stderr
            if stderr : print stderr
            for fileName in files : os.remove(fileName)

        hAdd = utils.getCommandOutput("%s -f %s %s"%(configuration.hadd(),self.outputFileName, " ".join(products["outputFileName"])))
        printComment(hAdd["stdout"])
        cleanUp(hAdd["stderr"], products["outputFileName"])
コード例 #2
0
ファイル: other.py プロジェクト: elaird/susycaf
 def lumi(self, json) :
     if not self.calculateLumi : return -1.0
     if self.pixelLumi :
         return utils.luminosity.recordedInvMicrobarns(json)/1e6
     else :
         dct = utils.getCommandOutput("lumiCalc2.py overview -i %s"%self.outputFileName)
         assert not dct["returncode"],dct["returncode"]
         assert not dct["stderr"],dct["stderr"]
         s = dct["stdout"]
         if self.debug : print s[s.find("Total"):]
         m = "Recorded(/"
         i = s.rindex(m) + len(m)
         units = s[i-1:i+2]
         factor = {"/fb":1.0e3, "/pb":1.0, "/nb":1.0e-3, "/ub":1.0e-6}
         assert units in factor,units
         i2 = dct["stdout"].rindex("|")
         i1 = dct["stdout"][:i2].rindex("|")
         return float(dct["stdout"][1+i1:i2])*factor[units]