22 return logging.getLogger(__name__)
26 """ Apply tracking to presimulated events or events generated on the fly """
29 description =
"Apply tracking to presimulated events or events generated on the fly."
39 'UseOnlyAxialCDCHits':
False,
40 'UseOnlyBeforeTOP':
True,
41 'UseReassignedHits':
True,
53 """Convert command-line arguments to basf2 argument list"""
56 tracking_argument_group = argument_parser.add_argument_group(
"Tracking setup arguments")
58 tracking_argument_group.add_argument(
64 help=
'Name of the finder module to be evaluated.',)
66 tracking_argument_group.add_argument(
71 help=
'Apply the fitting to the found tracks'
74 return argument_parser
76 def create_path(self):
77 """Sets up a path that plays back pregenerated events or generates events
78 based on the properties in the base
class.
"""
79 path = super().create_path()
84 if 'SetupGenfitExtrapolation' not in path:
86 path.add_module(
'SetupGenfitExtrapolation')
90 utilities.extend_path(path,
92 finder_modules_by_short_name,
93 allow_function_import=
True)
98 matching_coverage = {key: value
for key, value
in tracking_coverage.items()
99 if key
in (
'UsePXDHits',
'UseSVDHits',
'UseCDCHits',
'MinimalEfficiency',
'MinimalPurity')}
101 if "MinimalEfficiency" in tracking_coverage:
102 tracking_coverage.pop(
"MinimalEfficiency")
103 if "MinimalPurity" in tracking_coverage:
104 tracking_coverage.pop(
"MinimalPurity")
107 if self.
mc_tracking and 'MCRecoTracksMatcher' not in path:
109 track_finder_mc_truth_module = basf2.register_module(
'TrackFinderMCTruthRecoTracks')
112 mc_track_matcher_module = basf2.register_module(
'MCRecoTracksMatcher')
119 for module
in path.modules():
120 if 'MCRecoTracksMatcher' in module.name():
122 'mcRecoTracksStoreArrayName':
'MCRecoTracks',
123 'MinimalPurity': 0.66,
124 'prRecoTracksStoreArrayName':
"RecoTracks",
127 if 'TrackFinderMCTruthRecoTracks' in module.name():
129 'RecoTracksStoreArrayName':
'MCRecoTracks',
135 gen_fitter_module = basf2.register_module(
'DAFRecoFitter')
136 gen_fitter_module.param({
'pdgCodesToUseForFitting': [211]})
137 path.add_module(gen_fitter_module)
138 trackbuilder = basf2.register_module(
'TrackCreator', pdgCodes=[211])
139 path.add_module(trackbuilder)
144def add_standard_finder(path):
145 """adds the standard track finding to the path"""
149 for module
in path.modules():
150 if module.type() ==
"Geometry":
151 components = utilities.get_module_param(module,
"components")
155 if 'SetupGenfitExtrapolation' not in path:
156 path.add_module(
'SetupGenfitExtrapolation', energyLossBrems=
False, noiseBrems=
False)
161def add_cosmics_finder(path):
164 for module
in path.modules():
165 if module.type() ==
"Geometry":
166 components = utilities.get_module_param(module,
"components")
170 if 'SetupGenfitExtrapolation' not in path:
171 path.add_module(
'SetupGenfitExtrapolation', energyLossBrems=
False, noiseBrems=
False)
176def add_standard_reconstruction(path):
177 import reconstruction
179 for module
in path.modules():
180 if module.type() ==
"Geometry":
181 components = utilities.get_module_param(module,
"components")
187def add_cosmics_reconstruction(path):
188 import reconstruction
190 for module
in path.modules():
191 if module.type() ==
"Geometry":
192 components = utilities.get_module_param(module,
"components")
198finder_modules_by_short_name = {
199 'MC':
'TrackFinderMCTruthRecoTracks',
200 'Reconstruction': add_standard_reconstruction,
201 'CosmicsReconstruction': add_cosmics_reconstruction,
202 'TrackFinder': add_standard_finder,
203 'CosmicsTrackFinder': add_cosmics_finder,
204 'TrackFinderVXD': tracking.add_vxd_track_finding_vxdtf2,
205 'TFCDC':
lambda path: tracking.add_cdc_track_finding(path, with_ca=
True),
206 'TFCDC_Cosmics':
lambda path: tracking.add_cdc_cr_track_finding(path),
207 'TFCDC_Global': tracking.add_cdc_track_finding,
208 'TFCDC_Ca':
lambda path: (path.add_module(
'TFCDC_WireHitPreparer',
209 flightTimeEstimation=
"outwards"),
210 path.add_module(
'TFCDC_ClusterPreparer',
211 SuperClusterDegree=3,
212 SuperClusterExpandOverApogeeGap=
True),
213 path.add_module(
'TFCDC_SegmentFinderFacetAutomaton'),
214 path.add_module(
"TFCDC_TrackFinderSegmentPairAutomaton"),
215 path.add_module(
"TFCDC_TrackCreatorSingleSegments",
216 MinimalHitsBySuperLayerId={0: 15}),
217 path.add_module(
'TFCDC_TrackExporter')),
218 'TFCDC_Axial':
lambda path: (path.add_module(
'TFCDC_WireHitPreparer',
219 flightTimeEstimation=
"outwards"),
220 path.add_module(
'TFCDC_ClusterPreparer'),
221 path.add_module(
'TFCDC_AxialTrackFinderLegendre'),
222 path.add_module(
'TFCDC_TrackExporter')),
223 'TFCDC_Segments':
lambda path: (path.add_module(
'TFCDC_WireHitPreparer',
224 flightTimeEstimation=
"outwards"),
225 path.add_module(
'TFCDC_ClusterPreparer'),
226 path.add_module(
'TFCDC_SegmentFinderFacetAutomaton'),
227 path.add_module(
'TFCDC_TrackCreatorSingleSegments',
228 MinimalHitsBySuperLayerId={sl_id: 0
for sl_id
in range(9)}),
229 path.add_module(
'TFCDC_TrackExporter')),
230 'TFCDC_MCSegments':
lambda path: (path.add_module(
'TFCDC_WireHitPreparer',
231 flightTimeEstimation=
"outwards"),
232 path.add_module(
'TFCDC_SegmentCreatorMCTruth'),
233 path.add_module(
'TFCDC_SegmentLinker',
234 segments=
"CDCSegment2DVector",
236 path.add_module(
'TFCDC_TrackCreatorSingleSegments',
237 MinimalHitsBySuperLayerId={sl_id: 0
for sl_id
in range(9)}),
238 path.add_module(
'TFCDC_TrackExporter')),
239 'FirstLoop':
lambda path: path.add_module(
'TFCDC_WireHitPreparer', UseNLoops=1.0),
244 """Generate, simulate and reconstruct events"""
246 generator_module =
'EvtGenInput'
249 """Add track reconstruction to the basf2 path"""
250 tracking.add_tracking_reconstruction(path, components=self.
components)
None components
By default, do specific components.
def create_argument_parser(self, **kwds)
None finder_module
Name of the finder module to be used - can be everything that is accepted by tracking....
bool mc_tracking
By default, do MC track finding and track matching.
dict tracking_coverage
States which detectors the finder module covers like as a dictionary like.
bool fit_tracks
By default, do not add the track fitting to the execution.
def add_reconstruction(path, components=None, pruneTracks=True, add_trigger_calculation=True, skipGeometryAdding=False, trackFitHypotheses=None, addClusterExpertModules=True, use_second_cdc_hits=False, add_muid_hits=False, reconstruct_cdst=None, event_abort=default_event_abort, use_random_numbers_for_hlt_prescale=True, pxd_filtering_offline=False, create_intercepts_for_pxd_ckf=False, append_full_grid_cdc_eventt0=True, legacy_ecl_charged_pid=False, emulate_HLT=False, skip_full_grid_cdc_eventt0_if_svd_time_present=True)
def add_cosmics_reconstruction(path, components=None, pruneTracks=True, skipGeometryAdding=False, eventTimingExtraction=True, addClusterExpertModules=True, merge_tracks=True, use_second_cdc_hits=False, add_muid_hits=False, reconstruct_cdst=False, posttracking=True, legacy_ecl_charged_pid=False)
def add_track_finding(path, components=None, reco_tracks="RecoTracks", prune_temporary_tracks=True, use_second_cdc_hits=False, use_mc_truth=False, svd_ckf_mode="SVD_after", add_both_directions=True, svd_standalone_mode="VXDTF2", use_svd_to_cdc_ckf=True, use_ecl_to_cdc_ckf=False, add_cdcTrack_QI=True, add_vxdTrack_QI=False, pxd_filtering_offline=False, use_HLT_ROIs=False, create_intercepts_for_pxd_ckf=False)
def add_cr_tracking_reconstruction(path, components=None, prune_tracks=False, skip_geometry_adding=False, event_time_extraction=True, merge_tracks=True, use_second_cdc_hits=False)