7 '''Function to configures some algorithms in the monitoring system.'''
11 from AthenaMonitoring.AthMonitorCfgHelper
import AthMonitorCfgHelper
12 helper = AthMonitorCfgHelper(flags,
'LArCollisionTimeMonAlgCfg')
14 from LArCellRec.LArCollisionTimeConfig
import LArCollisionTimeCfg
17 from LArClusterRec.LArClusterCollisionTimeConfig
import LArClusterCollisionTimeCfg
20 larColTime_hist_path=
'LArCollisionTime'
22 from AthenaConfiguration.ComponentFactory
import CompFactory
25 larClusColTime_hist_path=
'LArClusterCollisionTime'
27 for algo
in helper.monSeq.Members:
28 if algo.name ==
'LArClusterCollisionTimeMonAlg':
29 algo.Key =
"ClusterCollTime"
32 cfg.merge(helper.result())
37 larCollTimeMonAlg = helper.addAlgorithm(algoinstance,larColTime_hist_path+
'MonAlg')
39 collTimeGroupName=
"LArCollisionTimeMonGroup"
41 larCollTimeMonAlg.CollTimeGroupName=collTimeGroupName
45 timeUnit = Units.picosecond
46 larCollTimeMonAlg.TimeUnit = timeUnit
48 collTimeGroup = helper.addGroup(
55 from LArMonitoring.GlobalVariables
import lArDQGlobals
59 if timeUnit == Units.nanosecond:
63 collTimeGroup.defineHistogram(
'ecTimeDiff;LArCollTime',
64 title=
'LArCollisionTime - difference of avg time from ECC and ECA;<t_{C}> - <t_{A}> ('+timeUnitName+
');'+(
'Number of events (weighted by energy/GeV) per %.2f ' % (lArDQGlobals.colTime_BinWidth/timeUnit))+timeUnitName,
66 path=larColTime_hist_path,
68 xbins=lArDQGlobals.colTime_Bins,xmin=lArDQGlobals.colTime_Min/timeUnit,xmax=lArDQGlobals.colTime_Max/timeUnit)
70 collTimeGroup.defineHistogram(
'ecTimeAvg;LArCollAvgTime',
71 title=
'LArCollisionAverageTime - avg time of ECC and ECA;(<t_{C}> + <t_{A}>) / 2 ('+timeUnitName+(
');Number of events (weighted by energy/GeV) per %.2f ' % (lArDQGlobals.avgColTime_BinWidth/timeUnit))+timeUnitName,
73 path=larColTime_hist_path,
75 xbins=lArDQGlobals.avgColTime_Bins,xmin=lArDQGlobals.avgColTime_Min/timeUnit,xmax=lArDQGlobals.avgColTime_Max/timeUnit)
78 collTimeGroup.defineHistogram(
'ecTimeDiff;LArCollTimeLumiBlock',
79 title=
'LArCollisionTime - difference of avg time from ECC and ECA;<t_{C}> - <t_{A}> ('+timeUnitName+(
');Number of events (weighted by energy/GeV) per %.2f ' % (lArDQGlobals.colTime_BinWidth/timeUnit))+timeUnitName,
81 path=larColTime_hist_path,
83 xbins=lArDQGlobals.colTime_Bins,xmin=lArDQGlobals.colTime_Min/timeUnit,xmax=lArDQGlobals.colTime_Max/timeUnit,
87 collTimeGroup.defineHistogram(
'lumi_block_timeWindow;LArCollTimeLumiBlockTimeCut',
88 title=
'Events with abs(<t_{C}> - <t_{A}>) < 10 ns as a function of LB;Luminosity Block Number;Number of events per LB',
90 path=larColTime_hist_path,
92 xbins=lArDQGlobals.LB_Bins,xmin=lArDQGlobals.LB_Min,xmax=lArDQGlobals.LB_Max)
95 collTimeGroup.defineHistogram(
'lumi_block_singleBeam_timeWindow;LArCollTimeLumiBlockSingleBeamTimeCut',
96 title=
'Events with 20 ns < abs(<t_{C}> - <t_{A}>) < 30ns as a function of LB;Luminosity Block Number;Number of events per LB',
98 path=larColTime_hist_path,
100 xbins=lArDQGlobals.LB_Bins,xmin=lArDQGlobals.LB_Min,xmax=lArDQGlobals.LB_Max)
103 collTimeGroup.defineHistogram(
'lumi_block,ecTimeDiff;LArCollTime_vs_LB',
104 title=
'LArCollisionTime Vs Luminosity Block - difference of avg time of ECC and ECA as a function of luminosity block;Luminosity Block Number;<t_{C}> - <t_{A}> ('+timeUnitName+
');Number of events (weighted by energy/GeV)',
106 path=larColTime_hist_path,
108 xbins=lArDQGlobals.LB_Bins,xmin=lArDQGlobals.LB_Min,xmax=lArDQGlobals.LB_Max,
109 ybins=lArDQGlobals.colTime_Bins,ymin=lArDQGlobals.colTime_Min/timeUnit,ymax=lArDQGlobals.colTime_Max/timeUnit)
112 collTimeGroup.defineHistogram(
'bunch_crossing_id,ecTimeDiff;LArCollTime_vs_BCID',
113 title=
'LArCollisionTime Vs BCID - difference of avg time of ECC and ECA as a function of BCID;Bunch Crossing Number;<t_{C}> - <t_{A}> ('+timeUnitName+
');Number of events (weighted by energy/GeV)',
115 path=larColTime_hist_path,
117 xbins=lArDQGlobals.BCID_Bins,xmin=lArDQGlobals.BCID_Min,xmax=lArDQGlobals.BCID_Max,
118 ybins=lArDQGlobals.colTime_Bins,ymin=lArDQGlobals.colTime_Min/timeUnit,ymax=lArDQGlobals.colTime_Max/timeUnit)
120 collTimeGroup.defineHistogram(
'lumi_block,ecTimeAvg;LArCollAvgTime_vs_LB',
121 title=
'LArCollisionAvgTime Vs Luminosity Block - avg time of ECC and ECA as a function of luminosity block;Luminosity Block Number;(<t_{C}> + <t_{A}>) / 2 ('+timeUnitName+
');Number of events (weighted by energy/GeV)',
123 path=larColTime_hist_path,
125 xbins=lArDQGlobals.LB_Bins,xmin=lArDQGlobals.LB_Min,xmax=lArDQGlobals.LB_Max,
126 ybins=lArDQGlobals.avgColTime_Bins,ymin=lArDQGlobals.avgColTime_Min/timeUnit,ymax=lArDQGlobals.avgColTime_Max/timeUnit)
128 collTimeGroup.defineHistogram(
'bunch_crossing_id,ecTimeAvg;LArCollAvgTime_vs_BCID',
129 title=
'LArCollisionAvgTime Vs BCID - avg time of ECC and ECA as a function of BCID;Bunch Crossing Number;(<t_{C}> + <t_{A}>) / 2 ('+timeUnitName+
');Number of events (weighted by energy/GeV)',
131 path=larColTime_hist_path,
133 xbins=lArDQGlobals.BCID_Bins,xmin=lArDQGlobals.BCID_Min,xmax=lArDQGlobals.BCID_Max,
134 ybins=lArDQGlobals.avgColTime_Bins,ymin=lArDQGlobals.avgColTime_Min/timeUnit,ymax=lArDQGlobals.avgColTime_Max/timeUnit)
138 if flags.Common.isOnline:
140 collTimeGroupName_intrain=collTimeGroupName+
"_intrain"
141 collTimeGroup_intrain = helper.addGroup(
143 collTimeGroupName_intrain,
146 larCollTimeMonAlg.InTrain_CollTimeGroupName=collTimeGroupName_intrain
148 intrain_title=
" inside the train"
149 intrain_name=
"_intrain"
151 collTimeGroup_intrain.defineHistogram(
'ecTimeDiff;LArCollTime'+intrain_name,
152 title=
'LArCollisionTime - difference of avg time from ECC and ECA'+intrain_title+
';<t_{C}> - <t_{A}> ('+timeUnitName+(
');Number of events (weighted by energy/GeV) per %.2f ' % (lArDQGlobals.colTime_BinWidth/timeUnit))+timeUnitName,
154 path=larColTime_hist_path,
156 xbins=lArDQGlobals.colTime_Bins,xmin=lArDQGlobals.colTime_Min/timeUnit,xmax=lArDQGlobals.colTime_Max/timeUnit)
159 collTimeGroup_intrain.defineHistogram(
'ecTimeAvg;LArCollAvgTime'+intrain_name,
160 title=
'LArCollisionAverageTime - avg time of ECC and ECA'+intrain_title+
';(<t_{C}> + <t_{A}>) / 2 ('+timeUnitName+(
');Number of events (weighted by energy/GeV) per %.2f ' % (lArDQGlobals.avgColTime_BinWidth/timeUnit))+timeUnitName,
162 path=larColTime_hist_path,
164 xbins=lArDQGlobals.avgColTime_Bins,xmin=lArDQGlobals.avgColTime_Min/timeUnit,xmax=lArDQGlobals.avgColTime_Max/timeUnit)
167 collTimeGroup_intrain.defineHistogram(
'ecTimeDiff;LArCollTimeLumiBlock'+intrain_name,
168 title=
'LArCollisionTime - difference of avg time from ECC and ECA;<t_{C}> - <t_{A}> ('+timeUnitName+
')'+intrain_title+(
';Number of events (weighted by energy/GeV) per %.2f ' % (lArDQGlobals.colTime_BinWidth/timeUnit))+timeUnitName,
170 path=larColTime_hist_path,
172 xbins=lArDQGlobals.colTime_Bins,xmin=lArDQGlobals.colTime_Min/timeUnit,xmax=lArDQGlobals.colTime_Max/timeUnit,
177 collTimeGroup_intrain.defineHistogram(
'(lumi_block_timeWindow);LArCollTimeLumiBlockTimeCut'+intrain_name,
178 title=
'Events with abs(<t_{C}> - <t_{A}>) < 10ns as a function of LB'+intrain_title+
';Luminosity Block Number;Number of events per LB',
179 path=larColTime_hist_path,
181 xbins=lArDQGlobals.LB_Bins,xmin=lArDQGlobals.LB_Min,xmax=lArDQGlobals.LB_Max)
184 collTimeGroup_intrain.defineHistogram(
'(lumi_block_singleBeam_timeWindow);LArCollTimeLumiBlockSingleBeamTimeCut'+intrain_name,
185 title=
'Events with 20 ns < abs(<t_{C}> - <t_{A}>) < 30ns as a function of LB'+intrain_title+
';Luminosity Block Number;Number of events per LB',
187 path=larColTime_hist_path,
189 xbins=lArDQGlobals.LB_Bins,xmin=lArDQGlobals.LB_Min,xmax=lArDQGlobals.LB_Max)
192 collTimeGroup_intrain.defineHistogram(
'lumi_block,ecTimeDiff;LArCollTime_vs_LB'+intrain_name,
193 title=
'LArCollisionTime Vs Luminosity Block - difference of avg time of ECC and ECA as a function of luminosity block;Luminosity Block Number'+intrain_title+
';<t_{C}> - <t_{A}> ('+timeUnitName+
');Number of events (weighted by energy/GeV)',
195 path=larColTime_hist_path,
197 xbins=lArDQGlobals.LB_Bins,xmin=lArDQGlobals.LB_Min,xmax=lArDQGlobals.LB_Max,
198 ybins=lArDQGlobals.colTime_Bins,ymin=lArDQGlobals.colTime_Min/timeUnit,ymax=lArDQGlobals.colTime_Max/timeUnit)
201 collTimeGroup_intrain.defineHistogram(
'bunch_crossing_id,ecTimeDiff;LArCollTime_vs_BCID'+intrain_name,
202 title=
'LArCollisionTime Vs BCID - difference of avg time of ECC and ECA as a function of BCID'+intrain_title+
';Bunch Crossing Number;<t_{C}> - <t_{A}> ('+timeUnitName+
');Number of events (weighted by energy/GeV)',
204 path=larColTime_hist_path,
206 xbins=lArDQGlobals.BCID_Bins,xmin=lArDQGlobals.BCID_Min,xmax=lArDQGlobals.BCID_Max,
207 ybins=lArDQGlobals.colTime_Bins,ymin=lArDQGlobals.colTime_Min/timeUnit,ymax=lArDQGlobals.colTime_Max/timeUnit)
209 collTimeGroup_intrain.defineHistogram(
'lumi_block,ecTimeAvg;LArCollAvgTime_vs_LB'+intrain_name,
210 title=
'LArCollisionAvgTime Vs Luminosity Block - avg time of ECC and ECA as a function of luminosity block'+intrain_title+
';Luminosity Block Number;(<t_{C}> + <t_{A}>) / 2 ('+timeUnitName+
');Number of events (weighted by energy/GeV)',
212 path=larColTime_hist_path,
214 xbins=lArDQGlobals.LB_Bins,xmin=lArDQGlobals.LB_Min,xmax=lArDQGlobals.LB_Max,
215 ybins=lArDQGlobals.avgColTime_Bins,ymin=lArDQGlobals.avgColTime_Min/timeUnit,ymax=lArDQGlobals.avgColTime_Max/timeUnit)
217 collTimeGroup_intrain.defineHistogram(
'bunch_crossing_id,ecTimeAvg;LArCollAvgTime_vs_BCID'+intrain_name,
218 title=
'LArCollisionAvgTime Vs BCID - avg time of ECC and ECA as a function of BCID'+intrain_title+
';Bunch Crossing Number;(<t_{C}> + <t_{A}>) / 2 ('+timeUnitName+
');Number of events (weighted by energy/GeV)',
220 path=larColTime_hist_path,
222 xbins=lArDQGlobals.BCID_Bins,xmin=lArDQGlobals.BCID_Min,xmax=lArDQGlobals.BCID_Max,
223 ybins=lArDQGlobals.avgColTime_Bins,ymin=lArDQGlobals.avgColTime_Min/timeUnit,ymax=lArDQGlobals.avgColTime_Max/timeUnit)
228 if __name__==
'__main__':
232 from AthenaCommon.Logging
import log
236 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
237 from AthenaConfiguration.TestDefaults
import defaultTestFiles
239 from LArMonitoring.LArMonConfigFlags
import addLArMonFlags
240 flags.addFlagsCategory(
"LArMon", addLArMonFlags)
241 flags.Input.Files = defaultTestFiles.RAW_RUN2
242 flags.DQ.enableLumiAccess =
False
243 flags.DQ.useTrigger =
False
244 flags.Output.HISTFileName =
'LArCollTimeMonitoringOutput.root'
248 from CaloRec.CaloRecoConfig
import CaloRecoCfg
251 from LumiBlockComps.BunchCrossingCondAlgConfig
import BunchCrossingCondAlgCfg
256 collmon.getEventAlgo(
"LArCollisionTimeMonAlg").timeDiffCut=5.0*Units.nanosecond
257 collmon.getEventAlgo(
"LArCollisionTimeMonAlg").nCells=1
258 collmon.getEventAlgo(
"LArCollisionTimeMonAlg").TrainFrontDistance=
int(30*Units.nanosecond)
259 collmon.getEventAlgo(
"LArClusterCollisionTimeMonAlg").nCells=0
260 collmon.getEventAlgo(
"LArClusterCollisionTimeMonAlg").TrainFrontDistance=
int(30*Units.nanosecond)
264 with open(
"CollTimeMonMaker.pkl",
"wb")
as f: