Timestamps calculated in MAGICEventSource/MarsRun
Currently, the timestamps in MAGICEventSource are calculated as follows:
event_mjd = event_times[b'MTime.fMjd']
event_millisec = event_times[b'MTime.fTime.fMilliSec']
event_nanosec = event_times[b'MTime.fNanoSec']
event_mjd = event_mjd + (event_millisec / 1e3 + event_nanosec / 1e9) / seconds_per_day
event_data['MJD'] = scipy.concatenate((event_data['MJD'], event_mjd))
So the timestamps are calculated in units of "day" (Modified Julian Day, MJD).
When I try to find the coincident events between MAGIC and LST1, I prefer to use the timestamps in unit of "sec" counted since the start of each day.
So in order to get such kind of format, I need to do the following calculation:
timestamp_reco = (event_mjd - int(event_mjd)) * day2sec [sec] (day2sec = 60x60x24)
Then, I compared the value with the one that I simply reconstructed as follows:
timestamp_true = event_millisec * millisec2sec + event_nanosec * nanosec2sec
(millisec2sec = 1e-3, nanosec2sec = 1e-9)
Then, sometimes I saw the following values, for example:
case1:
timestamp_reco = 82314.38639627304 [sec]
timestamp_true = 82314.3863962 [sec]
case2:
timestamps_reco = 82314.39802993555 [sec]
timestamps_true = 82314.3980302 [sec]
In case of 1, it is ok if I discard the order below 100 ns.
However, in case of 2, even the order of 100 ns is different, and it may affect the coincidence algorithm because the coincidence window is ~ 1 µs order.
Actually, this is my concern and why I would like to change the timestamp calculation in MAGICEventSource.
This problem seems to be related with the accuracy of the float..? I don't know.
So my proposal of changes is,
1. simply store the mjd, millisec and nanosec parameters separately in MarsRun object
2. change the get_stereo_event_data function to extract these parameters
Actually, what I would like to do is to avoid using the mjd unit as the timestamps.
I would like to change the above things in dev-yoshiki branch and will do the merge-request. It would be appreciated if you gave me some comments or suggestions on this.
Best regards,
Yoshiki