diff --git a/orcasong_plag/core.py b/orcasong_plag/core.py index 2f8275aef8d7a09706490bfee24b346a321fffd1..fd0d4f59c42273076d675ed10627d791ad1919c7 100644 --- a/orcasong_plag/core.py +++ b/orcasong_plag/core.py @@ -28,8 +28,9 @@ class FileBinner: n_memory_observer : int, optional Print memory usage every n blobs. do_time_preproc : bool - Do time preprocessing, i.e. add t0 to real data, subtract time + Do time preprocessing, i.e. add t0 only to real data, and subtract time of first triggered hit. + Will also be done for McHits if they are in the blob. chunksize : int Chunksize (along axis_0) used for saving the output to a .h5 file. complib : str diff --git a/orcasong_plag/mc_info_types.py b/orcasong_plag/mc_info_types.py index 7385f8536b3e33e63738cd4263a4cbfa030c90e0..adcd6fe4934d1cce45181faeb81b12770a38a660 100644 --- a/orcasong_plag/mc_info_types.py +++ b/orcasong_plag/mc_info_types.py @@ -20,12 +20,28 @@ def get_mc_info_extr(mc_info_extr): if mc_info_extr == "mupage": mc_info_extr = get_mupage_mc + elif mc_info_extr == "event_and_run_id": + mc_info_extr = get_event_and_run_id + else: raise ValueError("Unknown mc_info_type " + mc_info_extr) return mc_info_extr +def get_event_and_run_id(blob): + """ + Get event id and run id from event info. + E.g. for the 2017 one line real data. + """ + event_id = blob['EventInfo'].event_id[0] + run_id = blob["EventInfo"].run_id + + track = {'event_id': event_id, + 'run_id': run_id, } + return track + + def get_mupage_mc(blob): """ For mupage muon simulations. diff --git a/orcasong_plag/modules.py b/orcasong_plag/modules.py index bf089f0d5f203b8031cadf576ee5c25fc2ca7ba3..6361aa731bd4a609acb3d11ea547475bbb8797a4 100644 --- a/orcasong_plag/modules.py +++ b/orcasong_plag/modules.py @@ -43,20 +43,12 @@ class TimePreproc(kp.Module): Time hits and mchits will be shifted by the time of the first triggered hit. - Attributes - ---------- - correct_hits : bool - If true, will correct time of the hits. - correct_mchits : bool - If true, will correct the time of the McHits. - """ - def configure(self): - self.correct_hits = self.get('correct_hits', default=True) - self.correct_mchits = self.get('correct_mchits', default=True) - def process(self, blob): - blob = time_preproc(blob, self.correct_hits, self.correct_mchits) + correct_mchits = "McHits" in blob + blob = time_preproc(blob, + correct_hits=True, + correct_mchits=correct_mchits) return blob