ATLAS Offline Software
PixelAthMVAMonAlgCfg.py
Go to the documentation of this file.
1 #
2 # Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 #
4 
5 '''
6 @file PixelAthMVAMonAlgCfg.py
7 @brief Configuration of Pixel MVA Monitoring Histograms for Run 3
8 '''
9 
10 from PixelMonitoring.PixelAthMonitoringBase import define2DProfHist, ModulesHead
11 from PixelMonitoring.PixelAthMonitoringBase import LabelX, LabelY, baselayers, lumibinsx
12 
13 def PixelAthMVAMonAlgCfg(helper, alg, **kwargs):
14  '''
15  Arguments:
16  helper -- AthMonitorCfgHelper(Old) instance
17  alg -- algorithm Configurable object returned from addAlgorithm
18  kwargs -- jo agruments
19  '''
20 
21  dumpTree = kwargs.get('dumpTree', False)
22  path = '/Pixel/MVA/'
23 
24  if dumpTree:
25  mvaGroup = helper.addGroup(alg, 'MVA')
26  mvaGroup.defineTree('pixmvamontool_lb,status_vec,\
27 holes_vec,outliers_vec,meas_vec,\
28 clsontrkf_vec,clsontrk_vec,clsofftrk_vec,clsall_vec,\
29 clsontrksize_vec,clsontrkrowsize_vec,clsontrkcolsize_vec,\
30 clsofftrksize_vec,clsofftrkrowsize_vec,clsofftrkcolsize_vec,\
31 trkalpha_vec,trkchi2byndf_vec,trknpixdead_vec,trknblayerhits_vec,\
32 clsontrktot_vec,clsofftrktot_vec,mva_vec;\
33 vartree', path=path, treedef='pixmvamontool_lb/i:status_vec/vector<float>\
34 :h_vec/vector<float>:o_vec/vector<float>:m_vec/vector<float>\
35 :clsontrkf_vec/vector<float>:clsontrk_vec/vector<float>:clsofftrk_vec/vector<float>:clsall_vec/vector<float>\
36 :clsontrksize_vec/vector<float>:clsontrkrowsize_vec/vector<float>:clsontrkcolsize_vec/vector<float>\
37 :clsofftrksize_vec/vector<float>:clsofftrkrowsize_vec/vector<float>:clsofftrkcolsize_vec/vector<float>\
38 :trkalpha_vec/vector<float>:trkchi2byndf_vec/vector<float>\
39 :trknpixdead_vec/vector<float>:trknblayerhits_vec/vector<float>\
40 :clsontrktot_vec/vector<float>:clsofftrktot_vec/vector<float>:mva_vec/vector<float>')
41 
42  histoGroupName = 'BDTWeights'
43  title = 'BDT score'
44  define2DProfHist(helper, alg, histoGroupName, title, path, type='TProfile2D')
45 
46  histoGroupName = 'BDTWeightsReset'
47  title = 'BDT score reset every 10 LB'
48  define2DProfHist(helper, alg, 'BDTWeights', title, path, type='TProfile2D', opt='kLBNHistoryDepth=10', histname=histoGroupName)
49 
50  xbins = lumibinsx
51  fullvarstring = 'pixmvamontool_lb, BDTWeights_val' #re-use monitoring variables
52  modArray = []
53  for i, layer in enumerate(baselayers):
54  hnames = []
55  for ix, x in enumerate(LabelX[i]):
56  for y in LabelY[i]:
57  hname = ModulesHead[i]
58  if 'Disk' in x:
59  hname += str(ix+1)
60  hname+= '_' + y
61  if i==0:
62  hname += 'A'
63  else:
64  hname += 'C'
65  elif layer=='IBL':
66  #A1_0 -> S0_M1A
67  newx = 'S'+ x[3] + x[2] + 'M' + x[1] + x[0]
68  #S14 -> B14
69  newy = 'B'+ y[1:]
70  hname += '_' + newy + '_' + newx
71  else:
72  hname += '_' + y + '_' + x
73  hnames.append(hname)
74  modArray.append(helper.addArray([len(hnames)], alg, layer, path+'Modules/'))
75  for postfix, tool in modArray[i].Tools.items():
76  hname_idx = int( postfix.split('_').pop() )
77  hname = hnames[hname_idx]
78  tool.defineHistogram(fullvarstring + ';' + hname, type='TProfile', path=layer,
79  title='BDT score per LB ' + hname + ';lumi block;<BDT score>',
80  xbins=xbins, xmin=-0.5, xmax=-0.5+xbins)
81 '''
82 This function configures 1D (Profile) vs lumi histograms for Pixel(IBL) modules(FEs).
83 '''
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
PixelAthMVAMonAlgCfg.PixelAthMVAMonAlgCfg
def PixelAthMVAMonAlgCfg(helper, alg, **kwargs)
Definition: PixelAthMVAMonAlgCfg.py:13
PixelAthMonitoringBase.define2DProfHist
def define2DProfHist(helper, alg, name, title, path, type='TProfile2D', doWeight=False, lifecycle='run', zmin=None, zmax=None, opt='', histname=None, onlylayers=baselayers)
Definition: PixelAthMonitoringBase.py:276
str
Definition: BTagTrackIpAccessor.cxx:11