14from testbeam.utils
import add_vxdtf_v2
22 geometry_xml='testbeam/vxd/2017_geometry.xml',
23 excluded_components=[],
26 additonal_components = []
28 if geometry_version == 0:
29 print(
'WARNING: overriding the setting of parameter geometry_xml! Old value: ' + geometry_xml)
30 geometry_xml =
'testbeam/vxd/2017_geometry.xml'
31 print(
'New value: ' + geometry_xml)
33 if geometry_version == 1:
34 print(
'WARNING: overriding the setting of parameter geometry_xml! Old value: ' + geometry_xml)
35 geometry_xml =
'testbeam/vxd/2017_geometry_1.xml'
36 print(
'New value: ' + geometry_xml)
38 if target
is not None:
39 additonal_components += [target]
42 excluded_components += [
'MagneticField']
44 if field_override
is not None:
45 excluded_components += [
'MagneticField']
46 additonal_components += [
'MagneticFieldConstant']
49 if field_override
is not None:
50 path.add_module(
'Gearbox',
51 fileName=geometry_xml,
52 override=[(
"/DetectorComponent[@name='MagneticFieldConstant']//Z",
56 path.add_module(
'Gearbox', fileName=geometry_xml)
59 path.add_module(
'Geometry', excludedComponents=excluded_components, additionalComponents=additonal_components)
62def add_simulation(path, momentum=5., positrons=False, momentum_spread=0.05):
69 gun_x_position = -100.
74 particlegun = b2.register_module(
'ParticleGun')
76 particlegun.param(
'nTracks', 1)
79 particlegun.param(
'pdgCodes', [11])
81 particlegun.param(
'pdgCodes', [-11])
87 particlegun.param(
'momentumGeneration',
'normal')
88 particlegun.param(
'momentumParams', [momentum, momentum * momentum_spread])
90 particlegun.param(
'thetaGeneration',
'normal')
91 particlegun.param(
'thetaParams', [theta, theta_spread])
92 particlegun.param(
'phiGeneration',
'normal')
93 particlegun.param(
'phiParams', [phi, phi_spread])
94 particlegun.param(
'vertexGeneration',
'normal')
95 particlegun.param(
'xVertexParams', [gun_x_position, 0.])
96 particlegun.param(
'yVertexParams', [0., beamspot_size_y])
97 particlegun.param(
'zVertexParams', [0., beamspot_size_z])
98 particlegun.param(
'independentVertices',
True)
100 path.add_module(particlegun)
102 path.add_module(
'FullSim', StoreAllSecondaries=
True)
103 path.add_module(
'SVDDigitizer')
106def add_reconstruction(
115 useThisGeometry =
'TB2017newGeo'
116 if geometry_version == 0:
117 useThisGeometry =
'TB2017'
119 path.add_module(
'SetupGenfitExtrapolation')
121 path.add_module(
'TrackFinderMCTruthRecoTracks')
126 filter_overlapping=
True,
127 use_segment_network_filters=
True,
129 log_level=b2.LogLevel.ERROR,
131 usedGeometry=useThisGeometry
134 print(
"VXDTF1 not supported")
135 daf = b2.register_module(
'DAFRecoFitter')
136 daf.param(
'initializeCDCTranslators',
False)
137 daf.logging.log_level = b2.LogLevel.ERROR
139 track_creator = b2.register_module(
'TrackCreator')
140 track_creator.param(
'beamSpot', [0., 0., 0.])
141 track_creator.param(
'pdgCodes', [11])
142 track_creator.logging.log_level = b2.LogLevel.ERROR
143 path.add_module(track_creator)