ATLAS Offline Software
AccumulateConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 
3 # File: InDetAlignConfig/python/AccumulateConfig.py
4 # Author: David Brunner (david.brunner@cern.ch), Thomas Strebler (thomas.strebler@cern.ch)
5 
6 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
7 from AthenaConfiguration.ComponentFactory import CompFactory
8 
9 
10 
11 
12 def ConstrainedTrackProviderCfg(flags, name="ConstrainedTrackProvider", **kwargs):
13  cfg = ComponentAccumulator()
14 
15  if "TrackFitter" not in kwargs:
16  from TrkConfig.CommonTrackFitterConfig import InDetTrackFitterCfg
17  kwargs.setdefault("TrackFitter", cfg.addPublicTool(cfg.popToolsAndMerge(
18  InDetTrackFitterCfg(flags, FillDerivativeMatrix = True))))
19 
20  kwargs.setdefault("MinPt", 0.)
21  from AthenaCommon.Utils.unixtools import find_datafile
22  kwargs.setdefault("MomentumConstraintFileName", find_datafile("InDetAlign/nullmap.root"))
23  kwargs.setdefault("MomentumConstraintHistName", "LambdaCorrectionVsEtaPhi")
24  kwargs.setdefault("ScalePMapToGeV", True)
25  kwargs.setdefault("ReduceConstraintUncertainty", 100.)
26  kwargs.setdefault("z0ConstraintFileName", "")
27  kwargs.setdefault("z0ConstraintHistName", "z0CorrectionVsEtaPhi")
28  kwargs.setdefault("d0ConstraintFileName", "")
29  kwargs.setdefault("d0ConstraintHistName", "d0CorrectionVsEtaPhi")
30  kwargs.setdefault("UseConstraintError", False)
31  kwargs.setdefault("UseConstrainedTrkOnly", True)
32 
33  cfg.setPrivateTools(CompFactory.Trk.ConstrainedTrackProvider(name, **kwargs))
34  return cfg
35 
36 
37 def AnalyticalDerivCalcToolCfg(flags, name="AnalyticalDerivCalcTool", **kwargs):
38  cfg = ComponentAccumulator()
39 
40  if "AlignModuleTool" not in kwargs:
41  from InDetAlignConfig.IDAlignToolsConfig import InDetAlignModuleToolCfg
42  kwargs.setdefault("AlignModuleTool", cfg.addPublicTool(cfg.popToolsAndMerge(
43  InDetAlignModuleToolCfg(flags))))
44 
45  kwargs.setdefault("UseIntrinsicPixelError", True)
46  kwargs.setdefault("UseIntrinsicSCTError", True)
47  kwargs.setdefault("UseIntrinsicTRTError", True)
48 
49  cfg.setPrivateTools(CompFactory.Trk.AnalyticalDerivCalcTool(name, **kwargs))
50  return cfg
51 
52 
53 def AlignTrackDresserCfg(flags, name="AlignTrackDresser", **kwargs):
54  cfg = ComponentAccumulator()
55 
56  if "DerivCalcTool" not in kwargs:
57  kwargs.setdefault("DerivCalcTool", cfg.popToolsAndMerge(
59 
60  cfg.setPrivateTools(CompFactory.Trk.AlignTrackDresser(name, **kwargs))
61  return cfg
62 
63 
64 def SimpleIDNtupleToolCfg(flags, name="SimpleIDNtupleTool", **kwargs):
65  cfg = ComponentAccumulator()
66 
67  if "AlignModuleTool" not in kwargs:
68  from InDetAlignConfig.IDAlignToolsConfig import InDetAlignModuleToolCfg
69  kwargs.setdefault("AlignModuleTool", cfg.addPublicTool(cfg.popToolsAndMerge(
70  InDetAlignModuleToolCfg(flags))))
71 
72  if "TrackParticleCreatorTool" not in kwargs:
73  from TrkConfig.TrkParticleCreatorConfig import TrackParticleCreatorToolCfg
74  kwargs.setdefault("TrackParticleCreatorTool", cfg.popToolsAndMerge(
76 
77  cfg.setPrivateTools(CompFactory.InDet.SimpleIDNtupleTool(name, **kwargs))
78  return cfg
79 
80 
81 def AlignAlgCfg(flags, name="AlignAlgAccumulate", **kwargs):
82  cfg = ComponentAccumulator()
83 
84  if "GeometryManagerTool" not in kwargs:
85  from InDetAlignConfig.IDAlignToolsConfig import GeometryManagerToolCfg
86  kwargs.setdefault("GeometryManagerTool", cfg.addPublicTool(cfg.popToolsAndMerge(
87  GeometryManagerToolCfg(flags))))
88 
89  if "AlignTool" not in kwargs:
90  from InDetAlignConfig.IDAlignToolsConfig import AlignDBToolCfg
91  kwargs.setdefault("AlignTool", cfg.popToolsAndMerge(AlignDBToolCfg(flags)))
92 
93  kwargs.setdefault("TrackCollectionProvider", cfg.popToolsAndMerge(
95 
96  if "AlignTrackCreator" not in kwargs:
97  from InDetAlignConfig.IDAlignToolsConfig import AlignTrackCreatorCfg
98  kwargs.setdefault("AlignTrackCreator", cfg.popToolsAndMerge(
99  AlignTrackCreatorCfg(flags)))
100 
101  kwargs.setdefault("AlignTrackDresser", cfg.popToolsAndMerge(AlignTrackDresserCfg(flags)))
102 
103  if "AlignTrackPreProcessor" not in kwargs:
104  from InDetAlignConfig.IDAlignToolsConfig import BeamspotVertexPreProcessorCfg
105  kwargs.setdefault("AlignTrackPreProcessor", cfg.popToolsAndMerge(
107 
108  kwargs.setdefault("WriteNtuple", flags.InDet.Align.writeAlignNtuple)
109  if kwargs["WriteNtuple"]:
110  kwargs.setdefault("FillNtupleTool", cfg.popToolsAndMerge(SimpleIDNtupleToolCfg(flags)))
111  kwargs.setdefault("FileName", flags.InDet.Align.FileName)
112 
113  cfg.addEventAlgo(CompFactory.Trk.AlignAlg(name, **kwargs))
114  return cfg
115 
116 
117 def AlignTrackCollSplitterCfg(flags, name="AlignTrackCollSplitter", **kwargs):
118  cfg = ComponentAccumulator()
119  cfg.addEventAlgo(CompFactory.Trk.AlignTrackCollSplitter(name, **kwargs))
120  return cfg
121 
122 
123 def AccumulateCfg(flags, **kwargs):
124  cfg = AlignAlgCfg(flags)
125  cfg.merge(AlignTrackCollSplitterCfg(flags))
126 
127  if flags.InDet.Align.doMonitoring:
128  from InDetAlignmentMonitoringRun3.InDetAlignmentMonitoringRun3Config import (
129  InDetAlignmentMonitoringRun3Config)
130  cfg.merge(InDetAlignmentMonitoringRun3Config(flags))
131 
132  return cfg
IDAlignToolsConfig.AlignTrackCreatorCfg
def AlignTrackCreatorCfg(flags, name="AlignTrackCreator", **kwargs)
Definition: IDAlignToolsConfig.py:279
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
AccumulateConfig.ConstrainedTrackProviderCfg
def ConstrainedTrackProviderCfg(flags, name="ConstrainedTrackProvider", **kwargs)
--— Setup of Tools for Trk::AlignAlg --—##
Definition: AccumulateConfig.py:12
python.TrkParticleCreatorConfig.TrackParticleCreatorToolCfg
def TrackParticleCreatorToolCfg(flags, name="InDetxAODParticleCreatorTool", **kwargs)
InDet/ITk #####.
Definition: TrkParticleCreatorConfig.py:14
AccumulateConfig.AccumulateCfg
def AccumulateCfg(flags, **kwargs)
Definition: AccumulateConfig.py:123
python.CommonTrackFitterConfig.InDetTrackFitterCfg
def InDetTrackFitterCfg(flags, name='InDetTrackFitter', **kwargs)
InDet configs #####.
Definition: CommonTrackFitterConfig.py:10
AccumulateConfig.AlignTrackDresserCfg
def AlignTrackDresserCfg(flags, name="AlignTrackDresser", **kwargs)
Definition: AccumulateConfig.py:53
IDAlignToolsConfig.GeometryManagerToolCfg
def GeometryManagerToolCfg(flags, **kwargs)
Definition: IDAlignToolsConfig.py:206
AccumulateConfig.SimpleIDNtupleToolCfg
def SimpleIDNtupleToolCfg(flags, name="SimpleIDNtupleTool", **kwargs)
Definition: AccumulateConfig.py:64
AccumulateConfig.AlignTrackCollSplitterCfg
def AlignTrackCollSplitterCfg(flags, name="AlignTrackCollSplitter", **kwargs)
Definition: AccumulateConfig.py:117
IDAlignToolsConfig.InDetAlignModuleToolCfg
def InDetAlignModuleToolCfg(flags, name="InDetAlignModuleTool", **kwargs)
--— Geometry mangager tool config functions --—##
Definition: IDAlignToolsConfig.py:12
InDetAlignmentMonitoringRun3Config
Definition: InDetAlignmentMonitoringRun3Config.py:1
IDAlignToolsConfig.BeamspotVertexPreProcessorCfg
def BeamspotVertexPreProcessorCfg(flags, name="BeamspotVertexPreProcessor", **kwargs)
--— BeamspotVertexPreProcessor Setup --—##
Definition: IDAlignToolsConfig.py:297
AccumulateConfig.AlignAlgCfg
def AlignAlgCfg(flags, name="AlignAlgAccumulate", **kwargs)
Definition: AccumulateConfig.py:81
AccumulateConfig.AnalyticalDerivCalcToolCfg
def AnalyticalDerivCalcToolCfg(flags, name="AnalyticalDerivCalcTool", **kwargs)
Definition: AccumulateConfig.py:37
IDAlignToolsConfig.AlignDBToolCfg
def AlignDBToolCfg(flags, **kwargs)
Definition: IDAlignToolsConfig.py:220
python.Utils.unixtools.find_datafile
def find_datafile(fname, pathlist=None, access=os.R_OK)
pathresolver-like helper function --------------------------------------—
Definition: unixtools.py:67