5 '''Function to configures some algorithms in the monitoring system.'''
10 from AthenaMonitoring.AthMonitorCfgHelper
import AthMonitorCfgHelper
11 helper = AthMonitorCfgHelper(flags,
'LArNoiseCorrelationMonAlgCfg')
13 from AthenaConfiguration.ComponentFactory
import CompFactory
19 from LArMonitoring.GlobalVariables
import lArDQGlobals
21 larNoiseCorrelMonAlg = helper.addAlgorithm(algoinstance,
'larNoiseCorrelMonAlg')
26 customFEBStoMonitor = flags.LArMon.customFEBsToMonitor
27 except AttributeError:
28 customFEBStoMonitor = [
"endcapAft19slot12",
"endcapAft19slot09",
"endcapAft20slot09"]
32 from ROOT
import LArStrHelper
34 customFEBStoMonitor=[larStrHelp.fixFEBname(nm)
for nm
in customFEBStoMonitor]
38 larNoiseCorrelMonAlg.ProblemsToMask=[
"deadReadout",
"deadPhys",
"short",
"almostDead",
"highNoiseHG",
"highNoiseMG",
"highNoiseLG",
"sporadicBurstNoise"]
39 larNoiseCorrelMonAlg.IgnoreBadChannels=
True
40 larNoiseCorrelMonAlg.TriggerChain =
"HLT_noalg_zb_L1ZB, HLT_noalg_zb_L1RD1_EMPTY, HLT_noalg_cosmiccalo_L1RD1_EMPTY"
42 larNoiseCorrelMonAlg.IsCalibrationRun = flags.LArMon.calibRun
43 except AttributeError:
44 larNoiseCorrelMonAlg.IsCalibrationRun =
False
46 larNoiseCorrelMonAlg.LArDigitContainerKey = flags.LArMon.LArDigitKey
47 except AttributeError:
48 larNoiseCorrelMonAlg.LArDigitContainerKey =
'FREE'
51 if len(customFEBStoMonitor)==0:
53 if flags.DQ.Environment ==
'online':
54 from AthenaCommon.Logging
import logging
55 larNoiseCorrelMonAlg.PlotsOFF=
True
56 msg=logging.getLogger(
"LArNoiseCorrelationMonAlg")
57 msg.warning(
"customFEBStoMonitors empty, and we are online, no plot will be produced")
58 msg.warning(customFEBStoMonitor)
60 febsToMonitorBarrelA=lArDQGlobals.febsBarrelA
61 febsToMonitorEndcapA=lArDQGlobals.febsEndcapA
62 febsToMonitorBarrelC=lArDQGlobals.febsBarrelC
63 febsToMonitorEndcapC=lArDQGlobals.febsEndcapC
64 larNoiseCorrelMonAlg.FEBlist=febsToMonitorBarrelA+febsToMonitorBarrelC+febsToMonitorEndcapA+febsToMonitorEndcapC
66 setCustomFEBS=
set(customFEBStoMonitor)
67 febsToMonitorBarrelA=
sorted(setCustomFEBS.intersection(lArDQGlobals.febsBarrelA))
68 febsToMonitorEndcapA=
sorted(setCustomFEBS.intersection(lArDQGlobals.febsEndcapA))
69 febsToMonitorBarrelC=
sorted(setCustomFEBS.intersection(lArDQGlobals.febsBarrelC))
70 febsToMonitorEndcapC=
sorted(setCustomFEBS.intersection(lArDQGlobals.febsEndcapC))
72 if len(febsToMonitorBarrelA)==0
and len(febsToMonitorEndcapA)==0
and len(febsToMonitorBarrelC)==0
and len(febsToMonitorEndcapC)==0:
73 from AthenaCommon.Logging
import logging
74 msg=logging.getLogger(
"LArNoiseCorrelationMonAlg")
75 msg.warning(
"None of the following FEBs were recognised, no plot will be produced")
76 msg.warning(customFEBStoMonitor)
77 larNoiseCorrelMonAlg.PlotsOFF=
True
78 larNoiseCorrelMonAlg.FEBlist=lArDQGlobals.febsBarrelA+lArDQGlobals.febsEndcapA+lArDQGlobals.febsBarrelC+lArDQGlobals.febsEndcapC
83 larNoiseCorrelMonAlg.FEBlist=febsToMonitorBarrelA+febsToMonitorBarrelC+febsToMonitorEndcapA+febsToMonitorEndcapC
87 if larNoiseCorrelMonAlg.PlotsOFF:
88 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
90 cfg.merge(helper.result())
95 larNoiseCorrelMonAlg.NoiseCorrGroupName=grpName
96 correlArray = helper.addArray([larNoiseCorrelMonAlg.FEBlist],larNoiseCorrelMonAlg,grpName,
'/LAr/',
'run')
99 hist_path=
'NoiseCorrelation/'
101 average_plot_name=
"RAW_NoiseCorr_average"
102 average_var_and_name=
"chanMeanX,chanMean;"+average_plot_name
103 correlArray.defineHistogram(average_var_and_name,
104 title=average_plot_name,
106 path=hist_path+
'BarrelA',
107 xbins=lArDQGlobals.FEB_N_channels,xmin=lArDQGlobals.FEB_channels_Min,xmax=lArDQGlobals.FEB_channels_Max,
108 pattern=febsToMonitorBarrelA)
110 correlArray.defineHistogram(average_var_and_name,
111 title=average_plot_name,
113 path=hist_path+
'EndcapA',
114 xbins=lArDQGlobals.FEB_N_channels,xmin=lArDQGlobals.FEB_channels_Min,xmax=lArDQGlobals.FEB_channels_Max,
115 pattern=febsToMonitorEndcapA)
118 correlArray.defineHistogram(average_var_and_name,
119 title=average_plot_name,
121 path=hist_path+
'BarrelC',
122 xbins=lArDQGlobals.FEB_N_channels,xmin=lArDQGlobals.FEB_channels_Min,xmax=lArDQGlobals.FEB_channels_Max,
123 pattern=febsToMonitorBarrelC)
125 correlArray.defineHistogram(average_var_and_name,
126 title=average_plot_name,
128 path=hist_path+
'EndcapC',
129 xbins=lArDQGlobals.FEB_N_channels,xmin=lArDQGlobals.FEB_channels_Min,xmax=lArDQGlobals.FEB_channels_Max,
130 pattern=febsToMonitorEndcapC)
133 partialSum_plot_name=
"RAW_NoiseCorr_partialSum"
134 partialSum_var_and_name=
"chanPartSumX,chanPartSumY;"+partialSum_plot_name
136 correlArray.defineHistogram(partialSum_var_and_name,
137 title=partialSum_plot_name,
139 weight=
'chanPartSum',
140 path=hist_path+
'BarrelA',
141 xbins=lArDQGlobals.FEB_N_channels,xmin=lArDQGlobals.FEB_channels_Min,xmax=lArDQGlobals.FEB_channels_Max,
142 ybins=lArDQGlobals.FEB_N_channels,ymin=lArDQGlobals.FEB_channels_Min,ymax=lArDQGlobals.FEB_channels_Max,
143 pattern=febsToMonitorBarrelA)
145 correlArray.defineHistogram(partialSum_var_and_name,
146 title=partialSum_plot_name,
148 weight=
'chanPartSum',
149 path=hist_path+
'EndcapA',
150 xbins=lArDQGlobals.FEB_N_channels,xmin=lArDQGlobals.FEB_channels_Min,xmax=lArDQGlobals.FEB_channels_Max,
151 ybins=lArDQGlobals.FEB_N_channels,ymin=lArDQGlobals.FEB_channels_Min,ymax=lArDQGlobals.FEB_channels_Max,
152 pattern=febsToMonitorEndcapA)
155 correlArray.defineHistogram(partialSum_var_and_name,
156 title=partialSum_plot_name,
158 weight=
'chanPartSum',
159 path=hist_path+
'BarrelC',
160 xbins=lArDQGlobals.FEB_N_channels,xmin=lArDQGlobals.FEB_channels_Min,xmax=lArDQGlobals.FEB_channels_Max,
161 ybins=lArDQGlobals.FEB_N_channels,ymin=lArDQGlobals.FEB_channels_Min,ymax=lArDQGlobals.FEB_channels_Max,
162 pattern=febsToMonitorBarrelC)
164 correlArray.defineHistogram(partialSum_var_and_name,
165 title=partialSum_plot_name,
167 weight=
'chanPartSum',
168 path=hist_path+
'EndcapC',
169 xbins=lArDQGlobals.FEB_N_channels,xmin=lArDQGlobals.FEB_channels_Min,xmax=lArDQGlobals.FEB_channels_Max,
170 ybins=lArDQGlobals.FEB_N_channels,ymin=lArDQGlobals.FEB_channels_Min,ymax=lArDQGlobals.FEB_channels_Max,
171 pattern=febsToMonitorEndcapC)
174 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
176 cfg.merge(helper.result())
180 if __name__==
'__main__':
182 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
185 from AthenaCommon.Logging
import log
189 from LArMonitoring.LArMonConfigFlags
import addLArMonFlags
190 flags.addFlagsCategory(
"LArMon", addLArMonFlags)
192 from AthenaConfiguration.TestDefaults
import defaultTestFiles
193 flags.Input.Files = defaultTestFiles.RAW_RUN2
195 flags.Output.HISTFileName =
'LArNoiseCorrMonOutput.root'
196 flags.DQ.enableLumiAccess =
False
197 flags.DQ.useTrigger =
False
200 from CaloRec.CaloRecoConfig
import CaloRecoCfg
203 from LArCellRec.LArNoisyROSummaryConfig
import LArNoisyROSummaryCfg
213 f=
open(
"LArNoiseCorrelationMon.pkl",
"wb")