15 This module is used for the SVD validation.
16 It gets information about RecoDigits, saving
17 in a ttree in a ROOT file.
19 <noexecute>SVD validation helper class</noexecute>
27 from ROOT
import Belle2
28 from ROOT
import gROOT, addressof
31 gROOT.ProcessLine(
'struct EventDataRecoDigit {\
38 float recodigit_charge;\
39 float recodigit_time;\
43 from ROOT
import EventDataRecoDigit
47 '''class to create reco digitis ttree'''
50 """Initialize the module"""
52 super(SVDValidationTTreeRecoDigit, self).
__init__()
54 self.
filefile = ROOT.TFile(
'../SVDValidationTTreeRecoDigit.root',
'recreate')
56 self.
treetree = ROOT.TTree(
'tree',
'Event data of SVD validation events')
58 self.
datadata = EventDataRecoDigit()
61 for key
in EventDataRecoDigit.__dict__:
64 if isinstance(self.
datadata.__getattribute__(key), int):
66 self.
treetree.Branch(key, addressof(self.
datadata, key), key + formstring)
69 """Take digits from SVDRecoDigits with at least one truehit and save needed information"""
76 digit_truehits = shaperDigits[digit.getArrayIndex()].getRelationsTo(
'SVDTrueHits')
78 if len(digit_truehits) == 0:
85 for i, trueHit
in enumerate(digit_truehits):
86 if trueHit.getEnergyDep() > energy:
87 energy = trueHit.getEnergyDep()
89 bestTrueHit = digit_truehits[bestTrueHitIndex]
92 sensorID = digit.getSensorID()
93 self.
datadata.sensor_id = int(sensorID)
94 sensorNum = sensorID.getSensorNumber()
95 self.
datadata.sensor = sensorNum
96 layerNum = sensorID.getLayerNumber()
97 self.
datadata.layer = layerNum
105 self.
datadata.sensor_type = sensorType
106 ladderNum = sensorID.getLadderNumber()
107 self.
datadata.ladder = ladderNum
109 self.
datadata.strip_dir = 0
111 self.
datadata.strip_dir = 1
112 self.
datadata.recodigit_charge = digit.getCharge()
113 self.
datadata.recodigit_time = digit.getTime()
114 self.
datadata.truehit_time = bestTrueHit.getGlobalTime()
120 """Close the output file. """
122 self.
filefile.Write()
123 self.
filefile.Close()
A (simplified) python wrapper for StoreArray.
data
instance of event data class