Exemple #1
0
def initPlots( config ):
    from os.path import exists as pathExisits
    result = []
    cachePath = config.get("output","cachePath")
    cache = {}
    if pathExisits(cachePath):
        cacheFile = open(cachePath,"r")
        cache.update( eval(cacheFile.read()) )
        cacheFile.close()
    for section in sorted(config.sections()):
        if section.startswith("plot:"):
            result.append(TrendPlot(section, config, cache))
    return result, cache
Exemple #2
0
def initPlots( config ):
    from os.path import exists as pathExisits
    result = []
    cachePath = config.get("output","cachePath")
    cache = {}
    if pathExisits(cachePath):
        cacheFile = open(cachePath,"r")
        cache.update( eval(cacheFile.read()) )
        cacheFile.close()
    for section in sorted(config.sections()):
        if section.startswith("plot:"):
            result.append(TrendPlot(section, config, cache))
    return result, cache
Exemple #3
0
def toOrdinaryJSON(fromRR3, verbose=False):
    result = {}
    for block in fromRR3:
        if len(block) == 3:
            runNum = block['runNumber']
            lumiStart = block['sectionFrom']
            lumiEnd = block['sectionTo']
            runExist = 0
            if pathExisits(".APVModeCache"):
                cacheIFile = open(".APVModeCache", "r")
                dataCache = []
                for line in cacheIFile:
                    dataCache = line.split()
                    if dataCache[0] == str(runNum):
                        runExist = 1
                        modeCache = dataCache[1]
                        print "Cache APV Mode for Run : ", dataCache[
                            0], " is : ", dataCache[1]
                        break
            if runExist == 0:
                if verbose:
                    print " debug: Run ", runNum, " Lumi ", lumiStart, ", ", lumiEnd

                link = "http://cern.ch/erik.butz/cgi-bin/getReadOutmode.pl?RUN=" + str(
                    runNum)
                f = urllib.urlopen(link)
                json_data = f.read()
                dbmodelist = json.loads(json_data)
                dbmode = dbmodelist[0][1]
                print "DB APV Mode for Run : ", runNum, " is : ", dbmode
                cacheOFile = open(".APVModeCache", "a")
                cacheOFile.write(str(runNum))
                cacheOFile.write(" ")
                cacheOFile.write(dbmode)
                cacheOFile.write("\n")
                cacheOFile.close()
            else:
                dbmode = modeCache
            if options.Peak:
                if dbmode == "PEAK":
                    print "Write Run : ", runNum, " with APV mode : ", dbmode
                    result.setdefault(str(runNum),
                                      []).append([lumiStart, lumiEnd])
            else:
                if dbmode == "DECO":
                    print "Write Run : ", runNum, " with APV mode : ", dbmode
                    result.setdefault(str(runNum),
                                      []).append([lumiStart, lumiEnd])

    return result