Example #1
0
 pedopt,pedcov,pedxdata,pedydata,pedyunc = GainFinder.FitPedestal(
         thehist, init_params["PedParams"],init_params["PedFitRange"],
         fit_tail = FIT_TAIL, exp_fit_range = exp_fit_range)
 if pedopt is None:
     print("PEDESTAL FIT FULLY FAILED... LIKELY A BUNK CHANNEL.  SKIPPING")
     PedFitComplete = True
     GoodPedFit = False
     FitComplete = True
     GoodFit = False
     continue
 pl.PlotPedestal(pedxdata,pedydata,fu.gauss1,pedxdata,pedopt,"GaussPlusExpo")
 above_ped = 0
 past_ped = np.where(pedxdata > (pedopt[1] + 3*pedopt[2]))[0]
 if FIT_TAIL:
     plt.plot(pedxdata[past_ped],pedydata[past_ped])
     plt.plot(pedxdata[past_ped],fu.expo(pedxdata[past_ped],pedopt[3],
                        pedopt[4],pedopt[5]))
     above_ped = np.sum(pedydata[past_ped] - fu.expo(pedxdata[past_ped],pedopt[3],
                        pedopt[4],pedopt[5]))
 else:
     above_ped = np.sum(pedydata[past_ped] - fu.gauss1(pedxdata[past_ped],pedopt[0],
                       pedopt[1],pedopt[2]))
 plt.show()
 print("4SIGMA PAST PED, EXP. SUBTRACTED: " + str(above_ped))
 if (above_ped < 300):
     print("Low statistics beyond pedestal!  May just be fitting on fluctuations.")
     skip_fit = str(raw_input("Skip this fit?"))
     if skip_fit in ["y","Y","yes","Yes","YES"]:
         PedFitComplete = True
         GoodPedFit = False
         FitComplete = True
         GoodFit = False
Example #2
0
        if ped_opt is None:   #TODO:what if no pedestal?
          print(" > PEDESTAL FIT FAILED... BAD PMT?  SKIPPING")
          PedFitComplete = True
          GoodPedFit = False
          FitComplete = True
          GoodFit = False
          continue

        pl.PlotPedestal(ped_xdata, ped_ydata, fn.gauss1, ped_xdata, ped_opt, "GaussPlusExpo")

        above_ped = 0
        past_ped = np.where(ped_xdata > (ped_opt[1] + 3.*ped_opt[2]))[0]

        if FIT_TAIL:
          plt.plot(ped_xdata[past_ped], ped_ydata[past_ped])
          plt.plot(ped_xdata[past_ped], fn.expo(ped_xdata[past_ped], ped_opt[3], ped_opt[4], ped_opt[5]))
          above_ped = np.sum(ped_ydata[past_ped] - fn.expo(ped_xdata[past_ped], ped_opt[3], ped_opt[4], ped_opt[5]))
        else:
          above_ped = np.sum(ped_ydata[past_ped] - fn.gauss1(ped_xdata[past_ped], ped_opt[0], ped_opt[1], ped_opt[2]))
        plt.show()
        print(" > 4SIGMA PAST PED, EXP. SUBTRACTED: " + str(above_ped))
        if (above_ped < 300):
          print("Low statistics beyond pedestal! May just be fitting on fluctuations.")
          skip_fit = str(input("Skip this fit?"))
          if (skip_fit in ["y", "Y", "yes", "Yes", "YES", "yEs"]):
            PedFitComplete = True
            GoodPedFit = False
            FitComplete = True
            GoodFit = False
            continue