14 This module is used
for the SVD validation.
15 It gets information about truehits
and clusters, 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
30gROOT.ProcessLine(
'struct EventDataSimhit {\
41from ROOT
import EventDataSimhit
45 '''class to create sim hit ttree'''
48 """Initialize the module"""
52 self.
file = ROOT.TFile(
'../SVDValidationTTreeSimhit.root',
'recreate')
54 self.
tree = ROOT.TTree(
'tree',
'Event data of SVD validation events')
56 self.
data = EventDataSimhit()
59 for key
in EventDataSimhit.__dict__:
62 if isinstance(self.
data.__getattribute__(key), int):
64 self.
tree.Branch(key, addressof(self.
data, key), key + formstring)
67 """Find simhits with a truehit and save needed information"""
72 for truehit
in svd_truehits:
73 simhits = truehit.getRelationsTo(
'SVDSimHits')
74 for simhit
in simhits:
76 sensorID = simhit.getSensorID()
77 self.
data.sensor_id = int(sensorID)
78 sensorNum = sensorID.getSensorNumber()
79 self.
data.sensor = sensorNum
80 layerNum = sensorID.getLayerNumber()
81 self.
data.layer = layerNum
82 ladderNum = sensorID.getLadderNumber()
83 self.
data.ladder = ladderNum
91 self.
data.sensor_type = sensorType
94 particle = simhit.getRelatedFrom(
'MCParticles')
95 if not particle.hasStatus(Belle2.MCParticle.c_PrimaryParticle):
98 length = (simhit.getPosOut() - simhit.getPosIn()).R()
101 energy = simhit.getElectrons() * Belle2.Const.ehEnergy
102 self.
data.simhit_length = length
103 self.
data.simhit_energy = energy
106 self.
data.simhit_dEdx = energy / length
116 """Close the output file. """
A (simplified) python wrapper for StoreArray.
data
instance of eventDataSimhit