15 This module is used for the SVD validation.
16 It gets information about digits, saving
17 in a ttree in a ROOT file.
19 <noexecute>SVD validation helper class</noexecute>
22 import xml.etree.ElementTree
as ET
28 from ROOT
import Belle2
29 from ROOT
import gROOT, addressof
32 gROOT.ProcessLine(
'struct EventDataStrip {\
43 from ROOT
import EventDataStrip
47 '''class to create the strip ttree'''
50 """Initialize the module"""
52 super(SVDValidationTTreeStrip, self).
__init__()
54 self.
filefile = ROOT.TFile(
'../SVDValidationTTreeStrip.root',
'recreate')
56 self.
treetree = ROOT.TTree(
'tree',
'Event data of SVD validation events')
58 self.
datadata = EventDataStrip()
61 for key
in EventDataStrip.__dict__:
64 if isinstance(self.
datadata.__getattribute__(key), int):
66 self.
treetree.Branch(key, addressof(self.
datadata, key), key + formstring)
69 """Find digit with a cluster and save needed information"""
74 for sensor
in root.findall(
'Sensor'):
75 if sensor.get(
'type') ==
'Layer3':
76 if len(sensor.findall(
'Active')) == 1:
77 active = sensor.find(
'Active')
78 NoiseULayer3 = int(active.find(
'ElectronicNoiseU').text)
79 NoiseVLayer3 = int(active.find(
'ElectronicNoiseV').text)
80 for sensorbase
in root.iter(
'SensorBase'):
81 if sensorbase.get(
'type') ==
'Barrel':
82 active = sensorbase.find(
'Active')
83 NoiseUBarrel = int(active.find(
'ElectronicNoiseU').text)
84 NoiseVBarrel = int(active.find(
'ElectronicNoiseV').text)
85 elif sensorbase.get(
'type') ==
'Slanted':
86 active = sensorbase.find(
'Active')
87 NoiseUSlanted = int(active.find(
'ElectronicNoiseU').text)
88 NoiseVSlanted = int(active.find(
'ElectronicNoiseV').text)
93 for cluster
in clusters:
97 cluster_truehits = cluster.getRelationsTo(
'SVDTrueHits')
99 if len(cluster_truehits) != 1:
101 digits = cluster.getRelationsTo(
'SVDRecoDigits')
105 if digit.getCellID()
not in cls_strip_ids:
106 cls_strip_ids.append(digit.getCellID())
109 for strip_id
in cls_strip_ids:
113 if strip_id != digit.getCellID():
118 if(digit.getCharge() > strip_charge):
119 strip_charge = digit.getCharge()
122 sensorID = cluster.getSensorID()
123 self.
datadata.sensor_id = int(sensorID)
124 sensorNum = sensorID.getSensorNumber()
125 self.
datadata.sensor = sensorNum
126 layerNum = sensorID.getLayerNumber()
127 self.
datadata.layer = layerNum
135 self.
datadata.sensor_type = sensorType
136 ladderNum = sensorID.getLadderNumber()
137 self.
datadata.ladder = ladderNum
138 self.
datadata.strip_charge = strip_charge
147 noise = NoiseUSlanted
156 noise = NoiseVSlanted
159 self.
datadata.strip_dir = strip_dir
160 self.
datadata.strip_noise = noise
166 """Close the output file. """
168 self.
filefile.Write()
169 self.
filefile.Close()
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