Skip to content
Snippets Groups Projects
Commit 7ec5b1c3 authored by Stefan Reck's avatar Stefan Reck
Browse files

Added mc info extractor for real data, time gets corrected for

McHits automatically if McHits are in blob.
parent 9e20d808
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -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.
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment