From e1a4f9168899def1d6a22e38056c81191120ddcd Mon Sep 17 00:00:00 2001
From: Iskander Ibragimov <iskander.ibragimov@cern.ch>
Date: Mon, 21 Jun 2021 13:23:51 +0200
Subject: [PATCH 1/2] fixing range of kLive histos

---
 .../python/PixelAthClusterMonAlgCfg.py           |  2 +-
 .../python/PixelAthMonitoringBase.py             | 16 ++++++++++++----
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/python/PixelAthClusterMonAlgCfg.py b/InnerDetector/InDetMonitoring/PixelMonitoring/python/PixelAthClusterMonAlgCfg.py
index bb8e93d6fa6b..ed5956f1b171 100644
--- a/InnerDetector/InDetMonitoring/PixelMonitoring/python/PixelAthClusterMonAlgCfg.py
+++ b/InnerDetector/InDetMonitoring/PixelMonitoring/python/PixelAthClusterMonAlgCfg.py
@@ -153,7 +153,7 @@ def PixelAthClusterMonAlgCfg(helper, alg, **kwargs):
         varName += ';NPixHitsPerTrackPerLumiLast100LB'
         trackGroup.defineHistogram(varName,
                                 type='TH2F', path=path, title=title, weight='npixhits_per_track_wgt',
-                                xbins=lumibinsx, xmin=-0.5, xmax=-0.5+lumibinsx,
+                                xbins=100, xmin=-0.5, xmax=-0.5+100,
                                 ybins=10, ymin=-0.5, ymax=9.5, opt='kLive=100')
         if forceOnline: athenaCommonFlags.isOnline = False
 
diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/python/PixelAthMonitoringBase.py b/InnerDetector/InDetMonitoring/PixelMonitoring/python/PixelAthMonitoringBase.py
index 7bd23b7cf195..8cab5cb2cccf 100644
--- a/InnerDetector/InDetMonitoring/PixelMonitoring/python/PixelAthMonitoringBase.py
+++ b/InnerDetector/InDetMonitoring/PixelMonitoring/python/PixelAthMonitoringBase.py
@@ -416,6 +416,10 @@ def define1DProfLumiLayers(helper, alg, name, title, path, yaxistext, type='TPro
     assert(set(onlylayers).issubset(layers))
     if histname is None:
         histname = name
+    if "kLive" in opt:
+        xbins = int(opt.split('=')[1])
+    else:
+        xbins = lumibinsx
     for layer in layers:
         if layer not in onlylayers: 
             continue
@@ -426,7 +430,7 @@ def define1DProfLumiLayers(helper, alg, name, title, path, yaxistext, type='TPro
         fullvarstring += ';' + histname + '_{0}'.format(layer)
         layerGroup.defineHistogram(fullvarstring, 
                                     type=type, path=path, title=fulltitle,
-                                    xbins=lumibinsx, xmin=-0.5, xmax=-0.5+lumibinsx, opt=opt)
+                                    xbins=xbins, xmin=-0.5, xmax=-0.5+xbins, opt=opt)
 
 def defineMapVsLumiLayers(helper, alg, name, title, path, xaxistext, yaxistext, ybins, ymins, binsizes=[1.0], ylabels=None, opt='', type='TH2F', histname=None, onlylayers=layers):
     '''
@@ -448,6 +452,10 @@ def defineMapVsLumiLayers(helper, alg, name, title, path, xaxistext, yaxistext,
     assert(set(onlylayers).issubset(layers))
     if histname is None:
         histname = name
+    if "kLive" in opt:
+        xbins = int(opt.split('=')[1])
+    else:
+        xbins = lumibinsx
     for idx,layer in enumerate(layers):
         if layer not in onlylayers: 
             continue
@@ -460,17 +468,17 @@ def defineMapVsLumiLayers(helper, alg, name, title, path, xaxistext, yaxistext,
         if ( len(ybins)==1 and len(ymins)==1 and len(binsizes)==1):
             layerGroup.defineHistogram(fullvarstring, 
                                        type=type, path=path, title=fulltitle,
-                                       xbins=lumibinsx, xmin=-0.5, xmax=-0.5+lumibinsx,
+                                       xbins=xbins, xmin=-0.5, xmax=-0.5+xbins,
                                        ybins=ybins[0], ymin=ymins[0], ymax=ymins[0]+binsizes[0]*ybins[0], opt=opt)
         elif (len(ybins)==len(layers) and len(ymins)==len(layers) and len(binsizes)==len(layers) and len(ylabels)==len(layers)):
             layerGroup.defineHistogram(fullvarstring, 
                                        type=type, path=path, title=fulltitle,
-                                       xbins=lumibinsx, xmin=-0.5, xmax=-0.5+lumibinsx,
+                                       xbins=xbins, xmin=-0.5, xmax=-0.5+xbins,
                                        ybins=ybins[idx], ymin=ymins[idx], ymax=ymins[idx]+binsizes[idx]*ybins[idx], ylabels=ylabels[idx], opt=opt)
         elif (len(ybins)==len(layers) and len(ymins)==len(layers) and len(binsizes)==1 and ylabels is None):
             layerGroup.defineHistogram(fullvarstring, 
                                        type=type, path=path, title=fulltitle,
-                                       xbins=lumibinsx, xmin=-0.5, xmax=-0.5+lumibinsx,
+                                       xbins=xbins, xmin=-0.5, xmax=-0.5+xbins,
                                        ybins=ybins[idx], ymin=ymins[idx], ymax=ymins[idx]+ybins[idx], opt=opt)
 
 
-- 
GitLab


From ffe889fdfb36df1bf4c634f74f5aac79e83bc051 Mon Sep 17 00:00:00 2001
From: Iskander Ibragimov <iskander.ibragimov@cern.ch>
Date: Mon, 21 Jun 2021 14:26:50 +0200
Subject: [PATCH 2/2] don't book TSOS histos when online

---
 .../python/PixelAthClusterMonAlgCfg.py        | 21 ++++++++++---------
 .../python/PixelAthMonitoringBase.py          |  2 +-
 2 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/python/PixelAthClusterMonAlgCfg.py b/InnerDetector/InDetMonitoring/PixelMonitoring/python/PixelAthClusterMonAlgCfg.py
index ed5956f1b171..6011099b331b 100644
--- a/InnerDetector/InDetMonitoring/PixelMonitoring/python/PixelAthClusterMonAlgCfg.py
+++ b/InnerDetector/InDetMonitoring/PixelMonitoring/python/PixelAthClusterMonAlgCfg.py
@@ -64,18 +64,19 @@ def PixelAthClusterMonAlgCfg(helper, alg, **kwargs):
 ### begin track histograms
     path        = '/Pixel/TrackOnTrack/'
     pathLowStat = '/Pixel/LumiBlockOnTrack/'
+    
+    if not doOnline:
+        histoGroupName = 'TSOSMeasurement' 
+        title = 'TSOS of type Measurement'
+        define2DProfHist(helper, alg, histoGroupName, title, path, type='TH2F')
 
-    histoGroupName = 'TSOSMeasurement' 
-    title = 'TSOS of type Measurement'
-    define2DProfHist(helper, alg, histoGroupName, title, path, type='TH2F')
-
-    histoGroupName = 'TSOSHole' 
-    title = 'TSOS of type Hole'
-    define2DProfHist(helper, alg, histoGroupName, title, path, type='TH2F')
+        histoGroupName = 'TSOSHole' 
+        title = 'TSOS of type Hole'
+        define2DProfHist(helper, alg, histoGroupName, title, path, type='TH2F')
 
-    histoGroupName = 'TSOSOutlier' 
-    title = 'TSOS of type Outlier'
-    define2DProfHist(helper, alg, histoGroupName, title, path, type='TH2F')
+        histoGroupName = 'TSOSOutlier' 
+        title = 'TSOS of type Outlier'
+        define2DProfHist(helper, alg, histoGroupName, title, path, type='TH2F')
 
     histoGroupName = 'HitEffAll'
     title          = 'hit efficiency'
diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/python/PixelAthMonitoringBase.py b/InnerDetector/InDetMonitoring/PixelMonitoring/python/PixelAthMonitoringBase.py
index 8cab5cb2cccf..f80d6c594a31 100644
--- a/InnerDetector/InDetMonitoring/PixelMonitoring/python/PixelAthMonitoringBase.py
+++ b/InnerDetector/InDetMonitoring/PixelMonitoring/python/PixelAthMonitoringBase.py
@@ -1,5 +1,5 @@
 #
-#  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+#  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
 #
 
 '''
-- 
GitLab