ATLAS Offline Software
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  helper.defineDQAlgorithm("Efex_ecal_hot_etaThiMapFilled",
39  hanConfig={"libname":"libdqm_summaries.so","name":"Bins_Equal_Threshold","BinThreshold":"0."},
40  thresholdConfig={"NBins":[0,64*50]}, # currently there is no known deadspot in ecal, so that is warning. Error if empty
41  )
42  helper.defineDQAlgorithm("Efex_hcal_hot_etaThiMapFilled",
43  hanConfig={"libname":"libdqm_summaries.so","name":"Bins_Equal_Threshold","BinThreshold":"0."},
44  thresholdConfig={"NBins":[50,64*50]}, # currently there are disabled drawers (24 dead towers). Error if empty
45  )
46 
47  for layer in ["ecal","hcal"]:
48  helper.defineHistogram(f'TowerEta,TowerPhi;h_dataTowers_{layer}_hot_EtaPhiMap',title=f'{layer.upper()} SuperCells >= 500MeV;#eta;#phi',
49  cutmask="AboveCut",
50  path="Expert/Inputs/eFEX",
51  hanConfig={"algorithm":f"Efex_{layer}_hot_etaThiMapFilled","description":f"Check <a href='./detail/h_dataTowers_{layer}_hot_posVsLBN'>detail plot</a> to get timeseries for each location"},
52  fillGroup=layer,
53  type='TH2I',
54  xbins=50,xmin=-2.5,xmax=2.5,
55  ybins=64,ymin=-math.pi,ymax=math.pi,opt=['kAlwaysCreate'])
56 
57  helper.defineHistogram(f'LBN,binNumber;h_dataTowers_{layer}_hot_posVsLBN',title=f'{layer.upper()} SuperCells >= 500MeV;LB;50(y-1)+x',
58  path="Expert/Inputs/eFEX/detail",
59  cutmask="AboveCut",
60  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"},
61  fillGroup=layer,
62  type='TH2I',
63  xbins=1,xmin=0,xmax=10,
64  ybins=64*50,ymin=0.5,ymax=64*50+0.5,
65  opt=['kAddBinsDynamically','kAlwaysCreate'],merge="merge")
66  helper.defineHistogram(f'TowerEta,TowerPhi;h_dataTowers_{layer}_cold_EtaPhiMap',title=f'{layer.upper()} SuperCells <= -500MeV;#eta;#phi',
67  cutmask="BelowCut",
68  path="Expert/Inputs/eFEX",
69  hanConfig={"description":f"Check <a href='./detail/h_dataTowers_{layer}_cold_posVsLBN'>detail plot</a> to get timeseries for each location"},
70  fillGroup=layer,
71  type='TH2I',
72  xbins=50,xmin=-2.5,xmax=2.5,
73  ybins=64,ymin=-math.pi,ymax=math.pi,opt=['kAlwaysCreate'])
74 
75  helper.defineHistogram(f'LBN,binNumber;h_dataTowers_{layer}_cold_posVsLBN',title=f'{layer.upper()} SuperCells <= -500MeV;LB;50(y-1)+x',
76  path="Expert/Inputs/eFEX/detail",
77  cutmask="BelowCut",
78  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"},
79  fillGroup=layer,
80  type='TH2I',
81  xbins=1,xmin=0,xmax=10,
82  ybins=64*50,ymin=0.5,ymax=64*50+0.5,
83  opt=['kAddBinsDynamically','kAlwaysCreate'],merge="merge")
84 
85  helper.defineTree('LBNString,Error,EventNumber,TowerId,TowerEta,TowerPhi,TowerEmstatus,TowerHadstatus,TowerSlot,TowerCount,RefTowerCount,SlotSCID,timeSince,timeUntil;errors',
86  "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",
87  title="errors tree;LBN;Error",fillGroup="errors")
88 
89 
90  result.merge(helper.result())
91  return result
92 
93 
94 if __name__=='__main__':
95  # set input file and config options
96  from AthenaConfiguration.AllConfigFlags import initConfigFlags
97  import glob
98 
99  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')
100 
101  flags = initConfigFlags()
102  flags.Input.Files = inputs
103  flags.Output.HISTFileName = 'ExampleMonitorOutput_LVL1_MC.root'
104 
105  flags.lock()
106  flags.dump() # print all the configs
107 
108  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
109  from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
110  cfg = MainServicesCfg(flags)
111  cfg.merge(PoolReadCfg(flags))
112 
113  EfexInputMonitorCfg = EfexInputMonitoringConfig(flags)
114  cfg.merge(EfexInputMonitorCfg)
115 
116  # options - print all details of algorithms, very short summary
117  cfg.printConfig(withDetails=False, summariseProps = True)
118 
119  nevents=10
120  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:59
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
python.PoolReadConfig.PoolReadCfg
def PoolReadCfg(flags)
Definition: PoolReadConfig.py:69