14 This module is used
for the SVD validation.
15 It gets information about digits, saving
16 in a ttree
in a ROOT file.
18 <noexecute>SVD validation helper
class</noexecute>
21import xml.etree.ElementTree as ET
27from ROOT import Belle2
28from ROOT
import gROOT, addressof
31gROOT.ProcessLine(
'struct EventDataStrip {\
42from ROOT
import EventDataStrip
46 '''class to create the strip ttree'''
49 """Initialize the module"""
53 self.
file = ROOT.TFile(
'../SVDValidationTTreeStrip.root',
'recreate')
55 self.
tree = ROOT.TTree(
'tree',
'Event data of SVD validation events')
57 self.
data = EventDataStrip()
60 for key
in EventDataStrip.__dict__:
63 if isinstance(self.
data.__getattribute__(key), int):
65 self.
tree.Branch(key, addressof(self.
data, key), key + formstring)
68 """Find digit with a cluster and save needed information"""
73 for sensor
in root.findall(
'Sensor'):
74 if sensor.get(
'type') ==
'Layer3':
75 if len(sensor.findall(
'Active')) == 1:
76 active = sensor.find(
'Active')
77 NoiseULayer3 = int(active.find(
'ElectronicNoiseU').text)
78 NoiseVLayer3 = int(active.find(
'ElectronicNoiseV').text)
79 for sensorbase
in root.iter(
'SensorBase'):
80 if sensorbase.get(
'type') ==
'Barrel':
81 active = sensorbase.find(
'Active')
82 NoiseUBarrel = int(active.find(
'ElectronicNoiseU').text)
83 NoiseVBarrel = int(active.find(
'ElectronicNoiseV').text)
84 elif sensorbase.get(
'type') ==
'Slanted':
85 active = sensorbase.find(
'Active')
86 NoiseUSlanted = int(active.find(
'ElectronicNoiseU').text)
87 NoiseVSlanted = int(active.find(
'ElectronicNoiseV').text)
92 for cluster
in clusters:
96 cluster_truehits = cluster.getRelationsTo(
'SVDTrueHits')
98 if len(cluster_truehits) != 1:
100 digits = cluster.getRelationsTo(
'SVDRecoDigits')
104 if digit.getCellID()
not in cls_strip_ids:
105 cls_strip_ids.append(digit.getCellID())
108 for strip_id
in cls_strip_ids:
112 if strip_id != digit.getCellID():
117 if (digit.getCharge() > strip_charge):
118 strip_charge = digit.getCharge()
121 sensorID = cluster.getSensorID()
122 self.
data.sensor_id = int(sensorID)
123 sensorNum = sensorID.getSensorNumber()
124 self.
data.sensor = sensorNum
125 layerNum = sensorID.getLayerNumber()
126 self.
data.layer = layerNum
134 self.
data.sensor_type = sensorType
135 ladderNum = sensorID.getLadderNumber()
136 self.
data.ladder = ladderNum
137 self.
data.strip_charge = strip_charge
146 noise = NoiseUSlanted
155 noise = NoiseVSlanted
158 self.
data.strip_dir = strip_dir
159 self.
data.strip_noise = noise
165 """Close the output file. """
static std::string findFile(const std::string &path, bool silent=false)
Search for given file or directory in local or central release directory, and return absolute path if...
A (simplified) python wrapper for StoreArray.
data
instance of EventDataStrip class