49 ccross_t0_E = df.hit_max_time_p2_tpcE - tcathode_EE
50 ccross_t0_E[df.cryostat==1] = df.hit_max_time_p2_tpcE - tcathode_WE
52 ccross_t0_W = df.hit_max_time_p2_tpcW - tcathode_EW
53 ccross_t0_W[df.cryostat==1] = df.hit_max_time_p2_tpcW - tcathode_WW
56 select_track = df.selected == 1
58 df[
"ccross_t0"] = ((ccross_t0_E + ccross_t0_W) / 2.) * tick_period
59 df[
"tpcE"] =
isTPCE(df.hits2.h)
62 outdf = df.loc[(df.hits2.dqdx > 0) & select_track,
63 [ (
"hits2",
"h",
"time"),
64 (
"hits2",
"h",
"wire"),
66 (
"hits2",
"dqdx",
""),
67 (
"hits2",
"pitch",
""),
68 (
"ccross_t0",
"",
""),
75 outdf.columns = [
"time",
"wire",
"tpcE",
"dqdx_nocorr",
"width",
"ccross_t0",
"run",
"cryostat"]
78 outdf[
"thit"] = (outdf.time * tick_period - outdf.ccross_t0 - tanode*tick_period) / 1000.
80 thisrun = outdf.run.iloc[0]
82 outdf[
"dqdx_corr"] = outdf.dqdx_nocorr *
exp(outdf.thit, 1., -run_etaus[thisrun][0]*1e3)
83 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)]
84 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)]
85 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)]