FairShip
Loading...
Searching...
No Matches
SBTDetector.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
10 self,
11 name,
12 intree,
13 branchName=None,
14 mcBranchType=None,
15 mcBranchName: str = "digiSBT2MC",
16 outtree=None,
17 ) -> None:
18 super().__init__(
19 name,
20 intree,
21 branchName,
22 mcBranchType,
23 mcBranchName,
24 outtree=outtree,
25 )
26
27 def digitize(self) -> None:
28 """Digitize Surrounding Background Tagger MC hits.
29
30 TDC defined as the time of the first MC hit in the cell.
31 Eloss defined as the cumulative energy deposition of MC hits in the cell.
32
33 """
34 ElossPerDetId = {}
35 tOfFlight = {}
36 listOfVetoPoints = {}
37 key = -1
38 for aMCPoint in self.intree.vetoPoint:
39 key += 1
40 detID = aMCPoint.GetDetectorID()
41 Eloss = aMCPoint.GetEnergyLoss()
42 if detID not in ElossPerDetId:
43 ElossPerDetId[detID] = 0
44 listOfVetoPoints[detID] = []
45 tOfFlight[detID] = []
46 ElossPerDetId[detID] += Eloss
47 listOfVetoPoints[detID].append(key)
48 tOfFlight[detID].append(aMCPoint.GetTime())
49 for seg in ElossPerDetId:
50 aHit = ROOT.vetoHit(seg, ElossPerDetId[seg])
51 aHit.SetTDC(min(tOfFlight[seg]) + self.intree.t0)
52 if ElossPerDetId[seg] < 0.045:
53 aHit.setInvalid() # threshold for liquid scintillator, source Berlin group
54 self.det.push_back(aHit)
55 v = ROOT.std.vector("int")()
56 for x in listOfVetoPoints[seg]:
57 v.push_back(x)
58 self.MCdet.push_back(v)
None __init__(self, name, intree, branchName=None, mcBranchType=None, str mcBranchName="digiSBT2MC", outtree=None)
Definition: SBTDetector.py:17