Beispiel #1
0
wsutils.loadLibraries(options)

if options.sort:
    # case insensitive sorting
    varSortFunc = lambda var: var.GetName().lower()
else:
    varSortFunc = None

for fname in ARGV:

    fin = ROOT.TFile.Open(fname)

    if not fin.IsOpen():
        print >> sys.stderr, "problems opening file " + fname
        sys.exit(1)

    # traverse all directories in this file
    for ws in wsutils.findWorkspaces(fin, options):
        if options.csv:
            wsutils.printVarsCSV(ws.allVars(), sortKeyFunc=varSortFunc)
        else:
            print "variables in " + fname + ":" + ws.GetName() + ":"
            print "----------------------------------------"
            sys.stdout.flush()

            wsutils.printVars(ws.allVars(), sortKeyFunc=varSortFunc)

    ROOT.gROOT.cd()
    fin.Close()
Beispiel #2
0
    maxSpec = float(maxSpec)
else:
    maxSpec = None

if minSpec == None and maxSpec == None:
    print >> sys.stderr, "neither upper nor lower bound specified, exiting"
    sys.exit(1)
#--------------------

fin = ROOT.TFile.Open(fname, "UPDATE")
if not fin.IsOpen():
    print >> sys.stderr, "problems opening file " + fname
    sys.exit(1)

# insist that there is a single workspace in this file
workspaces = wsutils.findWorkspaces(fin, options)

if len(workspaces) > 1:
    print >> sys.stderr, "more than one workspace found"
    sys.exit(1)

if len(workspaces) < 1:
    print >> sys.stderr, "no workspace found"
    sys.exit(1)

workspace = workspaces[0]

obj = workspace.obj(itemName)

if obj == None:
    print >> sys.stderr, "could not find item %s in workspace %s in file %s" % (