6 <contact> SVD Software Group, svd-software@belle2.org </contact>
8 This module is used for the SVD validation.
9 It gets information about ShaperDigits and RecoDigits, saving
10 in a ttree in a ROOT file.
21 from ROOT
import Belle2
22 from ROOT
import gROOT, AddressOf
23 from ROOT
import PyConfig
24 from ROOT
import TVector3
27 gROOT.ProcessLine(
'struct EventDataRecoDigit {\
34 float recodigit_time;\
38 from ROOT
import EventDataRecoDigit
42 '''class to create reco digitis ttree'''
45 """Initialize the module"""
47 super(SVDValidationTTreeRecoDigit, self).
__init__()
48 self.
file = ROOT.TFile(
'../SVDValidationTTreeRecoDigit.root',
'recreate')
49 '''Output ROOT file'''
50 self.
tree = ROOT.TTree(
'tree',
'Event data of SVD validation events')
51 '''TTrees for output data'''
52 self.
data = EventDataRecoDigit()
53 '''Instance of the EventData class'''
56 for key
in EventDataRecoDigit.__dict__:
59 if isinstance(self.
data.__getattribute__(key), int):
61 self.
tree.Branch(key, AddressOf(self.
data, key), key + formstring)
64 """Take digits from SVDRecoDigits with a truehit and save needed information"""
67 digit_truehits = digit.getRelationsTo(
'SVDTrueHits')
69 if len(digit_truehits) != 1:
71 for truehit
in digit_truehits:
73 sensorID = digit.getSensorID()
74 self.
data.sensor_id = int(sensorID)
75 sensorNum = sensorID.getSensorNumber()
76 self.
data.sensor = sensorNum
77 layerNum = sensorID.getLayerNumber()
78 self.
data.layer = layerNum
86 self.
data.sensor_type = sensorType
87 ladderNum = sensorID.getLadderNumber()
88 self.
data.ladder = ladderNum
90 self.
data.strip_dir = 0
92 self.
data.strip_dir = 1
93 self.
data.recodigit_time = digit.getTime()
94 self.
data.truehit_time = truehit.getGlobalTime()
100 """Close the output file. """