14 This module is used
for the SVD validation.
15 It gets information about RecoDigits, saving
16 in a ttree
in a ROOT file.
18 <noexecute>SVD validation helper
class</noexecute>
26from ROOT import Belle2
27from ROOT import gROOT, addressof
29# Define a ROOT struct to hold output data in the TTree
30gROOT.ProcessLine('struct EventDataRecoDigit {\
37 float recodigit_charge;\
38 float recodigit_time;\
41from ROOT
import EventDataRecoDigit
45 '''class to create reco digitis ttree'''
48 """Initialize the module"""
52 self.
file = ROOT.TFile(
'../SVDValidationTTreeRecoDigit.root',
'recreate')
54 self.
tree = ROOT.TTree(
'tree',
'Event data of SVD validation events')
56 self.
data = EventDataRecoDigit()
59 for key
in EventDataRecoDigit.__dict__:
62 if isinstance(self.
data.__getattribute__(key), int):
64 self.
tree.Branch(key, addressof(self.
data, key), key + formstring)
67 """Take digits from SVDRecoDigits with at least one truehit and save needed information"""
74 digit_truehits = shaperDigits[digit.getArrayIndex()].getRelationsTo(
'SVDTrueHits')
76 if len(digit_truehits) == 0:
83 for i, trueHit
in enumerate(digit_truehits):
84 if trueHit.getEnergyDep() > energy:
85 energy = trueHit.getEnergyDep()
87 bestTrueHit = digit_truehits[bestTrueHitIndex]
90 sensorID = digit.getSensorID()
91 self.
data.sensor_id = int(sensorID)
92 sensorNum = sensorID.getSensorNumber()
93 self.
data.sensor = sensorNum
94 layerNum = sensorID.getLayerNumber()
95 self.
data.layer = layerNum
103 self.
data.sensor_type = sensorType
104 ladderNum = sensorID.getLadderNumber()
105 self.
data.ladder = ladderNum
107 self.
data.strip_dir = 0
109 self.
data.strip_dir = 1
110 self.
data.recodigit_charge = digit.getCharge()
111 self.
data.recodigit_time = digit.getTime()
112 self.
data.truehit_time = bestTrueHit.getGlobalTime()
118 """Close the output file. """
A (simplified) python wrapper for StoreArray.
data
instance of event data class