Loading [MathJax]/jax/input/TeX/config.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Functions
EfexMonitorAlgorithm Namespace Reference

Functions

def EfexMonitoringConfig (inputFlags)
 
def EfexMonitoringHistConfig (flags, eFexAlg)
 

Function Documentation

◆ EfexMonitoringConfig()

def EfexMonitorAlgorithm.EfexMonitoringConfig (   inputFlags)
Function to configure LVL1 Efex monitoring algorithm

Definition at line 4 of file EfexMonitorAlgorithm.py.

4 def EfexMonitoringConfig(inputFlags):
5  '''Function to configure LVL1 Efex monitoring algorithm'''
6 
7  # get the component factory - used for merging the algorithm results
8  from AthenaConfiguration.ComponentFactory import CompFactory
9  from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
10  result = ComponentAccumulator()
11 
12  # add algorithm to the helper
13  result.addEventAlgo( CompFactory.EfexMonitorAlgorithm('EfexMonAlg',
14  PackageName='EfexMonitor',
15  LowPtCut = 0.0,
16  HiPtCut = 15000.0,
17  eFexEMTobKeyList = ['L1_eEMRoI', 'L1_eEMxRoI'],
18  eFexTauTobKeyList = ['L1_eTauRoI', 'L1_eTauxRoI']
19  ) )
20 
21  return result
22 
23 

◆ EfexMonitoringHistConfig()

def EfexMonitorAlgorithm.EfexMonitoringHistConfig (   flags,
  eFexAlg 
)
Book the histograms for the efex monitoring. This is done in a separate method
to the algorithm creation (above) because the histograms are based on the list of container keys
given to the algorithm, which can be customized by the user before calling this method.

Definition at line 24 of file EfexMonitorAlgorithm.py.

24 def EfexMonitoringHistConfig(flags, eFexAlg):
25  """
26  Book the histograms for the efex monitoring. This is done in a separate method
27  to the algorithm creation (above) because the histograms are based on the list of container keys
28  given to the algorithm, which can be customized by the user before calling this method.
29  """
30  import math
31  from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
32  result = ComponentAccumulator()
33 
34 
35  # make the athena monitoring helper again so we can add groups
36  from TrigT1CaloMonitoring.LVL1CaloMonitoringConfig import L1CaloMonitorCfgHelper
37  helper = L1CaloMonitorCfgHelper(flags,None,'EfexMonitoringCfg')
38  helper.alg = eFexAlg
39 
40  # we don't add the algorithm again, use the supplied one
41  EfexMonAlg = eFexAlg
42  baseGroupName = EfexMonAlg.PackageName
43 
44  # Some helpful variables for declaring the histograms
45  # mainDir = 'L1Calo'
46  trigPath = f'Developer/{eFexAlg.name}/' # Default Directory trigger path for output histos
47  # Map from the key name to the output directory substructure.
48 
49  def pathFromKey(key,prefix="Nominal/"):
50  path=prefix
51  if "DAODSim" in key: path = "DAODSim/"
52  elif "ReSim" in key: path = "ReSim/"
53  elif "Sim" in key: path = "Sim/"
54  if "_eEMx" in key: path += "eEMx"
55  elif "_eEM" in key: path += "eEM"
56  elif "_eTaux" in key: path += "eTAUx"
57  elif "_eTau" in key: path += "eTAU"
58  return path
59 
60  cut_names = ["LowPtCut", "HiPtCut"] # List of cut names, for looping over to separate out histograms into directories
61  cut_vals = [EfexMonAlg.LowPtCut, EfexMonAlg.HiPtCut] # List of values, for looping over to add to histogram titles
62 
63  # First, define the histograms with no Pt cut
64  # add monitoring algorithm to group, with group name and main directory
65 
66  locIdxs = []
67  for phiOct in range(0,8):
68  for etaIdx in range(-25,25):
69  locIdxs += [str(phiOct) + ":" + str(etaIdx)]
70 
71  for containerKey in (list(EfexMonAlg.eFexEMTobKeyList) + list(EfexMonAlg.eFexTauTobKeyList)):
72  helper.defineHistogram(containerKey + '_nTOBs_nocut;h_n'+containerKey+'_nocut', title='Number of '+containerKey+';Number of '+containerKey+';Events',
73  fillGroup = baseGroupName,
74  path=trigPath+pathFromKey(containerKey)+"NoCut",
75  type='TH1I', xbins=100,xmin=-0.5,xmax=99.5)
76  if "Sim" not in containerKey:
77  # don't make these expensive plots for simulation
78  helper.defineHistogram(f"LBN,{containerKey}_nTOBs_nocut;h_"+containerKey+"_nTOBs", title = "Average # of " + containerKey + " TOBs;LBN",
79  fillGroup = baseGroupName + "_" + containerKey,
80  path=trigPath+pathFromKey(containerKey)+"NoCut",
81  type="TH2I",
82  xbins=1,xmin=0,xmax=1,ybins=20,ymin=-0.5,ymax=19.5, opt=['kAddBinsDynamically'])
83 
84 
85  commonAlgConfig = {"libname":"libdqm_summaries.so",
86  "name":"L1Calo_BinsDiffFromStripMedian",
87  "PublishDetail":32}
88  hotCuts = {"ColdCut":-7,"WarmCut":9,"HotCut":20} # when looking at frequency of hot deposits, use these cuts
89 
90  commonThresholdConfig = {
91  "NWrongKnown":[0,100], # warn of any corrections that are needed for the known anomalies lists
92  "NDead":[0,2], # warn on any new dead spots, error if more than a couple
93  "NHot":[0,2], # warn on any new hot spots, error if more than a couple
94  "NCold":[0,2], # warn on any new cold spots, error if more than a couple
95  "NWarm":[0,5], # warn on any new warm spots, error if more than 5
96  "NDeadStrip":[0,0], # no dead strips - exception to this will be in cold hcal, where tile cannot be negative
97  "NConsecUnlikelyStrip":[2,5], # warn if more than 2 consecutive strips deemed unlikely
98  }
99 
100  knownAnomalies_eEM = {
101  "KnownDead":"\"48,8;49,41;49,42\"",
102  "KnownCold":"\"2,18;3,17;4,18;5,17;20,31;21,31;23,26;49,10;11,29;11,30;11,44;11,51;14,51;15,51;40,12;40,19;40,26;10,17;10,18;11,17;11,18\"",
103  "KnownWarm":"\"11,26;11,52;21,48\""
104  }
105 
106  # use KnownDead list from input hcal as an automatic cold-spot for eTAU
107  from TrigT1CaloMonitoring.EfexInputMonitorAlgorithm import knownAnomalies_hotHcal
108 
109  knownAnomalies_eTAU = {
110  "KnownCold":knownAnomalies_eEM["KnownDead"][:-1]+";"+knownAnomalies_hotHcal["KnownDead"][1:-1]+";2,18;3,17;4,18;5,17;49,10;10,20;20,31;21,31;14,51;15,51;23,26;29,7;17,32;14,54\"",
111  "KnownWarm":"\"\""
112  }
113 
114  helper.defineDQAlgorithm("Efex_eEM_etaThiMapFilled",
115  hanConfig=commonAlgConfig|hotCuts|knownAnomalies_eEM,
116  thresholdConfig=commonThresholdConfig
117  )
118  helper.defineDQAlgorithm("Efex_eTAU_etaThiMapFilled",
119  hanConfig=commonAlgConfig|hotCuts|knownAnomalies_eTAU,
120  thresholdConfig=commonThresholdConfig
121  )
122 
123  helper.defineDQAlgorithm("Efex_eEM_etaPhiLBMapOutliers_Shifter",
124  hanConfig=commonAlgConfig|hotCuts|knownAnomalies_eEM|{"NBinsY":64,"LiveMode":1},
125  thresholdConfig=commonThresholdConfig
126  ) # configuration for P1 monitoring
127  helper.defineDQAlgorithm("Efex_eEM_etaPhiLBMapOutliers",
128  hanConfig=commonAlgConfig|hotCuts|knownAnomalies_eEM|{"NBinsY":64,"LiveMode":0},
129  thresholdConfig=commonThresholdConfig
130  )
131  helper.defineDQAlgorithm("Efex_eTAU_etaPhiLBMapOutliers_Shifter",
132  hanConfig=commonAlgConfig|hotCuts|knownAnomalies_eTAU|{"NBinsY":64,"LiveMode":1},
133  thresholdConfig=commonThresholdConfig
134  ) # configuration for P1 monitoring
135  helper.defineDQAlgorithm("Efex_eTAU_etaPhiLBMapOutliers",
136  hanConfig=commonAlgConfig|hotCuts|knownAnomalies_eTAU|{"NBinsY":64,"LiveMode":0},
137  thresholdConfig=commonThresholdConfig
138  )
139 
140 
141  # Now define the histograms with low/hi Pt cut
142  for cut_name, cut_val in zip(cut_names, cut_vals):
143  cut_title_addition = '' if (cut_val == 0.0) else ' [Et>=' + '%.1f'%(cut_val/1000) + 'GeV]'
144  # Em first
145  for containerKey in EfexMonAlg.eFexEMTobKeyList:
146  fillGroup = baseGroupName+'_'+containerKey+'_'+cut_name
147  tobStr = containerKey
148  # histograms of eEM variables
149  helper.defineHistogram('nEMTOBs;h_nEmTOBs', title='Number of '+tobStr+'s'+cut_title_addition+';EM '+tobStr+'s;Number of EM '+tobStr+'s',
150  fillGroup=fillGroup,
151  type='TH1I', path=trigPath+pathFromKey(containerKey)+cut_name, xbins=10,xmin=0,xmax=10)
152 
153  helper.defineHistogram('TOBTransverseEnergy;h_TOBTransverseEnergy', title=tobStr+' ET [MeV]'+cut_title_addition,
154  fillGroup=fillGroup,
155  type='TH1F', path=trigPath+pathFromKey(containerKey)+cut_name, xbins=100,xmin=0,xmax=50000)
156 
157  helper.defineHistogram('TOBEta;h_TOBEta', title=tobStr+' Eta'+cut_title_addition,
158  fillGroup=fillGroup,
159  type='TH1F', path=trigPath+pathFromKey(containerKey)+cut_name, xbins=50,xmin=-2.5,xmax=2.5)
160 
161  helper.defineHistogram('TOBPhi;h_TOBPhi', title=tobStr+' Phi'+cut_title_addition,
162  fillGroup=fillGroup,
163  type='TH1F', path=trigPath+pathFromKey(containerKey)+cut_name, xbins=64,xmin=-math.pi,xmax=math.pi)
164 
165  helper.defineHistogram(f"TOBEta,TOBPhi;h_{containerKey}_{cut_name}_EtaPhiMap", title=tobStr+' Count'+cut_title_addition+';#eta;#phi',
166  fillGroup=fillGroup,
167  hanConfig={"display":"SetPalette(55)",
168  "description":f"Inspect for hot/cold spots - check help for list of known hot/coldspots, then check <a href='./detail/h_{containerKey}_{cut_name}_posVsLBN'>detail timeseries</a>. Warning if more than 1 deadspot, but could just be low stats","algorithm":"Efex_eEM_etaThiMapFilled"},
169  type='TH2F',
170  path=(("Expert/Outputs/"+pathFromKey(containerKey,"")) if "Sim" not in containerKey and "x" not in containerKey else trigPath+pathFromKey(containerKey)+cut_name),
171  xbins=50,xmin=-2.5,xmax=2.5,ybins=64,ymin=-math.pi,ymax=math.pi,opt=['kAlwaysCreate'])
172 
173  if "Sim" not in containerKey and "x" not in containerKey:
174  helper.defineHistogram(f"LBN,binNumber;h_{containerKey}_{cut_name}_posVsLBN", title=tobStr+' Count'+cut_title_addition+';LB;64(x-1)+y',
175  fillGroup=fillGroup,
176  hanConfig={"Expert/algorithm":f"Efex_{pathFromKey(containerKey,'')}_etaPhiLBMapOutliers","Shifter/algorithm":f"Efex_{pathFromKey(containerKey,'')}_etaPhiLBMapOutliers_Shifter",
177  "description":f"Timeseries of TOB counts at each location ... y-axis relates to x and y bin numbers from <a href='../h_{containerKey}_{cut_name}_EtaPhiMap'>eta-phi map</a>. Use Projection X1 for 1D plot"},
178  type='TH2I',
179  paths=["Expert/Outputs/"+pathFromKey(containerKey,"")+"/detail","Shifter/Outputs/"+pathFromKey(containerKey,"")],
180  xbins=1,xmin=0,xmax=10,
181  ybins=64*50,ymin=0.5,ymax=64*50+0.5,opt=['kAddBinsDynamically'])
182 
183  helper.defineHistogram('TOBshelfNumber;h_TOBshelfNumber', title=tobStr+' EM Shelf Number'+cut_title_addition,
184  fillGroup=fillGroup,
185  type='TH1F', path=trigPath+pathFromKey(containerKey)+cut_name, xbins=2,xmin=0,xmax=2)
186 
187  helper.defineHistogram('TOBeFEXNumberSh0;h_TOBeFEXNumberShelf0', title=tobStr+' EM Module Number Shelf 0'+cut_title_addition,
188  fillGroup=fillGroup,
189  type='TH1F', path=trigPath+pathFromKey(containerKey)+cut_name, xbins=12,xmin=0,xmax=12)
190 
191  helper.defineHistogram('TOBeFEXNumberSh1;h_TOBeFEXNumberShelf1', title=tobStr+' EM Module Number Shelf 1'+cut_title_addition,
192  fillGroup=fillGroup,
193  type='TH1F', path=trigPath+pathFromKey(containerKey)+cut_name, xbins=12,xmin=0,xmax=12)
194 
195  helper.defineHistogram('TOBfpga;h_TOBfpga', title=tobStr+' EM FPGA'+cut_title_addition,
196  fillGroup=fillGroup,
197  type='TH1F', path=trigPath+pathFromKey(containerKey)+cut_name, xbins=4,xmin=0,xmax=4)
198 
199  helper.defineHistogram('TOBReta;h_TOBReta', title=tobStr+' EM Reta'+cut_title_addition,
200  fillGroup=fillGroup,
201  type='TH1F', path=trigPath+pathFromKey(containerKey)+cut_name,xbins=250,xmin=0,xmax=1)
202 
203  helper.defineHistogram('TOBRhad;h_TOBRhad', title=tobStr+' EM Rhad'+cut_title_addition,
204  fillGroup=fillGroup,
205  type='TH1F', path=trigPath+pathFromKey(containerKey)+cut_name, xbins=250,xmin=0,xmax=1)
206 
207  helper.defineHistogram('TOBWstot;h_TOBWstot', title=tobStr+' EM Wstot'+cut_title_addition,
208  fillGroup=fillGroup,
209  type='TH1F', path=trigPath+pathFromKey(containerKey)+cut_name, xbins=250,xmin=0,xmax=1)
210 
211  threshold_labels = ['fail','loose','medium','tight']
212  helper.defineHistogram('TOBReta_threshold;h_TOBReta_threshold', title=tobStr+' EM Reta threshold'+cut_title_addition,
213  fillGroup=fillGroup,
214  type='TH1F', path=trigPath+pathFromKey(containerKey)+cut_name,xbins=4,xmin=0,xmax=4.0,xlabels=threshold_labels)
215 
216  helper.defineHistogram('TOBRhad_threshold;h_TOBRhad_threshold', title=tobStr+' EM Rhad threshold'+cut_title_addition,
217  fillGroup=fillGroup,
218  type='TH1F', path=trigPath+pathFromKey(containerKey)+cut_name, xbins=4,xmin=0,xmax=4.0,xlabels=threshold_labels)
219 
220  helper.defineHistogram('TOBWstot_threshold;h_TOBWstot_threshold', title=tobStr+' EM Wstot threshold'+cut_title_addition,
221  fillGroup=fillGroup,
222  type='TH1F', path=trigPath+pathFromKey(containerKey)+cut_name, xbins=4,xmin=0,xmax=4.0,xlabels=threshold_labels)
223 
224  # Now Tau
225  for containerKey in EfexMonAlg.eFexTauTobKeyList:
226  fillGroup = baseGroupName+'_'+containerKey+'_'+cut_name
227  tobStr = containerKey
228  # plotting of eTau variables
229  helper.defineHistogram('nTauTOBs;h_nTauTOBs', title='Number of '+tobStr+'s'+cut_title_addition+';Tau '+tobStr+'s;Number of Tau '+tobStr+'s',
230  fillGroup = fillGroup,
231  type='TH1I', path=trigPath+pathFromKey(containerKey)+cut_name, xbins=10,xmin=0,xmax=10)
232 
233  helper.defineHistogram('tauTOBTransverseEnergy;h_tauTOBTransverseEnergy', title=tobStr+' Tau Transverse Energy [MeV]'+cut_title_addition,
234  fillGroup = fillGroup,
235  type='TH1F', path=trigPath+pathFromKey(containerKey)+cut_name, xbins=100,xmin=0,xmax=50000)
236 
237  helper.defineHistogram('tauTOBEta;h_tauTOBEta', title=tobStr+' Tau Eta'+cut_title_addition,
238  fillGroup = fillGroup,
239  type='TH1F', path=trigPath+pathFromKey(containerKey)+cut_name, xbins=60,xmin=-2.5,xmax=2.5)
240 
241  helper.defineHistogram('tauTOBPhi;h_tauTOBPhi', title=tobStr+' Tau Phi'+cut_title_addition,
242  fillGroup = fillGroup,
243  type='TH1F', path=trigPath+pathFromKey(containerKey)+cut_name, xbins=100,xmin=-math.pi,xmax=math.pi)
244 
245  helper.defineHistogram(f"tauTOBEta,tauTOBPhi;h_{containerKey}_{cut_name}_EtaPhiMap", title='eTAU '+tobStr+' Count'+cut_title_addition+';#eta;#phi',
246  fillGroup = fillGroup,
247  hanConfig={"display":"SetPalette(55)",
248  "description":f"Inspect for hot/cold spots - check help for list of known hot/coldspots, then check <a href='./detail/h_{containerKey}_{cut_name}_posVsLBN'>detail timeseries</a>. Warning if any deadspots/empty, but could just be low stats","algorithm":"Efex_eTAU_etaThiMapFilled"},
249  type='TH2F',
250  path=(("Expert/Outputs/"+pathFromKey(containerKey,"")) if "Sim" not in containerKey and "x" not in containerKey else (trigPath+pathFromKey(containerKey)+cut_name)),
251  xbins=50,xmin=-2.5,xmax=2.5,ybins=64,ymin=-math.pi,ymax=math.pi,opt=['kAlwaysCreate'])
252 
253  if "Sim" not in containerKey and "x" not in containerKey:
254  helper.defineHistogram(f"LBN,binNumber;h_{containerKey}_{cut_name}_posVsLBN", title='eTAU '+tobStr+' Count'+cut_title_addition+';LB;64(x-1)+y',
255  fillGroup=fillGroup,
256  hanConfig={"Expert/algorithm":f"Efex_{pathFromKey(containerKey,'')}_etaPhiLBMapOutliers","Shifter/algorithm":f"Efex_{pathFromKey(containerKey,'')}_etaPhiLBMapOutliers_Shifter",
257  "description":f"Timeseries of TOB counts at each location ... y-axis relates to x and y bin numbers from <a href='../h_{containerKey}_{cut_name}_EtaPhiMap'>eta-phi map</a>. Use Projection X1 for 1D plot"},
258  type='TH2I',
259  paths=["Expert/Outputs/"+pathFromKey(containerKey,"")+"/detail","Shifter/Outputs/"+pathFromKey(containerKey,"")],
260  xbins=1,xmin=0,xmax=10,
261  ybins=64*50,ymin=0.5,ymax=64*50+0.5,opt=['kAddBinsDynamically'])
262 
263  helper.defineHistogram('tauTOBshelfNumber;h_tauTOBshelfNumber', title=tobStr+' Tau Shelf Number'+cut_title_addition,
264  fillGroup = fillGroup,
265  type='TH1F', path=trigPath+pathFromKey(containerKey)+cut_name, xbins=2,xmin=0,xmax=2)
266 
267  helper.defineHistogram('tauTOBeFEXNumberSh0;h_tauTOBeFEXNumberShelf0', title=tobStr+' Tau Module Number Shelf 0'+cut_title_addition,
268  fillGroup = fillGroup,
269  type='TH1F', path=trigPath+pathFromKey(containerKey)+cut_name, xbins=12,xmin=0,xmax=12)
270 
271  helper.defineHistogram('tauTOBeFEXNumberSh1;h_tauTOBeFEXNumberShelf1', title=tobStr+' Tau Module Number Shelf 1'+cut_title_addition,
272  fillGroup = fillGroup,
273  type='TH1F', path=trigPath+pathFromKey(containerKey)+cut_name, xbins=12,xmin=0,xmax=12)
274 
275 
276  helper.defineHistogram('tauTOBfpga;h_tauTOBfpga', title=tobStr+' Tau FPGA'+cut_title_addition,
277  fillGroup = fillGroup,
278  type='TH1F', path=trigPath+pathFromKey(containerKey)+cut_name, xbins=4,xmin=0,xmax=4)
279 
280  helper.defineHistogram('tauTOBRcore;h_tauTOBRcore', title=tobStr+' Tau rCore'+cut_title_addition,
281  fillGroup = fillGroup,
282  type='TH1F', path=trigPath+pathFromKey(containerKey)+cut_name, xbins=250,xmin=0,xmax=1)
283 
284  helper.defineHistogram('tauTOBRhad;h_tauTOBRhad', title=tobStr+' Tau rHad'+cut_title_addition,
285  fillGroup = fillGroup,
286  type='TH1F', path=trigPath+pathFromKey(containerKey)+cut_name, xbins=250,xmin=0,xmax=1)
287 
288  helper.defineHistogram('tauTOBRcore_threshold;h_tauTOBRcore_threshold', title=tobStr+' Tau rCore threshold'+cut_title_addition,
289  fillGroup = fillGroup,
290  type='TH1F', path=trigPath+pathFromKey(containerKey)+cut_name, xbins=4,xmin=0,xmax=4.0, xlabels=threshold_labels)
291 
292  helper.defineHistogram('tauTOBRhad_threshold;h_tauTOBRhad_threshold', title=tobStr+' Tau rHad threshold'+cut_title_addition,
293  fillGroup = fillGroup,
294  type='TH1F', path=trigPath+pathFromKey(containerKey)+cut_name, xbins=4,xmin=0,xmax=4.0, xlabels=threshold_labels)
295 
296  helper.defineHistogram('tauTOBthree_threshold;h_tauTOBthree_threshold', title=tobStr+' Tau 3 taus threshold'+cut_title_addition,
297  fillGroup = fillGroup,
298  type='TH1F', path=trigPath+pathFromKey(containerKey)+cut_name, xbins=4,xmin=0,xmax=4.0, xlabels=threshold_labels)
299 
300  acc = helper.result()
301  result.merge(acc)
302  return result
303 
304 
EfexMonitorAlgorithm.EfexMonitoringHistConfig
def EfexMonitoringHistConfig(flags, eFexAlg)
Definition: EfexMonitorAlgorithm.py:24
python.JetAnalysisCommon.ComponentAccumulator
ComponentAccumulator
Definition: JetAnalysisCommon.py:302
plotBeamSpotVxVal.range
range
Definition: plotBeamSpotVxVal.py:195
histSizes.list
def list(name, path='/')
Definition: histSizes.py:38
str
Definition: BTagTrackIpAccessor.cxx:11
EfexMonitorAlgorithm.EfexMonitoringConfig
def EfexMonitoringConfig(inputFlags)
Definition: EfexMonitorAlgorithm.py:4