4 from lib
import branches
11 tcathode_EE = 3198.5279397664003
12 tcathode_EW = 3207.147982327826
13 tcathode_WE = 3200.883742841676
14 tcathode_WW = 3199.9763136348492
18 with
open(
"/icarus/app/users/gputnam/calib/rundata")
as f:
21 run_times[int(dat[0])] = dt.datetime.strptime(dat[1].rstrip(
"\n"),
"%Y-%m-%dT%H:%M:%S").date()
25 with
open(
"/icarus/app/users/gputnam/calib/plots2/etau_run_data.txt")
as f:
29 run_etaus[int(dat[0])] = [float(d)
for d
in dat[1:]]
32 "h.time",
"h.width",
"h.tpc",
"h.wire",
"dqdx",
"pitch",
35 plane2branches = [
"hits2.%s" % s
for s
in plane2branches]
41 return A*np.exp(-(t - t0)/tau)
48 ccross_t0_E = df.hit_max_time_p2_tpcE - tcathode_EE
49 ccross_t0_E[df.cryostat==1] = df.hit_max_time_p2_tpcE - tcathode_WE
51 ccross_t0_W = df.hit_max_time_p2_tpcW - tcathode_EW
52 ccross_t0_W[df.cryostat==1] = df.hit_max_time_p2_tpcW - tcathode_WW
55 select_track = df.selected == 1
57 df[
"ccross_t0"] = ((ccross_t0_E + ccross_t0_W) / 2.) * tick_period
58 df[
"tpcE"] =
isTPCE(df.hits2.h)
61 outdf = df.loc[(df.hits2.dqdx > 0) & select_track,
62 [ (
"hits2",
"h",
"time"),
63 (
"hits2",
"h",
"wire"),
65 (
"hits2",
"dqdx",
""),
66 (
"hits2",
"pitch",
""),
67 (
"ccross_t0",
"",
""),
74 outdf.columns = [
"time",
"wire",
"tpcE",
"dqdx_nocorr",
"width",
"ccross_t0",
"run",
"cryostat"]
77 outdf[
"thit"] = (outdf.time * tick_period - outdf.ccross_t0 - tanode*tick_period) / 1000.
79 thisrun = outdf.run.iloc[0]
81 outdf[
"dqdx_corr"] = outdf.dqdx_nocorr *
exp(outdf.thit, 1., -run_etaus[thisrun][0]*1e3)
82 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)]
83 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)]
84 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)]
89 ntuples =
NTupleGlob(inputs, branches.trkbranches + plane2branches)
90 df = ntuples.dataframe(nproc=
"auto", f=reduce_df)
91 df.to_hdf(output, key=
"df", mode=
"w")
93 if __name__ ==
"__main__":
94 printhelp = len(sys.argv) < 3
or sys.argv[1] ==
"-h"
96 print(
"Usage: python make_equalibriate_df.py [output.df] [inputs.root,]")
98 main(sys.argv[1], sys.argv[2:])
do one_file $F done echo for F in find $TOP name CMakeLists txt print
open(RACETRACK) or die("Could not open file $RACETRACK for writing")