def main(options): 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
def shortlists(): for i, (inp, out), in enumerate([(sw.fedList("HO"), "724-731"), (sw.fedList("1118,HO"), "724-731,1118"), (sw.fedList("HCAL"), "724-731,1100-1123,1134-1135"), (sw.fedList("1118,HO,1111,1118,670"), "670,724-731,1111,1118"), (sw.fedList("1118,HO,1111,670,671"), "670-671,724-731,1111,1118"), ([1118, 1134, 1135], "1118,1134-1135"), ]): result = utils.shortList(inp) if result != out: print("%2d" % i) print(" Input:", inp) print(" Expected: ", out) print(" Result: ", result) print("") return
def shortlists(): for i, (inp, out), in enumerate([(sw.fedList("HO"), "724-731"), (sw.fedList("1118,HO"), "724-731,1118"), (sw.fedList("HCAL"), "724-731,1100,1102,1104,1106,1108,1110,1112,1114,1116,1118-1123,1134"), (sw.fedList("1118,HO,1111,1118,670"), "670,724-731,1111,1118"), (sw.fedList("1118,HO,1111,670,671"), "670-671,724-731,1111,1118"), ([1118, 1134, 1135], "1118,1134-1135"), ]): result = utils.shortList(inp) if result != out: print "%2d" % i print " Input:", inp print " Expected: ", out print " Result: ", result print return
def processed(options): if not all([options.file1, options.feds1]): sys.exit("--file1 and --feds1 are required (see './oneRun.py --help').") if not options.outputFile.endswith(".root"): sys.exit("--output-file must end with .root (%s)" % options.outputFile) if options.file2 and not options.feds2: sys.exit("--file2 requires --feds2") if 0 <= options.sparseLoop: if options.file2: sys.exit("--sparse-loop does not work with --file2") if options.nEventsSkip: sys.exit("--sparse-loop does not work with --nevents-skip") matching.__ignoreCE = options.ignoreCE matching.__utcaBcnDelta = options.utcaBcnDelta matching.__utcaPipelineDelta = options.utcaPipelineDelta printer.__color = not options.noColor common = subset(options, ["dump", "firstNTs", "lastNAmcs", "nEventsMax", "nEventsSkip", "perTs", "progress", "sparseLoop"]) common.update(subset(options, ["noWarnQuality"], invert=True)) common["crateslots"] = sw.fedList(options.crateslots) plugins = options.plugins.split(",") if 1 <= options.dump and "printraw" not in plugins: plugins.append("printraw") if options.file2 and "compare" not in plugins: plugins.append("compare") common["plugins"] = [x for x in plugins if x] outer = {"fedIds": sw.fedList(options.feds1), "label": "files1", "fileNames": options.file1} outer.update(common) inner = {} if options.feds2: inner = {"fedIds": sw.fedList(options.feds2), "label": "files2", "fileNames": options.file2 if options.file2 else options.file1} inner.update(common) return {"outer": outer, "inner": inner, "outputFile": options.outputFile, "mapOptions": subset(options, ["printEventMap", "identityMap"]), "options": subset(options, ["anyEmap", "printEmap", "printMismatches", "fewerHistos"])}
def processed(options): if not all([options.file1, options.feds1]): sys.exit("--file1 and --feds1 are required (see './oneRun.py --help').") if not options.outputFile.endswith(".root"): sys.exit("--output-file must end with .root (%s)" % options.outputFile) if options.file2 and not options.feds2: sys.exit("--file2 requires --feds2") if 0 <= options.sparseLoop: if options.file2: sys.exit("--sparse-loop does not work with --file2") if options.nEventsSkip: sys.exit("--sparse-loop does not work with --nevents-skip") matching.__okErrF = sw.fedList(options.okErrF) matching.__utcaBcnDelta = options.utcaBcnDelta matching.__utcaPipelineDelta = options.utcaPipelineDelta printer.__color = not options.noColor common = subset(options, ["dump", "firstNTs", "lastNAmcs", "nEventsMax", "nEventsSkip", "progress", "sparseLoop"]) common.update(subset(options, ["noUnpack", "noWarnQuality", "noWarnUnpack"], invert=True)) common["crateslots"] = sw.fedList(options.crateslots) plugins = options.plugins.split(",") if 1 <= options.dump and "printraw" not in plugins: plugins.append("printraw") if options.file2 and "compare" not in plugins: plugins.append("compare") common["plugins"] = filter(lambda x: x, plugins) outer = {"fedIds": sw.fedList(options.feds1), "label": "files1", "fileNames": options.file1} outer.update(common) inner = {} if options.feds2: inner = {"fedIds": sw.fedList(options.feds2), "label": "files2", "fileNames": options.file2 if options.file2 else options.file1} inner.update(common) return {"outer": outer, "inner": inner, "outputFile": options.outputFile, "mapOptions": subset(options, ["printEventMap", "identityMap"]), "options": subset(options, ["anyEmap", "printEmap", "printMismatches", "fewerHistos"])}
def main(options): if options.noLoop: retCode = 0 feds1 = fedList(options.feds1) feds2 = fedList(options.feds2) elif options.profile: pr = cProfile.Profile() retCode, feds1, feds2 = pr.runcall(analyze.main, options) pr.print_stats("time") else: retCode, feds1, feds2 = analyze.main(options) if feds2 and 0 <= options.dump: analyze.printChannelSummary(options.outputFile) if not options.noPlot: graphs.main(options.outputFile, feds1, feds2) return retCode, feds1, feds2
def main(options, runs=[]): roots = [] feds1s = [] feds2s = [] for run in runs: if run == 239895: options.hhmm = 2212 else: options.hhmm = None options.file1 = "" options.file2 = "" if not look.main(options, [run], quiet=True): roots.append(options.outputFile) feds1s.append(fedList(options.feds1)) feds2s.append(fedList(options.feds2)) plot(roots, feds1s, feds2s)
def subset(options, l, process=False, invert=False): assert not (process and invert) out = {} for item in l: value = getattr(options, item) if process: out[item] = sw.fedList(value) elif invert: # "noFoo": True --> "foo": False out[item[2].lower() + item[3:]] = not value else: out[item] = value return out
def go(options): kargs = subset(options, ["feds1", "feds2"], process=True) kargs.update(subset(options, ["nEvents", "nEventsSkip", "outputFile", "noUnpack", "patterns", "sparseLoop"])) kargs["compareOptions"] = subset(options, ["anyEmap", "printEmap"]) kargs["mapOptions"] = subset(options, ["printEventMap", "identityMap"]) kargs["printOptions"] = subset(options, ["dump", "progress"]) kargs["printOptions"].update(subset(options, ["noWarnUnpack", "noWarnQuality"], invert=True)) kargs["printOptions"]["crateslots"] = sw.fedList(options.crateslots) for iFile in [1, 2]: value = getattr(options, "file%d" % iFile) if value: kargs["files%d" % iFile] = value.split(",") return analyze.oneRun(**kargs)
def go(options): kargs = subset(options, ["feds1", "feds2"], process=True) kargs.update( subset(options, [ "nEvents", "nEventsSkip", "outputFile", "noUnpack", "patterns", "sparseLoop" ])) kargs["compareOptions"] = subset( options, ["anyEmap", "printEmap", "printMismatches", "fewerHistos"]) kargs["mapOptions"] = subset(options, ["printEventMap", "identityMap"]) kargs["printOptions"] = subset(options, ["dump", "progress"]) kargs["printOptions"].update( subset(options, ["noWarnUnpack", "noWarnQuality"], invert=True)) kargs["printOptions"]["crateslots"] = sw.fedList(options.crateslots) for iFile in [1, 2]: value = getattr(options, "file%d" % iFile) if value: kargs["files%d" % iFile] = value.split(",") return analyze.oneRun(**kargs)
def main(options): makeSummaryPdf(inputFile=options.outputFile, feds1=sw.fedList(options.feds1), feds2=sw.fedList(options.feds2), pdf=options.outputFile.replace(".root", ".pdf"), )