mytree["meas1"].Draw("area*1.e9>>myhist_meas1", "", "")

    myhist["meas2"] = TH1D("myhist_meas2", "meas2", 256, -0.5, 7.5)
    mytree["meas2"].Draw("area*1.e9>>myhist_meas2", "", "")

    myhist["meas3"] = TH1D("myhist_meas3", "meas3", 256, -0.5, 7.5)
    mytree["meas3"].Draw("area*1.e9>>myhist_meas3", "", "")

    myhist["meas4"] = TH1D("myhist_meas4", "meas4", 256, -0.5, 7.5)
    mytree["meas4"].Draw("area*1.e9>>myhist_meas4", "", "")

    ## Draw the first measurement
    myhist["meas1"].SetLineColor(2)
    ## Fit meas1
    fitopt = [0.4, 1.4]
    vEng[1], sFit[1], myfit[1] = AlphaSourceFitter().GausFitEngPeak(
        myhist["meas1"], "Chris 20181101", fitopt, 1)
    ## Some drawing options for meas1
    myhist["meas1"].GetXaxis().SetTitle("Energy [V#timesns]")
    myhist["meas1"].GetYaxis().SetTitle("A.U.")
    #myhist["meas1"].GetYaxis().SetRangeUser(5.e-2,2.e6)     ##Used for LogY
    myhist["meas1"].GetYaxis().SetRangeUser(0, 3.e3)

    myhist["meas2"].Scale(myhist["meas1"].Integral() /
                          myhist["meas2"].Integral())
    myhist["meas2"].SetLineColor(4)
    myhist["meas2"].SetLineStyle(1)
    ## Some drawing options for meas2
    myhist["meas2"].GetXaxis().SetTitle("Energy [V#timesns]")
    #myhist["meas2"].GetYaxis().SetTitle("Events")
    myhist["meas2"].GetYaxis().SetTitle("A.U.")
    #myhist["meas2"].GetYaxis().SetRangeUser(5.e-2,2.e6)
Esempio n. 2
0
    myhist["meas1"] = TH1D("myhist_meas1", "meas1", 256, 0, 8.5)
    ### Then get the saved histogram into the new one and normalize to ns from s by *1.e9
    mytree["meas1"].Draw("area*1.e9>>myhist_meas1", "", "")

    today = datetime.date.today()
    fTag = today.strftime("%Y%m%d")
    fName = options.input
    i = fName.find("/")
    while i > 0:
        fName = fName[i + 1:]
        i = fName.find("/")
    fName = fName[:-5]

    myhist["meas1"].SetTitle("%s" % fName)
    myhist["meas1"].GetXaxis().SetTitle("area [V#times ns]")
    myhist["meas1"].GetYaxis().SetTitle("counts")

    c1.Update()

    ## Fit meas1
    fitopt = [0.4, 0.4]
    vEng_1, sFit_1, myfit_1 = AlphaSourceFitter().GausFitEngPeak(
        myhist["meas1"], "meas1", fitopt, 1.)

    t = TLatex(0.5, 1600, "peak = %f#pm%f V#times ns" % (vEng_1, sFit_1))
    t.Draw()

    if (os.path.isdir("Results/%s" % fTag)) == False:
        os.mkdir("Results/%s" % fTag)
    c1.SaveAs("Results/%s/%s.pdf" % (fTag, fName))
    ## Create a histogram and insert the area histogram from the tree.
    ## Use |amplitude|>mypedcut && time > 500 to skim the data.
    ## The hist has limited range and it is only for fitting.
    mypedcut = 0.0
    hDC50_i = TH1D("myhist_DC50", "DC50", 52, -1, 0.)
    tDC50_i.Draw("area*1.e9>>myhist_DC50",
                 "abs(amplitude)>%f && time>%f" % (mypedcut, 0))
    hDC50_f = TH1D("myhist_DC50", "DC50", 52, -1, 0.)
    tDC50_f.Draw("area*1.e9>>myhist_DC50",
                 "abs(amplitude)>%f && time>%f" % (mypedcut, 0))
    ## Find overall max (this is energy offset)
    ## Fit 1st hist
    ## Range value seemed suspicious. Total range is [-0.2,0] but he fits in +-0.2 from the maxbin (???)
    ## Need to find the right pedestal cut value
    DCName_i = "DC50_i"
    vEng[DCName_i], sFit[DCName_i], myfit[DCName_i] = AlphaSourceFitter(
    ).GausFitEngPeak(hDC50_i, DCName_i, [0.2, 0.2], 1.)
    DCName_f = "DC50_f"
    vEng[DCName_f], sFit[DCName_f], myfit[DCName_f] = AlphaSourceFitter(
    ).GausFitEngPeak(hDC50_f, DCName_f, [0.2, 0.2], 1.)

    vOffset_i = [vEng[DCName_i], sFit[DCName_i]]
    vOffset_f = [vEng[DCName_f], sFit[DCName_f]]

    for nf, fl in sorted(plotSets.items()):
        fNames = {}
        grTemp_ = {}
        trees_ = {}
        labels_ = {}

        refPlot_ = []
        irrPlots_ = []
Esempio n. 4
0
    fTag = today.strftime("%Y%m%d")

    # Step 1: Find Dark Current and --> offset
    #fDC_i = TFile(finput[1][:-1]+"DarkCurrent_AdTrig_PN6_TO86ms_file20200206_"+finput[2][:8]+"_FF1_"+finput[2][9:-1]+".root")
    fDC_i = TFile(finput[1][:-1]+"DarkCurrent_AdTrig_PN6_TO86ms_file20200206_"+finput[3][:8]+"_"+finput[3][9:-1]+".root")
    tDC_i = fDC_i.Get("tree")
    fDC_f = TFile(finput[1][:-1]+"DarkCurrent_AdTrig_PN6_TO86ms_file20200206_"+finput[3][:8]+"_"+finput[3][9:-1]+".root")
    tDC_f = fDC_f.Get("tree")
    # Use |amplitude|>mypedcut && time > 0 to skim the data.
    mypedcut = 0.0
    hDC_i = TH1D("myhist_DC_i","DC",100,-1,0.)
    tDC_i.Draw("area*1.e9>>myhist_DC_i","abs(amplitude)>%f && time>%f"%(mypedcut,0))
    hDC_f = TH1D("myhist_DC_f","DC",100,-1,0.)
    tDC_f.Draw("area*1.e9>>myhist_DC_f","abs(amplitude)>%f && time>%f"%(mypedcut,0))
    DCName_i = "DC_i"
    vEng[DCName_i],sFit[DCName_i],myfit[DCName_i]=AlphaSourceFitter().GausFitEngPeak(hDC_i,DCName_i,[0.2,0.2],1.)
    DCName_f = "DC_f"
    vEng[DCName_f],sFit[DCName_f],myfit[DCName_f]=AlphaSourceFitter().GausFitEngPeak(hDC_f,DCName_f,[0.2,0.2],1.)
    vOffset_i = [vEng[DCName_i],sFit[DCName_i]]
    vOffset_f = [vEng[DCName_f],sFit[DCName_f]]

    # Step 2: Find gain
    fRef_i = TFile(finput[1][:-1]+"Pu239new_EJ200_2X_3_Default_Nofoil_FaceA_FastFrame_"+finput[2][:8]+"_"+finput[2][9:-1]+".root")
    tRef_i = fRef_i.Get("tree")
    fRef_f = TFile(finput[1][:-1]+"Pu239new_EJ200_2X_3_Default_Nofoil_FaceA_FastFrame_"+finput[3][:8]+"_"+finput[3][9:-1]+".root")
    tRef_f = fRef_f.Get("tree")
    hRef_i = TH1D("myhist_Ref_i","Ref",256,0,8)
    tRef_i.Draw("area*1.e9>>myhist_Ref_i")
    hRef_f = TH1D("myhist_Ref_f","Ref",256,0,8)
    tRef_f.Draw("area*1.e9>>myhist_Ref_f")
    RefName_i = "Ref_i"
    mytree["meas1"].Draw("area*1.e9>>myhist_meas1", "", "")

    myhist["meas2"] = TH1D("myhist_meas2", "meas2", 256, -0.5, 7.5)
    mytree["meas2"].Draw("area*1.e9>>myhist_meas2", "", "")

    myhist["meas3"] = TH1D("myhist_meas3", "meas3", 256, -0.5, 7.5)
    mytree["meas3"].Draw("area*1.e9>>myhist_meas3", "", "")

    myhist["meas4"] = TH1D("myhist_meas4", "meas4", 256, -0.5, 7.5)
    mytree["meas4"].Draw("area*1.e9>>myhist_meas4", "", "")

    ## Draw the first measurement
    myhist["meas1"].SetLineColor(2)
    ## Fit meas1
    fitopt = [0.4, 1.4]
    vEng[1], sFit[1], myfit[1] = AlphaSourceFitter().GausFitEngPeak(
        myhist["meas1"], "merged 20181108", fitopt, 1)
    ## Some drawing options for meas1
    myhist["meas1"].GetXaxis().SetTitle("Energy [V#timesns]")
    myhist["meas1"].GetYaxis().SetTitle("A.U.")
    #myhist["meas1"].GetYaxis().SetRangeUser(5.e-2,2.e6)     ##Used for LogY
    myhist["meas1"].GetYaxis().SetRangeUser(0, 3.e3)

    myhist["meas2"].Scale(myhist["meas1"].Integral() /
                          myhist["meas2"].Integral())
    myhist["meas2"].SetLineColor(4)
    myhist["meas2"].SetLineStyle(1)
    ## Some drawing options for meas2
    myhist["meas2"].GetXaxis().SetTitle("Energy [V#timesns]")
    #myhist["meas2"].GetYaxis().SetTitle("Events")
    myhist["meas2"].GetYaxis().SetTitle("A.U.")
    #myhist["meas2"].GetYaxis().SetRangeUser(5.e-2,2.e6)
Esempio n. 6
0
    myhist = {}
    myfit = {}
    valphys = {}
    valsyst = {}
    vEng = {}
    uncEng = {}
    sFit = {}
    uncFit = {}
    valphys = {}
    valsyst = {}
    runSyst = False
    mypedcut = 0.0
    if options.myPedCut:
        mypedcut = float(options.myPedCut)

    fitter_ = AlphaSourceFitter()
    GausFitEngPeak = fitter_.GausFitEngPeak
    TwoGausFitEngPeak = fitter_.TwoGausFitEngPeak

    ## Dark Current
    ## Random trigger 43 ms
    myfile["DC_AT43ms_1"] = TFile(
        "root/AlphaSource/DarkCurrent_AutoTrig43ms_20160816.root")
    mytree["DC_AT43ms_1"] = myfile["DC_AT43ms_1"].Get("tree")

    myfile["DC_AT43ms_2"] = TFile(
        "root/AlphaSource/DarkCurrent_AutoTrig43ms_20160817.root")
    mytree["DC_AT43ms_2"] = myfile["DC_AT43ms_2"].Get("tree")

    ## Dark Current
    ## Random trigger 60 ms