5 @brief configuration for the min bias monitoring
10 from .utils
import getMinBiasChains
11 from AthenaCommon.Logging
import logging
13 log = logging.getLogger(
'TrigSPTRKMonitoringMT')
18 from AthenaMonitoring
import AthMonitorCfgHelper
20 monConfig = AthMonitorCfgHelper(configFlags,
"HLTMBSPTRKMonAlg")
22 from AthenaConfiguration.ComponentFactory
import CompFactory
24 alg = monConfig.addAlgorithm(CompFactory.HLTMinBiasTrkMonAlg,
"HLTMBSPTRKMonAlg")
26 from InDetConfig.InDetTrackSelectionToolConfig
import InDetTrackSelectionTool_LoosePrimary_Cfg
28 alg.TrackSelectionTool = trkSel
30 ZFinderCollection =
'HLT_vtx_z'
31 if ZFinderCollection
in configFlags.Input.Collections:
32 log.info(
"Enabled z finder data reading")
33 alg.zFinderDataKey = ZFinderCollection
35 from TrigConfigSvc.TriggerConfigAccess
import getHLTMonitoringAccess
41 log.info(f
'Monitoring {len(spChains)} SpacePoints chains')
42 log.debug([name
for name, _
in spChains])
43 log.info(f
'Monitoring {len(spTrkChains)} Tracking chains')
44 log.debug([name
for name, _
in spTrkChains])
46 alg.triggerListTrackingMon = [name
for name, _
in spTrkChains]
47 alg.triggerListSpacePointsMon = [name
for name, _
in spChains]
50 nbins = 400
if highGranularity
else 50
56 for chain, group
in spChains:
57 mbSpGroup = monConfig.addGroup(alg, f
'{chain}_SpacePoints', topPath=f
"HLT/MinBiasMon/{group}/SpacePoints/{chain}/")
59 mbSpGroup.defineHistogram(
"PixelCL;PixelCLNarrowRange", title=
"Number of SP in whole Pixels detector for all events", xbins=100, xmin=0, xmax=100)
60 mbSpGroup.defineHistogram(
"PixelCL;PixelCLWideRange", title=
"Number of SP in whole Pixels detector for all events", xbins=250, xmin=0, xmax=nPixBar)
61 mbSpGroup.defineHistogram(
"PixBarr_SP", title=
"Number of SP for all events in Barrel", xbins=250, xmin=0, xmax=nPixBar)
62 mbSpGroup.defineHistogram(
"PixECA_SP", title=
"Number of SP for all events in ECA", xbins=250, xmin=0, xmax=nPixEC)
63 mbSpGroup.defineHistogram(
"PixECC_SP", title=
"Number of SP for all events in ECC", xbins=250, xmin=0, xmax=nPixEC)
64 mbSpGroup.defineHistogram(
"SctTot;SctTotNarrowRange", title=
"Number of SP in whole SCT detector for all events", xbins=100, xmin=0, xmax=100)
65 mbSpGroup.defineHistogram(
"SctTot;SctTotWideRange", title=
"Number of SP in whole SCT detector for all events", xbins=250, xmin=0, xmax=nSctCl)
66 mbSpGroup.defineHistogram(
"SctBarr_SP", title=
"Number of SCT_SP for all events in Barrel", xbins=250, xmin=0, xmax=nSctCl)
67 mbSpGroup.defineHistogram(
"SctECA_SP", title=
"Number of SCT_SP for all events in ECA", xbins=250, xmin=0, xmax=nSctCl)
68 mbSpGroup.defineHistogram(
"SctECC_SP", title=
"Number of SCT_SP for all events in ECC", xbins=250, xmin=0, xmax=nSctCl)
69 mbSpGroup.defineHistogram(
"SctECA_SP,SctECC_SP", type=
"TH2F", title=
";SctECA_SP;SctECC_SP", xbins=nbins, xmin=0, xmax=nSctCl, ybins=nbins, ymin=0, ymax=nSctCl)
70 mbSpGroup.defineHistogram(
"PixECA_SP,PixECC_SP", type=
"TH2F", title=
";PixECA_SP;PixECC_SP", xbins=nbins, xmin=0, xmax=nPixEC, ybins=nbins, ymin=0, ymax=nPixEC)
71 mbSpGroup.defineHistogram(
"SctBarr_SP,PixBarr_SP", type=
"TH2F", title=
";SctBarr_SP;PixBarr_SP", xbins=nbins, xmin=0, xmax=nSctCl, ybins=nbins, ymin=0, ymax=nPixBar)
72 mbSpGroup.defineHistogram(
"SctECA_SP,PixECA_SP", type=
"TH2F", title=
";SctECA_SP;PixECA_SP", xbins=nbins, xmin=0, xmax=nSctCl, ybins=nbins, ymin=0, ymax=nPixEC)
73 mbSpGroup.defineHistogram(
"SctECC_SP,PixECC_SP", type=
"TH2F", title=
";SctECC_SP;PixECC_SP", xbins=nbins, xmin=0, xmax=nSctCl, ybins=nbins, ymin=0, ymax=nPixEC)
74 mbSpGroup.defineHistogram(
"SctTot,PixelCL", type=
"TH2F", title=
";Number of SP in whole SCT detector for all events;Number of SP in whole Pixels detector for all events", xbins=nbins, xmin=0, xmax=4000, ybins=nbins, ymin=0, ymax=4000)
76 for chain, group
in spTrkChains:
77 mbSpTrkGroup = monConfig.addGroup(alg, f
'{chain}_Tracking', topPath=f
"HLT/MinBiasMon/{group}/Tracking/{chain}/")
80 mbSpTrkGroup.defineHistogram(
"nTrkOffline", title=
"Number of tracks reconstructed offline;track counts", xbins=200, xmin=-1, xmax=400)
81 mbSpTrkGroup.defineHistogram(
"nTrkOffline;nTrkOfflineLowMult", title=
"Number of tracks reconstructed offline;track counts", xbins=50, xmin=-1, xmax=50)
82 mbSpTrkGroup.defineHistogram(
"nTrkOnline;nTrkOnlineLowMult", title=
"Number of tracks reconstructed online;track counts", xbins=50, xmin=-1, xmax=50)
84 mbSpTrkGroup.defineHistogram(
"trkPt", cutmask=
"trkMask", title=
"Offline selected tracks pt;p_{T} [GeV]", xbins=100, xmin=0, xmax=5)
85 mbSpTrkGroup.defineHistogram(
"trkEta", cutmask=
"trkMask", title=
"Offline selected tracks eta;#eta", xbins=50, xmin=-2.5, xmax=2.5)
86 mbSpTrkGroup.defineHistogram(
"trkPhi", cutmask=
"trkMask", title=
"Offline selected tracks phi;#phi", xbins=64, xmin=-math.pi, xmax=math.pi)
87 mbSpTrkGroup.defineHistogram(
"trkHits", title=
"Offline selected tracks, hits per track;number of hits", xbins=15, xmin=-0.5, xmax=15 - 0.5)
89 mbSpTrkGroup.defineHistogram(
"onlTrkPt", title=
"Online tracks pt;p_{T} [GeV]", xbins=100, xmin=0, xmax=5)
90 mbSpTrkGroup.defineHistogram(
"onlTrkEta", title=
"Online tracks eta;#eta", xbins=50, xmin=-2.5, xmax=2.5)
91 mbSpTrkGroup.defineHistogram(
"onlTrkPhi", title=
"Online tracks phi;#phi", xbins=64, xmin=-math.pi, xmax=math.pi)
92 mbSpTrkGroup.defineHistogram(
"onlTrkHits", title=
"Online hits per track;number of hits", xbins=15, xmin=-0.5, xmax=15 - 0.5)
93 mbSpTrkGroup.defineHistogram(
"onlTrkZ0", title=
"Online track z_{0};z_{0}[mm]", xbins=40, xmin=-200, xmax=200)
94 mbSpTrkGroup.defineHistogram(
"onlTrkD0", title=
"Online track d_{0};d_{0}[mm]", xbins=40, xmin=-20, xmax=20)
96 mbSpTrkGroup.defineHistogram(
"trkD0", cutmask=
"trkMask", title=
"Offline selected tracks D0;d_{0} [mm]", xbins=40, xmin=-20, xmax=20)
97 mbSpTrkGroup.defineHistogram(
"trkZ0wrtPV", cutmask=
"trkMask", title=
"Offline selected tracks Z0 wrt PV;z_{0}[mm]", xbins=40, xmin=-20, xmax=20)
98 mbSpTrkGroup.defineHistogram(
"trkZ0", cutmask=
"trkMask", title=
"Offline selected tracks Z0;z_{0}[mm]", xbins=40, xmin=-200, xmax=200)
100 mbSpTrkGroup.defineHistogram(
"onlineOfflineVtxDelta", title=
";(offline - online) vertex z[mm]", xbins=200, xmin=-200, xmax=200)
103 mbSpTrkGroup.defineHistogram(
'trkEta,trkPt', cutmask=
'trkMask', type=
'TH2F', title=
'Offline selected tracks pT/eta correlation;#eta;p_{T} [GeV]', xbins=50, xmin=-2.5, xmax=2.5, ybins=50, ymin=0, ymax=5)
104 mbSpTrkGroup.defineHistogram(
'onlTrkEta,onlTrkPt', type=
'TH2F', title=
'Online tracks pT/eta correlation;#eta;p_{T} [GeV]', xbins=50, xmin=-2.5, xmax=2.5, ybins=50, ymin=0, ymax=5)
106 mbSpTrkGroup.defineHistogram(
'trkEta,trkPhi', cutmask=
'trkMask', type=
'TH2F', title=
'Offline selected tracks eta/phi correlation;#eta;#varphi', xbins=50, xmin=-2.5, xmax=2.5, ybins=50, ymin=-math.pi, ymax=math.pi)
107 mbSpTrkGroup.defineHistogram(
'onlTrkEta,onlTrkPhi', type=
'TH2F', title=
'Online tracks eta/phi correlation;#eta;#varphi', xbins=50, xmin=-2.5, xmax=2.5, ybins=50, ymin=-math.pi, ymax=math.pi)
109 mbSpTrkGroup.defineHistogram(
"nTrkOnline,nTrkOffline", type=
"TH2F", title=
";N online tracks;N offline tracks", xbins=nbins, xmin=0, xmax=nTrkMax, ybins=nbins, ymin=0, ymax=nTrkMax)
110 mbSpTrkGroup.defineHistogram(
"nTrkOfflineVtx,nTrkOffline", type=
"TH2F", title=
";N offline tracks with Vtx cut;N offline tracks", xbins=nbins, xmin=0, xmax=nTrkMax, ybins=nbins, ymin=0, ymax=nTrkMax)
111 mbSpTrkGroup.defineHistogram(
"nTrkOnline,zFinderWeight", type=
"TH2F", title=
";N online tracks;ZFinder weight", xbins=nbins, xmin=0, xmax=nTrkMax, ybins=nbins, ymin=0, ymax=nTrkMax)
112 mbSpTrkGroup.defineHistogram(
"nTrkOffline,zFinderWeight", type=
"TH2F", title=
";N online tracks;ZFinder weight", xbins=nbins, xmin=0, xmax=nTrkMax, ybins=nbins, ymin=0, ymax=nTrkMax)
113 mbSpTrkGroup.defineHistogram(
"nTrkOfflineVtx,zFinderWeight", type=
"TH2F", title=
";N offline tracks with Vtx cut;ZFinder weight", xbins=nbins, xmin=0, xmax=nTrkMax, ybins=nbins, ymin=0, ymax=nTrkMax)
114 mbSpTrkGroup.defineHistogram(
"nTrkOfflineVtx,nTrkOnlineVtx", type=
"TH2F", title=
";N offline tracks with Vtx cut;N online tracks with Vtx cut;", xbins=nbins, xmin=0, xmax=nTrkMax, ybins=nbins, ymin=0, ymax=nTrkMax)
117 mbSpTrkGroup.defineHistogram(
"nTrkOnline", title=
"Number of tracks reconstructed online;track counts", xbins=200, xmin=-1, xmax=400)
118 mbSpTrkGroup.defineHistogram(
"nTrkRatio", title=
"Number of tracks reconstructed online/offline;track counts online/offline", xbins=200, xmin=-1, xmax=4)
119 mbSpTrkGroup.defineHistogram(
"trkSelOfflineRatio", title=
"Number of tracks reconstructed offline(selected)/offline; N sel/all", xbins=200, xmin=0.1, xmax=1.9)
121 return monConfig.result()
124 if __name__ ==
"__main__":
126 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
128 flags.DQ.Environment =
"AOD"
129 flags.Concurrency.NumConcurrentEvents = 5
131 flags.Output.HISTFileName =
"TestMonitorOutput.root"
133 from AthenaCommon.Logging
import logging
134 log = logging.getLogger(__name__)
135 log.info(
"Input %s",
str(flags.Input.Files))
139 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
140 from AthenaPoolCnvSvc.PoolReadConfig
import PoolReadCfg
150 cfg.printConfig(withDetails=
True)
151 with open(
"cfg.pkl",
"wb")
as f: