ATLAS Offline Software
AFP_LocReco.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 
3 #==============================================================
4 # Job options file for the AFP_LocReco package
5 #==============================================================
6 
7 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
8 from AthenaConfiguration.ComponentFactory import CompFactory
9 from AthenaConfiguration.Enums import Format
10 from IOVDbSvc.IOVDbSvcConfig import addFolders
11 from TrigEDMConfig.TriggerEDM import recordable
12 
13 def AFP_LocReco_SiD_Cfg(flags, kwargs={}):
14 
15  # prepare track reconstruction algorithm tools - one for each station
16  kalmanTool0 = CompFactory.AFPSiDBasicKalmanTool("AFPSiDBasicKalmanTool0", stationID=0, **kwargs)
17 
18  # number of layers in each station, size of the vector determines number of stations
19  # kalmanTool1.numberOfLayersInStation = 3
20 
21  # Maximal distance at which cluster can be joined to the track
22  # kalmanTool1.maxAllowedDistance = 10
23 
24  # Minimal number of clusters in track. If there are less clusters track is rejected
25  # kalmanTool1.minClustersNumber = 3
26 
27  kalmanTool1 = CompFactory.AFPSiDBasicKalmanTool("AFPSiDBasicKalmanTool1", stationID=1, **kwargs)
28  kalmanTool2 = CompFactory.AFPSiDBasicKalmanTool("AFPSiDBasicKalmanTool2", stationID=2, **kwargs)
29  kalmanTool3 = CompFactory.AFPSiDBasicKalmanTool("AFPSiDBasicKalmanTool3", stationID=3, **kwargs)
30 
31  # it's also possible to have the same track reco tool as in AFPAnalysisToolbox
32  # linRegTool0 = CompFactory.AFPSiDLinRegTool("AFPSiDLinRegTool0", stationID=0, **kwargs)
33  # linRegTool1 = CompFactory.AFPSiDLinRegTool("AFPSiDLinRegTool1", stationID=1, **kwargs)
34  # linRegTool2 = CompFactory.AFPSiDLinRegTool("AFPSiDLinRegTool2", stationID=2, **kwargs)
35  # linRegTool3 = CompFactory.AFPSiDLinRegTool("AFPSiDLinRegTool3", stationID=3, **kwargs)
36 
37  kalmanToolsList=[kalmanTool0, kalmanTool1, kalmanTool2, kalmanTool3]
38 
39  # collect all output names and make a list with unique names for write handle keys; if this goes wrong AFP_SIDLocRecoTool::initialize() will complain
40  outputKalmanList=[]
41  for kalmanTool in kalmanToolsList:
42  try:
43  # in case the "tracksContainerName" is set
44  contName=kalmanTool.tracksContainerName
45  except AttributeError:
46  # in case the "tracksContainerName" is not set
47  contName=kalmanTool.getDefaultProperty("tracksContainerName")
48  if contName not in outputKalmanList:
49  outputKalmanList.append(contName)
50 
51  # prepare track reco tool
52  trackRecoTool = CompFactory.AFP_SIDLocRecoTool("AFP_SIDLocRecoTool", RecoToolsList=kalmanToolsList, AFPTrackContainerList=outputKalmanList )
53 
54  # actually setup the track reco
55  acc = ComponentAccumulator()
56  acc.addEventAlgo(CompFactory.AFP_SIDLocReco("AFP_SIDLocReco", recoTool = trackRecoTool))
57 
58  return acc
59 
60 
61 def AFP_LocReco_TD_Cfg(flags, kwargs={}):
62 
63  acc = ComponentAccumulator()
64 
65  if flags.Input.isMC:
66  # if other tags are desired, they can be set also in postExec
67  acc.merge(addFolders(flags, "/FWD/AFP/ToFParameters/Local<tag>AFPMCToFLoc-ideal-01</tag>", 'FWD_OFL', className='CondAttrListCollection', db='OFLP200'))
68  tofLocParamTool = CompFactory.getComp("AFP::ToFLocParamDBTool")("ToFLocParamDBTool", loc_param_key="/FWD/AFP/ToFParameters/Local")
69  else:
70  acc.merge(addFolders(flags, "/FWD/Onl/AFP/ToFParameters/Local<tag>AFPToFLoc-01</tag>", 'FWD_ONL', className='CondAttrListCollection', db='CONDBR2'))
71  tofLocParamTool = CompFactory.getComp("AFP::ToFLocParamDBTool")("ToFLocParamDBTool", loc_param_key="/FWD/Onl/AFP/ToFParameters/Local")
72 
73  basicTool0 = CompFactory.getComp("AFPTDBasicTool")("AFPTDBasicTool0", stationID=0, tofLocParamDBTool=tofLocParamTool, **kwargs)
74  basicTool3 = CompFactory.getComp("AFPTDBasicTool")("AFPTDBasicTool3", stationID=3, tofLocParamDBTool=tofLocParamTool, **kwargs)
75 
76  if flags.Input.Format is Format.POOL:
77  if "AFPToFHitContainer" not in flags.Input.Collections:
78  basicTool0.AFPToFHitContainerKey=""
79  basicTool3.AFPToFHitContainerKey=""
80  else:
81  from SGComps.SGInputLoaderConfig import SGInputLoaderCfg
82  acc.merge(SGInputLoaderCfg(flags, Load={('xAOD::AFPToFHitContainer' , 'StoreGateSvc+AFPToFHitContainer')}))
83 
84  basicToolsList=[basicTool0, basicTool3]
85 
86  # collect all output names and make a list with unique names for write handle keys; if this goes wrong AFP_TDLocRecoTool::initialize() will complain
87  outputBasicList=[]
88  for basicTool in basicToolsList:
89  contName=getattr(basicTool, "tracksContainerName", basicTool.getDefaultProperty("tracksContainerName"))
90  if contName not in outputBasicList:
91  outputBasicList.append(contName)
92 
93  # prepare track reco tool
94  ToFtrackRecoTool = CompFactory.AFP_TDLocRecoTool("AFP_TDLocRecoTool", RecoToolsList=basicToolsList, AFPToFTrackContainerList=outputBasicList )
95 
96  # actually setup the ToF track reco
97  acc.addEventAlgo(CompFactory.AFP_TDLocReco("AFP_TDLocReco", recoTool=ToFtrackRecoTool))
98 
99  return acc
100 
101 
103  from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
104  acc = ComponentAccumulator()
105  acc.merge(AFP_LocReco_SiD_Cfg(flags, {"tracksContainerName": recordable("HLT_AFPTrackContainer"), "AFPSiHitsClusterContainerKey": "HLT_AFPSiHitsClusterContainer"}))
106  AFP_SID = acc.getEventAlgo("AFP_SIDLocReco")
107 
108  from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool
109 
110  monTool_AFP_SIDLocRecoTool = GenericMonitoringTool(flags, "MonTool_AFP_SIDLocRecoTool")
111  monTool_AFP_SIDLocRecoTool.defineHistogram( 'TrkSize', path='EXPERT', type='TH1F', title='AFP tracks size',xbins=50, xmin=0, xmax=50 )
112  AFP_SID.recoTool.MonTool = monTool_AFP_SIDLocRecoTool
113 
114  for i, kalmanTool in enumerate(AFP_SID.recoTool.RecoToolsList):
115  monTool_AFP_BasicKalman = GenericMonitoringTool(flags, "MonTool_AFP_"+kalmanTool.getName())
116 
117  monTool_AFP_BasicKalman.defineHistogram( 'TrkStationID', path='EXPERT', type='TH1F', title='Track station ID',xbins=4, xmin=0, xmax=4, cutmask='TrkMask' )
118  monTool_AFP_BasicKalman.defineHistogram( 'TrkXLocal', path='EXPERT', type='TH1F', title='Track xLocal',xbins=100, xmin=-200, xmax=200, cutmask='TrkMask' )
119  monTool_AFP_BasicKalman.defineHistogram( 'TrkYLocal', path='EXPERT', type='TH1F', title='Track yLocal',xbins=100, xmin=-30, xmax=30, cutmask='TrkMask' )
120  monTool_AFP_BasicKalman.defineHistogram( 'TrkZLocal', path='EXPERT', type='TH1F', title='Track zLocal',xbins=100, xmin=-500000, xmax=500000, cutmask='TrkMask' )
121  monTool_AFP_BasicKalman.defineHistogram( 'TrkXSlope', path='EXPERT', type='TH1F', title='Track x slope',xbins=100, xmin=-0.5, xmax=0.5, cutmask='TrkMask' )
122  monTool_AFP_BasicKalman.defineHistogram( 'TrkYSlope', path='EXPERT', type='TH1F', title='Track y slope',xbins=100, xmin=-0.5, xmax=0.5, cutmask='TrkMask' )
123  monTool_AFP_BasicKalman.defineHistogram( 'TrkNClusters', path='EXPERT', type='TH1F', title='Track number of clusters',xbins=100, xmin=0, xmax=100, cutmask='TrkMask' )
124  monTool_AFP_BasicKalman.defineHistogram( 'TrkNHoles', path='EXPERT', type='TH1F', title='Track number of holes',xbins=100, xmin=0, xmax=100, cutmask='TrkMask' )
125  monTool_AFP_BasicKalman.defineHistogram( 'TrkChi2', path='EXPERT', type='TH1F', title='Track chi2',xbins=50, xmin=0, xmax=10, cutmask='TrkMask' )
126 
127  AFP_SID.recoTool.RecoToolsList[i].MonTool = monTool_AFP_BasicKalman
128 
129  return acc
130 
132  from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
133  acc = ComponentAccumulator()
134 
135  acc.merge(AFP_LocReco_TD_Cfg(flags, {"tracksContainerName": recordable("HLT_AFPToFTrackContainer")}))
136 
137  return acc
138 
AFP_LocReco.AFP_LocReco_TD_HLT
def AFP_LocReco_TD_HLT(flags)
Definition: AFP_LocReco.py:131
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
AFP_LocReco.AFP_LocReco_TD_Cfg
def AFP_LocReco_TD_Cfg(flags, kwargs={})
Definition: AFP_LocReco.py:61
GenericMonitoringTool
Definition: GenericMonitoringTool.h:53
SGInputLoaderConfig.SGInputLoaderCfg
def SGInputLoaderCfg(flags, Load=None, **kwargs)
Definition: SGInputLoaderConfig.py:7
python.IOVDbSvcConfig.addFolders
def addFolders(flags, folderStrings, detDb=None, className=None, extensible=False, tag=None, db=None, modifiers='')
Definition: IOVDbSvcConfig.py:72
AFP_LocReco.AFP_LocReco_SiD_Cfg
def AFP_LocReco_SiD_Cfg(flags, kwargs={})
Definition: AFP_LocReco.py:13
AFP_LocReco.AFP_LocReco_SiD_HLT
def AFP_LocReco_SiD_HLT(flags)
Definition: AFP_LocReco.py:102
python.TriggerEDM.recordable
def recordable(arg, runVersion=3)
Definition: TriggerEDM.py:30