Esempio n. 1
0
def showDecay():
    tree1 = TTree()
    tree1.ReadFile(
        '/data/repos/Mic4Test_KC705/Software/Analysis/data/ENC/ENC_Chip5Col12_scan1.dat',
        'idX/i:vL/F:vH:A:D/i:R:W')
    tree1.ReadFile(
        '/data/repos/Mic4Test_KC705/Software/Analysis/data/ENC/ENC_Chip5Col12_scan2_mod.dat'
    )

    #     p1 = TProfile('p1','p1;#DeltaU [V];Prob',50,0.12,0.2)
    #     tree1.Draw("W:(vH-vL)>>p1","","profE")

    tree1.Draw("W*0.0001:(vH-vL)>>p1", "", "profs")

    p1 = gPad.GetPrimitive('p1')
    p1.GetYaxis().SetTitle('<Width> [us]')
    #     p1.GetYaxis().SetTitle('<Raising time> [us]')
    p1.GetXaxis().SetTitle('#Delta U [V]')

    #     fun1 = TF1('fun1','0.5*(1+TMath::Erf((x-[0])/(TMath::Sqrt(2)*[1])))',0.05,0.3)
    #     fun1.SetParameter(0,0.155);
    #     fun1.SetParameter(1,0.005);
    #
    #     p1.Fit(fun1)
    #     fun1a = p1.GetFunction('fun1')
    #     fun1a.SetLineColor(2)
    #
    #     p1.Draw("Esame")
    #
    #     v0 = fun1a.GetParameter(0)
    #     e0 = fun1a.GetParError(0)
    #     v1 = fun1a.GetParameter(1)
    #     e1 = fun1a.GetParError(1)
    #
    #     print v0, v1
    #
    #     fUnit = 1000.
    #     lt = TLatex()
    #     lt.DrawLatexNDC(0.185,0.89,'#mu = {0:.1f} #pm {1:.1f} mV'.format(v0*fUnit, e0*fUnit))
    #     lt.DrawLatexNDC(0.185,0.84,'#sigma = {0:.1f} #pm {1:.1f} mV'.format(v1*fUnit, e1*fUnit))
    #
    #     print 'TMath::Gaus(x,{0:.5f},{1:.5f})'.format(v0, v1)
    #     fun2 = TF1('gaus1','TMath::Gaus(x,{0:.5f},{1:.5f})'.format(v0, v1))
    #     fun2.SetLineColor(4)
    #     fun2.SetLineStyle(2)
    #     fun2.Draw('same')
    #
    #     lg = TLegend(0.7,0.4, 0.95, 0.5)
    #     lg.SetFillStyle(0)
    #     lg.AddEntry(p1,'Measurement','p')
    #     lg.AddEntry(fun1a,'Fit','l')
    #     lg.AddEntry(fun2,'Gaus','l')
    #     lg.Draw()

    waitRootCmdX()
Esempio n. 2
0
def test2():
    add_fit_menu()
    t150 = TTree()
    t150.ReadFile('Jan05a_150mV.dat')
    t150.ReadFile('Jan05a_50mV.dat')
#     t150.ReadFile('Jan05a_100mV.dat')
    t150.ReadFile('tt2.dat')
    t150.ReadFile('Jan05a_250mV.dat')

    t150.Draw('A','ch==12')
    waitRootCmdX()
Esempio n. 3
0
def harvesttree(textfile=''):
    filename, description = treedescription()
    tree = TTree('tree', 'data from ascii file')
    if len(textfile) > 0:
        nlines = tree.ReadFile(textfile, description)
    elif len(filename) > 0:
        nlines = tree.ReadFile(filename, description)
    else:
        print 'WARNING: file name is empty. No tree is read.'

    tree.SetMarkerStyle(8)
    tree.SetMarkerSize(0.5)

    return tree
Esempio n. 4
0
def makeEMSTree(dirname, fname):
    print dirname
    ifname = dirname.rstrip("/") + "/" + fname + ".txt"

    if len(dirname.split("/")) > 1:
        outdir = "root/" + dirname.split('/')[1]
    else:
        outdir = "root"
    try:
        os.makedirs(outdir)
    except:
        pass

    ofname = outdir + "/" + fname + ".root"
    print ofname
    #output file and tree
    outfile = TFile(ofname, "RECREATE")
    tree = TTree("tree", "tree of " + fname)

    #create tree from text file

    # Raw formats:
    desc = "time:amplitude:area:areaFromScope"

    tree.ReadFile(ifname, desc)  # delimiter = space
    #tree.ReadFile(ifname,desc,",") # delimiter = comma

    #save output tree
    outfile.cd()
    tree.Write()
    outfile.Close()

    #print message
    print "Created tree in root file: %s" % ofname
Esempio n. 5
0
    def execute(self, log_out, log_err):

        # Use local ROOT imports so ROOT env isn't necessary just to load the module.
        from ROOT import gROOT, TFile, TTree

        output_file = self.outputs[0]
        input_files = self.inputs

        logger.info("Creating output ROOT tuple '%s'" % output_file)
        logger.info("Input text files: %s" % str(input_files))

        treeFile = TFile(output_file, "RECREATE")
        tree = TTree("ntuple", "data from text tuple " + input_files[0])

        if len(input_files) > 1:
            inputfile = tempfile.NamedTemporaryFile(delete=False)
            print inputfile.name
            firstfile = True
            for filename in input_files:
                if os.path.isfile(filename):
                    f = open(filename, 'r')
                    firstline = True
                    for i in f:
                        if firstline:
                            if firstfile:
                                branchdescriptor = i
                                inputfile.write(i)
                            else:
                                if branchdescriptor != i:
                                    print "branch descriptor doesn't match"
                                    sys.exit(-1)
                        else:
                            inputfile.write(i)
                        firstline = False
                    f.close()
                    firstfile = False
                else:
                    logger.warn("Ignoring non-existant input file '%s'" %
                                filename)
            inputfile.close()
            print tree.ReadFile(inputfile.name)
            os.remove(inputfile.name)
        else:
            print tree.ReadFile(input_files[0])

        tree.Write()
Esempio n. 6
0
def makeGaussians(data_file):
    #Pull in Data
    allData = TTree()
    allData.ReadFile(data_file)
    #allData.GetXaxis().SetTitle("Read Velocity (MB/s)")

    for (buf, reads) in itertools.product(bufferList, numReadsList):
        drawNext(allData, buf, reads)
Esempio n. 7
0
def build_tree(tree_name, tree_descriptor, input_file):

    if tree_name is None:
        tree_name = re.match('(.*)\.cat', input_file).group(1)

    tree = TTree(tree_name, tree_name)
    tree.ReadFile(input_file, tree_descriptor)

    return tree
Esempio n. 8
0
def compareX():
#     fl = ['Jan05a_100mV.dat', 'Jan08a_100mV_r30p0us.dat','Jan08a_100mV_r40p0us.dat','Jan08a_100mV_r50p0us.dat']
#     fl = ['Jan05a_100mV.dat', 'Jan08a_100mV_r30p0us.dat','Jan08a_100mV_r40p0us.dat','Jan08a_100mV_r50p0us.dat']
    fl = ['data/fpgaLin/Jan22a_C2_100mV_f{0:d}.dat'.format(x) for x in [100,200,500,1000]]
    fs = [TTree() for f in fl]
    opt = ''

    chx = TTree()
    for f in fl: chx.ReadFile(f)

    chx.Draw('A','ch==12','axis')

    opt = 'same'
    for i in range(len(fl)):
        fs[i].ReadFile(fl[i])
        fs[i].SetFillStyle(0)
        fs[i].SetLineColor(i+1)

        fs[i].Draw('A','ch==12',opt)
    waitRootCmdX()
Esempio n. 9
0
def test1(fname='tt2.dat'):
    add_fit_menu()

    t1 = TTree()
    t1.ReadFile(fname)

    t1.Show(0)

    for i in range(18):
        c1.cd(i+1)
        lt.DrawLatexNDC(0.2,0.4,'Ch={0:d}'.format(i))
        t1.Draw('A','ch=={0:d}'.format(i))

    #     t1.Draw('A>>h1','ch=={0:d}'.format(i),'goff')
    #     h1 = gDirectory.Get('h1')
    #     h1.SetName('ch'+str(i))
    # 
    #     c1.cd(i)
    #     h1.Draw()
    #     if i>1: break
    c1.cd()
    waitRootCmdX()
Esempio n. 10
0
def makeEMSTree(dirname,fname):
    print(dirname)
    ifname = dirname.rstrip("/")+ "/" + fname + ".txt"

    loutdir = (dirname.rstrip("/")).split('/')
    if len(loutdir)>1:
        outdir = "."
        for idx in range(1,len(loutdir)):
            outdir+="%s/"%(loutdir[idx])
    else:
        outdir = "."
    try:
        os.makedirs(outdir)
    except:
        pass

    ofname = outdir.rstrip("/") + "/" + fname + ".root"
    print(ofname)
    #output file and tree
    outfile = TFile(ofname,"RECREATE")
    tree = TTree("tree","tree of "+fname)

    #create tree from text file

    # Raw formats:
    desc = "time:amplitude:area:areaFromScope"

    tree.ReadFile(ifname,desc) # delimiter = space
    #tree.ReadFile(ifname,desc,",") # delimiter = comma

    #save output tree
    outfile.cd()
    tree.Write()
    outfile.Close()

    #print message
    print("Created tree in root file: %s"%ofname)
Esempio n. 11
0
def inspectCh(ds, chs):
    t = TTree()
    t.SetFillColor(0)
    t.SetFillStyle(0)
    for d in ds:
        t.ReadFile(d[1])

    cv1 = TCanvas()
    cv1.Divide(2,4)

    icv = 1
    for ch in chs:
        cv1.cd(icv)
        t.Draw('A','ch=={0:d}'.format(ch))
        hx = gPad.GetPrimitive('htemp')
        hx.GetXaxis().SetTitle('U_{Out} [V]')
        hx.SetName('h{0:d}'.format(ch))
        
        lt.DrawLatexNDC(0.7,0.9,"Ch {0:d}".format(ch))

        icv += 1

    cv1.cd(0)
    waitRootCmdX()
Esempio n. 12
0
outdir = dirname.rstrip("/")

try:
    os.makedirs(outdir)
except:
    pass

ofname = outdir + "/" + fname.rstrip(".txt") + ".root"

#output file and tree
outfile = TFile(ofname, "RECREATE")
tree = TTree("tree", "tree of " + fname)
outfile.cd()

#create tree from text file
desc = "MUEFFECTIVE:EFFICIENCY"  #this gives names and types of variables
tree.ReadFile(ifname, desc)  # delimiter = space
#tree.ReadFile(ifname,desc,",") # delimiter = comma

c1 = TCanvas("c1", "c1", 500, 500)
tree.Draw(
    "EFFICIENCY:MUEFFECTIVE>>MvsE")  # draws MuE vs Eff and saves to histogram
c1.SaveAs("MvsE.root")

#save output tree
tree.Write()
outfile.Close()

#print message
print "Created tree in root file: %s" % ofname
Esempio n. 13
0
    v1 = allData.GetV1()

    graph = TGraph(numPoints, v2, v1)

    graph.SetTitle("%i Concurrent Reads" % reads)
    graph.SetXTitle("Read Velocity (MB/s)")
    graph.Draw("ap")
    return graph


##### Begin Main Scriping #####

#Pull in Data
data_file = sys.argv[1]
allData = TTree()
allData.ReadFile(data_file)

#Set title equal to default value if none given
title = sys.argv[2] if len(
    sys.argv) == 3 else "Read Velocity on Local Disk for root Files"

#Create Background Canvas
BG = TCanvas("BG", title, 1920, 1080)
'''RObjs['headerText'] = drawTitle(title)

#Create pad to hold all plots.
body = TPad("MainPad", "My main pad", 0, 0, 1, 0.9)
body.Draw()
halfSize = (int) (len(numReadsList)/2)
body.Divide(halfSize,halfSize)
Esempio n. 14
0
print sys.argv[2:]

if len(sys.argv) > 3:
    inputfile = tempfile.NamedTemporaryFile(delete=False)
    print inputfile.name
    firstfile = True
    for filename in sys.argv[2:]:
        f = open(filename)
        firstline = True
        for i in f:
            if firstline:
                if firstfile:
                    branchdescriptor = i
                    inputfile.write(i)
                else:
                    if branchdescriptor != i:
                        print "branch descriptor doesn't match"
                        sys.exit(-1)
            else:
                inputfile.write(i)
            firstline = False
        f.close()
        firstfile = False
    inputfile.close()
    print tree.ReadFile(inputfile.name)
    os.remove(inputfile.name)
else:
    print tree.ReadFile(sys.argv[2])

tree.Write()
Esempio n. 15
0
def test3():
    ds = [(50, 'Jan05a_50mV.dat'), (100, 'Jan05a_100mV.dat'), (150, 'Jan05a_150mV.dat'), (250, 'Jan05a_250mV.dat'), (400, 'Jan05a_400mV.dat')]
    chs = [12, 8, 1, 4, 6, 9, 13,15]
    inspectCh(ds,chs)

    return

#     pars = array('d',[0]*3)
#     errs = array('d',[0]*3)
#     print(max(chs))
#     return
    nch = max(chs)+1
    g1s = [None]*nch
    g2s = [None]*nch

    g1M = -1
    g2M = -1
    for d in ds:
        tr = TTree()
        tr.ReadFile(d[1])

        for ch in chs:
            gDirectory.DeleteAll('h1*')
            tr.Draw('A>>h1','ch=={0:d}'.format(ch),'goff')
            h1 = gDirectory.Get('h1')
            h1.Fit('gaus')
            
            fun1 = h1.GetFunction('gaus')
            fun1.SetLineColor(4)
            errs = fun1.GetParErrors()
            pars = fun1.GetParameters()
#             print(d[0],'--'*20)
#             print(pars[0],errs[0])
#             print(pars[1],errs[1])
#             print(pars[2],errs[2])

            if g1s[ch] is None:
                g1s[ch] = TGraphErrors()
                g2s[ch] = TGraphErrors()

            g1 = g1s[ch]
            g2 = g2s[ch]
            n = g1.GetN()
            g1.SetPoint(n, d[0]*7, pars[1])
            g1.SetPointError(n, 0, errs[1])
            g2.SetPoint(n, d[0]*7, pars[2]*d[0]*7/pars[1])
            g2.SetPointError(n, 0, errs[2]*d[0]*7/pars[1])

            if pars[1]+errs[1]>g1M: g1M = pars[1]+errs[1]
            t = (pars[2]+errs[2])*d[0]*7/pars[1]
            if t>g2M: g2M = t
    opt = 'A'
    h1x = None
    for g1 in g1s:
        if g1 is None: continue
        g1.Draw('PL PMC PLC'+opt)
        opt = ' same'
        if h1x is None: h1x = g1.GetHistogram()
    h1x.GetYaxis().SetRangeUser(0, g1M*1.1)
    h1x.GetYaxis().SetTitle("U_{Out} [V]")
    h1x.GetXaxis().SetTitle("N_{Sig} [e^{-}]")
    waitRootCmdX()
    opt = 'A'

    h2x = None
    for g2 in g2s:
        if g2 is None: continue
        g2.Draw('PL PMC PLC'+opt)
        opt = ' same'
        if h2x is None: h2x = g2.GetHistogram()
    h2x.GetYaxis().SetRangeUser(0, g2M*1.1)
    h2x.GetYaxis().SetTitle("ENC [e^{-}]")
    h2x.GetXaxis().SetTitle("N_{Sig} [e^{-}]")
    waitRootCmdX()
Esempio n. 16
0
def showENC():
    fname1 = '/data/repos/Mic4Test_KC705/Software/Analysis/data/ENC/ENC_Chip5Col12_scan1.dat'

    tree1 = TTree()
    tree1.ReadFile(
        '/data/repos/Mic4Test_KC705/Software/Analysis/data/ENC/ENC_Chip5Col12_scan1.dat',
        'idX/i:vL/F:vH:A:D/i:R:W')
    tree1.ReadFile(
        '/data/repos/Mic4Test_KC705/Software/Analysis/data/ENC/ENC_Chip5Col12_scan2_mod.dat'
    )

    tree1.Show(500)

    p1 = TProfile('p1', 'p1;#DeltaU [V];Prob', 50, 0.12, 0.2)
    tree1.Draw("D:(vH-vL)>>p1", "", "profE")

    ### change it to tgraph
    g1 = TGraphErrors()
    for i in range(p1.GetNbinsX() + 2):
        N = p1.GetBinEntries(i)
        if N > 0:
            print i, N, p1.GetXaxis().GetBinCenter(i), p1.GetBinContent(
                i), p1.GetBinError(i)
            n = g1.GetN()
            g1.SetPoint(n, p1.GetXaxis().GetBinCenter(i), p1.GetBinContent(i))
            g1.SetPointError(n, 0, p1.GetBinError(i))


#     g1.SetMarkerColor(3)
#     g1.SetLineColor(3)

    p1.Draw("axis")
    g1.Draw('Psame')

    fun1 = TF1('fun1', '0.5*(1+TMath::Erf((x-[0])/(TMath::Sqrt(2)*[1])))',
               0.05, 0.3)
    fun1.SetParameter(0, 0.155)
    fun1.SetParameter(1, 0.005)

    g1.Fit(fun1)
    fun1a = g1.GetFunction('fun1')

    #     p1.Fit(fun1)
    #     fun1a = p1.GetFunction('fun1')
    fun1a.SetLineColor(2)

    #     p1.Draw("Esame")

    v0 = fun1a.GetParameter(0)
    e0 = fun1a.GetParError(0)
    v1 = fun1a.GetParameter(1)
    e1 = fun1a.GetParError(1)

    print v0, v1

    fUnit = 1000.
    lt = TLatex()
    lt.DrawLatexNDC(
        0.185, 0.89,
        '#mu = {0:.1f} #pm {1:.1f} mV'.format(v0 * fUnit, e0 * fUnit))
    lt.DrawLatexNDC(
        0.185, 0.84,
        '#sigma = {0:.1f} #pm {1:.1f} mV'.format(v1 * fUnit, e1 * fUnit))

    print 'TMath::Gaus(x,{0:.5f},{1:.5f})'.format(v0, v1)
    fun2 = TF1('gaus1', 'TMath::Gaus(x,{0:.5f},{1:.5f})'.format(v0, v1))
    fun2.SetLineColor(4)
    fun2.SetLineStyle(2)
    fun2.Draw('same')

    lg = TLegend(0.7, 0.4, 0.95, 0.5)
    lg.SetFillStyle(0)
    lg.AddEntry(p1, 'Measurement', 'p')
    lg.AddEntry(fun1a, 'Fit', 'l')
    lg.AddEntry(fun2, 'Gaus', 'l')
    lg.Draw()

    waitRootCmdX()
Esempio n. 17
0
    def showENC(self):
        tree1 = TTree()
        header = 'idX/i:vL/F:vH:A:D/i:R:W'
        first = True
        for f in self.dataFiles:
            if first: tree1.ReadFile(f, header)
            else: tree1.ReadFile(f)

        p1 = TProfile('p1', 'p1;#DeltaU [V];Prob', self.bins[0],
                      tree1.GetMinimum('vH-vL') * 0.8,
                      tree1.GetMaximum('vH-vL') * 1.2)
        tree1.Draw("D:(vH-vL)>>p1", "", "profE")

        ### change it to tgraph
        g1 = TGraphErrors()
        for i in range(p1.GetNbinsX() + 2):
            N = p1.GetBinEntries(i)
            if N > 0:
                print i, N, p1.GetXaxis().GetBinCenter(i), p1.GetBinContent(
                    i), p1.GetBinError(i)
                n = g1.GetN()
                g1.SetPoint(n,
                            p1.GetXaxis().GetBinCenter(i), p1.GetBinContent(i))
                g1.SetPointError(n, 0, p1.GetBinError(i))

        p1.Draw("axis")
        g1.Draw('Psame')

        fun1 = TF1('fun1', '0.5*(1+TMath::Erf((x-[0])/(TMath::Sqrt(2)*[1])))',
                   0.05, 0.3)
        fun1.SetParameter(0, 0.155)
        fun1.SetParameter(1, 0.005)

        g1.Fit(fun1)
        fun1a = g1.GetFunction('fun1')

        fun1a.SetLineColor(2)

        v0 = fun1a.GetParameter(0)
        e0 = fun1a.GetParError(0)
        v1 = fun1a.GetParameter(1)
        e1 = fun1a.GetParError(1)

        print v0, v1

        fUnit = 1000.
        self.lt.DrawLatexNDC(
            0.185, 0.89,
            '#mu = {0:.1f} #pm {1:.1f} mV'.format(v0 * fUnit, e0 * fUnit))
        self.lt.DrawLatexNDC(
            0.185, 0.84,
            '#sigma = {0:.1f} #pm {1:.1f} mV'.format(v1 * fUnit, e1 * fUnit))
        if self.Info:
            self.lt.DrawLatexNDC(0.185, 0.6, self.Info)

        print 'TMath::Gaus(x,{0:.5f},{1:.5f})'.format(v0, v1)
        fun2 = TF1('gaus1', 'TMath::Gaus(x,{0:.5f},{1:.5f})'.format(v0, v1))
        fun2.SetLineColor(4)
        fun2.SetLineStyle(2)
        fun2.Draw('same')

        lg = TLegend(0.7, 0.4, 0.95, 0.5)
        lg.SetFillStyle(0)
        lg.AddEntry(p1, 'Measurement', 'p')
        lg.AddEntry(fun1a, 'Fit', 'l')
        lg.AddEntry(fun2, 'Gaus', 'l')
        lg.Draw()

        waitRootCmdX()
Esempio n. 18
0
#Line_string = str(f.readline())
#bin_init,_,_ = Line_string.split();   bin_init = float(bin_init)   # get initial bin

lineList = f.readlines()
Nbin = (len(lineList))  # get number of bins
Line_string = str(lineList[0])
bin_init, _, _ = Line_string.split()
bin_init = float(bin_init)  # get initial bin
Line_string = str(lineList[len(lineList) - 1])
_, bin_final, _ = Line_string.split()
bin_final = float(bin_final)  # get final bin
f.seek(0)  # reset python read line

hist = TH1D("h1f", "h1f", Nbin, bin_init, bin_final)
tree = TTree("tree", "tree")
tree.ReadFile("py-fillrandom_via_py.txt", "init_bin/D:end_bin/D:bin_content/D")
total_e = 0
for i in range(1, Nbin + 1):
    Line_string = str(f.readline())
    ss, ff, bin_c = Line_string.split()
    ss = float(ss)
    ff = float(ff)
    bin_c = float(bin_c)
    hist.SetBinContent(i, bin_c)
    total_e = total_e + bin_c
#gStyle.SetOptStat()
hist.Draw()
gPad.Update()
can.Update()

wf = TFile("root_tree_from_txt.root", "RECREATE")
Esempio n. 19
0
#! /usr/bin/python

from ROOT import ROOT, TFile, TTree
from sys import argv, exit

name_in = argv[1]
name_out = argv[2]
branchDescriptor = ""
if len(argv) == 4:
    branchDescriptor = argv[3]
    print branchDescriptor

fout = TFile(name_out, "recreate")
T = TTree("T", branchDescriptor)
T.ReadFile(name_in, branchDescriptor)
T.Write()
fout.Close()
Esempio n. 20
0
parser.add_option('-b',
                  action='store_true',
                  dest='batch',
                  help='run in batch mode without graphics',
                  default=False)

(opts, args) = parser.parse_args()

from ROOT import TTree, TFile, TH1F, TH1, gPad, gROOT, TCanvas
import sys

sys.path.append('/uscms/home/andersj/pyroot')
import pyroot_logon

fname = args[0]

pes = TTree()
pes.ReadFile(fname, 'LayerPES[19]/F')

BarrelPE = TH1F("BarrelPE", "Barrel PE", 100, 0., 1500. * 30.)
BarrelSum = 0.
for entry in pes:
    BarrelSum = 0.
    for i in range(0, 17):
        BarrelSum += entry.LayerPES[i]
    if (BarrelSum > 300):
        BarrelPE.Fill(BarrelSum)

c1 = TCanvas()
BarrelPE.Draw()
Esempio n. 21
0
fname = args[0]
fin = open(fname, 'r')
firstLine = fin.readline()
fin.close()
floatGroup = r'([0-9\.]*)'
Test1 = float(re.search('Test1 ' + floatGroup, firstLine).group(1))
Test2 = float(re.search('Test2 ' + floatGroup, firstLine).group(1))
pescale = float(re.search('pescale ' + floatGroup, firstLine).group(1))
print floatGroup, Test1, Test2, pescale

gev2pe = 30. * pescale

Resps = TTree()
Resps.ReadFile(
    fname,
    'TotPe/I:LivePxIntegral/F:NP/I:ped[3]/F:Layer/I:Response/F:GenPE/I:Response2/F:GenPE2/I:respForm[50]/F:genForm[50]/F'
)

depths = int(Resps.GetMaximum('Layer'))
BarrelPE = TH1F("BarrelPE", "Barrel PE", 100, 0., Test1 * 30. * pescale)
BarrelPE2 = TH1F("BarrelPE2", "Barrel PE", 100, 0., Test2 * 30. * pescale)
BarrelRes = TH1F("BarrelRes", "Barrel Resolution", 100, -0.3, 0.05)
BarrelRes2 = TH1F("BarrelRes2", "Barrel Resolution", 100, -0.3, 0.05)
BarrelSum = 0.
BarrelSum2 = 0.
BarrelDiff = 0.
BarrelDiff2 = 0.
for entry in Resps:
    if (entry.Layer > depths - 1):
        BarrelPE.Fill(BarrelSum)
        BarrelSum = 0.