Loading [MathJax]/jax/output/SVG/config.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
EfexInputMonitorAlgorithm.py
Go to the documentation of this file.
1 #
2 # Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 #
5  '''Function to configure LVL1 EfexInput algorithm in the monitoring system.'''
6 
7  # get the component factory - used for getting the algorithms
8  from AthenaConfiguration.ComponentFactory import CompFactory
9  from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
10  result = ComponentAccumulator()
11 
12  from LArBadChannelTool.LArBadChannelConfig import LArMaskedSCCfg
13 
14  result.merge(LArMaskedSCCfg(flags))
15 
16  # use L1Calo's special MonitoringCfgHelper
17  from TrigT1CaloMonitoring.LVL1CaloMonitoringConfig import L1CaloMonitorCfgHelper
18  helper = L1CaloMonitorCfgHelper(flags,CompFactory.EfexInputMonitorAlgorithm,'EfexInputMonAlg')
19 
20  helper.defineHistogram('LBN,ErrorAndLocation;h_summary',title='EfexInput Monitoring summary;LBN;Error:TowerID',
21  path="Expert/Inputs/eFEX/detail",
22  hanConfig={"description":"TowerID format: '[E]EPPMMF', where E=eta index, P=phi index,M=module,F=fpga"},
23  fillGroup="errors",
24  type='TH2I',
25  xbins=1,xmin=0,xmax=1,
26  ybins=1,ymin=0,ymax=1,
27  opt=['kAddBinsDynamically','kAlwaysCreate'],merge="merge")
28 
29  import math
30  helper.defineHistogram('TowerEta,TowerPhi;h_errors',title='EfexInput Errors (BadEMStatus,BadHadStatus);#eta;#phi',
31  path="Expert/Inputs/eFEX",
32  hanConfig={"algorithm":"Histogram_Empty","description":"Locations of any non-zero em or hadronic status flags. Check <a href='./detail/h_summary'>detail/h_summary</a> for more detail if there are entries"},
33  fillGroup="errors",cutmask='IsMonReady',
34  type='TH2I',
35  xbins=50,xmin=-2.5,xmax=2.5,
36  ybins=64,ymin=-math.pi,ymax=math.pi)
37 
38  # note: string DQ algo parameters must have leading/trailing ' char, to distinguish from other parts of algo config
39  # these initial values were determined from run 486894 in 2024
40  # these should be reviewed at an L1Calo meeting in 2025, prior to data taking
41  knownAnomalies_hotHcal = {
42  "KnownDead":"\"1,29;12,57;15,57;18,24;18,41;18,50;19,41;2,29;20,41;21,41;22,41;23,29;23,41;24,41;25,36;25,41;26,18;26,38;27,18;28,18;29,18;32,18;33,18;41,21;41,54;42,21;42,43;47,6;7,62;8,54;9,41;9,51;9,52;9,53;9,54;9,56\"",
43  "KnownWarm":"\"26,3;27,3;28,3;29,3;30,3;31,3;32,3;33,3;34,3\"", # noisy tile drawer
44  "KnownHot":"\"15,49\"" # one hotspot in LAr HCal?
45  }
46  knownAnomalies_coldHcal = {
47  "KnownDead":"\"1,29;2,29;41,21;41,54;42,21;42,43;47,6;7,62;8,54;9,41;9,51;9,52;9,53;9,54;9,56\"",
48  "KnownWarm":"\"5,33\"" # one slightly-frequent coldspot
49  }
50  knownAnomalies_hotEcal = {
51  "KnownCold":"\"19,18;48,8;8,33;9,19;9,20;9,33;9,34\"",
52  "KnownWarm":"\"2,15;2,47;2,55;2,56;47,35;47,36;47,47;47,48;48,47;50,44\""
53  }
54  knownAnomalies_coldEcal = {
55  "KnownHot":"\"1,15;2,15;47,47;48,36\"",
56  "KnownWarm":"\"1,47;1,48;1,49;1,55;1,56;2,16;2,47;2,48;2,55;2,56;22,14;23,14;47,35;47,36;47,48;48,35;48,47;48,48;49,51;50,43;50,44\""
57  }
58 
59  commonAlgConfig = {"libname":"libdqm_summaries.so",
60  "name":"L1Calo_BinsDiffFromStripMedian",
61  "PublishDetail":32}
62  hotCuts = {"ColdCut":-3.5,"WarmCut":9,"HotCut":20} # when looking at frequency of hot deposits, use these cuts
63  coldCuts = {"ColdCut":-4,"WarmCut":5,"HotCut":10} # lower thresholds for looking at negative energy deposits, as RMS is usually smaller
64 
65  commonThresholdConfig = {
66  "NWrongKnown":[0,100], # warn of any corrections that are needed for the known anomalies lists
67  "NDead":[0,2], # warn on any new dead spots, error if more than a couple
68  "NHot":[0,2], # warn on any new hot spots, error if more than a couple
69  "NCold":[0,2], # warn on any new cold spots, error if more than a couple
70  "NWarm":[0,5], # warn on any new warm spots, error if more than 5
71  "NDeadStrip":[0,0], # no dead strips - exception to this will be in cold hcal, where tile cannot be negative
72  "NConsecUnlikelyStrip":[2,5], # warn if more than 2 consecutive strips deemed unlikely
73  }
74 
75  helper.defineDQAlgorithm("Efex_ecal_hot_etaPhiMapOutliers",
76  hanConfig=commonAlgConfig|hotCuts|knownAnomalies_hotEcal,
77  thresholdConfig=commonThresholdConfig
78  )
79 
80  helper.defineDQAlgorithm("Efex_hcal_hot_etaPhiMapOutliers",
81  hanConfig=commonAlgConfig|hotCuts|knownAnomalies_hotHcal,
82  thresholdConfig=commonThresholdConfig
83  )
84 
85  helper.defineDQAlgorithm("Efex_ecal_cold_etaPhiMapOutliers",
86  hanConfig=commonAlgConfig|coldCuts|knownAnomalies_coldEcal,
87  thresholdConfig=commonThresholdConfig
88  )
89 
90  helper.defineDQAlgorithm("Efex_hcal_cold_etaPhiMapOutliers",
91  hanConfig=commonAlgConfig|coldCuts|knownAnomalies_coldHcal,
92  thresholdConfig=commonThresholdConfig|{"NDeadStrip":[30,30]} # negatives not possible in tile (-1.5->1.5)
93  )
94 
95  for layer in ["ecal","hcal"]:
96  helper.defineHistogram(f'TowerEta,TowerPhi;h_dataTowers_{layer}_hot_EtaPhiMap',title=f'{layer.upper()} SuperCells >= 500MeV;#eta;#phi',
97  cutmask="AboveCut",
98  path="Expert/Inputs/eFEX",
99  hanConfig={"algorithm":f"Efex_{layer}_hot_etaPhiMapOutliers","description":f"Check <a href='./detail/h_dataTowers_{layer}_hot_posVsLBN'>detail plot</a> to get timeseries for each location"},
100  fillGroup=layer,
101  type='TH2I',
102  xbins=50,xmin=-2.5,xmax=2.5,
103  ybins=64,ymin=-math.pi,ymax=math.pi,opt=['kAlwaysCreate'])
104 
105  helper.defineHistogram(f'LBN,binNumber;h_dataTowers_{layer}_hot_posVsLBN',title=f'{layer.upper()} SuperCells >= 500MeV;LB;50(y-1)+x',
106  path="Expert/Inputs/eFEX/detail",
107  cutmask="AboveCut",
108  hanConfig={"description":f"x and y correspond to axis bin numbers on <a href='../h_dataTowers_{layer}_hot_EtaPhiMap'/>eta-phi plot</a>. Use this plot to check if hotspot/coldspots affected whole or part of run: turn on Projection X1 to see 1D hist of individual locations"},
109  fillGroup=layer,
110  type='TH2I',
111  xbins=1,xmin=0,xmax=10,
112  ybins=64*50,ymin=0.5,ymax=64*50+0.5,
113  opt=['kAddBinsDynamically','kAlwaysCreate'],merge="merge")
114  helper.defineHistogram(f'TowerEta,TowerPhi;h_dataTowers_{layer}_cold_EtaPhiMap',title=f'{layer.upper()} SuperCells <= -500MeV;#eta;#phi',
115  cutmask="BelowCut",
116  path="Expert/Inputs/eFEX",
117  hanConfig={"algorithm":f"Efex_{layer}_cold_etaPhiMapOutliers","description":f"Check <a href='./detail/h_dataTowers_{layer}_cold_posVsLBN'>detail plot</a> to get timeseries for each location"},
118  fillGroup=layer,
119  type='TH2I',
120  xbins=50,xmin=-2.5,xmax=2.5,
121  ybins=64,ymin=-math.pi,ymax=math.pi,opt=['kAlwaysCreate'])
122 
123  helper.defineHistogram(f'LBN,binNumber;h_dataTowers_{layer}_cold_posVsLBN',title=f'{layer.upper()} SuperCells <= -500MeV;LB;50(y-1)+x',
124  path="Expert/Inputs/eFEX/detail",
125  cutmask="BelowCut",
126  hanConfig={"description":f"x and y correspond to axis bin numbers on <a href='../h_dataTowers_{layer}_cold_EtaPhiMap'/>eta-phi plot</a>. Use this plot to check if hotspot/coldspots affected whole or part of run: turn on Projection X1 to see 1D hist of individual locations"},
127  fillGroup=layer,
128  type='TH2I',
129  xbins=1,xmin=0,xmax=10,
130  ybins=64*50,ymin=0.5,ymax=64*50+0.5,
131  opt=['kAddBinsDynamically','kAlwaysCreate'],merge="merge")
132 
133  helper.defineTree('LBNString,Error,EventNumber,TowerId,TowerEta,TowerPhi,TowerEmstatus,TowerHadstatus,TowerSlot,TowerCount,RefTowerCount,SlotSCID,timeSince,timeUntil;errors',
134  "lbnString/string:error/string:eventNumber/l:id/I:eta/F:phi/F:em_status/i:had_status/i:slot/I:count/I:ref_count/I:scid/string:timeSince/I:timeUntil/I",
135  title="errors tree;LBN;Error",fillGroup="errors")
136 
137 
138  result.merge(helper.result())
139  return result
140 
141 
142 if __name__=='__main__':
143  # set input file and config options
144  from AthenaConfiguration.AllConfigFlags import initConfigFlags
145  import glob
146 
147  inputs = glob.glob('/eos/atlas/atlastier0/rucio/data18_13TeV/physics_Main/00354311/data18_13TeV.00354311.physics_Main.recon.ESD.f1129/data18_13TeV.00354311.physics_Main.recon.ESD.f1129._lb0013._SFO-8._0001.1')
148 
149  flags = initConfigFlags()
150  flags.Input.Files = inputs
151  flags.Output.HISTFileName = 'ExampleMonitorOutput_LVL1_MC.root'
152 
153  flags.lock()
154  flags.dump() # print all the configs
155 
156  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
157  from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
158  cfg = MainServicesCfg(flags)
159  cfg.merge(PoolReadCfg(flags))
160 
161  EfexInputMonitorCfg = EfexInputMonitoringConfig(flags)
162  cfg.merge(EfexInputMonitorCfg)
163 
164  # options - print all details of algorithms, very short summary
165  cfg.printConfig(withDetails=False, summariseProps = True)
166 
167  nevents=10
168  cfg.run(nevents)
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
EfexInputMonitorAlgorithm.EfexInputMonitoringConfig
def EfexInputMonitoringConfig(flags)
Definition: EfexInputMonitorAlgorithm.py:4
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:260
python.LArBadChannelConfig.LArMaskedSCCfg
def LArMaskedSCCfg(configFlags)
Definition: LArBadChannelConfig.py:60
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
python.PoolReadConfig.PoolReadCfg
def PoolReadCfg(flags)
Definition: PoolReadConfig.py:69