FairShip
Loading...
Searching...
No Matches
timeDetector.py
Go to the documentation of this file.
1# SPDX-License-Identifier: LGPL-3.0-or-later
2# SPDX-FileCopyrightText: Copyright CERN for the benefit of the SHiP Collaboration
3
4import ROOT
5from BaseDetector import BaseDetector
6
7
9 def __init__(self, name, intree, outtree=None) -> None:
10 super().__init__(name, intree, outtree=outtree)
11
12 def digitize(self) -> None:
13 """Digitize timing detector MC hits.
14
15 The earliest hit per straw will be marked valid, all later ones invalid.
16 """
17 earliest_per_det_id = {}
18 for index, point in enumerate(self.intree.TimeDetPoint):
19 hit = ROOT.TimeDetHit(point, self.intree.t0)
20 self.det.push_back(hit)
21 detector_id = hit.GetDetectorID()
22 if hit.isValid():
23 if detector_id in earliest_per_det_id:
24 times = hit.GetMeasurements()
25 earliest = earliest_per_det_id[detector_id]
26 reference_times = self.det[earliest].GetMeasurements()
27 # this is not really correct, only first attempt
28 # case that one measurement only is earlier not taken into account
29 # SetTDC(Float_t val1, Float_t val2)
30 if reference_times[0] > times[0] or reference_times[1] > times[1]:
31 # second hit with smaller tdc
32 self.det[earliest].setInvalid()
33 earliest_per_det_id[detector_id] = index
34 else:
35 self.det[index].setInvalid()
36 else:
37 earliest_per_det_id[detector_id] = index
None __init__(self, name, intree, outtree=None)
Definition: timeDetector.py:9