15 from testbeam.utils
import add_vxdtf_v2
23 geometry_xml='testbeam/vxd/2017_geometry.xml',
24 excluded_components=[],
27 additonal_components = []
29 if geometry_version == 0:
30 print(
'WARNING: overriding the setting of parameter geometry_xml! Old value: ' + geometry_xml)
31 geometry_xml =
'testbeam/vxd/2017_geometry.xml'
32 print(
'New value: ' + geometry_xml)
34 if geometry_version == 1:
35 print(
'WARNING: overriding the setting of parameter geometry_xml! Old value: ' + geometry_xml)
36 geometry_xml =
'testbeam/vxd/2017_geometry_1.xml'
37 print(
'New value: ' + geometry_xml)
39 if target
is not None:
40 additonal_components += [target]
43 excluded_components += [
'MagneticField']
45 if field_override
is not None:
46 excluded_components += [
'MagneticField']
47 additonal_components += [
'MagneticFieldConstant']
50 if field_override
is not None:
51 path.add_module(
'Gearbox',
52 fileName=geometry_xml,
53 override=[(
"/DetectorComponent[@name='MagneticFieldConstant']//Z",
57 path.add_module(
'Gearbox', fileName=geometry_xml)
60 path.add_module(
'Geometry', excludedComponents=excluded_components, additionalComponents=additonal_components)
63 def add_simulation(path, momentum=5., positrons=False, momentum_spread=0.05):
70 gun_x_position = -100.
75 particlegun = b2.register_module(
'ParticleGun')
77 particlegun.param(
'nTracks', 1)
80 particlegun.param(
'pdgCodes', [11])
82 particlegun.param(
'pdgCodes', [-11])
88 particlegun.param(
'momentumGeneration',
'normal')
89 particlegun.param(
'momentumParams', [momentum, momentum * momentum_spread])
91 particlegun.param(
'thetaGeneration',
'normal')
92 particlegun.param(
'thetaParams', [theta, theta_spread])
93 particlegun.param(
'phiGeneration',
'normal')
94 particlegun.param(
'phiParams', [phi, phi_spread])
95 particlegun.param(
'vertexGeneration',
'normal')
96 particlegun.param(
'xVertexParams', [gun_x_position, 0.])
97 particlegun.param(
'yVertexParams', [0., beamspot_size_y])
98 particlegun.param(
'zVertexParams', [0., beamspot_size_z])
99 particlegun.param(
'independentVertices',
True)
101 path.add_module(particlegun)
103 path.add_module(
'FullSim', StoreAllSecondaries=
True)
104 path.add_module(
'SVDDigitizer')
107 def add_reconstruction(
116 useThisGeometry =
'TB2017newGeo'
117 if geometry_version == 0:
118 useThisGeometry =
'TB2017'
120 path.add_module(
'SetupGenfitExtrapolation')
122 path.add_module(
'TrackFinderMCTruthRecoTracks')
127 filter_overlapping=
True,
128 use_segment_network_filters=
True,
130 log_level=b2.LogLevel.ERROR,
132 usedGeometry=useThisGeometry
135 print(
"VXDTF1 not supported")
136 daf = b2.register_module(
'DAFRecoFitter')
137 daf.param(
'initializeCDCTranslators',
False)
138 daf.logging.log_level = b2.LogLevel.ERROR
140 track_creator = b2.register_module(
'TrackCreator')
141 track_creator.param(
'beamSpot', [0., 0., 0.])
142 track_creator.param(
'pdgCodes', [11])
143 track_creator.logging.log_level = b2.LogLevel.ERROR
144 path.add_module(track_creator)