4 '''@file SCTTracksMonAlg.py
7 @brief Based on AthenaMonitoring/ExampleMonitorAlgorithm.py
11 '''Function to configures some algorithms in the monitoring system.'''
15 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
20 from AthenaMonitoring
import AthMonitorCfgHelper
21 helper = AthMonitorCfgHelper(flags,
'SCTTracksMonCfg')
30 from AthenaConfiguration.ComponentFactory
import CompFactory
31 from TrkConfig.TrkResidualPullCalculatorConfig
import (
32 ResidualPullCalculatorCfg)
33 myMonAlg = helper.addAlgorithm(CompFactory.SCTTracksMonAlg,
'SCTTracksMonAlg',
34 ResPullCalc = result.popToolsAndMerge(
37 from AthenaConfiguration.Enums
import BeamType
38 if flags.Beam.Type
is BeamType.Collisions:
39 from AthenaMonitoring.FilledBunchFilterToolConfig
import FilledBunchFilterToolCfg
43 if not flags.Input.isMC:
44 if flags.Trigger.doHLT:
46 myMonAlg.doTrigger = doTrigger
56 myMonAlg.TriggerChain =
''
59 from TrkConfig.TrkTrackSummaryToolConfig
import InDetTrackSummaryToolCfg
73 myMonGroup = helper.addGroup(
81 regionNames = [
"EndCapC",
"Barrel",
"EndCapA"]
82 N_REGIONS = len(regionNames)
83 s_triggerNames = [
"RNDM",
"BPTX",
"L1CAL",
"TGC",
"RPC",
"MBTS",
"COSM",
"Calib"]
84 N_TRIGGER_TYPES = len(s_triggerNames)
87 LAST_HIT_BIN = N_HIT_BINS-FIRST_HIT_BIN-1
88 myMonGroup.defineHistogram(varname=
"trk_N",
90 title=
"Number of tracks"+
";Number of Tracks",
92 xbins=400, xmin=0., xmax=4000.)
93 myMonGroup.defineHistogram(varname=
"trk_chi2",
95 title=
"Track #chi^{2} div ndf"+
";Number of track #chi^{2}/NDF",
97 xbins=150, xmin=0., xmax=150.)
98 myMonGroup.defineHistogram(varname=
"trk_d0",
100 title=
"Track d0"+
";d0 [mm]",
102 xbins=160, xmin=-40., xmax=40.)
103 myMonGroup.defineHistogram(varname=
"trk_z0",
105 title=
"Track z0"+
";z0 [mm]",
107 xbins=200, xmin=-200., xmax=200.)
108 myMonGroup.defineHistogram(varname=
"trk_phi",
110 title=
"Track Phi"+
";#phi [rad]",
112 xbins=160, xmin=-4., xmax=4.)
113 myMonGroup.defineHistogram(varname=
"trk_pt",
115 title=
"Track P_{T}"+
";P_{T} [GeV]",
117 xbins=150, xmin=0., xmax=150.)
118 myMonGroup.defineHistogram(varname=
"trk_sct_hits",
120 title=
"SCT HITS per single Track"+
";Num of Hits",
122 xbins=N_HIT_BINS, xmin=FIRST_HIT_BIN, xmax=LAST_HIT_BIN)
123 myMonGroup.defineHistogram(varname=
"trk_eta",
125 title=
"Track Eta"+
";#eta",
127 xbins=160, xmin=-4., xmax=4.)
129 myMonGroup.defineHistogram(varname=
"trackTriggers",
131 title=
"Tracks for different trigger types",
133 xbins=N_TRIGGER_TYPES, xmin=-0.5, xmax=7.5, xlabels=s_triggerNames)
134 myMonGroup.defineHistogram(varname=
"region"+
","+
"hitsRegion"+
";"+
"SCTTrackRate",
136 title=
"Track per event for SCT regions",
138 xbins=3, xmin=0.0, xmax=3.0, xlabels=regionNames)
139 myMonGroup.defineHistogram(varname=
"tracksPerRegion",
141 title=
"Number of tracks in eta regions",
143 xbins=N_REGIONS, xmin=0, xmax=N_REGIONS, xlabels=regionNames)
146 for region
in regionNames:
147 myMonGroup.defineHistogram(varname=
"total"+region+
"Residual",
148 title=
"Overall Residual Distribution for the "+region+
";Residual [mm]",
149 type=
"TH1F", path=
"tracks",
150 xbins=100, xmin=-0.5, xmax=0.5)
151 myMonGroup.defineHistogram(varname=
"total"+region+
"Pull",
152 title=
"Overall Pull Distribution for the "+region+
";Pull",
153 type=
"TH1F", path=
"tracks",
154 xbins=100, xmin=-5, xmax=5)
163 result.merge(helper.result())
166 if __name__ ==
"__main__":
168 from AthenaCommon.Logging
import log
173 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
175 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"]
176 flags.Input.isMC =
True
177 flags.Output.HISTFileName =
'SCTTracksMonOutput.root'
178 flags.GeoModel.Align.Dynamic =
False
179 flags.Detector.GeometryID =
True
180 flags.Detector.GeometryPixel =
True
181 flags.Detector.GeometrySCT =
True
182 flags.Detector.GeometryTRT =
True
186 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
187 from AthenaPoolCnvSvc.PoolReadConfig
import PoolReadCfg