예제 #1
0
def phsp_goofit(flat_ltime=False):
    import root_pandas
    # path = 'root://eoslhcb.cern.ch//eos/lhcb/user/d/dmuller/K3Pi/RS_with_weight.root'
    path = 'root://eoslhcb.cern.ch//eos/lhcb/user/d/dmuller/K3Pi/phsp_mc.root'
    df = root_pandas.read_root(path, 'events', stop=15000000)
    df.rename(columns={
        'c12': vars.cos1(),
        'c34': vars.cos2(),
        'dtime': vars.ltime(mode_config.D0),
        'phi': vars.phi1(),
        'm12': vars.m12(),
        'm34': vars.m34()
    },
              inplace=True)
    df[vars.m12()] = df[vars.m12()] * 1000.
    df[vars.m34()] = df[vars.m34()] * 1000.
    if flat_ltime:
        df['D0_Loki_BPVLTIME'] = np.random.uniform(0.0001725,
                                                   0.00326,
                                                   size=df.index.size)
    else:
        df['D0_Loki_BPVLTIME'] = two_parts_generate(turn=0.55,
                                                    size=df.index.size) / 1000.

    return df
예제 #2
0
def phsp_goofit_alt():
    import root_pandas
    path = 'root://eoslhcb.cern.ch//eos/lhcb/user/d/dmuller/K3Pi/RS_with_weight_dtime.root'
    df = root_pandas.read_root(path, 'events')
    df.rename(columns={
        'c12': vars.cos1(),
        'c34': vars.cos2(),
        'dtime': vars.ltime(mode_config.D0),
        'phi': vars.phi1(),
        'm12': vars.m12(),
        'm34': vars.m34()
    },
              inplace=True)
    df[vars.m12()] = df[vars.m12()] * 1000.
    df[vars.m34()] = df[vars.m34()] * 1000.
    df['D0_Loki_BPVLTIME'] = df['D0_Loki_BPVLTIME'] / 1000.

    return df
예제 #3
0
def get_model_ws_alt(redo=False):
    files = [
        '/afs/cern.ch/user/c/chasse/public/forDominik/Sig_49_61_WSNR_Smaller.root'
    ]  # NOQA

    bcolz_folder = config.bcolz_locations.format('generated_model_ws_alt')
    if redo:
        try:
            shutil.rmtree(bcolz_folder)
        except:
            pass
        helpers.allow_root()
        import root_pandas
        df = root_pandas.read_root(files, 'events')
        # Now rename stuff and fix units to MeV and ns.
        # Ugly hardcoded for now.
        df.rename(columns={
            'c12': vars.cos1(),
            'c34': vars.cos2(),
            'dtime': vars.ltime(mode_config.D0),
            'phi': vars.phi1(),
            'm12': vars.m12(),
            'm34': vars.m34()
        },
                  inplace=True)
        df[vars.m12()] = df[vars.m12()] * 1000.
        df[vars.m34()] = df[vars.m34()] * 1000.
        df[vars.ltime(mode_config.D0)] = df[vars.ltime(mode_config.D0)] / 1000.
        df = df.query('{} > 0.0001725'.format(vars.ltime(mode_config.D0)))
        df = df.query('{} < 0.003256'.format(vars.ltime(mode_config.D0)))
        bcolz.ctable.fromdataframe(df, rootdir=bcolz_folder)
        return df

    else:
        bc = bcolz.open(bcolz_folder)
        return bc.todataframe()

    return df
예제 #4
0
def get_model(redo=False):
    files = filelists.Generated.paths

    bcolz_folder = config.bcolz_locations.format('generated_model')
    if redo:
        try:
            shutil.rmtree(bcolz_folder)
        except:
            pass
        helpers.allow_root()
        import root_pandas
        df = root_pandas.read_root(files, 'events')
        # Now rename stuff and fix units to MeV and ns.
        # Ugly hardcoded for now.
        df.rename(columns={
            'c12': vars.cos1(),
            'c34': vars.cos2(),
            'dtime': vars.ltime(mode_config.D0),
            'phi': vars.phi1(),
            'm12': vars.m12(),
            'm34': vars.m34()
        },
                  inplace=True)
        df[vars.m12()] = df[vars.m12()] * 1000.
        df[vars.m34()] = df[vars.m34()] * 1000.
        df[vars.ltime(mode_config.D0)] = df[vars.ltime(mode_config.D0)] / 1000.
        df = df.query('{} > 0.0001725'.format(vars.ltime(mode_config.D0)))
        df = df.query('{} < 0.003256'.format(vars.ltime(mode_config.D0)))
        bcolz.ctable.fromdataframe(df, rootdir=bcolz_folder)
        return df

    else:
        bc = bcolz.open(bcolz_folder)
        return bc.todataframe()

    return df