4 @author Riley Xu - riley.xu@cern.ch
6 @brief Configuration file that parses run arguments from transforms
8 This file collects all transform run argument parsing into a centralized area
9 for configuring various FPGATrackSim transforms.
11 Note that the parse functions return a dictionary that contain keys to correspond
12 to those in the various package tags. We don't want to use the tags directly here
13 to maintain good factorization. However, any changes to the tag keys must now be
18 addFPGATrackSimBanksArgs(trf.parser)
20 opts = parseFPGATrackSimArgs(runArgs)
21 FPGATrackSimTagConfig.getTags(opts)
32 _FPGATrackSimMapsArgs = [
33 (
'mapTag',
trfArgClasses.argString,
'Switch to a different tag than the default listed in FPGATrackSimMapTags'),
36 (
'layerOverride',
trfArgClasses.argIntList,
"Overrides the selection of the 1st stage logical layers in the plane map. Each entry declares a detector layer to use as a logical layer. Specify a detector layer with { SilictonTech * 1000 + DetectorZone * 100 + PhysicalLayer }"),
47 Adds arguments used by FPGATrackSimMaps to a transform parser.
50 parser.defineArgGroup(
'FPGATrackSimMaps',
'Options for FPGATrackSimMaps. '
51 'These options will override the default configuration specified in FPGATrackSimMapTags.')
53 def addArg(argName, argType, helpText=""):
54 parser.add_argument(
'--' + argName,
57 group=
'FPGATrackSimMaps')
59 for arg
in _FPGATrackSimMapsArgs:
66 _FPGATrackSimBanksArgs = [
67 (
"bankTag",
trfArgClasses.argString,
"Switch to a different tag than the default listed in FPGATrackSimBankTags"),
68 (
"bankDir",
trfArgClasses.argString,
"Common directory path to be prepended to all filenames below. If not all files are in the same directory, you can change bankDir to a common parent directory or just '' and use fully-qualified paths for the individual filenames."),
79 Adds arguments used by FPGATrackSimBanks to a transform parser.
82 parser.defineArgGroup(
'FPGATrackSimBanks',
'Optional overrides for FPGATrackSimBanks. '
83 'These options will override the default configuration specified in FPGATrackSimBankTags.')
85 def addArg(argName, argType, helpText=""):
86 parser.add_argument(
'--' + argName,
89 group=
'FPGATrackSimBanks')
91 for arg
in _FPGATrackSimBanksArgs:
99 _FPGATrackSimAlgorithmsArgs = [
101 (
"FirstInputToolN",
trfArgClasses.argInt,
"number of times to reuse each event in first input tool, i.e. for overlaying"),
117 (
"PhiRoadFilter",
trfArgClasses.argString,
"Turn on PhiRoad filter with window sizes given as a list of nLayers numbers"),
118 (
"IdealCoordFitType",
trfArgClasses.argInt,
"Do ideal coordinate fits? 0 means don't do this, 1 means yes with 1st order correction, 2 means yes with 2nd order correction"),
119 (
"DoDeltaGPhis",
trfArgClasses.argBool,
"Do the track fitting based on the Hough transform, idealized geometry and delta phis"),
125 _FPGATrackSimHoughTransformArgs = [
143 (
'hitExtend_x',
trfArgClasses.argString,
"Hit lines will fill extra bins in x by this amount on each side, size == nLayers"),
146 (
'localMaxWindowSize',
trfArgClasses.argInt,
"Only create roads that are a local maximum within this window size. Set this to 0 to turn off local max filtering"),
149 (
"fieldCorrection",
trfArgClasses.argBool,
"Apply corrections to hough equation due to field nonuniformity"),
152 _FPGATrackSimLRTArgs = [
165 (
'm_LRT_pdgID',
trfArgClasses.argInt,
"if only some PDGID desired in truth matching, add it here."),
166 (
'allowHighTruthBarcode',
trfArgClasses.argBool,
"Allow truth matching to take place for truth particles with barcodes > 200000. This is important for some LLP samples where the LLP decays in Geant.")
172 Adds arguments used by FPGATrackSimAlgorithms to a transform parser.
175 parser.defineArgGroup(
'FPGATrackSimAlgorithms',
'Options for FPGATrackSimAlgorithms configuration')
176 parser.defineArgGroup(
'FPGATrackSimHoughTransform',
'Options for FPGATrackSim Hough transform')
177 parser.defineArgGroup(
'FPGATrackSimLRT',
'Options for FPGATrackSim Hough transform')
179 def addArg(group, argName, argType, helpText=""):
180 parser.add_argument(
'--' + argName,
185 for arg
in _FPGATrackSimAlgorithmsArgs:
186 addArg(
'FPGATrackSimAlgorithms', *arg)
188 for arg
in _FPGATrackSimHoughTransformArgs:
189 addArg(
'FPGATrackSimHoughTransform', *arg)
191 for arg
in _FPGATrackSimLRTArgs:
192 addArg(
'FPGATrackSimLRT', *arg)
194 _FPGATrackSimHitFilteringArgs = [
210 Adds arguments used by FPGATrackSimHitFiltering to a transform parser.
213 parser.defineArgGroup(
'FPGATrackSimHitFiltering',
'Options for FPGATrackSimHitFiltering configuration')
215 def addArg(group, argName, argType, helpText=""):
216 parser.add_argument(
'--' + argName,
221 for arg
in _FPGATrackSimHitFilteringArgs:
222 addArg(
'FPGATrackSimHitFiltering', *arg)
232 Collects FPGATrackSim arguments from runArgs into a dictionary of (parameter: value) pairs.
233 Use the corresponding add***Args() functions above to add arguments to a transform parser.
236 for arg
in itertools.chain(_FPGATrackSimMapsArgs, _FPGATrackSimBanksArgs, _FPGATrackSimAlgorithmsArgs, _FPGATrackSimHoughTransformArgs, _FPGATrackSimHitFilteringArgs, _FPGATrackSimLRTArgs):
238 if hasattr(runArgs, key):
239 opts[key] = getattr(runArgs, key)
240 msg.info(
"Final pars: ", opts)