6 @file RPCMonitoringConfig.py
7 @brief Python configuration of RPC Monitoring for the Run III
12 from AthenaConfiguration.ComponentFactory
import CompFactory
13 from AthenaConfiguration.ComponentAccumulator
import ComponentAccumulator
16 from MagFieldServices.MagFieldServicesConfig
import AtlasFieldCacheCondAlgCfg
19 from AthenaMonitoring
import AthMonitorCfgHelper
20 helper = AthMonitorCfgHelper(inputFlags,
'RpcMonitoringCfg')
25 from TrkConfig.AtlasExtrapolatorConfig
import AtlasExtrapolatorCfg
28 rpcTrackAnaAlg = helper.addAlgorithm(CompFactory.RpcTrackAnaAlg,
"RpcTrackAnaAlgAlg", TrackExtrapolator = extrapolator)
30 from TrackingGeometryCondAlg.AtlasTrackingGeometryCondAlgConfig
import TrackingGeometryCondAlgCfg
33 rpcTrackAnaAlg.plotMuonEff =
True
34 rpcTrackAnaAlg.plotPRD =
True
35 rpcTrackAnaAlg.ElementsFileName =
"Element.xml"
36 rpcTrackAnaAlg.TagAndProbe =
False
38 if not inputFlags.DQ.triggerDataAvailable:
39 rpcTrackAnaAlg.MuonRoIContainerName =
''
42 from TrigDecisionTool.TrigDecisionToolConfig
import getRun3NavigationContainerFromInput
48 myGroup_track = helper.addGroup(rpcTrackAnaAlg,
'RpcTrackAnaAlg',
'Muon/MuonRawDataMonitoring/RPC/')
50 myGroup_track.defineHistogram(
'run;Run',
51 title=
'Run Number;run;Events',
54 xbins=800000,xmin=200000.5,xmax=1000000.5)
56 myGroup_track.defineHistogram(
'evtLB',
57 title=
'Number of Event;Luminosity Block;N Event',
60 xbins=2000, xmin=0.5, xmax=2000.5)
62 myGroup_track.defineHistogram(
'prdTime',
63 title=
"Number of RPC Hit;Time;NHit",
66 xbins=36, xmin=-101.5625, xmax=10.9375)
68 myGroup_track.defineHistogram(
'prd_sec,prd_layer;NPRDHit_sectorVSlayer',
69 title=
"NPRDHit_sectorVSlayer;Sector(- for C side, + for A side);layer((dbR-1)*2+gasGap);NHit",
72 xbins=33, xmin=-16.5, xmax=16.5,
73 ybins=8, ymin=0.5, ymax=8.5)
74 myGroup_track.defineHistogram(
'prd_sec_1214,prd_layer_1214;NPRDHit_sectorVSlayer_Sector1214',
75 title=
"NPRDHit_sectorVSlayer_Sector1214;Sector(- for C side, + for A side);layer((dbR-1)*2+gasGap);NHit",
78 xbins=[-14.5,-13.5,-12.5,-11.5, 11.5, 12.5, 13.5, 14.5],
79 ybins=8, ymin=0.5, ymax=8.5)
80 myGroup_track.defineHistogram(
'prd_sec_eta,prd_layer_eta;NPRDHit_sectorVSlayer_Eta',
81 title=
"NPRDHit_sectorVSlayer_eta;Sector(- for C side, + for A side);layer((dbR-1)*2+gasGap);NHit",
84 xbins=33, xmin=-16.5, xmax=16.5,
85 ybins=8, ymin=0.5, ymax=8.5)
86 myGroup_track.defineHistogram(
'prd_sec_phi,prd_layer_phi;NPRDHit_sectorVSlayer_Phi',
87 title=
"NPRDHit_sectorVSlayer_phi;Sector(- for C side, + for A side);layer((dbR-1)*2+gasGap);NHit",
90 xbins=33, xmin=-16.5, xmax=16.5,
91 ybins=8, ymin=0.5, ymax=8.5)
93 myGroup_track.defineHistogram(
'LB,panelInd;NPRDHit_Panels_All',
94 title=
'Number of RPC Hit;Luminosity Block;Panel Index;NHit',
97 xbins=2000, xmin=0.5, xmax=2000.5, ybins=8592, ymin=-0.5, ymax=8591.5)
98 myGroup_track.defineHistogram(
'LB;NPRDHitVSLB_All',
99 title=
"Number of RPC Hit;Luminosity Block;NHit",
102 xbins=2000, xmin=0.5, xmax=2000.5)
107 trackPath =
'TrackMatch'
109 myGroup_track.defineHistogram(
'LB_nrpchit,PhiSector;NPRDHitFromMuon_PhiSector_vs_LB',
110 title=
'Number of RPC hits for muons decayed from Z candidates;Luminosity Block;#phi sector(- for C side, + for A side);NHit',
113 xbins=2000, xmin=0.5, xmax=2000.5, ybins=33, ymin=-16.5, ymax=16.5)
116 myGroup_track.defineHistogram(
'muPt_MuonFromZ;Pt_MuonFromZ',
117 title=
'Pt of muons decayed from Z candidates;Pt[MeV];NMuon',
120 xbins=100,xmin=0,xmax=400e3)
121 myGroup_track.defineHistogram(
'muEta_MuonFromZ;Eta_MuonFromZ',
122 title=
'#eta of muons decayed from Z candidates;#eta;NMuon',
125 xbins=42, xmin=-1.05, xmax=1.05)
126 myGroup_track.defineHistogram(
'muPhi_MuonFromZ;Phi_MuonFromZ',
127 title=
'#phi of muons decayed from Z candidates;#phi;NMuon',
130 xbins=32, xmin=-3.1415926, xmax=3.1415926)
131 myGroup_track.defineHistogram(
'muEta_MuonFromZ,muPhi_MuonFromZ;EtaVSPhi_MuonFromZ',
133 title=
'Eta vs phi for muons decayed from Z;#eta;#phi;NMuon',
135 xbins=42,xmin=-1.05, xmax=1.05,
136 ybins=32,ymin=-3.1415926,ymax=3.1415926)
137 myGroup_track.defineHistogram(
'muEta_p_MuonFromZ,muPhi_p_MuonFromZ;EtaVSPhi_MuonFromZ_plateau',
139 title=
'Eta vs phi for muons decayed from Z(pT>25GeV);#eta;#phi;NMuon',
141 xbins=42,xmin=-1.05, xmax=1.05,
142 ybins=32,ymin=-3.1415926,ymax=3.1415926)
144 myGroup_track.defineHistogram(
'hitMulti_eta;HitMultiplicity_eta',
146 title=
'Hit multiplicity in #eta view for muons decayed from Z candidates;#eta strip hit Multiplicity;muon entries',
148 xbins=11,xmin=-0.5, xmax=10.5)
150 myGroup_track.defineHistogram(
'hitMulti_phi;HitMultiplicity_phi',
152 title=
'Hit multiplicity in #phi view for muons decayed from Z candidates;#phi strip hit Multiplicity;muon entries',
154 xbins=11,xmin=-0.5, xmax=10.5)
156 myGroup_track.defineHistogram(
'hitMulti,panelInd_hM;HitMultiplicity_Panels',
157 title=
'Hit multiplicity for muons decayed from Z candidates;Hit Multiplicity;Panel Index;NMuon',
160 xbins=11, xmin=-0.5, xmax=10.5, ybins=8592, ymin=-0.5, ymax=8591.5)
162 myGroup_track.defineHistogram(
'clusterSize_eta;ClusterSize_etaView',
164 title=
'Cluster size in #eta view for muons decayed from Z candidates;Cluster size;NCluster',
166 xbins=11,xmin=-0.5, xmax=10.5)
168 myGroup_track.defineHistogram(
'clusterSize_phi;ClusterSize_phiView',
170 title=
'Cluster size in #phi view for muons decayed from Z candidates;Cluster size;NCluster',
172 xbins=11,xmin=-0.5, xmax=10.5)
174 myGroup_track.defineHistogram(
'clusterSize,panelInd_clust;ClusterSize_Panels',
175 title=
'Cluster size for muons decayed from Z candidates;Cluster size;Panel Index;NCluster',
178 xbins=11, xmin=-0.5, xmax=10.5, ybins=8592, ymin=-0.5, ymax=8591.5)
180 myGroup_track.defineHistogram(
'muon_passExtrap,panelInd_hM;Detection_Efficiency_MuonFromZ',
181 title=
'Panels detection efficiency for muons decayed from Z candidates;Panel Index;Efficiency',
184 xbins=8592, xmin=-0.5, xmax=8591.5)
185 myGroup_track.defineHistogram(
'muon_passExtrap_or,panelInd_hM;Detection_Efficiency_MuonFromZ_EtaORPhi',
186 title=
'Panels(eta or phi) detection efficiency for muons decayed from Z candidates;Panel Index;Efficiency',
189 xbins=8592, xmin=-0.5, xmax=8591.5)
190 myGroup_track.defineHistogram(
'muon_passExtrap_and,panelInd_hM;Detection_Efficiency_MuonFromZ_EtaANDPhi',
191 title=
'Panels(eta and phi) detection efficiency for muons decayed from Z candidates;Panel Index;Efficiency',
194 xbins=8592, xmin=-0.5, xmax=8591.5)
195 myGroup_track.defineHistogram(
'muon_passExtrap_signalhit_or,panelInd_hM;Detection_Efficiency_MuonFromZ_signalHit_EtaORPhi',
196 title=
'Panels(eta or phi) detection efficiency for muons decayed from Z candidates(Signal hits);Panel Index;Efficiency',
199 xbins=8592, xmin=-0.5, xmax=8591.5)
200 myGroup_track.defineHistogram(
'muon_passExtrap_signalhit_and,panelInd_hM;Detection_Efficiency_MuonFromZ_signalHit_EtaANDPhi',
201 title=
'Panels(eta and phi) detection efficiency for muons decayed from Z candidates(Signal hits);Panel Index;Efficiency',
204 xbins=8592, xmin=-0.5, xmax=8591.5)
205 myGroup_track.defineHistogram(
'muon_passExtrap_signalhit,panelInd_hM;Detection_Efficiency_MuonFromZ_signalHit',
206 title=
'Panels detection efficiency for muons decayed from Z candidates(Signal hits);Panel Index;Efficiency',
209 xbins=8592, xmin=-0.5, xmax=8591.5)
210 myGroup_track.defineHistogram(
'muon_passExtrap,LB_detEff;Detection_Efficiency_LB_MuonFromZ',
211 title=
'Panels detection efficiency for muons decayed from Z candidates;Luminosity Block;Efficiency',
214 xbins=2000, xmin=0.5, xmax=2000.5)
216 myGroup_track.defineHistogram(
'isOutTime_prd,panelInd_prd;OuttimeHitFraction_PRDHit',
217 title=
'Fraction of out-of-time hits for muons decayed from Z candidates;Panel Index;Fraction of out-of-time hits',
220 xbins=8592, xmin=-0.5, xmax=8591.5)
222 myGroup_track.defineHistogram(
'isOutTime_prd_onTrack,panelInd_prd_onTrack;OuttimeHitFraction_PRDHit_onTrack',
223 title=
'Fraction of out-of-time hits on tracks of muons decayed from Z candidates;Panel Index;Fraction of out-of-time hits',
226 xbins=8592, xmin=-0.5, xmax=8591.5)
228 myGroup_track.defineHistogram(
'residual_eta;residual_eta',
229 title=
'Distance between extrapolated muon track position and RPC eta hit;Distance [mm];Number of hit',
232 xbins=200, xmin=-100., xmax=100.)
234 myGroup_track.defineHistogram(
'residual_phi;residual_phi',
235 title=
'Distance between extrapolated muon track position and RPC eta hit;Distance [mm];Number of hit',
238 xbins=200, xmin=-100., xmax=100.)
240 myGroup_track.defineHistogram(
'closest_residual_eta;closest_residual_eta',
241 title=
'The closest distance between extrapolated muon track position and RPC eta hit;Distance [mm];Number of muon track position',
244 xbins=200, xmin=-100., xmax=100.)
246 myGroup_track.defineHistogram(
'closest_residual_phi;closest_residual_phi',
247 title=
'The closest distance between extrapolated muon track position and RPC eta hit;Distance [mm];Number of muon track position',
250 xbins=200, xmin=-100., xmax=100.)
252 myGroup_track.defineHistogram(
'residual_panel,panelInd_res_inTime;Residual_Panels',
253 title=
'Distance between extrapolated muon track position and RPC hit;Panel Index;Distance [mm];Number of hit',
256 xbins=100, xmin=-50., xmax=50., ybins=8592, ymin=-0.5, ymax=8591.5)
259 myGroup_track.defineHistogram(
'muPt_allMu;Pt_AllMuons',
260 title=
'Pt of muons in all events;Pt[MeV];NMuon',
263 xbins=100,xmin=0,xmax=400e3)
264 myGroup_track.defineHistogram(
'muEta_allMu;Eta_AllMuons',
265 title=
'#eta of muons in all events;#eta;NMuon',
268 xbins=42, xmin=-1.05, xmax=1.05)
269 myGroup_track.defineHistogram(
'muPhi_allMu;Phi_AllMuons',
270 title=
'#phi of muons in all events;#phi;NMuon',
273 xbins=32, xmin=-3.1415926, xmax=3.1415926)
274 myGroup_track.defineHistogram(
'muEta_allMu,muPhi_allMu;EtaVSPhi_AllMuons',
276 title=
'Eta vs phi of all muons;#eta;#phi;NMuon',
278 xbins=42,xmin=-1.05, xmax=1.05,
279 ybins=32,ymin=-3.1415926,ymax=3.1415926)
282 myGroup_track.defineHistogram(
'muon_passExtrap_allMu,panelInd_hM_allMu;Detection_Efficiency_AllMuons',
283 title=
'Panels detection efficiency for all muons;Panel Index;Efficiency',
286 xbins=8592, xmin=-0.5, xmax=8591.5)
289 sectors = [
"sector"+
str(k)
for k
in range(1, 16+1)]
290 array_sectors = helper.addArray([sectors], rpcTrackAnaAlg,
'RpcTrackAnaAlg',
'Muon/MuonRawDataMonitoring/RPC/')
292 array_sectors.defineHistogram(
'cs_sec;ClusterSize',
293 title=
'Cluster size on {0};Cluster size;NCluster',
295 path=
'TrackMatch/ClusterSize',
296 xbins=11, xmin=-0.5, xmax=10.5)
298 array_sectors.defineHistogram(
'hitTime_sec;PRDHitTime_MuonFromZ',
299 title=
'Hit time on {0};Hit time;NHits',
301 path=
'TrackMatch/PRDHitTime',
302 xbins=36, xmin=-101.5625, xmax=10.9375)
307 myGroup_track.defineHistogram(
'nMu;NMuon',
308 title=
'Number of Muons;nMuons;Events',
311 xbins=10,xmin=-0.5,xmax=9.5)
312 myGroup_track.defineHistogram(
'nMuBarrel;NMuonBarrel',
313 title=
'Number of Barrel Muons;nMuons;Events',
316 xbins=5,xmin=-0.5,xmax=4.5)
317 myGroup_track.defineHistogram(
'roiEta;roiEta',
318 title=
'roi eta;roi #eta;rois',
321 xbins=50,xmin=-2.5,xmax=2.5)
323 myGroup_track.defineHistogram(
'roiBarrelEta;roiBarrelEta',
324 title=
'Barrel roi eta;roi #eta;rois',
327 xbins=50,xmin=-2.5,xmax=2.5)
329 myGroup_track.defineHistogram(
'roiBarrelThr;roiBarrelThrs',
330 title=
'Barrel roi threshold;roi threshold;rois',
333 xbins=6,xmin=0.5,xmax=6.5)
335 lv1Triggers = [
"thr"+
str(k)
for k
in range(1, 6+1)]
336 array_triggerThr = helper.addArray([lv1Triggers], rpcTrackAnaAlg,
'RpcTrackAnaAlg',
'Muon/MuonRawDataMonitoring/RPC/')
338 array_triggerThr.defineHistogram(
'passTrigger,muPt_l1;L1TriggerEff_muPt',
339 title=
'L1 Trigger Efficiency for {0};Pt[MeV];#epsilon for {0}',
342 xbins=10, xmin=0.0, xmax=80.0e3)
344 array_triggerThr.defineHistogram(
'passTrigger_plateau,muEta_l1;L1TriggerEff_muEta',
345 title=
'L1 Trigger Efficiency for {0};#eta;#epsilon for {0}',
348 xbins=42,xmin=-1.05, xmax=1.05)
350 array_triggerThr.defineHistogram(
'passTrigger_plateau,muPhi_l1;L1TriggerEff_muPhi',
351 title=
'L1 Trigger Efficiency for {0};#phi;#epsilon for {0}',
354 xbins=32,xmin=-3.1415926,xmax=3.1415926)
356 array_triggerThr.defineHistogram(
'passTrigger_plateau,muEta_l1,muPhi_l1;L1TriggerEff_eta_phi',
357 title=
'L1 Trigger Efficiency for {0};#eta;#phi;#epsilon for {0}',
360 xbins=42,xmin=-1.05, xmax=1.05,
361 ybins=32,ymin=-3.1415926,ymax=3.1415926)
363 result.merge(helper.result())
364 print(
" RpcMonitorAlgorithm END !")
369 if __name__==
"__main__":
370 print(
" In RpcMonitorAlgorithm !")
372 from AthenaCommon.Logging
import log
377 from AthenaConfiguration.AllConfigFlags
import initConfigFlags
384 if os.path.exists(
'input.txt'):
385 infile =
open(
'input.txt',
"r")
386 file_list = infile.readlines()
387 file_list = [ filename.strip()
for filename
in file_list ]
388 print (
"read files path from input.txt .")
389 print (
"files paths: \n", file_list)
391 file_list = [
'/eos/atlas/atlascerngroupdisk/det-rpc/data/DESDM_MCP/data18_13TeV.00358615.physics_Main.merge.DESDM_MCP.f961_m2024/data18_13TeV.00358615.physics_Main.merge.DESDM_MCP.f961_m2024._0005.1']
393 print (
"file input.txt does not exist")
394 print (
"WIll use files: \n", file_list)
396 flags.Input.Files = file_list
397 flags.Output.HISTFileName =
'RPCMonitoringOutput.root'
398 from AthenaConfiguration.TestDefaults
import defaultGeometryTags
399 flags.GeoModel.AtlasVersion = defaultGeometryTags.RUN2
405 from AthenaConfiguration.MainServicesConfig
import MainServicesCfg
406 from AthenaPoolCnvSvc.PoolReadConfig
import PoolReadCfg
411 acc.OutputLevel = INFO
414 from MagFieldServices.MagFieldServicesConfig
import AtlasFieldCacheCondAlgCfg
417 if flags.DQ.Steering.Muon.doTrackMon:
419 if flags.DQ.Environment
not in (
'tier0Raw',):
420 from MuonTrackMonitoring.MuonTrackMonitorAlgorithm
import MuonTrackConfig
423 cfg.printConfig(withDetails=
True, summariseProps =
True)