6 @file TileCalCellMonAlg.py
7 @brief Python configuration of TileCalCellMonAlg algorithm for the Run III
12 ''' Function to configure TileCalCellMonAlg algorithm in the monitoring system.'''
14 kwargs.setdefault(
'MonGroupName',
'TileEventFiter')
15 kwargs.setdefault(
'useBeamBackgroundRemoval',
False)
16 kwargs.setdefault(
'useLArNoisyAlg',
False)
17 kwargs.setdefault(
'useLArCollisionFilterTool',
False)
19 if not (flags.Common.isOnline ==
'online' or flags.Input.isMC):
20 kwargs.setdefault(
'useReadyFilterTool',
True)
21 kwargs.setdefault(
'useBadLBTool',
False)
23 kwargs.setdefault(
'useReadyFilterTool',
False)
24 kwargs.setdefault(
'useBadLBTool',
False)
27 kwargs.setdefault(
'EnergyThreshold', 300.0 * MeV)
29 from AthenaMonitoring
import AthMonitorCfgHelper
30 helper = AthMonitorCfgHelper(flags,
'TileCalMonCfg')
32 from LArGeoAlgsNV.LArGMConfig
import LArGMCfg
35 from TileGeoModel.TileGMConfig
import TileGMCfg
38 from CaloTools.CaloNoiseCondAlgConfig
import CaloNoiseCondAlgCfg
41 if kwargs[
'useLArCollisionFilterTool']:
42 from LArCellRec.LArCollisionTimeConfig
import LArCollisionTimeCfg
45 if kwargs[
'useReadyFilterTool']
and 'ReadyFilterTool' not in kwargs:
46 from AthenaMonitoring.AtlasReadyFilterConfig
import AtlasReadyFilterCfg
48 kwargs[
'ReadyFilterTool'] = readyFilterTool
50 from AthenaConfiguration.ComponentFactory
import CompFactory
51 tileCalCellMonAlg = helper.addAlgorithm(CompFactory.TileCalCellMonAlg,
'TileCalCellMonAlg')
53 for k, v
in kwargs.items():
54 setattr(tileCalCellMonAlg, k, v)
56 binLabels = [
"TotalEvents",
"ATLAS Ready",
"with Good LAr LB",
"with No LAr Collision",
57 "with No Beam Background",
"with No Trigger Filter",
"with No LArError"]
59 if not tileCalCellMonAlg.useReadyFilterTool:
60 binLabels[1] =
"ATLAS Ready-OFF"
61 if not tileCalCellMonAlg.useBadLBTool:
62 binLabels[2] =
"Good LAr LB-OFF"
63 if not tileCalCellMonAlg.useLArCollisionFilterTool:
64 binLabels[3] =
"LAr collision-OFF"
65 if not tileCalCellMonAlg.useBeamBackgroundRemoval:
66 binLabels[4] =
"Beam backgr.-OFF"
67 if not tileCalCellMonAlg.useLArNoisyAlg:
68 binLabels[5] =
"LAr Error Veto-OFF"
70 topPath =
'/CaloMonitoring/TileCellMon_NoTrigSel/General/'
71 tileFilterGroup = helper.addGroup(tileCalCellMonAlg, tileCalCellMonAlg.MonGroupName, topPath)
73 from CaloMonitoring.CaloMonAlgBase
import CaloBaseHistConfig
77 executeTimeGroup = helper.addGroup(tileCalCellMonAlg,
'TileCalCellMonExecuteTime', topPath)
78 executeTimeGroup.defineHistogram(
'TIME_execute', path =
'Summary', type=
'TH1F',
79 title =
'Time for execute TileCalCellMonAlg algorithm;time [#mus]',
80 xbins = 100, xmin = 0, xmax = 100000)
83 samplesWithoutE = [
'A',
'BC',
'D',
'']
84 noiseEtaPhiArray = helper.addArray([len(samplesWithoutE)], tileCalCellMonAlg,
'CellsNoiseXEtaVSPhi', topPath = topPath)
85 for postfix, tool
in noiseEtaPhiArray.Tools.items():
86 sample = samplesWithoutE[
int( postfix.split(
'_')[1] )]
87 title = (
'Number of Tile Cells %s' % sample) +
' with E > 4 sigma (DB);#eta;#phi'
88 name =
'eta,phi;CellsNoiseXEtaVSPhi' + (sample +
'cells' if sample
else '')
89 tool.defineHistogram(name, title = title, type =
'TH2F',
90 xbins = 17, xmin = -1.7, xmax = 1.7,
91 ybins = 64, ymin = -3.14, ymax = 3.14)
94 noiseHashGroup = helper.addGroup(tileCalCellMonAlg,
'CellsXNoiseXHash', topPath)
95 noiseHashGroup.defineHistogram(
'hash;CellsXNoiseXHash', path =
'', type=
'TH1F',
96 title =
'Number of 4 sigma seeds per hash;Tile Cell Hash ID;Events',
97 xbins = 5184, xmin = -0.5, xmax = 5183.5)
100 noiseHashGroup = helper.addGroup(tileCalCellMonAlg,
'CellsNoiseTile', topPath)
101 noiseHashGroup.defineHistogram(
'noise;CellsNoiseTile', path =
'', type=
'TH1F',
102 title =
'Energy/Noise (DB) of TileCal;Cell Energy / sigma (DB);Events',
103 xbins = 200, xmin = -10.0, xmax = 10.0)
106 noiseEtaGroup = helper.addGroup(tileCalCellMonAlg,
'CellsNoiseXEta', topPath)
107 noiseEtaGroup.defineHistogram(
'eta,noise;CellsNoiseXEta', path =
'', type=
'TProfile',
108 title =
'Tile Cell noise #sigma (DB) vs #eta;#eta;Mean Cell noise (DB) [MeV]',
109 xbins = 17, xmin = -1.7, xmax = 1.7)
112 noisePhiGroup = helper.addGroup(tileCalCellMonAlg,
'CellsNoiseXPhi', topPath)
113 noisePhiGroup.defineHistogram(
'phi,noise;CellsNoiseXPhi', path =
'', type=
'TProfile',
114 title =
'Tile Cell noise #sigma (DB) vs #phi;#phi;Mean Cell noise (DB) [MeV]',
115 xbins = 64, xmin = -3.14, xmax = 3.14)
118 nCellsGroup = helper.addGroup(tileCalCellMonAlg,
'CellsXN', topPath)
119 nCellsGroup.defineHistogram(
'nCells;CellsXN', path =
'', type=
'TH1F',
120 title =
'Number of Tile Cells over threshold;Number of Tile Cells; Events',
121 xbins = 250, xmin = 0, xmax = 500)
124 energyGroup = helper.addGroup(tileCalCellMonAlg,
'CellsXE', topPath)
125 energyGroup.defineHistogram(
'energy;CellsXE', path =
'', type=
'TH1F',
126 title =
'Energy of Tile Cells;Tile Cell Energy [GeV]; Events',
127 xbins = 50, xmin = 0, xmax = 20)
130 energyEtaGroup = helper.addGroup(tileCalCellMonAlg,
'CellsXEta', topPath)
131 energyEtaGroup.defineHistogram(
'eta,energy;CellsXEta', path =
'', type=
'TProfile',
132 title =
'Tile Cell Energy vs #eta;#eta;Mean Cell Energy [GeV]',
133 xbins = 17, xmin = -1.7, xmax = 1.7)
136 energyPhiGroup = helper.addGroup(tileCalCellMonAlg,
'CellsXPhi', topPath)
137 energyPhiGroup.defineHistogram(
'phi,energy;CellsXPhi', path =
'', type=
'TProfile',
138 title =
'Tile Cell Energy vs #phi;#phi;Mean Cell Energy [GeV]',
139 xbins = 64, xmin = -3.14, xmax = 3.14)
142 energyTowerGroup = helper.addGroup(tileCalCellMonAlg,
'CellsXTower', topPath)
143 energyTowerGroup.defineHistogram(
'tower,energy;CellsXTower', path =
'', type=
'TProfile',
144 title =
'Tile Cell Energy vs tower;Tower;Mean Cell Energy [GeV]',
145 xbins = 18, xmin = 0, xmax = 18)
148 occupEtaPhiGroup = helper.addGroup(tileCalCellMonAlg,
'CellsXEtaVSPhi', topPath)
149 occupEtaPhiTitle = (
'Number of Tile Cell above threshold %s MeV;#eta;#phi' % kwargs[
'EnergyThreshold'])
150 occupEtaPhiGroup.defineHistogram(
'eta,phi;CellsXEtaVSPhi', path =
'', type=
'TH2F', title = occupEtaPhiTitle,
151 xbins = 17, xmin = -1.7, xmax = 1.7, ybins = 64, ymin = -3.14, ymax = 3.14)
154 samples = [
'A',
'BC',
'D',
'E']
155 energyModuleArray = helper.addArray([len(samples)], tileCalCellMonAlg,
'CellsXModule', topPath = topPath)
156 for postfix, tool
in energyModuleArray.Tools.items():
157 sampleIdx =
int( postfix.split(
'_')[1] )
158 sample = samples[sampleIdx]
159 title = (
'Tile Sampling %s' % sample) +
';Module;Mean Cell Energy [GeV]'
160 name =
'module,energy;CellsXModuleS' +
str(sampleIdx + 1)
161 tool.defineHistogram(name, title = title, type =
'TProfile',
162 xbins = 64, xmin = 1, xmax = 65)
165 accumalator = helper.result()
166 cfg.merge(accumalator)
170 if __name__==
'__main__':
173 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
174 from AthenaConfiguration.TestDefaults
import defaultTestFiles
176 flags.Input.Files = defaultTestFiles.ESD
177 flags.Output.HISTFileName =
'TileCalCellMonOutput.root'
178 flags.DQ.enableLumiAccess =
False
179 flags.DQ.useTrigger =
False
183 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
186 from AthenaPoolCnvSvc.PoolReadConfig
import PoolReadCfg
192 cfg.printConfig(withDetails =
True, summariseProps =
True)
194 cfg.store(
open(
'TileCalCellMonAlg.pkl',
'wb') )
200 sys.exit(
not sc.isSuccess())