FairShip
Loading...
Searching...
No Matches
SiliconTargetDetector.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
4from collections import defaultdict
5
6import ROOT
7from BaseDetector import BaseDetector
8
9
11 def __init__(self, name, intree, branchName=None, outtree=None) -> None:
12 super().__init__(name, intree, branchName, outtree=outtree)
13
14 def digitize(self) -> None:
15 """Group SiliconTargetPoints by detector ID and build one SiliconTargetHit per ID."""
16 pointsByDetID = defaultdict(list)
17 for point in self.intree.SiliconTargetPoint:
18 pointsByDetID[point.GetDetectorID()].append(point)
19
20 for detID, pts in pointsByDetID.items():
21 allPoints = ROOT.std.vector("SiliconTargetPoint*")()
22 for p in pts:
23 allPoints.push_back(p)
24 det_hit = ROOT.SiliconTargetHit(detID, allPoints)
25 self.det.push_back(det_hit)
None __init__(self, name, intree, branchName=None, outtree=None)