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