ATLAS Offline Software
TrigT2CaloEgammaConfig.py
Go to the documentation of this file.
1 # Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
2 
3 from AthenaConfiguration.ComponentFactory import CompFactory
4 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
5 from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool
6 from TrigEDMConfig.TriggerEDM import recordable
7 from TrigT2CaloCalibration.EgammaCalibrationConfig import (EgammaHitsCalibrationBarrelConfig,
8  EgammaHitsCalibrationEndcapConfig,
9  EgammaGapCalibrationConfig,
10  EgammaTransitionRegionsConfig,
11  EgammaSshapeCalibrationBarrelConfig,
12  EgammaSshapeCalibrationEndcapConfig)
13 
14 _T2CaloEgamma_ExtraInputs = {
15  ('IRegSelLUTCondData', 'ConditionStore+RegSelLUTCondData_TTEM'),
16  ('IRegSelLUTCondData', 'ConditionStore+RegSelLUTCondData_TTHEC'),
17  ('IRegSelLUTCondData', 'ConditionStore+RegSelLUTCondData_TILE'),
18  ('IRegSelLUTCondData', 'ConditionStore+RegSelLUTCondData_FCALEM'),
19  ('IRegSelLUTCondData', 'ConditionStore+RegSelLUTCondData_FCALHAD'),
20  ('LArBadChannelCont' , 'ConditionStore+LArBadChannel')
21 }
22 
23 #local variable
24 from HLTSeeding.HLTSeedingConfig import mapThresholdToL1RoICollection
25 inputEDM = mapThresholdToL1RoICollection("FSNOSEED")
26 
27 def RingerReFexConfig(flags, name="RingerReMaker", RingerKey="FastCaloRings",
28  ClustersName="HLT_FastCaloEMClusters",**kwargs):
29 
30  from TrigT2CaloEgamma.RingerConstants import Layer
31  from TrigT2CaloEgamma.RingerConstants import DETID as det
32 
33  monTool = GenericMonitoringTool(flags, 'MonTool')
34  monTool.defineHistogram( "TIME_total", title="Total Time;time [us]",xbins=100, xmin=0, xmax=500,type='TH1F', path='EXPERT')
35  monTool.defineHistogram( "TIME_load_cells", title="Load Cells Time;time [us]",xbins=50, xmin=0, xmax=100,type='TH1F', path='EXPERT')
36 
37  _lenNRings = 7 # number of entries in NRings
38 
39  ringer = CompFactory.RingerReFex(
40  name = name,
41  EtaBins = [0.0000, 2.500], # bin pairs: min < eta <= max, PS,barrel,crack,endcap
42  RingerKey = RingerKey,
43  ClustersName = ClustersName,
44  GlobalCenter = False,
45  EtaSearchWindowSize = 0.1,
46  PhiSearchWindowSize = 0.1,
47  NRings = [8, 64, 8, 8, 4, 4, 4],
48  DeltaEta = [0.025, 0.003125, 0.025, 0.05, 0.1, 0.1, 0.1],
49  DeltaPhi = [0.098174770424681, 0.098174770424681, 0.024543692606170, 0.024543692606170,
50  0.098174770424681, 0.098174770424681, 0.098174770424681],
51  UseTile = True,
52  Detectors = [ [det.TTEM], [det.TTEM], [det.TTEM], [det.TTEM], [det.TTHEC, det.TILE],
53  [det.TTHEC, det.TTHEC, det.TILE], [det.TTHEC, det.TILE] ],
54  Samplings = [ [0] , [1] , [2] , [3] , [0 , -1 ],
55  [1 , 2 , -1 ] , [3 , -1 ] ],
56  Samples = [ [ Layer.PreSamplerB,Layer.PreSamplerE ], # TTEM:0
57  [ Layer.EMB1, Layer.EME1 ], # TTEM: 1
58  [ Layer.EMB2, Layer.EME2 ], # TTEM: 2
59  [ Layer.EMB3, Layer.EME3 ], # TTEM: 3
60  [ Layer.HEC0, Layer.TileBar0, Layer.TileGap2, Layer.TileExt0 ], # TTHEC: 0, TILE
61  [ Layer.HEC1, Layer.HEC2, Layer.TileBar1, Layer.TileGap0, Layer.TileExt1 ], # TTHEC: 1,2, TILE
62  [ Layer.HEC3, Layer.TileBar2, Layer.TileGap1, Layer.TileExt2 ] # TTHEC: 3, TILE
63  ],
64  DumpCells = flags.Trigger.egamma.dumpCellsFastCaloInfo,
65  DoNoiseThrRings = flags.Trigger.egamma.doNoiseThrRings,
66  NoiseFactor = flags.Trigger.egamma.sigmaNoiseFactor,
67  DoQuarter = [flags.Trigger.egamma.doQuarterRings]*_lenNRings,
68  DoEtaAxesDivision = [True]*_lenNRings,
69  DoPhiAxesDivision = [True]*_lenNRings,
70  MonTool = monTool)
71  for k, v in kwargs.items():
72  setattr(ringer,k,v)
73  return ringer
74 
75 #=======================================================================
76 
77 def AsymRingerReFexConfig(flags, name="AsymRingerReMaker"):
78  ringer = RingerReFexConfig(flags, name, RingerKey="FastCaloAsymRings")
79  ringer.DoQuarter = [True]*len(ringer.NRings),
80  return ringer
81 
82 #=======================================================================
83 
84 def t2CaloEgamma_AllCfg(flags, name="T2CaloEgamma_All",RoIs=inputEDM,ExtraInputs=set(), ClustersName="HLT_FastCaloEMClusters"):
85  acc = ComponentAccumulator()
86  tool = CompFactory.EgammaAllFex("EgammaAllFex",
87  IncludeHad=True,
88  ExtraInputs={('TileEMScale','ConditionStore+TileEMScale'),
89  ('TileBadChannels','ConditionStore+TileBadChannels')})
90  alg = CompFactory.T2CaloEgammaReFastAlgo(name,
91  IReAlgToolList= [tool],
92  EtaWidth = 0.1,
93  PhiWidth = 0.1,
94  ExtraInputs = _T2CaloEgamma_ExtraInputs)
95  alg.RoIs=RoIs
96  alg.ExtraInputs |= ExtraInputs
97  alg.ClustersName = recordable(ClustersName)
98  acc.addEventAlgo(alg)
99 
100  return acc
101 
102 #=======================================================================
103 
104 def t2CaloEgamma_AllEmCfg(flags, name="T2CaloEgamma_AllEm", RoIs=inputEDM, ExtraInputs=set(), ClustersName="HLT_FastCaloEMClusters"):
105  acc = ComponentAccumulator()
106  tool = CompFactory.EgammaAllFex("EgammaAllEmFex",
107  ExtraInputs={('TileEMScale','ConditionStore+TileEMScale'),
108  ('TileBadChannels','ConditionStore+TileBadChannels')})
109 
110  alg = CompFactory.T2CaloEgammaReFastAlgo(name,
111  IReAlgToolList= [tool],
112  EtaWidth = 0.1,
113  PhiWidth = 0.1,
114  ExtraInputs = _T2CaloEgamma_ExtraInputs)
115  alg.RoIs=RoIs
116  alg.ExtraInputs |= ExtraInputs
117  alg.ClustersName = recordable(ClustersName)
118  acc.addEventAlgo(alg)
119  return acc
120 
121 #=======================================================================
122 
123 def t2CaloEgamma_ReFastAlgoCfg(flags, name="T2CaloEgamma_ReFastAlgo", ClustersName="HLT_FastCaloEMClusters",
124  doRinger=False, RingerKey="HLT_FastCaloRinger", RoIs=inputEDM, ExtraInputs=set()):
125  acc = ComponentAccumulator()
126 
127  samp2 = CompFactory.EgammaReSamp2Fex("ReFaAlgoSamp2FexConfig",
128  MaxDetaHotCell=0.15, MaxDphiHotCell=0.15 )
129  samp1 = CompFactory.EgammaReSamp1Fex("ReFaAlgoSamp1FexConfig")
130  sampe = CompFactory.EgammaReEmEnFex("ReFaAlgoEmEnFexConfig")
131  samph = CompFactory.EgammaReHadEnFex("ReFaAlgoHadEnFexConfig",
132  ExtraInputs={('TileEMScale','ConditionStore+TileEMScale'),
133  ('TileBadChannels','ConditionStore+TileBadChannels')})
134  monTool = GenericMonitoringTool(flags, 'MonTool')
135  monTool.defineHistogram('TrigEMCluster_eT', path='EXPERT', type='TH1F', title="T2Calo Egamma E_T; E_T [ GeV ] ; Nclusters", xbins=80, xmin=0.0, xmax=140.0)
136  monTool.defineHistogram('TrigEMCluster_had1', path='EXPERT', type='TH1F', title="T2Calo Egamma had E_T samp1; had E_T samp1 [ GeV ] ; Nclusters", xbins=80, xmin=0.0, xmax=8.0)
137  monTool.defineHistogram('TrigEMCluster_eta', path='EXPERT', type='TH1F', title="T2Calo Egamma #eta; #eta ; Nclusters", xbins=100, xmin=-2.5, xmax=2.5)
138  monTool.defineHistogram('TrigEMCluster_phi', path='EXPERT', type='TH1F', title="T2Calo Egamma #phi; #phi ; Nclusters", xbins=128, xmin=-3.2, xmax=3.2)
139  monTool.defineHistogram('TrigEMCluster_eta,TrigEMCluster_phi', path='EXPERT', type='TH2F', title="T2Calo Egamma Number of Clusters; #eta ; #phi ; Number of Clusters", xbins=100, xmin=-2.5, xmax=2.5, ybins=128, ymin=-3.2, ymax=3.2)
140  monTool.defineHistogram('TrigEMCluster_rEta', path='EXPERT', type='TH1F', title="T2Calo Egamma rEta; rEta (e237/e277) ; Nclusters", xbins=140, xmin=-0.2, xmax=1.2)
141  monTool.defineHistogram('TIME_exec', path='EXPERT', type='TH1F', title="T2Calo Egamma time; time [ us ] ; Nruns", xbins=80, xmin=0.0, xmax=8000.0)
142  monTool.defineHistogram('TrigEMCluster_eta,TIME_exec', path='EXPERT', type='TH2F', title="T2Calo Egamma time vs #eta ; #eta ; time [ us ]", xbins=100, xmin=-2.5, xmax=2.5, ybins=80, ymin=0.0, ymax=8000.0)
143  monTool.defineHistogram('TrigEMCluster_eta,TrigEMCluster_eT', path='EXPERT', type='TH2F', title="Egamma E_T vs #eta ; #eta; E_T", xbins=100, xmin=-2.5, xmax=2.5)
144  monTool.defineHistogram('TrigEMCluster_eta,TrigEMCluster_et_rings', path='EXPERT', type='TH2F', title="Egamma E_T[calib] vs #eta ; #eta; E_T", xbins=100, xmin=-2.5, xmax=2.5)
145  monTool.defineHistogram('Resolution_et', path='EXPERT', type='TH1F', title="Egamma Resolution E_T; (E_T[calib] - E_T)/ E_T ; Nclusters", xbins=80, xmin=-10.0, xmax=10.0)
146  monTool.defineHistogram('TrigEMCluster_et_rings', path='EXPERT', type='TH1F', title="Egamma E_T [calib]; E_T [ GeV ] ; Nclusters", xbins=80, xmin=0.0, xmax=140.0)
147 
148  alg = CompFactory.T2CaloEgammaReFastAlgo(
149  name,
150  IReAlgToolList = [ samp2, samp1, sampe, samph ],
151  ExtraInputs = _T2CaloEgamma_ExtraInputs,
152  EtaWidth = 0.2,
153  PhiWidth = 0.2,
154  MonTool = monTool,
155  CalibListBarrel = [EgammaSshapeCalibrationBarrelConfig(),
156  EgammaHitsCalibrationBarrelConfig(),
157  EgammaGapCalibrationConfig(),
158  EgammaTransitionRegionsConfig()],
159  CalibListEndcap = [EgammaSshapeCalibrationEndcapConfig(),
160  EgammaHitsCalibrationEndcapConfig(),
161  EgammaGapCalibrationConfig()])
162 
163  if doRinger:
164  ringer = RingerReFexConfig(flags, 'ReFaAlgoRingerFexConfig',
165  RingerKey= RingerKey,
166  ClustersName = ClustersName)
167  alg.IReAlgToolList += [ringer]
168 
169  if flags.Trigger.egamma.fastCaloETCalibration:
170  ringerCalib = CompFactory.TrigFastCalibWithRings(name="FastCalibRingsTool",
171  CalibPath = flags.Trigger.egamma.fastCaloETCalibrationVersion, RingerKey="HLT_FastCaloRinger")
172  alg.CalibWRingsTool = ringerCalib
173  alg.DoCalibWithRings = True
174 
175  alg.UseRings = True
176 
177 
178  alg.RoIs=RoIs
179  alg.ExtraInputs |= ExtraInputs
180  alg.ClustersName = recordable(ClustersName)
181  acc.addEventAlgo(alg)
182  return acc
183 
184 #=======================================================================
185 
186 def t2CaloEgamma_ReFastFWDAlgoCfg(flags, name="T2CaloEgamma_ReFastFWDAlgo",
187  ClustersName="HLT_FWDFastCaloEMClusters",
188  doRinger=False, RingerKey="HLT_FWDFastCaloRinger", RoIs=inputEDM, ExtraInputs=set()):
189  acc = ComponentAccumulator()
190 
191  alg = CompFactory.T2CaloEgammaForwardReFastAlgo(name,
192  IReAlgToolList = [],
193  ExtraInputs = _T2CaloEgamma_ExtraInputs,
194  EtaWidth = 0.2,
195  PhiWidth = 0.2)
196  alg.RoIs=RoIs
197  alg.ExtraInputs |= ExtraInputs
198  alg.ClustersName = recordable(ClustersName)
199  acc.addEventAlgo(alg)
200  return acc
201 
202 #=======================================================================
203 
204 # Test:
205 if __name__ == '__main__':
206  from AthenaConfiguration.AllConfigFlags import initConfigFlags
207  flags = initConfigFlags()
208  flags.lock()
209  t2CaloEgamma_ReFastAlgoCfg(flags, "FastCaloL2EgammaAlgo_noRinger").printConfig(withDetails=True,summariseProps=True)
210  t2CaloEgamma_ReFastAlgoCfg(flags, "FastCaloL2EgammaAlgo", doRinger=True).printConfig(withDetails=True,summariseProps=True)
211  t2CaloEgamma_AllCfg(flags).printConfig(withDetails=True,summariseProps=True)
212  t2CaloEgamma_AllEmCfg(flags).printConfig(withDetails=True,summariseProps=True)
213  t2CaloEgamma_ReFastFWDAlgoCfg(flags, ClustersName="HLT_FastCaloEMClusters", doRinger=True).printConfig(withDetails=True,summariseProps=True)
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
python.TrigT2CaloEgammaConfig.t2CaloEgamma_ReFastAlgoCfg
def t2CaloEgamma_ReFastAlgoCfg(flags, name="T2CaloEgamma_ReFastAlgo", ClustersName="HLT_FastCaloEMClusters", doRinger=False, RingerKey="HLT_FastCaloRinger", RoIs=inputEDM, ExtraInputs=set())
Definition: TrigT2CaloEgammaConfig.py:123
python.TrigT2CaloEgammaConfig.t2CaloEgamma_AllCfg
def t2CaloEgamma_AllCfg(flags, name="T2CaloEgamma_All", RoIs=inputEDM, ExtraInputs=set(), ClustersName="HLT_FastCaloEMClusters")
Definition: TrigT2CaloEgammaConfig.py:84
python.TrigT2CaloEgammaConfig.t2CaloEgamma_ReFastFWDAlgoCfg
def t2CaloEgamma_ReFastFWDAlgoCfg(flags, name="T2CaloEgamma_ReFastFWDAlgo", ClustersName="HLT_FWDFastCaloEMClusters", doRinger=False, RingerKey="HLT_FWDFastCaloRinger", RoIs=inputEDM, ExtraInputs=set())
Definition: TrigT2CaloEgammaConfig.py:186
python.TrigT2CaloEgammaConfig.t2CaloEgamma_AllEmCfg
def t2CaloEgamma_AllEmCfg(flags, name="T2CaloEgamma_AllEm", RoIs=inputEDM, ExtraInputs=set(), ClustersName="HLT_FastCaloEMClusters")
Definition: TrigT2CaloEgammaConfig.py:104
GenericMonitoringTool
Definition: GenericMonitoringTool.py:1
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
python.TrigT2CaloEgammaConfig.RingerReFexConfig
def RingerReFexConfig(flags, name="RingerReMaker", RingerKey="FastCaloRings", ClustersName="HLT_FastCaloEMClusters", **kwargs)
Definition: TrigT2CaloEgammaConfig.py:27
HLTSeedingConfig.mapThresholdToL1RoICollection
def mapThresholdToL1RoICollection(threshold)
Definition: HLTSeedingConfig.py:91
python.TriggerEDM.recordable
def recordable(arg, runVersion=3)
Definition: TriggerEDM.py:30
python.TrigT2CaloEgammaConfig.AsymRingerReFexConfig
def AsymRingerReFexConfig(flags, name="AsymRingerReMaker")
Definition: TrigT2CaloEgammaConfig.py:77