9 import xml.etree.ElementTree
as xml
13 from ROOT
import Belle2
15 logging.log_level = LogLevel.WARNING
20 """A utility module to manipulate the threshold on deposited energy
21 in PXD and SVD SensitiveDetector.
25 """Initialize the module"""
27 super(SetVXDSensitiveThreshold, self).
__init__()
35 self.
path =
'data/{comp}/{COMP}.xml'
37 self.
xmlpath =
'Content/SensitiveThreshold'
40 """ Set the threshold value in PXD or SVD file."""
42 filename = self.
path.format(comp=component.lower(),
43 COMP=component.upper())
44 tree = xml.parse(filename)
45 for node
in tree.getroot().findall(self.
xmlpath):
46 if component.lower() ==
'pxd':
50 node.text =
'{val}'.format(val=value)
52 file = open(filename,
'w')
53 tree.write(file, encoding=
'UTF-8', xml_declaration=
True)
57 """ Set the required threshold value """
69 """ Set the previuos threshold value """
71 self.set_threshold(
'PXD', self.old_pxd_threshold)
72 self.set_threshold(
'SVD', self.old_svd_threshold)
76 particlegun = register_module(
'ParticleGun')
78 eventinfosetter = register_module(
'EventInfoSetter')
80 progress = register_module(
'Progress')
84 gearbox = register_module(
'Gearbox')
86 geometry = register_module(
'Geometry')
88 simulation = register_module(
'FullSim')
90 pxddigi = register_module(
'PXDDigitizer')
92 pxdclust = register_module(
'PXDClusterizer')
94 svddigi = register_module(
'SVDDigitizer')
96 svdclust = register_module(
'SVDClusterizer')
98 output = register_module(
'RootOutput')
101 eventinfosetter.param({
'evtNumList': [10],
'runList': [1]})
119 'pdgCodes': [211, -211, 11, -11],
120 'momentumGeneration':
'normalPt',
121 'momentumParams': [5, 1],
122 'phiGeneration':
'normal',
123 'phiParams': [180, 30],
124 'thetaGeneration':
'uniformCosinus',
125 'thetaParams': [17, 150],
126 'vertexGeneration':
'normal',
127 'xVertexParams': [0, 2],
128 'yVertexParams': [0, 2],
129 'zVertexParams': [0, 0],
130 'independentVertices':
False,
134 geometry.param(
'Components', [
'MagneticField',
'PXD',
'SVD'])
142 main.add_module(eventinfosetter)
143 main.add_module(progress)
144 main.add_module(particlegun)
145 main.add_module(set_thr)
146 main.add_module(gearbox)
147 main.add_module(geometry)
148 main.add_module(simulation)
149 main.add_module(pxddigi)
150 main.add_module(pxdclust)
151 main.add_module(svddigi)
152 main.add_module(svdclust)
153 main.add_module(output)