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')
22 MistimedMonAlg.UseLegacy =
True
24 MistimedMonAlg.UsePhase1 =
True
27 from DetDescrCnvSvc.DetDescrCnvSvcConfig
import DetDescrCnvSvcCfg
30 from TrigT1CaloCondSvc.L1CaloCondConfig
import L1CaloCondAlgCfg
33 from TrigConfxAOD.TrigConfxAODConfig
import getxAODConfigSvc
37 groupName =
'MistimedStreamMonitor'
38 MistimedMonAlg.PackageName = groupName
42 trigPath =
'MistimedStream'
45 etabins = [-4.9,-4.475,-4.050,-3.625,-3.2,-3.1,-2.9,
46 -2.7,-2.5,-2.4,-2.3,-2.2,-2.1,-2.0,-1.9,
47 -1.8,-1.7,-1.6,-1.5,-1.4,-1.3,-1.2,-1.1,
48 -1.0,-0.9,-0.8,-0.7,-0.6,-0.5,-0.4,-0.3,
49 -0.2,-0.1,0.0,0.1,0.2,0.3,0.4,0.5,0.6,0.7,
50 0.8,0.9,1.0,1.1,1.2,1.3,1.4,1.5,1.6,1.7,
51 1.8,1.9,2.0,2.1,2.2,2.3,2.4,2.5,2.7,2.9,
52 3.1,3.2,3.625,4.050,4.475,4.9]
61 NumberOfGlobalErrors=11
62 globalStatus_xlabels = [
68 "<= 4 bad central TT",
72 ">= 1 significant TT in EM layer",
77 NumberofEvents = MistimedMonAlg.MaxEvents
80 myGroup = helper.addGroup(MistimedMonAlg, groupName , mainDir)
84 myGroup.defineHistogram(
'cutFlowX;1d_cutFlow_mistimedStreamAna',title=
'Total events selected by the MistimedStream analysis for this run',
87 xbins=NumberOfGlobalErrors,xmin=0.,xmax=NumberOfGlobalErrors,xlabels=globalStatus_xlabels,
90 groupMapsEvents = helper.addGroup(MistimedMonAlg,
'Event_', mainDir)
91 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)
92 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)
94 groupMapsEvents_all = helper.addGroup(MistimedMonAlg,
'Event_all_', mainDir)
95 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)
96 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)
98 groupMapsEfexin = helper.addGroup(MistimedMonAlg,
'Efex_maxTOB_in', mainDir)
99 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)
100 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)
102 groupMapsEfexout = helper.addGroup(MistimedMonAlg,
'Efex_maxTOB_out', mainDir)
103 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)
104 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)
106 groupMapsJfex = helper.addGroup(MistimedMonAlg,
'Jfex_maxTOB', mainDir)
107 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)
108 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)
110 groupMapsGfex = helper.addGroup(MistimedMonAlg,
'Gfex_maxTOB', mainDir)
111 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)
112 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)
115 histPath = trigPath+
'/EventofInterest'
117 for i
in range(0, NumberofEvents):
120 groupMapsEM = helper.addGroup(MistimedMonAlg,
'EventofInterest_'+
str(i)+
'_TT_EM', mainDir)
121 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)
122 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)
124 groupMapsHAD = helper.addGroup(MistimedMonAlg,
'EventofInterest_'+
str(i)+
'_TT_HAD', mainDir)
125 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)
126 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)
128 groupMapsEM0 = helper.addGroup(MistimedMonAlg,
'EventofInterest_'+
str(i)+
'_lut_EM0', mainDir)
129 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)
130 groupMapsEM1 = helper.addGroup(MistimedMonAlg,
'EventofInterest_'+
str(i)+
'_lut_EM1', mainDir)
131 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)
132 groupMapsEM2 = helper.addGroup(MistimedMonAlg,
'EventofInterest_'+
str(i)+
'_lut_EM2', mainDir)
133 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)
135 groupMapsHAD0 = helper.addGroup(MistimedMonAlg,
'EventofInterest_'+
str(i)+
'_lut_HAD0', mainDir)
136 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)
137 groupMapsHAD1 = helper.addGroup(MistimedMonAlg,
'EventofInterest_'+
str(i)+
'_lut_HAD1', mainDir)
138 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)
139 groupMapsHAD2 = helper.addGroup(MistimedMonAlg,
'EventofInterest_'+
str(i)+
'_lut_HAD2', mainDir)
140 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)
142 groupMapsEfex0 = helper.addGroup(MistimedMonAlg,
'EventofInterest_'+
str(i)+
'_Efex0', mainDir)
143 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)
144 groupMapsEfex1 = helper.addGroup(MistimedMonAlg,
'EventofInterest_'+
str(i)+
'_Efex1', mainDir)
145 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)
146 groupMapsEfex2 = helper.addGroup(MistimedMonAlg,
'EventofInterest_'+
str(i)+
'_Efex2', mainDir)
147 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)
149 groupMapsJfexEmulated = helper.addGroup(MistimedMonAlg,
'EventofInterest_'+
str(i)+
'_JfexEmulated', mainDir)
150 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)
152 groupMapsJfexSRJet = helper.addGroup(MistimedMonAlg,
'EventofInterest_'+
str(i)+
'_JfexSRJet', mainDir)
153 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)
154 groupMapsJfexTau = helper.addGroup(MistimedMonAlg,
'EventofInterest_'+
str(i)+
'_JfexTau', mainDir)
155 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)
157 groupMapsgFexSRJet = helper.addGroup(MistimedMonAlg,
'EventofInterest_'+
str(i)+
'_GfexSRJet', mainDir)
158 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)
159 groupMapsgFexLRJet = helper.addGroup(MistimedMonAlg,
'EventofInterest_'+
str(i)+
'_GfexLRJet', mainDir)
160 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)
162 acc = helper.result()
166 if __name__==
'__main__':
170 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
173 flags.Exec.MaxEvents = -1
174 flags.IOVDb.GlobalTag =
'CONDBR2-HLTP-2023-01'
175 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"]
178 flags.Output.HISTFileName =
'ExampleMonitorOutput_LVL1.root'
182 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
183 from AthenaPoolCnvSvc.PoolReadConfig
import PoolReadCfg
188 acc.merge(MistimedStreamMonitorCfg)
190 MistimedStreamMonitorCfg.getEventAlgo(
'MistimedStreamMonitorAlg').OutputLevel = 2
191 acc.printConfig(withDetails=
True, summariseProps =
True)
193 sys.exit(acc.run().isFailure())