ATLAS Offline Software
MistimedStreamMonitorAlgorithm.py
Go to the documentation of this file.
1 #
2 # Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 #
4 
5 
7  '''Function to configure LVL1 Mistimed Stream algorithm in the monitoring system.'''
8  import math
9 
10  # get the component factory - used for getting the algorithms
11  from AthenaConfiguration.ComponentFactory import CompFactory
12  from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
13  result = ComponentAccumulator()
14 
15  # make the athena monitoring helper
16  from AthenaMonitoring import AthMonitorCfgHelper
17  helper = AthMonitorCfgHelper(flags,'MistimedStreamMonitorCfg')
18 
19  # get any algorithms
20  MistimedMonAlg = helper.addAlgorithm(CompFactory.MistimedStreamMonitorAlgorithm,'MistimedStreamMonitorAlg')
21 
22  # import tools
23  from DetDescrCnvSvc.DetDescrCnvSvcConfig import DetDescrCnvSvcCfg
24  helper.result().merge(DetDescrCnvSvcCfg(flags))
25 
26  from TrigT1CaloCondSvc.L1CaloCondConfig import L1CaloCondAlgCfg
27  helper.result().merge(L1CaloCondAlgCfg(flags,Physics=True, Calib1=False, Calib2=False))
28 
29  from TrigConfxAOD.TrigConfxAODConfig import getxAODConfigSvc
30  helper.result().getPrimaryAndMerge(getxAODConfigSvc(flags))
31 
32  # add any steering
33  groupName = 'MistimedStreamMonitor' # the monitoring group name is also used for the package name
34  MistimedMonAlg.PackageName = groupName
35 
36  # Histogram paths
37  mainDir = 'L1Calo'
38  trigPath = 'MistimedStream'
39 
40  # Trigger tower plots: eta-phi granularity
41  etabins = [-4.9,-4.475,-4.050,-3.625,-3.2,-3.1,-2.9,
42  -2.7,-2.5,-2.4,-2.3,-2.2,-2.1,-2.0,-1.9,
43  -1.8,-1.7,-1.6,-1.5,-1.4,-1.3,-1.2,-1.1,
44  -1.0,-0.9,-0.8,-0.7,-0.6,-0.5,-0.4,-0.3,
45  -0.2,-0.1,0.0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,
46  0.8,0.9,1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7,
47  1.8,1.9,2.0,2.1,2.2,2.3,2.4,2.5,2.7,2.9,
48  3.1,3.2,3.625,4.050,4.475,4.9]
49 
50 
51 
52 
53  phibins = 64
54  phimin = 0
55 
56 
57  NumberOfGlobalErrors=11
58  globalStatus_xlabels = [
59  "All",
60  "unsuitable readout",
61  "HLT_mistimemonj400",
62  "L1_Trigger",
63  "<= 4 bad peak TT",
64  "<= 4 bad central TT",
65  "<= 4 bad late TT",
66  ">= 2 late TT",
67  "<= 3 in-time",
68  ">= 1 significant TT in EM layer",
69  "spatial overlap"
70  ]
71 
72 
73  NumberofEvents = MistimedMonAlg.MaxEvents
74 
75  # add monitoring algorithm to group, with group name and main directory
76  myGroup = helper.addGroup(MistimedMonAlg, groupName , mainDir)
77 
78 
79 
80  myGroup.defineHistogram('cutFlowX;1d_cutFlow_mistimedStreamAna',title='Total events selected by the MistimedStream analysis for this run',
81  type='TH1F',
82  path=trigPath,
83  xbins=NumberOfGlobalErrors,xmin=0.,xmax=NumberOfGlobalErrors,xlabels=globalStatus_xlabels,
84  opt='kAlwaysCreate')
85 
86  groupMapsEvents = helper.addGroup(MistimedMonAlg, 'Event_', mainDir)
87  groupMapsEvents.defineHistogram('eventMonitor_legacy,lbMonitor;1d_selectedEvents_mistimedStreamAna_legacy', title='Events of interest - Lumi Block;Events of interest;Lumi Block',type='TH2I', xbins=NumberofEvents, ybins=NumberofEvents, path=trigPath)
88  groupMapsEvents.defineHistogram('eventMonitor_phaseI,lbMonitor;1d_selectedEvents_mistimedStreamAna_phaseI', title='Events of interest - Lumi Block;Events of interest;Lumi Block',type='TH2I', xbins=NumberofEvents, ybins=NumberofEvents, path=trigPath)
89 
90  groupMapsEvents_all = helper.addGroup(MistimedMonAlg, 'Event_all_', mainDir)
91  groupMapsEvents_all.defineHistogram('eventMonitor_all_legacy,lbMonitor_all;1d_selectedEvents_mistimedStreamAna_notSaved_legacy', title='Events of interest - Lumi Block (not saved);Events of interest;Lumi Block',type='TH2I', path=trigPath)
92  groupMapsEvents_all.defineHistogram('eventMonitor_all_phaseI,lbMonitor_all;1d_selectedEvents_mistimedStreamAna_notSaved_phaseI', title='Events of interest - Lumi Block (not saved);Events of interest;Lumi Block',type='TH2I', path=trigPath)
93 
94  groupMapsEfexin = helper.addGroup(MistimedMonAlg, 'Efex_maxTOB_in', mainDir)
95  groupMapsEfexin.defineHistogram('TOBEta_max, TOBPhi_max;Efex_2d_etaPhi_in_mistimedStreamAna', title='#eta - #phi Map of max Efex TOBs (in-time) ;#eta;#phi' , xbins=100,xmin=-5.0,xmax=5.0,ybins=64,ymin=0.,ymax=2*math.pi, type='TH2D', path=trigPath)
96  groupMapsEfexin.defineHistogram('TOBTransverseEnergy;Efex_TOBenergy_in_mistimedStreamAna', title='Energy of Efex TOBs (in-time);TOB E_T [GeV];Entries', xbins=90,xmin=0.0,xmax=450.0, type='TH1D', path=trigPath)
97 
98  groupMapsEfexout = helper.addGroup(MistimedMonAlg, 'Efex_maxTOB_out', mainDir)
99  groupMapsEfexout.defineHistogram('TOBEta_max, TOBPhi_max;Efex_2d_etaPhi_out_mistimedStreamAna', title='#eta - #phi Map of max Efex TOBs (out-of-time) ;#eta;#phi' , xbins=100,xmin=-5.0,xmax=5.0,ybins=64,ymin=0.,ymax=2*math.pi, type='TH2D', path=trigPath)
100  groupMapsEfexout.defineHistogram('TOBTransverseEnergy;Efex_TOBenergy_out_mistimedStreamAna', title='Energy of Efex TOBs (out-of-time);TOB E_T [GeV];Entries', xbins=90,xmin=0.0,xmax=450.0, type='TH1D', path=trigPath)
101 
102  groupMapsJfex = helper.addGroup(MistimedMonAlg, 'Jfex_maxTOB', mainDir)
103  groupMapsJfex.defineHistogram('TOBEta_max, TOBPhi_max;Jfex_2d_etaPhi_mistimedStreamAna', title='#eta - #phi Map of max Jfex TOBs;#eta;#phi' , xbins=100,xmin=-5.0,xmax=5.0,ybins=64,ymin=0.,ymax=2*math.pi, type='TH2D', path=trigPath)
104  groupMapsJfex.defineHistogram('jFexEt;Jfex_TOBenergy_mistimedStreamAna', title='Energy of Jfex TOBs;TOB E_T [GeV];Entries', xbins=90,xmin=0.0,xmax=450.0, type='TH1D', path=trigPath)
105 
106  groupMapsGfex = helper.addGroup(MistimedMonAlg, 'Gfex_maxTOB', mainDir)
107  groupMapsGfex.defineHistogram('TOBEta_max, TOBPhi_max;Gfex_2d_etaPhi_mistimedStreamAna', title='#eta - #phi Map of max Gfex TOBs;#eta;#phi' , xbins=50,xmin=-5.0,xmax=5.0,ybins=32,ymin=0.,ymax=2*math.pi, type='TH2D', path=trigPath)
108  groupMapsGfex.defineHistogram('gFexEt;Gfex_TOBenergy_mistimedStreamAna', title='Energy of Gfex TOBs;TOB E_T [GeV];Entries', xbins=90,xmin=0.0,xmax=450.0, type='TH1D', path=trigPath)
109 
110  # add monitoring algorithm to group, with group name and main directory
111  histPath = trigPath+'/EventofInterest'
112 
113  for i in range(0, NumberofEvents):
114 
115  # LUT per BCN (Both EM & HAD together)
116  groupMapsEM = helper.addGroup(MistimedMonAlg, 'EventofInterest_'+str(i)+'_TT_EM', mainDir)
117  groupMapsEM.defineHistogram('etaTT_2D,phiTT_2D,pulseCat;EventofInterest_'+str(i)+'_em_2d_etaPhi_tt_classification_mistimedStreamAna', title='#eta - #phi Map of TT classification, EM layer: event of interest no. '+str(i)+';#eta;#phi' , xbins=etabins, ybins=phibins, ymin=phimin, ymax=phibins, type='TProfile2D', path=histPath)
118  groupMapsEM.defineHistogram('etaTT_2D,phiTT_2D,bcidWord;EventofInterest_'+str(i)+'_em_2d_etaPhi_tt_pseBits_mistimedStreamAna', title='#eta - #phi Map of TT PSE Bits, EM layer: event of interest no. '+str(i)+';#eta;#phi', xbins=etabins, ybins=phibins, ymin=phimin, ymax=phibins,type='TProfile2D', path=histPath)
119 
120  groupMapsHAD = helper.addGroup(MistimedMonAlg, 'EventofInterest_'+str(i)+'_TT_HAD', mainDir)
121  groupMapsHAD.defineHistogram('etaTT_2D,phiTT_2D,pulseCat;EventofInterest_'+str(i)+'_had_2d_etaPhi_tt_classification_mistimedStreamAna', title='#eta - #phi Map of TT classification, HAD layer: event of interest no. '+str(i)+';#eta;#phi' , xbins=etabins, ybins=phibins, ymin=phimin, ymax=phibins, type='TProfile2D', path=histPath)
122  groupMapsHAD.defineHistogram('etaTT_2D,phiTT_2D,bcidWord;EventofInterest_'+str(i)+'_had_2d_etaPhi_tt_pseBits_mistimedStreamAna', title='#eta - #phi Map of TT PSE Bits, HAD layer: event of interest no. '+str(i)+';#eta;#phi', xbins=etabins, ybins=phibins, ymin=phimin, ymax=phibins, type='TProfile2D', path=histPath)
123 
124  groupMapsEM0 = helper.addGroup(MistimedMonAlg, 'EventofInterest_'+str(i)+'_lut_EM0', mainDir)
125  groupMapsEM0.defineHistogram('etalut,philut,emLUT0;EventofInterest_'+str(i)+'_em_2d_etaPhi_tt_lut0_mistimedStreamAna', title='#eta - #phi Map of TT LUT in timeslice 0 = BCID-1, EM layer: event of interest no. '+str(i)+';#eta;#phi' , xbins=etabins, ybins=phibins, ymin=phimin, ymax=phibins, type='TProfile2D', path=histPath)
126  groupMapsEM1 = helper.addGroup(MistimedMonAlg, 'EventofInterest_'+str(i)+'_lut_EM1', mainDir)
127  groupMapsEM1.defineHistogram('etalut,philut,emLUT1;EventofInterest_'+str(i)+'_em_2d_etaPhi_tt_lut1_mistimedStreamAna', title='#eta - #phi Map of TT LUT in timeslice 1 = BCID, EM layer: event of interest no. '+str(i)+';#eta;#phi' , xbins=etabins, ybins=phibins, ymin=phimin, ymax=phibins, type='TProfile2D', path=histPath)
128  groupMapsEM2 = helper.addGroup(MistimedMonAlg, 'EventofInterest_'+str(i)+'_lut_EM2', mainDir)
129  groupMapsEM2.defineHistogram('etalut,philut,emLUT2;EventofInterest_'+str(i)+'_em_2d_etaPhi_tt_lut2_mistimedStreamAna', title='#eta - #phi Map of TT LUT in timeslice 2 = BCID+1, EM layer: event of interest no. '+str(i)+';#eta;#phi' , xbins=etabins, ybins=phibins, ymin=phimin, ymax=phibins, type='TProfile2D', path=histPath)
130 
131  groupMapsHAD0 = helper.addGroup(MistimedMonAlg, 'EventofInterest_'+str(i)+'_lut_HAD0', mainDir)
132  groupMapsHAD0.defineHistogram('etalut,philut,hadLUT0;EventofInterest_'+str(i)+'_had_2d_etaPhi_tt_lut0_mistimedStreamAna', title='#eta - #phi Map of TT LUT in timeslice 0 = BCID-1, HAD layer: event of interest no. '+str(i)+';#eta;#phi' , xbins=etabins, ybins=phibins, ymin=phimin, ymax=phibins, type='TProfile2D', path=histPath)
133  groupMapsHAD1 = helper.addGroup(MistimedMonAlg, 'EventofInterest_'+str(i)+'_lut_HAD1', mainDir)
134  groupMapsHAD1.defineHistogram('etalut,philut,hadLUT1;EventofInterest_'+str(i)+'_had_2d_etaPhi_tt_lut1_mistimedStreamAna', title='#eta - #phi Map of TT LUT in timeslice 1 = BCID, HAD layer: event of interest no. '+str(i)+';#eta;#phi' , xbins=etabins, ybins=phibins, ymin=phimin, ymax=phibins, type='TProfile2D', path=histPath)
135  groupMapsHAD2 = helper.addGroup(MistimedMonAlg, 'EventofInterest_'+str(i)+'_lut_HAD2', mainDir)
136  groupMapsHAD2.defineHistogram('etalut,philut,hadLUT2;EventofInterest_'+str(i)+'_had_2d_etaPhi_tt_lut2_mistimedStreamAna', title='#eta - #phi Map of TT LUT in timeslice 2 = BCID+1, HAD layer: eventof interest no. '+str(i)+';#eta;#phi' , xbins=etabins, ybins=phibins, ymin=phimin, ymax=phibins, type='TProfile2D', path=histPath)
137 
138  groupMapsEfex0 = helper.addGroup(MistimedMonAlg, 'EventofInterest_'+str(i)+'_Efex0', mainDir)
139  groupMapsEfex0.defineHistogram('TOBEta, TOBPhi, TOBTransverseEnergy;EventofInterest_'+str(i)+'_Efex0_2d_etaPhi_out_mistimedStreamAna', title='#eta - #phi Map of Efex TT in timeslice 0 = BCID-1, EM layer: event of interest no. '+str(i)+';#eta;#phi' , xbins=100,xmin=-5.0,xmax=5.0,ybins=64,ymin=0.,ymax=2*math.pi, type='TProfile2D', path=histPath)
140  groupMapsEfex1 = helper.addGroup(MistimedMonAlg, 'EventofInterest_'+str(i)+'_Efex1', mainDir)
141  groupMapsEfex1.defineHistogram('TOBEta, TOBPhi, TOBTransverseEnergy;EventofInterest_'+str(i)+'_Efex1_2d_etaPhi_mistimedStreamAna', title='#eta - #phi Map of Efex TT in timeslice 1 = BCID, EM layer: event of interest no. '+str(i)+';#eta;#phi' , xbins=100,xmin=-5.0,xmax=5.0,ybins=64,ymin=0.,ymax=2*math.pi, type='TProfile2D', path=histPath)
142  groupMapsEfex2 = helper.addGroup(MistimedMonAlg, 'EventofInterest_'+str(i)+'_Efex2', mainDir)
143  groupMapsEfex2.defineHistogram('TOBEta, TOBPhi, TOBTransverseEnergy;EventofInterest_'+str(i)+'_Efex2_2d_etaPhi_out_mistimedStreamAna', title='#eta - #phi Map of Efex TT in timeslice 2 = BCID+1, EM layer: event of interest no. '+str(i)+';#eta;#phi' , xbins=100,xmin=-5.0,xmax=5.0,ybins=64,ymin=0.,ymax=2*math.pi, type='TProfile2D', path=histPath)
144 
145  groupMapsJfexEmulated = helper.addGroup(MistimedMonAlg, 'EventofInterest_'+str(i)+'_JfexEmulated', mainDir)
146  groupMapsJfexEmulated.defineHistogram('jFexEta, jFexPhi, jFexEt;EventofInterest_'+str(i)+'_Jfex_2d_etaPhi_emulatedTowers_mistimedStreamAna', title='#eta - #phi Map of Jfex Emulated Towers in time, events of interest no. '+str(i)+';#eta;#phi' , xbins=100,xmin=-5.0,xmax=5.0,ybins=64,ymin=0.,ymax=2*math.pi, type='TProfile2D', path=histPath)
147 
148  groupMapsJfexSRJet = helper.addGroup(MistimedMonAlg, 'EventofInterest_'+str(i)+'_JfexSRJet', mainDir)
149  groupMapsJfexSRJet.defineHistogram('jFexEta, jFexPhi, jFexEt;EventofInterest_'+str(i)+'_Jfex_2d_etaPhi_SRJet_mistimedStreamAna', title='#eta - #phi Map of Jfex SRJets in time, events of interest no. '+str(i)+';#eta;#phi' , xbins=100,xmin=-5.0,xmax=5.0,ybins=64,ymin=0.,ymax=2*math.pi, type='TProfile2D', path=histPath)
150  groupMapsJfexTau = helper.addGroup(MistimedMonAlg, 'EventofInterest_'+str(i)+'_JfexTau', mainDir)
151  groupMapsJfexTau.defineHistogram('jFexEta, jFexPhi, jFexEt;EventofInterest_'+str(i)+'_Jfex_2d_etaPhi_Tau_mistimedStreamAna', title='#eta - #phi Map of Jfex Tau in time, event of interest no. '+str(i)+';#eta;#phi' , xbins=100,xmin=-5.0,xmax=5.0,ybins=64,ymin=0.,ymax=2*math.pi, type='TProfile2D', path=histPath)
152 
153  groupMapsgFexSRJet = helper.addGroup(MistimedMonAlg, 'EventofInterest_'+str(i)+'_GfexSRJet', mainDir)
154  groupMapsgFexSRJet.defineHistogram('gFexEta, gFexPhi, gFexEt;EventofInterest_'+str(i)+'_Gfex_2d_etaPhi_SRJet_mistimedStreamAna', title='#eta - #phi Map of Gfex Jets in time, events of interest no. '+str(i)+';#eta;#phi' , xbins=50,xmin=-5.0,xmax=5.0,ybins=32,ymin=0.,ymax=2*math.pi, type='TProfile2D', path=histPath)
155  groupMapsgFexLRJet = helper.addGroup(MistimedMonAlg, 'EventofInterest_'+str(i)+'_GfexLRJet', mainDir)
156  groupMapsgFexLRJet.defineHistogram('gFexEta, gFexPhi, gFexEt;EventofInterest_'+str(i)+'_Gfex_2d_etaPhi_LRJet_mistimedStreamAna', title='#eta - #phi Map of Gfex Jets in time, events of interest no. '+str(i)+';#eta;#phi' , xbins=50,xmin=-5.0,xmax=5.0,ybins=32,ymin=0.,ymax=2*math.pi, type='TProfile2D', path=histPath)
157 
158  acc = helper.result()
159  result.merge(acc)
160  return result
161 
162 if __name__=='__main__':
163 
164  import sys
165 
166  from AthenaConfiguration.AllConfigFlags import initConfigFlags
167 
168  flags = initConfigFlags()
169  flags.Exec.MaxEvents = -1
170  flags.IOVDb.GlobalTag = 'CONDBR2-HLTP-2023-01'
171  flags.Input.Files = ["/eos/atlas/atlastier0/rucio/data22_13p6TeV/express_express/00423433/data22_13p6TeV.00423433.express_express.recon.ESD.x653/data22_13p6TeV.00423433.express_express.recon.ESD.x653._lb0015._SFO-ALL._0001.2"]
172 
173 
174  flags.Output.HISTFileName = 'ExampleMonitorOutput_LVL1.root'
175 
176  flags.lock()
177 
178  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
179  from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
180  acc = MainServicesCfg(flags)
181  acc.merge(PoolReadCfg(flags))
182 
183 
184  MistimedStreamMonitorCfg = MistimedStreamMonitorConfig(flags)
185  acc.merge(MistimedStreamMonitorCfg)
186 
187  MistimedStreamMonitorCfg.getEventAlgo('MistimedStreamMonitorAlg').OutputLevel = 2 # 1/2 INFO/DEBUG
188  acc.printConfig(withDetails=True, summariseProps = True)
189 
190  sys.exit(acc.run().isFailure())
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
TrigConfxAODConfig.getxAODConfigSvc
def getxAODConfigSvc(flags)
Definition: TrigConfxAODConfig.py:5
L1CaloCondConfig.L1CaloCondAlgCfg
def L1CaloCondAlgCfg(flags, readTest=False, Physics=True, Calib1=True, Calib2=True)
Definition: L1CaloCondConfig.py:45
python.DetDescrCnvSvcConfig.DetDescrCnvSvcCfg
def DetDescrCnvSvcCfg(flags, **kwargs)
Definition: DetDescrCnvSvcConfig.py:6
MistimedStreamMonitorAlgorithm.MistimedStreamMonitorConfig
def MistimedStreamMonitorConfig(flags)
Definition: MistimedStreamMonitorAlgorithm.py:6
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:256
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
str
Definition: BTagTrackIpAccessor.cxx:11
python.PoolReadConfig.PoolReadCfg
def PoolReadCfg(flags)
Definition: PoolReadConfig.py:69
merge
Definition: merge.py:1