5 '''@file InDetTrackPerfMonConfig.py
8 @brief Main CA-based python configuration for InDetTrackPerfMonTool
11 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
12 from AthenaConfiguration.ComponentFactory
import CompFactory
13 from AthenaCommon.Logging
import logging
18 Tool to read the plots definitions from an input file in JSON format
20 log = logging.getLogger(
"JsonPlotsDefReadTool" )
24 from InDetTrackPerfMon.ConfigUtils
import getPlotsDefList
26 log.debug(
"Loading the following plot definitions:" )
27 for plotDef
in plotsDefList : log.debug(
"\t-> %s", plotDef )
29 kwargs.setdefault(
"PlotsDefs", plotsDefList )
32 CompFactory.IDTPM.JsonPlotsDefReadTool( name, **kwargs ) )
38 CA-based configuration for the Tool to read the plots definition
40 log = logging.getLogger(
"PlotsDefReadTool" )
42 if flags.PhysVal.IDTPM.plotsDefFormat ==
"JSON" :
44 flags, name =
"JsonPlotsDefReadTool" +
45 flags.PhysVal.IDTPM.currentTrkAna.anaTag, **kwargs )
47 log.error(
"Non supported plots definition file type %s",
48 flags.PhysVal.IDTPM.plotsDefFormat )
54 CA-based configuration for the PlotsDefinition Service
58 if "PlotsDefReadTool" not in kwargs:
59 kwargs.setdefault(
"PlotsDefReadTool", acc.popToolsAndMerge(
63 CompFactory.PlotsDefinitionSvc( name, **kwargs ) )
69 Tool to write TrackAnalysisInfo to StoreGate
73 kwargs.setdefault(
"AnaTag", flags.PhysVal.IDTPM.currentTrkAna.anaTag )
75 acc.setPrivateTools( CompFactory.IDTPM.TrackAnalysisInfoWriteTool( name, **kwargs ) )
81 CA-based configuration for the TrackAnalysisDefinition Service
85 kwargs.setdefault(
"DirName", flags.PhysVal.IDTPM.DirName )
86 kwargs.setdefault(
"sortPlotsByChain", flags.PhysVal.IDTPM.sortPlotsByChain )
87 kwargs.setdefault(
"SubFolder", flags.PhysVal.IDTPM.currentTrkAna.SubFolder )
88 kwargs.setdefault(
"TrkAnaTag", flags.PhysVal.IDTPM.currentTrkAna.anaTag )
90 kwargs.setdefault(
"TestType", flags.PhysVal.IDTPM.currentTrkAna.TestType )
91 kwargs.setdefault(
"RefType", flags.PhysVal.IDTPM.currentTrkAna.RefType )
93 kwargs.setdefault(
"pileupSwitch", flags.PhysVal.IDTPM.currentTrkAna.pileupSwitch )
95 from InDetTrackPerfMon.ConfigUtils
import getTag
96 kwargs.setdefault(
"TestTag",
getTag( flags, flags.PhysVal.IDTPM.currentTrkAna.TestType ) )
97 kwargs.setdefault(
"RefTag",
getTag( flags, flags.PhysVal.IDTPM.currentTrkAna.RefType ) )
99 kwargs.setdefault(
"MatchingType", flags.PhysVal.IDTPM.currentTrkAna.MatchingType )
100 kwargs.setdefault(
"MatchingTruthProb", flags.PhysVal.IDTPM.currentTrkAna.truthProbCut )
102 if ( (
"Trigger" in flags.PhysVal.IDTPM.currentTrkAna.TestType
and "EFTrigger" not in flags.PhysVal.IDTPM.currentTrkAna.TestType)
or
103 (
"Trigger" in flags.PhysVal.IDTPM.currentTrkAna.RefType
and "EFTrigger" not in flags.PhysVal.IDTPM.currentTrkAna.RefType ) ):
104 kwargs.setdefault(
"ChainNames", flags.PhysVal.IDTPM.currentTrkAna.ChainNames )
106 kwargs.setdefault(
"plotTrackParameters", flags.PhysVal.IDTPM.currentTrkAna.plotTrackParameters )
107 kwargs.setdefault(
"plotTrackMultiplicities", flags.PhysVal.IDTPM.currentTrkAna.plotTrackMultiplicities )
108 kwargs.setdefault(
"plotEfficiencies", flags.PhysVal.IDTPM.currentTrkAna.plotEfficiencies )
109 kwargs.setdefault(
"plotTechnicalEfficiencies", flags.PhysVal.IDTPM.currentTrkAna.plotTechnicalEfficiencies )
110 kwargs.setdefault(
"plotResolutions", flags.PhysVal.IDTPM.currentTrkAna.plotResolutions )
111 kwargs.setdefault(
"plotFakeRates", flags.PhysVal.IDTPM.currentTrkAna.plotFakeRates )
112 kwargs.setdefault(
"unlinkedAsFakes", flags.PhysVal.IDTPM.currentTrkAna.unlinkedAsFakes )
113 kwargs.setdefault(
"plotDuplicateRates", flags.PhysVal.IDTPM.currentTrkAna.plotDuplicateRates )
114 kwargs.setdefault(
"plotHitsOnTracks", flags.PhysVal.IDTPM.currentTrkAna.plotHitsOnTracks )
115 kwargs.setdefault(
"plotHitsOnTracksReference", flags.PhysVal.IDTPM.currentTrkAna.plotHitsOnTracksReference )
116 kwargs.setdefault(
"plotHitsOnMatchedTracks", flags.PhysVal.IDTPM.currentTrkAna.plotHitsOnMatchedTracks )
117 kwargs.setdefault(
"plotHitsOnFakeTracks", flags.PhysVal.IDTPM.currentTrkAna.plotHitsOnFakeTracks )
118 kwargs.setdefault(
"plotOfflineElectrons", flags.PhysVal.IDTPM.currentTrkAna.plotOfflineElectrons )
119 kwargs.setdefault(
"ResolutionMethod", flags.PhysVal.IDTPM.currentTrkAna.ResolutionMethod )
120 kwargs.setdefault(
"isITk", flags.Detector.GeometryITk )
122 kwargs.setdefault(
"EtaBins", flags.Tracking.ITkMainPass.etaBins
if flags.Detector.GeometryITk
else [-1, 9999.])
123 kwargs.setdefault(
"MinSilHits", flags.Tracking.ITkMainPass.minClusters
if flags.Detector.GeometryITk
else [flags.Tracking.MainPass.minClusters])
125 trkAnaSvc = CompFactory.TrackAnalysisDefinitionSvc( name, **kwargs )
126 acc.addService( trkAnaSvc )
132 Main IDTPM tool instance CA-based configuration
136 kwargs.setdefault(
"OfflineTrkParticleContainerName",
137 flags.PhysVal.IDTPM.currentTrkAna.OfflineTrkKey )
138 kwargs.setdefault(
"TruthParticleContainerName",
139 flags.PhysVal.IDTPM.currentTrkAna.TruthPartKey )
141 kwargs.setdefault(
"AnaTag", flags.PhysVal.IDTPM.currentTrkAna.anaTag )
143 if flags.Output.doWriteAOD_IDTPM :
144 kwargs.setdefault(
"writeOut",
True )
145 kwargs.setdefault(
"TrkAnaInfoKey",
146 "TrkAnaInfo"+flags.PhysVal.IDTPM.currentTrkAna.anaTag )
148 if "TrackAnalysisInfoWriteTool" not in kwargs :
149 kwargs.setdefault(
"TrackAnalysisInfoWriteTool", acc.popToolsAndMerge(
151 name=
"TrackAnalysisInfoWriteTool"+flags.PhysVal.IDTPM.currentTrkAna.anaTag ) ) )
155 name=
"TrkAnaDefSvc"+flags.PhysVal.IDTPM.currentTrkAna.anaTag ) )
159 name=
"PlotsDefSvc"+flags.PhysVal.IDTPM.currentTrkAna.anaTag ) )
163 if ( (
"Truth" in flags.PhysVal.IDTPM.currentTrkAna.RefType )
or
164 (
"Truth" in flags.PhysVal.IDTPM.currentTrkAna.TestType ) ):
165 from InDetTrackPerfMon.InDetAlgorithmConfig
import TruthHitDecoratorAlgCfg
169 if ( ( flags.PhysVal.IDTPM.currentTrkAna.SelectOfflineObject )
and
170 (
"Truth" not in flags.PhysVal.IDTPM.currentTrkAna.SelectOfflineObject ) ):
171 from InDetTrackPerfMon.InDetAlgorithmConfig
import OfflineObjectDecoratorAlgCfg
175 if "TrackQualitySelectionTool" not in kwargs:
176 from InDetTrackPerfMon.InDetSelectionConfig
import TrackQualitySelectionToolCfg
177 kwargs.setdefault(
"TrackQualitySelectionTool", acc.popToolsAndMerge(
179 name=
"TrackQualitySelectionTool"+flags.PhysVal.IDTPM.currentTrkAna.anaTag ) ) )
181 if ( (
"Trigger" in flags.PhysVal.IDTPM.currentTrkAna.TestType )
or
182 (
"Trigger" in flags.PhysVal.IDTPM.currentTrkAna.RefType ) ):
184 kwargs.setdefault(
"TriggerTrkParticleContainerName",
185 flags.PhysVal.IDTPM.currentTrkAna.TrigTrkKey )
187 if (
"EFTrigger" not in flags.PhysVal.IDTPM.currentTrkAna.TestType
and "EFTrigger" not in flags.PhysVal.IDTPM.currentTrkAna.RefType ):
188 if "TrigDecisionTool" not in kwargs:
189 from TrigDecisionTool.TrigDecisionToolConfig
import TrigDecisionToolCfg
190 kwargs.setdefault(
"TrigDecisionTool",
193 if "RoiSelectionTool" not in kwargs:
194 from InDetTrackPerfMon.InDetSelectionConfig
import RoiSelectionToolCfg
195 kwargs.setdefault(
"RoiSelectionTool", acc.popToolsAndMerge(
197 name=
"RoiSelectionTool"+flags.PhysVal.IDTPM.currentTrkAna.anaTag ) ) )
199 if "TrackRoiSelectionTool" not in kwargs:
200 from InDetTrackPerfMon.InDetSelectionConfig
import TrackRoiSelectionToolCfg
201 kwargs.setdefault(
"TrackRoiSelectionTool", acc.popToolsAndMerge(
203 name=
"TrackRoiSelectionTool"+flags.PhysVal.IDTPM.currentTrkAna.anaTag ) ) )
205 if "TrackMatchingTool" not in kwargs:
206 from InDetTrackPerfMon.InDetMatchingConfig
import TrackMatchingToolCfg
208 if matchToolCfg
is not None :
209 kwargs.setdefault(
"doMatch",
True )
210 kwargs.setdefault(
"TrackMatchingTool", acc.popToolsAndMerge( matchToolCfg ) )
212 acc.setPrivateTools( CompFactory.InDetTrackPerfMonTool( name, **kwargs ) )
218 CA-based configuration of all tool instances (= TrackAnalyses)
220 log = logging.getLogger(
"InDetTrackPerfMonCfg" )
226 for trkAnaName
in flags.PhysVal.IDTPM.trkAnaNames :
228 flags_thisTrkAna = flags.cloneAndReplace(
"PhysVal.IDTPM.currentTrkAna",
229 "PhysVal.IDTPM."+trkAnaName )
231 if flags_thisTrkAna.PhysVal.IDTPM.currentTrkAna.enabled:
232 log.debug(
"Scheduling TrackAnalysis: %s",
233 flags_thisTrkAna.PhysVal.IDTPM.currentTrkAna.anaTag )
237 name=
"InDetTrackPerfMonTool"+
238 flags_thisTrkAna.PhysVal.IDTPM.currentTrkAna.anaTag ) ) )
240 from PhysValMonitoring.PhysValMonitoringConfig
import PhysValMonitoringCfg
244 if flags.Output.doWriteAOD_IDTPM :
245 from InDetTrackPerfMon.InDetOutputConfig
import InDetOutputCfg