Пример #1
0
def clarice(run_number,
            input_filenames,
            output_filename,
            read_fun=hpfun.get_pmaps_gd):

    # initalize
    correction_filename = f"$IC_DATA/maps/kr_corrections_run{run_number}.h5"
    correction_filename = os.path.expandvars(correction_filename)
    calibrate = corrections.Calibration(correction_filename, 'scale')

    datasipm = db.DataSiPM(run_number)
    sipms_xs, sipms_ys = datasipm.X.values, datasipm.Y.values

    ntotal, naccepted = 0, 0

    for file in input_filenames:
        print('processing ', file)
        try:
            pmaps = read_fun(file)
        except:
            continue

        dfevent, dfslice, _ = hpfun.create_event_dfs(pmaps, sipms_xs, sipms_ys,
                                                     calibrate)

        dfevent.to_hdf(output_filename, key='pkevent', append=True)
        dfslice.to_hdf(output_filename, key='pkslice', append=True)

        ntotal += len(set(pmaps.s1.event))
        naccepted += len(set(dfevent.event))
    f = 100. * naccepted / (1. * ntotal) if ntotal > 0 else 0.
    print('total events ', ntotal, ', accepted  ', naccepted, 'fraction (%)',
          f)
Пример #2
0
def tools(correction_filename, run_number):

    calibrate = corrections.Calibration(correction_filename, 'scale')
    datasipm = db.DataSiPM(run_number)
    xpos, ypos = datasipm.X.values, datasipm.Y.values

    return calibrate, xpos, ypos
Пример #3
0
def tools(correction_filename, run_number):

    calibrate = corrections.Calibration(correction_filename, 'scale')

    return calibrate