ATLAS Offline Software
StgcMonitorAlgorithm.py
Go to the documentation of this file.
1 #
2 # Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration #
3 #
4 
5 from AthenaConfiguration.ComponentFactory import CompFactory
6 from StgcRawDataMonitoring.StgcMonitorUtils import columnLabels_AL, columnLabels_CL, columnLabels_AS, columnLabels_CS, rowLabels, wireGroupNumberLabel
7 import math
8 
9 def sTgcMonitoringConfig(inputFlags,NSW_PadTrigKey=''):
10  '''Function to configures some algorithms in the monitoring system.'''
11 
14  from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
15  result = ComponentAccumulator()
16 
17  # Make sure muon geometry is configured
18  from MuonConfig.MuonGeometryConfig import MuonGeoModelCfg
19  result.merge(MuonGeoModelCfg(inputFlags))
20 
21  # The following class will make a sequence, configure algorithms, and link
22  # them to GenericMonitoringTools
23 
24  from AthenaMonitoring import AthMonitorCfgHelper
25  helper = AthMonitorCfgHelper(inputFlags, 'StgcAthMonitorCfg')
26 
27  # Adding an algorithm to the helper.
28  sTgcMonAlg = helper.addAlgorithm(CompFactory.sTgcRawDataMonAlg,'sTgcMonAlg')
29  sTgcMonAlg.cutPt = 15000.
30  sTgcMonAlg.cutEtaDown = 1.3
31  sTgcMonAlg.cutEtaUp = 2.4
32  sTgcMonAlg.minDeltaR = 0.1
33  sTgcMonAlg.cutTriggerPhiId = 63
34  sTgcMonAlg.cutTriggerBandId = 255
35  sTgcMonAlg.NSW_PadTriggerDataKey = NSW_PadTrigKey
36 
37  globalPath = 'Muon/MuonRawDataMonitoring/STG/'
38 
39  # Shifter
40  sTgcOverviewGroup = helper.addGroup(sTgcMonAlg, 'sTgcOverview', globalPath + 'Shifter')
41  sTgcQuadOccupancyGroupPad = helper.addGroup(sTgcMonAlg, 'sTgcQuadOccupancyPad', globalPath + 'Shifter/Occupancy')
42  sTgcQuadOccupancyGroupStrip = helper.addGroup(sTgcMonAlg, 'sTgcQuadOccupancyStrip', globalPath + 'Shifter/Occupancy')
43  sTgcQuadOccupancyGroupWire = helper.addGroup(sTgcMonAlg, 'sTgcQuadOccupancyWire', globalPath + 'Shifter/Occupancy')
44  sTgcTimingGroup = helper.addGroup(sTgcMonAlg, 'sTgcTiming', globalPath + 'Shifter/Timing')
45  sTgcPadTriggerShifterGroup = helper.addGroup(sTgcMonAlg, 'padTriggerShifter', globalPath + 'Shifter/')
46  sTgcLBshifterGroup = helper.addGroup(sTgcMonAlg, 'sTgcLumiblock', globalPath + 'Shifter/Lumiblock/')
47 
48  # Expert
49  sTgcOccupancyGroup = helper.addGroup(sTgcMonAlg, 'sTgcOccupancy', globalPath + 'Expert/Occupancy')
50  sTgcPadTriggerExpertGroup = helper.addGroup(sTgcMonAlg, 'padTriggerExpert', globalPath + 'Expert/')
51  padTriggerOccupancyGroup = helper.addGroup(sTgcMonAlg, 'padTriggerOccupancy', globalPath + 'Expert/PadTrigger/Hits/')
52 
53  # Layered and occupancy histograms
54  side = ['A', 'C']
55  size = ['L', 'S']
56  stationEtaMax = 3
57  sectorMax = 16
58  layerMax = 8
59 
60  # Custom labels
61  # Pad trigger occupancy
62  columnLabels = [columnLabels_AL, columnLabels_AS, columnLabels_CL, columnLabels_CS]
63  columnLabelsCounter = 0
64 
65  titleEtaPhiEffMap = '; #eta (reco); #phi (reco); Pad trigger efficiency wrt. reco. muon'
66  varEtaPhiEffMap = 'muonRecoTriggerMatch,etaRecoMuonEff,phiRecoMuonEff;padTrigger_Efficiency_per_etaPhi'
67  sTgcOverviewGroup.defineHistogram(varEtaPhiEffMap, type = 'TEfficiency', title = titleEtaPhiEffMap, path = 'Overview', xbins = 100, xmin = -3., xmax = 3., ybins = 100, ymin = -math.pi, ymax = math.pi, opt = 'kAlwaysCreate')
68 
69  titleEtaEffMap = '; #eta (reco); Pad trigger efficiency wrt. reco. muon'
70  varEtaEffMap = 'muonRecoTriggerMatch,etaRecoMuonEff;padTrigger_Efficiency_per_eta'
71  sTgcOverviewGroup.defineHistogram(varEtaEffMap, type = 'TEfficiency', title = titleEtaEffMap, path = 'Overview', xbins = 100, xmin = -3., xmax = 3., opt = 'kAlwaysCreate')
72 
73  titleEtaPhiRecoMuonMap = '; #eta (reco); #phi (reco); Entries'
74  varEtaPhiRecoMuonMap = 'etaRecoMuon,phiRecoMuon;recoMuon_Map_per_etaPhi'
75  sTgcOverviewGroup.defineHistogram(varEtaPhiRecoMuonMap, type = 'TH2F', title = titleEtaPhiRecoMuonMap, path = 'Overview', xbins = 100, xmin = -3., xmax = 3., ybins = 100, ymin = -math.pi, ymax = math.pi, opt = 'kAlwaysCreate')
76 
77  titleEtaPhiPadTriggerMap = '; #eta (trig); #phi (trig); Entries'
78  varEtaPhiPadTriggerMap = 'etaPadTrigger,phiPadTrigger;padTrigger_Map_per_etaPhi'
79  sTgcOverviewGroup.defineHistogram(varEtaPhiPadTriggerMap, type = 'TH2F', title = titleEtaPhiPadTriggerMap, path = 'Overview', xbins = 100, xmin = -3., xmax = 3., ybins = 100, ymin = -math.pi, ymax = math.pi, opt = 'kAlwaysCreate')
80 
81  titleEtaRecoMuonMap = '; #eta (reco); Entries'
82  varEtaRecoMuonMap = 'etaRecoMuon;recoMuon_Map_per_eta'
83  sTgcOverviewGroup.defineHistogram(varEtaRecoMuonMap, type = 'TH1F', title = titleEtaRecoMuonMap, path = 'Overview', xbins = 100, xmin = -3., xmax = 3., opt = 'kAlwaysCreate')
84 
85  titleEtaPadTriggerMap = '; #eta (trig); Entries'
86  varEtaPadTriggerMap = 'etaPadTrigger;padTrigger_Map_per_eta'
87  sTgcOverviewGroup.defineHistogram(varEtaPadTriggerMap, type = 'TH1F', title = titleEtaPadTriggerMap, path = 'Overview', xbins = 100, xmin = -3., xmax = 3., opt = 'kAlwaysCreate')
88 
89  titleDeltaR = '; #Delta R(trig,reco); Entries'
90  varDeltaR = 'deltaR;deltaR_Matching_recoMuonPadTrigger'
91  sTgcOverviewGroup.defineHistogram(varDeltaR, type = 'TH1F', title = titleDeltaR, path = 'Overview', xbins = 100, xmin = 0, xmax = 10, opt = 'kAlwaysCreate')
92 
93  titleSectorsVersusLumiblockPad = 'Pad; LB; Sector; Hits'
94  varSectorsVersusLumiblockPad = 'padLumiblock,padSector;Nhits_all_pad_in_sector_per_LB'
95  sTgcLBshifterGroup.defineHistogram(varSectorsVersusLumiblockPad, type = 'TH2F', title = titleSectorsVersusLumiblockPad, path = 'Pad', xbins = 2001, xmin = -0.5, xmax = 2000.5, ybins = 2*sectorMax + 1, ymin = -sectorMax - 0.5, ymax = sectorMax + 0.5, opt = 'kAlwaysCreate')
96 
97  titleSectorsVersusLumiblockStrip = 'Strip; LB; Sector; Hits'
98  varSectorsVersusLumiblockStrip = 'stripLumiblock,stripSector;Nhits_all_strip_in_sector_per_LB'
99  sTgcLBshifterGroup.defineHistogram(varSectorsVersusLumiblockStrip, type = 'TH2F', title = titleSectorsVersusLumiblockStrip, path = 'Strip', xbins = 2001, xmin = -0.5, xmax = 2000.5, ybins = 2*sectorMax + 1, ymin = -sectorMax - 0.5, ymax = sectorMax + 0.5, opt = 'kAlwaysCreate')
100 
101  titleSectorsVersusLumiblockWire = 'Wire; LB; Sector; Hits'
102  varSectorsVersusLumiblockWire = 'wireLumiblock,wireSector;Nhits_all_wire_in_sector_per_LB'
103  sTgcLBshifterGroup.defineHistogram(varSectorsVersusLumiblockWire, type = 'TH2F', title = titleSectorsVersusLumiblockWire, path = 'Wire', xbins = 2001, xmin = -0.5, xmax = 2000.5, ybins = 2*sectorMax + 1, ymin = -sectorMax - 0.5, ymax = sectorMax + 0.5, opt = 'kAlwaysCreate')
104 
105  titleSectorVsLB = '; LB; Sector; Number of triggers'
106  varSectorVsLB = 'lb,sector;OccupancySector_vs_LB'
107  weightSectorVsLB = 'numberOfTriggers'
108  sTgcPadTriggerShifterGroup.defineHistogram(varSectorVsLB, type = 'TH2F', title = titleSectorVsLB, path = 'PadTrigger/Triggers', xbins = 2001, xmin = -0.5, xmax = 2000.5, ybins = 2*sectorMax + 1, ymin = -sectorMax - 0.5, ymax = sectorMax + 0.5, opt = 'kAlwaysCreate', weight = weightSectorVsLB)
109 
110  titleRelBCIDvsLB = '; LB; Trigger relBCID; Pad Trigger hits'
111  varRelBCIDvsLB = 'lb,relBCID;RelBCID_vs_LB'
112  sTgcPadTriggerShifterGroup.defineHistogram(varRelBCIDvsLB, type = 'TH2F', title = titleRelBCIDvsLB, path = 'PadTrigger/Triggers', xbins = 2001, xmin = -0.5, xmax = 2000.5, ybins = 7, ymin = -0.5, ymax = 6.5, opt = 'kAlwaysCreate')
113 
114  titleHitPFEBperSector = '; Sector; Hit pFEB; Pad Trigger hits associated to reco muons'
115  varHitPFEBperSector = 'sector,hitPfebs;OccupancypFEB_vs_Sector'
116  sTgcPadTriggerShifterGroup.defineHistogram(varHitPFEBperSector, type = 'TH2F', title = titleHitPFEBperSector, path = 'PadTrigger/Hits', xbins = 2*sectorMax + 1, xmin = -sectorMax - 0.5, xmax = sectorMax + 0.5, ybins = 25, ymin = -0.5, ymax = 24.5, opt = 'kAlwaysCreate')
117 
118  titleHitRelBCID = '; Sector; Hit relBCID; Pad Trigger hits associated to reco muons'
119  varHitRelBCID = 'sector,hitRelBCID;relBCID_vs_Sector'
120  sTgcPadTriggerShifterGroup.defineHistogram(varHitRelBCID, type = 'TH2F', title = titleHitRelBCID, path = 'PadTrigger/Hits', xbins = 2*sectorMax + 1, xmin = -sectorMax - 0.5, xmax = sectorMax + 0.5, ybins = 7, ymin = -0.5, ymax = 6.5, opt = 'kAlwaysCreate')
121 
122  for sideIndex in side:
123  titlePhiRecoMuonMap = f'{sideIndex}; #phi (reco); Entries'
124  varPhiRecoMuonMap = f'phiRecoMuon_{sideIndex};recoMuon_Map_per_phi_Side{sideIndex}'
125  sTgcOverviewGroup.defineHistogram(varPhiRecoMuonMap, type = 'TH1F', title = titlePhiRecoMuonMap, path = 'Overview', xbins = 100, xmin = -math.pi, xmax = math.pi, opt = 'kAlwaysCreate')
126 
127  titlePhiPadTriggerMap = f'{sideIndex}; #phi (trig); Entries'
128  varPhiPadTriggerMap = f'phiPadTrigger_{sideIndex};padTrigger_Map_per_phi_Side{sideIndex}'
129  sTgcOverviewGroup.defineHistogram(varPhiPadTriggerMap, type = 'TH1F', title = titlePhiPadTriggerMap, path = 'Overview', xbins = 100, xmin = -math.pi, xmax = math.pi, opt = 'kAlwaysCreate')
130 
131  titlePhiEffMap = f'{sideIndex}; #phi (reco); Pad trigger efficiency wrt. reco. muon'
132  varPhiEffMap = f'muonRecoTriggerMatch,phiRecoMuonEff_{sideIndex};padTrigger_Efficiency_per_phi_Side_{sideIndex}'
133  sTgcOverviewGroup.defineHistogram(varPhiEffMap, type = 'TEfficiency', title = titlePhiEffMap, path = 'Overview', xbins = 100, xmin = -math.pi, xmax = math.pi, opt = 'kAlwaysCreate')
134 
135  for sectorIndex in range(1, sectorMax + 1):
136  efficiencyGlobalRgroup = helper.addGroup(sTgcMonAlg, f'rPosStrip_{sideIndex}{sectorIndex}', globalPath + 'Expert/Efficiency/')
137 
138  for layerIndex in range(1, layerMax + 1):
139  titleEffGlobalRstrip = f'{sideIndex}' + f'{sectorIndex}'.zfill(2) + f'L{layerIndex}; sTgc-GlobalR-Strip (on track) [mm]' + f'; Efficiency sTGC strip {sideIndex}' + f'{sectorIndex}'.zfill(2) + f'L{layerIndex}'
140  varEffGlobalRstrip = f'hitLayer,rPosStrip_{sideIndex}_sector_{sectorIndex}_layer_{layerIndex};Efficiency_per_Radius_Layer{layerIndex}'
141  efficiencyGlobalRgroup.defineHistogram(varEffGlobalRstrip, type = 'TEfficiency', title = titleEffGlobalRstrip, path = f'{sideIndex}' + f'{sectorIndex}'.zfill(2), xbins = 100, xmin = 0., xmax = 5000., opt = 'kAlwaysCreate')
142  for layerIndex in range(1, layerMax + 1):
143  titleEffYvsXstrip = f'{sideIndex}L{layerIndex}; sTgc-GlobalX-Strip (on track) [mm]; sTgc-GlobalY-Strip (on track) [mm]; Efficiency sTGC strip {sideIndex}L{layerIndex}'
144  varEffYvsXstrip = f'hitLayer,xPosStrip_{sideIndex}_layer_{layerIndex},yPosStrip_{sideIndex}_layer_{layerIndex};strip_efficiency_per_mm_squared_Wheel{sideIndex}_layer{layerIndex}'
145  sTgcOverviewGroup.defineHistogram(varEffYvsXstrip, type = 'TEfficiency', title = titleEffYvsXstrip, path = 'Overview', xbins = 500, xmin = -5000., xmax = 5000., ybins = 500, ymin = -5000., ymax = 5000., opt = 'kAlwaysCreate')
146 
147  for stationEtaIndex in range(1, stationEtaMax + 1):
148  sTgcPadTimingExpertGroup = helper.addGroup(sTgcMonAlg, f'padTiming_quad_{stationEtaIndex}', globalPath + 'Expert/Timing/Pad')
149  sTgcStripTimingExpertGroup = helper.addGroup(sTgcMonAlg, f'stripTiming_quad_{stationEtaIndex}', globalPath + 'Expert/Timing/Strip')
150  sTgcWireTimingExpertGroup = helper.addGroup(sTgcMonAlg, f'wireTiming_quad_{stationEtaIndex}', globalPath + 'Expert/Timing/Wire')
151 
152  sTgcLBpadShifterGroup = helper.addGroup(sTgcMonAlg, f'sTgcLumiblockPad_quad_{stationEtaIndex}', globalPath + 'Shifter/Lumiblock/Pad')
153  sTgcLBstripShifterGroup = helper.addGroup(sTgcMonAlg, f'sTgcLumiblockStrip_quad_{stationEtaIndex}', globalPath + 'Shifter/Lumiblock/Strip')
154  sTgcLBwireShifterGroup = helper.addGroup(sTgcMonAlg, f'sTgcLumiblockWire_quad_{stationEtaIndex}', globalPath + 'Shifter/Lumiblock/Wire')
155 
156  for layerIndex in range(1, layerMax + 1):
157  titleTimingPadTrack = f'Q{stationEtaIndex}L{layerIndex}; Sector; Pad Timing (on-track) [ns]; Hits'
158  varTimingPadTrack = f'padTrackSectorSided_quad_{stationEtaIndex}_layer_{layerIndex},padTrackTiming_quad_{stationEtaIndex}_layer_{layerIndex};All_pad_timing_in_Q{stationEtaIndex}_Layer{layerIndex}'
159  sTgcPadTimingExpertGroup.defineHistogram(varTimingPadTrack, type = 'TH2F', title = titleTimingPadTrack, path = f'Q{stationEtaIndex}', xbins = 2*sectorMax + 1, xmin = -sectorMax - 0.5, xmax = sectorMax + 0.5, ybins = 201, ymin = -75.5, ymax = 125.5, opt = 'kAlwaysCreate')
160 
161  titleTimingStripTrack = f'Q{stationEtaIndex}L{layerIndex}; Sector; Strip Cluster Timing (on-track) [ns]; Hits'
162  varTimingStripTrack = f'stripTrackSectorSided_quad_{stationEtaIndex}_layer_{layerIndex},stripTrackTiming_quad_{stationEtaIndex}_layer_{layerIndex};All_strip_timing_in_Q{stationEtaIndex}_Layer{layerIndex}'
163  sTgcStripTimingExpertGroup.defineHistogram(varTimingStripTrack, type = 'TH2F', title = titleTimingStripTrack, path = f'Q{stationEtaIndex}', xbins = 2*sectorMax + 1, xmin = -sectorMax - 0.5, xmax = sectorMax + 0.5, ybins = 201, ymin = -75.5, ymax = 125.5, opt = 'kAlwaysCreate')
164 
165  titleTimingWireTrack = f'Q{stationEtaIndex}L{layerIndex}; Sector; Wire Group Timing (on-track) [ns]; Hits'
166  varTimingWireTrack = f'wireTrackSectorSided_quad_{stationEtaIndex}_layer_{layerIndex},wireTrackTiming_quad_{stationEtaIndex}_layer_{layerIndex};All_wire_timing_in_Q{stationEtaIndex}_Layer{layerIndex}'
167  sTgcWireTimingExpertGroup.defineHistogram(varTimingWireTrack, type = 'TH2F', title = titleTimingWireTrack, path = f'Q{stationEtaIndex}', xbins = 2*sectorMax + 1, xmin = -sectorMax - 0.5, xmax = sectorMax + 0.5, ybins = 201, ymin = -75.5, ymax = 125.5, opt = 'kAlwaysCreate')
168 
169  titleSectorsVersusLumiblockPad = f'Pad_L{layerIndex}Q{stationEtaIndex}; LB; Sector; Hits'
170  varSectorsVersusLumiblockPad = f'padLumiblock_quad_{stationEtaIndex}_layer_{layerIndex},padSector_quad_{stationEtaIndex}_layer_{layerIndex};Nhits_all_pad_in_sector_per_LB_in_Q{stationEtaIndex}_Layer{layerIndex}'
171  sTgcLBpadShifterGroup.defineHistogram(varSectorsVersusLumiblockPad, type = 'TH2F', title = titleSectorsVersusLumiblockPad, path = f'Q{stationEtaIndex}', xbins = 2001, xmin = -0.5, xmax = 2000.5, ybins = 2*sectorMax + 1, ymin = -sectorMax - 0.5, ymax = sectorMax + 0.5, opt = 'kAlwaysCreate')
172 
173  titleSectorsVersusLumiblockStrip = f'Strip_L{layerIndex}Q{stationEtaIndex}; LB; Sector; Hits'
174  varSectorsVersusLumiblockStrip = f'stripLumiblock_quad_{stationEtaIndex}_layer_{layerIndex},stripSector_quad_{stationEtaIndex}_layer_{layerIndex};Nhits_all_strip_in_sector_per_LB_in_Q{stationEtaIndex}_Layer{layerIndex}'
175  sTgcLBstripShifterGroup.defineHistogram(varSectorsVersusLumiblockStrip, type = 'TH2F', title = titleSectorsVersusLumiblockStrip, path = f'Q{stationEtaIndex}', xbins = 2001, xmin = -0.5, xmax = 2000.5, ybins = 2*sectorMax + 1, ymin = -sectorMax - 0.5, ymax = sectorMax + 0.5, opt = 'kAlwaysCreate')
176 
177  titleSectorsVersusLumiblockWire = f'Wire_L{layerIndex}Q{stationEtaIndex}; LB; Sector; Hits'
178  varSectorsVersusLumiblockWire = f'wireLumiblock_quad_{stationEtaIndex}_layer_{layerIndex},wireSector_quad_{stationEtaIndex}_layer_{layerIndex};Nhits_all_wire_in_sector_per_LB_in_Q{stationEtaIndex}_Layer{layerIndex}'
179  sTgcLBwireShifterGroup.defineHistogram(varSectorsVersusLumiblockWire, type = 'TH2F', title = titleSectorsVersusLumiblockWire, path = f'Q{stationEtaIndex}', xbins = 2001, xmin = -0.5, xmax = 2000.5, ybins = 2*sectorMax + 1, ymin = -sectorMax - 0.5, ymax = sectorMax + 0.5, opt = 'kAlwaysCreate')
180 
181  for sideIndex in side:
182  for sizeIndex in size:
183  titlePhiVsIds = f'{sideIndex}{sizeIndex}; Trigger phiID; Trigger bandID; Pad Trigger hits'
184  varPhiVsIds = f'phiIds_{sideIndex}_{sizeIndex},bandIds_{sideIndex}_{sizeIndex};bandIds_vs_phiIds_Side{sideIndex}_Size{sizeIndex}'
185  sTgcPadTriggerShifterGroup.defineHistogram(varPhiVsIds, type = 'TH2F', title = titlePhiVsIds, path = 'PadTrigger/Triggers', xbins = 65, xmin = -32.5, xmax = 32.5, ybins = 101, ymin = -0.5, ymax = 100.5, opt = 'kAlwaysCreate')
186 
187  for layerIndex in range(1, layerMax + 1):
188  titleEtaPhiOcc = f'{layerIndex}{sideIndex}{sizeIndex}; Pad column; Pad row; Hits'
189  varEtaPhiOcc = f'padPhi_{sideIndex}_{sizeIndex}_layer_{layerIndex},padEta_{sideIndex}_{sizeIndex}_layer_{layerIndex};padEtaPhiOcc_{layerIndex}{sideIndex}{sizeIndex}'
190  padTriggerOccupancyGroup.defineHistogram(varEtaPhiOcc, type = 'TH2F', title = titleEtaPhiOcc, path = 'padTriggerOccupancy', xbins = 71, xmin = 0.5, xmax = 71.5, xlabels = columnLabels[columnLabelsCounter], ybins = 56, ymin = 0.5, ymax = 56.5, ylabels = rowLabels, opt = 'kAlwaysCreate')
191 
192  columnLabelsCounter += 1
193  for sectorIndex in range(1, sectorMax + 1):
194  titleBandIdVersusLBperSector = f'{sideIndex}' + f'{sectorIndex}'.zfill(2) + '; LB; Trigger bandID; number of triggers'
195  varBandIdVersusLBperSector = f'lb_{sideIndex}_sector_{sectorIndex},bandIds_{sideIndex}_sector_{sectorIndex};OccupancyBandId_vs_LB_Side{sideIndex}_Sector{sectorIndex}'
196  weightBandIdVersusLBperSector = f'numberOfTriggers_{sideIndex}_sector_{sectorIndex}'
197  sTgcPadTriggerExpertGroup.defineHistogram(varBandIdVersusLBperSector, type = 'TH2F', title = titleBandIdVersusLBperSector, path = 'PadTrigger/Triggers/OccupancyBandIDvsLB', xbins = 2001, xmin = -0.5, xmax = 2000.5, ybins = 101, ymin = -0.5, ymax = 100.5, opt = 'kAlwaysCreate', weight = weightBandIdVersusLBperSector)
198 
199  titlePhiVsIds = f'{sideIndex}' + f'{sectorIndex}'.zfill(2) + '; Trigger phiID; Trigger bandID; Pad Trigger hits'
200  varPhiVsIds = f'phiIds_{sideIndex}_sector_{sectorIndex},bandIds_{sideIndex}_sector_{sectorIndex};bandIds_vs_phiIds_Side{sideIndex}_Sector{sectorIndex}'
201  sTgcPadTriggerExpertGroup.defineHistogram(varPhiVsIds, type = 'TH2F', title = titlePhiVsIds, path = 'PadTrigger/Triggers/OccupancyBandIDvsPhiId', xbins = 65, xmin = -32.5, xmax = 32.5, ybins = 101, ymin = -0.5, ymax = 100.5, opt = 'kAlwaysCreate')
202  titleRelBCIDvsLB = f'{sideIndex}' + f'{sectorIndex}'.zfill(2) + '; LB; Trigger relBCID; Pad Trigger hits'
203  varRelBCIDvsLB = f'lb_{sideIndex}_sector_{sectorIndex},relBCID_{sideIndex}_sector_{sectorIndex};RelBCID_vs_LB_Side{sideIndex}_Sector{sectorIndex}'
204  sTgcPadTriggerExpertGroup.defineHistogram(varRelBCIDvsLB, type = 'TH2F', title = titleRelBCIDvsLB, path = 'PadTrigger/Triggers/RelBCIDvsLB', xbins = 2001, xmin = -0.5, xmax = 2000.5, ybins = 7, ymin = -0.5, ymax = 6.5, opt = 'kAlwaysCreate')
205 
206  titleTriggerPhiIDvsRelBCIDPerSector = f'{sideIndex}' + f'{sectorIndex}'.zfill(2) + '; Trigger relBCID; Trigger phiID; Pad Trigger hits'
207  varTriggerPhiIDvsRelBCIDPerSector = f'relBCID_{sideIndex}_sector_{sectorIndex},phiIds_{sideIndex}_sector_{sectorIndex};Trigger_PhiID_vs_RelBCID_Side{sideIndex}_Sector{sectorIndex}'
208  sTgcPadTriggerShifterGroup.defineHistogram(varTriggerPhiIDvsRelBCIDPerSector, type = 'TH2F', title = titleTriggerPhiIDvsRelBCIDPerSector, path = 'PadTrigger/Triggers/PhiIDvsRelBCID', xbins = 7, xmin = -0.5, xmax = 6.5, ybins = 65, ymin = -32.5, ymax = 32.5, opt = 'kAlwaysCreate')
209 
210  titleTriggerBandIDvsRelBCIDPerSector = f'{sideIndex}' + f'{sectorIndex}'.zfill(2) + '; Trigger relBCID; Trigger bandID; Pad Trigger hits'
211  varTriggerBandIDvsRelBCIDPerSector = f'relBCID_{sideIndex}_sector_{sectorIndex},bandID_{sideIndex}_sector_{sectorIndex};Trigger_BandID_vs_RelBCID_Side{sideIndex}_Sector{sectorIndex}'
212  sTgcPadTriggerShifterGroup.defineHistogram(varTriggerBandIDvsRelBCIDPerSector, type = 'TH2F', title = titleTriggerBandIDvsRelBCIDPerSector, path = 'PadTrigger/Triggers/BandIDvsRelBCID', xbins = 7, xmin = -0.5, xmax = 6.5, ybins = 101, ymin = -0.5, ymax = 100.5, opt = 'kAlwaysCreate')
213 
214  titleHitPFEBvsRelBCIDPerSector = f'{sideIndex}' + f'{sectorIndex}'.zfill(2) + '; Hit relBCID; Hit pFEB; Pad Trigger hits associated to reco muons'
215  varHitPFEBvsRelBCIDPerSector = f'hitRelBCID_{sideIndex}_sector_{sectorIndex},hitPfebs_{sideIndex}_sector_{sectorIndex};pFEB_vs_relBCID_Side{sideIndex}_Sector{sectorIndex}'
216  sTgcPadTriggerShifterGroup.defineHistogram(varHitPFEBvsRelBCIDPerSector, type = 'TH2F', title = titleHitPFEBvsRelBCIDPerSector, path = 'PadTrigger/Hits/PFEBvsRelBCID', xbins = 7, xmin = -0.5, xmax = 6.5, ybins = 25, ymin = -0.5, ymax = 24.5, opt = 'kAlwaysCreate')
217 
218  for stationEtaIndex in range(1, stationEtaMax + 1):
219  padChargeGroup = helper.addGroup(sTgcMonAlg, f'padCharge_{sideIndex}{sectorIndex}_quad_{stationEtaIndex}', globalPath + f'Expert/Charge/{sideIndex}' + f'{sectorIndex}'.zfill(2) + '/Pad')
220  stripChargeGroup = helper.addGroup(sTgcMonAlg, f'stripCharge_{sideIndex}{sectorIndex}_quad_{stationEtaIndex}', globalPath + f'Expert/Charge/{sideIndex}' + f'{sectorIndex}'.zfill(2) + '/Strip')
221  wireGroupChargeGroup = helper.addGroup(sTgcMonAlg, f'wireGroupCharge_{sideIndex}{sectorIndex}_quad_{stationEtaIndex}', globalPath + f'Expert/Charge/{sideIndex}' + f'{sectorIndex}'.zfill(2) + '/Wire')
222  residualGroup = helper.addGroup(sTgcMonAlg, f'sTgcResiduals_{sideIndex}{sectorIndex}_quad_{stationEtaIndex}', globalPath + f'Expert/Residuals/{sideIndex}' + f'{sectorIndex}'.zfill(2))
223 
224  for layerIndex in range(1, layerMax + 1):
225  titlePadChargeTrack = f'{sideIndex}' + f'{sectorIndex}'.zfill(2) + f'L{layerIndex}Q{stationEtaIndex}; Pad Charge (on-track) [fC]; Number of Entries'
226  varPadChargeTrack = f'padTrackCharge_{sideIndex}_quad_{stationEtaIndex}_sector_{sectorIndex}_layer_{layerIndex};All_pad_charge_in_Q{stationEtaIndex}_Layer{layerIndex}'
227  padChargeGroup.defineHistogram(varPadChargeTrack, type = 'TH1F', title = titlePadChargeTrack, path = f'Q{stationEtaIndex}', xbins = 100, xmin = 0., xmax = 1000., opt = 'kAlwaysCreate')
228 
229  titleStripChargeTrack = f'{sideIndex}' + f'{sectorIndex}'.zfill(2) + f'L{layerIndex}Q{stationEtaIndex}; Strip Cluster Charge (on-track) [fC]; Number of Entries'
230  varStripChargeTrack = f'stripTrackCharge_{sideIndex}_quad_{stationEtaIndex}_sector_{sectorIndex}_layer_{layerIndex};All_strip_charge_in_Q{stationEtaIndex}_Layer{layerIndex}'
231  stripChargeGroup.defineHistogram(varStripChargeTrack, type = 'TH1F', title = titleStripChargeTrack, path = f'Q{stationEtaIndex}', xbins = 120, xmin = 0., xmax = 1200., opt = 'kAlwaysCreate')
232 
233  titleWireGroupChargeTrack = f'{sideIndex}' + f'{sectorIndex}'.zfill(2) + f'L{layerIndex}Q{stationEtaIndex}; Wire Group Charge (on-track) [fC]; Number of Entries'
234  varWireGroupChargeTrack = f'wireGroupTrackCharge_{sideIndex}_quad_{stationEtaIndex}_sector_{sectorIndex}_layer_{layerIndex};All_wire_charge_in_Q{stationEtaIndex}_Layer{layerIndex}'
235  wireGroupChargeGroup.defineHistogram(varWireGroupChargeTrack, type = 'TH1F', title = titleWireGroupChargeTrack, path = f'Q{stationEtaIndex}', xbins = 100, xmin = 0., xmax = 1000., opt = 'kAlwaysCreate')
236 
237  titleResidual = f'{sideIndex}' + f'{sectorIndex}'.zfill(2) + f'L{layerIndex}Q{stationEtaIndex}; Residual [mm]; Number of Entries'
238  varResidual = f'residual_{sideIndex}_quad_{stationEtaIndex}_sector_{sectorIndex}_layer_{layerIndex};Residuals_in_Q{stationEtaIndex}_Layer{layerIndex}'
239  residualGroup.defineHistogram(varResidual, type = 'TH1F', title = titleResidual, path = f'Q{stationEtaIndex}', xbins = 1000, xmin = -2., xmax = 2., opt = 'kAlwaysCreate')
240 
241 
242  for layerIndex in range(1, layerMax + 1):
243  titleStripClusterSizeTrack = f'L{layerIndex}; Sector; Strip Cluster Size (on-track); Hits'
244  varStripClusterSizeTrack = f'stripTrackSectorSided_layer_{layerIndex},stripTrackClusterSize_layer_{layerIndex};Strip_cluster_size_ontrk_per_sector_Layer{layerIndex}'
245  sTgcOverviewGroup.defineHistogram(varStripClusterSizeTrack, type = 'TH2F', title = titleStripClusterSizeTrack, path = 'Overview', xbins = 2*sectorMax + 1, xmin = -sectorMax - 0.5, xmax = sectorMax + 0.5, ybins = 13, ymin = -0.5, ymax = 12.5, opt = 'kAlwaysCreate')
246 
247  titleTimingStripTrack = f'L{layerIndex}; Sector; Strip Cluster Timing (on-track) [ns]; Hits'
248  varTimingStripTrack = f'stripTrackSectorSided_layer_{layerIndex},stripTrackTiming_layer_{layerIndex};Strip_cluster_timing_ontrk_per_sector_Layer{layerIndex}'
249  sTgcOverviewGroup.defineHistogram(varTimingStripTrack, type = 'TH2F', title = titleTimingStripTrack, path = 'Overview', xbins = 2*sectorMax + 1, xmin = -sectorMax - 0.5, xmax = sectorMax + 0.5, ybins = 201, ymin = -75.5, ymax = 125.5, opt = 'kAlwaysCreate')
250 
251  titleStationEtaSectorPadHitMap = f'Pad_L{layerIndex}; Sector; Quad; Hits'
252  varStationEtaSectorPadHitMap = f'sector_layer_{layerIndex},stationEta_layer_{layerIndex};Pad_quad_occupancy_per_sector_Layer{layerIndex}'
253  sTgcQuadOccupancyGroupPad.defineHistogram(varStationEtaSectorPadHitMap, type = 'TH2F', title = titleStationEtaSectorPadHitMap, path = 'Pad', xbins = sectorMax, xmin = 0.5, xmax = sectorMax + 0.5, ybins = 2*stationEtaMax + 1, ymin = -stationEtaMax - 0.5, ymax = stationEtaMax + 0.5, opt = 'kAlwaysCreate')
254 
255  titleStationEtaSectorStripHitMap = f'Strip_L{layerIndex}; Sector; Quad; Hits'
256  varStationEtaSectorStripHitMap = f'sector_layer_{layerIndex},stationEta_layer_{layerIndex};Strip_quad_occupancy_per_sector_Layer{layerIndex}'
257  sTgcQuadOccupancyGroupStrip.defineHistogram(varStationEtaSectorStripHitMap, type = 'TH2F', title = titleStationEtaSectorStripHitMap, path = 'Strip', xbins = sectorMax, xmin = 0.5, xmax = sectorMax + 0.5, ybins = 2*stationEtaMax + 1, ymin = -stationEtaMax - 0.5, ymax = stationEtaMax + 0.5, opt = 'kAlwaysCreate')
258 
259  titleStationEtaSectorWireGroupHitMap = f'Wire_L{layerIndex}; Sector; Quad; Hits'
260  varStationEtaSectorWireGroupHitMap = f'sector_layer_{layerIndex},stationEta_layer_{layerIndex};Wire_quad_occupancy_per_sector_Layer{layerIndex}'
261  sTgcQuadOccupancyGroupWire.defineHistogram(varStationEtaSectorWireGroupHitMap, type = 'TH2F', title = titleStationEtaSectorWireGroupHitMap, path = 'Wire', xbins = sectorMax, xmin = 0.5, xmax = sectorMax + 0.5, ybins = 2*stationEtaMax + 1, ymin = -stationEtaMax - 0.5, ymax = stationEtaMax + 0.5, opt = 'kAlwaysCreate')
262 
263  titleTimingPadTrack = f'L{layerIndex}; Sector; Pad Timing (on-track) [ns]; Hits'
264  varTimingPadTrack = f'padTrackSectorSided_layer_{layerIndex},padTrackTiming_layer_{layerIndex};All_pad_timing_per_sector_Layer{layerIndex}'
265  sTgcTimingGroup.defineHistogram(varTimingPadTrack, type = 'TH2F', title = titleTimingPadTrack, path = 'Pad', xbins = 2*sectorMax + 1, xmin = -sectorMax - 0.5, xmax = sectorMax + 0.5, ybins = 225, ymin = -100., ymax = 125., opt = 'kAlwaysCreate')
266 
267  titleTimingStripTrack = f'L{layerIndex}; Sector; Strip Cluster Timing (on-track) [ns]; Hits'
268  varTimingStripTrack = f'stripTrackSectorSided_layer_{layerIndex},stripTrackTiming_layer_{layerIndex};All_strip_timing_per_sector_Layer{layerIndex}'
269  sTgcTimingGroup.defineHistogram(varTimingStripTrack, type = 'TH2F', title = titleTimingStripTrack, path = 'Strip', xbins = 2*sectorMax + 1, xmin = -sectorMax - 0.5, xmax = sectorMax + 0.5, ybins = 225, ymin = -100., ymax = 125., opt = 'kAlwaysCreate')
270 
271  titleTimingWireGroupTrack = f'L{layerIndex}; Sector; Wire Group timing (on-track) [ns]; Hits'
272  varTimingWireGroupTrack = f'wireGroupTrackSectorSided_layer_{layerIndex},wireGroupTrackTiming_layer_{layerIndex};All_wire_timing_per_sector_Layer{layerIndex}'
273  sTgcTimingGroup.defineHistogram(varTimingWireGroupTrack, type = 'TH2F', title = titleTimingWireGroupTrack, path = 'Wire', xbins = 2*sectorMax + 1, xmin = -sectorMax - 0.5, xmax = sectorMax + 0.5, ybins = 225, ymin = -100., ymax = 125., opt = 'kAlwaysCreate')
274 
275  titlePadOccupancy = f'L{layerIndex}; Sector; Pad Number; Hits'
276  varPadOccupancy = f'sector_layer_{layerIndex},padNumber_layer_{layerIndex};Pad_ch_occupancy_per_sector_Layer{layerIndex}'
277  sTgcOccupancyGroup.defineHistogram(varPadOccupancy, type = 'TH2F', title = titlePadOccupancy, path = 'Pad', xbins = 2*sectorMax + 1, xmin = -sectorMax - 0.5, xmax = sectorMax + 0.5, ybins = 317, ymin = 0., ymax = 317., opt = 'kAlwaysCreate')
278 
279  titleStripOccupancy = f'L{layerIndex}; Sector; Strip Number; Hits'
280  varStripOccupancy = f'sector_layer_{layerIndex},stripNumber_layer_{layerIndex};Strip_ch_occupancy_per_sector_Layer{layerIndex}'
281  sTgcOccupancyGroup.defineHistogram(varStripOccupancy, type = 'TH2F', title = titleStripOccupancy, path = 'Strip', xbins = 2*sectorMax + 1, xmin = -sectorMax - 0.5, xmax = sectorMax + 0.5, ybins = 1130, ymin = 0., ymax = 1130., opt = 'kAlwaysCreate')
282 
283  titleWireGroupOccupancyPerQuad = f'L{layerIndex}; Wire Group Number; Quad; Hits'
284  varWireGroupOccupancyPerQuad = f'wireGroupNumber_layer_{layerIndex},stationEta_layer_{layerIndex};Wire_ch_occupancy_per_sector_Layer{layerIndex}'
285  sTgcOccupancyGroup.defineHistogram(varWireGroupOccupancyPerQuad, type = 'TH2F', title = titleWireGroupOccupancyPerQuad, path = 'Wire', xbins = 58*sectorMax + 1, xmin = -0.5, xmax = 58*sectorMax + 0.5, xlabels = wireGroupNumberLabel, ybins = 2*stationEtaMax + 1, ymin = -stationEtaMax - 0.5, ymax = stationEtaMax + 0.5, opt = 'kAlwaysCreate')
286 
287  acc = helper.result()
288  result.merge(acc)
289  return result
290 
291 if __name__=='__main__':
292  from AthenaConfiguration.AllConfigFlags import initConfigFlags
293  import argparse
294 
295  parser = argparse.ArgumentParser()
296  parser.add_argument("--events", default = 100, type = int, help = 'Number of events that you want to run.')
297  parser.add_argument("--samples", nargs = "+", default = None, help = 'Path to the input samples. If you want to run multiple samples at once you have to introduce them separated by blank spaces.')
298  parser.add_argument("--output", default = "HIST.root", help = 'Name of the output ROOT file.')
299  args = parser.parse_args()
300 
301  flags = initConfigFlags()
302  flags.Input.Files = []
303  flags.Input.Files += args.samples
304 
305  flags.Output.HISTFileName = args.output
306 
307  flags.Detector.GeometrysTGC = True
308  flags.DQ.useTrigger = False
309 
310  flags.lock()
311  flags.dump()
312 
313  # Initialize configuration object, add accumulator, merge, and run.
314  from AthenaConfiguration.MainServicesConfig import MainServicesCfg
315  from AthenaPoolCnvSvc.PoolReadConfig import PoolReadCfg
316 
317  cfg = MainServicesCfg(flags)
318  cfg.merge(PoolReadCfg(flags))
319  sTgcMonitorAcc = sTgcMonitoringConfig(flags)
320  sTgcMonitorAcc.OutputLevel = 2
321  cfg.merge(sTgcMonitorAcc)
322 
323  # number of events selected in the ESD
324  cfg.run(args.events)
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
StgcMonitorAlgorithm.sTgcMonitoringConfig
def sTgcMonitoringConfig(inputFlags, NSW_PadTrigKey='')
Definition: StgcMonitorAlgorithm.py:9
python.MainServicesConfig.MainServicesCfg
def MainServicesCfg(flags, LoopMgr='AthenaEventLoopMgr')
Definition: MainServicesConfig.py:256
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
python.MuonGeometryConfig.MuonGeoModelCfg
def MuonGeoModelCfg(flags)
Definition: MuonGeometryConfig.py:28
python.AllConfigFlags.initConfigFlags
def initConfigFlags()
Definition: AllConfigFlags.py:19
python.PoolReadConfig.PoolReadCfg
def PoolReadCfg(flags)
Definition: PoolReadConfig.py:69