53 ccross_t0_E = df.hit_max_time_p2_tpcE - tcathode_EE
54 ccross_t0_E[df.cryostat==1] = df.hit_max_time_p2_tpcE - tcathode_WE
56 ccross_t0_W = df.hit_max_time_p2_tpcW - tcathode_EW
57 ccross_t0_W[df.cryostat==1] = df.hit_max_time_p2_tpcW - tcathode_WW
60 select_track = df.selected == 0
62 df[
"ccross_t0"] = ((ccross_t0_E + ccross_t0_W) / 2.) * tick_period
63 df[
"tpcE"] =
isTPCE(df.hits2.h)
66 outdf = df.loc[(df.hits2.dqdx > 0) & (df.hits2.rr < 200.) & select_track,
67 [ (
"hits2",
"h",
"time"),
69 (
"hits2",
"dqdx",
""),
70 (
"hits2",
"pitch",
""),
72 (
"hits2",
"dir",
"x"),
73 (
"hits2",
"h",
"width"),
74 (
"ccross_t0",
"",
""),
78 (
"hit_min_time_p2_tpcE",
"",
""),
79 (
"hit_max_time_p2_tpcE",
"",
""),
80 (
"hit_min_time_p2_tpcW",
"",
""),
81 (
"hit_max_time_p2_tpcW",
"",
""),
86 outdf.columns = [
"time",
"tpcE",
"dqdx_nocorr",
"pitch",
"rr",
"dir_x",
"width",
"ccross_t0",
"run",
"cryostat",
"tdir_y",
"mint_tpcE",
"maxt_tpcE",
"mint_tpcW",
"maxt_tpcW"]
89 outdf[
"thit"] = (outdf.time * tick_period - outdf.ccross_t0 - tanode*tick_period) / 1000.
91 thisrun = outdf.run.iloc[0]
93 outdf[
"dqdx_corr"] = outdf.dqdx_nocorr *
exp(outdf.thit, 1., -run_etaus[thisrun][0]*1e3)
94 outdf.loc[~outdf.tpcE & (outdf.cryostat==0),
"dqdx_corr"] = (outdf.dqdx_nocorr *
exp(outdf.thit, 1., -run_etaus[thisrun][1]*1e3))[~outdf.tpcE & (outdf.cryostat==0)]
95 outdf.loc[outdf.tpcE & (outdf.cryostat==1),
"dqdx_corr"] = (outdf.dqdx_nocorr *
exp(outdf.thit, 1., -run_etaus[thisrun][2]*1e3))[outdf.tpcE & (outdf.cryostat==1)]
96 outdf.loc[~outdf.tpcE & (outdf.cryostat==1),
"dqdx_corr"] = (outdf.dqdx_nocorr *
exp(outdf.thit, 1., -run_etaus[thisrun][3]*1e3))[~outdf.tpcE & (outdf.cryostat==1)]
100 closest_tdaughter = raydf.groupby(level=0).daughter_sp_toend_dist.min()
101 outdf = outdf.join(closest_tdaughter.rename(
"closest_tdaughter"), on=
"entry", how=
"left")