9 from AthenaConfiguration.ComponentFactory
import CompFactory
14 selStr[
"passDigiNom"] =
"for unmasked SCs with ADC_max-pedestal > 10*RMS(DB) & good quality bits"
15 selStr[
"badNotMasked"] =
"for unmasked SCs which have bad quality bits"
17 selStr[
"passSCNom"] =
"for unmasked SCs which pass #tau selection with non-zero ET"
18 selStr[
"passSCNom1"] =
"for unmasked SCs which pass #tau selection with ET > 1 GeV"
19 selStr[
"passSCNom10"] =
"for unmasked SCs which pass tau selection with ET > 10 GeV"
20 selStr[
"passSCNom10tauGt3"] =
"for unmasked SCs which pass tau selection with ET > 10 GeV and #tau > 3"
21 selStr[
"saturNotMasked"] =
"for unmasked SCs which are saturated"
22 selStr[
"OFCbOFNotMasked"] =
"for unmasked SCs with OFCb in overflow"
23 selStr[
"onlofflEmismatch"] =
"for unmasked SCs which pass #tau selection where online & offline energies are different"
25 selStr[
"notMaskedEoflNe0"] =
"for unmasked SCs with non-zero ET ofl"
26 selStr[
"notMaskedEoflGt1"] =
"for unmasked SCs with ET ofl > 1 GeV"
31 '''Function to configures some algorithms in the monitoring system.'''
35 from AthenaMonitoring.AthMonitorCfgHelper
import AthMonitorCfgHelper
36 helper = AthMonitorCfgHelper(flags,
'LArDigitalTriggMonAlgCfg')
38 from LArMonitoring.GlobalVariables
import lArDQGlobals
40 from AthenaCommon.Logging
import logging
41 mlog = logging.getLogger(
'LArDigitalTriggMon' )
43 if not flags.DQ.enableLumiAccess:
44 from LumiBlockComps.LuminosityCondAlgConfig
import LuminosityCondAlgCfg
48 from LArCabling.LArCablingConfig
import LArOnOffIdMappingSCCfg
52 from LArConfiguration.LArElecCalibDBConfig
import LArElecCalibDBSCCfg
53 helper.resobj.merge(
LArElecCalibDBSCCfg(flags, condObjs=[
"Ramp",
"DAC2uA",
"Pedestal",
"uA2MeV",
"MphysOverMcal",
"OFC",
"Shape",
"HVScaleCorr"]))
57 larDigitalTriggMonAlg = helper.addAlgorithm(CompFactory.LArDigitalTriggMonAlg(
'larDigitalTriggMonAlg'))
58 larDigitalTriggMonAlg.ProblemsToMask=[
"maskedOSUM"]
64 for i
in range(0,len(streamTypes)):
65 mlog.info(
"runinfo.streamTypes()[i]: "+
str(streamTypes[i]))
66 if streamTypes[i] ==
"SelectedEnergy":
68 larDigitalTriggMonAlg.LArRawSCContainerKey =
"SC_ET_ID"
69 if streamTypes[i] ==
"Energy":
71 larDigitalTriggMonAlg.LArRawSCContainerKey =
"SC_ET"
72 if streamTypes[i] ==
"RawADC":
74 larLATOMEBuilderAlg.LArDigitKey =
"SC"
75 larLATOMEBuilderAlg.isADCBas =
False
76 larDigitalTriggMonAlg.LArDigitContainerKey =
"SC"
77 if streamTypes[i] ==
"ADC":
79 larDigitalTriggMonAlg.isADCBas =
True
80 larDigitalTriggMonAlg.LArDigitContainerKey =
"SC_ADC_BAS"
81 larLATOMEBuilderAlg.isADCBas =
True
82 larLATOMEBuilderAlg.LArDigitKey =
"SC_ADC_BAS"
84 if (hasEtId
and hasEt):
88 if (hasAdc
and hasAdcBas):
90 larDigitalTriggMonAlg.isADCBas=
False
92 mlog.info(
"Mux settings from COOL:")
93 mlog.info(
"has ET Id: "+
str(hasEtId))
94 mlog.info(
"has ET: "+
str(hasEt))
95 mlog.info(
"has ADC: "+
str(hasAdc))
96 mlog.info(
"has ADC Bas: "+
str(hasAdcBas))
99 larDigitalTriggMonAlg.SCMonGroup=SCGroupName
103 SCGroup = helper.addGroup(
104 larDigitalTriggMonAlg,
106 '/LArDigitalTrigger/',
112 LatomeDetBinMapping = dict([
113 (
"0x48",{
"Subdet":
"FCALC",
"Bin":1}),
114 (
"0x4c",{
"Subdet":
"EMEC/HECC",
"Bin":3}),
115 (
"0x44",{
"Subdet":
"EMECC",
"Bin":11}),
116 (
"0x4a",{
"Subdet":
"EMB/EMECC",
"Bin":27}),
117 (
"0x42",{
"Subdet":
"EMBC",
"Bin":43}),
118 (
"0x41",{
"Subdet":
"EMBA",
"Bin":59}),
119 (
"0x49",{
"Subdet":
"EMB/EMECA",
"Bin":75}),
120 (
"0x43",{
"Subdet":
"EMECA",
"Bin":91}),
121 (
"0x4b",{
"Subdet":
"EMEC/HECA",
"Bin":107}),
122 (
"0x47",{
"Subdet":
"FCALA",
"Bin":115})
131 for bb
in range (0,NLatomeBins):
133 for detID
in LatomeDetBinMapping:
134 if bb==(LatomeDetBinMapping[detID][
"Bin"]-1):
135 Label=LatomeDetBinMapping[detID][
"Subdet"]
138 if bb < NLatomeBins_side:
139 BinLabel_LATOME_C+=[Label+
str(phi)]
141 BinLabel_LATOME_A+=[Label+
str(phi)]
143 BinLabel_LATOME+=[Label+
str(phi)]
149 iphi_bins_dict = {
"ALL": 63,
"EMB": 63,
"EMEC": 63,
"HEC": 63,
"FCAL": 15}
154 SCGroup.defineHistogram(
'lumi_block,event_size;EventSize_vs_LB',
155 title=
'Digital trigger event size per LB; LumiBlock; Event size [MB]',
158 xbins=lArDQGlobals.LB_Bins, xmin=lArDQGlobals.LB_Min, xmax=lArDQGlobals.LB_Max)
163 partGroup_digi = helper.addArray([larDigitalTriggMonAlg.LayerNames], larDigitalTriggMonAlg,
'LArDigitalTriggerMon_digi', topPath=
'/LArDigitalTrigger/')
164 partGroup_sc = helper.addArray([larDigitalTriggMonAlg.LayerNames], larDigitalTriggMonAlg,
'LArDigitalTriggerMon_sc', topPath=
'/LArDigitalTrigger/')
166 for part
in larDigitalTriggMonAlg.LayerNames:
168 for sel
in selStr.keys():
169 selStrPart[sel] =
"in "+part+
" "+selStr[sel]
171 for key
in iphi_bins_dict.keys():
172 if part.startswith(key):
173 iphi_bins = iphi_bins_dict[key]
176 partxbins=lArDQGlobals.SuperCell_Variables[
"etaRange"][
"All"][
"All"]
177 partybins=lArDQGlobals.SuperCell_Variables[
"phiRange"][
"All"][
"All"]
180 topPath=
"PerPartition/"
192 partxbins=lArDQGlobals.SuperCell_Variables[
"etaRange"][Part][Side][Sampling]
193 partybins=lArDQGlobals.SuperCell_Variables[
"phiRange"][Part][Side][Sampling]
198 for thisSel
in [
"passDigiNom",
"badNotMasked"]:
199 thisTopPath=f
"/{thisSel}/{topPath}"
202 partGroup_digi.defineHistogram(
'Digi_part_maxpos,Digi_part_partition;Partition_vs_maxSamplePosition_'+thisSel,
203 title=
'Partition vs. position of max sample '+selStrPart[thisSel],
204 cutmask=
'Digi_part_'+thisSel,
207 xbins=nsamples,xmin=0.5,xmax=nsamples+0.5,
208 ybins=lArDQGlobals.N_Partitions, ymin=-0.5, ymax=lArDQGlobals.N_Partitions-0.5,
209 xlabels = [
str(x)
for x
in range(1,nsamples+1)],
210 ylabels=lArDQGlobals.Partitions,
213 partGroup_digi.defineHistogram(
'Digi_part_latomesourceidbin,Digi_part_adc;ADCFullRange_vs_LATOME_'+thisSel,
214 title=
'ADC vs LATOME name '+selStrPart[thisSel]+
'; ; ADC',
215 cutmask=
'Digi_part_'+thisSel,
218 xbins=NLatomeBins,xmin=1,xmax=NLatomeBins+1,
219 ybins=500, ymin=-2, ymax=2500,
220 xlabels=BinLabel_LATOME,
223 partGroup_digi.defineHistogram(
'Digi_part_latomesourceidbin,Digi_part_pedestal;Pedestal_vs_LATOME_'+thisSel,
224 title=
'Pedestal vs LATOME name '+selStrPart[thisSel]+
'; ; Pedestal',
225 cutmask=
'Digi_part_'+thisSel,
228 xbins=NLatomeBins,xmin=1,xmax=NLatomeBins+1,
229 ybins=500, ymin=-2, ymax=2500,
230 xlabels=BinLabel_LATOME,
233 partGroup_digi.defineHistogram(
'Digi_part_latomesourceidbin,Digi_part_maxpos;MaxSamplePosition_vs_LATOME_'+thisSel,
234 title=
'Position of max sample vs. LATOME '+selStrPart[thisSel],
236 cutmask=
'Digi_part_'+thisSel,
238 xbins=NLatomeBins,xmin=1,xmax=NLatomeBins+1,
239 ybins=nsamples,ymin=0.5,ymax=nsamples+0.5,
240 xlabels=BinLabel_LATOME,
241 ylabels = [
str(x)
for x
in range(1,nsamples+1)],
244 partGroup_digi.defineHistogram(
'Digi_part_latomesourceidbin,Digi_part_diff_adc0_ped;Diff_ADC0_Ped_vs_LATOME_'+thisSel,
245 title=
'ADC[0] - Pedestal vs LATOME name '+selStrPart[thisSel]+
'; ; ADC[0] - Pedestal',
247 cutmask=
'Digi_part_'+thisSel,
249 xbins=NLatomeBins,xmin=1,xmax=NLatomeBins+1,
250 ybins=64, ymin=-32, ymax=32,
251 xlabels=BinLabel_LATOME,
254 partGroup_digi.defineHistogram(
'Digi_part_latomesourceidbin,Digi_part_diff_adc_ped_norm;Diff_ADC_Ped_Norm_vs_LATOME_'+thisSel,
255 title=
'(ADC-ped)/fabs(ADC_max-ped) '+selStrPart[thisSel]+
'; LATOME Name; (ADC - pedestal) / fabs(ADC_max - pedestal)',
257 cutmask=
'Digi_part_'+thisSel,
259 xbins=NLatomeBins,xmin=1,xmax=NLatomeBins+1,
260 ybins=64, ymin=-32, ymax=32,
261 xlabels=BinLabel_LATOME,
266 partGroup_digi.defineHistogram(
'Digi_part_eta,Digi_part_phi;Coverage_Eta_Phi_'+thisSel,
267 title=
'SC coverage '+selStrPart[thisSel]+
': #phi vs #eta;#eta;#phi',
269 path=thisTopPath+
'/Coverage',
270 cutmask=
'Digi_part_'+thisSel,
276 if not flags.Common.isOnline:
continue
278 if thisSel !=
"passDigiNom":
continue
279 partGroup_digi.defineHistogram(
'Digi_part_eta,Digi_part_phi,Digi_part_diff_adc0_ped;Coverage_Diff_ADC0_Ped_'+thisSel,
280 title=
'ADC[0] - Pedestal'+selStrPart[thisSel]+
': #phi vs #eta;#eta;#phi',
282 cutmask=
'Digi_part_'+thisSel,
283 path=thisTopPath+
'/Coverage',
290 partGroup_digi.defineHistogram(
'Digi_part_BCID,Digi_part_iphi,Digi_part_diff_adc_ped;Diff_ADC_Ped_Per_BCID_Per_iphi_'+thisSel,
291 title=
'ADC - Pedestal (all samples) '+selStrPart[thisSel]+
': iphi vs BCID;BCID;iphi',
293 cutmask=
'Digi_part_'+thisSel,
295 xbins=3564,xmin=-0.5,xmax=3563.5,
296 ybins=iphi_bins+1,ymin=0,ymax=iphi_bins+1,
304 partGroup_digi.defineHistogram(
'Digi_part_sampos,Digi_part_adc;ADCZoom_vs_SamplePosition_'+thisSel,
305 title=
'ADC (zoom) vs sample position '+selStrPart[thisSel],
306 cutmask=
'Digi_part_'+thisSel,
309 xbins=nsamples,xmin=0.5,xmax=nsamples+0.5,
310 xlabels = [
str(x)
for x
in range(1,nsamples+1)],
311 ybins=750, ymin=0, ymax=1300,
314 partGroup_digi.defineHistogram(
'Digi_part_sampos,Digi_part_adc;ADCFullRange_vs_SamplePosition_'+thisSel,
315 title=
'ADC vs sample position '+selStrPart[thisSel],
316 cutmask=
'Digi_part_'+thisSel,
319 xbins=nsamples,xmin=0.5,xmax=nsamples+0.5,
320 xlabels = [
str(x)
for x
in range(1,nsamples+1)],
321 ybins=500, ymin=0, ymax=5000,
324 partGroup_digi.defineHistogram(
'Digi_part_sampos,Digi_part_pedestal;Pedestal_vs_SamplePosition_'+thisSel,
325 title=
'Pedestal vs sample position '+selStrPart[thisSel],
326 cutmask=
'Digi_part_'+thisSel,
329 xbins=nsamples,xmin=0.5,xmax=nsamples+0.5,
330 xlabels = [
str(x)
for x
in range(1,nsamples+1)],
331 ybins=500, ymin=0, ymax=5000,
334 partGroup_digi.defineHistogram(
'Digi_part_diff_adc0_ped;Diff_ADC0_Ped_'+thisSel,
335 title=
'LATOME (ADC[0]-ped) '+selStrPart[thisSel]+
'; (ADC - pedestal)',
337 cutmask=
'Digi_part_'+thisSel,
339 xbins=50,xmin=-25,xmax=25,
342 partGroup_digi.defineHistogram(
'Digi_part_sampos,Digi_part_diff_adc_ped_norm;Diff_ADC_Ped_Norm_vs_SamplePosition_'+thisSel,
343 title=
'(ADC-ped)/fabs(ADC_max-ped) '+selStrPart[thisSel]+
'; Sample position; (ADC - pedestal) / fabs(ADC_max - pedestal)',
345 cutmask=
'Digi_part_'+thisSel,
347 ybins=40,ymin=-1,ymax=1,
348 xbins=nsamples,xmin=0.5,xmax=nsamples+0.5,
349 xlabels = [
str(x)
for x
in range(1,nsamples+1)],
352 partGroup_digi.defineHistogram(
'Digi_part_BCID, Digi_part_adc;ADC_vs_BCID_'+thisSel,
353 title=
'ADC value vs BCID '+selStrPart[thisSel]+
'; BCID; ADC Value',
355 cutmask=
'Digi_part_'+thisSel,
357 xbins=3564,xmin=-0.5,xmax=3563.5,
358 ybins=500, ymin=0, ymax=5000,
361 partGroup_digi.defineHistogram(
'Digi_part_BCID, Digi_part_diff_adc0_ped;Diff_ADC0_Ped_vs_BCID_'+thisSel,
362 title=
'ADC[0] - Ped value vs BCID '+selStrPart[thisSel]+
'; BCID; ADC[0] Value',
364 cutmask=
'Digi_part_'+thisSel,
366 xbins=3564,xmin=-0.5,xmax=3563.5,
367 ybins=500, ymin=-5, ymax=5,
373 for thisSel
in [
"passSCNom",
"passSCNom1",
"passSCNom10",
"passSCNom10tauGt3",
"saturNotMasked",
"OFCbOFNotMasked",
"onlofflEmismatch",
"notMaskedEoflNe0",
"notMaskedEoflGt1"]:
374 thisTopPath=f
"/{thisSel}/{topPath}"
377 partGroup_sc.defineHistogram(
'SC_part_latomesourceidbin,SC_part_et_onl;SC_ET_Onl_vs_LATOME_'+thisSel,
378 title=
'SC ET [GeV] vs LATOME name '+selStrPart[thisSel]+
'; ; ET SC [GeV]',
380 cutmask=
'SC_part_'+thisSel,
382 xbins=NLatomeBins,xmin=1,xmax=NLatomeBins+1,
383 ybins=200, ymin=-10, ymax=200,
384 xlabels=BinLabel_LATOME,
388 partGroup_sc.defineHistogram(
'SC_part_LB,SC_part_latomesourceidbin;LB_vs_LATOME_'+thisSel,
389 title=
'LATOME name vs LB '+selStrPart[thisSel]+
';LB;LATOME',
391 cutmask=
'SC_part_'+thisSel,
393 xbins=lArDQGlobals.LB_Bins, xmin=lArDQGlobals.LB_Min, xmax=lArDQGlobals.LB_Max,
394 ybins=NLatomeBins,ymin=1,ymax=NLatomeBins+1,
395 ylabels=BinLabel_LATOME,
398 partGroup_sc.defineHistogram(
'SC_part_time,SC_part_et_ofl;time_vs_et_ofl_'+thisSel,
399 title=
'SC coverage '+selStrPart[thisSel]+
': #tau vs ET ofl;#tau;ET ofl',
401 cutmask=
'SC_part_'+thisSel,
403 xbins=500,xmin=-50,xmax=50,
404 ybins=500,ymin=-10,ymax=70,
408 partGroup_sc.defineHistogram(
'SC_part_latomesourceidbin,SC_part_time;MeanOfflineLATOMEtime_vs_LATOME_'+thisSel,
409 title=
'Average LATOME #tau from Offline computation per LATOME'+selStrPart[thisSel]+
'; LATOME ; #tau [ns]',
411 cutmask=
'SC_part_'+thisSel,
413 xbins=NLatomeBins,xmin=1,xmax=NLatomeBins+1,
414 ybins=200, ymin=-50, ymax=50,
415 xlabels=BinLabel_LATOME,
418 partGroup_sc.defineHistogram(
'SC_part_LB,SC_part_latomesourceidbin,SC_part_time;MeanOfflineLATOMEtime_perLB_perLATOME_'+thisSel,
419 title=
'SC #tau '+selStrPart[thisSel]+
': LATOME vs LB;LB;LATOME',
421 cutmask=
'SC_part_'+thisSel,
423 xbins=lArDQGlobals.LB_Bins, xmin=lArDQGlobals.LB_Min, xmax=lArDQGlobals.LB_Max,
424 ybins=NLatomeBins,ymin=1,ymax=NLatomeBins+1,
425 ylabels=BinLabel_LATOME,
428 partGroup_sc.defineHistogram(
'SC_part_LB,SC_part_time;MeanOfflineLATOMEtime_vs_LB_'+thisSel,
429 title=
'Average LATOME #tau from Offline computation per LB '+selStrPart[thisSel]+
'; LumiBloc; #tau [ns]',
431 cutmask=
'SC_part_'+thisSel,
433 xbins=lArDQGlobals.LB_Bins, xmin=lArDQGlobals.LB_Min, xmax=lArDQGlobals.LB_Max,
439 partGroup_sc.defineHistogram(
'SC_part_eta,SC_part_phi;Coverage_Eta_Phi_'+thisSel,
440 title=
'SC coverage '+selStrPart[thisSel]+
': #phi vs #eta;#eta;#phi',
442 cutmask=
'SC_part_'+thisSel,
443 path=thisTopPath+
'/Coverage',
449 partGroup_sc.defineHistogram(
'SC_part_time;OfflineLATOMEtime_'+thisSel,
450 title=
'LATOME #tau from Offline Computation '+selStrPart[thisSel]+
';#tau [ns]; Evts;',
452 cutmask=
'SC_part_'+thisSel,
454 xbins=100,xmin=-25,xmax=25,
458 if not flags.Common.isOnline:
continue
460 if thisSel !=
"passSCNom1":
continue
462 partGroup_sc.defineHistogram(
'SC_part_eta,SC_part_phi,SC_part_et_onl;Coverage_Et_Onl_'+thisSel,
463 title=
'SC Energy '+selStrPart[thisSel]+
': #phi vs #eta;#eta;#phi',
465 cutmask=
'SC_part_'+thisSel,
466 path=thisTopPath+
'/Coverage',
471 partGroup_sc.defineHistogram(
'SC_part_eta,SC_part_phi,SC_part_time;Coverage_OfflineLATOMEtime_'+thisSel,
472 title=
'LATOME #tau from Offline Computation '+selStrPart[thisSel]+
': #phi vs #eta;#eta;#phi',
474 cutmask=
'SC_part_'+thisSel,
475 path=thisTopPath+
'/Coverage',
480 partGroup_sc.defineHistogram(
'SC_part_et_onl,SC_part_et_ofl;ET_Ofl_vs_ET_Onl_'+thisSel,
481 title=
'LATOME ET vs Offline Computation '+selStrPart[thisSel]+
'; ET Onl;ET Offl [GeV]',
483 cutmask=
'SC_part_'+thisSel,
485 xbins=0,xmin=0,xmax=20,
486 ybins=0,ymin=0,ymax=20,
489 partGroup_sc.defineHistogram(
'SC_part_et_diff;ET_Diff_OnlOfl_'+thisSel,
490 title=
'LATOME ET vs Offline Computation '+selStrPart[thisSel]+
'; ET Onl - ET Offl [GeV]; Evts;',
492 cutmask=
'SC_part_'+thisSel,
494 xbins=200,xmin=-10,xmax=10,
498 partGroup_sc.defineHistogram(
'SC_part_et_onl;SC_ET_Onl_'+thisSel,
499 title=
'SC eT [GeV] '+selStrPart[thisSel],
501 cutmask=
'SC_part_'+thisSel,
503 xbins=500, xmin=-100, xmax=400,
507 partGroup_sc.defineHistogram(
'SC_part_BCID,SC_part_time;MeanOfflineLATOMEtime_vs_BCID_'+thisSel,
508 title=
'Average LATOME #tau from Offline computation per BCID '+selStrPart[thisSel]+
'; BCID; #tau [ns]',
510 cutmask=
'SC_part_'+thisSel,
512 xbins=3564,xmin=-0.5,xmax=3563.5,
515 partGroup_sc.defineHistogram(
'SC_part_BCID,SC_part_et_onl_muscaled;AvEnergyVsBCID_'+thisSel,
516 title=
'Average Energy vs BCID '+selStrPart[thisSel]+
'; BCID; Energy per SC [MeV]',
518 cutmask=
'SC_part_'+thisSel,
520 xbins=3564,xmin=-0.5,xmax=3563.5,
521 ybins=10, ymin=-20, ymax=20,
525 return helper.result()
528 if __name__==
'__main__':
530 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
531 from AthenaConfiguration.TestDefaults
import defaultGeometryTags
534 from AthenaConfiguration.Enums
import LHCPeriod
535 flags.GeoModel.Run = LHCPeriod.Run3
537 flags.Input.Files = [
"/eos/atlas/atlascerngroupdisk/proj-spot/spot-job-inputs/data23_13p6TeV/data23_13p6TeV.00451569.physics_Main.daq.RAW._lb0260._SFO-14._0001.data"]
539 flags.Output.HISTFileName =
'LArDigitalTriggMonOutput.root'
541 flags.DQ.useTrigger =
False
542 flags.GeoModel.AtlasVersion=defaultGeometryTags.RUN3
543 flags.PerfMon.doFullMonMT=
True
544 flags.Exec.MaxEvents=100
548 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
552 from CaloRec.CaloRecoConfig
import CaloRecoCfg
555 from LArBadChannelTool.LArBadChannelConfig
import LArBadChannelCfg
558 from LArByteStream.LArRawSCDataReadingConfig
import LArRawSCDataReadingCfg
561 cfg.merge(SCData_acc)
563 larLATOMEBuilderAlg=CompFactory.LArLATOMEBuilderAlg(
"LArLATOMEBuilderAlg",LArDigitKey=
"SC", isADCBas=
False)
564 cfg.addEventAlgo(larLATOMEBuilderAlg)
566 streamTypes = [
"SelectedEnergy",
"ADC"]
570 from PerfMonComps.PerfMonCompsConfig
import PerfMonMTSvcCfg