ATLAS Offline Software
Functions
EfexMonitorAlgorithm Namespace Reference

Functions

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

Function Documentation

◆ EfexMonitoringConfig()

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

Definition at line 4 of file EfexMonitorAlgorithm.py.

4 def EfexMonitoringConfig(inputFlags):
5  '''Function to configure LVL1 Efex algorithm in the monitoring system.'''
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  # uncomment if you want to see all the flags
13  #inputFlags.dump() # print all the configs
14 
15  # make the athena monitoring helper
16  from AthenaMonitoring import AthMonitorCfgHelper
17  helper = AthMonitorCfgHelper(inputFlags,'EfexMonitoringCfg')
18 
19  # add algorithm to the helper
20  EfexMonAlg = helper.addAlgorithm(CompFactory.EfexMonitorAlgorithm,'EfexMonAlg')
21 
22  # add any steering
23  baseGroupName = 'EfexMonitor' # the monitoring group name is also used for the package name
24  EfexMonAlg.PackageName = baseGroupName
25  EfexMonAlg.LowPtCut = 0.0
26  EfexMonAlg.HiPtCut = 15000.0
27  EfexMonAlg.eFexEMTobKeyList = ['L1_eEMRoI', 'L1_eEMxRoI']
28  EfexMonAlg.eFexTauTobKeyList = ['L1_eTauRoI', 'L1_eTauxRoI']
29 
30  acc = helper.result()
31  result.merge(acc)
32  return result
33 
34 

◆ EfexMonitoringHistConfig()

def EfexMonitorAlgorithm.EfexMonitoringHistConfig (   flags,
  eFexAlg 
)
The histogram binning depends on the algorithm settings, configure separately

Definition at line 35 of file EfexMonitorAlgorithm.py.

35 def EfexMonitoringHistConfig(flags, eFexAlg):
36  """
37  The histogram binning depends on the algorithm settings, configure separately
38  """
39  import math
40  from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator
41  result = ComponentAccumulator()
42 
43 
44  # make the athena monitoring helper again so we can add groups
45  from TrigT1CaloMonitoring.LVL1CaloMonitoringConfig import L1CaloMonitorCfgHelper
46  helper = L1CaloMonitorCfgHelper(flags,None,'EfexMonitoringCfg')
47  helper.alg = eFexAlg
48 
49  # we don't add the algorithm again, use the supplied one
50  EfexMonAlg = eFexAlg
51  baseGroupName = EfexMonAlg.PackageName
52 
53  # Some helpful variables for declaring the histograms
54  # mainDir = 'L1Calo'
55  trigPath = 'Developer/Efex/' # Directory trigger path for output histos
56  # Map from the key name to the output directory substructure.
57 
58  def pathFromKey(key):
59  path=""
60  if "DAODSim" in key: path = "DAODSim/"
61  elif "Sim" in key: path = "Sim/"
62  if "_eEMx" in key: path += "eEMx"
63  elif "_eEM" in key: path += "eEM"
64  elif "_eTaux" in key: path += "eTAUx"
65  elif "_eTau" in key: path += "eTAU"
66  return path
67 
68  cut_names = ["LowPtCut", "HiPtCut"] # List of cut names, for looping over to separate out histograms into directories
69  cut_vals = [EfexMonAlg.LowPtCut, EfexMonAlg.HiPtCut] # List of values, for looping over to add to histogram titles
70 
71  # First, define the histograms with no Pt cut
72  # add monitoring algorithm to group, with group name and main directory
73 
74  locIdxs = []
75  for phiOct in range(0,8):
76  for etaIdx in range(-25,25):
77  locIdxs += [str(phiOct) + ":" + str(etaIdx)]
78 
79  for containerKey in (list(EfexMonAlg.eFexEMTobKeyList) + list(EfexMonAlg.eFexTauTobKeyList)):
80  helper.defineHistogram(containerKey + '_nTOBs_nocut;h_n'+containerKey+'_nocut', title='Number of '+containerKey+';Number of '+containerKey+';Events',
81  fillGroup = baseGroupName,
82  type='TH1I', xbins=100,xmin=-0.5,xmax=99.5)
83  if "Sim" not in containerKey:
84  # don't make these expensive plots for simulation
85  helper.defineHistogram("LBN,locIdx,tobEt;h_"+containerKey+"_et_posLbnMap", title = "Average " + containerKey + " ET;LB;Position (Octant:Eta)",
86  fillGroup = baseGroupName + "_" + containerKey,
87  path = ("Expert/Outputs/" if "x" not in containerKey else trigPath)+pathFromKey(containerKey),
88  hanConfig={"description":"Check for horizontal anomalies (hotspot/coldspot) or vertical anomalies (whole-system hot/cold)"},
89  type="TProfile2D",
90  xbins=1,xmin=0,xmax=1, ylabels=locIdxs, opt=['kAddBinsDynamically'])
91  helper.defineHistogram(f"LBN,{containerKey}_nTOBs_nocut;h_"+containerKey+"_nTOBs", title = "Average # of " + containerKey + " TOBs;LBN",
92  fillGroup = baseGroupName,
93  type="TH2I",
94  xbins=1,xmin=0,xmax=1,ybins=20,ymin=-0.5,ymax=19.5, opt=['kAddBinsDynamically'])
95 
96 
97  helper.defineDQAlgorithm("Efex_eEM_etaThiMapFilled",
98  hanConfig={"libname":"libdqm_summaries.so","name":"Bins_Equal_Threshold","BinThreshold":"0."},
99  thresholdConfig={"NBins":[1,64*50]}, # currently there is 1 known deadspot in eEM, so that is allowed, anything else is a warning. Error if fully empty
100  )
101  helper.defineDQAlgorithm("Efex_eTAU_etaThiMapFilled",
102  hanConfig={"libname":"libdqm_summaries.so","name":"Bins_Equal_Threshold","BinThreshold":"0."},
103  thresholdConfig={"NBins":[0,64*50]}, # everywhere should be filled, otherwise a warning (error if entirely empty)
104  )
105 
106  # Now define the histograms with low/hi Pt cut
107  for cut_name, cut_val in zip(cut_names, cut_vals):
108  cut_title_addition = '' if (cut_val == 0.0) else ' [Et>=' + '%.1f'%(cut_val/1000) + 'GeV]'
109  # Em first
110  for containerKey in EfexMonAlg.eFexEMTobKeyList:
111  fillGroup = baseGroupName+'_'+containerKey+'_'+cut_name
112  tobTypeStr = "xTOB" if ('xRoI' in containerKey) else "TOB"
113  simStr = "Sim" if ('Sim' in containerKey) else ""
114  tobStr = tobTypeStr + simStr
115  # histograms of eEM variables
116  helper.defineHistogram('nEMTOBs;h_nEmTOBs', title='Number of eFex EM '+tobStr+'s'+cut_title_addition+';EM '+tobStr+'s;Number of EM '+tobStr+'s',
117  fillGroup=fillGroup,
118  type='TH1I', path=trigPath+pathFromKey(containerKey)+cut_name, xbins=10,xmin=0,xmax=10)
119 
120  helper.defineHistogram('TOBTransverseEnergy;h_TOBTransverseEnergy', title='eFex '+tobStr+' EM Transverse Energy [MeV]'+cut_title_addition,
121  fillGroup=fillGroup,
122  type='TH1F', path=trigPath+pathFromKey(containerKey)+cut_name, xbins=100,xmin=0,xmax=50000)
123 
124  helper.defineHistogram('TOBEta;h_TOBEta', title='eFex '+tobStr+' EM Eta'+cut_title_addition,
125  fillGroup=fillGroup,
126  type='TH1F', path=trigPath+pathFromKey(containerKey)+cut_name, xbins=50,xmin=-2.5,xmax=2.5)
127 
128  helper.defineHistogram('TOBPhi;h_TOBPhi', title='eFex '+tobStr+' EM Phi'+cut_title_addition,
129  fillGroup=fillGroup,
130  type='TH1F', path=trigPath+pathFromKey(containerKey)+cut_name, xbins=64,xmin=-math.pi,xmax=math.pi)
131 
132  helper.defineHistogram(f"TOBEta,TOBPhi;h_{containerKey}_{cut_name}_EtaPhiMap", title='eEM '+tobStr+' Count'+cut_title_addition+';#eta;#phi',
133  fillGroup=fillGroup,
134  hanConfig={"display":"SetPalette(55)",
135  "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"},
136  type='TH2F',
137  path=(("Expert/Outputs/"+pathFromKey(containerKey)) if "Sim" not in containerKey and "x" not in containerKey else trigPath+pathFromKey(containerKey)+cut_name),
138  xbins=50,xmin=-2.5,xmax=2.5,ybins=64,ymin=-math.pi,ymax=math.pi,opt=['kAlwaysCreate'])
139 
140  if "Sim" not in containerKey and "x" not in containerKey:
141  helper.defineHistogram(f"LBN,binNumber;h_{containerKey}_{cut_name}_posVsLBN", title='eEM '+tobStr+' Count'+cut_title_addition+';LB;50(y-1)+x',
142  fillGroup=fillGroup,
143  hanConfig={"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"},
144  type='TH2I',
145  path="Expert/Outputs/"+pathFromKey(containerKey)+"/detail",
146  xbins=1,xmin=0,xmax=10,
147  ybins=64*50,ymin=0.5,ymax=64*50+0.5,opt=['kAddBinsDynamically'])
148 
149  helper.defineHistogram('TOBshelfNumber;h_TOBshelfNumber', title='eFex '+tobStr+' EM Shelf Number'+cut_title_addition,
150  fillGroup=fillGroup,
151  type='TH1F', path=trigPath+pathFromKey(containerKey)+cut_name, xbins=2,xmin=0,xmax=2)
152 
153  helper.defineHistogram('TOBeFEXNumberSh0;h_TOBeFEXNumberShelf0', title='eFex '+tobStr+' EM Module Number Shelf 0'+cut_title_addition,
154  fillGroup=fillGroup,
155  type='TH1F', path=trigPath+pathFromKey(containerKey)+cut_name, xbins=12,xmin=0,xmax=12)
156 
157  helper.defineHistogram('TOBeFEXNumberSh1;h_TOBeFEXNumberShelf1', title='eFex '+tobStr+' EM Module Number Shelf 1'+cut_title_addition,
158  fillGroup=fillGroup,
159  type='TH1F', path=trigPath+pathFromKey(containerKey)+cut_name, xbins=12,xmin=0,xmax=12)
160 
161  helper.defineHistogram('TOBfpga;h_TOBfpga', title='eFex '+tobStr+' EM FPGA'+cut_title_addition,
162  fillGroup=fillGroup,
163  type='TH1F', path=trigPath+pathFromKey(containerKey)+cut_name, xbins=4,xmin=0,xmax=4)
164 
165  helper.defineHistogram('TOBReta;h_TOBReta', title='eFex '+tobStr+' EM Reta'+cut_title_addition,
166  fillGroup=fillGroup,
167  type='TH1F', path=trigPath+pathFromKey(containerKey)+cut_name,xbins=250,xmin=0,xmax=1)
168 
169  helper.defineHistogram('TOBRhad;h_TOBRhad', title='eFex '+tobStr+' EM Rhad'+cut_title_addition,
170  fillGroup=fillGroup,
171  type='TH1F', path=trigPath+pathFromKey(containerKey)+cut_name, xbins=250,xmin=0,xmax=1)
172 
173  helper.defineHistogram('TOBWstot;h_TOBWstot', title='eFex '+tobStr+' EM Wstot'+cut_title_addition,
174  fillGroup=fillGroup,
175  type='TH1F', path=trigPath+pathFromKey(containerKey)+cut_name, xbins=250,xmin=0,xmax=1)
176 
177  threshold_labels = ['fail','loose','medium','tight']
178  helper.defineHistogram('TOBReta_threshold;h_TOBReta_threshold', title='eFex '+tobStr+' EM Reta threshold'+cut_title_addition,
179  fillGroup=fillGroup,
180  type='TH1F', path=trigPath+pathFromKey(containerKey)+cut_name,xbins=4,xmin=0,xmax=4.0,xlabels=threshold_labels)
181 
182  helper.defineHistogram('TOBRhad_threshold;h_TOBRhad_threshold', title='eFex '+tobStr+' EM Rhad threshold'+cut_title_addition,
183  fillGroup=fillGroup,
184  type='TH1F', path=trigPath+pathFromKey(containerKey)+cut_name, xbins=4,xmin=0,xmax=4.0,xlabels=threshold_labels)
185 
186  helper.defineHistogram('TOBWstot_threshold;h_TOBWstot_threshold', title='eFex '+tobStr+' EM Wstot threshold'+cut_title_addition,
187  fillGroup=fillGroup,
188  type='TH1F', path=trigPath+pathFromKey(containerKey)+cut_name, xbins=4,xmin=0,xmax=4.0,xlabels=threshold_labels)
189 
190  # Now Tau
191  for containerKey in EfexMonAlg.eFexTauTobKeyList:
192  fillGroup = baseGroupName+'_'+containerKey+'_'+cut_name
193  tobTypeStr = "xTOB" if ('xRoI' in containerKey) else "TOB"
194  simStr = "Sim" if ('Sim' in containerKey) else ""
195  tobStr = tobTypeStr + simStr
196  # plotting of eTau variables
197  helper.defineHistogram('nTauTOBs;h_nTauTOBs', title='Number of eFex Tau '+tobStr+'s'+cut_title_addition+';Tau '+tobStr+'s;Number of Tau '+tobStr+'s',
198  fillGroup = fillGroup,
199  type='TH1I', path=trigPath+pathFromKey(containerKey)+cut_name, xbins=10,xmin=0,xmax=10)
200 
201  helper.defineHistogram('tauTOBTransverseEnergy;h_tauTOBTransverseEnergy', title='eFex '+tobStr+' Tau Transverse Energy [MeV]'+cut_title_addition,
202  fillGroup = fillGroup,
203  type='TH1F', path=trigPath+pathFromKey(containerKey)+cut_name, xbins=100,xmin=0,xmax=50000)
204 
205  helper.defineHistogram('tauTOBEta;h_tauTOBEta', title='eFex '+tobStr+' Tau Eta'+cut_title_addition,
206  fillGroup = fillGroup,
207  type='TH1F', path=trigPath+pathFromKey(containerKey)+cut_name, xbins=60,xmin=-2.5,xmax=2.5)
208 
209  helper.defineHistogram('tauTOBPhi;h_tauTOBPhi', title='eFex '+tobStr+' Tau Phi'+cut_title_addition,
210  fillGroup = fillGroup,
211  type='TH1F', path=trigPath+pathFromKey(containerKey)+cut_name, xbins=100,xmin=-math.pi,xmax=math.pi)
212 
213  helper.defineHistogram(f"tauTOBEta,tauTOBPhi;h_{containerKey}_{cut_name}_EtaPhiMap", title='eTAU '+tobStr+' Count'+cut_title_addition+';#eta;#phi',
214  fillGroup = fillGroup,
215  hanConfig={"display":"SetPalette(55)",
216  "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"},
217  type='TH2F',
218  path=(("Expert/Outputs/"+pathFromKey(containerKey)) if "Sim" not in containerKey and "x" not in containerKey else (trigPath+pathFromKey(containerKey)+cut_name)),
219  xbins=50,xmin=-2.5,xmax=2.5,ybins=64,ymin=-math.pi,ymax=math.pi,opt=['kAlwaysCreate'])
220 
221  if "Sim" not in containerKey and "x" not in containerKey:
222  helper.defineHistogram(f"LBN,binNumber;h_{containerKey}_{cut_name}_posVsLBN", title='eTAU '+tobStr+' Count'+cut_title_addition+';LB;50(y-1)+x',
223  fillGroup=fillGroup,
224  hanConfig={"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"},
225  type='TH2I',
226  path="Expert/Outputs/"+pathFromKey(containerKey)+"/detail",
227  xbins=1,xmin=0,xmax=10,
228  ybins=64*50,ymin=0.5,ymax=64*50+0.5,opt=['kAddBinsDynamically'])
229 
230  helper.defineHistogram('tauTOBshelfNumber;h_tauTOBshelfNumber', title='eFex '+tobStr+' Tau Shelf Number'+cut_title_addition,
231  fillGroup = fillGroup,
232  type='TH1F', path=trigPath+pathFromKey(containerKey)+cut_name, xbins=2,xmin=0,xmax=2)
233 
234  helper.defineHistogram('tauTOBeFEXNumberSh0;h_tauTOBeFEXNumberShelf0', title='eFex '+tobStr+' Tau Module Number Shelf 0'+cut_title_addition,
235  fillGroup = fillGroup,
236  type='TH1F', path=trigPath+pathFromKey(containerKey)+cut_name, xbins=12,xmin=0,xmax=12)
237 
238  helper.defineHistogram('tauTOBeFEXNumberSh1;h_tauTOBeFEXNumberShelf1', title='eFex '+tobStr+' Tau Module Number Shelf 1'+cut_title_addition,
239  fillGroup = fillGroup,
240  type='TH1F', path=trigPath+pathFromKey(containerKey)+cut_name, xbins=12,xmin=0,xmax=12)
241 
242 
243  helper.defineHistogram('tauTOBfpga;h_tauTOBfpga', title='eFex '+tobStr+' Tau FPGA'+cut_title_addition,
244  fillGroup = fillGroup,
245  type='TH1F', path=trigPath+pathFromKey(containerKey)+cut_name, xbins=4,xmin=0,xmax=4)
246 
247  helper.defineHistogram('tauTOBRcore;h_tauTOBRcore', title='eFex '+tobStr+' Tau rCore'+cut_title_addition,
248  fillGroup = fillGroup,
249  type='TH1F', path=trigPath+pathFromKey(containerKey)+cut_name, xbins=250,xmin=0,xmax=1)
250 
251  helper.defineHistogram('tauTOBRhad;h_tauTOBRhad', title='eFex '+tobStr+' Tau rHad'+cut_title_addition,
252  fillGroup = fillGroup,
253  type='TH1F', path=trigPath+pathFromKey(containerKey)+cut_name, xbins=250,xmin=0,xmax=1)
254 
255  helper.defineHistogram('tauTOBRcore_threshold;h_tauTOBRcore_threshold', title='eFex '+tobStr+' Tau rCore threshold'+cut_title_addition,
256  fillGroup = fillGroup,
257  type='TH1F', path=trigPath+pathFromKey(containerKey)+cut_name, xbins=4,xmin=0,xmax=4.0, xlabels=threshold_labels)
258 
259  helper.defineHistogram('tauTOBRhad_threshold;h_tauTOBRhad_threshold', title='eFex '+tobStr+' Tau rHad threshold'+cut_title_addition,
260  fillGroup = fillGroup,
261  type='TH1F', path=trigPath+pathFromKey(containerKey)+cut_name, xbins=4,xmin=0,xmax=4.0, xlabels=threshold_labels)
262 
263  helper.defineHistogram('tauTOBthree_threshold;h_tauTOBthree_threshold', title='eFex '+tobStr+' Tau 3 taus threshold'+cut_title_addition,
264  fillGroup = fillGroup,
265  type='TH1F', path=trigPath+pathFromKey(containerKey)+cut_name, xbins=4,xmin=0,xmax=4.0, xlabels=threshold_labels)
266 
267  acc = helper.result()
268  result.merge(acc)
269  return result
270 
271 
EfexMonitorAlgorithm.EfexMonitoringHistConfig
def EfexMonitoringHistConfig(flags, eFexAlg)
Definition: EfexMonitorAlgorithm.py:35
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