15 This module is used for the SVD validation.
16 It gets information about truehits, saving in a ttree in a ROOT file.
18 <noexecute>SVD validation helper class</noexecute>
25 from ROOT
import Belle2
26 from ROOT
import gROOT, addressof
29 gROOT.ProcessLine(
'struct EventDataTrueHit {\
39 from ROOT
import EventDataTrueHit
43 '''class to create the true hit ttree'''
46 """Initialize the module"""
48 super(SVDValidationTTreeTrueHit, self).
__init__()
50 self.
filefile = ROOT.TFile(
'../SVDValidationTTreeTrueHit.root',
'recreate')
52 self.
treetree = ROOT.TTree(
'tree',
'Event data of SVD validation events')
54 self.
datadata = EventDataTrueHit()
57 for key
in EventDataTrueHit.__dict__:
60 if isinstance(self.
datadata.__getattribute__(key), int):
62 self.
treetree.Branch(key, addressof(self.
datadata, key), key + formstring)
65 """ Start with truehits and use the relation to get the corresponding clusters """
67 for truehit
in svdtruehits:
68 clusters = truehit.getRelationsFrom(
'SVDClusters')
70 if len(clusters) == 0:
71 self.
datadata.reconstructed = 0
73 sensorID = truehit.getSensorID()
74 self.
datadata.sensor_id = int(sensorID)
75 sensorNum = sensorID.getSensorNumber()
76 self.
datadata.sensor = sensorNum
77 layerNum = sensorID.getLayerNumber()
78 self.
datadata.layer = layerNum
86 self.
datadata.sensor_type = sensorType
87 ladderNum = sensorID.getLadderNumber()
88 self.
datadata.ladder = ladderNum
89 self.
datadata.strip_dir = -1
94 for cluster
in clusters:
95 self.
datadata.reconstructed = 1
97 sensorID = truehit.getSensorID()
98 self.
datadata.sensor_id = int(sensorID)
99 sensorNum = sensorID.getSensorNumber()
100 self.
datadata.sensor = sensorNum
101 layerNum = sensorID.getLayerNumber()
102 self.
datadata.layer = layerNum
110 self.
datadata.sensor_type = sensorType
111 ladderNum = sensorID.getLadderNumber()
112 self.
datadata.ladder = ladderNum
113 if cluster.isUCluster():
114 self.
datadata.strip_dir = 0
116 self.
datadata.strip_dir = 1
122 """Close the output file. """
124 self.
filefile.Write()
125 self.
filefile.Close()
A (simplified) python wrapper for StoreArray.
data
instance of EventDataTrueHit class