23 return logging.getLogger(__name__)
27 """ Apply tracking to presimulated events or events generated on the fly """
30 description =
"Apply tracking to presimulated events or events generated on the fly."
40 'UseOnlyAxialCDCHits':
False,
41 'UseOnlyBeforeTOP':
True,
42 'UseReassignedHits':
True,
54 """Convert command-line arguments to basf2 argument list"""
57 tracking_argument_group = argument_parser.add_argument_group(
"Tracking setup arguments")
59 tracking_argument_group.add_argument(
65 help=
'Name of the finder module to be evaluated.',)
67 tracking_argument_group.add_argument(
72 help=
'Apply the fitting to the found tracks'
75 return argument_parser
78 """Sets up a path that plays back pregenerated events or generates events
79 based on the properties in the base class."""
85 if 'SetupGenfitExtrapolation' not in path:
87 path.add_module(
'SetupGenfitExtrapolation')
91 utilities.extend_path(path,
93 finder_modules_by_short_name,
94 allow_function_import=
True)
99 matching_coverage = {key: value
for key, value
in tracking_coverage.items()
100 if key
in (
'UsePXDHits',
'UseSVDHits',
'UseCDCHits',
'MinimalEfficiency',
'MinimalPurity')}
102 if "MinimalEfficiency" in tracking_coverage:
103 tracking_coverage.pop(
"MinimalEfficiency")
104 if "MinimalPurity" in tracking_coverage:
105 tracking_coverage.pop(
"MinimalPurity")
108 if self.
mc_trackingmc_tracking
and 'MCRecoTracksMatcher' not in path:
110 track_finder_mc_truth_module = basf2.register_module(
'TrackFinderMCTruthRecoTracks')
113 mc_track_matcher_module = basf2.register_module(
'MCRecoTracksMatcher')
120 for module
in path.modules():
121 if 'MCRecoTracksMatcher' in module.name():
123 'mcRecoTracksStoreArrayName':
'MCRecoTracks',
124 'MinimalPurity': 0.66,
125 'prRecoTracksStoreArrayName':
"RecoTracks",
128 if 'TrackFinderMCTruthRecoTracks' in module.name():
130 'RecoTracksStoreArrayName':
'MCRecoTracks',
136 gen_fitter_module = basf2.register_module(
'DAFRecoFitter')
137 gen_fitter_module.param({
'pdgCodesToUseForFitting': [211]})
138 path.add_module(gen_fitter_module)
139 trackbuilder = basf2.register_module(
'TrackCreator', pdgCodes=[211])
140 path.add_module(trackbuilder)
145 def add_standard_finder(path):
146 """adds the standard track finding to the path"""
150 for module
in path.modules():
151 if module.type() ==
"Geometry":
152 components = utilities.get_module_param(module,
"components")
156 if 'SetupGenfitExtrapolation' not in path:
157 path.add_module(
'SetupGenfitExtrapolation', energyLossBrems=
False, noiseBrems=
False)
162 def add_cosmics_finder(path):
165 for module
in path.modules():
166 if module.type() ==
"Geometry":
167 components = utilities.get_module_param(module,
"components")
171 if 'SetupGenfitExtrapolation' not in path:
172 path.add_module(
'SetupGenfitExtrapolation', energyLossBrems=
False, noiseBrems=
False)
177 def add_standard_reconstruction(path):
178 import reconstruction
180 for module
in path.modules():
181 if module.type() ==
"Geometry":
182 components = utilities.get_module_param(module,
"components")
188 def add_cosmics_reconstruction(path):
189 import reconstruction
191 for module
in path.modules():
192 if module.type() ==
"Geometry":
193 components = utilities.get_module_param(module,
"components")
199 finder_modules_by_short_name = {
200 'MC':
'TrackFinderMCTruthRecoTracks',
201 'Reconstruction': add_standard_reconstruction,
202 'CosmicsReconstruction': add_cosmics_reconstruction,
203 'TrackFinder': add_standard_finder,
204 'CosmicsTrackFinder': add_cosmics_finder,
205 'TrackFinderVXD': tracking.add_vxd_track_finding_vxdtf2,
206 'TFCDC':
lambda path: tracking.add_cdc_track_finding(path, with_ca=
True),
207 'TFCDC_Cosmics':
lambda path: tracking.add_cdc_cr_track_finding(path),
208 'TFCDC_Global': tracking.add_cdc_track_finding,
209 'TFCDC_Ca':
lambda path: (path.add_module(
'TFCDC_WireHitPreparer',
210 flightTimeEstimation=
"outwards"),
211 path.add_module(
'TFCDC_ClusterPreparer',
212 SuperClusterDegree=3,
213 SuperClusterExpandOverApogeeGap=
True),
214 path.add_module(
'TFCDC_SegmentFinderFacetAutomaton'),
215 path.add_module(
"TFCDC_TrackFinderSegmentPairAutomaton"),
216 path.add_module(
"TFCDC_TrackCreatorSingleSegments",
217 MinimalHitsBySuperLayerId={0: 15}),
218 path.add_module(
'TFCDC_TrackExporter')),
219 'TFCDC_Axial':
lambda path: (path.add_module(
'TFCDC_WireHitPreparer',
220 flightTimeEstimation=
"outwards"),
221 path.add_module(
'TFCDC_ClusterPreparer'),
222 path.add_module(
'TFCDC_AxialTrackFinderLegendre'),
223 path.add_module(
'TFCDC_TrackExporter')),
224 'TFCDC_Segments':
lambda path: (path.add_module(
'TFCDC_WireHitPreparer',
225 flightTimeEstimation=
"outwards"),
226 path.add_module(
'TFCDC_ClusterPreparer'),
227 path.add_module(
'TFCDC_SegmentFinderFacetAutomaton'),
228 path.add_module(
'TFCDC_TrackCreatorSingleSegments',
229 MinimalHitsBySuperLayerId={sl_id: 0
for sl_id
in range(9)}),
230 path.add_module(
'TFCDC_TrackExporter')),
231 'TFCDC_MCSegments':
lambda path: (path.add_module(
'TFCDC_WireHitPreparer',
232 flightTimeEstimation=
"outwards"),
233 path.add_module(
'TFCDC_SegmentCreatorMCTruth'),
234 path.add_module(
'TFCDC_SegmentLinker',
235 segments=
"CDCSegment2DVector",
237 path.add_module(
'TFCDC_TrackCreatorSingleSegments',
238 MinimalHitsBySuperLayerId={sl_id: 0
for sl_id
in range(9)}),
239 path.add_module(
'TFCDC_TrackExporter')),
240 'FirstLoop':
lambda path: path.add_module(
'TFCDC_WireHitPreparer', UseNLoops=1.0),
245 """Generate, simulate and reconstruct events"""
247 generator_module =
'EvtGenInput'
250 """Add track reconstruction to the basf2 path"""
251 tracking.add_tracking_reconstruction(path, components=self.
componentscomponents)
components
By default, do specific components.
def create_argument_parser(self, **kwds)
bool mc_tracking
By default, do MC track finding and track matching.
finder_module
Name of the finder module to be used - can be everything that is accepted by tracking....
dictionary 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_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, eventt0_combiner_mode="prefer_cdc", legacy_ecl_charged_pid=False)
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, append_full_grid_cdc_eventt0=False, legacy_ecl_charged_pid=False, emulate_HLT=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)
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)