Belle II Software development
ReadOrGenerateTrackedEventsRun Class Reference
Inheritance diagram for ReadOrGenerateTrackedEventsRun:
ReadOrGenerateEventsRun MinimalRun EmptyRun CDCDisplayRun StandardReconstructionEventsRun TrackingValidationRun CombinedSVDTrackingValidation CombinedSVDTrackingValidationBkg SVDHoughTrackingValidation SVDHoughTrackingValidationBkg Standalone VXDTF2TrackingValidation VXDTF2TrackingValidationBkg CDCAutomaton CDCAutomaton CDCCR CDCCombined CDCCombined CDCFull CDCFull CDCLegendre CDCLegendre CosmicsAxialHough CosmicsHough Cosmics Full FullBkg fullTrackingValidation_plusECL Full Muon CKFBkg toCDCCKFValidationBkg toCDCfromEclCKF toCDCfromEclCKF

Public Member Functions

def create_argument_parser (self, **kwds)
 
def create_path (self)
 

Static Public Attributes

str description = "Apply tracking to presimulated events or events generated on the fly."
 Description of the run setup to be displayed on command line.
 
None finder_module = None
 Name of the finder module to be used - can be everything that is accepted by tracking.run.utilities.extend_path.
 
dict tracking_coverage
 States which detectors the finder module covers like as a dictionary like.
 
bool fit_tracks = False
 By default, do not add the track fitting to the execution.
 
bool mc_tracking = True
 By default, do MC track finding and track matching.
 

Detailed Description

 Apply tracking to presimulated events or events generated on the fly 

Definition at line 25 of file tracked_event_generation.py.

Member Function Documentation

◆ create_argument_parser()

def create_argument_parser (   self,
**  kwds 
)
Convert command-line arguments to basf2 argument list

Reimplemented from ReadOrGenerateEventsRun.

Reimplemented in TrackingValidationRun, and CDCDisplayRun.

Definition at line 52 of file tracked_event_generation.py.

52 def create_argument_parser(self, **kwds):
53 """Convert command-line arguments to basf2 argument list"""
54 argument_parser = super().create_argument_parser(**kwds)
55
56 tracking_argument_group = argument_parser.add_argument_group("Tracking setup arguments")
57
58 tracking_argument_group.add_argument(
59 '-f',
60 '--finder',
61 choices=utilities.NonstrictChoices(finder_modules_by_short_name.keys()),
62 default=self.finder_module,
63 dest='finder_module',
64 help='Name of the finder module to be evaluated.',)
65
66 tracking_argument_group.add_argument(
67 '--fit',
68 action="store_true",
69 default=self.fit_tracks,
70 dest='fit_tracks',
71 help='Apply the fitting to the found tracks'
72 )
73
74 return argument_parser
75

◆ create_path()

def create_path (   self)
Sets up a path that plays back pregenerated events or generates events
   based on the properties in the base class.

Reimplemented from ReadOrGenerateEventsRun.

Reimplemented in TrackingValidationRun, and CDCDisplayRun.

Definition at line 76 of file tracked_event_generation.py.

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()
80
81 # setting up fitting is only necessary when testing
82 # track finding comonenst ex-situ
83 if self.fit_tracks:
84 if 'SetupGenfitExtrapolation' not in path:
85 # Prepare Genfit extrapolation
86 path.add_module('SetupGenfitExtrapolation')
87
88 if self.finder_module is not None:
89 # Setup track finder
90 utilities.extend_path(path,
91 self.finder_module,
92 finder_modules_by_short_name,
93 allow_function_import=True)
94
95 # determine which sub-detector hits will be used
96 tracking_coverage = dict(self.tracking_coverage)
97
98 matching_coverage = {key: value for key, value in tracking_coverage.items()
99 if key in ('UsePXDHits', 'UseSVDHits', 'UseCDCHits', 'MinimalEfficiency', 'MinimalPurity')}
100 # Removing minimal efficiency and purity as they are only parameters of the matching
101 if "MinimalEfficiency" in tracking_coverage:
102 tracking_coverage.pop("MinimalEfficiency")
103 if "MinimalPurity" in tracking_coverage:
104 tracking_coverage.pop("MinimalPurity")
105
106 # Include the mc tracks if the monte carlo data is presentx
107 if self.mc_tracking and 'MCRecoTracksMatcher' not in path:
108 # Reference Monte Carlo tracks
109 track_finder_mc_truth_module = basf2.register_module('TrackFinderMCTruthRecoTracks')
110
111 # Track matcher
112 mc_track_matcher_module = basf2.register_module('MCRecoTracksMatcher')
113
114 path.add_module(IfMCParticlesPresentModule(track_finder_mc_truth_module))
115 path.add_module(IfMCParticlesPresentModule(mc_track_matcher_module))
116
117 # this ensures that the parameters are set in both cases (if the modules have been added or are already in the path)
118 # only check for containment to also cope with the "IfMCParticlesPresentModule" cases correctly
119 for module in path.modules():
120 if 'MCRecoTracksMatcher' in module.name():
121 module.param({
122 'mcRecoTracksStoreArrayName': 'MCRecoTracks',
123 'MinimalPurity': 0.66,
124 'prRecoTracksStoreArrayName': "RecoTracks",
125 **matching_coverage
126 })
127 if 'TrackFinderMCTruthRecoTracks' in module.name():
128 module.param({
129 'RecoTracksStoreArrayName': 'MCRecoTracks',
130 **tracking_coverage
131 })
132
133 if self.fit_tracks:
134 # Fit tracks
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)
140
141 return path
142
143

Member Data Documentation

◆ description

str description = "Apply tracking to presimulated events or events generated on the fly."
static

Description of the run setup to be displayed on command line.

Definition at line 29 of file tracked_event_generation.py.

◆ finder_module

◆ fit_tracks

bool fit_tracks = False
static

By default, do not add the track fitting to the execution.

Definition at line 47 of file tracked_event_generation.py.

◆ mc_tracking

bool mc_tracking = True
static

By default, do MC track finding and track matching.

Definition at line 50 of file tracked_event_generation.py.

◆ tracking_coverage

dict tracking_coverage
static
Initial value:
= {
'UsePXDHits': True,
'UseSVDHits': True,
'UseCDCHits': True,
'UseOnlyAxialCDCHits': False,
'UseOnlyBeforeTOP': True,
'UseReassignedHits': True,
'UseNLoops': 1,
'WhichParticles': [],
}

States which detectors the finder module covers like as a dictionary like.

Definition at line 35 of file tracked_event_generation.py.


The documentation for this class was generated from the following file: