ATLAS Offline Software
Loading...
Searching...
No Matches
CaloClusterCellMonAlg.py
Go to the documentation of this file.
2# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3#
4
6
7 from AthenaMonitoring.AthMonitorCfgHelper import AthMonitorCfgHelper
8 helper = AthMonitorCfgHelper(flags,'CaloClusterCellMonAlgCfg')
9
10 from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
11 cfg=ComponentAccumulator()
12
13
14 from LArGeoAlgsNV.LArGMConfig import LArGMCfg
15 cfg.merge(LArGMCfg(flags))
16 from TileGeoModel.TileGMConfig import TileGMCfg
17 cfg.merge(TileGMCfg(flags))
18
19 from DetDescrCnvSvc.DetDescrCnvSvcConfig import DetDescrCnvSvcCfg
20 cfg.merge(DetDescrCnvSvcCfg(flags))
21
22 from LArCellRec.LArCollisionTimeConfig import LArCollisionTimeCfg
23 cfg.merge(LArCollisionTimeCfg(flags))
24
25
26 from AthenaConfiguration.ComponentFactory import CompFactory
27 lArCellMonAlg=CompFactory.CaloClusterCellMonAlg
28
29 algname='CaloClusterCellMonAlg'
30 from AthenaConfiguration.Enums import BeamType
31 if flags.Beam.Type is BeamType.Cosmics:
32 algname=algname+'Cosmics'
33
34 algo = CaloClusterCellMonConfigCore(helper, lArCellMonAlg, flags,
35 flags.Beam.Type is BeamType.Cosmics,
36 flags.Input.TriggerStream,
37 flags.Input.isMC, flags.Common.isOnline,
38 algname)
39 algo.useTrigger = flags.DQ.useTrigger
40
41 #copied from CaloClusterCellMonTool
42 algo.rndmTriggerNames = "L1_RD0, L1_RD0_FILLED, L1_RD0_EMPTY, L1_RD1, L1_RD1_NOISE, L1_RD1_HIST, L1_RD1_BGRP4, L1_RD1_BGRP5"
43 algo.caloTriggerNames = "L1_EM[0-9]+, L1_HA[0-9]+, L1_J[0-9]+.*, L1_JB[0-9]+, L1_JF[0-9]+, L1_TE[0-9]+, L1_JE[0-9]+, L1_XE[0-9]+, L1_2EM[0-9]+, L1_2FJ[0-9]+, L1_2J[0-9]+,L1_3J[0-9]+.*,L1_4J[0-9]+.*,L1_5J[0-9]+,L1_6J[0-9]+,L1_FJ[0-9]+.*"
44 algo.minBiasTriggerNames = "L1_RD0_FILLED, L1_MBTS_1, L1_MBTS_2, L1_MBTS_1_1"
45 algo.metTriggerNames = "EF_xe[0-9]+.*"
46 algo.miscTriggerNames = ""
47
48 from AthenaMonitoring.AtlasReadyFilterConfig import AtlasReadyFilterCfg
49 algo.ReadyFilterTool = cfg.popToolsAndMerge(AtlasReadyFilterCfg(flags))
50
51 if not flags.Input.isMC:
52 from AthenaMonitoring.BadLBFilterToolConfig import LArBadLBFilterToolCfg
53 algo.BadLBTool=cfg.popToolsAndMerge(LArBadLBFilterToolCfg(flags))
54
55 cfg.merge(helper.result())
56
57 return cfg
58
59
60def CaloClusterCellMonConfigCore(helper, algclass, flags, isCosmics=False, TriggerStream='CosmicCalo', isMC=False, isOnline=False, algname='CaloClusterCellMonAlg'):
61
62
63 CaloClusterCellMonAlg = helper.addAlgorithm(algclass, algname)
64
65 if not isCosmics and not isMC:
66 CaloClusterCellMonAlg.useReadyFilterTool=True
67 else:
68 CaloClusterCellMonAlg.useReadyFilterTool=False
69
70 if isMC:
71 CaloClusterCellMonAlg.useBadLBTool=False
72 else:
73 CaloClusterCellMonAlg.useBadLBTool=True
74
75 if isCosmics or TriggerStream!='physics_CosmicCalo':
76 CaloClusterCellMonAlg.useBeamBackgroundRemoval = False
77 CaloClusterCellMonAlg.useLArCollisionFilterTool = False
78 else:
79 CaloClusterCellMonAlg.useBeamBackgroundRemoval = True
80 CaloClusterCellMonAlg.useLArCollisionFilterTool = True
81
82 if isOnline:
83 CaloClusterCellMonAlg.useLArNoisyAlg = False
84 else:
85 CaloClusterCellMonAlg.useLArNoisyAlg = True
86
87 GroupName="LArClusterCell"
88 CaloClusterCellMonAlg.MonGroupName = GroupName
89
90 CaloClusterCellMonAlg.EnableLumi = True
91
92
93 from CaloMonitoring.LArCellBinning import lArCellBinningScheme
94
95 binlabels=["TotalEvents","ATLAS Ready","with Good LAr LB","with No LAr Collision","with No Beam Background", "with No Trigger Filter","with No LArError"]
96
97 # triggers to use
98 CaloClusterCellMonAlg.rndmTriggerNames = "L1_RD0, L1_RD0_FILLED, L1_RD0_EMPTY, L1_RD1, L1_RD1_NOISE, L1_RD1_HIST, L1_RD1_BGRP4, L1_RD1_BGRP5"
99 CaloClusterCellMonAlg.caloTriggerNames = "L1_EM[0-9]+, L1_HA[0-9]+, L1_J[0-9]+.*, L1_JB[0-9]+, L1_JF[0-9]+, L1_TE[0-9]+, L1_JE[0-9]+, L1_XE[0-9]+, L1_2EM[0-9]+, L1_2FJ[0-9]+, L1_2J[0-9]+,L1_3J[0-9]+.*,L1_4J[0-9]+.*,L1_5J[0-9]+,L1_6J[0-9]+,L1_FJ[0-9]+.*"
100 CaloClusterCellMonAlg.minBiasTriggerNames = "L1_RD0_FILLED, L1_MBTS_1, L1_MBTS_2, L1_MBTS_1_1"
101 CaloClusterCellMonAlg.metTriggerNames = "EF_xe[0-9]+.*"
102 CaloClusterCellMonAlg.miscTriggerNames = ""
103
104 # Global Settings:
105
106 #---single Group for non threshold histograms
107 cellMonGroup = helper.addGroup(
108 CaloClusterCellMonAlg,
109 GroupName,
110 '/CaloMonitoring/CaloClusterCellMon/'
111
112 )
113
114
115 #--define histograms
116 # Summary
117 summ_hist_path='Summary/'
118
119 from CaloMonitoring.CaloMonAlgBase import CaloBaseHistConfig
120 CaloBaseHistConfig(cellMonGroup,summ_hist_path,binlabels)
121
122 cellMonGroup.defineHistogram('trigType;nEvtsByTrigger',
123 title='Total Events: bin 0, RNDM Trigger: 1, Calo Trigger: 2, MinBias Trigger: 3, MET Trigger: 4, Misc Trigger: 5, Events Accepted 6 ',
124 type='TH1I', path=summ_hist_path,
125 xbins=lArCellBinningScheme.larCellSummary["xbins"][0], xmin=lArCellBinningScheme.larCellSummary["xbins"][1], xmax=lArCellBinningScheme.larCellSummary["xbins"][2],
126 xlabels=lArCellBinningScheme.larCellSummary["xlabels"])
127
128
129 cellMonGroup.defineHistogram('eventCounter',
130 title='Events events passed Trigger and Background removal for each threshold (for normalisation)',
131 type='TH1I', path=summ_hist_path,
132 xbins=1
133 )
134
135 cellMonGroup.defineHistogram('larhash',
136 title='Total number of LAr Cells contributing to clusters, per online-hash',
137 type='TH1I', path=summ_hist_path,
138 xbins=195072,xmin=-0.5,xmax=195072.5
139 )
140
141 cellMonGroup.defineHistogram('tilehash',
142 title='Total number of Tile PMTs contributing to clusters, per online-hash',
143 type='TH1I', path=summ_hist_path,
144 xbins=12602,xmin=-0.5,xmax=12601.5
145 )
146
147 for part in CaloClusterCellMonAlg.LayerNames:
148 cellMonGroup.defineHistogram('celleta_'+part+',cellphi_'+part+';NClusteredCells_'+part,
149 title="Total number of cells contributing to clusters in (#eta,#phi) for "+part+";cell #eta;cell #phi",
150 weight='NClusteredCells_'+part,
151 type='TH2I', path="ClusterCell/",
152 xbins = lArCellBinningScheme.etaRange[part],
153 ybins = lArCellBinningScheme.phiRange[part])
154 pass #part loop
155
156 for part in ("TileBar0","TileBar1","TileBar2","TileGap0","TileGap1","TileGap2","TileExt0","TileExt1","TileExt2"):
157 for side in ("A","C"):
158 part+=side
159 cellMonGroup.defineHistogram('celleta_'+part+',cellphi_'+part+';NClusteredCells_'+part,
160 title="Total number of cells contributing to clusters in (#eta,#phi) for "+part+";cell #eta;cell #phi",
161 weight='NClusteredCells_'+part,
162 type='TH2I', path="ClusterCell/",
163 xbins = 17, xmin = -1.7, xmax = 1.7,
164 ybins = 64, ymin = -3.14, ymax = 3.14)
165 pass #part loop
166
167 return CaloClusterCellMonAlg
168
169
170if __name__=='__main__':
171
172 # Set the Athena configuration flags
173 from AthenaConfiguration.AllConfigFlags import initConfigFlags
174 flags = initConfigFlags()
175 from AthenaConfiguration.TestDefaults import defaultTestFiles, defaultConditionsTags,defaultGeometryTags
176 flags.Input.Files = defaultTestFiles.RAW_RUN3
177 flags.IOVDb.GlobalTag = defaultConditionsTags.RUN3_DATA
178 flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN3
179
180 flags.Output.HISTFileName = 'CaloClusterCellMonOutput.root'
181 flags.DQ.enableLumiAccess = True
182 flags.DQ.useTrigger = True
183 flags.DQ.Environment = 'tier0'
184 from AthenaConfiguration.Enums import LHCPeriod
185 flags.GeoModel.Run=LHCPeriod.Run3
186 flags.Concurrency.NumThreads=1
187 flags.lock()
188
189
190
191 # Initialize configuration object, add accumulator, merge, and run.
192 from AthenaConfiguration.MainServicesConfig import MainServicesCfg
193 cfg = MainServicesCfg(flags)
194
195 from TrigConfigSvc.TrigConfigSvcCfg import L1ConfigSvcCfg, HLTConfigSvcCfg, L1PrescaleCondAlgCfg, HLTPrescaleCondAlgCfg
196 from TrigT1ResultByteStream.TrigT1ResultByteStreamConfig import L1TriggerByteStreamDecoderCfg
197
198 cfg.merge( L1TriggerByteStreamDecoderCfg(flags) )
199 cfg.merge( L1ConfigSvcCfg(flags) )
200 cfg.merge( HLTConfigSvcCfg(flags) )
201 cfg.merge( L1PrescaleCondAlgCfg(flags) )
202 cfg.merge( HLTPrescaleCondAlgCfg(flags) )
203
204 from TrigConfigSvc.TrigConfigSvcCfg import BunchGroupCondAlgCfg
205 cfg.merge( BunchGroupCondAlgCfg( flags ) )
206
207 from AthenaConfiguration.ComponentFactory import CompFactory
208 tdm = CompFactory.getComp('TrigDec::TrigDecisionMakerMT')()
209 tdm.doL1 = True
210 tdm.doHLT = False
211 cfg.addEventAlgo( tdm, 'AthAlgSeq' )
212
213
214
215 # in case of tier0 workflow:
216 from CaloRec.CaloRecoConfig import CaloRecoCfg
217 cfg.merge(CaloRecoCfg(flags))
218
219
220 cfg.merge(CaloClusterCellMonConfig(flags))
221
222 cfg.run(10) #use cfg.run() to run on all events
CaloClusterCellMonConfigCore(helper, algclass, flags, isCosmics=False, TriggerStream='CosmicCalo', isMC=False, isOnline=False, algname='CaloClusterCellMonAlg')