ATLAS Offline Software
TRT_ElectronPidToolsConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
3 from AthenaConfiguration.ComponentFactory import CompFactory
4 
5 
6 def TRT_LocalOccupancyCfg(flags, name="TRT_LocalOccupancy", **kwargs):
8  from TRT_ConditionsServices.TRT_ConditionsServicesConfig import TRT_CalDbToolCfg
9  CalDbTool = acc.popToolsAndMerge(TRT_CalDbToolCfg(flags))
10  acc.addPublicTool(CalDbTool) # public as it is has many clients to save some memory
11  kwargs.setdefault("TRTCalDbTool", CalDbTool)
12 
13  from TRT_ConditionsAlgs.TRT_ConditionsAlgsConfig import TRTStrawStatusCondAlgCfg, TRTStrawCondAlgCfg
14  acc.merge(TRTStrawStatusCondAlgCfg(flags))
15  acc.merge(TRTStrawCondAlgCfg(flags))
16 
17  kwargs.setdefault("isTrigger", False)
18 
19  if "TRT_DriftCircleCollection" not in kwargs:
20  # TODO: Drift circles
21  pass
22 
23  acc.setPrivateTools(CompFactory.InDet.TRT_LocalOccupancy(name, **kwargs))
24  return acc
25 
26 def TrigTRT_LocalOccupancyCfg(flags, name="TrigTRT_LocalOccupancy", **kwargs):
27  acc = ComponentAccumulator()
28 
29  kwargs.setdefault("isTrigger", True)
30  kwargs.setdefault("TRT_DriftCircleCollection", "TRT_TrigDriftCircles")
31 
32  acc.setPrivateTools(acc.popToolsAndMerge(TRT_LocalOccupancyCfg(flags,name,**kwargs)))
33  return acc
34 
35 
36 def TRT_OverlayLocalOccupancyCfg(flags, name="TRT_OverlayLocalOccupancy", **kwargs):
37  """Return a ComponentAccumulator for overlay TRT_LocalOccupancy Tool"""
38  kwargs.setdefault("TRT_DriftCircleCollection", "")
39  from TRT_ConditionsAlgs.TRT_ConditionsAlgsConfig import TRTStrawStatusCondAlgCfg
40  acc = TRTStrawStatusCondAlgCfg(flags, StrawStatusHTSummaryWriteKey="")
41  acc.setPrivateTools(acc.popToolsAndMerge(TRT_LocalOccupancyCfg(flags, name, **kwargs)))
42  return acc
43 
44 
45 def TRTOccupancyIncludeCfg(flags, name="TRTOccupancyInclude", **kwargs):
46  acc = ComponentAccumulator()
47  tool = acc.popToolsAndMerge(TRT_LocalOccupancyCfg(flags))
48  acc.addPublicTool(tool)
49  kwargs.setdefault("TRT_LocalOccupancyTool", tool)
50  acc.addEventAlgo(CompFactory.TRTOccupancyInclude(name, **kwargs))
51  return acc
52 
53 
54 def __TRT_dEdxToolBaseCfg(flags, name, **kwargs):
55  """internal function to avoid code duplication,
56  it does not deal with LumiBlockMuWriterCfg dependancy correctly
57  """
58 
59  from TRT_ConditionsAlgs.TRT_ConditionsAlgsConfig import TRTToTCondAlgCfg
60  acc = TRTToTCondAlgCfg(flags)
61 
62  kwargs.setdefault("TRT_dEdx_isData", not flags.Input.isMC)
63 
64  acc.setPrivateTools(CompFactory.TRT_ToT_dEdx(name,**kwargs))
65  return acc
66 
67 
68 def TRT_dEdxToolCfg(flags, name="TRT_dEdxTool", **kwargs):
69  acc = ComponentAccumulator()
70 
71  if not flags.Input.isMC:
72  from LumiBlockComps.LumiBlockMuWriterConfig import LumiBlockMuWriterCfg
73  acc.merge(LumiBlockMuWriterCfg(flags))
74 
75  if "TRT_LocalOccupancyTool" not in kwargs:
76  kwargs.setdefault("TRT_LocalOccupancyTool", acc.popToolsAndMerge(
77  TRT_LocalOccupancyCfg(flags)))
78 
79  if "AssociationTool" not in kwargs:
80  from InDetConfig.InDetAssociationToolsConfig import (
81  InDetPrdAssociationToolCfg)
82  kwargs.setdefault("AssociationTool", acc.popToolsAndMerge(
84 
85  from AthenaConfiguration.Enums import ProductionStep
86  if flags.Common.ProductionStep in [ProductionStep.MinbiasPreprocessing]:
87  kwargs.setdefault("averageInteractionsPerCrossingKey", f"{flags.Overlay.BkgPrefix}EventInfo.averageInteractionsPerCrossing")
88 
89  acc.setPrivateTools(acc.popToolsAndMerge(
90  __TRT_dEdxToolBaseCfg(flags, name, **kwargs)))
91  return acc
92 
93 
94 def TrigTRT_dEdxToolCfg(flags, name="TrigTRT_dEdxTool", **kwargs):
95  """trigger version should not add LumiBlockMuWriterCfg to views as it is scheduled globally"""
96 
97  acc = ComponentAccumulator()
98 
99  if "TRT_LocalOccupancyTool" not in kwargs:
100  kwargs.setdefault("TRT_LocalOccupancyTool", acc.popToolsAndMerge(TrigTRT_LocalOccupancyCfg(flags)))
101 
102  if "AssociationTool" not in kwargs:
103  from InDetConfig.InDetAssociationToolsConfig import TrigPrdAssociationToolCfg
104  kwargs.setdefault("AssociationTool", acc.popToolsAndMerge(TrigPrdAssociationToolCfg(flags)))
105 
106  acc.setPrivateTools(acc.popToolsAndMerge(__TRT_dEdxToolBaseCfg(flags, name, **kwargs)))
107  return acc
108 
109 def TRT_ElectronPidToolCfg(flags, name="TRT_ElectronPidTool", **kwargs):
110  from TRT_ConditionsAlgs.TRT_ConditionsAlgsConfig import TRTHTCondAlgCfg, TRTPIDNNCondAlgCfg
111  acc = TRTHTCondAlgCfg(flags)
112 
113  kwargs.setdefault("CalculateNNPid", True)
114 
115  if kwargs["CalculateNNPid"]:
116  acc.merge(TRTPIDNNCondAlgCfg(flags))
117 
118  if "TRTStrawSummaryTool" not in kwargs:
119  from TRT_ConditionsServices.TRT_ConditionsServicesConfig import TRT_StrawStatusSummaryToolCfg
120  StrawStatusTool = acc.popToolsAndMerge(TRT_StrawStatusSummaryToolCfg(flags))
121  acc.addPublicTool(StrawStatusTool) # public as it is has many clients to save some memory
122  kwargs.setdefault("TRTStrawSummaryTool", StrawStatusTool)
123 
124  if "TRT_LocalOccupancyTool" not in kwargs:
125  kwargs.setdefault("TRT_LocalOccupancyTool", acc.popToolsAndMerge(TRT_LocalOccupancyCfg(flags)))
126 
127  if "TRT_ToT_dEdx_Tool" not in kwargs:
128  kwargs.setdefault("TRT_ToT_dEdx_Tool", acc.popToolsAndMerge(TRT_dEdxToolCfg(flags)))
129 
130  acc.setPrivateTools(CompFactory.InDet.TRT_ElectronPidToolRun2(name, **kwargs))
131  return acc
132 
133 def TrigTRT_ElectronPidToolCfg(flags, name="InDetTrigTRT_ElectronPidTool", **kwargs):
134 
135  acc = ComponentAccumulator()
136 
137  from TRT_ConditionsServices.TRT_ConditionsServicesConfig import TRT_StrawStatusSummaryToolCfg
138  StrawStatusTool = acc.popToolsAndMerge(TRT_StrawStatusSummaryToolCfg(flags,name="InDetTrigTRTStrawStatusSummaryTool"))
139  acc.addPublicTool(StrawStatusTool) # public as it is has many clients to save some memory
140  kwargs.setdefault("TRTStrawSummaryTool", StrawStatusTool)
141 
142  kwargs.setdefault("TRT_LocalOccupancyTool", acc.popToolsAndMerge(TrigTRT_LocalOccupancyCfg(flags)))
143  kwargs.setdefault("TRT_ToT_dEdx_Tool", acc.popToolsAndMerge(TrigTRT_dEdxToolCfg(flags)))
144 
145  kwargs.setdefault("CalculateNNPid", False)
146 
147  acc.setPrivateTools(acc.popToolsAndMerge(TRT_ElectronPidToolCfg(flags,name,**kwargs)))
148  return acc
149 
150 def GSFBuildTRT_ElectronPidToolCfg(flags, name="GSFBuildTRT_ElectronPidTool", isTrigger=False, **kwargs):
151  kwargs.setdefault("CalculateNNPid", False)
152  kwargs.setdefault("MinimumTrackPtForNNPid", 0.)
153  if isTrigger:
154  return TrigTRT_ElectronPidToolCfg(flags, name="TrigGSFBuildTRT_ElectronPidTool", **kwargs)
155  else:
156  return TRT_ElectronPidToolCfg(flags, name, **kwargs)
157 
158 
python.TRT_ElectronPidToolsConfig.TRT_dEdxToolCfg
def TRT_dEdxToolCfg(flags, name="TRT_dEdxTool", **kwargs)
Definition: TRT_ElectronPidToolsConfig.py:68
python.TRT_ElectronPidToolsConfig.TrigTRT_ElectronPidToolCfg
def TrigTRT_ElectronPidToolCfg(flags, name="InDetTrigTRT_ElectronPidTool", **kwargs)
Definition: TRT_ElectronPidToolsConfig.py:133
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.TRT_ElectronPidToolsConfig.TrigTRT_dEdxToolCfg
def TrigTRT_dEdxToolCfg(flags, name="TrigTRT_dEdxTool", **kwargs)
Definition: TRT_ElectronPidToolsConfig.py:94
python.TRT_ElectronPidToolsConfig.TRTOccupancyIncludeCfg
def TRTOccupancyIncludeCfg(flags, name="TRTOccupancyInclude", **kwargs)
Definition: TRT_ElectronPidToolsConfig.py:45
python.TRT_ConditionsAlgsConfig.TRTToTCondAlgCfg
def TRTToTCondAlgCfg(flags, name="TRTToTCondAlg", **kwargs)
Definition: TRT_ConditionsAlgsConfig.py:82
python.InDetAssociationToolsConfig.InDetPrdAssociationToolCfg
def InDetPrdAssociationToolCfg(flags, name='InDetPrdAssociationTool', **kwargs)
Definition: InDetAssociationToolsConfig.py:14
python.TRT_ElectronPidToolsConfig.TRT_LocalOccupancyCfg
def TRT_LocalOccupancyCfg(flags, name="TRT_LocalOccupancy", **kwargs)
Definition: TRT_ElectronPidToolsConfig.py:6
python.TRT_ElectronPidToolsConfig.__TRT_dEdxToolBaseCfg
def __TRT_dEdxToolBaseCfg(flags, name, **kwargs)
Definition: TRT_ElectronPidToolsConfig.py:54
python.TRT_ConditionsServicesConfig.TRT_StrawStatusSummaryToolCfg
def TRT_StrawStatusSummaryToolCfg(flags, name="TRT_StrawStatusSummaryTool", forceLegacyAccess=False, **kwargs)
Definition: TRT_ConditionsServicesConfig.py:23
python.TRT_ConditionsAlgsConfig.TRTPIDNNCondAlgCfg
def TRTPIDNNCondAlgCfg(flags, name="TRTPIDNNCondAlg", **kwargs)
Definition: TRT_ConditionsAlgsConfig.py:103
python.LumiBlockMuWriterConfig.LumiBlockMuWriterCfg
def LumiBlockMuWriterCfg(flags, name='LumiBlockMuWriter', seqName="AthAlgSeq")
Definition: LumiBlockMuWriterConfig.py:14
python.TRT_ConditionsAlgsConfig.TRTHTCondAlgCfg
def TRTHTCondAlgCfg(flags, name="TRTHTCondAlg", **kwargs)
Definition: TRT_ConditionsAlgsConfig.py:94
python.TRT_ElectronPidToolsConfig.TrigTRT_LocalOccupancyCfg
def TrigTRT_LocalOccupancyCfg(flags, name="TrigTRT_LocalOccupancy", **kwargs)
Definition: TRT_ElectronPidToolsConfig.py:26
python.TRT_ElectronPidToolsConfig.GSFBuildTRT_ElectronPidToolCfg
def GSFBuildTRT_ElectronPidToolCfg(flags, name="GSFBuildTRT_ElectronPidTool", isTrigger=False, **kwargs)
Definition: TRT_ElectronPidToolsConfig.py:150
python.TRT_ElectronPidToolsConfig.TRT_OverlayLocalOccupancyCfg
def TRT_OverlayLocalOccupancyCfg(flags, name="TRT_OverlayLocalOccupancy", **kwargs)
Definition: TRT_ElectronPidToolsConfig.py:36
python.InDetAssociationToolsConfig.TrigPrdAssociationToolCfg
def TrigPrdAssociationToolCfg(flags, name='InDetTrigPrdAssociationTool', **kwargs)
Definition: InDetAssociationToolsConfig.py:22
python.TRT_ConditionsAlgsConfig.TRTStrawStatusCondAlgCfg
def TRTStrawStatusCondAlgCfg(flags, name="TRTStrawStatusCondAlg", **kwargs)
Definition: TRT_ConditionsAlgsConfig.py:29
python.TRT_ConditionsAlgsConfig.TRTStrawCondAlgCfg
def TRTStrawCondAlgCfg(flags, name="TRTStrawCondAlg", **kwargs)
Definition: TRT_ConditionsAlgsConfig.py:46
python.TRT_ElectronPidToolsConfig.TRT_ElectronPidToolCfg
def TRT_ElectronPidToolCfg(flags, name="TRT_ElectronPidTool", **kwargs)
Definition: TRT_ElectronPidToolsConfig.py:109
python.TRT_ConditionsServicesConfig.TRT_CalDbToolCfg
def TRT_CalDbToolCfg(flags, name="TRT_CalDbTool", **kwags)
Definition: TRT_ConditionsServicesConfig.py:9