def selectdfrunlist(dfr, runlist, runvar):
    """
    Select smaller runlist on dataframe
    """
    if runlist is not None:
        isgoodrun = select_runs(runlist, dfr[runvar].values)
        dfr = dfr[np.array(isgoodrun, dtype=bool)]
    return dfr
def selectdfrunlist(dfr, runlist, runvar):
    """
    Select smaller runlist on dataframe
    """
    if runlist is not None:
        runlist_np = np.asarray(runlist)
        array_run_np = np.asarray(dfr[runvar].values)
        issel = select_runs(runlist_np, array_run_np)
        dfr = dfr[issel]
    return dfr
def skimmer(filein, filevt, fileout, skimming_sel, var_evt_match, param_case,
            presel_reco, sel_cent, skimming2_dotrackpid, runlist):
    df = pickle.load(open(filein, "rb"))
    dfevt = pickle.load(open(filevt, "rb"))
    if "Evt" not in filein:
        df = pd.merge(df, dfevt, on=var_evt_match)
    if skimming_sel is not None:
        df = df.query(skimming_sel)
    if runlist is not None:
        array_run = df.run_number.values
        isgoodrun = select_runs(runlist, array_run)
        df = df[np.array(isgoodrun, dtype=bool)]
    if "Reco" in filein:
        if skimming2_dotrackpid is True:
            df = filter_df_cand(df, param_case, 'presel_track_pid')
        if presel_reco is not None:
            df = df.query(presel_reco)
        array_pt = df.pt_cand.values
        array_y = df.y_cand.values
        isselacc = selectfidacc(array_pt, array_y)
        df = df[np.array(isselacc, dtype=bool)]
    if sel_cent is not None:
        df = df.query(sel_cent)
    df.to_pickle(fileout)
Exemple #4
0
def selectdfrunlist(dfr, runlist, runvar):
    if runlist is not None:
        isgoodrun = select_runs(runlist, dfr[runvar].values)
        dfr = dfr[np.array(isgoodrun, dtype=bool)]
    return dfr