7 '''Function to configure LVL1 Mistimed Stream algorithm in the monitoring system.'''
11 from AthenaConfiguration.ComponentFactory
import CompFactory
12 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
16 from AthenaMonitoring
import AthMonitorCfgHelper
17 helper = AthMonitorCfgHelper(flags,
'MistimedStreamMonitorCfg')
20 MistimedMonAlg = helper.addAlgorithm(CompFactory.MistimedStreamMonitorAlgorithm,
'MistimedStreamMonitorAlg')
23 from DetDescrCnvSvc.DetDescrCnvSvcConfig
import DetDescrCnvSvcCfg
26 from TrigT1CaloCondSvc.L1CaloCondConfig
import L1CaloCondAlgCfg
29 from TrigConfxAOD.TrigConfxAODConfig
import getxAODConfigSvc
33 groupName =
'MistimedStreamMonitor'
34 MistimedMonAlg.PackageName = groupName
38 trigPath =
'MistimedStream'
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]
57 NumberOfGlobalErrors=11
58 globalStatus_xlabels = [
64 "<= 4 bad central TT",
68 ">= 1 significant TT in EM layer",
73 NumberofEvents = MistimedMonAlg.MaxEvents
76 myGroup = helper.addGroup(MistimedMonAlg, groupName , mainDir)
80 myGroup.defineHistogram(
'cutFlowX;1d_cutFlow_mistimedStreamAna',title=
'Total events selected by the MistimedStream analysis for this run',
83 xbins=NumberOfGlobalErrors,xmin=0.,xmax=NumberOfGlobalErrors,xlabels=globalStatus_xlabels,
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)
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)
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)
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)
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)
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)
111 histPath = trigPath+
'/EventofInterest'
113 for i
in range(0, NumberofEvents):
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)
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)
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)
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)
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)
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)
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)
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)
158 acc = helper.result()
162 if __name__==
'__main__':
166 from AthenaConfiguration.AllConfigFlags
import 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"]
174 flags.Output.HISTFileName =
'ExampleMonitorOutput_LVL1.root'
178 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
179 from AthenaPoolCnvSvc.PoolReadConfig
import PoolReadCfg
185 acc.merge(MistimedStreamMonitorCfg)
187 MistimedStreamMonitorCfg.getEventAlgo(
'MistimedStreamMonitorAlg').OutputLevel = 2
188 acc.printConfig(withDetails=
True, summariseProps =
True)
190 sys.exit(acc.run().isFailure())