14import xml.etree.ElementTree
as xml
18b2.logging.log_level = b2.LogLevel.WARNING
23 """A utility module to manipulate the threshold on deposited energy
24 in PXD
and SVD SensitiveDetector.
28 """Initialize the module"""
38 self.
path =
'data/{comp}/{COMP}.xml'
40 self.
xmlpath =
'Content/SensitiveThreshold'
43 """ Set the threshold value in PXD or SVD file."""
45 filename = self.
path.format(comp=component.lower(),
46 COMP=component.upper())
47 tree = xml.parse(filename)
48 for node
in tree.getroot().findall(self.
xmlpath):
49 if component.lower() ==
'pxd':
53 node.text = f
'{value}'
55 file = open(filename,
'w')
56 tree.write(file, encoding=
'UTF-8', xml_declaration=
True)
60 """ Set the required threshold value """
72 """ Set the previuos threshold value """
74 self.set_threshold(
'PXD', self.old_pxd_threshold)
75 self.set_threshold(
'SVD', self.old_svd_threshold)
79particlegun = b2.register_module(
'ParticleGun')
81eventinfosetter = b2.register_module(
'EventInfoSetter')
83progress = b2.register_module(
'Progress')
87gearbox = b2.register_module(
'Gearbox')
89geometry = b2.register_module(
'Geometry')
91simulation = b2.register_module(
'FullSim')
93pxddigi = b2.register_module(
'PXDDigitizer')
95pxdclust = b2.register_module(
'PXDClusterizer')
97svddigi = b2.register_module(
'SVDDigitizer')
99svdclust = b2.register_module(
'SVDClusterizer')
101output = b2.register_module(
'RootOutput')
104eventinfosetter.param({
'evtNumList': [10],
'runList': [1]})
122 'pdgCodes': [211, -211, 11, -11],
123 'momentumGeneration':
'normalPt',
124 'momentumParams': [5, 1],
125 'phiGeneration':
'normal',
126 'phiParams': [180, 30],
127 'thetaGeneration':
'uniformCosinus',
128 'thetaParams': [17, 150],
129 'vertexGeneration':
'normal',
130 'xVertexParams': [0, 2],
131 'yVertexParams': [0, 2],
132 'zVertexParams': [0, 0],
133 'independentVertices':
False,
137geometry.param(
'Components', [
'MagneticField',
'PXD',
'SVD'])
144main = b2.create_path()
145main.add_module(eventinfosetter)
146main.add_module(progress)
147main.add_module(particlegun)
148main.add_module(set_thr)
149main.add_module(gearbox)
150main.add_module(geometry)
151main.add_module(simulation)
152main.add_module(pxddigi)
153main.add_module(pxdclust)
154main.add_module(svddigi)
155main.add_module(svdclust)
156main.add_module(output)
threshold
The threshold value to be set.
xmlpath
XML path to the threshold setting.
def __init__(self, threshold)
def set_threshold(self, component, value)
old_svd_threshold
The current svd threshold value.
path
Filesystem path to the .xml file.
old_pxd_threshold
The current pxd threshold value.