4 '''@file SCTHitEffMonAlg.py
7 @brief Based on AthenaMonitoring/ExampleMonitorAlgorithm.py
15 return "Layer " +
str(m_layerStr) +
" Side " +
str((m_element % 2 + 1) % 2)
17 return "Disk " +
str(m_layerStr) +
" Side " +
str((m_element % 2 + 1) % 2)
20 '''Function to configures some algorithms in the monitoring system.'''
24 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
29 from AthenaMonitoring
import AthMonitorCfgHelper
30 helper = AthMonitorCfgHelper(flags,
'SCTHitEffMonCfg')
39 from AthenaConfiguration.ComponentFactory
import CompFactory
40 from InDetConfig.InDetTrackHoleSearchConfig
import (
41 InDetTrackHoleSearchToolCfg)
42 from InDetConfig.SiClusterOnTrackTool_SCTStripConfig
import (
43 InDetSCT_ClusterOnTrackToolCfg)
44 from TrkConfig.TrkResidualPullCalculatorConfig
import (
45 ResidualPullCalculatorCfg)
47 myMonAlg = helper.addAlgorithm(
48 CompFactory.SCTHitEffMonAlg,
50 HoleSearch = result.popToolsAndMerge(
52 ROTCreator = result.popToolsAndMerge(
54 ResPullCalc = result.popToolsAndMerge(
66 myMonAlg.TriggerChain =
''
73 from LumiBlockComps.BunchCrossingCondAlgConfig
import BunchCrossingCondAlgCfg
75 from MagFieldServices.MagFieldServicesConfig
import AtlasFieldCacheCondAlgCfg
77 from SCT_ConditionsAlgorithms.SCT_ConditionsAlgorithmsConfig
import SCT_DetectorElementCondAlgCfg
83 from ROOT
import SCT_Monitoring
as sctMon
113 for i
in range(len(sctMon.subDetName)):
114 subDetName.append(sctMon.subDetName[i].
Data())
116 mapName = [
"m_eff_",
"eff_",
"p_eff_"]
117 ineffmapName = [
"ineffm_",
"ineff_",
"ineffp_"]
119 sumEff = [
"summaryeffm",
"summaryeff",
"summaryeffp"]
120 sumEffTitle = [
"Summary Module Efficiency in Endcap C",
121 "Summary Module Efficiency in Barrel",
122 "Summary Module Efficiency in Endcap A"]
124 limit = [sctMon.N_DISKS*2, sctMon.N_BARRELS*2, sctMon.N_DISKS*2]
127 myMonGroup[sctMon.GENERAL_INDEX].
defineHistogram(varname=
"isub, eff;" +
"SctTotalEff",
129 title=
"SCT Total Efficiency",
131 xbins=sctMon.N_REGIONS,
133 xmax=sctMon.N_REGIONS,
137 myMonGroup[sctMon.GENERAL_INDEX].
defineHistogram(varname=
"isub, eff;" +
"SctTotalEffBCID",
139 title=
"SCT Total Efficiency for First BCID",
141 xbins=sctMon.N_REGIONS,
143 xmax=sctMon.N_REGIONS,
145 cutmask=
"isFirstBCID",
148 myMonGroup[sctMon.GENERAL_INDEX].
defineHistogram(varname=
"sideHash, eff;" +
"effHashCode",
150 title=
"Efficiency vs module Hash code" +
";Module Hash Code;Efficiency",
152 xbins=sctMon.n_mod[sctMon.GENERAL_INDEX] * 2,
154 xmax=sctMon.n_mod[sctMon.GENERAL_INDEX] * 2 -0.5,
157 myMonGroup[sctMon.GENERAL_INDEX].
defineHistogram(varname=
"LumiBlock, eff;" +
"effLumiBlock",
159 title=
"Efficiency vs Luminosity block"+
";;Efficiency",
161 xbins=sctMon.NBINS_LBs,
163 xmax=sctMon.NBINS_LBs + 0.5,
176 for isub
in range(sctMon.N_REGIONS):
178 for k
in range(limit[isub]):
181 myMonGroup[isub].
defineHistogram(varname=
"layerPlusHalfSide, eff;" + sumEff[isub],
183 title= sumEffTitle[isub]+
";;Efficiency",
185 xbins=2*sctMon.n_layers[isub],
187 xmax=sctMon.n_layers[isub],
188 xlabels=profileLabels,
191 myMonGroup[isub].
defineHistogram(varname=
"layerPlusHalfSide, eff;" + sumEff[isub] +
"BCID",
193 title= sumEffTitle[isub]+
" for First BC" +
";;Efficiency",
195 xbins=2*sctMon.n_layers[isub],
197 xmax=sctMon.n_layers[isub],
198 xlabels=profileLabels,
199 cutmask=
"isFirstBCID",
202 myMonGroup[isub].
defineHistogram(varname=
"LumiBlock, eff;"+
"effLumiBlock",
204 title=
"Efficiency vs Luminosity block in "+subDetName[isub]+
";Luminosity block"+
";Efficiency",
206 xbins=sctMon.NBINS_LBs,
208 xmax=sctMon.NBINS_LBs + 0.5,
212 for layer_disk
in range(sctMon.n_layers[isub]):
213 for side
in range(2):
214 etaPhiSuffix =
"_" +
str(layer_disk) +
"_" +
str(side)
215 effName = mapName[isub] +
str(layer_disk) +
"_" +
str(side)
216 ineffName = ineffmapName[isub] +
str(layer_disk) +
"_" +
str(side)
218 myMonGroup[isub].
defineHistogram(varname=
"ieta" + etaPhiSuffix +
",iphi" + etaPhiSuffix +
",eff;" + effName,
220 title=
"Hit efficiency of" + sctMon.layerName[isub].
Data() +
str(layer_disk) +
" / side " +
str(side) +
" in " + subDetName[isub] +
";Index in the direction of #eta;Index in the direction of #phi",
222 xbins=sctMon.n_etabins[isub], xmin=sctMon.f_etabin[isub] - .5, xmax=sctMon.l_etabin[isub] + .5,
223 ybins=sctMon.n_phibins[isub], ymin=sctMon.f_phibin[isub] - .5, ymax=sctMon.l_phibin[isub] + .5,
226 myMonGroup[isub].
defineHistogram(varname=
"ieta" + etaPhiSuffix +
",iphi" + etaPhiSuffix +
",eff;" + effName +
"_bcid",
228 title=
"Hit efficiency of" + sctMon.layerName[isub].
Data() +
str(layer_disk) +
" / side " +
str(side) +
" in " + subDetName[isub] +
" for first BCID" +
";Index in the direction of #eta;Index in the direction of #phi",
230 xbins=sctMon.n_etabins[isub], xmin=sctMon.f_etabin[isub] - .5, xmax=sctMon.l_etabin[isub] + .5,
231 ybins=sctMon.n_phibins[isub], ymin=sctMon.f_phibin[isub] - .5, ymax=sctMon.l_phibin[isub] + .5,
232 cutmask=
"isFirstBCID",
235 myMonGroup[isub].
defineHistogram(varname=
"ieta" + etaPhiSuffix +
",iphi" + etaPhiSuffix +
",ineff;" + ineffName,
237 title=
"Hit inefficiency of" + sctMon.layerName[isub].
Data() +
str(layer_disk) +
" / side " +
str(side) +
" in " + subDetName[isub] +
";Index in the direction of #eta;Index in the direction of #phi",
239 xbins=sctMon.n_etabins[isub], xmin=sctMon.f_etabin[isub] - .5, xmax=sctMon.l_etabin[isub] + .5,
240 ybins=sctMon.n_phibins[isub], ymin=sctMon.f_phibin[isub] - .5, ymax=sctMon.l_phibin[isub] + .5,
244 result.merge(helper.result())
247 if __name__ ==
"__main__":
249 from AthenaCommon.Logging
import log
254 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
256 flags.Input.Files = [
"/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/RecExRecoTest/mc16_13TeV.361022.Pythia8EvtGen_A14NNPDF23LO_jetjet_JZ2W.recon.ESD.e3668_s3170_r10572_homeMade.pool.root"]
257 flags.Input.isMC =
True
258 flags.Output.HISTFileName =
'SCTHitEffMonOutput.root'
259 flags.GeoModel.Align.Dynamic =
False
260 flags.Detector.GeometryID =
True
261 flags.Detector.GeometryPixel =
True
262 flags.Detector.GeometrySCT =
True
263 flags.Detector.GeometryTRT =
True
267 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
268 from AthenaPoolCnvSvc.PoolReadConfig
import PoolReadCfg