kp.calib.Calibration incorrectly adds t0 to McHits time
Environment
- KM3Pipe version (
km3pipe --version
): '9.0.0b5' - Python version (
python --version
): 3.6.8
Additional information
When using kp.calib.Calibration to calibrate McHits, t0 gets added even though it should not.
I converted a mupage root file using h5extract
(this is not relevant for this issue).
Then, in this dir /sps/km3net/users/sreck/storage/four_line/prod1/mupage/v5.40_km3/temp
, I build a pipeline to calibrate the blob and print hits.time and mchits.time:
import km3pipe as kp
import km3modules as km
h5_file = "mcv5.40.mupage_10G.km3_AAv1.jterbr00005782.jorcarec.aanet.837.root.h5"
detx_file = "KM3NeT_00000044_00005782.v5.4_PMTeff.K40_muonCalibration_shift00.detx"
pump = kp.io.HDF5Pump(filename=h5_file)
calib = kp.calib.Calibration(filename=detx_file)
mc_time_cor = km.mc.MCTimeCorrector()
blob = next(pump)
blob = mc_time_cor.process(blob)
calib_hits = calib.apply(blob["Hits"])
calib_mchits = calib.apply(blob["McHits"])
mean_time = calib_hits.time.mean()
print("Hits time:\n", (calib_hits.time - mean_time)[:10])
print("McHits time:\n", (calib_mchits.time - mean_time)[:10])
print("McHits time - t0:\n", (calib_mchits.time - calib_mchits.t0 - mean_time)[:10])
Which gives this output:
Hits time:
[-318.7426111 194.7713889 264.13038892 42.2343889 363.69238892
-116.55261108 14.88638891 -71.0846111 -117.23061109 -114.21161109]
McHits time:
[207810.02096483 207819.43096727 207839.37696606 207837.84097399
207864.469974 207899.76296544 207900.88297582 207898.76397461
207941.65597826 207943.20996971]
McHits time - t0:
[-117.25603516 -156.56603272 -191.53603394 -191.60602601 -220.35602601
-237.39603455 -236.27602418 -235.7460254 -248.83602174 -247.62603028]
So mchit times as they come out of calib.apply are wrong, as they are nowhere close to the real hit times. If I subtract t0 again, they are right.
--> t0 should not be added to mchits when calib.apply is run.
I also wonder if the functionality of km.mc.MCTimeCorrector should be a part of kp.calib.Calibration, since the times of McHits and Hits are not comparable without it (i.e. one could see it as a part of the calibration).