Esempio n. 1
0
 def __init__(self):
     self.__program = 'dhcpd'
     self.__pid = None
     fname = opts().dhcp_cfg_fname
     cmd = 'dhcpd -f -q -cf ' + fname
     testcmd = 'dhcpd -t -cf ' + fname
     self.__args = cmd.split()
     self.__testargs = testcmd.split()
Esempio n. 2
0
    check_and_adjust(options)

    matching.__okErrF = sw.fedList(options.okErrF)
    matching.__utcaBcnDelta = options.utcaBcnDelta
    matching.__utcaPipelineDelta = options.utcaPipelineDelta
    if options.noColor:
        printer.__color = False

    if options.noLoop:
        goCode = 0
    else:
        analyze.setup()
        if options.profile:
            import cProfile
            cProfile.runctx("go(options)", globals(), locals(), sort="time")
            goCode = 0  # FIXME
        else:
            goCode = go(options)

    if options.feds2 and 0 <= options.dump:
        analyze.printChannelSummary(options.outputFile)

    if not options.noPlot:
        graphs.main(options)

    return goCode


if __name__ == "__main__":
    main(opts()[0])
Esempio n. 3
0
        f.Close()
    canvas.Print(pdf + "]")


def makeSummaryPdf(inputFile="", feds1=[], feds2=[], pdf="summary.pdf"):
    makeSummaryPdfMulti(inputFiles=[inputFile], feds1s=[feds1], feds2s=[feds2], pdf=pdf)


def main(options):
    makeSummaryPdf(inputFile=options.outputFile,
                   feds1=sw.fedList(options.feds1),
                   feds2=sw.fedList(options.feds2),
                   pdf=options.outputFile.replace(".root", ".pdf"),
    )


all_pages = ["overview", "vs", "page3",
             # "maps_rates",
             "maps_evn_orn_bcn", "maps_errf", "maps_adc_tp",
             # "frac0_orbit",
             "evn", "orn",
             # "trends",
             "occupancy",
             # "ts",
             ]


if __name__ == "__main__":
    main(opts()[0])
Esempio n. 4
0
    for iFind, grDir in sorted(paths.iteritems()):
        if grDir is None:
            options.file1 = eval("find%d" % iFind)(run)
        else:
            options.file1 = find_gr(run, grDir, options.hhmm, quiet)

        if not options.file1:
            continue

        fileNames = options.file1.split(",")
        report(fileNames, iFind)

        n = len(fileNames)
        if 2 <= n and options.hhmm is None:
            options.sparseLoop = max(1, options.nEvents / n)
        else:
            options.sparseLoop = -1

        options.file2 = ""  # clear from previous iterations
        if oneRun.main(options):
            continue
        else:
            return

    printer.warning("Did not find a matching file for run %d.  Perhaps try 'source env/lxplus6.sh'" % run)
    return 1


if __name__ == "__main__":
    main(*opts(alsoArgs=True))
Esempio n. 5
0
            options.feds2 = ""
            options.file2 = ""

            roots.append(options.outputFile)
            feds1s.append([fed])
            feds2s.append([])
            oneRun.main(options)

    return prefix, roots, feds1s, feds2s


def plot(prefix, roots, feds1s, feds2s):
    graphs.makeSummaryPdfMulti(inputFiles=roots,
                               feds1s=feds1s,
                               feds2s=feds2s,
                               pdf="output/%s.pdf" % prefix)

    if not any(feds2s):
        outputFile = "output/%s.root" % prefix
        cmd = " ".join(["hadd -f", outputFile] + roots)
        os.system(cmd)

        graphs.makeSummaryPdf(inputFile=outputFile,
                              feds1=sorted(sum(feds1s, [])),
                              pdf=outputFile.replace(".root", "_merged.pdf"))


if __name__ == "__main__":
    options, args = opts(alsoArgs=True)
    plot(*histogrammed(*rooted(args, options)))
Esempio n. 6
0
            feds2s.append(fedList(options.feds2))

    plot(roots, feds1s, feds2s)


def plot(roots, feds1s, feds2s):
    for i, stem in enumerate(graphs.all_pages):
        graphs.makeSummaryPdfMulti(inputFiles=roots,
                                   feds1s=feds1s,
                                   feds2s=feds2s,
                                   pdf="output/%d_%s.pdf" % (1 + i, stem),
                                   pages=[stem],
                                  )


def runs(file=None):
    out = []
    for i, lineRaw in enumerate(file):
        line = lineRaw.strip()
        if line.startswith("#"):
            continue
        try:
            out.append(int(line))
        except ValueError:
            print "skipping line %d: '%s'" % (i, line)
    return out


if __name__ == "__main__":
    main(opts()[0], runs(sys.stdin))
Esempio n. 7
0
            options.file1 = root1
            options.outputFile = rootOut

            options.feds2 = ""
            options.file2 = ""

            roots.append(options.outputFile)
            feds1s.append([fed])
            feds2s.append([])
            oneRun.main(options)

    return prefix, roots, feds1s, feds2s


def plot(prefix, roots, feds1s, feds2s):
    graphs.makeSummaryPdfMulti(inputFiles=roots, feds1s=feds1s, feds2s=feds2s, pdf="output/%s.pdf" % prefix)

    if not any(feds2s):
        outputFile = "output/%s.root" % prefix
        cmd = " ".join(["hadd -f", outputFile] + roots)
        os.system(cmd)

        graphs.makeSummaryPdf(
            inputFile=outputFile, feds1=sorted(sum(feds1s, [])), pdf=outputFile.replace(".root", "_merged.pdf")
        )


if __name__ == "__main__":
    options, args = opts(alsoArgs=True)
    plot(*histogrammed(*rooted(args, options)))
Esempio n. 8
0
    plot(roots, feds1s, feds2s)


def plot(roots, feds1s, feds2s):
    for i, stem in enumerate(graphs.all_pages):
        graphs.makeSummaryPdfMulti(
            inputFiles=roots,
            feds1s=feds1s,
            feds2s=feds2s,
            pdf="output/%d_%s.pdf" % (1 + i, stem),
            pages=[stem],
        )


def runs(file=None):
    out = []
    for i, lineRaw in enumerate(file):
        line = lineRaw.strip()
        if line.startswith("#"):
            continue
        try:
            out.append(int(line))
        except ValueError:
            print "skipping line %d: '%s'" % (i, line)
    return out


if __name__ == "__main__":
    main(opts()[0], runs(sys.stdin))
Esempio n. 9
0
            options.file1 = eval("find%d" % iFind)(run)
        else:
            options.file1 = find_gr(run, grDir, options.hhmm, quiet)

        if not options.file1:
            continue

        fileNames = options.file1.split(",")
        report(fileNames, iFind)

        n = len(fileNames)
        if 2 <= n and options.hhmm is None:
            options.sparseLoop = max(1, options.nEvents / n)
        else:
            options.sparseLoop = -1

        options.file2 = ""  # clear from previous iterations
        if oneRun.main(options):
            continue
        else:
            return

    printer.warning(
        "Did not find a matching file for run %d.  Perhaps try 'source env/lxplus6.sh'"
        % run)
    return 1


if __name__ == "__main__":
    main(*opts(alsoArgs=True))
Esempio n. 10
0
from ensembles import ensemble_specs
from measurement import measurement
from options import opts
from inputs import channel_data
import os
import batch

def chunk(L,n):
    return [L[i:i+n] for i in range(0,len(L), n)] if L else []

def chunktuple(T,n):
    return [(i,min(i+n,T[1])) for i in range(T[0],T[1], n)] if T[0]!=T[1] else []

if __name__ == '__main__':
    r.gROOT.SetBatch(1)
    options = opts()

    measure = 0
    if options.partitions==True:
        print ','.join(systematics.partitions)
        exit()
    partitions = options.partitions.split(',')

    allSystematics = [s['label'] for s in systematics.systematics()]
    if options.systematics == True:
        print ','.join(allSystematics)
        exit()
    systs = ([] if not options.systematics else 
             allSystematics if options.systematics=='all' else 
             options.systematics.split(','))
Esempio n. 11
0
 def load(self):
     self.__server.reset()
     if not opts().deploy and os.path.exists(self.__cfg_fname):
         storage.load(self.__server, open(self.__cfg_fname))
Esempio n. 12
0
 def __init__(self):
     self.__server = Server.get()
     self.__cfg_fname = opts().cfg_fname
     self.__cfg_fname_new = self.__cfg_fname + '.new'
     self.__dhcp_cfg_fname = opts().dhcp_cfg_fname
     self.__dhcp_cfg_fname_new = self.__dhcp_cfg_fname + '.new'
Esempio n. 13
0
start = False
while not start:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            pygame.quit()
            quit()
        elif event.type == pygame.KEYDOWN:
            if event.key == pygame.K_SPACE:
                if graph.sel == 0:
                    start = True
                    print('Continue')
                elif graph.sel == 1:
                    start = True
                    print('New Game')
                elif graph.sel == 2:
                    opts(graph, clock)
                else:
                    start = True
                    print('Exit')

            elif event.key == pygame.K_DOWN:
                if graph.sel < 3:
                    graph.sel += 1
                else:
                    graph.sel = 0
            elif event.key == pygame.K_UP:
                if graph.sel > 0:
                    graph.sel -= 1
                else:
                    graph.sel = 3
            elif event.key == pygame.K_F11: