diff --git a/InnerDetector/InDetExample/InDetRecExample/share/InDetMonitoringPixel.py b/InnerDetector/InDetExample/InDetRecExample/share/InDetMonitoringPixel.py index 63a29b233a06b76c6166177e79d5d79528489a45..bbc188f2183bdc201d83b91f643624c97dec64f4 100644 --- a/InnerDetector/InDetExample/InDetRecExample/share/InDetMonitoringPixel.py +++ b/InnerDetector/InDetExample/InDetRecExample/share/InDetMonitoringPixel.py @@ -1,146 +1,92 @@ -# configure the pixel main monitoring tool -doAllHits = True -doHitsOnTrack = True +# +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# + +''' +@file InDetMonitoringPixel.py +@brief Top configuration of Pixel Monitoring in Run 3 style but in Run 2 environment +''' + +doHitMonTool = False +doClusterMonTool = True +doErrorMonTool = True + +from PixelMonitoring.PixelMonitoringConf import PixelAthHitMonTool +from PixelMonitoring.PixelAthHitMonToolCfg import PixelAthHitMonToolCfg + +from PixelMonitoring.PixelMonitoringConf import PixelAthClusterMonTool +from PixelMonitoring.PixelAthClusterMonToolCfg import PixelAthClusterMonToolCfg + +from PixelMonitoring.PixelMonitoringConf import PixelAthErrorMonTool +from PixelMonitoring.PixelAthErrorMonToolCfg import PixelAthErrorMonToolCfg -from PixelMonitoring.PixelMonitoringConf import PixelMainMon from InDetRecExample.InDetKeys import InDetKeys -if doAllHits: - doDCS = False - from AtlasGeoModel.CommonGMJobProperties import CommonGeometryFlags - if (globalflags.DataSource() == 'data' and ( CommonGeometryFlags.Run() in ["RUN2", "RUN3"] ) and conddb.dbdata == "CONDBR2"): - doDCS = True - InDetPixelMainsMon=PixelMainMon(name = "InDetPixelMonitoringAllHits", - onTrack = False, - - ##Flags for normal monitoring. This will run over all hits/clusters/etc, not just ones on track - doOffline = True, #Histograms for offline (tier0) running - doOnline = True if athenaCommonFlags.isOnline() else False, #Histograms for online (athenaPT) running - doHeavyIonMon = InDetFlags.doHeavyIon(), # Histogram modification for heavy ion monitoring - - do2DMaps = True, #Turn on/off the sets of 2D module maps - doModules = True if athenaCommonFlags.isOnline() else False, #Turn on/off the sets of 1744 module histograms (for dqmf) - doLowOccupancy = False, #Turn on/off histograms with binning for cosmics/single beam - doHighOccupancy = True, #Turn on/off histograms with binning for collisions - doDetails = False, #Turn on/off the set of histograms with detailed info for 4 modules - doPixelOccupancy = False, #Turn on/off histograms displaying pixel occupancy. VERY memory heavy! - doLumiBlock = False if athenaCommonFlags.isOnline() else True, #Turn on/off histograms stored for each lumi block - - doTiming = True, #Turn on/off histograms with BCID/timing information - doRDO = True, #Turn on/off histograms with RDO/Hit information - doErrors = True, #Turn on/off histograms with ROD Error information - doSpacePoint = True, #Turn on/off histograms with Spacepoint information - doCluster = True, #Turn on/off histograms with Cluster information - doTrack = False, #Turn on/off histograms with Track information - doStatus = True, #Turn on/off histograms with Module Status information - doDCS = doDCS, - RDOName = InDetKeys.PixelRDOs(), - RODErrorName = "pixel_error_summary", - SpacePointName = InDetKeys.PixelSpacePoints(), - ClusterName = InDetKeys.PixelClusters(), - DetailsMod1 = "D1A_B03_S2_M3", #Give the 4 modules which you want to do detailed monitoring of - DetailsMod2 = "L0_B05_S2_M1A", #Use the normal name like D1A_B03_S2_M4 or - DetailsMod3 = "L1_B10_S1_M2C", #L1_B10_S2_M2C and the code should be able to parse - DetailsMod4 = "D2C_B01_S1_M6") - - InDetPixelMainsMon.TrackName = InDetKeys.PixelTracks() if InDetFlags.doTrackSegmentsPixel() else InDetKeys.Tracks() - - ##Other parameters - - if jobproperties.Beam.beamType()=='collisions': - from AthenaMonitoring.FilledBunchFilterTool import GetFilledBunchFilterTool - InDetPixelMainsMon.FilterTools += [GetFilledBunchFilterTool()] - - #ToolSvc += InDetPixelMainsMon - if (InDetFlags.doPrintConfigurables()): - print InDetPixelMainsMon - -########################################################################## - -if doHitsOnTrack: - InDetPixelMainsMonOnTrack=PixelMainMon(name = "InDetPixelMonitoringOnTrack", - onTrack = True, - - ##Flags for data container types - doOffline = True, #Histograms for offline (tier0) running - doOnline = True if athenaCommonFlags.isOnline() else False, #Histograms for online (athenaPT) running - doHeavyIonMon = InDetFlags.doHeavyIon(), # Histogram modification for heavy ion monitoring - - do2DMaps = True , #Turn on/off the sets of 2D module maps - doModules = True if athenaCommonFlags.isOnline() else False, #Turn on/off the sets of 1744 module histograms (for dqmf) - doLowOccupancy = False, #Turn on/off histograms with binning for cosmics/single beam - doHighOccupancy = True, #Turn on/off histograms with binning for collisions - doDetails = False, #Turn on/off the set of histograms with detailed info for 4 modules - doPixelOccupancy = False, #Turn on/off histograms displaying pixel occupancy. VERY memory heavy! - doLumiBlock = False if athenaCommonFlags.isOnline() else True, #Turn on/off histograms stored for each lumi block - doHoleSearch = True, - doTiming = False, #Turn on/off histograms with BCID/timing information - doRDO = False, #Turn on/off histograms with RDO/Hit information - doErrors = False, #Turn on/off histograms with ROD Error information - doSpacePoint = True, #Turn on/off histograms with Spacepoint information - doCluster = True, #Turn on/off histograms with Cluster information - doTrack = True, #Turn on/off histograms with Track information - doStatus = True, #Turn on/off histograms with Module Status information - doDCS = False, - - ##Names of storegate containers - RDOName = InDetKeys.PixelRDOs(), - RODErrorName = "pixel_error_summary", - SpacePointName = InDetKeys.PixelSpacePoints(), - ClusterName = InDetKeys.PixelClusters(), - DetailsMod1 = "D1A_B03_S2_M3", #Give the 4 modules which you want to do detailed monitoring of - DetailsMod2 = "L0_B05_S2_M1A", #Use the normal name like D1A_B03_S2_M4 or - DetailsMod3 = "L1_B10_S1_M2C", #L1_B10_S2_M2C and the code should be able to parse - DetailsMod4 = "D2C_B01_S1_M6") - - InDetPixelMainsMonOnTrack.TrackName = InDetKeys.Tracks() - - ## Track Selection Criteria - # InDetTrackSelectionToolPixelMon = InDet__InDetTrackSelectionTool(name = "InDetTrackSelectionToolPixelMon", - # UseTrkTrackTools = True, - # CutLevel = "TightPrimary", - # minPt = 5000, - # TrackSummaryTool = InDetTrackSummaryTool, - # Extrapolator = InDetExtrapolator) - #ToolSvc += InDetTrackSelectionToolPixelMon - #InDetPixelMainsMonOnTrack.TrackSelectionTool = InDetTrackSelectionToolPixelMon - InDetPixelMainsMonOnTrack.TrackSelectionTool.UseTrkTrackTools = True - InDetPixelMainsMonOnTrack.TrackSelectionTool.CutLevel = "TightPrimary" - InDetPixelMainsMonOnTrack.TrackSelectionTool.maxNPixelHoles = 1 - InDetPixelMainsMonOnTrack.TrackSelectionTool.maxD0 = 2 - InDetPixelMainsMonOnTrack.TrackSelectionTool.maxZ0 = 150 - InDetPixelMainsMonOnTrack.TrackSelectionTool.TrackSummaryTool = InDetTrackSummaryTool - InDetPixelMainsMonOnTrack.TrackSelectionTool.Extrapolator = InDetExtrapolator - ##Other parameters - - if jobproperties.Beam.beamType()=='collisions': - from AthenaMonitoring.FilledBunchFilterTool import GetFilledBunchFilterTool - InDetPixelMainsMonOnTrack.FilterTools += [GetFilledBunchFilterTool()] +kwargsHitMonTool = { 'doOnline' : True if athenaCommonFlags.isOnline() else False, #Histograms for online (athenaPT) running + 'doModules' : True if athenaCommonFlags.isOnline() else False, #Turn on/off the sets of 1744 module histograms (for dqmf) + 'doLumiBlock' : False if athenaCommonFlags.isOnline() else True, #Turn on/off histograms stored for each lumi block + 'doLowOccupancy' : False, #Turn on/off histograms with binning for cosmics/single beam + 'doHighOccupancy' : True, #Turn on/off histograms with binning for collisions + 'doHeavyIonMon' : InDetFlags.doHeavyIon(), # Histogram modification for heavy ion monitoring + 'RDOName' : InDetKeys.PixelRDOs() +} + +kwargsClusMonTool = { 'doOnline' : True if athenaCommonFlags.isOnline() else False, #Histograms for online (athenaPT) running + 'doModules' : True if athenaCommonFlags.isOnline() else False, #Turn on/off the sets of 1744 module histograms (for dqmf) + 'doLumiBlock' : False if athenaCommonFlags.isOnline() else True, #Turn on/off histograms stored for each lumi block + 'doLowOccupancy' : False, #Turn on/off histograms with binning for cosmics/single beam + 'doHighOccupancy' : True, #Turn on/off histograms with binning for collisions + 'doHeavyIonMon' : InDetFlags.doHeavyIon(), # Histogram modification for heavy ion monitoring + # 'doStatus' : True, #Turn on/off histograms with Module Status information + 'ClusterName' : InDetKeys.PixelClusters(), + 'TrackName' : InDetKeys.Tracks() +} + +kwargsErrMonTool = { 'doOnline' : True if athenaCommonFlags.isOnline() else False, #Histograms for online (athenaPT) running + 'doModules' : True if athenaCommonFlags.isOnline() else False, #Turn on/off the sets of 1744 module histograms (for dqmf) + 'doLumiBlock' : False if athenaCommonFlags.isOnline() else True, #Turn on/off histograms stored for each lumi block + 'doLowOccupancy' : False, #Turn on/off histograms with binning for cosmics/single beam + 'doHighOccupancy' : True, #Turn on/off histograms with binning for collisions + 'doHeavyIonMon' : InDetFlags.doHeavyIon() +} + + + +from AthenaMonitoring.DQMonFlags import DQMonFlags +from AthenaMonitoring import AthMonitorCfgHelperOld +helper = AthMonitorCfgHelperOld(DQMonFlags, "NewPixelMonitoring") + + +if doHitMonTool: + pixelAthMonAlgHitMonTool = helper.addAlgorithm(PixelAthHitMonTool, 'PixelAthHitMonTool', 'PixelAthHitMonTool') + for k, v in kwargsHitMonTool.items(): + setattr(pixelAthMonAlgHitMonTool, k, v) + PixelAthHitMonToolCfg(helper, pixelAthMonAlgHitMonTool, **kwargsHitMonTool) + + +if doClusterMonTool: + pixelAthClusterMonTool = helper.addAlgorithm(PixelAthClusterMonTool, 'PixelAthClusterMonTool', 'PixelAthClusterMonTool') + for k, v in kwargsClusMonTool.items(): + setattr(pixelAthClusterMonTool, k, v) + pixelAthClusterMonTool.TrackSelectionTool.UseTrkTrackTools = True + pixelAthClusterMonTool.TrackSelectionTool.CutLevel = "TightPrimary" + pixelAthClusterMonTool.TrackSelectionTool.maxNPixelHoles = 1 + pixelAthClusterMonTool.TrackSelectionTool.maxD0 = 2 + pixelAthClusterMonTool.TrackSelectionTool.maxZ0 = 150 + pixelAthClusterMonTool.TrackSelectionTool.TrackSummaryTool = InDetTrackSummaryTool + pixelAthClusterMonTool.TrackSelectionTool.Extrapolator = InDetExtrapolator - #ToolSvc += InDetPixelMainsMonOnTrack - if (InDetFlags.doPrintConfigurables()): - print InDetPixelMainsMonOnTrack - -########################################################################## - -# configure the pixel mon manager and add main pixel monitoring tool -from AthenaMonitoring.AthenaMonitoringConf import AthenaMonManager -from AthenaMonitoring.DQMonFlags import DQMonFlags - -InDetPixMonMan = AthenaMonManager( "InDetPixelMonManager", - FileKey = DQMonFlags.monManFileKey(), - ManualDataTypeSetup = DQMonFlags.monManManualDataTypeSetup(), - ManualRunLBSetup = DQMonFlags.monManManualRunLBSetup(), - DataType = DQMonFlags.monManDataType(), - Environment = DQMonFlags.monManEnvironment(), - Run = DQMonFlags.monManRun(), - LumiBlock = DQMonFlags.monManLumiBlock()) -if doAllHits: - InDetPixMonMan.AthenaMonTools += [ InDetPixelMainsMon ] -if doHitsOnTrack: - InDetPixMonMan.AthenaMonTools += [ InDetPixelMainsMonOnTrack ] - -topSequence += InDetPixMonMan -if (InDetFlags.doPrintConfigurables()): - print InDetPixMonMan + #print getattr(pixelAthClusterMonTool, 'onTrack') + PixelAthClusterMonToolCfg(helper, pixelAthClusterMonTool, **kwargsClusMonTool) + +if doErrorMonTool: + pixelAthMonAlgErrorMonTool = helper.addAlgorithm(PixelAthErrorMonTool, 'PixelAthErrorMonTool', 'PixelAthErrorMonTool') + for k, v in kwargsErrMonTool.items(): + setattr(pixelAthMonAlgErrorMonTool, k, v) + PixelAthErrorMonToolCfg(helper, pixelAthMonAlgErrorMonTool, **kwargsErrMonTool) + + +topSequence += helper.result() + + diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/CMakeLists.txt b/InnerDetector/InDetMonitoring/PixelMonitoring/CMakeLists.txt index 690903fa3e71ae77207c8bb24900e27c9793609d..57b86d06a6b92f50fdeef4a15cb4ac0f3b9f9c1c 100644 --- a/InnerDetector/InDetMonitoring/PixelMonitoring/CMakeLists.txt +++ b/InnerDetector/InDetMonitoring/PixelMonitoring/CMakeLists.txt @@ -49,3 +49,4 @@ atlas_add_component( PixelMonitoring TrkTrackSummary TrkToolInterfaces PixelCablingLib PixelGeoModelLib PathResolver InDetTrackSelectionToolLib ) +atlas_install_python_modules( python/*.py ) \ No newline at end of file diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/PixelMonitoring/Components.h b/InnerDetector/InDetMonitoring/PixelMonitoring/PixelMonitoring/Components.h deleted file mode 100644 index d2c3133364156dae81fb5150ac4ee77e040b426d..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetMonitoring/PixelMonitoring/PixelMonitoring/Components.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef PIXMON_COMPONENTS_H_ -#define PIXMON_COMPONENTS_H_ - -#include <array> -#include <string> - -namespace PixMon { -/** - * Enum class listing all pixel detector components - * - * N.B. This is identical to the PixLayerIBL2D3DDBM enum of PixelMainMon and is - * supposed to replace it in the future. - */ -enum class LayerIBL2D3DDBM {kECA = 0, kECC, kB0, kB1, kB2, kDBMA, kDBMC, kIBL, kIBL2D, kIBL3D, COUNT}; - -const unsigned int kNumLayersDisk{3}; -const unsigned int kNumLayersDBM{3}; -const unsigned int kNumStavesIBL{14}; -const unsigned int kNumStavesL0{22}; -const unsigned int kNumStavesL1{38}; -const unsigned int kNumStavesL2{52}; - -const unsigned int kNumModulesIBL{32}; -const unsigned int kNumModulesIBL2D{12}; -const unsigned int kNumModulesIBL3D{8}; -const unsigned int kNumModulesBarrel{13}; -const unsigned int kNumModulesDisk{48}; -const unsigned int kNumModulesDBM{4}; -const unsigned int kNumPP0sEC{24}; - -extern const std::array<std::string, kNumStavesIBL> StavesIBL; -extern const std::array<std::string, kNumStavesL0> StavesL0; -extern const std::array<std::string, kNumStavesL1> StavesL1; -extern const std::array<std::string, kNumStavesL2> StavesL2; -extern const std::array<std::string, kNumModulesBarrel> ModulesBarrel; -extern const std::array<std::string, kNumModulesIBL> ModulesIBL; -extern const std::array<std::string, kNumModulesIBL2D> ModulesIBL2D; -extern const std::array<std::string, kNumModulesIBL3D> ModulesIBL3D; - -extern const std::array<std::string, kNumLayersDisk> LayersDisk; -extern const std::array<std::string, kNumLayersDBM> LayersDBM; -extern const std::array<std::string, kNumModulesDisk> ModulesECA; -extern const std::array<std::string, kNumModulesDisk> ModulesECC; -extern const std::array<std::string, kNumModulesDBM> ModulesDBM; -extern const std::array<std::string, kNumPP0sEC> PP0sEC; - -/** - * Enum class to set configuration of histogram containers - * - * This object is given to all histogram classes and determines for which - * components the histograms are initialised. - * - Pix = pixel components (L0, L1, L2, ECA, ECC) - * - IBL = IBL - * - IBL2D3D = IBL plus additional IBL2D and IBL3D - * - DBM = DBM - */ -enum class HistConf {kPix = 0, kPixIBL, kPixIBL2D3D, kPixDBM, kPixDBMIBL, kPixDBMIBL2D3D, kDBM, kDBMIBL, kDBMIBL2D3D, kIBL, kIBL2D3D, COUNT}; - -/** - * Function to check whether the HistConfig object 'config' includes a certain - * pixel detector component (desribed by enum class LayerIBL2D3DDBM). - * - * @param config: histogram configuration object - * @param component: the pixel detector component to be tested - */ -bool HasComponent(const HistConf& config, const LayerIBL2D3DDBM& component); -} // namespace PixMon - -#endif // PIXMON_COMPONENTS_H_ diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/PixelMonitoring/HolderTemplate.h b/InnerDetector/InDetMonitoring/PixelMonitoring/PixelMonitoring/HolderTemplate.h deleted file mode 100644 index 06f70b6493aace01a9700f88a2988c0f7ab376e2..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetMonitoring/PixelMonitoring/PixelMonitoring/HolderTemplate.h +++ /dev/null @@ -1,144 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef HOLDERTEMPLATE_H_ -#define HOLDERTEMPLATE_H_ -#include "AthenaMonitoring/ManagedMonitorToolBase.h" -#include "GaudiKernel/StatusCode.h" -#include "InDetIdentifier/PixelID.h" - -class array; -class string; - -namespace PixMon { -enum class HistConf; - -/** - * Template structure to delete light-weight histograms. The implementation of - * this deleter is intentionally left empty: all histograms and their memory are - * taken care of by the central monitoring tools (i.e. the monitoring group - * classes in which the histograms are registered). - */ -template <typename T> -struct LWHistDeleter { - void operator()(T* hist) { - // To avoid "unused variable" compiler warnings for the parameter. - (void)hist; - } -}; - -/** - * Template class to hold a set of histogram for the different pixel components. - * The class holds a maxmium of 10 histograms; the initialisation can be - * controlled with the HistConf parameter given as input to the constructor. - * - * This class serves as template for various histogram holder classes. - */ -template <typename T> -class HolderTemplate { - public: - /** - * Default constructor of the template class. Sets all pointers to null - * and saves the configuration option as member variables. - * - * @param config: the histogram configuration - * @param copy2DFEval: boolean whether to copy IBL values to neighbouring FE - */ - inline HolderTemplate(const HistConf& config, bool copy2DFEval = false) - : IBL{nullptr}, - IBL2D{nullptr}, - IBL3D{nullptr}, - B0{nullptr}, - B1{nullptr}, - B2{nullptr}, - A{nullptr}, - C{nullptr}, - DBMA{nullptr}, - DBMC{nullptr}, - m_histograms{{nullptr}}, - // Use parens here to work around gcc bug 83919 - m_config(config), - m_copy2DFEval{copy2DFEval}, - m_doIBL{true} {} - - virtual ~HolderTemplate() {} - - //! Function for histogram formatting. To be reimplemented in derived classes. - virtual void formatHist() = 0; - - //! Register the histograms in the monitoring group. - StatusCode regHist(ManagedMonitorToolBase::MonGroup& group) { - StatusCode sc = StatusCode::SUCCESS; - for (auto& hist : m_histograms) { - if (hist && group.regHist(hist.get()).isFailure()) { - sc = StatusCode::FAILURE; - } - } - return sc; - } - - /** - * Function to set the individual (raw) pointers declared below to the correct - * memory addresses. This function is to be called *after* the histograms in - * m_histograms are initialised in the class constructor. - */ - inline void setHistogramPointers() { - IBL = m_histograms.at(0).get(); - IBL2D = m_histograms.at(1).get(); - IBL3D = m_histograms.at(2).get(); - B0 = m_histograms.at(3).get(); - B1 = m_histograms.at(4).get(); - B2 = m_histograms.at(5).get(); - A = m_histograms.at(6).get(); - C = m_histograms.at(7).get(); - DBMA = m_histograms.at(8).get(); - DBMC = m_histograms.at(9).get(); - } - - //! Pointer to individal histogram: IBL (both 2D/3D modules). - T* IBL; - - //! Pointer to individal histogram: IBL 2D histogram (2D modules only). - T* IBL2D; - - //! Pointer to individal histogram: IBL 3D histogram (3D modules only). - T* IBL3D; - - //! Pointer to individal histogram: barrel layer 0. - T* B0; - - //! Pointer to individal histogram: barrel layer 1. - T* B1; - - //! Pointer to individal histogram: barrel layer 2. - T* B2; - - //! Pointer to individal histogram: end-cap side A. - T* A; - - //! Pointer to individal histogram: end-cap side C. - T* C; - - //! Pointer to individal histogram: DBM side A. - T* DBMA; - - //! Pointer to individal histogram: DBM side C. - T* DBMC; - - protected: - //! Array containing unique pointers to all histograms. - std::array<std::unique_ptr<T, LWHistDeleter<T>>, 10> m_histograms; - - //! Configuration which histograms are to be initialised. - const HistConf m_config; - - //! Boolean whether IBL values should be copied to neighbouring FE. - const bool m_copy2DFEval; - - //! Boolean for job option 'doIBL'. --> TO BE REMOVED - const bool m_doIBL; -}; -} // namespace PixMon - -#endif // HOLDERTEMPLATE_H_ diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/PixelMonitoring/PixelAthClusterMonTool.h b/InnerDetector/InDetMonitoring/PixelMonitoring/PixelMonitoring/PixelAthClusterMonTool.h new file mode 100644 index 0000000000000000000000000000000000000000..21d922ffdfb6276f415eff4bf14258d4cb8fcf24 --- /dev/null +++ b/InnerDetector/InDetMonitoring/PixelMonitoring/PixelMonitoring/PixelAthClusterMonTool.h @@ -0,0 +1,77 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef PIXELATHCLUSTERMONTOOL_H +#define PIXELATHCLUSTERMONTOOL_H + +#include "AthenaMonitoring/AthMonitorAlgorithm.h" +#include "AthenaMonitoring/Monitored.h" +#include "PixelAthMonitoringBase.h" + +#include "AtlasDetDescr/AtlasDetectorID.h" +#include "InDetIdentifier/PixelID.h" +#include "InDetConditionsSummaryService/IInDetConditionsTool.h" +#include "StoreGate/ReadHandleKey.h" + +#include "InDetPrepRawData/PixelClusterContainer.h" + +//------------TrackMon------------ +#include <algorithm> +#include "TrkToolInterfaces/ITrackHoleSearchTool.h" +#include "InDetTrackSelectionTool/IInDetTrackSelectionTool.h" + +#include "TrkTrack/TrackCollection.h" +#include "TrkTrackSummary/TrackSummary.h" +#include "TrkMeasurementBase/MeasurementBase.h" +#include "TrkRIO_OnTrack/RIO_OnTrack.h" +#include "InDetReadoutGeometry/SiDetectorElement.h" +#include "InDetRIO_OnTrack/SiClusterOnTrack.h" + + +//for Amg::error helper function: +#include "EventPrimitives/EventPrimitivesHelpers.h" +//------------------------------ + +class PixelID; + +namespace InDet { + class PixelCluster; + class IInDetTrackSelectionTool; +} +namespace Trk { + class ITrackHoleSearchTool; +} + + +class PixelAthClusterMonTool : public PixelAthMonitoringBase { + + public: + + PixelAthClusterMonTool( const std::string& name, ISvcLocator* pSvcLocator ); + virtual ~PixelAthClusterMonTool(); + virtual StatusCode initialize() override; + virtual StatusCode fillHistograms( const EventContext& ctx ) const override; + std::string findComponentString(int bec, int ld) const; + + private: + + ToolHandle<Trk::ITrackHoleSearchTool> m_holeSearchTool; + ToolHandle<InDet::IInDetTrackSelectionTool> m_trackSelTool; + ToolHandle<IInDetConditionsTool> m_pixelCondSummaryTool{this, "PixelConditionsSummaryTool", "PixelConditionsSummaryTool", "Tool to retrieve Pixel Conditions summary"}; + + const AtlasDetectorID* m_atlasid; //tracks only + const PixelID* m_pixelid; + + SG::ReadHandleKey<InDet::PixelClusterContainer> m_clustersKey{this, "ClusterName", "PixelClusters", "pixel cluster data key" }; + SG::ReadHandleKey<TrackCollection> m_tracksKey{this, "TrackName", "CombinedInDetTracks", "track data key"}; + + bool m_doOnline; + bool m_doModules; + bool m_doLumiBlock; + bool m_doLowOccupancy; + bool m_doHighOccupancy; + bool m_doHeavyIonMon; + +}; +#endif diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/PixelMonitoring/PixelAthErrorMonTool.h b/InnerDetector/InDetMonitoring/PixelMonitoring/PixelMonitoring/PixelAthErrorMonTool.h new file mode 100644 index 0000000000000000000000000000000000000000..deadb1342faceca1fd29b17e28d4b2b092055de1 --- /dev/null +++ b/InnerDetector/InDetMonitoring/PixelMonitoring/PixelMonitoring/PixelAthErrorMonTool.h @@ -0,0 +1,45 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef PIXELATHERRORMONTOOL_H +#define PIXELATHERRORMONTOOL_H + +#include "AthenaMonitoring/AthMonitorAlgorithm.h" +#include "AthenaMonitoring/Monitored.h" + +#include "InDetIdentifier/PixelID.h" +#include "PixelConditionsTools/IPixelByteStreamErrorsTool.h" +#include "InDetConditionsSummaryService/IInDetConditionsTool.h" +#include "StoreGate/ReadHandleKey.h" + +#include "PixelAthMonitoringBase.h" + +class PixelID; +class IPixelByteStreamErrorsSvc; + +class PixelAthErrorMonTool : public PixelAthMonitoringBase { + + public: + + PixelAthErrorMonTool( const std::string& name, ISvcLocator* pSvcLocator ); + virtual ~PixelAthErrorMonTool(); + virtual StatusCode initialize() override; + virtual StatusCode fillHistograms( const EventContext& ctx ) const override; + std::string findComponentString(int bec, int ld) const; + + private: + + ToolHandle<IPixelByteStreamErrorsTool> m_pixelErrorTool{this, "PixelByteStreamErrorsTool", "PixelByteStreamErrorsTool", "Tool for PixelByteStreamErrors"}; + ToolHandle<IInDetConditionsTool> m_pixelCondSummaryTool{this, "PixelConditionsSummaryTool", "PixelConditionsSummaryTool", "Tool to retrieve Pixel Conditions summary"}; + + const PixelID* m_pixelid; + + bool m_doOnline; + bool m_doModules; + bool m_doLumiBlock; + bool m_doLowOccupancy; + bool m_doHighOccupancy; + bool m_doHeavyIonMon; +}; +#endif diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/PixelMonitoring/PixelAthHitMonTool.h b/InnerDetector/InDetMonitoring/PixelMonitoring/PixelMonitoring/PixelAthHitMonTool.h new file mode 100644 index 0000000000000000000000000000000000000000..f72e28ea4f61b1c33705ba68a8718eb9f9bed859 --- /dev/null +++ b/InnerDetector/InDetMonitoring/PixelMonitoring/PixelMonitoring/PixelAthHitMonTool.h @@ -0,0 +1,53 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef PIXELATHHITMONTOOL_H +#define PIXELATHHITMONTOOL_H + +#include "AthenaMonitoring/AthMonitorAlgorithm.h" +#include "AthenaMonitoring/Monitored.h" + +#include "InDetIdentifier/PixelID.h" +#include "InDetConditionsSummaryService/IInDetConditionsTool.h" +//#include "InDetReadoutGeometry/SiDetectorElementCollection.h" +#include "StoreGate/ReadHandleKey.h" + + +#include "InDetRawData/InDetRawDataCLASS_DEF.h" +#include "InDetRawData/InDetRawDataContainer.h" +#include "InDetRawData/InDetTimeCollection.h" + +#include "PixelAthMonitoringBase.h" + +class PixelID; +class IPixelCablingSvc; +class PixelRDORawData; + +class PixelAthHitMonTool : public PixelAthMonitoringBase { + + public: + + PixelAthHitMonTool( const std::string& name, ISvcLocator* pSvcLocator ); + virtual ~PixelAthHitMonTool(); + virtual StatusCode initialize() override; + virtual StatusCode fillHistograms( const EventContext& ctx ) const override; + std::string findComponentString(int bec, int ld) const; + + private: + + ServiceHandle<IPixelCablingSvc> m_pixelCableSvc; //FE info + ToolHandle<IInDetConditionsTool> m_pixelCondSummaryTool{this, "PixelConditionsSummaryTool", "PixelConditionsSummaryTool", "Tool to retrieve Pixel Conditions summary"}; + + const PixelID* m_pixelid; + + SG::ReadHandleKey<PixelRDO_Container> m_pixelRDOName{this, "RDOName", "PixelRDOs", "rdo data key"}; + + bool m_doOnline; + bool m_doModules; + bool m_doLumiBlock; + bool m_doLowOccupancy; + bool m_doHighOccupancy; + bool m_doHeavyIonMon; +}; +#endif diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/PixelMonitoring/PixelAthMonitoringBase.h b/InnerDetector/InDetMonitoring/PixelMonitoring/PixelMonitoring/PixelAthMonitoringBase.h new file mode 100644 index 0000000000000000000000000000000000000000..355aaa23d4851faecd86889dea1e67589e71b136 --- /dev/null +++ b/InnerDetector/InDetMonitoring/PixelMonitoring/PixelMonitoring/PixelAthMonitoringBase.h @@ -0,0 +1,60 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef PIXELATHMONITORINGBASE_H +#define PIXELATHMONITORINGBASE_H + +#include "AthenaMonitoring/AthMonitorAlgorithm.h" +#include "AthenaMonitoring/Monitored.h" + +#include "InDetIdentifier/PixelID.h" + +class PixelID; + +class PixLayers { + public: + enum PixLayersID {kECA = 0, kECC, kB0, kB1, kB2, kIBL, kDBMA, kDBMC, COUNT}; +}; +const std::string pixLayersLabel[PixLayers::COUNT] = {"ECA", "ECC", "B0", "B1", "B2", "IBL", "DBMA", "DBMC"}; +const float inv_nmod_per_layer[PixLayers::COUNT] = {1./144., 1./144., 1./286., 1./494., 1./676., 1./448., 1./12., 1./12.}; +const int clusterToTMinCut[PixLayers::COUNT] = {15, 15, 15, 15, 15, 4, 4, 4}; + +namespace PixMon { + const unsigned int kNumLayersDisk{3}; + const unsigned int kNumLayersDBM{3}; + const unsigned int kNumStavesIBL{14}; + const unsigned int kNumStavesL0{22}; + const unsigned int kNumStavesL1{38}; + const unsigned int kNumStavesL2{52}; + + const unsigned int kNumFEsIBL{32}; + const unsigned int kNumModulesIBL{20}; + const unsigned int kNumModulesIBL2D{12}; + const unsigned int kNumModulesIBL3D{8}; + const unsigned int kNumModulesBarrel{13}; + const unsigned int kNumModulesDisk{48}; + const unsigned int kNumModulesDBM{4}; + const unsigned int kNumPP0sEC{24}; +} + +class PixelAthMonitoringBase : public virtual AthMonitorAlgorithm { + + public: + + StatusCode fill2DProfLayer( std::string prof2Dname, Identifier& id, const PixelID* pid, float weight=1.0, bool copy2DFEval=false ) const; + StatusCode fill1DProfLumiLayers( std::string prof1Dname, int lb, float* weights ) const; + StatusCode fill1DProfLayers( std::string name, float* values ) const; + StatusCode fillPP0Histos( std::string name, int(&D_A)[PixMon::kNumModulesDisk][PixMon::kNumLayersDisk], int(&D_C)[PixMon::kNumModulesDisk][PixMon::kNumLayersDisk], int(&B0)[PixMon::kNumStavesL0][PixMon::kNumModulesBarrel], int(&B1)[PixMon::kNumStavesL1][PixMon::kNumModulesBarrel], int(&B2)[PixMon::kNumStavesL2][PixMon::kNumModulesBarrel], int(&IBL)[PixMon::kNumStavesIBL][PixMon::kNumFEsIBL] ) const; + + + int getPixLayersID(int ec, int ld) const; + std::string addTxt(std::string txt, bool ontrack) const; + void getPhiEtaMod(const PixelID* pid, Identifier& id, int& phiMod, int& etaMod, bool& copyFE) const; + bool isHitOnTrack(Identifier id, std::vector<Identifier> const &RDOIDs) const; + bool isClusterOnTrack(Identifier id, std::vector<std::pair<Identifier, double> > const &ClusterIDs) const; + bool isClusterOnTrack(Identifier id, std::vector<std::pair<Identifier, double> > const &ClusterIDs, double& cosalpha) const; + +}; + +#endif diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/PixelMonitoring/PixelMainMon.h b/InnerDetector/InDetMonitoring/PixelMonitoring/PixelMonitoring/PixelMainMon.h deleted file mode 100755 index 696c3f73efbb05d17937853bc233ff0292d11596..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetMonitoring/PixelMonitoring/PixelMonitoring/PixelMainMon.h +++ /dev/null @@ -1,718 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef PIXMAINMON_H_ -#define PIXMAINMON_H_ - -#include <stdint.h> -#include <string> -#include <ctime> -#include <map> -#include <vector> -#include "AthenaMonitoring/ManagedMonitorToolBase.h" - -#include "GaudiKernel/ServiceHandle.h" -#include "InDetPrepRawData/PixelClusterContainer.h" -#include "InDetRawData/InDetRawDataCLASS_DEF.h" -#include "InDetRawData/InDetRawDataContainer.h" -#include "InDetRawData/InDetTimeCollection.h" -#include "TrkTrack/TrackCollection.h" -#include "AtlasDetDescr/AtlasDetectorID.h" -#include "PixelGeoModel/IBLParameterSvc.h" -#include "xAODEventInfo/EventInfo.h" -#include "StoreGate/ReadHandleKey.h" -#include "InDetConditionsSummaryService/IInDetConditionsTool.h" - -#include "PixelConditionsTools/IPixelByteStreamErrorsTool.h" - -class PixelMonModules1D; -class PixelMonModulesProf; -class PixelMonModules2D; -class PixelMon2DMapsLW; -class PixelMon2DProfilesLW; -class PixelMon2DLumiProfiles; -class PixelMon2DLumiMaps; -class StatusCode; -class PixelID; -class TH1I; -class TH1F; -class TH2I; -class TH2F; -class TH3F; -class TH1I_LW; -class TH1F_LW; -class TH2I_LW; -class TH2F_LW; -class TH2S; -class TProfile; -class TProfile2D; -class TProfile_LW; -class TProfile2D_LW; -namespace InDet { -class PixelCluster; -class IInDetTrackSelectionTool; -} // namespace InDet -namespace Trk { -class SpacePoint; -class ITrackHoleSearchTool; -} // namespace Trk -class IPixelCablingSvc; -class SpacePointContainer; -class PixelRDORawData; - -typedef InDet::PixelCluster PixelCluster; -typedef InDetRawDataCollection<PixelRDORawData> RDO_Collection; -typedef Trk::SpacePoint SpacePoint; - -class ErrorCategory { - public: - enum ErrorCategoryID {kSync = 0, kTrunc, kOpt, kSeu, kTout, COUNT}; -}; - -class ErrorCategoryMODROD { - public: - enum ErrorCategoryMODRODID {kSyncMod = 0, kSyncROD, kTruncMod, kTruncROD, kOpt, kSeu, kTout, COUNT}; -}; - -class PixLayerIBL2D3D { - public: - enum PixLayerIBL2D3DID {kECA = 0, kECC, kB0, kB1, kB2, kIBL, kIBL2D, kIBL3D, COUNT}; -}; - -class PixLayer { - public: - enum PixLayerID {kECA = 0, kECC, kB0, kB1, kB2, kIBL, COUNT}; -}; - -class PixLayerDisk { - public: - enum PixLayerDiskID {kECA0 = 0, kECA1, kECA2, kECC0, kECC1, kECC2, kB0, kB1, kB2, kIBL, COUNT}; -}; - -class IBLStave { - public: - enum IBLStaveID {kS01 = 0, kS02, kS03, kS04, kS05, kS06, kS07, kS08, kS09, kS10, kS11, kS12, kS13, kS14, COUNT}; -}; - -class PixLayerDBM { - public: - enum PixLayerDBMID {kECA = 0, kECC, kB0, kB1, kB2, kDBMA, kDBMC, kIBL, COUNT}; -}; - -class PixLayerIBL2D3DDBM { - public: - enum PixLayerIBL2D3DDBMID {kECA = 0, kECC, kB0, kB1, kB2, kDBMA, kDBMC, kIBL, kIBL2D, kIBL3D, COUNT}; -}; - -class PixelMainMon : public ManagedMonitorToolBase { - public: - PixelMainMon(const std::string& type, const std::string& name, const IInterface* parent); - PixelMainMon (const PixelMainMon&) = delete; - PixelMainMon& operator = (const PixelMainMon&) = delete; - virtual ~PixelMainMon(); - virtual StatusCode initialize(); //!< Runs once at the start of the code. Sets up services etc. - virtual StatusCode bookHistograms(); //!< Runs at the start of every event. Books some histograms if one of the function parameters is true - virtual StatusCode fillHistograms(); //!< Runs at every event, bulk of the code is inside here. Fills the histograms. - virtual StatusCode procHistograms(); //! - - int getPixLayerID(int ec, int ld, bool ibl); - int getPixLayerIDWithDBM(int id); - int getPixLayerIDIBL2D3D(int ec, int ld, int eta, bool ibl); - int getPixLayerIDIBL2D3DDBM(int ec, int ld, int eta, bool ibl); - int getPixLayerIDDBM(int ec, int ld, bool ibl); - int getPixLayerDiskID(int ec, int ld, bool ibl); - void th1FillMonitoring(TH1F_LW* mon, TH1F_LW* tmp); - void fillSummaryHistos(PixelMon2DMapsLW* occupancy, TH1F_LW* A, TH1F_LW* C, TH1F_LW* IBL, TH1F_LW* B0, TH1F_LW* B1, TH1F_LW* B2); - void fillPP0Histos(PixelMon2DMapsLW* occupancy, TProfile_LW* D_A, TProfile_LW* D_C, TProfile_LW* B0, TProfile_LW* B1, TProfile_LW* B2, TProfile_LW* IBL_A, TProfile_LW* IBL_C); - void formatPP0Histos(TProfile_LW* D_A, TProfile_LW* D_C, TProfile_LW* B0, TProfile_LW* B1, TProfile_LW* B2, TProfile_LW* IBL_A, TProfile_LW* IBL_C); - int parseDetailsString(std::string& detailsMod); - bool isOnTrack(Identifier id, bool isCluster); - bool isOnTrack(Identifier id, double& cosalpha); - unsigned int getEventBitLength(const Identifier& WaferID, const unsigned int& num_femcc_errorwords); - double getBitStreamFraction(const Identifier& WaferID, const unsigned int& bits); - int getErrorState(int bit, bool isibl); - std::string makeHistname(std::string set, bool ontrk); - std::string makeHisttitle(std::string set, std::string axis, bool ontrk); - bool getFEID(int pixlayer, int phiid, int etaid, int& oufephi, int& outfeeta); - void divide_TH1F_LW(TH1F_LW* num, TH1F_LW* den); //!< returns num = num/den w/ error propagation - - StatusCode bookClustersMon(void); - StatusCode bookClustersLumiBlockMon(void); - StatusCode fillClustersMon(void); - StatusCode procClustersMon(void); - - StatusCode bookHitsMon(void); - StatusCode bookHitsLumiBlockMon(void); - StatusCode fillHitsMon(void); - StatusCode procHitsMon(void); - - StatusCode bookStatusMon(void); - StatusCode bookStatusLumiBlockMon(void); - StatusCode fillStatusMon(void); - StatusCode procStatusMon(void); - - StatusCode bookTrackMon(void); - StatusCode bookTrackLumiBlockMon(void); - StatusCode fillTrackMon(void); - StatusCode procTrackMon(void); - - StatusCode bookRODErrorMon(void); - StatusCode bookRODErrorLumiBlockMon(void); - StatusCode fillRODErrorMon(void); - - StatusCode bookSpacePointMon(void); - StatusCode fillSpacePointMon(void); - - StatusCode bookPixelDCSMon(void); - StatusCode fillPixelDCSMon(void); - StatusCode procPixelDCSMon(void); - - private: - ToolHandle<IInDetConditionsTool> m_pixelCondSummaryTool - {this, "PixelConditionsSummaryTool", "PixelConditionsSummaryTool", "Tool to retrieve Pixel Conditions summary"}; - ToolHandle<IPixelByteStreamErrorsTool> m_ErrorSvc - {this, "PixelByteStreamErrorsTool", "PixelByteStreamErrorsTool", "Tool for PixelByteStreamError"}; - - ServiceHandle<IPixelCablingSvc> m_pixelCableSvc; - ServiceHandle<IBLParameterSvc> m_IBLParameterSvc; - ToolHandle<Trk::ITrackHoleSearchTool> m_holeSearchTool; - ToolHandle<InDet::IInDetTrackSelectionTool> m_trackSelTool; - - const PixelID* m_pixelid; - uint64_t m_event; - uint64_t m_event_ref; - - time_t m_startTime; - bool m_majorityDisabled; // check for each event, true if >50% modules disabled - - int m_lbRange; - int m_bcidRange; - int m_lumiBlockNum; - unsigned int m_firstBookTime; - unsigned int m_currentTime; - unsigned int m_currentBCID; - int m_runNum; - int m_ntracksPerEvent; - int m_nGood_mod[PixLayerIBL2D3DDBM::COUNT]; - int m_nActive_mod[PixLayerIBL2D3DDBM::COUNT]; - - int m_nRefresh; - int m_nRefresh5min; - - const AtlasDetectorID* m_idHelper; - - std::vector<Identifier> m_RDOIDs; - std::vector<std::pair<Identifier, double> > m_ClusterIDs; - - SG::ReadHandleKey<PixelRDO_Container> m_Pixel_RDOName; - SG::ReadHandleKey<InDet::PixelClusterContainer> m_Pixel_SiClustersName; - SG::ReadHandleKey<SpacePointContainer> m_Pixel_SpacePointsName; - SG::ReadHandleKey<TrackCollection> m_TracksName; - SG::ReadHandleKey<InDetTimeCollection> m_PixelBCIDName; - SG::ReadHandleKey<xAOD::EventInfo> m_eventxAODInfoKey; - - std::string m_detector_error_name; - std::string m_histTitleExt; - - std::string m_modLabel_PixLayerIBL2D3D[PixLayerIBL2D3D::COUNT] = { - "ECA", "ECC", "B0", "B1", "B2", - "IBL", "IBL2D", "IBL3D" - }; - std::string m_modLabel_PixLayerDBM[PixLayerDBM::COUNT] = { - "ECA", "ECC", - "B0", "B1", "B2", - "DBMA", "DBMC", "IBL" - }; - std::string m_modLabel_PixLayerIBL2D3DDBM[PixLayerIBL2D3DDBM::COUNT] = { - "ECA", "ECC", - "B0", "B1", "B2", - "DBMA", "DBMC", "IBL", "IBL2D", "IBL3D" - }; - std::string m_modLabel_PixLayerDisk[PixLayerDisk::COUNT] = { - "ECA0", "ECA1", "ECA2", - "ECC0", "ECC1", "ECC2", - "B0", "B1", "B2", "IBL" - }; - - bool m_doRDO; - bool m_doRODError; - bool m_doCluster; - bool m_doSpacePoint; - bool m_doTrack; - bool m_doStatus; - bool m_doDCS; - - bool m_doHoleSearch; - bool m_do2DMaps; - bool m_doModules; - bool m_doOffline; - bool m_doOnline; - bool m_doLowOccupancy; - bool m_doHighOccupancy; - bool m_doOnTrack; - bool m_doPixelOccupancy; - bool m_doDetails; - bool m_doTiming; - bool m_doLumiBlock; - bool m_doRefresh; - bool m_doRefresh5min; - bool m_isFirstBook; - - bool m_doHeavyIonMon; - - std::string m_DetailsMod1; - std::string m_DetailsMod2; - std::string m_DetailsMod3; - std::string m_DetailsMod4; - - bool m_doIBL; - - bool m_isNewRun; - bool m_newLowStatInterval; - - int m_ClusPerEventArray_disksA[48][3]; - int m_ClusPerEventArray_disksC[48][3]; - int m_ClusPerEventArray_lI[14][20]; - int m_ClusPerEventArray_l0[22][13]; - int m_ClusPerEventArray_l1[38][13]; - int m_ClusPerEventArray_l2[52][13]; - - int m_HitPerEventArray_disksA[48][3] = {{0}}; - int m_HitPerEventArray_disksC[48][3] = {{0}}; - // Effective number of hit words based on phi pairing - int m_HitPerEventArray_lI_phi_paired[14][20] = {{0}}; - int m_HitPerEventArray_lI[14][20] = {{0}}; - int m_HitPerEventArray_l0[22][13] = {{0}}; - int m_HitPerEventArray_l1[38][13] = {{0}}; - int m_HitPerEventArray_l2[52][13] = {{0}}; - - //////////////////////Histograms/////////////////////////// - - // event info - TH1F_LW* m_events_per_lumi; - TProfile_LW* m_mu_vs_bcid; - TProfile_LW* m_mu_vs_lumi; - TH2F_LW* m_storegate_errors; - - // number of hits - TProfile_LW* m_hits_per_lumi; - TH1I_LW* m_num_hits; - std::unique_ptr<PixelMon2DMapsLW> m_hitmap_mon; - std::unique_ptr<PixelMon2DMapsLW> m_hitmap_tmp; - TH1F_LW* m_nhits_mod[PixLayer::COUNT]; - TProfile_LW* m_hits_per_lumi_mod[PixLayer::COUNT]; - TH1F_LW* m_totalhits_per_bcid_mod[PixLayerIBL2D3D::COUNT]; - - // hit occupancy - TProfile_LW* m_avgocc_per_lumi; - TProfile_LW* m_avgocc_per_lumi_mod[PixLayerIBL2D3DDBM::COUNT]; - TH1F* m_avgocc_ratio_lastXlb_mod[PixLayer::COUNT]; - TProfile* m_avgocc_ratio_lastXlb_mod_prof[PixLayer::COUNT]; - TProfile_LW* m_avgocc_per_bcid_mod[PixLayerIBL2D3DDBM::COUNT]; - TProfile_LW* m_avgocc_active_per_lumi_mod[PixLayerIBL2D3D::COUNT]; - TH2F_LW* m_maxocc_per_lumi_mod[PixLayerIBL2D3D::COUNT]; - TH2F_LW* m_modocc_per_lumi[PixLayer::COUNT]; - TH1F_LW* m_maxocc_per_bcid_mod[PixLayerIBL2D3D::COUNT]; - std::unique_ptr<PixelMon2DMapsLW> m_occupancy; - std::unique_ptr<PixelMon2DMapsLW> m_average_pixocc; - std::unique_ptr<PixelMon2DProfilesLW> m_occupancy_pix_evt; - std::unique_ptr<PixelMon2DMapsLW> m_occupancy_10min; - TH1F_LW* m_occupancy_summary_mod[PixLayer::COUNT]; - TProfile_LW* m_occupancy_PP0_ECA; - TProfile_LW* m_occupancy_PP0_ECC; - TProfile_LW* m_occupancy_PP0_B0; - TProfile_LW* m_occupancy_PP0_B1; - TProfile_LW* m_occupancy_PP0_B2; - TProfile_LW* m_occupancy_PP0_IBLA; - TProfile_LW* m_occupancy_PP0_IBLC; - TProfile_LW* m_cluster_occupancy_PP0_ECA; - TProfile_LW* m_cluster_occupancy_PP0_ECC; - TProfile_LW* m_cluster_occupancy_PP0_B0; - TProfile_LW* m_cluster_occupancy_PP0_B1; - TProfile_LW* m_cluster_occupancy_PP0_B2; - TProfile_LW* m_cluster_occupancy_PP0_IBLA; - TProfile_LW* m_cluster_occupancy_PP0_IBLC; - TH3F* m_nFEswithHits_mod[PixLayer::COUNT]; - - // hit tot - TH1F_LW* m_hit_ToT[PixLayerIBL2D3DDBM::COUNT]; - TH1F_LW* m_hit_ToT_tmp_mod[PixLayer::COUNT]; - TH1F_LW* m_hit_ToT_Mon_mod[PixLayer::COUNT]; - TProfile_LW* m_hit_ToTMean_mod[PixLayer::COUNT]; - - // timing - TH1I_LW* m_Lvl1ID_PIX; - TH1I_LW* m_Lvl1ID_IBL; - TH1F_LW* m_Atlas_BCID; - TH2F_LW* m_Atlas_BCID_hits; - TH1I_LW* m_BCID; - TProfile_LW* m_BCID_Profile; - TH1F_LW* m_Lvl1A; - TH1F_LW* m_Lvl1A_mod[PixLayerDBM::COUNT]; - TH1F_LW* m_Lvl1A_10min_mod[PixLayer::COUNT]; - TH1I_LW* m_Lvl1ID_diff_mod_ATLAS_mod[PixLayer::COUNT]; - TH1I_LW* m_diff_ROD_vs_Module_BCID_mod[PixLayer::COUNT]; - std::unique_ptr<PixelMon2DLumiProfiles> m_Lvl1ID_diff_mod_ATLAS_per_LB; - std::unique_ptr<PixelMon2DLumiProfiles> m_Lvl1ID_absdiff_mod_ATLAS_per_LB; - - // module histograms - std::unique_ptr<PixelMonModulesProf> m_hiteff_mod; - std::unique_ptr<PixelMonModules1D> m_FE_chip_hit_summary; - std::unique_ptr<PixelMonModules2D> m_pixel_occupancy; - - // detailed histograms - TH1F_LW* m_Details_mod1_num_hits; - TH1F_LW* m_Details_mod2_num_hits; - TH1F_LW* m_Details_mod3_num_hits; - TH1F_LW* m_Details_mod4_num_hits; - TH2F_LW* m_Details_mod1_occupancy; - TH2F_LW* m_Details_mod2_occupancy; - TH2F_LW* m_Details_mod3_occupancy; - TH2F_LW* m_Details_mod4_occupancy; - TH1F_LW* m_Details_mod1_ToT; - TH1F_LW* m_Details_mod2_ToT; - TH1F_LW* m_Details_mod3_ToT; - TH1F_LW* m_Details_mod4_ToT; - - // track quality - TH1F_LW* m_track_res_phi; - TH1F_LW* m_track_pull_phi; - TH1F_LW* m_track_res_eta; - TH1F_LW* m_track_pull_eta; - TH1F_LW* m_track_chi2; - TProfile_LW* m_tracksPerEvt_per_lumi; - TProfile_LW* m_tracksPerEvtPerMu_per_lumi; - - // track state on surface - std::unique_ptr<PixelMon2DMapsLW> m_tsos_hitmap; - std::unique_ptr<PixelMon2DMapsLW> m_tsos_holemap; - std::unique_ptr<PixelMon2DMapsLW> m_tsos_outliermap; - std::unique_ptr<PixelMon2DProfilesLW> m_tsos_holeratio_tmp; - std::unique_ptr<PixelMon2DProfilesLW> m_tsos_holeratio_mon; - std::unique_ptr<PixelMon2DProfilesLW> m_misshits_ratio_tmp; - std::unique_ptr<PixelMon2DProfilesLW> m_misshits_ratio_mon; - - // hit efficiency - TProfile_LW* m_hiteff_incl_mod[PixLayer::COUNT]; - TProfile* m_hiteff_lastXlb_mod[PixLayer::COUNT]; - - // npixhits/track/lumi - TH2F_LW* m_npixhits_per_track_lumi{}; - TH2F* m_npixhits_per_track_lastXlb{}; - - // zoomed clusterToTxcosAlpha peak region - TH2F_LW* m_zoomed_clusterToTcosA_lumi_IBL; - TH2F* m_zoomed_clusterToTcosA_lastXlb_IBL; - TH2F_LW* m_zoomed_clusterToTcosA_lumi_B0; - TH2F* m_zoomed_clusterToTcosA_lastXlb_B0; - TH2F_LW* m_zoomed_clusterToTcosA_lumi_B1; - TH2F* m_zoomed_clusterToTcosA_lastXlb_B1; - TH2F_LW* m_zoomed_clusterToTcosA_lumi_B2; - TH2F* m_zoomed_clusterToTcosA_lastXlb_B2; - TH2F_LW* m_zoomed_clusterToTcosA_lumi_ECA; - TH2F* m_zoomed_clusterToTcosA_lastXlb_ECA; - TH2F_LW* m_zoomed_clusterToTcosA_lumi_ECC; - TH2F* m_zoomed_clusterToTcosA_lastXlb_ECC; - - // cluster size - TH1F_LW* m_clusize_ontrack_mod[PixLayerIBL2D3D::COUNT]; - TH1F_LW* m_clusize_offtrack_mod[PixLayerIBL2D3D::COUNT]; - - // cluster histograms - TProfile_LW* m_clusters_per_lumi; - TProfile_LW* m_clusters_per_lumi_mod[PixLayer::COUNT]; - TProfile_LW* m_clusters_row_width_per_lumi_mod[PixLayerIBL2D3D::COUNT]; - TProfile_LW* m_clusters_col_width_per_lumi_mod[PixLayerIBL2D3D::COUNT]; - TProfile_LW* m_clusters_row_width_per_bcid_mod[PixLayerIBL2D3D::COUNT]; - TProfile_LW* m_clusters_col_width_per_bcid_mod[PixLayerIBL2D3D::COUNT]; - TH1I_LW* m_totalclusters_per_lumi; - TH1I_LW* m_totalclusters_per_lumi_mod[PixLayerIBL2D3D::COUNT]; - TH1I_LW* m_totalclusters_per_bcid_mod[PixLayerIBL2D3D::COUNT]; - TH1F_LW* m_cluster_ToT1d_mod[PixLayerIBL2D3DDBM::COUNT]; - TH1F_LW* m_cluster_ToT1d_corr[PixLayerIBL2D3DDBM::COUNT]; - TH1F_LW* m_cluster_Q_mod[PixLayerIBL2D3DDBM::COUNT]; - TH1F_LW* m_cluster_Q_corr[PixLayerIBL2D3DDBM::COUNT]; - std::unique_ptr<PixelMon2DProfilesLW> m_clussize_map; - std::unique_ptr<PixelMon2DProfilesLW> m_cluscharge_map; - std::unique_ptr<PixelMon2DProfilesLW> m_clusToT_map; - TH1F_LW* m_cluster_groupsize; - TH1F_LW* m_cluster_col_width; - TH1F_LW* m_cluster_row_width; - TH1F_LW* m_cluster_col_width_mod[PixLayerIBL2D3D::COUNT]; - TH1F_LW* m_cluster_row_width_mod[PixLayerIBL2D3D::COUNT]; - TH1F_LW* m_cluster_groupsize_mod[PixLayerIBL2D3DDBM::COUNT]; - TH1F_LW* m_cluster_LVL1A; - TH1F_LW* m_cluster_LVL1A1d_mod[PixLayer::COUNT]; - TProfile_LW* m_clusterSize_eta; - TProfile_LW* m_clussize_vs_eta_mod[PixLayer::COUNT]; - - std::unique_ptr<PixelMon2DMapsLW> m_clustermap_mon; - std::unique_ptr<PixelMon2DMapsLW> m_clustermap_tmp; - std::unique_ptr<PixelMon2DMapsLW> m_cluster_occupancy; - - std::unique_ptr<PixelMon2DMapsLW> m_clusocc_sizenot1; - std::unique_ptr<PixelMonModulesProf> m_cluseff_mod; - std::unique_ptr<PixelMonModules1D> m_cluster_ToT_mod; - std::unique_ptr<PixelMonModules1D> m_cluster_size_mod; - std::unique_ptr<PixelMonModules1D> m_cluster_num_mod; - TH1I_LW* m_num_clusters; - TProfile_LW* m_clusters_per_track_per_lumi_mod[PixLayer::COUNT]; - TH1I_LW* m_num_clusters_mod[PixLayer::COUNT]; - TH1F_LW* m_cluster_occupancy_summary_mod[PixLayer::COUNT]; - std::unique_ptr<PixelMon2DProfilesLW> m_cluster_LVL1A_mod; - std::unique_ptr<PixelMon2DProfilesLW> m_clus_LVL1A_sizenot1; - TProfile_LW* m_clustersOnOffTrack_per_lumi; - - // status histograms - std::unique_ptr<PixelMon2DProfilesLW> m_status; - std::unique_ptr<PixelMon2DProfilesLW> m_status_mon; - std::unique_ptr<PixelMon2DProfilesLW> m_status_LB; - std::unique_ptr<PixelMon2DMapsLW> m_dqStatus; - TProfile_LW* m_disabledModules_per_lumi_PIX; - TProfile_LW* m_badModules_per_lumi_mod[PixLayerIBL2D3D::COUNT]; - TProfile_LW* m_disabledModules_per_lumi_mod[PixLayerIBL2D3D::COUNT]; - TProfile_LW* m_baddisabledModules_per_lumi_mod[PixLayerIBL2D3D::COUNT]; - - // ROD error histograms - static const int kNumErrorBits{32}; - static const int kNumErrorStates{16}; - static const int kNumErrorStatesIBL{27}; - TProfile_LW* m_errhist_errcat_LB[PixLayerIBL2D3DDBM::COUNT][ErrorCategory::COUNT]; - TProfile_LW* m_errhist_errtype_LB[PixLayerIBL2D3DDBM::COUNT][ErrorCategoryMODROD::COUNT - 3]; - std::unique_ptr<PixelMon2DMapsLW> m_errhist_errcat_map[ErrorCategory::COUNT]; - std::unique_ptr<PixelMon2DMapsLW> m_errhist_errtype_map[ErrorCategoryMODROD::COUNT]; - TProfile_LW* m_errhist_errcat_avg[ErrorCategory::COUNT][PixLayerIBL2D3DDBM::COUNT]; - TProfile_LW* m_errhist_errtype_avg[ErrorCategoryMODROD::COUNT - 3][PixLayerIBL2D3DDBM::COUNT]; - TProfile_LW* m_errhist_tot_LB[PixLayerIBL2D3DDBM::COUNT]; - TProfile2D_LW* m_errhist_per_bit_LB[PixLayerIBL2D3DDBM::COUNT]; - TProfile2D_LW* m_errhist_per_type_LB[PixLayerIBL2D3DDBM::COUNT]; - TProfile_LW* m_errhist_syncerr_LB_pix; - std::unique_ptr<PixelMonModules1D> m_errors; - std::unique_ptr<PixelMon2DProfilesLW> m_errhist_femcc_errwords_map; - std::unique_ptr<PixelMon2DProfilesLW> m_errhist_bitstr_occ_errors; - std::unique_ptr<PixelMon2DProfilesLW> m_errhist_bitstr_occ_tot; - TProfile_LW* m_errhist_bitstr_occ_errors_avg[PixLayerIBL2D3D::COUNT]{}; - TProfile_LW* m_errhist_bitstr_occ_tot_avg[PixLayerIBL2D3D::COUNT] {}; - - // Histograms in 'ErrorsExpert' folder - std::unique_ptr<PixelMon2DMapsLW> m_errhist_expert_maps[kNumErrorStates + kNumErrorStatesIBL]; - TProfile_LW* m_errhist_expert_LB[PixLayer::COUNT - 1][kNumErrorStates]; - TProfile_LW* m_errhist_expert_DBMIBL_LB[PixLayerDBM::COUNT - PixLayerDBM::kDBMA][kNumErrorStatesIBL]; - TH3F* m_errhist_expert_fe_trunc_err_3d[PixLayer::COUNT]; - TH1F_LW* m_errhist_expert_servrec_ibl_unweighted; - TH1F_LW* m_errhist_expert_servrec_ibl_weighted; - TH1F_LW* m_errhist_expert_servrec_ibl_count; - - // Histograms in low-stat folder - std::unique_ptr<PixelMon2DMapsLW> m_errors_LB; - std::unique_ptr<PixelMon2DMapsLW> m_errors_RODSync_mod; - std::unique_ptr<PixelMon2DMapsLW> m_errors_ModSync_mod; - - // space-point histograms - TH1I_LW* m_num_spacepoints; - TH1I_LW* m_num_spacepoints_low; - TH1F_LW* m_spHit_x; - TH1F_LW* m_spHit_y; - TH1F_LW* m_spHit_z; - TH1F_LW* m_spHit_r; - TH1F_LW* m_spHit_phi; - TH2F_LW* m_spHit_xy; - TH2F_LW* m_spHit_rz; - - std::unique_ptr<PixelMon2DMapsLW> m_cluster_occupancy_LB; // cluster occupancy (shows module status) - std::unique_ptr<PixelMonModules1D> m_cluster_ToT_mod_LB; - std::unique_ptr<PixelMonModules1D> m_cluster_num_mod_LB; - std::unique_ptr<PixelMonModules1D> m_hit_num_mod_LB; - - TH1I_LW* m_num_hits_LB; - TH1F_LW* m_hit_ToT_LB_mod[PixLayer::COUNT]; - TH1F_LW* m_cluster_ToT_LB; - TH1I_LW* m_num_clusters_LB; - - // DCS Monitoring - TProfile2D_LW* m_hist_moduleTemperatureEtaPhi; - TH2F_LW* m_hist_moduleTemperature2Dscatter[IBLStave::COUNT]; - TProfile_LW* m_hist_moduleTemperatureLB[IBLStave::COUNT]; - TProfile2D_LW* m_hist_LB_staveID_moduleTemperature; - TProfile2D_LW* m_hist_LB_moduleGroup_moduleTemperature[IBLStave::COUNT]; - TProfile2D_LW* m_hist_HVoltageEtaPhi; - TH2F_LW* m_hist_HVoltage2Dscatter[IBLStave::COUNT]; - TProfile_LW* m_hist_HVoltageLB[IBLStave::COUNT]; - TProfile2D_LW* m_hist_LB_staveID_HVoltage; - TProfile2D_LW* m_hist_LB_moduleGroup_HVoltage[IBLStave::COUNT]; - TH2F_LW* m_hist_Pipes_inlet2Dscatter; - TProfile_LW* m_hist_Pipes_inletLB[IBLStave::COUNT]; - TProfile2D_LW* m_hist_LB_staveID_coolingPipeInlet; - TH2F_LW* m_hist_Pipes_outlet2Dscatter; - TProfile_LW* m_hist_Pipes_outletLB[IBLStave::COUNT]; - TProfile2D_LW* m_hist_LB_staveID_coolingPipeOutlet; - TProfile2D_LW* m_hist_LVoltageEtaPhi; - TH2F_LW* m_hist_LVoltage2Dscatter[IBLStave::COUNT]; - TProfile_LW* m_hist_LVoltageLB[IBLStave::COUNT]; - TProfile2D_LW* m_hist_LB_staveID_LVoltage; - TProfile2D_LW* m_hist_LB_moduleGroup_LVoltage[IBLStave::COUNT]; - TProfile2D_LW* m_hist_LVcurrentEtaPhi; - TH2F_LW* m_hist_LVcurrent2Dscatter[IBLStave::COUNT]; - TProfile_LW* m_hist_LVcurrentLB[IBLStave::COUNT]; - TProfile2D_LW* m_hist_LB_staveID_LVcurrent; - TProfile2D_LW* m_hist_LB_moduleGroup_LVcurrent[IBLStave::COUNT]; - TProfile2D_LW* m_hist_HVcurrentEtaPhi; - TH2F_LW* m_hist_HVcurrent2Dscatter[IBLStave::COUNT]; - TProfile_LW* m_hist_HVcurrentLB[IBLStave::COUNT]; - TProfile2D_LW* m_hist_LB_staveID_HVcurrent; - TProfile2D_LW* m_hist_LB_moduleGroup_HVcurrent[IBLStave::COUNT]; - TH2F* m_hist_FSMstateEtaPhi; - TH2F_LW* m_hist_FSMstate2Dscatter[IBLStave::COUNT]; - TH2F_LW* m_hist_FSMstateLB[IBLStave::COUNT]; - TH2F* m_hist_LB_staveID_FSMstate; - TH2F* m_hist_LB_moduleGroup_FSMstate[IBLStave::COUNT]; - TH2F* m_hist_FSMstatusEtaPhi; - TH2F_LW* m_hist_FSMstatus2Dscatter[IBLStave::COUNT]; - TH2F_LW* m_hist_FSMstatusLB[IBLStave::COUNT]; - TH2F* m_hist_LB_staveID_FSMstatus; - TH2F* m_hist_LB_moduleGroup_FSMstatus[IBLStave::COUNT]; - - // Combination histograms - TProfile2D_LW* m_hist_dTEtaPhi; - TProfile2D_LW* m_hist_LB_moduleGroup_dT[IBLStave::COUNT]; - TProfile2D_LW* m_hist_LB_staveID_dT; - TProfile2D_LW* m_hist_LVPowerConsumptionEtaPhi; - TProfile2D_LW* m_hist_LB_moduleGroup_LVPowerConsumption[IBLStave::COUNT]; - TProfile2D_LW* m_hist_LB_staveID_LVPowerConsumption; - TProfile2D_LW* m_hist_HVPowerConsumptionEtaPhi; - TProfile2D_LW* m_hist_LB_moduleGroup_HVPowerConsumption[IBLStave::COUNT]; - TProfile2D_LW* m_hist_LB_staveID_HVPowerConsumption; - TProfile2D_LW* m_hist_LVHVPowerConsumptionEtaPhi; - TProfile2D_LW* m_hist_LB_moduleGroup_LVHVPowerConsumption[IBLStave::COUNT]; - TProfile2D_LW* m_hist_LB_staveID_LVHVPowerConsumption; - TProfile2D_LW* m_hist_effFLEXtempEtaPhi; - TProfile2D_LW* m_hist_LB_moduleGroup_effFLEXtemp[IBLStave::COUNT]; - TProfile2D_LW* m_hist_LB_staveID_effFLEXtemp; - TProfile2D_LW* m_hist_thermalFigureMeritEtaPhi; - TProfile2D_LW* m_hist_LB_moduleGroup_thermalFigureMerit[IBLStave::COUNT]; - TProfile2D_LW* m_hist_LB_staveID_thermalFigureMerit; - - std::vector<std::string> m_atrcollist; - int m_currentLumiBlockNumber{}; - - class dcsDataHolder { - public: - dcsDataHolder() : m_values(new std::map<int, std::map<int, float>*>), - m_maps(new std::map<std::string, int>){}; - dcsDataHolder (const dcsDataHolder&) = delete; - dcsDataHolder& operator = (const dcsDataHolder&) = delete; - ~dcsDataHolder() { - for (auto lbmap : *m_values) { - delete lbmap.second; - } - delete m_values; - delete m_maps; - }; - std::map<int, std::map<int, float>*>* m_values; // <channel number, <LB, value> > - std::map<std::string, int>* m_maps; // <module name, channel number> - }; - dcsDataHolder* m_moduleTemperature; - dcsDataHolder* m_coolingPipeTemperatureInlet; - dcsDataHolder* m_coolingPipeTemperatureOutlet; - dcsDataHolder* m_HV; - dcsDataHolder* m_HV_current; - dcsDataHolder* m_LV_voltage; - dcsDataHolder* m_LV_current; - dcsDataHolder* m_FSM_state; - dcsDataHolder* m_FSM_status; - - class moduleDcsDataHolder { - public: - moduleDcsDataHolder() : m_tempModule(new std::map<int, std::map<int, float>*>), - m_tempInlet(new std::map<int, std::map<int, float>*>), - m_tempOutlet(new std::map<int, std::map<int, float>*>), - m_hv_voltage(new std::map<int, std::map<int, float>*>), - m_lv_voltage(new std::map<int, std::map<int, float>*>), - m_hv_current(new std::map<int, std::map<int, float>*>), - m_lv_current(new std::map<int, std::map<int, float>*>), - m_fsm_state(new std::map<int, std::map<int, float>*>), - m_fsm_status(new std::map<int, std::map<int, float>*>), - m_moduleMap(new std::map<std::string, int>){}; - moduleDcsDataHolder (const moduleDcsDataHolder&) = delete; - moduleDcsDataHolder& operator = (const moduleDcsDataHolder&) = delete; - ~moduleDcsDataHolder() { - for (auto lbmap : *m_tempModule) { - delete lbmap.second; - } - for (auto lbmap : *m_tempInlet) { - delete lbmap.second; - } - for (auto lbmap : *m_tempOutlet) { - delete lbmap.second; - } - for (auto lbmap : *m_hv_voltage) { - delete lbmap.second; - } - for (auto lbmap : *m_lv_voltage) { - delete lbmap.second; - } - for (auto lbmap : *m_hv_current) { - delete lbmap.second; - } - for (auto lbmap : *m_lv_current) { - delete lbmap.second; - } - for (auto lbmap : *m_fsm_state) { - delete lbmap.second; - } - for (auto lbmap : *m_fsm_status) { - delete lbmap.second; - } - delete m_tempModule; - delete m_tempInlet; - delete m_tempOutlet; - delete m_hv_voltage; - delete m_lv_voltage; - delete m_hv_current; - delete m_lv_current; - delete m_fsm_state; - delete m_fsm_status; - delete m_moduleMap; - }; - // <module number, <LB, value> > - std::map<int, std::map<int, float>*>* m_tempModule; - std::map<int, std::map<int, float>*>* m_tempInlet; - std::map<int, std::map<int, float>*>* m_tempOutlet; - std::map<int, std::map<int, float>*>* m_hv_voltage; - std::map<int, std::map<int, float>*>* m_lv_voltage; - std::map<int, std::map<int, float>*>* m_hv_current; - std::map<int, std::map<int, float>*>* m_lv_current; - std::map<int, std::map<int, float>*>* m_fsm_state; - std::map<int, std::map<int, float>*>* m_fsm_status; - // <module name, channel number> - std::map<std::string, int>* m_moduleMap; - }; - moduleDcsDataHolder* m_moduleDCSDataHolder; - - public: - int getIBLetaIndexFromModuleName(std::string moduleName) { - int module_eta = m_name2etaIndex[moduleName.substr(static_cast<int>(moduleName.find("S")) + 4)]; - return module_eta; - } - - int getIBLmoduleGroupFromModuleName(std::string moduleName) { - int moduleGroup = m_name2moduleGroup[moduleName.substr(static_cast<int>(moduleName.find("S")) + 4, 4)]; // LI_S01_A_M4_A8_2 - return moduleGroup; - } - - int getIBLstaveIdFromModuleName(std::string moduleName) { - std::string staveNumStr(moduleName, moduleName.find("S") + 1, 2); // LI_S01_A_... - int staveNum = std::stoi(staveNumStr); - return staveNum; - } - - private: - std::map<std::string, int> m_name2etaIndex; - std::map<std::string, int> m_name2moduleGroup; - - std::map<std::string, float> m_fsmState2enum; - std::map<std::string, float> m_fsmStatus2enum; -}; // end class PixelMainMon : public ManagedMonitorToolBase - -#endif diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/PixelMonitoring/PixelMon2DLumiMaps.h b/InnerDetector/InDetMonitoring/PixelMonitoring/PixelMonitoring/PixelMon2DLumiMaps.h deleted file mode 100644 index 112285429bf18ca45c85707cc9d11d8bb1006cde..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetMonitoring/PixelMonitoring/PixelMonitoring/PixelMon2DLumiMaps.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef PIXELMON2DLUMIMAPS_H_ -#define PIXELMON2DLUMIMAPS_H_ -#include "PixelMonitoring/HolderTemplate.h" - -class string; -class TH2F_LW; -class Identifier; -class PixelID; -class StatusCode; -namespace PixMon { enum class HistConf; } - -/** - * PixelMon2DLumiMaps histogram holder class - * --> Base type: 2D Maps (TH2F_LW) - * --> Supports: IBL - * B0, B1, B2 - * ECA/C - * DBMA/C - * - * Collection of 2D pixel component maps, based on the TH2F_LW histogram class. - * The initialisation of the components is controlled by the HistConf object. - * The fill method will take the identifier as the input and fill the correct - * histogram and bin. The histograms are also public so that they can be - * formatted/accessed like any other histograms in the monitoring. - * - * N.B. Currently no support for IBL2D/3D histograms. Should this be added? - * Also, if the histogram configuration contains unsupported histograms, this is - * completely ignored. Should we do anything against it? - */ -class PixelMon2DLumiMaps : public PixMon::HolderTemplate<TH2F_LW> { - public: - //! Constructor for 2D lumi objects - PixelMon2DLumiMaps(std::string name, std::string title, std::string zlabel, const PixMon::HistConf& config); - - /** - * Standard method to fill the histograms of this container. - * - * @param LB: the luminosity block number - * @param id: the identifier of the pixel unit - * @param pixID: instance of the class which translates the above ID - * into readable info (e.g. eta/phi module index) - * @param weight: optional weighting factor - */ - void fill(double LB, Identifier &id, const PixelID* pixID, float weight = 1.0); - - //! Formatting function for histograms (reimplemented from template) - virtual void formatHist() override; -}; - -#endif // PIXELMON2DLUMIMAPS_H_ diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/PixelMonitoring/PixelMon2DLumiProfiles.h b/InnerDetector/InDetMonitoring/PixelMonitoring/PixelMonitoring/PixelMon2DLumiProfiles.h deleted file mode 100644 index 40d0b3a59c2dbd7f6a6caa496b94de37e4835799..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetMonitoring/PixelMonitoring/PixelMonitoring/PixelMon2DLumiProfiles.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef PIXELMON2DLUMIPROFILES_H_ -#define PIXELMON2DLUMIPROFILES_H_ -#include "PixelMonitoring/HolderTemplate.h" - -class string; -class TProfile2D_LW; -class Identifier; -class PixelID; -class StatusCode; -namespace PixMon { enum class HistConf; } - -/** - * PixelMon2DMapsLW histogram holder class - * --> Base type: 2D Profiles (TProfile2D_LW) - * --> Supports: IBL - * IBL 2D/3D - * B0, B1, B2 - * ECA/C - * DBMA/C - * - * Collection of 2D pixel component maps, based on the TH2F_LW histogram class. - * The initialisation of the components is controlled by the HistConf object. - * The fill method will take the identifier as the input and fill the correct - * histogram and bin. The histograms are also public so that they can be - * formatted/accessed like any other histograms in the monitoring. - * - * N.B. Currently no support for IBL2D/3D histograms. Should this be added? - * Also, if the histogram configuration contains unsupported histograms, this is - * completely ignored. Should we do anything against it? - */ -class PixelMon2DLumiProfiles : public PixMon::HolderTemplate<TProfile2D_LW> { - public: - //! Constructor for 2D lumi profiles - PixelMon2DLumiProfiles(std::string name, std::string title, std::string zlabel, const PixMon::HistConf& config); - - /** - * Standard method to fill the histograms of this container. - * - * @param LB: the luminosity block number - * @param id: the identifier of the pixel unit - * @param pixID: instance of the class which translates the above ID - * into readable info (e.g. eta/phi module index) - * @param weight: optional weighting factor - */ - void fill(double LB, Identifier &id, const PixelID* pixID, double weight = 1.0); - - //! Formatting function for histograms (reimplemented from template) - void formatHist(); -}; - -#endif // PIXELMON2DLUMIPROFILES_H_ diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/PixelMonitoring/PixelMon2DMapsLW.h b/InnerDetector/InDetMonitoring/PixelMonitoring/PixelMonitoring/PixelMon2DMapsLW.h deleted file mode 100644 index 74462684ca8896b2a15710d6858dbbed7532ca74..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetMonitoring/PixelMonitoring/PixelMonitoring/PixelMon2DMapsLW.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef PIXELMON2DMAPSLW_H_ -#define PIXELMON2DMAPSLW_H_ -#include "PixelMonitoring/HolderTemplate.h" - -class string; -class TH2F_LW; -class Identifier; -class PixelID; -class StatusCode; -namespace PixMon { enum class HistConf; } - -/** - * PixelMon2DMapsLW histogram holder class - * --> Base type: 2D Maps (TH2F_LW) - * --> Supports: IBL - * IBL 2D/3D - * B0, B1, B2 - * ECA/C - * DBMA/C - * - * Collection of 2D pixel component maps, based on the TH2F_LW histogram class. - * The initialisation of the components is controlled by the HistConf object. - * The fill method will take the identifier as the input and fill the correct - * histogram and bin. The histograms are also public so that they can be - * formatted/accessed like any other histograms in the monitoring. - */ -class PixelMon2DMapsLW : public PixMon::HolderTemplate<TH2F_LW> { - public: - //! Constructor for 2D map objects - PixelMon2DMapsLW(std::string name, std::string title, const PixMon::HistConf& config, bool copy2DFEval = false); - - /** - * Standard method to fill the histograms of this container. - * - * @param id: the identifier of the pixel unit - * @param pixID: instance of the class which translates the above ID - * into readable info (e.g. eta/phi module index) - * @param weight: optional weighting factor - */ - void fill(Identifier &id, const PixelID* pixID, float weight = 1.0); - - //! Fill method which takes values from another map - void fill2DMon(PixelMon2DMapsLW* oldmap); - - //! Formatting function for histograms (reimplemented from template) - virtual void formatHist() override; - - protected: - friend class PixelMon2DProfilesLW; -}; - -#endif // PIXELMON2DMAPSLW_H_ diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/PixelMonitoring/PixelMon2DProfilesLW.h b/InnerDetector/InDetMonitoring/PixelMonitoring/PixelMonitoring/PixelMon2DProfilesLW.h deleted file mode 100644 index 8c9d23ca138f91bf414e091c663d62ceeec851ee..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetMonitoring/PixelMonitoring/PixelMonitoring/PixelMon2DProfilesLW.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef PIXELMON2DPROFILESLW_H_ -#define PIXELMON2DPROFILESLW_H_ -#include "PixelMonitoring/HolderTemplate.h" - -class string; -class TProfile2D_LW; -class Identifier; -class PixelID; -class StatusCode; -namespace PixMon { enum class HistConf; } -class PixelMon2DMapsLW; - -/** - * PixelMon2DProfilesLW histogram holder class - * --> Base type: 2D Profiles (TProfile2D_LW) - * --> Supports: IBL - * IBL 2D/3D - * B0, B1, B2 - * ECA/C - * DBMA/C - * - * Collection of 2D pixel component maps, based on the TH2F_LW histogram class. - * The initialisation of the components is controlled by the HistConf object. - * The fill method will take the identifier as the input and fill the correct - * histogram and bin. The histograms are also public so that they can be - * formatted/accessed like any other histograms in the monitoring. - */ -class PixelMon2DProfilesLW : public PixMon::HolderTemplate<TProfile2D_LW> { -public: - //! Constructor for 2D map profiles - PixelMon2DProfilesLW(std::string name, std::string title, const PixMon::HistConf& config, bool copy2DFEval = false); - - /** - * Standard method to fill the histograms of this container. - * - * @param id: the identifier of the pixel unit - * @param pixID: instance of the class which translates the above ID - * into readable info (e.g. eta/phi module index) - * @param value: the fill value - */ - void fill(Identifier &id, const PixelID* pixID, float value); - - //! Fill method which takes values from another 2D profile - void fill2DMon(PixelMon2DProfilesLW* oldmap); - - //! Fill method which takes values from a 2D map object - void fillFromMap(PixelMon2DMapsLW* inputmap, bool clear_inputmap); - - //! Set maximal value of the 2D profile bins - void setMaxValue(float max); - - //! Reset the 2D profiles - void reset(); - - //! Formatting function for histograms (reimplemented from template) - virtual void formatHist() override; -}; - -#endif // PIXELMON2DPROFILESLW_H_ diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/PixelMonitoring/PixelMonModules.h b/InnerDetector/InDetMonitoring/PixelMonitoring/PixelMonitoring/PixelMonModules.h deleted file mode 100644 index 6078ee7357f4999bccf8a29bf6a35dabbf2520de..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetMonitoring/PixelMonitoring/PixelMonitoring/PixelMonModules.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef PIXELMONMODULES_H_ -#define PIXELMONMODULES_H_ -#include <string.h> -#include "AthenaMonitoring/ManagedMonitorToolBase.h" - -class TH2F; -class TH1F; -class TH1F_LW; -class TProfile; -class TProfile_LW; -class Identifier; -class PixelID; -class StatusCode; - -// A helper class to remove a lot of the code duplication. -// This is a collection of 1744 1D histograms which make up one set of module -// histograms. It will book the histograms in the constructor. The fill method -// will take the identifier as the input and fill the correct histogram and bin. - -class PixelMonModules { - public: - // PixelMonModules(); - virtual ~PixelMonModules() {} - virtual void formatHist(std::string) = 0; // pass the bin labels here if needed - virtual void reset() = 0; - virtual StatusCode regHist(ManagedMonitorToolBase* thisptr, std::string path, ManagedMonitorToolBase::Interval_t Run) = 0; - - protected: - int m_nBins; - std::string getHistName(int i, bool forPath = false); - static const bool m_doIBL; -}; - -class PixelMonModules1D : public PixelMonModules { - public: - PixelMonModules1D(std::string name, std::string title, int nbins, double low, double high); - PixelMonModules1D(std::string name, std::string title, int nbins, double* arr); - StatusCode regHist(ManagedMonitorToolBase* thisptr, std::string path, ManagedMonitorToolBase::Interval_t Run); - TH1F* IBL[20][14]; - TH1F* B0[13][22]; - TH1F* B1[13][38]; - TH1F* B2[13][52]; - TH1F* A[3][48]; - TH1F* C[3][48]; - virtual void formatHist(std::string opt = ""); // pass the bin labels here if needed - void fill(double value, Identifier& id, const PixelID* pixID); - void setBinLabel(const char* lable, int binN); - virtual void reset(); - double getBinContent(double value, Identifier& id, const PixelID* pixID); - - private: - TH1F* m_Dummy; // shouldn't be used unless messed up; - TH1F*& getHist(int i); // make looping over all the histos easier. -}; - -class PixelMonModulesProf : public PixelMonModules { - public: - PixelMonModulesProf(std::string name, std::string title, int nbins, double low, double high); - PixelMonModulesProf(std::string name, std::string title, int nbins, double* arr); - StatusCode regHist(ManagedMonitorToolBase* thisptr, std::string path, ManagedMonitorToolBase::Interval_t Run); - TProfile_LW* IBL[20][14]; - TProfile_LW* B0[13][22]; - TProfile_LW* B1[13][38]; - TProfile_LW* B2[13][52]; - TProfile_LW* A[3][48]; - TProfile_LW* C[3][48]; - virtual void formatHist(std::string opt = ""); // pass the bin labels here if needed - void fill(double value0, double value1, Identifier& id, const PixelID* pixID); - void setBinLabel(const char* lable, int binN); - virtual void reset(); - - private: - TProfile_LW* m_Dummy; // shouldn't be used unless messed up; - TProfile_LW*& getHist(int i); // make looping over all the histos easier. -}; - -class PixelMonModules2D : public PixelMonModules { - public: - PixelMonModules2D(std::string name, std::string title, int nbins0, - double low0, double high0, int nbins1, double low1, double high1); - StatusCode regHist(ManagedMonitorToolBase* thisptr, std::string path, ManagedMonitorToolBase::Interval_t Run); - TH2F* IBL[20][14]; - TH2F* B0[13][22]; - TH2F* B1[13][38]; - TH2F* B2[13][52]; - TH2F* A[3][48]; - TH2F* C[3][48]; - virtual void formatHist(std::string opt = ""); // pass the bin labels here if needed - void fill(double value0, double value1, Identifier& id, const PixelID* pixID, double weight = 1.); - virtual void reset(); - - private: - TH2F* m_Dummy; // shouldn't be used unless messed up; - TH2F*& getHist(int i); // make looping over all the histos easier. -}; - -#endif diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/python/PixelAthClusterMonToolCfg.py b/InnerDetector/InDetMonitoring/PixelMonitoring/python/PixelAthClusterMonToolCfg.py new file mode 100644 index 0000000000000000000000000000000000000000..d79c5647b60445c8713fc6bae9f7fce41ca21bc2 --- /dev/null +++ b/InnerDetector/InDetMonitoring/PixelMonitoring/python/PixelAthClusterMonToolCfg.py @@ -0,0 +1,299 @@ +# +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# + +''' +@file PixelAthClusterMonToolCfg.py +@brief Configuration of Pixel Monitoring Clusters, Tracks and Status Histograms for Run 3 +''' + +from PixelMonitoring.PixelAthMonitoringBase import define2DProfLayers, definePP0Histos +from PixelMonitoring.PixelAthMonitoringBase import define1DLayers +from PixelMonitoring.PixelAthMonitoringBase import define1DProfLumiLayers +from PixelMonitoring.PixelAthMonitoringBase import layers, totcuts, xbinsem, xminsem, lumibinsx +from PixelMonitoring.PixelAthMonitoringBase import addOnTrackTxt, fullDressTitle +from RecExConfig.AutoConfiguration import GetRunNumber +runNumber = GetRunNumber() +runtext = ' (Run ' + str(runNumber) + ')' + + +def PixelAthClusterMonToolCfg(helper, alg, **kwargs): + + doOnline = kwargs.get('doOnline', False) + +### begin status histograms + + path = '/Pixel/Status/' + pathLowStat = '/Pixel/LumiBlock/' + + histoGroupName = 'Map_Of_Modules_Status' + title = 'Modules Status (0=Active+Good 1=Active+Bad 2=Inactive)' + define2DProfLayers(helper, alg, histoGroupName, title, path, type='TProfile2D') + + histoGroupName = 'Map_Of_Modules_Status_Mon' + title = 'Modules Status Reset (0=Active+Good 1=Active+Bad 2=Inactive)' + define2DProfLayers(helper, alg, histoGroupName, title, path, type='TProfile2D', zmin=0, zmax=2, opt='kLBNHistoryDepth=2') + + histoGroupName = 'Map_Of_Modules_Status_LB' + title = 'Modules Status (0=Active+Good 1=Active+Bad 2=Inactive)' + define2DProfLayers(helper, alg, histoGroupName, title, pathLowStat, type='TProfile2D', lifecycle='lowStat') + + histoGroupName = 'BadModules_per_lumi' + title = 'Number of bad modules (bad+active) per event per LB' + yaxistext = ';# modules/event' + define1DProfLumiLayers(helper, alg, histoGroupName, title, path, yaxistext, type='TProfile') + + histoGroupName = 'DisabledModules_per_lumi' + title = 'Number of disabled modules per event per LB' + yaxistext = ';# modules/event' + define1DProfLumiLayers(helper, alg, histoGroupName, title, path, yaxistext, type='TProfile') + +### end status histograms +### begin track histograms + path = '/Pixel/TrackOnTrack/' + pathLowStat = '/Pixel/LumiBlockOnTrack/' + + histoGroupName = 'TSOS_Measurement' + title = 'TSOS of type Measurement' + define2DProfLayers(helper, alg, histoGroupName, title, path, type='TH2F') + + histoGroupName = 'TSOS_Hole' + title = 'TSOS of type Hole' + define2DProfLayers(helper, alg, histoGroupName, title, path, type='TH2F') + + histoGroupName = 'TSOS_Outlier' + title = 'TSOS of type Outlier' + define2DProfLayers(helper, alg, histoGroupName, title, path, type='TH2F') + + histoGroupName = 'HitEff_all' + title = 'hit efficiency' + yaxistext = ';hit efficiency' + define1DProfLumiLayers(helper, alg, histoGroupName, title, path, yaxistext, type='TProfile') + + histoGroupName = 'HolesRatio' + title = 'Holes per track' + define2DProfLayers(helper, alg, histoGroupName, title, path, type='TProfile2D') + + histoGroupName = 'MissHitsRatio' + title = 'Hole+Outlier per track' + define2DProfLayers(helper, alg, histoGroupName, title, path, type='TProfile2D') + + + varName = 'res_phi' + title = fullDressTitle('Pixel Residual LocX(phi)', False, ';Residual LocX(phi)',';# measurements on track') + trackGroup = helper.addGroup(alg, 'Track_res_phi') + varName += ';Track_res_phi' + trackGroup.defineHistogram(varName, + type='TH1F', path=path, title=title, + xbins=100, xmin=-0.1, xmax=0.1) + varName = 'res_eta' + title = fullDressTitle('Pixel Residual LocY(eta)', False, ';Residual LocY(eta)',';# measurements on track') + trackGroup = helper.addGroup(alg, 'Track_res_eta') + varName += ';Track_res_eta' + trackGroup.defineHistogram(varName, + type='TH1F', path=path, title=title, + xbins=100, xmin=-0.3, xmax=0.3) + varName = 'pull_phi' + title = fullDressTitle('Pixel Pull LocX(phi)', False, ';Pull LocX(phi)',';# measurements on track') + trackGroup = helper.addGroup(alg, 'Track_pulls_phi') + varName += ';Track_pulls_phi' + trackGroup.defineHistogram(varName, + type='TH1F', path=path, title=title, + xbins=100, xmin=-1.2, xmax=1.2) + varName = 'pull_eta' + title = fullDressTitle('Pixel Pull LocY(eta)', False, ';Pull LocY(eta)',';# measurements on track') + trackGroup = helper.addGroup(alg, 'Track_pulls_eta') + varName += ';Track_pulls_eta' + trackGroup.defineHistogram(varName, + type='TH1F', path=path, title=title, + xbins=100, xmin=-2.0, xmax=2.0) + varName = 'fit_chi2byndf' + title = fullDressTitle('chi2/ndf of track', False, ';#chi^{2}/DoF',';# of tracks') + trackGroup = helper.addGroup(alg, 'Track_chi2byndf') + varName += ';Track_chi2byndf' + trackGroup.defineHistogram(varName, + type='TH1F', path=path, title=title, + xbins=50, xmin=-0., xmax=10.0) + + varName = 'pixclusmontool_lb,ntrks_per_event' + title = fullDressTitle('Number of tracks per event per LB', False, ';lumi block', ';tracks/event') + trackGroup = helper.addGroup(alg, 'tracksPerEvt_per_lumi') + varName += ';tracksPerEvt_per_lumi' + trackGroup.defineHistogram(varName, + type='TProfile', path=path, title=title, + xbins=lumibinsx, xmin=-0.5, xmax=-0.5+lumibinsx) + + varName = 'pixclusmontool_lb,npixhits_per_track' + title = fullDressTitle('Number of pixhits per track per LB', False, ';lumi block', ';number of hits') + trackGroup = helper.addGroup(alg, 'NPixhits_per_track_lumi') + varName += ';NPixhits_per_track_lumi' + trackGroup.defineHistogram(varName, + type='TH2F', path=path, title=title, weight='npixhits_per_track_wgt', + xbins=lumibinsx, xmin=-0.5, xmax=-0.5+lumibinsx, + ybins=10, ymin=-0.5, ymax=9.5) + + if doOnline: + histoGroupName = 'HolesRatio_5min' + title = 'Holes per track reset every 5 min' + define2DProfLayers(helper, alg, histoGroupName, title, path, type='TProfile2D', zmin=0, zmax=1.1, opt='kLBNHistoryDepth=5') + + histoGroupName = 'MissHitsRatio_5min' + title = 'Hole+Outlier per track reset every 5 min' + define2DProfLayers(helper, alg, histoGroupName, title, path, type='TProfile2D', zmin=0, zmax=1.1, opt='kLBNHistoryDepth=5') + +### end track histograms +### begin cluster histograms + path = '/Pixel/Clusters' + pathLowStat = '/Pixel/LumiBlock' + pathTiming = '/Pixel/Timing' + +### begin cluster timing +### + for ontrack in True,False: + pathGroup = addOnTrackToPath(pathTiming, ontrack) + varName = 'Cluster_LVL1A_lvl1a' + title = fullDressTitle('Cluster Level 1 Accept', ontrack, ';LVL1A',';# clusters/event') + clusterGroup = helper.addGroup(alg, addOnTrackTxt('Cluster_LVL1A', ontrack) ) + varName += ';'+ addOnTrackTxt('Cluster_LVL1A', ontrack) + clusterGroup.defineHistogram(varName, + type='TH1F', path=pathGroup, title=title, + xbins=14, xmin=-1.5, xmax=12.5) + + histoGroupName = addOnTrackTxt('Cluster_LVL1A_Mod', ontrack) + title = addOnTrackTxt('Average cluster Level 1 Accept', ontrack, True) + define2DProfLayers(helper, alg, histoGroupName, title, pathGroup, type='TProfile2D') + + histoGroupName = addOnTrackTxt('Cluster_LVL1A_SizeCut', ontrack) + title = addOnTrackTxt('Average Size>1 Cluster Level 1 Accept', ontrack, True) + define2DProfLayers(helper, alg, histoGroupName, title, pathGroup, type='TProfile2D') + + varName = 'Cluster_LVL1A_lvl1a' # re-using sam e variable + histoGroupName = addOnTrackTxt('Cluster_LVL1A_ToTCut', ontrack) + xaxistext = ';LVL1A' + yaxistext = ';# clusters/event' + for idx, layer in enumerate(layers): + groupname = histoGroupName + '_{0}'.format(layer) + title = addOnTrackTxt('Cluster Level 1 Accept with ToT > {0}'.format(totcuts[idx]), ontrack, True) + fulltitle = title + ' {0}'.format(layer) + runtext + xaxistext + yaxistext + layerGroup = helper.addGroup(alg, groupname) + fullvarstring = varName + ';' + groupname + layerGroup.defineHistogram(fullvarstring, + type='TH1F', path=pathGroup, title=fulltitle, + xbins=14, xmin=-1.5, xmax=12.5) +### +### end cluster timing +### begin cluster sizes +### + if ontrack: + pathGroup = addOnTrackToPath(path, ontrack) + var1Name = addOnTrackTxt('Cluster_Size', ontrack) + '_em' + var2Name = addOnTrackTxt('Cluster_Size', ontrack) + '_clsize' + histoGroupName = addOnTrackTxt('Cluster_groupsize_vs_eta', ontrack) + xaxistext = ';Module eta index' + yaxistext = ';# pixels/cluster' + title = addOnTrackTxt('Number of pixels per cluster vs eta', ontrack, True) + for idx, layer in enumerate(layers): + groupname = histoGroupName + '_{0}'.format(layer) + fulltitle = title + ' {0}'.format(layer) + runtext + xaxistext + yaxistext + layerGroup = helper.addGroup(alg, groupname) + fullvarstring = var1Name + ',' + var2Name + ';' + groupname + layerGroup.defineHistogram(fullvarstring, + type='TProfile', path=pathGroup, title=fulltitle, + xbins=xbinsem[idx], xmin=xminsem[idx], xmax=xminsem[idx]+xbinsem[idx]) + + histoGroupName = addOnTrackTxt('Cluster_Size_Map', ontrack) + title = addOnTrackTxt('Average cluster size map', ontrack, True) + define2DProfLayers(helper, alg, histoGroupName, title, pathGroup, type='TProfile2D') + +### +### end cluster sizes +### begin cluster rates +### + pathGroup = addOnTrackToPath(path, ontrack) + + varName = 'pixclusmontool_lb,ncls_per_event' + title = fullDressTitle('Average number of pixel clusters per event per LB', ontrack, ';lumi block', ';clusters/event') + trackGroup = helper.addGroup(alg, addOnTrackTxt('Clusters_per_lumi', ontrack) ) + varName += ';'+ addOnTrackTxt('Clusters_per_lumi', ontrack) + trackGroup.defineHistogram(varName, + type='TProfile', path=pathGroup, title=title, + xbins=lumibinsx, xmin=-0.5, xmax=-0.5+lumibinsx) + + histoGroupName = addOnTrackTxt('Clusters_per_lumi', ontrack) + title = addOnTrackTxt('Average number of pixel clusters per event per LB', ontrack, True) + yaxistext = ';# clusters/event' + define1DProfLumiLayers(helper, alg, histoGroupName, title, pathGroup, yaxistext, type='TProfile') + + if ontrack: + varName = 'pixclusmontool_lb,cls_frac_ontrack' + title = fullDressTitle('Fraction pixel clusters on track per event per LB', False, ';lumi block', ';fraction clusters/event') + trackGroup = helper.addGroup(alg, 'ClustersOnOffTrack_per_lumi' ) + varName += ';ClustersOnOffTrack_per_lumi' + trackGroup.defineHistogram(varName, + type='TProfile', path=pathGroup, title=title, + xbins=lumibinsx, xmin=-0.5, xmax=-0.5+lumibinsx) + + + histoGroupName = 'num_clusters_per_track_per_lumi' + title = addOnTrackTxt('Number of pixel clusters per track per event', ontrack, True) + yaxistext = ';avg #clusters/track/event' + define1DProfLumiLayers(helper, alg, histoGroupName, title, pathGroup, yaxistext, type='TProfile') + + if doOnline: + histoGroupName = addOnTrackTxt('ClusterMap_Mon', ontrack) + title = addOnTrackTxt('Cluster map for monitoring', ontrack, True) + define2DProfLayers(helper, alg, histoGroupName, title, pathGroup, type='TH2D', zmin=0, zmax=1e4, opt='kLBNHistoryDepth=2') #FIXME zmax value w/ high stat + +### +### end cluster rates +### begin cluster occupancy +### + pathGroup = addOnTrackToPath(path, ontrack) + + histoGroupName = addOnTrackTxt('Cluster_Occupancy', ontrack) + title = addOnTrackTxt('Cluster occupancy', ontrack, True) + define2DProfLayers(helper, alg, histoGroupName, title, pathGroup, type='TH2D') + + histoGroupName = addOnTrackTxt('Clus_Occ_SizeCut', ontrack) + title = addOnTrackTxt('Size>1 Cluster occupancy', ontrack, True) + define2DProfLayers(helper, alg, histoGroupName, title, pathGroup, type='TH2D') + if ontrack: + histoGroupName = addOnTrackTxt('Cluster_Occupancy_PP0', ontrack) + title = addOnTrackTxt('Average per module(FE) cluster occupancy reset every 5 min', ontrack, True) + definePP0Histos(helper, alg, histoGroupName, title, pathGroup, opt='kLBNHistoryDepth=5') + + + pathGroup = addOnTrackToPath(pathLowStat, ontrack) + histoGroupName = addOnTrackTxt('Cluster_Occupancy_LB', ontrack) + title = addOnTrackTxt('Cluster occupancy lowStat', ontrack, True) + define2DProfLayers(helper, alg, histoGroupName, title, pathGroup, type='TH2D', lifecycle='lowStat') + + +### +### end cluster occupancy +### begin cluster ToT and charge +### + if ontrack: + pathGroup = addOnTrackToPath(path, ontrack) + histoGroupName = addOnTrackTxt('Cluster_ToTxCosAlpha', ontrack) + title = addOnTrackTxt('Cluster ToTxCosAlpha', ontrack, True) + define1DLayers(helper, alg, histoGroupName, title, pathGroup, ';ToT [BC]', ';# clusters', xbins=[300], xmins=[-0.5]) + if (not doOnline): + histoGroupName = addOnTrackTxt('Cluster_QxCosAlpha', ontrack) + title = addOnTrackTxt('Cluster Q normalized', ontrack, True) + define1DLayers(helper, alg, histoGroupName, title, pathGroup, ';Charge [e]', ';# clusters', xbins=[70], xmins=[-0.5], binsizes=[3000.]) + + +### +### end cluster ToT and charge + + + +### end cluster histograms + +def addOnTrackToPath(name, ontrack): + if ontrack: + name += 'OnTrack/' + else: + name += '/' + return name diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/python/PixelAthErrorMonToolCfg.py b/InnerDetector/InDetMonitoring/PixelMonitoring/python/PixelAthErrorMonToolCfg.py new file mode 100644 index 0000000000000000000000000000000000000000..922ceb623d16b33a1a7bae3f5c7b4e7b1fa674bd --- /dev/null +++ b/InnerDetector/InDetMonitoring/PixelMonitoring/python/PixelAthErrorMonToolCfg.py @@ -0,0 +1,33 @@ +# +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# + +''' +@file PixelAthErrorMonToolCfg.py +@brief Configuration of Pixel Error Monitoring Histograms for Run 3 +''' +from PixelMonitoring.PixelAthMonitoringBase import define2DProfLayers +from PixelMonitoring.PixelAthMonitoringBase import define1DLayers +from PixelMonitoring.PixelAthMonitoringBase import define1DProfLumiLayers +from PixelMonitoring.PixelAthMonitoringBase import layers, totcuts, xbinsem, xminsem, lumibinsx +from PixelMonitoring.PixelAthMonitoringBase import addOnTrackTxt, fullDressTitle +from RecExConfig.AutoConfiguration import GetRunNumber +runNumber = GetRunNumber() +runtext = ' (Run ' + str(runNumber) + ')' + +def PixelAthErrorMonToolCfg(helper, alg, **kwargs): + ''' + Arguments: + helper -- AthMonitorCfgHelper(Old) instance + alg -- algorithm Configurable object returned from addAlgorithm + kwargs -- jo agruments + ''' + doOnline = kwargs.get('doOnline', False) + + path = '/Pixel/Errors/' + pathLowStat = '/Pixel/LumiBlock/' + + histoGroupName = 'errors_per_lumi' + title = 'Average Total Errors' + yaxistext = ';# errors/event' + define1DProfLumiLayers(helper, alg, histoGroupName, title, path, yaxistext, type='TProfile') diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/python/PixelAthHitMonToolCfg.py b/InnerDetector/InDetMonitoring/PixelMonitoring/python/PixelAthHitMonToolCfg.py new file mode 100644 index 0000000000000000000000000000000000000000..1969cbaa577f4695cf806b9d2ab1ff1bb746cc7e --- /dev/null +++ b/InnerDetector/InDetMonitoring/PixelMonitoring/python/PixelAthHitMonToolCfg.py @@ -0,0 +1,28 @@ +# +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# + +''' +@file PixelAthHitMonToolCfg.py +@brief Configuration of Pixel Hit Monitoring Histograms for Run 3 +''' + +from PixelMonitoring.PixelAthMonitoringBase import define2DProfLayers +from PixelMonitoring.PixelAthMonitoringBase import define1DLayers +from PixelMonitoring.PixelAthMonitoringBase import define1DProfLumiLayers +from PixelMonitoring.PixelAthMonitoringBase import layers, totcuts, xbinsem, xminsem, lumibinsx +from PixelMonitoring.PixelAthMonitoringBase import addOnTrackTxt, fullDressTitle +from RecExConfig.AutoConfiguration import GetRunNumber +runNumber = GetRunNumber() +runtext = ' (Run ' + str(runNumber) + ')' + +def PixelAthHitMonToolCfg(helper, alg, **kwargs): + ''' + Arguments: + helper -- AthMonitorCfgHelper(Old) instance + alg -- algorithm Configurable object returned from addAlgorithm + kwargs -- jo agruments + ''' + path = '/Pixel/Hits/' + pathLowStat = '/Pixel/LumiBlock/' + diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/python/PixelAthMonitoringBase.py b/InnerDetector/InDetMonitoring/PixelMonitoring/python/PixelAthMonitoringBase.py new file mode 100644 index 0000000000000000000000000000000000000000..6f7f046cf7fba253254cd7a9db0b200c03c7b946 --- /dev/null +++ b/InnerDetector/InDetMonitoring/PixelMonitoring/python/PixelAthMonitoringBase.py @@ -0,0 +1,314 @@ +# +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# + +''' +@file PixelAthMonitoringBase.py +@brief Helper functions for Run 3 Pixel monitoring algorithm configuration +''' +from RecExConfig.AutoConfiguration import GetRunNumber +runNumber = GetRunNumber() +runtext = ' (Run ' + str(runNumber) + ')' + +NumLayersDisk = 3 +NumLayersDBM = 3 +NumStavesIBL = 14 +NumStavesL0 = 22 +NumStavesL1 = 38 +NumStavesL2 = 52 + +NumModulesIBL = 32 +NumModulesIBL2D = 12 +NumModulesIBL3D = 8 +NumModulesBarrel= 13 +NumModulesDisk = 48 +NumModulesDBM = 4 +NumPP0sEC = 24 + +btxt = ";eta index of module" +sbtxt = ";shifted eta index of module" +ditxt = ";disk number" +dbmtxt = ";layer number" +layers = ["ECA","ECC","B0","B1","B2","IBL","DBMA","DBMC"] +xbinsl = [ 3, 3, 13, 13, 13, 32, 3, 3] +xminsl = [ -0.5, -0.5,-6.5,-6.5,-6.5,-16.5, -0.5, -0.5] +ybinsl = [ 48, 48, 22, 38, 52, 14, 4, 4] +etatxt = [ditxt,ditxt,btxt,btxt,btxt,sbtxt,dbmtxt,dbmtxt] +phitext = ";phi index of module" +totcuts = [ 15, 15, 15, 15, 15, 4, 4, 4] +xbinsem = [ 3, 3, 13, 13, 13, 20, 3, 3] +xminsem = [ 0.5, 0.5,-6.5,-6.5,-6.5, -10, 0.5, 0.5] +xbinstotz= [ 3, 3, 13, 13, 13, 20, 3, 3] +xminstotz= [ -0.5, -0.5,-0.5,-0.5,-0.5, -0.5, -0.5, -0.5] + + +pp0layers= ["ECA","ECC","B0","B1","B2","IBLA","IBLC"] +pp0xbins = [ 24, 24, 22, 38, 52, 14, 14] + +lumitext = ";lumi block" +lumibinsx = 3000 + +#labels +LayersDisk = ["Disk 1", "Disk 2", "Disk 3"] #x EC +#xBarrel +ModulesBarrel = [ + "M6C", "M5C", "M4C", "M3C", "M2C", "M1C", "M0","M1A", "M2A", "M3A", "M4A", + "M5A", "M6A"] +#xIBL +ModulesIBL = [ + "C8", " ", "C7", " ", "C6", " ", "C5", " ", "C4", " ", "C3", " ", "C2", " ", + "C1", " ", "A1", " ", "A2", " ", "A3", " ", "A4", " ", "A5", " ", "A6", " ", + "A7", " ", "A8", " "] +LayersDBM = ["Layer 0", "Layer 1", "Layer 2"] #xDBM + +LabelX = [LayersDisk, LayersDisk, ModulesBarrel, ModulesBarrel, ModulesBarrel, ModulesIBL, LayersDBM, LayersDBM] + +ModulesECA = [ + "B01_S2_M1", "B01_S2_M6", "B01_S2_M2", "B01_S2_M5", "B01_S2_M3", + "B01_S2_M4", "B02_S1_M1", "B02_S1_M6", "B02_S1_M2", "B02_S1_M5", + "B02_S1_M3", "B02_S1_M4", "B02_S2_M1", "B02_S2_M6", "B02_S2_M2", + "B02_S2_M5", "B02_S2_M3", "B02_S2_M4", "B03_S1_M1", "B03_S1_M6", + "B03_S1_M2", "B03_S1_M5", "B03_S1_M3", "B03_S1_M4", "B03_S2_M1", + "B03_S2_M6", "B03_S2_M2", "B03_S2_M5", "B03_S2_M3", "B03_S2_M4", + "B04_S1_M1", "B04_S1_M6", "B04_S1_M2", "B04_S1_M5", "B04_S1_M3", + "B04_S1_M4", "B04_S2_M1", "B04_S2_M6", "B04_S2_M2", "B04_S2_M5", + "B04_S2_M3", "B04_S2_M4", "B01_S1_M1", "B01_S1_M6", "B01_S1_M2", + "B01_S1_M5", "B01_S1_M3", "B01_S1_M4"] +ModulesECC = [ + "B01_S2_M4", "B01_S2_M3", "B01_S2_M5", "B01_S2_M2", "B01_S2_M6", + "B01_S2_M1", "B02_S1_M4", "B02_S1_M3", "B02_S1_M5", "B02_S1_M2", + "B02_S1_M6", "B02_S1_M1", "B02_S2_M4", "B02_S2_M3", "B02_S2_M5", + "B02_S2_M2", "B02_S2_M6", "B02_S2_M1", "B03_S1_M4", "B03_S1_M3", + "B03_S1_M5", "B03_S1_M2", "B03_S1_M6", "B03_S1_M1", "B03_S2_M4", + "B03_S2_M3", "B03_S2_M5", "B03_S2_M2", "B03_S2_M6", "B03_S2_M1", + "B04_S1_M4", "B04_S1_M3", "B04_S1_M5", "B04_S1_M2", "B04_S1_M6", + "B04_S1_M1", "B04_S2_M4", "B04_S2_M3", "B04_S2_M5", "B04_S2_M2", + "B04_S2_M6", "B04_S2_M1", "B01_S1_M4", "B01_S1_M3", "B01_S1_M5", + "B01_S1_M2", "B01_S1_M6", "B01_S1_M1"] + +ModulesDBM = ["M3", "M4", "M1", "M2"] #yDBM + + +#yBarrel +StavesL0 = [ + "B11_S2", "B01_S1", "B01_S2", "B02_S1", "B02_S2", "B03_S1", "B03_S2", + "B04_S1", "B04_S2", "B05_S1", "B05_S2", "B06_S1", "B06_S2", "B07_S1", + "B07_S2", "B08_S1", "B08_S2", "B09_S1", "B09_S2", "B10_S1", "B10_S2", + "B11_S1"] + + +StavesL1 = [ + "B01_S1", "B01_S2", "B02_S1", "B02_S2", "B03_S1", "B03_S2", "B04_S1", + "B04_S2", "B05_S1", "B05_S2", "B06_S1", "B06_S2", "B07_S1", "B07_S2", + "B08_S1", "B08_S2", "B09_S1", "B09_S2", "B10_S1", "B10_S2", "B11_S1", + "B11_S2", "B12_S1", "B12_S2", "B13_S1", "B13_S2", "B14_S1", "B14_S2", + "B15_S1", "B15_S2", "B16_S1", "B16_S2", "B17_S1", "B17_S2", "B18_S1", + "B18_S2", "B19_S1", "B19_S2"] + +StavesL2 = [ + "B01_S2", "B02_S1", "B02_S2", "B03_S1", "B03_S2", "B04_S1", "B04_S2", + "B05_S1", "B05_S2", "B06_S1", "B06_S2", "B07_S1", "B07_S2", "B08_S1", + "B08_S2", "B09_S1", "B09_S2", "B10_S1", "B10_S2", "B11_S1", "B11_S2", + "B12_S1", "B12_S2", "B13_S1", "B13_S2", "B14_S1", "B14_S2", "B15_S1", + "B15_S2", "B16_S1", "B16_S2", "B17_S1", "B17_S2", "B18_S1", "B18_S2", + "B19_S1", "B19_S2", "B20_S1", "B20_S2", "B21_S1", "B21_S2", "B22_S1", + "B22_S2", "B23_S1", "B23_S2", "B24_S1", "B24_S2", "B25_S1", "B25_S2", + "B26_S1", "B26_S2", "B01_S1"] +#yIBL +StavesIBL = [ + "S01", "S02", "S03", "S04", "S05", "S06", "S07", "S08", "S09", "S10", "S11", + "S12", "S13","S14"] + +LabelY = [ModulesECA, ModulesECC, StavesL0, StavesL1, StavesL2, StavesIBL, ModulesDBM, ModulesDBM] + +#PP0 +PP0sEC = [ + "D1_B01_S2", "D1_B02_S1", "D1_B02_S2", "D1_B03_S1", "D1_B03_S2", "D1_B04_S1", "D1_B04_S2", "D1_B01_S1", + "D2_B01_S2", "D2_B02_S1", "D2_B02_S2", "D2_B03_S1", "D2_B03_S2", "D2_B04_S1", "D2_B04_S2", "D2_B01_S1", + "D3_B01_S2", "D3_B02_S1", "D3_B02_S2", "D3_B03_S1", "D3_B03_S2", "D3_B04_S1", "D3_B04_S2", "D3_B01_S1"] + +PP0LabelX = [PP0sEC, PP0sEC, StavesL0, StavesL1, StavesL2, StavesIBL, StavesIBL] + + + + +def define2DProfLayers(helper, alg, name, title, path, type='TProfile2D', doWeight=False, lifecycle='run', zmin=None, zmax=None, opt='', subDir=False): + ''' + This function configures 2D (Profile) histograms (or maps) for Pixel layers. + + Arguments: + helper -- AthMonitorCfgHelper(Old) instance + alg -- algorithm Configurable object returned from addAlgorithm + name -- Name of histogram (Name = name_layer) + title -- Title of histogram (Title = title +' '+layer) + path -- Path in ouput file for histogram + type -- Type of histogram (TH2D, TProfile2D) + lifecycle -- global life duration of histograms (run, lowstat [i.e. 20 LB], lumiblock) - APPLIES to MonGroup only + zmin(zmax) -- fix the displayed range - simply chopping the range!!! + opt -- history depth of a histogram e.g. 'kLBNHistoryDepth=10' + subDir -- Put the configured histograms into sub directory named like partion (True, False) + ''' + for i, layer in enumerate(layers): + groupname = name + '_{0}'.format(layer) + fulltitle = title + ' {0}'.format(layer) + runtext + etatxt[i] + phitext + if lifecycle != 'run': + layerGroup = helper.addGroup(alg, groupname, defaultDuration=str(lifecycle) ) + else : + layerGroup = helper.addGroup(alg, groupname) + + # sequential list of x- and y-axis bin labels (see defineHistogram) + labels = [] + for label in LabelX[i]: + labels.append(label) + for label in LabelY[i]: + labels.append(label) + fullvarstring = '{0}_{1},{0}_{2}'.format(groupname, 'em', 'pm') + if 'Profile' in type: fullvarstring += ',{0}_{1}'.format(groupname, 'val') + if doWeight: + weightvar = '{0}_{1}'.format(groupname, 'wgt') + else : + weightvar = '' + fullvarstring += ';' + groupname + layerGroup.defineHistogram(fullvarstring, + type=type, path=path, title=fulltitle, weight=weightvar, + xbins=xbinsl[i], xmin=xminsl[i], xmax=xminsl[i]+xbinsl[i], + ybins=ybinsl[i], ymin=-0.5, ymax=-0.5+ybinsl[i], + zmin=zmin, zmax=zmax, + opt=opt, labels=labels) + +def definePP0Histos(helper, alg, name, title, path, opt=''): + ''' + This function configures TProfile histograms for Pixel layers per pp0 or ROD. + + Arguments: + helper -- AthMonitorCfgHelper(Old) instance + alg -- algorithm Configurable object returned from addAlgorithm + name -- Name of histogram (Name = name_layer) + title -- Title of histogram (Title = title +' '+layer) + path -- Path in ouput file for histogram + opt -- history depth of a histogram e.g. 'kLBNHistoryDepth=10' + ''' + + for i, layer in enumerate(pp0layers): + if i<2: + xatxt = ';sector' + else : + xatxt = ';stave' + yatxt = ';average # clusters per event per ' + if i>4: + yatxt += 'FE' + else : + yatxt += 'module' + fulltitle = title + ' {0}'.format(layer) + runtext + xatxt + yatxt + groupname = name + '_{0}'.format(layer) + layerGroup = helper.addGroup(alg, groupname) + # sequential list of x-axis bin labels (see defineHistogram) + labels = [] + for label in PP0LabelX[i]: + labels.append(label) + fullvarstring = '{0}_{1},{0}_{2}'.format(name, 'pos', 'val') + fullvarstring += ';' + groupname + layerGroup.defineHistogram(fullvarstring, + type='TProfile', path=path, title=fulltitle, + xbins=pp0xbins[i], xmin=-0.5, xmax=-0.5+pp0xbins[i], + opt=opt, labels=labels) + + + +def define1DProfLumiLayers(helper, alg, name, title, path, yaxistext, type='TProfile'): + ''' + This function configures 1D (Profile) vs lumi histograms for Pixel layers. + + Arguments: + helper -- AthMonitorCfgHelper(Old) instance + alg -- algorithm Configurable object returned from addAlgorithm + name -- Name of histogram (Name = name_layer) + title -- Title of histogram (Title = title +' '+layer) + path -- Path in ouput file for histogram + type -- Type of histogram (TH1D, TProfile) + zmin(zmax) -- fix the displayed range + ''' + + for layer in layers: + groupname = name + '_{0}'.format(layer) + fulltitle = title + ' {0}'.format(layer) + runtext + lumitext + yaxistext + layerGroup = helper.addGroup(alg, groupname) + fullvarstring = '{0}_{1}'.format(name,'lb') + if 'Profile' in type: fullvarstring += ',{0}_{1}'.format(name, 'val') + fullvarstring += ';' + groupname + layerGroup.defineHistogram(fullvarstring, + type=type, path=path, title=fulltitle, + xbins=lumibinsx, xmin=-0.5, xmax=-0.5+lumibinsx) + +def defineMapVsLumiLayers(helper, alg, name, title, path, ybins, ymin, ymax, yaxistext, type='TH2F'): + ''' + This function configures 1D (Profile) vs lumi histograms for Pixel layers. + + Arguments: + helper -- AthMonitorCfgHelper(Old) instance + alg -- algorithm Configurable object returned from addAlgorithm + name -- Name of histogram (Name = name_layer) + title -- Title of histogram (Title = title +' '+layer) + path -- Path in ouput file for histogram + type -- Type of TH2 histogram (TH2I, TH2F) + zmin(zmax) -- fix the displayed range + ''' + + for layer in layers: + groupname = name + '_{0}'.format(layer) + fulltitle = title + ' {0}'.format(layer) + runtext + lumitext + yaxistext + layerGroup = helper.addGroup(alg, groupname) + fullvarstring = '{0}_{1}'.format(name,'lb') + fullvarstring += ',{0}_{1}'.format(name, 'yval') + fullvarstring += ';' + groupname + layerGroup.defineHistogram(fullvarstring, + type=type, path=path, title=fulltitle, + xbins=lumibinsx, xmin=-0.5, xmax=-0.5+lumibinsx, + ybins=ybins, ymin=ymin, ymax=ymax) + + + +def define1DLayers(helper, alg, name, title, path, xaxistext, yaxistext, xbins, xmins, binsizes=[1.0], type='TH1F'): + ''' + This function configures 1D (Profile) histograms for Pixel layers. + + Arguments: + helper -- AthMonitorCfgHelper(Old) instance + alg -- algorithm Configurable object returned from addAlgorithm + name -- Name of histogram (Name = name+'_'+layer) + title -- Title of histogram (Title = title +' '+layer) + path -- Path in ouput file for histogram + xaxistext -- X-axis title + yaxistext -- Y-axis title + type -- Type of histogram + *name* -- name of the variable to fill (_common_ to all layers) + ''' + + for idx,layer in enumerate(layers): + groupname = name + '_{0}'.format(layer) + fulltitle = title + ' {0}'.format(layer) + runtext + xaxistext + yaxistext + layerGroup = helper.addGroup(alg, groupname) + fullvarstring = '{0}_{1}'.format(name,'val') + fullvarstring += ';' + groupname + if ( len(xbins)==1 and len(xmins)==1 and len(binsizes)==1): + layerGroup.defineHistogram(fullvarstring, + type=type, path=path, title=fulltitle, + xbins=xbins[0], xmin=xmins[0], xmax=xmins[0]+binsizes[0]*xbins[0]) + elif (len(xbins)==len(layers) and len(xmins)==len(layers) and len(binsizes)==len(layers)): + layerGroup.defineHistogram(fullvarstring, + type=type, path=path, title=fulltitle, + xbins=xbins[idx], xmin=xmins[idx], xmax=xmins[idx]+binsizes[idx]*xbins[idx]) + +def addOnTrackTxt(name, ontrack, wSpace=False): + if ontrack: + if wSpace: + name += ' OnTrack' + else: + name += '_OnTrack' + return name + +def fullDressTitle(name, ontrack, xaxistext, yaxistext): + if ontrack: + name += ' OnTrack' + name += runtext + xaxistext + yaxistext + return name diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/src/Clusters.cxx b/InnerDetector/InDetMonitoring/PixelMonitoring/src/Clusters.cxx deleted file mode 100644 index 8a1a2cf9034b55e299812917fc6b43d51797abd5..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetMonitoring/PixelMonitoring/src/Clusters.cxx +++ /dev/null @@ -1,809 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -/////////////////////////////////////////////////////////////////////////////// -// Book and fill histograms showing pixel cluster properties -/////////////////////////////////////////////////////////////////////////////// - -#include <sstream> -#include "InDetIdentifier/PixelID.h" -#include "InDetPrepRawData/PixelClusterContainer.h" -#include "InDetRawData/InDetTimeCollection.h" -#include "LWHists/TH1F_LW.h" -#include "LWHists/TH1I_LW.h" -#include "LWHists/TH2F_LW.h" -#include "LWHists/TH2I_LW.h" -#include "LWHists/TProfile2D_LW.h" -#include "LWHists/TProfile_LW.h" -#include "PixelMonitoring/PixelMainMon.h" -#include "TH1F.h" -#include "TH1I.h" -#include "TH2F.h" -#include "TH2I.h" -#include "TProfile.h" - -#include "PixelMonitoring/Components.h" -#include "PixelMonitoring/PixelMon2DMapsLW.h" -#include "PixelMonitoring/PixelMon2DProfilesLW.h" -#include "PixelMonitoring/PixelMonModules.h" - -/////////////////////////////////////////////////////////////////////////////// -//////////////////////booking methods////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -StatusCode PixelMainMon::bookClustersMon(void) { - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "start booking pixel cluster monitoring histograms" << endmsg; - - std::string path = "Pixel/Clusters"; - if (m_doOnTrack) path.replace(path.begin(), path.end(), "Pixel/ClustersOnTrack"); - MonGroup clusterShift(this, path.c_str(), run, ATTRIB_MANAGED); // declare a group of histograms - MonGroup clusterExpert(this, path.c_str(), run, ATTRIB_MANAGED); // declare a group of histograms - - std::string pathT = "Pixel/Timing"; - if (m_doOnTrack) pathT.replace(pathT.begin(), pathT.end(), "Pixel/TimingOnTrack"); - MonGroup timeShift(this, pathT.c_str(), run, ATTRIB_MANAGED); // declare a group of histograms - MonGroup timeExpert(this, pathT.c_str(), run, ATTRIB_MANAGED); // declare a group of histograms - - std::string addOnTrack = "_OnTrack"; - - int nbins_LB = m_lbRange; - double min_LB = -0.5; - double max_LB = min_LB + (1.0 * nbins_LB); - int nbins_BCID = m_bcidRange; - double min_BCID = -0.5; - double max_BCID = min_BCID + (1.0 * nbins_BCID); - int nbins_npix = 300; - double min_npix = -0.5; - double max_npix = min_npix + (1.0 * nbins_npix); - int nbins_nwid = 50; - double min_nwid = -0.5; - double max_nwid = min_nwid + (1.0 * nbins_nwid); - int nbins_eta = 13; - double min_eta = -6.5; - double max_eta = min_eta + (1.0 * nbins_eta); - int nbins_tot = 300; - double min_tot = -0.5; - double max_tot = min_tot + (1.0 * nbins_tot); - int nbins_ibl_tot = 300; - double min_ibl_tot = -0.5; - double max_ibl_tot = min_ibl_tot + (1.0 * nbins_ibl_tot); - int nbins_Q = 70; - double min_Q = -0.5; - double max_Q = min_Q + (3000.0 * nbins_Q); - int nbins_lvl1 = 14; - double min_lvl1 = -1.5; - double max_lvl1 = min_lvl1 + (1.0 * nbins_lvl1); - std::string atext_LB = ";lumi block"; - std::string atext_BCID = ";BCID"; - std::string atext_clu = ";# clusters/event"; - std::string atext_npix = ";# pixels/cluster"; - std::string atext_nclu = ";# clusters"; - std::string atext_nevt = ";# events"; - std::string atext_cluw = ";cluster width"; - std::string atext_eta = ";Module eta index"; - std::string atext_tot = ";ToT [BC]"; - std::string atext_Q = ";Charge [e]"; - std::string atext_lvl1 = ";LVL1A"; - std::string tmp; - std::string tmp2; - std::string atitles; - std::string hname; - std::string htitles; - - StatusCode sc; - - hname = makeHistname("ClusterSize_vs_eta", false); - htitles = makeHisttitle("Average cluster size as a function of barrel module eta", (atext_eta + atext_cluw), false); - sc = clusterExpert.regHist(m_clusterSize_eta = TProfile_LW::create(hname.c_str(), htitles.c_str(), nbins_eta, min_eta, max_eta)); - - hname = makeHistname("Clusters_per_lumi", true); - htitles = makeHisttitle("Average number of pixel clusters per event", (atext_LB + atext_clu), true); - sc = clusterShift.regHist(m_clusters_per_lumi = TProfile_LW::create(hname.c_str(), htitles.c_str(), nbins_LB, min_LB, max_LB)); - - hname = makeHistname("TotalClusters_per_lumi", true); - htitles = makeHisttitle("Total number of pixel clusters", (atext_LB + atext_nclu), true); - sc = clusterShift.regHist(m_totalclusters_per_lumi = TH1I_LW::create(hname.c_str(), htitles.c_str(), nbins_LB, min_LB, max_LB)); - - hname = makeHistname("Cluster_groupsize", true); - htitles = makeHisttitle("Number of pixels in a cluster", (atext_npix + atext_nclu), true); - sc = clusterExpert.regHist(m_cluster_groupsize = TH1F_LW::create(hname.c_str(), htitles.c_str(), nbins_npix, min_npix, max_npix)); - - hname = makeHistname("Cluster_column_width", false); - htitles = makeHisttitle("Column width of a cluster", (atext_cluw + atext_nclu), false); - sc = clusterExpert.regHist(m_cluster_col_width = TH1F_LW::create(hname.c_str(), htitles.c_str(), nbins_nwid, min_nwid, max_nwid)); - - hname = makeHistname("Cluster_row_width", false); - htitles = makeHisttitle("Row width of a cluster", (atext_cluw + atext_nclu), false); - sc = clusterExpert.regHist(m_cluster_row_width = TH1F_LW::create(hname.c_str(), htitles.c_str(), nbins_nwid, min_nwid, max_nwid)); - - hname = makeHistname("Cluster_LVL1A", true); - htitles = makeHisttitle("Cluster Level 1 Accept", (atext_lvl1 + atext_nclu), true); - sc = timeShift.regHist(m_cluster_LVL1A = TH1F_LW::create(hname.c_str(), htitles.c_str(), nbins_lvl1, min_lvl1, max_lvl1)); - - // per-layer histograms - const unsigned int kNumLayers = m_doIBL ? PixLayer::COUNT : PixLayer::COUNT - 1; - for (unsigned int i = 0; i < kNumLayers; i++) { - enum PixLayerIBL2D3D::PixLayerIBL2D3DID i1 = (enum PixLayerIBL2D3D::PixLayerIBL2D3DID) i; - hname = makeHistname(("Clusters_per_lumi_" + m_modLabel_PixLayerIBL2D3D[i1]), false); - htitles = makeHisttitle(("Average number of pixel clusters per event per LB, " + m_modLabel_PixLayerIBL2D3D[i1]), (atext_LB + atext_clu), false); - sc = clusterExpert.regHist(m_clusters_per_lumi_mod[i] = TProfile_LW::create(hname.c_str(), htitles.c_str(), nbins_LB, min_LB, max_LB)); - - hname = makeHistname(("Cluster_LVL1A_" + m_modLabel_PixLayerIBL2D3D[i1]), true); - if (i != PixLayer::kIBL) { - htitles = makeHisttitle(("Cluster Level 1 Accept with ToT > 15, " + m_modLabel_PixLayerIBL2D3D[i1]), (atext_lvl1 + atext_nclu), false); - } else { - htitles = makeHisttitle(("Cluster Level 1 Accept with ToT > 4, " + m_modLabel_PixLayerIBL2D3D[i1]), (atext_lvl1 + atext_nclu), false); - } - sc = timeExpert.regHist(m_cluster_LVL1A1d_mod[i] = TH1F_LW::create(hname.c_str(), htitles.c_str(), nbins_lvl1, min_lvl1, max_lvl1)); - - hname = makeHistname(("Cluster_groupsize_vs_eta_" + m_modLabel_PixLayerIBL2D3D[i1]), false); - htitles = makeHisttitle(("Number of pixels per cluster vs eta, " + m_modLabel_PixLayerIBL2D3D[i1]), (atext_eta + atext_npix), false); - sc = clusterExpert.regHist(m_clussize_vs_eta_mod[i] = TProfile_LW::create(hname.c_str(), htitles.c_str(), nbins_eta, min_eta, max_eta)); - } - - for (int i = 0; i < PixLayerIBL2D3DDBM::COUNT; i++) { - hname = makeHistname(("Cluster_ToT_" + m_modLabel_PixLayerIBL2D3DDBM[i]), false); - htitles = makeHisttitle(("Cluster ToT, " + m_modLabel_PixLayerIBL2D3DDBM[i]), (atext_tot + atext_nclu), false); - if (i < PixLayerIBL2D3DDBM::kIBL) { - sc = clusterExpert.regHist(m_cluster_ToT1d_mod[i] = TH1F_LW::create(hname.c_str(), htitles.c_str(), nbins_tot, min_tot, max_tot)); - } else { - sc = clusterExpert.regHist(m_cluster_ToT1d_mod[i] = TH1F_LW::create(hname.c_str(), htitles.c_str(), nbins_ibl_tot, min_ibl_tot, max_ibl_tot)); - } - - hname = makeHistname(("Cluster_Q_" + m_modLabel_PixLayerIBL2D3DDBM[i]), false); - htitles = makeHisttitle(("Charge, " + m_modLabel_PixLayerIBL2D3DDBM[i]), (atext_Q + atext_nclu), false); - sc = clusterExpert.regHist(m_cluster_Q_mod[i] = TH1F_LW::create(hname.c_str(), htitles.c_str(), nbins_Q, min_Q, max_Q)); - - if (m_doOnTrack) { - hname = makeHistname(("Cluster_ToTxCosAlpha_" + m_modLabel_PixLayerIBL2D3DDBM[i]), false); - htitles = makeHisttitle(("Cluster ToTxCosAlpha, " + m_modLabel_PixLayerIBL2D3DDBM[i]), (atext_tot + atext_nclu), false); - if (i < PixLayerIBL2D3DDBM::kIBL) { - sc = clusterExpert.regHist(m_cluster_ToT1d_corr[i] = TH1F_LW::create(hname.c_str(), htitles.c_str(), nbins_tot, min_tot, max_tot)); - } else { - sc = clusterExpert.regHist(m_cluster_ToT1d_corr[i] = TH1F_LW::create(hname.c_str(), htitles.c_str(), nbins_ibl_tot, min_ibl_tot, max_ibl_tot)); - } - hname = makeHistname(("Cluster_QxCosAlpha_" + m_modLabel_PixLayerIBL2D3DDBM[i]), false); - htitles = makeHisttitle(("Corrected charge, " + m_modLabel_PixLayerIBL2D3DDBM[i]), (atext_Q + atext_nclu), false); - sc = clusterExpert.regHist(m_cluster_Q_corr[i] = TH1F_LW::create(hname.c_str(), htitles.c_str(), nbins_Q, min_Q, max_Q)); - } - - hname = makeHistname(("Cluster_groupsize_" + m_modLabel_PixLayerIBL2D3DDBM[i]), false); - htitles = makeHisttitle(("Number of pixels in a cluster, " + m_modLabel_PixLayerIBL2D3DDBM[i]), (atext_npix + atext_nclu), false); - sc = clusterExpert.regHist(m_cluster_groupsize_mod[i] = TH1F_LW::create(hname.c_str(), htitles.c_str(), nbins_npix + 1, min_npix, max_npix + 1)); - } - - for (int i = 0; i < PixLayerIBL2D3D::COUNT; i++) { - hname = makeHistname(("Cluster_column_width_" + m_modLabel_PixLayerIBL2D3D[i]), false); - htitles = makeHisttitle(("Column width of a cluster, " + m_modLabel_PixLayerIBL2D3D[i]), (atext_cluw + atext_nclu), false); - sc = clusterExpert.regHist(m_cluster_col_width_mod[i] = TH1F_LW::create(hname.c_str(), htitles.c_str(), nbins_nwid, min_nwid, max_nwid)); - - hname = makeHistname(("Cluster_row_width_" + m_modLabel_PixLayerIBL2D3D[i]), false); - htitles = makeHisttitle(("Row width of a cluster, " + m_modLabel_PixLayerIBL2D3D[i]), (atext_cluw + atext_nclu), false); - sc = clusterExpert.regHist(m_cluster_row_width_mod[i] = TH1F_LW::create(hname.c_str(), htitles.c_str(), nbins_nwid, min_nwid, max_nwid)); - - hname = makeHistname(("TotalClusters_per_lumi_" + m_modLabel_PixLayerIBL2D3D[i]), false); - htitles = makeHisttitle(("Total number of pixel clusters per LB, " + m_modLabel_PixLayerIBL2D3D[i]), (atext_LB + atext_nclu), false); - sc = clusterExpert.regHist(m_totalclusters_per_lumi_mod[i] = TH1I_LW::create(hname.c_str(), htitles.c_str(), nbins_LB, min_LB, max_LB)); - - hname = makeHistname(("TotalClusters_per_bcid_" + m_modLabel_PixLayerIBL2D3D[i]), false); - htitles = makeHisttitle(("Total number of pixel clusters per BCID, " + m_modLabel_PixLayerIBL2D3D[i]), (atext_LB + atext_nclu), false); - - hname = makeHistname(("Clusters_row_width_per_lumi_" + m_modLabel_PixLayerIBL2D3D[i]), true); - htitles = makeHisttitle("Average row width per LB", (atext_LB + atext_clu), true); - sc = clusterShift.regHist(m_clusters_row_width_per_lumi_mod[i] = TProfile_LW::create(hname.c_str(), htitles.c_str(), nbins_LB, min_LB, max_LB)); - - hname = makeHistname(("Clusters_column_width_per_lumi_" + m_modLabel_PixLayerIBL2D3D[i]), true); - htitles = makeHisttitle("Average column width per LB", (atext_LB + atext_clu), true); - sc = clusterShift.regHist(m_clusters_col_width_per_lumi_mod[i] = TProfile_LW::create(hname.c_str(), htitles.c_str(), nbins_LB, min_LB, max_LB)); - - hname = makeHistname(("Clusters_row_width_per_bcid_" + m_modLabel_PixLayerIBL2D3D[i]), true); - htitles = makeHisttitle("Average row width per BCID", (atext_BCID + atext_clu), true); - sc = clusterShift.regHist(m_clusters_row_width_per_bcid_mod[i] = TProfile_LW::create(hname.c_str(), htitles.c_str(), nbins_BCID, min_BCID, max_BCID)); - - hname = makeHistname(("Clusters_column_width_per_bcid_" + m_modLabel_PixLayerIBL2D3D[i]), true); - htitles = makeHisttitle("Average column width per BCID", (atext_BCID + atext_clu), true); - sc = clusterShift.regHist(m_clusters_col_width_per_bcid_mod[i] = TProfile_LW::create(hname.c_str(), htitles.c_str(), nbins_BCID, min_BCID, max_BCID)); - - hname = makeHistname(("ClusterSize_OnTrack_" + m_modLabel_PixLayerIBL2D3D[i]), false); - htitles = makeHisttitle(("cluster size for clusters on tracks, " + m_modLabel_PixLayerIBL2D3D[i]), ";cluster size;#clusters", false); - sc = clusterExpert.regHist(m_clusize_ontrack_mod[i] = TH1F_LW::create(hname.c_str(), htitles.c_str(), 300, -0.5, -0.5 + 300.0)); - - hname = makeHistname(("ClusterSize_OffTrack_" + m_modLabel_PixLayerIBL2D3D[i]), false); - htitles = makeHisttitle(("cluster size for clusters out of tracks , " + m_modLabel_PixLayerIBL2D3D[i]), ";cluster size;#clusters", false); - sc = clusterExpert.regHist(m_clusize_offtrack_mod[i] = TH1F_LW::create(hname.c_str(), htitles.c_str(), 300, -0.5, -0.5 + 300.0)); - } - - if (m_doOnTrack) { - sc = clusterExpert.regHist(m_clustersOnOffTrack_per_lumi = TProfile_LW::create("ClustersOnOffTrack_per_lumi", ("Fraction pixel clusters on track per event per LB" + m_histTitleExt + ";lumi block; fraction clusters/event").c_str(), 2500, -0.5, 2499.5)); - - hname = makeHistname("Zoomed_Cluster_ToTxCosAlpha_lumi_IBL", false); - htitles = makeHisttitle("Zoomed Cluster ToTxCosAlpha, IBL", ";lumi block;ToT [BC]", false); - sc = clusterExpert.regHist(m_zoomed_clusterToTcosA_lumi_IBL = TH2F_LW::create(hname.c_str(), htitles.c_str(), nbins_LB, min_LB, max_LB, 20, -0.5, 19.5)); - if (m_doOnline) { - hname = makeHistname("Zoomed_Cluster_ToTxCosAlpha_last100lb_IBL", false); - htitles = makeHisttitle("Zoomed Cluster ToTxCosAlpha last 100 LB, IBL", ";last 100 lumi blocks;ToT [BC]", false); - sc = clusterExpert.regHist(m_zoomed_clusterToTcosA_lastXlb_IBL = new TH2F(hname.c_str(), htitles.c_str(), 100, 0.5, 100.5, 20, -0.5, 19.5)); - if (m_zoomed_clusterToTcosA_lastXlb_IBL) m_zoomed_clusterToTcosA_lastXlb_IBL->SetOption("colz"); - } - hname = makeHistname("Zoomed_Cluster_ToTxCosAlpha_lumi_B0", false); - htitles = makeHisttitle("Zoomed Cluster ToTxCosAlpha, B0", ";lumi block;ToT [BC]", false); - sc = clusterExpert.regHist(m_zoomed_clusterToTcosA_lumi_B0 = TH2F_LW::create(hname.c_str(), htitles.c_str(), nbins_LB, min_LB, max_LB, 20, 7.5, 27.5)); - if (m_doOnline) { - hname = makeHistname("Zoomed_Cluster_ToTxCosAlpha_last100lb_B0", false); - htitles = makeHisttitle("Zoomed Cluster ToTxCosAlpha last 100 LB, B0", ";last 100 lumi blocks;ToT [BC]", false); - sc = clusterExpert.regHist(m_zoomed_clusterToTcosA_lastXlb_B0 = new TH2F(hname.c_str(), htitles.c_str(), 100, 0.5, 100.5, 20, 7.5, 27.5)); - if (m_zoomed_clusterToTcosA_lastXlb_B0) m_zoomed_clusterToTcosA_lastXlb_B0->SetOption("colz"); - } - hname = makeHistname("Zoomed_Cluster_ToTxCosAlpha_lumi_B1", false); - htitles = makeHisttitle("Zoomed Cluster ToTxCosAlpha, B1", ";lumi block;ToT [BC]", false); - sc = clusterExpert.regHist(m_zoomed_clusterToTcosA_lumi_B1 = TH2F_LW::create(hname.c_str(), htitles.c_str(), nbins_LB, min_LB, max_LB, 20, 19.5, 39.5)); - if (m_doOnline) { - hname = makeHistname("Zoomed_Cluster_ToTxCosAlpha_last100lb_B1", false); - htitles = makeHisttitle("Zoomed Cluster ToTxCosAlpha last 100 LB, B1", ";last 100 lumi blocks;ToT [BC]", false); - sc = clusterExpert.regHist(m_zoomed_clusterToTcosA_lastXlb_B1 = new TH2F(hname.c_str(), htitles.c_str(), 100, 0.5, 100.5, 20, 19.5, 39.5)); - if (m_zoomed_clusterToTcosA_lastXlb_B1) m_zoomed_clusterToTcosA_lastXlb_B1->SetOption("colz"); - } - hname = makeHistname("Zoomed_Cluster_ToTxCosAlpha_lumi_B2", false); - htitles = makeHisttitle("Zoomed Cluster ToTxCosAlpha, B2", ";lumi block;ToT [BC]", false); - sc = clusterExpert.regHist(m_zoomed_clusterToTcosA_lumi_B2 = TH2F_LW::create(hname.c_str(), htitles.c_str(), nbins_LB, min_LB, max_LB, 20, 19.5, 39.5)); - if (m_doOnline) { - hname = makeHistname("Zoomed_Cluster_ToTxCosAlpha_last100lb_B2", false); - htitles = makeHisttitle("Zoomed Cluster ToTxCosAlpha last 100 LB, B2", ";last 100 lumi blocks;ToT [BC]", false); - sc = clusterExpert.regHist(m_zoomed_clusterToTcosA_lastXlb_B2 = new TH2F(hname.c_str(), htitles.c_str(), 100, 0.5, 100.5, 20, 19.5, 39.5)); - if (m_zoomed_clusterToTcosA_lastXlb_B2) m_zoomed_clusterToTcosA_lastXlb_B2->SetOption("colz"); - } - hname = makeHistname("Zoomed_Cluster_ToTxCosAlpha_lumi_ECA", false); - htitles = makeHisttitle("Zoomed Cluster ToTxCosAlpha, ECA", ";lumi block;ToT [BC]", false); - sc = clusterExpert.regHist(m_zoomed_clusterToTcosA_lumi_ECA = TH2F_LW::create(hname.c_str(), htitles.c_str(), nbins_LB, min_LB, max_LB, 20, 19.5, 39.5)); - if (m_doOnline) { - hname = makeHistname("Zoomed_Cluster_ToTxCosAlpha_last100lb_ECA", false); - htitles = makeHisttitle("Zoomed Cluster ToTxCosAlpha last 100 LB, ECA", ";last 100 lumi blocks;ToT [BC]", false); - sc = clusterExpert.regHist(m_zoomed_clusterToTcosA_lastXlb_ECA = new TH2F(hname.c_str(), htitles.c_str(), 100, 0.5, 100.5, 20, 19.5, 39.5)); - if (m_zoomed_clusterToTcosA_lastXlb_ECA) m_zoomed_clusterToTcosA_lastXlb_ECA->SetOption("colz"); - } - hname = makeHistname("Zoomed_Cluster_ToTxCosAlpha_lumi_ECC", false); - htitles = makeHisttitle("Zoomed Cluster ToTxCosAlpha, ECC", ";lumi block;ToT [BC]", false); - sc = clusterExpert.regHist(m_zoomed_clusterToTcosA_lumi_ECC = TH2F_LW::create(hname.c_str(), htitles.c_str(), nbins_LB, min_LB, max_LB, 20, 19.5, 39.5)); - if (m_doOnline) { - hname = makeHistname("Zoomed_Cluster_ToTxCosAlpha_last100lb_ECC", false); - htitles = makeHisttitle("Zoomed Cluster ToTxCosAlpha last 100 LB, ECC", ";last 100 lumi blocks;ToT [BC]", false); - sc = clusterExpert.regHist(m_zoomed_clusterToTcosA_lastXlb_ECC = new TH2F(hname.c_str(), htitles.c_str(), 100, 0.5, 100.5, 20, 19.5, 39.5)); - if (m_zoomed_clusterToTcosA_lastXlb_ECC) m_zoomed_clusterToTcosA_lastXlb_ECC->SetOption("colz"); - } - - } - - if (m_do2DMaps) { - tmp = "Cluster_Occupancy"; - tmp2 = "Cluster occupancy"; - m_cluster_occupancy = std::make_unique<PixelMon2DMapsLW>(tmp.c_str(), (tmp2 + m_histTitleExt).c_str(), PixMon::HistConf::kPixDBMIBL2D3D); - sc = m_cluster_occupancy->regHist(clusterShift); - - tmp = "Cluster_LVL1A_Mod"; - tmp2 = "Average cluster Level 1 Accept"; - m_cluster_LVL1A_mod = std::make_unique<PixelMon2DProfilesLW>(tmp.c_str(), (tmp2 + m_histTitleExt).c_str(), PixMon::HistConf::kPixIBL2D3D); - sc = m_cluster_LVL1A_mod->regHist(timeShift); - - tmp = "Clus_Occ_SizeCut"; - tmp2 = "Size>1 Cluster occupancy"; - m_clusocc_sizenot1 = std::make_unique<PixelMon2DMapsLW>(tmp.c_str(), (tmp2 + m_histTitleExt).c_str(), PixMon::HistConf::kPixDBMIBL2D3D); - sc = m_clusocc_sizenot1->regHist(clusterShift); - - tmp = "Clus_LVL1A_SizeCut"; - tmp2 = "Average Size>1 Cluster Level 1 Accept"; - m_clus_LVL1A_sizenot1 = std::make_unique<PixelMon2DProfilesLW>(tmp.c_str(), (tmp2 + m_histTitleExt).c_str(), PixMon::HistConf::kPixIBL2D3D); - sc = m_clus_LVL1A_sizenot1->regHist(timeShift); - - if (m_doOnline) { - tmp = "ClusterMap_Mon"; - tmp2 = "Cluster map for monitoring"; - m_clustermap_mon = std::make_unique<PixelMon2DMapsLW>(tmp.c_str(), (tmp2 + m_histTitleExt).c_str(), PixMon::HistConf::kPixDBMIBL2D3D); - sc = m_clustermap_mon->regHist(clusterShift); - - tmp = "ClusterMap_tmp"; - tmp2 = "Cluster map for monitoring"; - m_clustermap_tmp = std::make_unique<PixelMon2DMapsLW>(tmp.c_str(), (tmp2 + m_histTitleExt).c_str(), PixMon::HistConf::kPixDBMIBL2D3D); - sc = m_clustermap_tmp->regHist(clusterShift); - } - if (!m_doOnline) { - tmp = "Cluster_Size_Map"; - tmp2 = "Average cluster size map"; - m_clussize_map = std::make_unique<PixelMon2DProfilesLW>(tmp.c_str(), (tmp2 + m_histTitleExt).c_str(), PixMon::HistConf::kPixIBL2D3D); - sc = m_clussize_map->regHist(clusterExpert); - - tmp = "Cluster_Charge_Map"; - tmp2 = "Average cluster charge map"; - m_cluscharge_map = std::make_unique<PixelMon2DProfilesLW>(tmp.c_str(), (tmp2 + m_histTitleExt).c_str(), PixMon::HistConf::kPixIBL2D3D); - sc = m_cluscharge_map->regHist(clusterExpert); - - tmp = "Cluster_ToT_Map"; - tmp2 = "Average cluster ToT map"; - m_clusToT_map = std::make_unique<PixelMon2DProfilesLW>(tmp.c_str(), (tmp2 + m_histTitleExt).c_str(), PixMon::HistConf::kPixIBL2D3D); - sc = m_clusToT_map->regHist(clusterExpert); - } - } - - if (m_doModules && m_doOnTrack) { - m_cluseff_mod = std::make_unique<PixelMonModulesProf>("Clus_track_eff", ("Proportion of clusters on track vs t in module" + m_histTitleExt).c_str(), 2500, -0.5, 2499.5); - sc = m_cluseff_mod->regHist(this, (path + "/Modules_Cluseff").c_str(), run); - - m_cluster_size_mod = std::make_unique<PixelMonModules1D>("Cluster_size", ("Cluster size in Module" + m_histTitleExt).c_str(), 20, -0.5, 19.5); - sc = m_cluster_size_mod->regHist(this, (path + "/Modules_ClusterSize").c_str(), run); - - m_cluster_num_mod = std::make_unique<PixelMonModules1D>("Cluster_num", ("Number of clusters per event in module" + m_histTitleExt).c_str(), 30, -0.5, 29.5); - sc = m_cluster_num_mod->regHist(this, (path + "/Modules_NumberOfClusters").c_str(), run); - - m_cluster_ToT_mod = std::make_unique<PixelMonModules1D>("Cluster_ToT", ("Cluster ToT in Module" + m_histTitleExt).c_str(), 200, 0., 200.); - sc = m_cluster_ToT_mod->regHist(this, (path + "/Modules_ClusToT").c_str(), run); - } - if (m_doOnline) { - if (m_doOnTrack) { - if (m_doIBL) { - hname = makeHistname("Cluster_Occupancy_PP0_IBLA", false); - htitles = makeHisttitle("Average per FE cluster occupancy reset every 5 min, IBL A-side", ";stave ;average # clusters per FE per event", false); - sc = clusterExpert.regHist(m_cluster_occupancy_PP0_IBLA = TProfile_LW::create(hname.c_str(), htitles.c_str(), - PixMon::kNumStavesIBL, 0.5, 0.5 + PixMon::kNumStavesIBL)); - hname = makeHistname("Cluster_Occupancy_PP0_IBLC", false); - htitles = makeHisttitle("Average per FE cluster occupancy reset every 5 min, IBL C-side", ";stave ;average # clusters per FE per event", false); - sc = clusterExpert.regHist(m_cluster_occupancy_PP0_IBLC = TProfile_LW::create(hname.c_str(), htitles.c_str(), - PixMon::kNumStavesIBL, 0.5, 0.5 + PixMon::kNumStavesIBL)); - } - hname = makeHistname("Cluster_Occupancy_PP0_B0", false); - htitles = makeHisttitle("Average per module cluster occupancy reset every 5 min, B0", ";stave ;average # clusters per module per event", false); - sc = clusterExpert.regHist(m_cluster_occupancy_PP0_B0 = TProfile_LW::create(hname.c_str(), htitles.c_str(), - PixMon::kNumStavesL0, 0.5, 0.5 + PixMon::kNumStavesL0)); - hname = makeHistname("Cluster_Occupancy_PP0_B1", false); - htitles = makeHisttitle("Average per module cluster occupancy reset every 5 min, B1", ";stave ;average # clusters per module per event", false); - sc = clusterExpert.regHist(m_cluster_occupancy_PP0_B1 = TProfile_LW::create(hname.c_str(), htitles.c_str(), - PixMon::kNumStavesL1, 0.5, 0.5 + PixMon::kNumStavesL1)); - hname = makeHistname("Cluster_Occupancy_PP0_B2", false); - htitles = makeHisttitle("Average per module cluster occupancy reset every 5 min, B2", ";stave ;average # clusters per module per event", false); - sc = clusterExpert.regHist(m_cluster_occupancy_PP0_B2 = TProfile_LW::create(hname.c_str(), htitles.c_str(), - PixMon::kNumStavesL2, 0.5, 0.5 + PixMon::kNumStavesL2)); - hname = makeHistname("Cluster_Occupancy_PP0_ECA", false); - htitles = makeHisttitle("Average per module cluster occupancy reset every 5 min, ECA", ";sector ;average # clusters per module per event", false); - sc = clusterExpert.regHist(m_cluster_occupancy_PP0_ECA = TProfile_LW::create(hname.c_str(), htitles.c_str(), - PixMon::kNumPP0sEC, 0.5, 0.5 + PixMon::kNumPP0sEC)); - hname = makeHistname("Cluster_Occupancy_PP0_ECC", false); - htitles = makeHisttitle("Average per module cluster occupancy reset every 5 min, ECC", ";sector ;average # clusters per module per event", false); - sc = clusterExpert.regHist(m_cluster_occupancy_PP0_ECC = TProfile_LW::create(hname.c_str(), htitles.c_str(), - PixMon::kNumPP0sEC, 0.5, 0.5 + PixMon::kNumPP0sEC)); - formatPP0Histos(m_cluster_occupancy_PP0_ECA, m_cluster_occupancy_PP0_ECC, - m_cluster_occupancy_PP0_B0, m_cluster_occupancy_PP0_B1, m_cluster_occupancy_PP0_B2, - m_cluster_occupancy_PP0_IBLA, m_cluster_occupancy_PP0_IBLC); - } - } - - if (m_doLowOccupancy || m_doHighOccupancy) { - int nbins_clusters = 1000; - float max_clusters = 40000.; - int nbins_clusters_region = 200; - float max_clusters_region = 8000.; - int nbins_avclusters = 100; - float max_avclusters = 50.; - - if (m_doLowOccupancy) { - nbins_clusters = 200; - max_clusters = 200.; - nbins_clusters_region = 200; - max_clusters_region = 8000.; - nbins_avclusters = 50; - max_avclusters = 2.; - } - if (m_doHeavyIonMon) { - max_clusters = 100000; - max_clusters_region = 40000; - max_avclusters = 1000; - } - - tmp = "num_clusters"; - tmp2 = "Number of pixel clusters in an event"; - sc = clusterShift.regHist(m_num_clusters = TH1I_LW::create(tmp.c_str(), (tmp2 + ";# pixel clusters/event" + m_histTitleExt + ";# events").c_str(), nbins_clusters, 0., max_clusters)); - - for (int i = 0; i < PixLayer::COUNT - 1 + (int)(m_doIBL); i++) { - hname = makeHistname(("num_clusters_" + m_modLabel_PixLayerIBL2D3D[i]), false); - tmp2 = "Number of pixel clusters in an event, " + m_modLabel_PixLayerIBL2D3D[i] + m_histTitleExt + ";# pixel clusters/event;# events"; - sc = clusterExpert.regHist(m_num_clusters_mod[i] = TH1I_LW::create(hname.c_str(), tmp2.c_str(), nbins_clusters_region, 0., max_clusters_region)); - - hname = makeHistname(("cluster_occupancy_summary_" + m_modLabel_PixLayerIBL2D3D[i]), true); - tmp2 = "Average cluster occupancy, " + m_modLabel_PixLayerIBL2D3D[i] + m_histTitleExt + ";average # of clusters per module per event;# modules"; - sc = clusterExpert.regHist(m_cluster_occupancy_summary_mod[i] = TH1F_LW::create(hname.c_str(), tmp2.c_str(), nbins_avclusters, 0., max_avclusters)); - - if (m_doOnTrack) { - hname = makeHistname(("num_clusters_per_track_per_lumi_" + m_modLabel_PixLayerIBL2D3D[i]), true); - tmp2 = "Number of pixel clusters in an event, " + m_modLabel_PixLayerIBL2D3D[i] + m_histTitleExt + atext_LB + ";Avg #clusters/track/event"; - sc = clusterExpert.regHist(m_clusters_per_track_per_lumi_mod[i] = TProfile_LW::create(hname.c_str(), tmp2.c_str(), nbins_LB, min_LB, max_LB)); - } - } - } - - if (sc.isFailure() && msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Pixel cluster monitoring histograms not booked" << endmsg; - return StatusCode::SUCCESS; -} - -StatusCode PixelMainMon::bookClustersLumiBlockMon(void) { - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "starting Book Clusters for lowStat" << endmsg; - - std::string path = "Pixel/LumiBlock"; - if (m_doOnTrack) path.replace(path.begin(), path.end(), "Pixel/LumiBlockOnTrack"); - MonGroup lumiBlockHist(this, path.c_str(), lowStat, ATTRIB_MANAGED); // declare a group of histograms - - StatusCode sc; - - sc = lumiBlockHist.regHist(m_cluster_ToT_LB = TH1F_LW::create("Cluster_ToT_LB", ("Cluster Time over Threshold" + m_histTitleExt + ";ToT;# clusters").c_str(), 300, -0.5, 299.5)); - - if (m_do2DMaps) { - m_cluster_occupancy_LB = std::make_unique<PixelMon2DMapsLW>("Cluster_Occupancy_LB", ("Cluster Occupancy" + m_histTitleExt).c_str(), PixMon::HistConf::kPixDBMIBL2D3D); - sc = m_cluster_occupancy_LB->regHist(lumiBlockHist); - } - if (m_doLowOccupancy || m_doHighOccupancy) { - int nbins_nclusters = 150; - double min_nclusters = -0.5; - double max_nclusters = min_nclusters + 15000.0; - if (m_doLowOccupancy) { - nbins_nclusters = 200; - max_nclusters = min_nclusters + 200.0; - } - sc = lumiBlockHist.regHist(m_num_clusters_LB = TH1I_LW::create("num_clusters_LB", ("Number of pixel clusters per event" + m_histTitleExt + ";# pixel clusters/event;# events").c_str(), nbins_nclusters, min_nclusters, max_nclusters)); - } - - // normally not booked, as doModules is online, doLumiBlock is offline - if (m_doModules && m_doOnTrack) { - m_cluster_num_mod_LB = std::make_unique<PixelMonModules1D>(PixelMonModules1D("Cluster_num_LB", ("Number of clusters per event in module" + m_histTitleExt).c_str(), 20, -0.5, 59.5)); - sc = m_cluster_num_mod_LB->regHist(this, (path + "/Modules_NumberOfClusters").c_str(), lowStat); - m_cluster_ToT_mod_LB = std::make_unique<PixelMonModules1D>(PixelMonModules1D("Cluster_ToT_mod_LB", ("Cluster ToT in Module" + m_histTitleExt).c_str(), 75, 0., 300.)); - sc = m_cluster_ToT_mod_LB->regHist(this, (path + "/Modules_ClusToT").c_str(), lowStat); - } - - if (sc.isFailure() && msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "Per LB pixel cluster monitoring histograms not booked" << endmsg; - return StatusCode::SUCCESS; -} - -StatusCode PixelMainMon::fillClustersMon(void) { - auto pixel_clcontainer = SG::makeHandle(m_Pixel_SiClustersName); - if (!(pixel_clcontainer.isValid())) { - if (msgLvl(MSG::INFO)) msg(MSG::INFO) << "Pixel Cluster container for Pixels not found" << endmsg; - if (m_storegate_errors) m_storegate_errors->Fill(3., 3.); - return StatusCode::SUCCESS; - } else { - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Pixel Cluster container for Pixels found" << endmsg; - } - - int nclusters = 0; - int nclusters_mod[PixLayer::COUNT] = {0}; - int nclusters_all = 0; - int nclusters_ontrack = 0; - - if (m_doModules && m_doOnTrack) { - if (m_doIBL) { - for (int i = 0; i < 20; i++) { - for (int j = 0; j < 14; j++) { - m_ClusPerEventArray_lI[j][i] = 0; - } - } - } - for (int i = 0; i < 13; i++) { - for (int j = 0; j < 22; j++) { - m_ClusPerEventArray_l0[j][i] = 0; - } - for (int j = 0; j < 38; j++) { - m_ClusPerEventArray_l1[j][i] = 0; - } - for (int j = 0; j < 52; j++) { - m_ClusPerEventArray_l2[j][i] = 0; - } - } - for (int j = 0; j < 3; j++) { - for (int i = 0; i < 48; i++) { - m_ClusPerEventArray_disksA[i][j] = 0; - m_ClusPerEventArray_disksC[i][j] = 0; - } - } - } - - Identifier clusID; - InDet::PixelClusterContainer::const_iterator colNext = pixel_clcontainer->begin(); - InDet::PixelClusterContainer::const_iterator lastCol = pixel_clcontainer->end(); - DataVector<PixelCluster>::const_iterator p_clus; - - for (; colNext != lastCol; ++colNext) { - const InDet::PixelClusterCollection* ClusterCollection(*colNext); - - if (!ClusterCollection) { - // first entry is for RDO, second is for data problem - if (m_storegate_errors) m_storegate_errors->Fill(3., 5.); - continue; - } - for (p_clus = ClusterCollection->begin(); p_clus != ClusterCollection->end(); ++p_clus) { - clusID = (*p_clus)->identify(); - int pixlayer = getPixLayerID(m_pixelid->barrel_ec(clusID), m_pixelid->layer_disk(clusID), m_doIBL); - int pixlayeribl2d3d = pixlayer; - if (pixlayeribl2d3d == PixLayerIBL2D3D::kIBL) { - pixlayeribl2d3d = getPixLayerIDIBL2D3D(m_pixelid->barrel_ec(clusID), m_pixelid->layer_disk(clusID), m_pixelid->eta_module(clusID), m_doIBL); - } - - int pixlayerdbm = getPixLayerIDDBM(m_pixelid->barrel_ec(clusID), m_pixelid->layer_disk(clusID), m_doIBL); - int pixlayeribl2d3ddbm = pixlayerdbm; - if (pixlayeribl2d3ddbm == PixLayerIBL2D3DDBM::kIBL) { - pixlayeribl2d3ddbm = getPixLayerIDIBL2D3DDBM(m_pixelid->barrel_ec(clusID), m_pixelid->layer_disk(clusID), m_pixelid->eta_module(clusID), m_doIBL); - } - - int lumiblock = m_manager->lumiBlockNumber(); - - const PixelCluster& cluster = **p_clus; - const InDet::SiWidth clusWidth = cluster.width(); - // note: description is wrong in SiWidth! <x,y> = <row,col> - int colWidth = clusWidth.colRow().y(); - int rowWidth = clusWidth.colRow().x(); - - int npixHitsInClusterRaw = cluster.rdoList().size(); - int npixHitsInCluster = cluster.rdoList().size(); - if (pixlayeribl2d3ddbm != 99 && npixHitsInCluster > m_cluster_groupsize_mod[pixlayeribl2d3ddbm]->getXMax()) { - npixHitsInCluster = (int)(m_cluster_groupsize_mod[pixlayeribl2d3ddbm]->getXMax() - 0.5); - } - - if (pixlayer != 99) nclusters_all++; // count all (no DBM) clusters on and off track - - if (isOnTrack(clusID, true)) { - if (m_cluseff_mod) m_cluseff_mod->fill(m_manager->lumiBlockNumber(), 1., clusID, m_pixelid); - if (pixlayeribl2d3d != 99 && m_clusize_ontrack_mod[pixlayeribl2d3d]) m_clusize_ontrack_mod[pixlayeribl2d3d]->Fill(npixHitsInClusterRaw); - if (pixlayer == PixLayer::kIBL && m_clusize_ontrack_mod[PixLayerIBL2D3D::kIBL]) m_clusize_ontrack_mod[PixLayerIBL2D3D::kIBL]->Fill(npixHitsInClusterRaw); - } else { - if (m_cluseff_mod) m_cluseff_mod->fill(m_manager->lumiBlockNumber(), 0., clusID, m_pixelid); - if (pixlayeribl2d3d != 99 && m_clusize_offtrack_mod[pixlayeribl2d3d]) m_clusize_offtrack_mod[pixlayeribl2d3d]->Fill(npixHitsInClusterRaw); - if (pixlayer == PixLayer::kIBL && m_clusize_offtrack_mod[PixLayerIBL2D3D::kIBL]) m_clusize_offtrack_mod[PixLayerIBL2D3D::kIBL]->Fill(npixHitsInClusterRaw); - } - - double cosalpha(0.); - if (m_doOnTrack && !isOnTrack(clusID, cosalpha)) { - continue; - // if we only want hits on track, and the hit is NOT on the track, skip filling. - // true means doing clusters, false means rdos - } - - ////////////////////////////////////////////////////// - /////////////Start main fill block here/////////////// - ////////////////////////////////////////////////////// - - // Fill first histograms with DBM - if (pixlayeribl2d3ddbm != 99 && m_cluster_ToT1d_mod[pixlayeribl2d3ddbm]) m_cluster_ToT1d_mod[pixlayeribl2d3ddbm]->Fill(cluster.totalToT()); - if (pixlayerdbm == PixLayerDBM::kIBL && m_cluster_ToT1d_mod[PixLayerIBL2D3DDBM::kIBL]) m_cluster_ToT1d_mod[PixLayerIBL2D3DDBM::kIBL]->Fill(cluster.totalToT()); - if (pixlayeribl2d3ddbm != 99 && m_cluster_Q_mod[pixlayeribl2d3ddbm]) m_cluster_Q_mod[pixlayeribl2d3ddbm]->Fill(cluster.totalCharge()); - if (pixlayerdbm == PixLayerDBM::kIBL && m_cluster_Q_mod[PixLayerIBL2D3DDBM::kIBL]) m_cluster_Q_mod[PixLayerIBL2D3DDBM::kIBL]->Fill(cluster.totalCharge()); - if (m_doOnTrack) { - if (pixlayeribl2d3ddbm != 99 && m_cluster_ToT1d_corr[pixlayeribl2d3ddbm]) m_cluster_ToT1d_corr[pixlayeribl2d3ddbm]->Fill(cluster.totalToT() * cosalpha); - if (pixlayerdbm == PixLayerDBM::kIBL && m_cluster_ToT1d_corr[PixLayerIBL2D3DDBM::kIBL]) m_cluster_ToT1d_corr[PixLayerIBL2D3DDBM::kIBL]->Fill(cluster.totalToT() * cosalpha); - if (pixlayeribl2d3ddbm != 99 && m_cluster_Q_corr[pixlayeribl2d3ddbm]) m_cluster_Q_corr[pixlayeribl2d3ddbm]->Fill(cluster.totalCharge() * cosalpha); - if (pixlayerdbm == PixLayerDBM::kIBL && m_cluster_Q_corr[PixLayerIBL2D3DDBM::kIBL]) m_cluster_Q_corr[PixLayerIBL2D3DDBM::kIBL]->Fill(cluster.totalCharge() * cosalpha); - if (pixlayer == PixLayer::kIBL && m_zoomed_clusterToTcosA_lumi_IBL) m_zoomed_clusterToTcosA_lumi_IBL->Fill(m_manager->lumiBlockNumber(), cluster.totalToT() * cosalpha); - if (pixlayer == PixLayer::kB0 && m_zoomed_clusterToTcosA_lumi_B0) m_zoomed_clusterToTcosA_lumi_B0->Fill(m_manager->lumiBlockNumber(), cluster.totalToT() * cosalpha); - if (pixlayer == PixLayer::kB1 && m_zoomed_clusterToTcosA_lumi_B1) m_zoomed_clusterToTcosA_lumi_B1->Fill(m_manager->lumiBlockNumber(), cluster.totalToT() * cosalpha); - if (pixlayer == PixLayer::kB2 && m_zoomed_clusterToTcosA_lumi_B2) m_zoomed_clusterToTcosA_lumi_B2->Fill(m_manager->lumiBlockNumber(), cluster.totalToT() * cosalpha); - if (pixlayer == PixLayer::kECA && m_zoomed_clusterToTcosA_lumi_ECA) m_zoomed_clusterToTcosA_lumi_ECA->Fill(m_manager->lumiBlockNumber(), cluster.totalToT() * cosalpha); - if (pixlayer == PixLayer::kECC && m_zoomed_clusterToTcosA_lumi_ECC) m_zoomed_clusterToTcosA_lumi_ECC->Fill(m_manager->lumiBlockNumber(), cluster.totalToT() * cosalpha); - } - if (pixlayeribl2d3ddbm != 99 && m_cluster_groupsize_mod[pixlayeribl2d3ddbm]) m_cluster_groupsize_mod[pixlayeribl2d3ddbm]->Fill(npixHitsInCluster); - if (pixlayerdbm == PixLayerDBM::kIBL && m_cluster_groupsize_mod[PixLayerIBL2D3DDBM::kIBL]) m_cluster_groupsize_mod[PixLayerIBL2D3DDBM::kIBL]->Fill(npixHitsInCluster); - if (m_cluster_occupancy) m_cluster_occupancy->fill(clusID, m_pixelid); - if (pixlayer == 99) continue; // DBM case - - nclusters_ontrack++; - - // Fill LVL1 Accepted - if (m_cluster_LVL1A) m_cluster_LVL1A->Fill(cluster.LVL1A()); - if (m_cluster_LVL1A_mod) m_cluster_LVL1A_mod->fill(clusID, m_pixelid, cluster.LVL1A() + 0.00001); // avoid filling exactly zero to distinguish from disabled modules - if (cluster.rdoList().size() > 1 && m_clus_LVL1A_sizenot1) m_clus_LVL1A_sizenot1->fill(clusID, m_pixelid, cluster.LVL1A() + 0.00001); // avoid filling exactly zero to distinguish from disabled modules - if (pixlayer != PixLayer::kIBL) { - if (cluster.totalToT() > 15 && m_cluster_LVL1A1d_mod[pixlayer]) m_cluster_LVL1A1d_mod[pixlayer]->Fill(cluster.LVL1A()); - } else { - if (cluster.totalToT() > 4 && m_cluster_LVL1A1d_mod[pixlayer]) m_cluster_LVL1A1d_mod[pixlayer]->Fill(cluster.LVL1A()); - } - - if (m_cluster_ToT_mod) m_cluster_ToT_mod->fill(cluster.totalToT(), clusID, m_pixelid); - - // Fill the number of pixel hits in a cluster - if (m_cluster_groupsize) m_cluster_groupsize->Fill(npixHitsInClusterRaw); - if (m_cluster_col_width) m_cluster_col_width->Fill(colWidth); - if (m_cluster_row_width) m_cluster_row_width->Fill(rowWidth); - if (m_clusterSize_eta && m_pixelid->barrel_ec(clusID) == 0) m_clusterSize_eta->Fill(m_pixelid->eta_module(clusID), npixHitsInClusterRaw); - - if (pixlayeribl2d3d != 99 && m_cluster_col_width_mod[pixlayeribl2d3d]) m_cluster_col_width_mod[pixlayeribl2d3d]->Fill(colWidth); - if (pixlayer == PixLayer::kIBL && m_cluster_col_width_mod[PixLayerIBL2D3D::kIBL]) m_cluster_col_width_mod[PixLayerIBL2D3D::kIBL]->Fill(colWidth); - if (pixlayeribl2d3d != 99 && m_cluster_row_width_mod[pixlayeribl2d3d]) m_cluster_row_width_mod[pixlayeribl2d3d]->Fill(rowWidth); - if (pixlayer == PixLayer::kIBL && m_cluster_row_width_mod[PixLayerIBL2D3D::kIBL]) m_cluster_row_width_mod[PixLayerIBL2D3D::kIBL]->Fill(rowWidth); - if (pixlayeribl2d3d != 99 && m_clusters_col_width_per_lumi_mod[pixlayeribl2d3d]) m_clusters_col_width_per_lumi_mod[pixlayeribl2d3d]->Fill(m_manager->lumiBlockNumber(), colWidth); - if (pixlayer == PixLayer::kIBL && m_clusters_col_width_per_lumi_mod[PixLayerIBL2D3D::kIBL]) m_clusters_col_width_per_lumi_mod[PixLayerIBL2D3D::kIBL]->Fill(lumiblock, colWidth); - if (pixlayeribl2d3d != 99 && m_clusters_row_width_per_lumi_mod[pixlayeribl2d3d]) m_clusters_row_width_per_lumi_mod[pixlayeribl2d3d]->Fill(m_manager->lumiBlockNumber(), rowWidth); - if (pixlayer == PixLayer::kIBL && m_clusters_row_width_per_lumi_mod[PixLayerIBL2D3D::kIBL]) m_clusters_row_width_per_lumi_mod[PixLayerIBL2D3D::kIBL]->Fill(lumiblock, rowWidth); - if (pixlayeribl2d3d != 99 && m_clusters_col_width_per_bcid_mod[pixlayeribl2d3d]) m_clusters_col_width_per_bcid_mod[pixlayeribl2d3d]->Fill(1.0 * m_currentBCID, colWidth); - if (pixlayer == PixLayer::kIBL && m_clusters_col_width_per_bcid_mod[PixLayerIBL2D3D::kIBL]) m_clusters_col_width_per_bcid_mod[PixLayerIBL2D3D::kIBL]->Fill(1.0 * m_currentBCID, colWidth); - if (pixlayeribl2d3d != 99 && m_clusters_row_width_per_bcid_mod[pixlayeribl2d3d]) m_clusters_row_width_per_bcid_mod[pixlayeribl2d3d]->Fill(1.0 * m_currentBCID, rowWidth); - if (pixlayer == PixLayer::kIBL && m_clusters_row_width_per_bcid_mod[PixLayerIBL2D3D::kIBL]) m_clusters_row_width_per_bcid_mod[PixLayerIBL2D3D::kIBL]->Fill(1.0 * m_currentBCID, rowWidth); - - // Total Number of Clusters - if (m_totalclusters_per_lumi) m_totalclusters_per_lumi->Fill(lumiblock); - if (pixlayeribl2d3d != 99 && m_totalclusters_per_lumi_mod[pixlayeribl2d3d]) m_totalclusters_per_lumi_mod[pixlayeribl2d3d]->Fill(lumiblock); - if (pixlayer == PixLayer::kIBL && m_totalclusters_per_lumi_mod[PixLayerIBL2D3D::kIBL]) m_totalclusters_per_lumi_mod[PixLayerIBL2D3D::kIBL]->Fill(lumiblock); - if (pixlayeribl2d3d != 99 && m_totalclusters_per_bcid_mod[pixlayeribl2d3d]) m_totalclusters_per_bcid_mod[pixlayeribl2d3d]->Fill(1.0 * m_currentBCID); - if (pixlayer == PixLayer::kIBL && m_totalclusters_per_bcid_mod[PixLayerIBL2D3D::kIBL]) m_totalclusters_per_bcid_mod[PixLayerIBL2D3D::kIBL]->Fill(1.0 * m_currentBCID); - - // Fill Occupancy - if (cluster.rdoList().size() > 1 && m_clusocc_sizenot1) m_clusocc_sizenot1->fill(clusID, m_pixelid); - if (m_doOnline && m_clustermap_tmp) m_clustermap_tmp->fill(clusID, m_pixelid); - - // 2D Map - if (m_clussize_map) m_clussize_map->fill(clusID, m_pixelid, cluster.rdoList().size()); - if (m_cluscharge_map) m_cluscharge_map->fill(clusID, m_pixelid, cluster.totalCharge()); - if (m_clusToT_map) m_clusToT_map->fill(clusID, m_pixelid, cluster.totalToT()); - if (m_cluster_size_mod) m_cluster_size_mod->fill(cluster.rdoList().size(), clusID, m_pixelid); - - if (m_clussize_vs_eta_mod[pixlayer]) m_clussize_vs_eta_mod[pixlayer]->Fill(1.0 * m_pixelid->eta_module(clusID), cluster.rdoList().size()); - - nclusters++; - nclusters_mod[pixlayer]++; - - if (m_doModules && m_doOnTrack) { - if (m_pixelid->barrel_ec(clusID) == 2) m_ClusPerEventArray_disksA[m_pixelid->phi_module(clusID)][m_pixelid->layer_disk(clusID)]++; - if (m_pixelid->barrel_ec(clusID) == -2) m_ClusPerEventArray_disksC[m_pixelid->phi_module(clusID)][m_pixelid->layer_disk(clusID)]++; - if (m_pixelid->barrel_ec(clusID) == 0) { - if (m_doIBL && m_pixelid->layer_disk(clusID) == 0) m_ClusPerEventArray_lI[m_pixelid->phi_module(clusID)][m_pixelid->eta_module(clusID) + 10]++; - if (m_pixelid->layer_disk(clusID) == 0 + m_doIBL) m_ClusPerEventArray_l0[m_pixelid->phi_module(clusID)][m_pixelid->eta_module(clusID) + 6]++; - if (m_pixelid->layer_disk(clusID) == 1 + m_doIBL) m_ClusPerEventArray_l1[m_pixelid->phi_module(clusID)][m_pixelid->eta_module(clusID) + 6]++; - if (m_pixelid->layer_disk(clusID) == 2 + m_doIBL) m_ClusPerEventArray_l2[m_pixelid->phi_module(clusID)][m_pixelid->eta_module(clusID) + 6]++; - } - } - - if (m_doLumiBlock) { - if (m_cluster_occupancy_LB) m_cluster_occupancy_LB->fill(clusID, m_pixelid); - if (m_cluster_ToT_LB) m_cluster_ToT_LB->Fill(cluster.totalToT()); - if (m_cluster_ToT_mod_LB) m_cluster_ToT_mod_LB->fill(cluster.totalToT(), clusID, m_pixelid); - } - } // PixelClusterContainer loop - } // end of cluster collections loop - - if (m_doOnline) { - fillSummaryHistos(m_cluster_occupancy.get(), - m_cluster_occupancy_summary_mod[PixLayer::kECA], - m_cluster_occupancy_summary_mod[PixLayer::kECC], - m_cluster_occupancy_summary_mod[PixLayer::kIBL], - m_cluster_occupancy_summary_mod[PixLayer::kB0], - m_cluster_occupancy_summary_mod[PixLayer::kB1], - m_cluster_occupancy_summary_mod[PixLayer::kB2]); - if (m_doOnTrack && m_doRefresh5min) { - if (m_cluster_occupancy_PP0_ECA) m_cluster_occupancy_PP0_ECA->Reset(); - if (m_cluster_occupancy_PP0_ECC) m_cluster_occupancy_PP0_ECC->Reset(); - if (m_cluster_occupancy_PP0_B0) m_cluster_occupancy_PP0_B0->Reset(); - if (m_cluster_occupancy_PP0_B1) m_cluster_occupancy_PP0_B1->Reset(); - if (m_cluster_occupancy_PP0_B2) m_cluster_occupancy_PP0_B2->Reset(); - if (m_cluster_occupancy_PP0_IBLA) m_cluster_occupancy_PP0_IBLA->Reset(); - if (m_cluster_occupancy_PP0_IBLC) m_cluster_occupancy_PP0_IBLC->Reset(); - } - if (m_doRefresh) { //set to true for testing - if (m_clustermap_mon && m_clustermap_tmp) { - if (m_doOnTrack) { - fillPP0Histos(m_clustermap_tmp.get(), - m_cluster_occupancy_PP0_ECA, m_cluster_occupancy_PP0_ECC, - m_cluster_occupancy_PP0_B0, m_cluster_occupancy_PP0_B1, m_cluster_occupancy_PP0_B2, - m_cluster_occupancy_PP0_IBLA, m_cluster_occupancy_PP0_IBLC); - } - m_clustermap_mon->fill2DMon(m_clustermap_tmp.get()); - } - } - } - - if (m_clusters_per_lumi) m_clusters_per_lumi->Fill(m_manager->lumiBlockNumber(), nclusters); - for (int i = 0; i < PixLayer::COUNT - 1 + (int)(m_doIBL); i++) { - if (m_clusters_per_lumi_mod[i]) m_clusters_per_lumi_mod[i]->Fill(m_manager->lumiBlockNumber(), nclusters_mod[i]); - if (m_doOnTrack && m_clusters_per_track_per_lumi_mod[i] && m_ntracksPerEvent > 0) { - m_clusters_per_track_per_lumi_mod[i]->Fill(m_manager->lumiBlockNumber(), (1.0 * nclusters_mod[i]) / (1.0 * m_ntracksPerEvent)); - } - } - if (m_doOnTrack && m_clustersOnOffTrack_per_lumi && nclusters_all > 0) { - m_clustersOnOffTrack_per_lumi->Fill(m_manager->lumiBlockNumber(), (float)nclusters_ontrack / nclusters_all); - } - - // Fill some histograms only if =< 50% of modules disabled - if (!m_majorityDisabled) { - if (m_num_clusters) m_num_clusters->Fill(nclusters); - - for (int i = 0; i < PixLayer::COUNT - 1 + (int)(m_doIBL); i++) { - if (m_num_clusters_mod[i]) m_num_clusters_mod[i]->Fill(nclusters_mod[i]); - } - if (m_doLumiBlock && m_num_clusters_LB) m_num_clusters_LB->Fill(nclusters); - - if (m_doModules && m_doOnTrack) { - PixelID::const_id_iterator idIt = m_pixelid->wafer_begin(); - PixelID::const_id_iterator idItEnd = m_pixelid->wafer_end(); - for (; idIt != idItEnd; ++idIt) { - Identifier WaferID = *idIt; - if (m_pixelid->barrel_ec(WaferID) == 2) m_cluster_num_mod->fill(m_ClusPerEventArray_disksA[m_pixelid->phi_module(WaferID)][m_pixelid->layer_disk(WaferID)], WaferID, m_pixelid); - if (m_pixelid->barrel_ec(WaferID) == -2) m_cluster_num_mod->fill(m_ClusPerEventArray_disksC[m_pixelid->phi_module(WaferID)][m_pixelid->layer_disk(WaferID)], WaferID, m_pixelid); - if (m_pixelid->barrel_ec(WaferID) == 0) { - if (m_doIBL && m_pixelid->layer_disk(WaferID) == 0) m_cluster_num_mod->fill(m_ClusPerEventArray_lI[m_pixelid->phi_module(WaferID)][m_pixelid->eta_module(WaferID) + 10], WaferID, m_pixelid); - if (m_pixelid->layer_disk(WaferID) == 0 + m_doIBL) m_cluster_num_mod->fill(m_ClusPerEventArray_l0[m_pixelid->phi_module(WaferID)][m_pixelid->eta_module(WaferID) + 6], WaferID, m_pixelid); - if (m_pixelid->layer_disk(WaferID) == 1 + m_doIBL) m_cluster_num_mod->fill(m_ClusPerEventArray_l1[m_pixelid->phi_module(WaferID)][m_pixelid->eta_module(WaferID) + 6], WaferID, m_pixelid); - if (m_pixelid->layer_disk(WaferID) == 2 + m_doIBL) m_cluster_num_mod->fill(m_ClusPerEventArray_l2[m_pixelid->phi_module(WaferID)][m_pixelid->eta_module(WaferID) + 6], WaferID, m_pixelid); - } - if (m_doLumiBlock) { - if (m_pixelid->barrel_ec(WaferID) == 2) m_cluster_num_mod_LB->fill(m_ClusPerEventArray_disksA[m_pixelid->phi_module(WaferID)][m_pixelid->layer_disk(WaferID)], WaferID, m_pixelid); - if (m_pixelid->barrel_ec(WaferID) == -2) m_cluster_num_mod_LB->fill(m_ClusPerEventArray_disksC[m_pixelid->phi_module(WaferID)][m_pixelid->layer_disk(WaferID)], WaferID, m_pixelid); - if (m_pixelid->barrel_ec(WaferID) == 0) { - if (m_doIBL && m_pixelid->layer_disk(WaferID) == 0) m_cluster_num_mod_LB->fill(m_ClusPerEventArray_lI[m_pixelid->phi_module(WaferID)][m_pixelid->eta_module(WaferID) + 10], WaferID, m_pixelid); - if (m_pixelid->layer_disk(WaferID) == 0 + m_doIBL) m_cluster_num_mod_LB->fill(m_ClusPerEventArray_l0[m_pixelid->phi_module(WaferID)][m_pixelid->eta_module(WaferID) + 6], WaferID, m_pixelid); - if (m_pixelid->layer_disk(WaferID) == 1 + m_doIBL) m_cluster_num_mod_LB->fill(m_ClusPerEventArray_l1[m_pixelid->phi_module(WaferID)][m_pixelid->eta_module(WaferID) + 6], WaferID, m_pixelid); - if (m_pixelid->layer_disk(WaferID) == 2 + m_doIBL) m_cluster_num_mod_LB->fill(m_ClusPerEventArray_l2[m_pixelid->phi_module(WaferID)][m_pixelid->eta_module(WaferID) + 6], WaferID, m_pixelid); - } - } - } - } - } // if (!m_majorityDisabled) - - if (nclusters == 0 && m_storegate_errors) m_storegate_errors->Fill(3., 4.); //first entry for RDO, second for size = 0 - - return StatusCode::SUCCESS; -} - -StatusCode PixelMainMon::procClustersMon(void) { - if (m_doOnline && m_doOnTrack) { - int lastlb = m_manager->lumiBlockNumber()-1; //remove -1 for testing - float cont(0.0); - if (m_zoomed_clusterToTcosA_lumi_IBL && m_zoomed_clusterToTcosA_lastXlb_IBL - && m_zoomed_clusterToTcosA_lumi_B0 && m_zoomed_clusterToTcosA_lastXlb_B0 - && m_zoomed_clusterToTcosA_lumi_B1 && m_zoomed_clusterToTcosA_lastXlb_B1 - && m_zoomed_clusterToTcosA_lumi_B2 && m_zoomed_clusterToTcosA_lastXlb_B2 - && m_zoomed_clusterToTcosA_lumi_ECA && m_zoomed_clusterToTcosA_lastXlb_ECA - && m_zoomed_clusterToTcosA_lumi_ECC && m_zoomed_clusterToTcosA_lastXlb_ECC) { - - int bingx = m_zoomed_clusterToTcosA_lumi_B2->GetXaxis()->FindBin(lastlb); - int nbingy = m_zoomed_clusterToTcosA_lumi_B2->GetNbinsY(); - int nXbins = m_zoomed_clusterToTcosA_lastXlb_B2->GetNbinsX(); - - m_zoomed_clusterToTcosA_lastXlb_IBL->GetXaxis()->Set(nXbins, lastlb-nXbins+0.5, lastlb+0.5); - m_zoomed_clusterToTcosA_lastXlb_IBL->Reset(); - m_zoomed_clusterToTcosA_lastXlb_B0->GetXaxis()->Set(nXbins, lastlb-nXbins+0.5, lastlb+0.5); - m_zoomed_clusterToTcosA_lastXlb_B0->Reset(); - m_zoomed_clusterToTcosA_lastXlb_B1->GetXaxis()->Set(nXbins, lastlb-nXbins+0.5, lastlb+0.5); - m_zoomed_clusterToTcosA_lastXlb_B1->Reset(); - m_zoomed_clusterToTcosA_lastXlb_B2->GetXaxis()->Set(nXbins, lastlb-nXbins+0.5, lastlb+0.5); - m_zoomed_clusterToTcosA_lastXlb_B2->Reset(); - m_zoomed_clusterToTcosA_lastXlb_ECA->GetXaxis()->Set(nXbins, lastlb-nXbins+0.5, lastlb+0.5); - m_zoomed_clusterToTcosA_lastXlb_ECA->Reset(); - m_zoomed_clusterToTcosA_lastXlb_ECC->GetXaxis()->Set(nXbins, lastlb-nXbins+0.5, lastlb+0.5); - m_zoomed_clusterToTcosA_lastXlb_ECC->Reset(); - - for (int binfx=nXbins; binfx>0; binfx--) { - if (bingx>0) { - for (int bingy = 1; bingy <= nbingy; bingy++) { - cont = m_zoomed_clusterToTcosA_lumi_IBL->GetBinContent(bingx, bingy); - if (cont!=0) m_zoomed_clusterToTcosA_lastXlb_IBL->SetBinContent(binfx, bingy, cont); - cont = m_zoomed_clusterToTcosA_lumi_B0->GetBinContent(bingx, bingy); - if (cont!=0) m_zoomed_clusterToTcosA_lastXlb_B0->SetBinContent(binfx, bingy, cont); - cont = m_zoomed_clusterToTcosA_lumi_B1->GetBinContent(bingx, bingy); - if (cont!=0) m_zoomed_clusterToTcosA_lastXlb_B1->SetBinContent(binfx, bingy, cont); - cont = m_zoomed_clusterToTcosA_lumi_B2->GetBinContent(bingx, bingy); - if (cont!=0) m_zoomed_clusterToTcosA_lastXlb_B2->SetBinContent(binfx, bingy, cont); - cont = m_zoomed_clusterToTcosA_lumi_ECA->GetBinContent(bingx, bingy); - if (cont!=0) m_zoomed_clusterToTcosA_lastXlb_ECA->SetBinContent(binfx, bingy, cont); - cont = m_zoomed_clusterToTcosA_lumi_ECC->GetBinContent(bingx, bingy); - if (cont!=0) m_zoomed_clusterToTcosA_lastXlb_ECC->SetBinContent(binfx, bingy, cont); - } - bingx--; - } - } - //m_zoomed_clusterToTcosA_lastXlb_B2->SetEntries(lastlb); // for testing - } - - } - if (m_doOffline) { - fillSummaryHistos(m_cluster_occupancy.get(), - m_cluster_occupancy_summary_mod[PixLayer::kECA], - m_cluster_occupancy_summary_mod[PixLayer::kECC], - m_cluster_occupancy_summary_mod[PixLayer::kIBL], - m_cluster_occupancy_summary_mod[PixLayer::kB0], - m_cluster_occupancy_summary_mod[PixLayer::kB1], - m_cluster_occupancy_summary_mod[PixLayer::kB2]); - } - - return StatusCode::SUCCESS; -} diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/src/Components.cxx b/InnerDetector/InDetMonitoring/PixelMonitoring/src/Components.cxx deleted file mode 100644 index 739ef7683d5a4cfd73e67750d9d92a626aa70fab..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetMonitoring/PixelMonitoring/src/Components.cxx +++ /dev/null @@ -1,120 +0,0 @@ -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ -#include "PixelMonitoring/Components.h" - -namespace PixMon { -// Definitions for barrel layers and IBL -const std::array<std::string, kNumStavesIBL> StavesIBL = {{ - "S01", "S02", "S03", "S04", "S05", "S06", "S07", "S08", "S09", "S10", "S11", - "S12", "S13","S14"}}; - -const std::array<std::string, kNumStavesL0> StavesL0 = {{ - "B11_S2", "B01_S1", "B01_S2", "B02_S1", "B02_S2", "B03_S1", "B03_S2", - "B04_S1", "B04_S2", "B05_S1", "B05_S2", "B06_S1", "B06_S2", "B07_S1", - "B07_S2", "B08_S1", "B08_S2", "B09_S1", "B09_S2","B10_S1", "B10_S2", - "B11_S1"}}; - -const std::array<std::string, kNumStavesL1> StavesL1 = {{ - "B01_S1", "B01_S2", "B02_S1", "B02_S2", "B03_S1", "B03_S2", "B04_S1", - "B04_S2", "B05_S1", "B05_S2", "B06_S1", "B06_S2", "B07_S1", "B07_S2", - "B08_S1", "B08_S2", "B09_S1", "B09_S2", "B10_S1", "B10_S2", "B11_S1", - "B11_S2", "B12_S1", "B12_S2", "B13_S1", "B13_S2", "B14_S1", "B14_S2", - "B15_S1", "B15_S2", "B16_S1", "B16_S2", "B17_S1", "B17_S2", "B18_S1", - "B18_S2", "B19_S1", "B19_S2"}}; - -const std::array<std::string, kNumStavesL2> StavesL2 = {{ - "B01_S2", "B02_S1", "B02_S2", "B03_S1", "B03_S2", "B04_S1", "B04_S2", - "B05_S1", "B05_S2", "B06_S1", "B06_S2", "B07_S1", "B07_S2", "B08_S1", - "B08_S2", "B09_S1", "B09_S2", "B10_S1", "B10_S2", "B11_S1", "B11_S2", - "B12_S1", "B12_S2", "B13_S1", "B13_S2", "B14_S1", "B14_S2", "B15_S1", - "B15_S2", "B16_S1", "B16_S2", "B17_S1", "B17_S2", "B18_S1", "B18_S2", - "B19_S1", "B19_S2", "B20_S1", "B20_S2", "B21_S1", "B21_S2", "B22_S1", - "B22_S2", "B23_S1", "B23_S2", "B24_S1", "B24_S2", "B25_S1", "B25_S2", - "B26_S1", "B26_S2", "B01_S1"}}; - -const std::array<std::string, kNumModulesIBL> ModulesIBL = {{ - "C8", "", "C7", "", "C6", "", "C5", "", "C4", "", "C3", "", "C2", "", - "C1", "", "A1", "", "A2", "", "A3", "", "A4", "", "A5", "", "A6", "", - "A7", "", "A8", ""}}; - -const std::array<std::string, kNumModulesIBL2D> ModulesIBL2D = {{ - "M3_C6", "M3_C5", "M2_C4", "M1_C3", "M1_C2", "M1_C1", "M1_A1", "M1_A2", - "M2_A3", "M2_A4", "M3_A5", "M3_A6"}}; - -const std::array<std::string, kNumModulesIBL3D> ModulesIBL3D = {{ - "M4_C8_2", "M4_C8_1", "M4_C7_2", "M4_C7_1", "M4_A7_1", "M4_A7_2", "M4_A8_1", - "M4_A8_2"}}; - -const std::array<std::string, kNumModulesBarrel> ModulesBarrel = {{ - "M6C", "M5C", "M4C", "M3C", "M2C", "M1C", "M0","M1A", "M2A", "M3A", "M4A", - "M5A", "M6A"}}; - - -// Definitions for end-caps and DBM -const std::array<std::string, kNumLayersDisk> LayersDisk = {{"Disk 1", "Disk 2", "Disk 3"}}; - -const std::array<std::string, kNumLayersDBM> LayersDBM = {{"Layer 0", "Layer 1", "Layer 2"}}; - -const std::array<std::string, kNumModulesDisk> ModulesECA = {{ - "B01_S2_M1", "B01_S2_M6", "B01_S2_M2", "B01_S2_M5", "B01_S2_M3", - "B01_S2_M4", "B02_S1_M1", "B02_S1_M6", "B02_S1_M2", "B02_S1_M5", - "B02_S1_M3", "B02_S1_M4", "B02_S2_M1", "B02_S2_M6", "B02_S2_M2", - "B02_S2_M5", "B02_S2_M3", "B02_S2_M4", "B03_S1_M1", "B03_S1_M6", - "B03_S1_M2", "B03_S1_M5", "B03_S1_M3", "B03_S1_M4", "B03_S2_M1", - "B03_S2_M6", "B03_S2_M2", "B03_S2_M5", "B03_S2_M3", "B03_S2_M4", - "B04_S1_M1", "B04_S1_M6", "B04_S1_M2", "B04_S1_M5", "B04_S1_M3", - "B04_S1_M4", "B04_S2_M1", "B04_S2_M6", "B04_S2_M2", "B04_S2_M5", - "B04_S2_M3", "B04_S2_M4", "B01_S1_M1", "B01_S1_M6", "B01_S1_M2", - "B01_S1_M5", "B01_S1_M3", "B01_S1_M4"}}; - -const std::array<std::string, kNumModulesDisk> ModulesECC = {{ - "B01_S2_M4", "B01_S2_M3", "B01_S2_M5", "B01_S2_M2", "B01_S2_M6", - "B01_S2_M1", "B02_S1_M4", "B02_S1_M3", "B02_S1_M5", "B02_S1_M2", - "B02_S1_M6", "B02_S1_M1", "B02_S2_M4", "B02_S2_M3", "B02_S2_M5", - "B02_S2_M2", "B02_S2_M6", "B02_S2_M1", "B03_S1_M4", "B03_S1_M3", - "B03_S1_M5", "B03_S1_M2", "B03_S1_M6", "B03_S1_M1", "B03_S2_M4", - "B03_S2_M3", "B03_S2_M5", "B03_S2_M2", "B03_S2_M6", "B03_S2_M1", - "B04_S1_M4", "B04_S1_M3", "B04_S1_M5", "B04_S1_M2", "B04_S1_M6", - "B04_S1_M1", "B04_S2_M4", "B04_S2_M3", "B04_S2_M5", "B04_S2_M2", - "B04_S2_M6", "B04_S2_M1", "B01_S1_M4", "B01_S1_M3", "B01_S1_M5", - "B01_S1_M2", "B01_S1_M6", "B01_S1_M1"}}; - -const std::array<std::string, kNumModulesDBM> ModulesDBM = {{"M3", "M4", "M1", "M2"}}; - -const std::array<std::string, kNumPP0sEC> PP0sEC = {{ - "D1_B01_S2", "D1_B02_S1", "D1_B02_S2", "D1_B03_S1", "D1_B03_S2", "D1_B04_S1", "D1_B04_S2", "D1_B01_S1", - "D2_B01_S2", "D2_B02_S1", "D2_B02_S2", "D2_B03_S1", "D2_B03_S2", "D2_B04_S1", "D2_B04_S2", "D2_B01_S1", - "D3_B01_S2", "D3_B02_S1", "D3_B02_S2", "D3_B03_S1", "D3_B03_S2", "D3_B04_S1", "D3_B04_S2", "D3_B01_S1"}}; - -bool HasComponent(const HistConf& config, const LayerIBL2D3DDBM& component) { - if (component >= LayerIBL2D3DDBM::COUNT) { - // return here if we are out of scope - return false; - } else if (config == HistConf::kPix && component <= LayerIBL2D3DDBM::kB2) { - return true; - } else if (config == HistConf::kPixIBL && (component <= LayerIBL2D3DDBM::kB2 || component == LayerIBL2D3DDBM::kIBL)) { - return true; - } else if (config == HistConf::kPixIBL2D3D && (component <= LayerIBL2D3DDBM::kB2 || component >= LayerIBL2D3DDBM::kIBL)) { - return true; - } else if (config == HistConf::kPixDBM && component <= LayerIBL2D3DDBM::kDBMC) { - return true; - } else if (config == HistConf::kPixDBMIBL && component <= LayerIBL2D3DDBM::kIBL) { - return true; - } else if (config == HistConf::kPixDBMIBL2D3D) { - return true; - } else if (config == HistConf::kDBM && (component == LayerIBL2D3DDBM::kDBMA || component == LayerIBL2D3DDBM::kDBMC)) { - return true; - } else if (config == HistConf::kDBMIBL && component >= LayerIBL2D3DDBM::kDBMA && component <= LayerIBL2D3DDBM::kIBL) { - return true; - } else if (config == HistConf::kDBMIBL2D3D && component >= LayerIBL2D3DDBM::kDBMA) { - return true; - } else if (config == HistConf::kIBL && component == LayerIBL2D3DDBM::kIBL) { - return true; - } else if (config == HistConf::kIBL2D3D && component >= LayerIBL2D3DDBM::kIBL) { - return true; - } else { - return false; - } -} -} // namespace PixMon diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/src/Errors.cxx b/InnerDetector/InDetMonitoring/PixelMonitoring/src/Errors.cxx deleted file mode 100644 index 2bb3096cf6e33d524da0aff66836a80df80b0dda..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetMonitoring/PixelMonitoring/src/Errors.cxx +++ /dev/null @@ -1,893 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -/////////////////////////////////////////////////////////////////////////////// -// Book and fill histograms showing module errors -/////////////////////////////////////////////////////////////////////////////// - -#include <sstream> -#include "InDetIdentifier/PixelID.h" -#include "LWHists/TH1F_LW.h" -#include "LWHists/TH1I_LW.h" -#include "LWHists/TH2F_LW.h" -#include "LWHists/TH2I_LW.h" -#include "LWHists/TProfile2D_LW.h" -#include "LWHists/TProfile_LW.h" -#include "PixelMonitoring/PixelMainMon.h" -#include "TH1F.h" -#include "TH1I.h" -#include "TH2F.h" -#include "TH2I.h" -#include "TH3F.h" -#include "TProfile.h" -#include "TString.h" - -#include "InDetReadoutGeometry/SiDetectorElement.h" -#include "PixelMonitoring/Components.h" -#include "PixelMonitoring/PixelMon2DLumiMaps.h" -#include "PixelMonitoring/PixelMon2DMapsLW.h" -#include "PixelMonitoring/PixelMon2DProfilesLW.h" -#include "PixelMonitoring/PixelMonModules.h" - -/////////////////////////////////////////////////////////////////////////////// -//////////////////////booking methods////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -StatusCode PixelMainMon::bookRODErrorMon(void) { - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "starting Book Errors" << endmsg; - - std::string path = "Pixel/Errors"; - std::string path2 = "Pixel/ErrorsExpert"; - if (m_doOnTrack) path.replace(path.begin(), path.end(), "Pixel/ErrorsOnTrack"); - MonGroup rodHistos(this, path.c_str(), run, ATTRIB_MANAGED); // declare a group of histograms - MonGroup rodExpert(this, path2.c_str(), run, ATTRIB_MANAGED); // declare a group of histograms - - const std::array<std::pair<std::string, std::string>, kNumErrorStates> error_state_labels = {{ - std::make_pair("Mod_Sync_BCID1_errors", "FE/MCC BCID1 Sync Errors"), - std::make_pair("Mod_Sync_BCID2_errors", "FE/MCC BCID2 Sync Errors"), - std::make_pair("Mod_Sync_LVL1ID_errors", "FE/MCC LVL1ID Sync Errors"), - std::make_pair("ROD_Sync_BCID_errors", "ROD BCID Sync Errors"), - std::make_pair("ROD_Sync_LVL1ID_errors", "ROD LVL1ID Sync Errors"), - std::make_pair("Mod_Trunc_EOC_errors", "FE/MCC EoC Trunc Errors"), - std::make_pair("Mod_Trunc_Hit_Overflow_errors", "FE/MCC Hit Overflow Trunc Errors"), - std::make_pair("Mod_Trunc_EoE_Overflow_errors", "FE/MCC EoE Overflow Trunc Errors"), - std::make_pair("ROD_Trunc_HT_Limit_errors", "ROD H/T Limit Trunc Errors"), - std::make_pair("ROD_Trunc_ROD_OF_errors", "ROD Overflow Trunc Errors"), - std::make_pair("Optical_Errors", "Preamble/Header Errors"), - std::make_pair("SEU_Hit_Parity", "SEU Hit Parity Errors"), - std::make_pair("SEU_Register_Parity", "SEU Register Parity Errors"), - std::make_pair("SEU_Hamming", "SEU Hamming Code Errors"), - std::make_pair("ROD_Timeout", "ROD Formatter Timeout Errors"), - std::make_pair("FE_Warning", "FE Warning Errors"), - }}; - - std::array<std::pair<std::string, std::string>, kNumErrorStatesIBL> error_state_labelsIBL = {{ - std::make_pair("BCID_errors", "Synchronization BCID errors"), - std::make_pair("LVL1ID_errors", "Synchronization LVL1ID errors"), - std::make_pair("Row_Column_errors", "Row Column errors"), - std::make_pair("Limit_errors", "Limit_errors"), - std::make_pair("Preamble_errors", "Preamble errors"), - std::make_pair("Masked_link_errors", "Masked link errors"), - std::make_pair("Hamming_code_0_errors", "Hamming code 0 errors"), - std::make_pair("Hamming_code_1_errors", "Hamming code 1 errors"), - std::make_pair("Hamming_code_2_errors", "Hamming code 2 errors"), - std::make_pair("L1_incounter_errors", "L1 in counter errors"), - std::make_pair("L1_request_counter_errors", "L1 request counter errors"), - std::make_pair("L1_register_errors", "L1 register errors"), - std::make_pair("L1_Trigger_ID_errors", "L1 trigger ID errors"), - std::make_pair("Readout_processor_errors", "Readout processor errors"), - std::make_pair("Skipped_trig_counter_errors", "Skipped trigger counter errors"), - std::make_pair("Truncated_event_flag_errors", "Truncated event errors"), - std::make_pair("Triple redundant_errors", "Triple redundant errors"), - std::make_pair("Write_reg_data_errors", "Write register data errors"), - std::make_pair("Address_errors", "Address errors"), - std::make_pair("Other_CMD_decoder_errors", "CMD decoder errors"), - std::make_pair("CMD_decoder_bitflip_errors", "CMD decoder bit flip errors"), - std::make_pair("CMD_decoder_SEU_errors", "CMD decoder SEU errors"), - std::make_pair("Data_bus_address_errors", "Data bus address errors"), - std::make_pair("ROD_Timeout_errors", "ROD Timeout errors"), - std::make_pair("Timeout_errors", "Timeout errors"), - std::make_pair("BCID_counter_errors", "BCID counter errors"), - std::make_pair("Triple_redundant_errors2", "Triple redundant errors 2"), - }}; - - const char* errorBitsPIX[kNumErrorBits] = { - "ROD Overflow Trunc", "ROD H/T Limit Trunc", "2", "3", - "FE/MCC EoC Trunc", "SEU Hit Parity", "SEU Register Parity", "SEU Hamming Code", - "FE Warning (Bit Flip)", "9", "10", "11", - "FE/MCC Hit Overflow Trunc", "FE/MCC EoE Overflow Trunc", "FE/MCC BCID1 Sync", "FE/MCC BCID2 Sync", - "FE/MCC LVL1ID Sync", "17", "18", "19", - "ROD BCID Sync", "ROD LVL1ID Sync", "ROD Formatter Timeout", "Preamble/Header", - "24", "25", "26", "27", - "28", "29", "30", "31" - }; - - const char* errorBitsIBL[kNumErrorBits] = { - "Row/ Column Error", "Limit Error", "Timeout Error", "BCID Error", - "LVL1ID Error", "Preamble Error", "Masked Link", "Timeout Error", - "BCID counter", "Hamming code 0", "Hamming code 1", "Hamming code 2", - "L1_in counter", "L1 request counter", "L1 register", "L1 Trigger ID", - "readout processor", "Skipped trig counter", "Truncated event flag", "Triple Redundant", - "Write reg data", "Address error", "Other CMD decoder", "CMD decoder bit flip", - "CMD decoder SEU", "Data bus address", "Triple redundant", "27", - "28", "29", "30", "31" - }; - - const std::array<std::pair<std::string, std::string>, ErrorCategoryMODROD::COUNT> error_type_labels = {{ - std::make_pair("SyncErrors_Mod", "FE/MCC Sync Errors"), - std::make_pair("SyncErrors_ROD", "ROD Sync Errors"), - std::make_pair("TruncErrors_Mod", "FE/MCC Trunc Errors"), - std::make_pair("TruncErrors_ROD", "ROD Trunc Errors"), - std::make_pair("OpticalErrors_RODMod", "Preamble/Header Errors"), - std::make_pair("SEUErrors_RODMod", "SEU Errors"), - std::make_pair("TimeoutErrors_RODMod", "Timeout Errors"), - }}; - - const std::array<std::pair<std::string, std::string>, ErrorCategory::COUNT> error_cat_labels = {{ - std::make_pair("SyncErrors", "Sync Errors (FE/MCC & ROD)"), - std::make_pair("TruncErrors", "Trunc Errors (FE/MCC & ROD)"), - std::make_pair("OpticalErrors", "Preamble/Header Errors"), - std::make_pair("SEUErrors", "SEU Errors"), - std::make_pair("TimeoutErrors", "Timeout Errors"), - }}; - - const std::string modlabel2[PixLayerIBL2D3DDBM::COUNT] = {"ECA", "ECC", "B0", "B1", "B2", "DBMA", "DBMC", "IBL", "IBL2D", "IBL3D"}; - - unsigned int nmod_eta[PixLayer::COUNT] = {3, 3, 13, 13, 13, 32}; - - std::string atext_LB = ";lumi block"; - std::string atext_err = ";# errors/event"; - std::string atext_erf = ";# errors/module/event"; - std::string atext_erb = ";error bit"; - std::string atext_ers = ";error type"; - int nbins_LB = m_lbRange; - float minbin_LB = -0.5; - float maxbin_LB = minbin_LB + (1.0 * nbins_LB); - std::string hname; - std::string htitles; - - StatusCode sc; - - hname = makeHistname("SyncErrors_per_lumi_PIX", false); - htitles = makeHisttitle("Average Synchronization errors per event, PIXEL BARREL", (atext_LB + atext_err), false); - sc = rodHistos.regHist(m_errhist_syncerr_LB_pix = TProfile_LW::create(hname.c_str(), htitles.c_str(), nbins_LB, minbin_LB, maxbin_LB)); - - for (int i = 0; i < PixLayerIBL2D3DDBM::COUNT; i++) { - for (int j = 0; j < ErrorCategory::COUNT; ++j) { - hname = makeHistname((error_cat_labels[j].first + "_per_lumi_" + modlabel2[i]), false); - htitles = makeHisttitle(("Average " + error_cat_labels[j].second + ", " + modlabel2[i]), (atext_LB + atext_err), false); - sc = rodHistos.regHist(m_errhist_errcat_LB[i][j] = TProfile_LW::create(hname.c_str(), htitles.c_str(), nbins_LB, minbin_LB, maxbin_LB)); - } - - for (int j = 0; j < ErrorCategoryMODROD::COUNT - 3; ++j) { - hname = makeHistname((error_type_labels[j].first + "_per_lumi_" + modlabel2[i]), false); - htitles = makeHisttitle(("Average " + error_type_labels[j].second + ", " + modlabel2[i]), (atext_LB + atext_err), false); - sc = rodHistos.regHist(m_errhist_errtype_LB[i][j] = TProfile_LW::create(hname.c_str(), htitles.c_str(), nbins_LB, minbin_LB, maxbin_LB)); - } - - hname = makeHistname(("errors_per_lumi_" + modlabel2[i]), false); - htitles = makeHisttitle(("Average Total Errors, " + modlabel2[i]), (atext_LB + atext_err), false); - sc = rodHistos.regHist(m_errhist_tot_LB[i] = TProfile_LW::create(hname.c_str(), htitles.c_str(), nbins_LB, minbin_LB, maxbin_LB)); - - hname = makeHistname(("ErrorBit_per_lumi_" + modlabel2[i]), false); - htitles = makeHisttitle(("Average Errors by Error Bits, " + modlabel2[i]), (atext_LB + atext_erb + atext_erf), false); - sc = rodHistos.regHist(m_errhist_per_bit_LB[i] = TProfile2D_LW::create(hname.c_str(), htitles.c_str(), nbins_LB, minbin_LB, maxbin_LB, 31, 0., 31.)); - m_errhist_per_bit_LB[i]->SetOption("colz"); - - hname = makeHistname(("Error_per_lumi_" + modlabel2[i]), false); - htitles = makeHisttitle(("Average Errors by Error Types, " + modlabel2[i]), (atext_LB + atext_ers + atext_err), false); - sc = rodHistos.regHist(m_errhist_per_type_LB[i] = TProfile2D_LW::create(hname.c_str(), htitles.c_str(), nbins_LB, minbin_LB, maxbin_LB, 7, 0., 7.)); - m_errhist_per_type_LB[i]->SetOption("colz"); - - if (i < PixLayerIBL2D3DDBM::kDBMA) { - for (unsigned int y = 1; y <= m_errhist_per_bit_LB[i]->GetYaxis()->GetNbins(); y++) { - m_errhist_per_bit_LB[i]->GetYaxis()->SetBinLabel(y, errorBitsPIX[y - 1]); - } - } else { - for (unsigned int y = 1; y <= m_errhist_per_bit_LB[i]->GetYaxis()->GetNbins(); y++) { - m_errhist_per_bit_LB[i]->GetYaxis()->SetBinLabel(y, errorBitsIBL[y - 1]); - } - } - - for (unsigned int y = 1; y <= m_errhist_per_type_LB[i]->GetYaxis()->GetNbins(); y++) { - m_errhist_per_type_LB[i]->GetYaxis()->SetBinLabel(y, error_type_labels[y - 1].second.c_str()); - } - - const std::string tmp[ErrorCategory::COUNT] = {"SyncErrorsFrac_per_event", "TruncationErrorsFrac_per_event", "OpticalErrorsFrac_per_event", "SEUErrorsFrac_per_event", "TimeoutErrorsFrac_per_event"}; - for (int j = 0; j < ErrorCategory::COUNT; j++) { - hname = makeHistname((tmp[j] + "_" + modlabel2[i]), false); - htitles = makeHisttitle(("Average " + error_cat_labels[j].second + " per Module" + ", " + modlabel2[i]), (atext_LB + atext_erf), false); - sc = rodHistos.regHist(m_errhist_errcat_avg[j][i] = TProfile_LW::create(hname.c_str(), htitles.c_str(), nbins_LB, minbin_LB, maxbin_LB)); - } - - const std::string tmp2[ErrorCategoryMODROD::COUNT - 3] = {"SyncErrors_Mod_Frac_per_event", "SyncErrors_ROD_Frac_per_event", "TruncErrors_Mod_Frac_per_event", "TruncErrors_ROD_Frac_per_event"}; - for (int j = 0; j < ErrorCategoryMODROD::COUNT - 3; j++) { - hname = makeHistname((tmp2[j] + "_" + modlabel2[i]), false); - htitles = makeHisttitle((tmp2[j] + ", " + modlabel2[i]), (atext_LB + atext_erf), false); - sc = rodHistos.regHist(m_errhist_errtype_avg[j][i] = TProfile_LW::create(hname.c_str(), htitles.c_str(), nbins_LB, minbin_LB, maxbin_LB)); - } - } - - if (m_doModules) { - m_errors = std::make_unique<PixelMonModules1D>(PixelMonModules1D("errors", ("Errors in module:ErrorType" + m_histTitleExt + ";Number of Errors").c_str(), 7, 0.5, 7.5)); - sc = m_errors->regHist(this, (path + "/ModulesErrors").c_str(), run); - for (int k = 0; k < 7; k++) { - m_errors->setBinLabel(error_type_labels[k].second.c_str(), k + 1); - } - } - - if (m_do2DMaps && !m_doOnline) { - for (int i = 0; i < ErrorCategoryMODROD::COUNT - 3; i++) { - m_errhist_errtype_map[i] = std::make_unique<PixelMon2DMapsLW>(error_type_labels[i].first, ("Total " + error_type_labels[i].second + m_histTitleExt).c_str(), PixMon::HistConf::kPixDBMIBL2D3D, true); - sc = m_errhist_errtype_map[i]->regHist(rodHistos); - } - for (int i = 0; i < ErrorCategory::COUNT; i++) { - m_errhist_errcat_map[i] = std::make_unique<PixelMon2DMapsLW>(error_cat_labels[i].first, ("Total " + error_cat_labels[i].second + m_histTitleExt).c_str(), PixMon::HistConf::kPixDBMIBL2D3D, true); - sc = m_errhist_errcat_map[i]->regHist(rodHistos); - } - } - - if (m_do2DMaps) { - m_errhist_femcc_errwords_map = std::make_unique<PixelMon2DProfilesLW>("femcc_errorwords", ("Average FE/MCC Error Words" + m_histTitleExt).c_str(), PixMon::HistConf::kPixIBL2D3D); - sc = m_errhist_femcc_errwords_map->regHist(rodHistos); - m_errhist_bitstr_occ_errors = std::make_unique<PixelMon2DProfilesLW>("Bitstr_Occ_Errors", ("Average Bit-Stream Occupancy (FE/MCC Errors, at 100k L1)" + m_histTitleExt).c_str(), PixMon::HistConf::kPixIBL, true); - sc = m_errhist_bitstr_occ_errors->regHist(rodHistos); - m_errhist_bitstr_occ_tot = std::make_unique<PixelMon2DProfilesLW>("Bitstr_Occ_Tot", ("Average Bit-Stream Occupancy (at 100k L1)" + m_histTitleExt).c_str(), PixMon::HistConf::kPixIBL, true); - sc = m_errhist_bitstr_occ_tot->regHist(rodHistos); - } - - for (int i = 0; i < PixLayerIBL2D3D::COUNT; ++i) { - hname = makeHistname(("Bitstr_Occ_Errors_LB_" + modlabel2[i]), false); - htitles = makeHisttitle(("Average Bit-Stream Occupancy per Module (FE/MCC Errors, at 100k L1), "+modlabel2[i]), (atext_LB + ";bitstream occ./module/event"), false); - sc = rodHistos.regHist(m_errhist_bitstr_occ_errors_avg[i] = TProfile_LW::create(hname.c_str(), htitles.c_str(), nbins_LB, minbin_LB, maxbin_LB)); - - hname = makeHistname(("Bitstr_Occ_Tot_LB_" + modlabel2[i]), false); - htitles = makeHisttitle(("Average Bit-Stream Occupancy per Module (at 100k L1), "+modlabel2[i]), (atext_LB + ";bitstream occ./module/event"), false); - sc = rodHistos.regHist(m_errhist_bitstr_occ_tot_avg[i] = TProfile_LW::create(hname.c_str(), htitles.c_str(), nbins_LB, minbin_LB, maxbin_LB)); - } - - for (int j = 0; j < kNumErrorStates; j++) { - for (int i = 0; i < PixLayer::COUNT - 1; i++) { - hname = makeHistname((error_state_labels[j].first + "_per_lumi_" + modlabel2[i]), false); - htitles = makeHisttitle(("Average " + error_state_labels[j].second + " per event per LB, " + modlabel2[i]), (atext_LB + atext_erf), false); - sc = rodExpert.regHist(m_errhist_expert_LB[i][j] = TProfile_LW::create(hname.c_str(), htitles.c_str(), nbins_LB, minbin_LB, maxbin_LB)); - } - hname = makeHistname((error_state_labels[j].first + "_Map"), false); - htitles = makeHisttitle((error_state_labels[j].second + " per event per LB"), "", false); - m_errhist_expert_maps[j] = std::make_unique<PixelMon2DMapsLW>(hname.c_str(), htitles.c_str(), PixMon::HistConf::kPix, true); - sc = m_errhist_expert_maps[j]->regHist(rodExpert); - } - - for (int j = 0; j < kNumErrorStatesIBL; j++) { - for (int i = 0; i < PixLayerDBM::COUNT - PixLayerDBM::kDBMA; i++) { - hname = makeHistname((error_state_labelsIBL[j].first + "_per_lumi_" + modlabel2[i + PixLayerIBL2D3DDBM::kDBMA]), false); - htitles = makeHisttitle(("Average " + error_state_labelsIBL[j].second + " per event per LB, " + modlabel2[i + PixLayerIBL2D3DDBM::kDBMA]), (atext_LB + atext_erf), false); - sc = rodExpert.regHist(m_errhist_expert_DBMIBL_LB[i][j] = TProfile_LW::create(hname.c_str(), htitles.c_str(), nbins_LB, minbin_LB, maxbin_LB)); - } - } - - for (int j = kNumErrorStates; j < kNumErrorStates + kNumErrorStatesIBL; j++) { - hname = makeHistname((error_state_labelsIBL[j - kNumErrorStates].first + "_Map"), false); - htitles = makeHisttitle((error_state_labelsIBL[j - kNumErrorStates].second + " per event per LB"), "", false); - m_errhist_expert_maps[j] = std::make_unique<PixelMon2DMapsLW>(hname.c_str(), htitles.c_str(), PixMon::HistConf::kDBMIBL, m_doIBL); - sc = m_errhist_expert_maps[j]->regHist(rodExpert); - } - - hname = makeHistname("ServiceRecord_Unweighted_IBL", false); - htitles = makeHisttitle("ServiceRecord Unweighted, IBL", ";SR;Count", false); - sc = rodExpert.regHist(m_errhist_expert_servrec_ibl_unweighted = TH1F_LW::create(hname.c_str(), htitles.c_str(), 32, -0.5, 31.5)); - - hname = makeHistname("ServiceRecord_Weighted_IBL", false); - htitles = makeHisttitle("ServiceRecord Weighted, IBL", ";SR;Count", false); - sc = rodExpert.regHist(m_errhist_expert_servrec_ibl_weighted = TH1F_LW::create(hname.c_str(), htitles.c_str(), 32, -0.5, 31.5)); - - hname = makeHistname("ServiceRecord_Count_IBL", false); - htitles = makeHisttitle("ServiceRecord Count, IBL", ";SR;Count", false); - sc = rodExpert.regHist(m_errhist_expert_servrec_ibl_count = TH1F_LW::create(hname.c_str(), htitles.c_str(), 100, -0.5, 99.5)); - - if (m_errhist_expert_servrec_ibl_unweighted) { - for (int i = 0; i < kNumErrorBits; i++) { - m_errhist_expert_servrec_ibl_unweighted->GetXaxis()->SetBinLabel(i + 1, errorBitsIBL[i]); - } - } - - if (m_errhist_expert_servrec_ibl_weighted) { - for (int i = 0; i < kNumErrorBits; i++) { - m_errhist_expert_servrec_ibl_weighted->GetXaxis()->SetBinLabel(i + 1, errorBitsIBL[i]); - } - } - - for (int i = 0; i < PixLayer::COUNT; i++) { - hname = makeHistname(("nFEswithTruncErr_" + m_modLabel_PixLayerIBL2D3D[i]), false); - htitles = makeHisttitle(("Number of FEs with FE EoC Trunc error, " + m_modLabel_PixLayerIBL2D3D[i]), ";lumi block;eta index of module;# FEs with errors in a module in an event;# event #times # modules", false); - sc = rodExpert.regHist(m_errhist_expert_fe_trunc_err_3d[i] = new TH3F(hname.c_str(), htitles.c_str(), nbins_LB, minbin_LB, maxbin_LB, nmod_eta[i], -0.5, -0.5 + nmod_eta[i], 18, -0.5, 17.5)); - } - if (sc.isFailure() && msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "histograms not booked" << endmsg; - return StatusCode::SUCCESS; -} - -StatusCode PixelMainMon::bookRODErrorLumiBlockMon(void) { - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "starting Book Errors for lowStat" << endmsg; - - std::string path = "Pixel/LumiBlock"; - if (m_doOnTrack) path.replace(path.begin(), path.end(), "Pixel/LumiBlockOnTrack"); - MonGroup lumiBlockHist(this, path.c_str(), lowStat, ATTRIB_MANAGED); // declare a group of histograms - - StatusCode sc; - - if (m_do2DMaps && !m_doOnline) { - m_errors_LB = std::make_unique<PixelMon2DMapsLW>("Errors_LB", ("Errors" + m_histTitleExt).c_str(), PixMon::HistConf::kPixDBMIBL2D3D, true); - sc = m_errors_LB->regHist(lumiBlockHist); - - m_errors_RODSync_mod = std::make_unique<PixelMon2DMapsLW>("Errors_RODSync_LB", ("Errors_RODSync" + m_histTitleExt).c_str(), PixMon::HistConf::kPixDBMIBL2D3D, true); - sc = m_errors_RODSync_mod->regHist(lumiBlockHist); - - m_errors_ModSync_mod = std::make_unique<PixelMon2DMapsLW>("Errors_ModSync_LB", ("Errors_ModSync" + m_histTitleExt).c_str(), PixMon::HistConf::kPixDBMIBL2D3D, true); - sc = m_errors_ModSync_mod->regHist(lumiBlockHist); - } - - if (sc.isFailure() && msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "histograms not booked" << endmsg; - return StatusCode::SUCCESS; -} - -StatusCode PixelMainMon::fillRODErrorMon(void) { - const int kLumiBlock = m_manager->lumiBlockNumber(); - const int kNumFEs{16}; - - static constexpr int kNumModulesPhi[PixLayer::COUNT] = {48, 48, 22, 38, 52, 14}; - static constexpr int kNumModulesEta[PixLayer::COUNT] = {3, 3, 13, 13, 13, 20}; - - // Error counters: total; errors by bit; errors by state (sync etc.) - int num_errors[PixLayerIBL2D3DDBM::COUNT] = {0}; - int num_errors_per_bit[PixLayerIBL2D3DDBM::COUNT][kNumErrorBits] = {{0}}; - int num_errors_per_state[PixLayer::COUNT - 1][kNumErrorStates] = {{0}}; // no IBL here - int num_errors_per_stateDBMIBL[PixLayerDBM::COUNT - PixLayerDBM::kDBMA][kNumErrorStatesIBL] = {{0}}; // DBMA, DBMC, IBL - double bitstream_occ_errors[PixLayerIBL2D3D::COUNT] = {0}; - double bitstream_occ_tot[PixLayerIBL2D3D::COUNT] = {0}; - - // Counter for erroneous modules on the layer, per error type and - // category (error cat. = error type w/o ROD/MOD distinction). - int num_errormodules_per_cat[PixLayerIBL2D3DDBM::COUNT][ErrorCategory::COUNT] = {{0}}; - int num_errormodules_per_type[PixLayerIBL2D3DDBM::COUNT][ErrorCategoryMODROD::COUNT] = {{0}}; - - // Counter for erroneous FEs per module per layer. - int num_errorFEs_EA[kNumModulesPhi[PixLayer::kECA]][kNumModulesEta[PixLayer::kECA]][kNumFEs] = {{{0}}}; - int num_errorFEs_EC[kNumModulesPhi[PixLayer::kECC]][kNumModulesEta[PixLayer::kECC]][kNumFEs] = {{{0}}}; - int num_errorFEs_B0[kNumModulesPhi[PixLayer::kB0]][kNumModulesEta[PixLayer::kB0]][kNumFEs] = {{{0}}}; - int num_errorFEs_B1[kNumModulesPhi[PixLayer::kB1]][kNumModulesEta[PixLayer::kB1]][kNumFEs] = {{{0}}}; - int num_errorFEs_B2[kNumModulesPhi[PixLayer::kB2]][kNumModulesEta[PixLayer::kB2]][kNumFEs] = {{{0}}}; - - const auto& kFeErrorWords = m_ErrorSvc->getAllFeErrors(); - - PixelID::const_id_iterator idIt = m_pixelid->wafer_begin(); - PixelID::const_id_iterator idItEnd = m_pixelid->wafer_end(); - - // Pixel ID Loop - for (; idIt != idItEnd; ++idIt) { - Identifier WaferID = *idIt; - IdentifierHash id_hash = m_pixelid->wafer_hash(WaferID); - const uint64_t kErrorWord = m_ErrorSvc->getModuleErrors(id_hash); - - bool is_fei4 = false; - if (m_ErrorSvc->isActive(id_hash) && m_pixelid->barrel_ec(WaferID) == 0 && m_pixelid->layer_disk(WaferID) == 0 && m_doIBL) is_fei4 = true; - if (m_ErrorSvc->isActive(id_hash) && abs(m_pixelid->barrel_ec(WaferID)) == 4 && m_doIBL) is_fei4 = true; - - // Determine layer; functions return '99' for non-sensible IDs. - const int kLayer = getPixLayerIDDBM(m_pixelid->barrel_ec(WaferID), m_pixelid->layer_disk(WaferID), m_doIBL); - const int kLayerIBL = getPixLayerIDIBL2D3DDBM(m_pixelid->barrel_ec(WaferID), m_pixelid->layer_disk(WaferID), m_pixelid->eta_module(WaferID), m_doIBL); - if (kLayer == 99) continue; - - // Boolean whether current module has an error of type/category. - bool has_err_cat[ErrorCategory::COUNT] = {false}; - bool has_err_type[ErrorCategoryMODROD::COUNT] = {false}; - - for (unsigned int bit = 0; bit < kNumErrorBits; bit++) { - if ((kErrorWord & (static_cast<uint64_t>(1) << bit)) != 0) { - // For non-IBL, We deal with FE/MCC errors separately, so ignore them here! - if (!is_fei4 && bit >= 4 && bit <= 16) continue; - - num_errors[kLayer]++; - num_errors_per_bit[kLayer][bit]++; - if (kLayerIBL != 99) { - num_errors[kLayerIBL]++; - num_errors_per_bit[kLayerIBL][bit]++; - } - - int error_type = 0; - int error_cat = 0; - - if (!is_fei4) { - // if (bit == 14 || bit == 15 || bit == 16) error_type = 1; // module synchronization errors (14: BCID, 15: BCID. 16: LVL1ID) - if (bit == 20 || bit == 21) error_type = 2; // ROD synchronization errors (20: BCID, 21: LVL1ID) - // if (bit == 4 || bit == 12 || bit == 13) error_type = 3; // module truncation errors (4: EOC, 12: hit overflow, 13: EoE overflow) - if (bit == 0 || bit == 1) error_type = 4; // ROD truncation errors (0: FIFO Overflow, 1: H/T Limit) - if (bit == 23) error_type = 5; // optical errors (23: preamble (bitflip)) - // if (bit >= 5 && bit <= 7) error_type = 6; // SEU (single event upset) errors (5,6,7: hit parity, register parity, hammingcode) - if (bit == 22) error_type = 7; // timeout errors (22: timeout on ROD formatter) - } else { - if (bit == 3 || bit == 4 || bit == 8) error_type = 1; // synchronization error (3:LVL1ID, 4:BCID, 8:BCID counter error) - if (bit == 0 || bit == 18) error_type = 3; // module truncation error (0:Row/Column error, 18:Truncated event) - if (bit == 1) error_type = 4; // ROD truncation error (1:Limit error) - if (bit == 5) error_type = 5; // optical error (5:Preable error) - if (bit == 9 || bit == 10 || bit == 11 || bit == 19 || bit == 23 || bit == 24 || bit == 26) error_type = 6; // SEU (9,10,11: hammingcode, 19:Triple redundant, 23:Bit flip, 24:SEU, 26:Triple redundant) - if (bit == 2 || bit == 7) error_type = 7; // Timeout error (2:Trailer timeout error, 7:readout timeout - } - - if (error_type) { // if there were any errors we care about - if (error_type == 1 || error_type == 2) error_cat = ErrorCategory::kSync; - if (error_type == 3 || error_type == 4) error_cat = ErrorCategory::kTrunc; - if (error_type == 5) error_cat = ErrorCategory::kOpt; - if (error_type == 6) error_cat = ErrorCategory::kSeu; - if (error_type == 7) error_cat = ErrorCategory::kTout; - - if (m_errors) m_errors->fill(error_type, WaferID, m_pixelid); - - if (m_doLumiBlock && m_errors_LB) { - m_errors_LB->fill(WaferID, m_pixelid); - } - - if (!has_err_type[error_type - 1]) { - if (m_errhist_errtype_map[error_type - 1] && !m_doOnline) { - m_errhist_errtype_map[error_type - 1]->fill(WaferID, m_pixelid); - } - num_errormodules_per_type[kLayer][error_type - 1]++; - if (kLayerIBL != 99) num_errormodules_per_type[kLayerIBL][error_type - 1]++; - has_err_type[error_type - 1] = true; - } - if (!has_err_cat[error_cat]) { - if (m_errhist_errcat_map[error_cat] && !m_doOnline) { - m_errhist_errcat_map[error_cat]->fill(WaferID, m_pixelid); - } - num_errormodules_per_cat[kLayer][error_cat]++; - if (kLayerIBL != 99) { - num_errormodules_per_cat[kLayerIBL][error_cat]++; - } - has_err_cat[error_cat] = true; - } - - if (bit == 4) { // EoC trunc error - int fephi = 0; - int feeta = 0; - if (kLayer == PixLayerDBM::kB0 && getFEID(kLayer, m_pixelid->phi_index(WaferID), m_pixelid->eta_index(WaferID), fephi, feeta)) { - num_errorFEs_B0[m_pixelid->phi_module(WaferID)][(int)(fabs(6 + m_pixelid->eta_module(WaferID)))][(int)((8 * fephi) + feeta)] = 1; - } - if (kLayer == PixLayerDBM::kB1 && getFEID(kLayer, m_pixelid->phi_index(WaferID), m_pixelid->eta_index(WaferID), fephi, feeta)) { - num_errorFEs_B1[m_pixelid->phi_module(WaferID)][(int)(fabs(6 + m_pixelid->eta_module(WaferID)))][(int)((8 * fephi) + feeta)] = 1; - } - if (kLayer == PixLayerDBM::kB2 && getFEID(kLayer, m_pixelid->phi_index(WaferID), m_pixelid->eta_index(WaferID), fephi, feeta)) { - num_errorFEs_B2[m_pixelid->phi_module(WaferID)][(int)(fabs(6 + m_pixelid->eta_module(WaferID)))][(int)((8 * fephi) + feeta)] = 1; - } - if (kLayer == PixLayerDBM::kECA && getFEID(kLayer, m_pixelid->phi_index(WaferID), m_pixelid->eta_index(WaferID), fephi, feeta)) { - num_errorFEs_EA[m_pixelid->phi_module(WaferID)][(int)m_pixelid->layer_disk(WaferID)][(int)((8 * fephi) + feeta)] = 1; - } - if (kLayer == PixLayerDBM::kECC && getFEID(kLayer, m_pixelid->phi_index(WaferID), m_pixelid->eta_index(WaferID), fephi, feeta)) { - num_errorFEs_EC[m_pixelid->phi_module(WaferID)][(int)m_pixelid->layer_disk(WaferID)][(int)((8 * fephi) + feeta)] = 1; - } - } - } // End of if(error_type) - - if (getErrorState(bit, is_fei4) != 99) { - if (is_fei4) { - num_errors_per_stateDBMIBL[kLayer - PixLayerDBM::kDBMA][getErrorState(bit, is_fei4) - kNumErrorStates]++; - } else { - num_errors_per_state[kLayer][getErrorState(bit, is_fei4)]++; - } - if (m_errhist_expert_maps[getErrorState(bit, is_fei4)]) m_errhist_expert_maps[getErrorState(bit, is_fei4)]->fill(WaferID, m_pixelid); - } - - if (kLayer == PixLayerDBM::kIBL) { - if (m_errhist_expert_servrec_ibl_unweighted) m_errhist_expert_servrec_ibl_unweighted->Fill(bit); - if (m_errhist_expert_servrec_ibl_weighted) m_errhist_expert_servrec_ibl_weighted->Fill(bit, m_ErrorSvc->getServiceRecordCount(bit)); - if (m_errhist_expert_servrec_ibl_count) m_errhist_expert_servrec_ibl_count->Fill(m_ErrorSvc->getServiceRecordCount(bit)); - } - } // end bit shifting - } // end for loop over bits - - unsigned int num_femcc_errwords = 0; - - // Do the same bit-shifting again, this time for FE/MCC error words. - if (!is_fei4 && kFeErrorWords.find(id_hash) != kFeErrorWords.end()) { - // Collection of: FE ID, associated error word - std::map<unsigned int, unsigned int> fe_errorword_map = kFeErrorWords.find(id_hash)->second; - - for (const auto& map_entry : fe_errorword_map) { - const auto& fe_errorword = map_entry.second; - bool has_femcc_errbits{false}; - - for (int bit = 0; bit < kNumErrorBits; ++bit) { - if ((fe_errorword & (static_cast<uint64_t>(1) << bit)) != 0) { - // FE Error word contains 'bit', so take appropriate actions. - num_errors[kLayer]++; - num_errors_per_bit[kLayer][bit]++; - - // This error word contains FE/MCC related errors. - if (bit >=4 && bit <=16) has_femcc_errbits = true; - - int error_type = 0; // same definitions as above - int error_cat = 0; // same definitions as above - - if (bit == 14 || bit == 15 || bit == 16) error_type = 1; - if (bit == 4 || bit == 12 || bit == 13) error_type = 3; - if (bit >= 5 && bit <= 7) error_type = 6; - - if (error_type) { // if there were any errors we care about - if (error_type == 1) error_cat = ErrorCategory::kSync; - if (error_type == 3) error_cat = ErrorCategory::kTrunc; - if (error_type == 6) error_cat = ErrorCategory::kSeu; - - if (m_errors) m_errors->fill(error_type, WaferID, m_pixelid); - - if (m_doLumiBlock && m_errors_LB) { - m_errors_LB->fill(WaferID, m_pixelid); - } - - // Should this stay the same? This counts '1' for errors, - // regardless of how many FEs have that error type. - if (!has_err_type[error_type - 1]) { - if (m_errhist_errtype_map[error_type - 1] && !m_doOnline) { - m_errhist_errtype_map[error_type - 1]->fill(WaferID, m_pixelid); - } - num_errormodules_per_type[kLayer][error_type - 1]++; - if (kLayerIBL != 99) num_errormodules_per_type[kLayerIBL][error_type - 1]++; - has_err_type[error_type - 1] = true; - } - if (!has_err_cat[error_cat]) { - if (m_errhist_errcat_map[error_cat] && !m_doOnline) { - m_errhist_errcat_map[error_cat]->fill(WaferID, m_pixelid); - } - num_errormodules_per_cat[kLayer][error_cat]++; - if (kLayerIBL != 99) { - num_errormodules_per_cat[kLayerIBL][error_cat]++; - } - has_err_cat[error_cat] = true; - } - } - - if (getErrorState(bit, is_fei4) != 99) { - num_errors_per_state[kLayer][getErrorState(bit, is_fei4)]++; - if (m_errhist_expert_maps[getErrorState(bit, is_fei4)]) m_errhist_expert_maps[getErrorState(bit, is_fei4)]->fill(WaferID, m_pixelid); - } - } // end bit shifting - } // end for loop over bits - - // If we have bits generated by FE/MCC, count this error word. - if (has_femcc_errbits) num_femcc_errwords++; - } // end loop over FE error words - } - - m_errhist_femcc_errwords_map->fill(WaferID, m_pixelid, num_femcc_errwords); - if (kLayer == PixLayer::kIBL) { - bool has_error = has_err_type[0] || has_err_type[2] || has_err_type[4] || has_err_type[5] || has_err_type[6]; - m_errhist_bitstr_occ_errors->fill(WaferID, m_pixelid, getBitStreamFraction(WaferID, (has_error ? 30 : 0))); - m_errhist_bitstr_occ_tot->fill(WaferID, m_pixelid, getBitStreamFraction(WaferID, getEventBitLength(WaferID, (has_error ? 1 : 0)))); - // Determine whether we are looking at a 2D or 3D module. If 2D, we need - // to double-count hits in the following arrays. This is because - // m_nActive_mod counts individual FEs for IBL. - bool is_ibl2d = (m_pixelid->eta_module(WaferID) < 6 && m_pixelid->eta_module(WaferID) > -7); - bitstream_occ_errors[kLayer] += (is_ibl2d ? 2 : 1) * getBitStreamFraction(WaferID, (has_error ? 30 : 0)); - bitstream_occ_tot[kLayer] += (is_ibl2d ? 2 : 1) * getBitStreamFraction(WaferID, getEventBitLength(WaferID, (has_error ? 1 : 0))); - if (kLayerIBL != 99) { - bitstream_occ_errors[kLayerIBL] += getBitStreamFraction(WaferID, (has_error ? 30 : 0)); - bitstream_occ_tot[kLayerIBL] += getBitStreamFraction(WaferID, getEventBitLength(WaferID, (has_error ? 1 : 0))); - } - } else { - m_errhist_bitstr_occ_errors->fill(WaferID, m_pixelid, getBitStreamFraction(WaferID, num_femcc_errwords * 22)); - m_errhist_bitstr_occ_tot->fill(WaferID, m_pixelid, getBitStreamFraction(WaferID, getEventBitLength(WaferID, num_femcc_errwords))); - bitstream_occ_errors[kLayer] += getBitStreamFraction(WaferID, num_femcc_errwords * 22); - bitstream_occ_tot[kLayer] += getBitStreamFraction(WaferID, getEventBitLength(WaferID, num_femcc_errwords)); - } - - if (m_doLumiBlock) { - if (m_errors_ModSync_mod && has_err_type[0]) m_errors_ModSync_mod->fill(WaferID, m_pixelid); - if (m_errors_RODSync_mod && has_err_type[1]) m_errors_RODSync_mod->fill(WaferID, m_pixelid); - } - } // end loop over all identifiers - - double total_errors = 0; - for (int i = 0; i < PixLayerIBL2D3DDBM::COUNT; i++) { - total_errors += num_errors[i]; - } - - for (int i = 0; i < PixLayer::COUNT - 1; i++) { - for (int j = 0; j < kNumErrorStates; j++) { - if (m_errhist_expert_LB[i][j] && m_nActive_mod[getPixLayerIDWithDBM(i)] > 0) { - m_errhist_expert_LB[i][j]->Fill(kLumiBlock, (float)num_errors_per_state[i][j] / m_nActive_mod[getPixLayerIDWithDBM(i)]); - } - } - } - - for (int j = 0; j < kNumErrorStatesIBL; j++) { - for (int i = 0; i < PixLayerDBM::COUNT - PixLayerDBM::kDBMA; i++) { - if (m_errhist_expert_DBMIBL_LB[i][j] && m_nActive_mod[i + PixLayerIBL2D3DDBM::kDBMA] > 0) { - m_errhist_expert_DBMIBL_LB[i][j]->Fill(kLumiBlock, (float)num_errors_per_stateDBMIBL[i][j] / m_nActive_mod[i + PixLayerIBL2D3DDBM::kDBMA]); - } - } - } - - for (int i = 0; i < PixLayerIBL2D3DDBM::COUNT; i++) { - if (m_errhist_per_bit_LB[i] && m_nActive_mod[i] > 0) { - for (int j = 0; j < kNumErrorBits; j++) { - m_errhist_per_bit_LB[i]->Fill(kLumiBlock, j, (float)num_errors_per_bit[i][j] / m_nActive_mod[i]); - } - } - if (m_errhist_per_type_LB[i] && m_nActive_mod[i] > 0) { - for (int j = 0; j < ErrorCategoryMODROD::COUNT; j++) { - m_errhist_per_type_LB[i]->Fill(kLumiBlock, j, (float)num_errormodules_per_type[i][j] / m_nActive_mod[i]); - } - } - } - - for (int i = 0; i < PixLayerIBL2D3DDBM::COUNT; i++) { - if (m_errhist_tot_LB[i]) m_errhist_tot_LB[i]->Fill(kLumiBlock, num_errors[i]); - - for (int j = 0; j < ErrorCategory::COUNT; ++j) { - if (m_errhist_errcat_LB[i][j]) m_errhist_errcat_LB[i][j]->Fill(kLumiBlock, num_errormodules_per_cat[i][j]); - } - - for (int j = 0; j < ErrorCategoryMODROD::COUNT - 3; ++j) { - if (m_errhist_errtype_LB[i][j]) m_errhist_errtype_LB[i][j]->Fill(kLumiBlock, num_errormodules_per_type[i][j]); - } - - for (int j = 0; j < ErrorCategory::COUNT; j++) { - if (m_errhist_errcat_avg[j][i] && m_nActive_mod[i] > 0) { - m_errhist_errcat_avg[j][i]->Fill(kLumiBlock, (float)num_errormodules_per_cat[i][j] / m_nActive_mod[i]); - } - } - for (int j = 0; j < ErrorCategoryMODROD::COUNT - 3; j++) { - if (m_errhist_errtype_avg[j][i] && m_nActive_mod[i] > 0) { - m_errhist_errtype_avg[j][i]->Fill(kLumiBlock, (float)num_errormodules_per_type[i][j] / m_nActive_mod[i]); - } - } - } - - for (int i = 0; i < PixLayerIBL2D3D::COUNT; ++i) { - if (m_errhist_bitstr_occ_errors_avg[i]) m_errhist_bitstr_occ_errors_avg[i]->Fill(kLumiBlock, (float) bitstream_occ_errors[i]/m_nActive_mod[getPixLayerIDWithDBM(i)]); - if (m_errhist_bitstr_occ_tot_avg[i]) m_errhist_bitstr_occ_tot_avg[i]->Fill(kLumiBlock, (float) bitstream_occ_tot[i]/m_nActive_mod[getPixLayerIDWithDBM(i)]); - } - - if (m_errhist_syncerr_LB_pix) { - m_errhist_syncerr_LB_pix->Fill(kLumiBlock, num_errormodules_per_cat[PixLayerIBL2D3DDBM::kB0][ErrorCategory::kSync] - + num_errormodules_per_cat[PixLayerIBL2D3DDBM::kB1][ErrorCategory::kSync] - + num_errormodules_per_cat[PixLayerIBL2D3DDBM::kB2][ErrorCategory::kSync]); - } - - for (int i = 0; i < PixLayer::COUNT; i++) { - for (int phi = 0; phi < kNumModulesPhi[i]; phi++) { - for (int eta = 0; eta < kNumModulesEta[i]; eta++) { - int nfes = 0; - for (int j = 0; j < kNumFEs; j++) { - if (i == PixLayer::kECA) nfes += num_errorFEs_EA[phi][eta][j]; - if (i == PixLayer::kECC) nfes += num_errorFEs_EC[phi][eta][j]; - if (i == PixLayer::kB0) nfes += num_errorFEs_B0[phi][eta][j]; - if (i == PixLayer::kB1) nfes += num_errorFEs_B1[phi][eta][j]; - if (i == PixLayer::kB2) nfes += num_errorFEs_B2[phi][eta][j]; - } - if (m_errhist_expert_fe_trunc_err_3d[i]) m_errhist_expert_fe_trunc_err_3d[i]->Fill(m_manager->lumiBlockNumber(), eta, nfes); - } - } - } - - return StatusCode::SUCCESS; -} - -unsigned int PixelMainMon::getEventBitLength(const Identifier& WaferID, const unsigned int& num_errwords) { - // The bit lengths for FE-I4-based components are (after 8b/10b conversion): - // - 50 bits for start/end words and data header - // - 30 bits for each data record (hits) - // - 30 bits for each service record (errors) - // - // The bit lengths for FE-I3-based components are: - // - 45 bits for event ID, header, trailer - // - 9 bits for each FE ID. If more than 16 hits:, count 16 FE ID blocks; - // otherwise calculate max(number of hits, number of error words). - // - 22 bits for each hit word - // - 22 bits for each error word - const int layer = getPixLayerID(m_pixelid->barrel_ec(WaferID), m_pixelid->layer_disk(WaferID), m_doIBL); - - unsigned int num_hits = 0; - if (layer == PixLayer::kIBL) { - num_hits = m_HitPerEventArray_lI_phi_paired[m_pixelid->phi_module(WaferID)][static_cast<int>(fabs(10 + m_pixelid->eta_module(WaferID)))]; - } else if (layer == PixLayer::kB0) { - num_hits = m_HitPerEventArray_l0[m_pixelid->phi_module(WaferID)][static_cast<int>(fabs(6 + m_pixelid->eta_module(WaferID)))]; - } else if (layer == PixLayer::kB1) { - num_hits = m_HitPerEventArray_l1[m_pixelid->phi_module(WaferID)][static_cast<int>(fabs(6 + m_pixelid->eta_module(WaferID)))]; - } else if (layer == PixLayer::kB2) { - num_hits = m_HitPerEventArray_l2[m_pixelid->phi_module(WaferID)][static_cast<int>(fabs(6 + m_pixelid->eta_module(WaferID)))]; - } else if (layer == PixLayer::kECA) { - num_hits = m_HitPerEventArray_disksA[m_pixelid->phi_module(WaferID)][m_pixelid->layer_disk(WaferID)]; - } else if (layer == PixLayer::kECC) { - num_hits = m_HitPerEventArray_disksC[m_pixelid->phi_module(WaferID)][m_pixelid->layer_disk(WaferID)]; - } - - // Return here if we have neither hits nor errors - if (num_hits == 0 && num_errwords == 0) { - return 0; - } - - int total_bits{0}; - if (layer == PixLayer::kIBL && num_hits > 0) { - total_bits = 50; - total_bits += num_hits * 30; - total_bits += num_errwords * 30; - } else { - total_bits = 45; - if (num_hits >= 16) { - total_bits += 16 * 9; - } else { - total_bits += std::max(num_hits, num_errwords) * 9; - } - total_bits += num_hits * 22; - total_bits += num_errwords * 22; - } - return total_bits; -} - -double PixelMainMon::getBitStreamFraction(const Identifier& WaferID, const unsigned int& bits) { - // Assuming a trigger rate of 100k, this function returns the fraction of the - // bit stream consumed by the inputted number of bits. - const int layer = getPixLayerID(m_pixelid->barrel_ec(WaferID), m_pixelid->layer_disk(WaferID), m_doIBL); - - // Assumed available bandwidth per layer - double mbits_sec = 80.; - if (layer == PixLayer::kB0 || layer == PixLayer::kB1) mbits_sec = 160.; - if (layer == PixLayer::kIBL) { - if (m_pixelid->eta_module(WaferID) < 6 && m_pixelid->eta_module(WaferID) > -7) { - mbits_sec = 320.; // 2D modules are 2 FEs with 160 Mbit/s each - } else { - mbits_sec = 160.; - } - } - - // Average bits available per event, assuming 100k trigger rate - double avg_available_bits = mbits_sec / 0.1; - return static_cast<double>(bits / avg_available_bits); -} - -int PixelMainMon::getErrorState(int bit, bool isibl) { - int erstate = 99; - if (!isibl) { - switch (bit) { - case 14: - erstate = 0; - break; - case 15: - erstate = 1; - break; - case 16: - erstate = 2; - break; - case 20: - erstate = 3; - break; - case 21: - erstate = 4; - break; - case 4: - erstate = 5; - break; - case 12: - erstate = 6; - break; - case 13: - erstate = 7; - break; - case 1: - erstate = 8; - break; - case 0: - erstate = 9; - break; - case 23: - erstate = 10; - break; - case 5: - erstate = 11; - break; - case 6: - erstate = 12; - break; - case 7: - erstate = 13; - break; - case 22: - erstate = 14; - break; - case 8: - erstate = 15; - break; - default: - erstate = 99; - break; - } - } else { - switch (bit) { - case 3: - erstate = 16; // BCID, Synch - break; - case 4: - erstate = 17; // LVL1ID, Synch - break; - case 8: - erstate = 18; // BCID counter, Synch - break; - case 12: - erstate = 19; // L1 trigger input in EODCL counter (write pointer), Synch - break; - case 13: - erstate = 20; // L1 trigger request counter to EODCL (read pointer), Synch - break; - case 14: - erstate = 21; // L1 register, register is full, Synch - break; - case 15: - erstate = 22; // L1 trigger ID in BC register, Synch - break; - case 17: - erstate = 23; // Skipped trigger because the L1 register is full, Synch - break; - case 0: - erstate = 24; // Row/Column, Trunc - break; - case 18: - erstate = 25; // Truncated event, Trunc - break; - case 1: - erstate = 26; // Limit error ROD, Trunc - break; - case 5: - erstate = 27; // Preamble error, Optical - break; - case 9: - erstate = 28; // Hamming code in word 0 in EOCHL, SEU - break; - case 10: - erstate = 29; // Hamming code in word 1 in EOCHL, SEU - break; - case 11: - erstate = 30; // Hamming code in word 2 in EOCHL, SEU - break; - case 19: - erstate = 31; // Triple redundant mismatch in Global Configuration Memory (CNFGMEM,) SEU - break; - case 23: - erstate = 32; // Bit flip in CMD, SEU - break; - case 24: - erstate = 33; // Triple redundant mismatch in CMD, SEU - break; - case 26: - erstate = 34; // Triple redundant mismatch in EFUSE, SEU - break; - case 2: - erstate = 35; // Trailer timeout, Timeout - break; - case 7: - erstate = 36; // Timeout ROD, Timeout - break; - case 6: - erstate = 37; // Masked link - break; - case 16: - erstate = 38; // FE readout process error - break; - case 20: - erstate = 39; // Write register data error - break; - case 21: - erstate = 40; // Address error - break; - case 22: - erstate = 41; // Other CMD decoder error - break; - case 25: - erstate = 42; // Data bus address - break; - default: - erstate = 99; - break; - } - } - - return erstate; -} diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/src/HelperFunctions.cxx b/InnerDetector/InDetMonitoring/PixelMonitoring/src/HelperFunctions.cxx deleted file mode 100644 index 8450df6b536628e68501532f87f197ce361b8c23..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetMonitoring/PixelMonitoring/src/HelperFunctions.cxx +++ /dev/null @@ -1,456 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/////////////////////////////////////////////////////////////////////////////// -// Helper functions used by other methods -/////////////////////////////////////////////////////////////////////////////// - -#include <algorithm> -#include <sstream> -#include <vector> -#include "InDetIdentifier/PixelID.h" -#include "LWHists/TH1F_LW.h" -#include "LWHists/TH1I_LW.h" -#include "LWHists/TH2F_LW.h" -#include "LWHists/TH2I_LW.h" -#include "LWHists/TProfile_LW.h" -#include "LWHists/TProfile2D_LW.h" -#include "PixelMonitoring/PixelMainMon.h" -#include "PixelMonitoring/PixelMon2DMapsLW.h" -#include "PixelMonitoring/PixelMon2DProfilesLW.h" -#include "PixelMonitoring/Components.h" -#include "TH1I.h" -#include "TH2I.h" -#include "TProfile2D.h" -#include "TString.h" - -std::string PixelMainMon::makeHistname(std::string set, bool ontrk) { - std::string name = set; - if (ontrk && m_doOnTrack) name += "_OnTrack"; - return name; -} - -std::string PixelMainMon::makeHisttitle(std::string set, std::string axis, bool ontrk) { - std::string name = set; - if (ontrk && m_doOnTrack) name += "_OnTrack"; - name = name + m_histTitleExt + axis; - return name; -} - -int PixelMainMon::getPixLayerID(int ec, int ld, bool ibl) { - int layer = 99; - if (ec == 2) { - layer = PixLayer::kECA; - } else if (ec == -2) { - layer = PixLayer::kECC; - } else if (ec == 0) { - if (ibl && ld == 0) layer = PixLayer::kIBL; - if (ld == 0 + ibl) layer = PixLayer::kB0; - if (ld == 1 + ibl) layer = PixLayer::kB1; - if (ld == 2 + ibl) layer = PixLayer::kB2; - } - return layer; -} - -int PixelMainMon::getPixLayerIDWithDBM(int id) { - // Translate PixLayerID to PixLayerIDDBM - if (id >= PixLayer::kIBL) return id + 2; - return id; -} - -int PixelMainMon::getPixLayerIDDBM(int ec, int ld, bool ibl) { - int layer = 99; - if (ec == 2) { - layer = PixLayerDBM::kECA; - } else if (ec == -2) { - layer = PixLayerDBM::kECC; - } else if (ec == 0) { - if (ibl && ld == 0) layer = PixLayerDBM::kIBL; - if (ld == 0 + ibl) layer = PixLayerDBM::kB0; - if (ld == 1 + ibl) layer = PixLayerDBM::kB1; - if (ld == 2 + ibl) layer = PixLayerDBM::kB2; - } else { - if (ec == 4) layer = PixLayerDBM::kDBMA; - if (ec == -4) layer = PixLayerDBM::kDBMC; - } - return layer; -} - -int PixelMainMon::getPixLayerIDIBL2D3D(int ec, int ld, int eta, bool ibl) { - int layer = 99; - if (ec == 0) { - if (ibl && ld == 0 && eta < 6 && eta > -7) layer = PixLayerIBL2D3D::kIBL2D; - if (ibl && ld == 0 && !(eta < 6 && eta > -7)) layer = PixLayerIBL2D3D::kIBL3D; - } - return layer; -} - -int PixelMainMon::getPixLayerIDIBL2D3DDBM(int ec, int ld, int eta, bool ibl) { - int layer = 99; - if (ec == 0) { - if (ibl && ld == 0 && eta < 6 && eta > -7) layer = PixLayerIBL2D3DDBM::kIBL2D; - if (ibl && ld == 0 && !(eta < 6 && eta > -7)) layer = PixLayerIBL2D3DDBM::kIBL3D; - } - return layer; -} - -int PixelMainMon::getPixLayerDiskID(int ec, int ld, bool ibl) { - int layer = 99; - if (ec == 2) { - layer = PixLayerDisk::kECA0 + ld; - } else if (ec == -2) { - layer = PixLayerDisk::kECC0 + ld; - } else if (ec == 0) { - if (ibl && ld == 0) layer = PixLayerDisk::kIBL; - if (ld == 0 + ibl) layer = PixLayerDisk::kB0; - if (ld == 1 + ibl) layer = PixLayerDisk::kB1; - if (ld == 2 + ibl) layer = PixLayerDisk::kB2; - } - return layer; -} - -void PixelMainMon::th1FillMonitoring(TH1F_LW* mon, TH1F_LW* tmp) { - for (unsigned int i = 1; i <= tmp->GetNbinsX(); i++) { - float content = tmp->GetBinContent(i); - mon->SetBinContent(i, content); - } - tmp->Reset(); -} - -void PixelMainMon::fillSummaryHistos(PixelMon2DMapsLW* occupancy, TH1F_LW* A, TH1F_LW* C, TH1F_LW* IBL, TH1F_LW* B0, TH1F_LW* B1, TH1F_LW* B2) { - // if the histos don't exist, dont' fill them - if (!(A && C && B0 && B1 && B2 && occupancy)) return; - double events = m_event; - if (events == 0) return; - - if (IBL) { - IBL->Reset(); - } - B0->Reset(); - B1->Reset(); - B2->Reset(); - A->Reset(); - C->Reset(); - - if (IBL) { - for (int etaIndex = 1; etaIndex <= 12; etaIndex++) { - for (int phiIndex = 1; phiIndex <= 14; phiIndex++) { - IBL->Fill(occupancy->IBL2D->GetBinContent(etaIndex, phiIndex) / events); - } - } - for (int etaIndex = 1; etaIndex <= 8; etaIndex++) { - for (int phiIndex = 1; phiIndex <= 14; phiIndex++) { - IBL->Fill(occupancy->IBL3D->GetBinContent(etaIndex, phiIndex) / events); - } - } - } - for (int etaIndex = 1; etaIndex <= 13; etaIndex++) { - for (int phiIndex = 1; phiIndex <= 22; phiIndex++) { - B0->Fill(occupancy->B0->GetBinContent(etaIndex, phiIndex) / events); - } - for (int phiIndex = 1; phiIndex <= 38; phiIndex++) { - B1->Fill(occupancy->B1->GetBinContent(etaIndex, phiIndex) / events); - } - for (int phiIndex = 1; phiIndex <= 52; phiIndex++) { - B2->Fill(occupancy->B2->GetBinContent(etaIndex, phiIndex) / events); - } - } - for (int etaIndex = 1; etaIndex <= 3; etaIndex++) { - for (int phiIndex = 1; phiIndex <= 48; phiIndex++) { - A->Fill(occupancy->A->GetBinContent(etaIndex, phiIndex) / events); - C->Fill(occupancy->C->GetBinContent(etaIndex, phiIndex) / events); - } - } -} - -void PixelMainMon::formatPP0Histos(TProfile_LW* D_A, TProfile_LW* D_C, TProfile_LW* B0, TProfile_LW* B1, TProfile_LW* B2, TProfile_LW* IBL_A, TProfile_LW* IBL_C) { - if (!(D_A && D_C && B0 && B1 && B2)) return; - if (IBL_A && IBL_C) { - for (unsigned int i = 0; i < PixMon::kNumStavesIBL; ++i) { - IBL_A->GetXaxis()->SetBinLabel(i + 1, PixMon::StavesIBL.at(i).c_str()); - IBL_A->GetXaxis()->SetLabelSize(0.03); - IBL_A->SetMinimum(0.); - IBL_C->GetXaxis()->SetBinLabel(i + 1, PixMon::StavesIBL.at(i).c_str()); - IBL_C->GetXaxis()->SetLabelSize(0.03); - IBL_C->SetMinimum(0.); - } - } - if (B0 && B1 && B2) { - for (unsigned int i = 0; i < PixMon::kNumStavesL0; ++i) { - B0->GetXaxis()->SetBinLabel(i + 1, PixMon::StavesL0.at(i).c_str()); - B0->GetXaxis()->SetLabelSize(0.03); - B0->SetMinimum(0.); - } - for (unsigned int i = 0; i < PixMon::kNumStavesL1; ++i) { - B1->GetXaxis()->SetBinLabel(i + 1, PixMon::StavesL1.at(i).c_str()); - B1->GetXaxis()->SetLabelSize(0.02); - B1->SetMinimum(0.); - } - for (unsigned int i = 0; i < PixMon::kNumStavesL2; ++i) { - B2->GetXaxis()->SetBinLabel(i + 1, PixMon::StavesL2.at(i).c_str()); - B2->GetXaxis()->SetLabelSize(0.02); - B2->SetMinimum(0.); - } - } - if (D_A && D_C) { - for (unsigned int i = 0; i < PixMon::kNumPP0sEC; ++i) { - D_A->GetXaxis()->SetBinLabel(i + 1, PixMon::PP0sEC.at(i).c_str()); - D_A->GetXaxis()->SetLabelSize(0.02); - D_A->SetMinimum(0.); - D_C->GetXaxis()->SetBinLabel(i + 1, PixMon::PP0sEC.at(i).c_str()); - D_C->GetXaxis()->SetLabelSize(0.02); - D_C->SetMinimum(0.); - } - } -} - -void PixelMainMon::fillPP0Histos(PixelMon2DMapsLW* occupancy, TProfile_LW* D_A, TProfile_LW* D_C, TProfile_LW* B0, TProfile_LW* B1, TProfile_LW* B2, TProfile_LW* IBL_A, TProfile_LW* IBL_C) { - if (!(D_A && D_C && B0 && B1 && B2 && occupancy && m_status)) return; - uint64_t events = m_event - m_event_ref; - if (events == 0) return; - unsigned int nbinx; - unsigned int nbiny; - // use FE occ for IBL, mod occ for the rest - // fill only if FE is active - if (IBL_A && IBL_C) { - nbinx = occupancy->IBL->GetNbinsX(); - nbiny = occupancy->IBL->GetNbinsY(); - for (unsigned int x = 1; x <= nbinx; ++x) { - for (unsigned int y = 1; y <= nbiny; ++y) { - const auto content = occupancy->IBL->GetBinContent(x, y) / events; - if (m_status->IBL->GetBinContent(x, y)!=2) { - if (x>0.5*nbinx) IBL_A->Fill(y, content); - else IBL_C->Fill(y, content); - } - } - } - } - nbinx = occupancy->B0->GetNbinsX(); - nbiny = occupancy->B0->GetNbinsY(); - for (unsigned int x = 1; x <= nbinx; ++x) { - for (unsigned int y = 1; y <= nbiny; ++y) { - const auto content = occupancy->B0->GetBinContent(x, y) / events; - if (m_status->B0->GetBinContent(x, y)!=2) { - B0->Fill(y, content); - } - } - } - nbinx = occupancy->B1->GetNbinsX(); - nbiny = occupancy->B1->GetNbinsY(); - for (unsigned int x = 1; x <= nbinx; ++x) { - for (unsigned int y = 1; y <= nbiny; ++y) { - const auto content = occupancy->B1->GetBinContent(x, y) / events; - if (m_status->B1->GetBinContent(x, y)!=2) { - B1->Fill(y, content); - } - } - } - nbinx = occupancy->B2->GetNbinsX(); - nbiny = occupancy->B2->GetNbinsY(); - for (unsigned int x = 1; x <= nbinx; ++x) { - for (unsigned int y = 1; y <= nbiny; ++y) { - const auto content = occupancy->B2->GetBinContent(x, y) / events; - if (m_status->B2->GetBinContent(x, y)!=2) { - B2->Fill(y, content); - } - } - } - nbinx = occupancy->A->GetNbinsX(); - nbiny = occupancy->A->GetNbinsY(); - for (unsigned int x = 1; x <= nbinx; ++x) { - for (unsigned int y = 1; y <= nbiny; ++y) { - const auto content = occupancy->A->GetBinContent(x, y) / events; - if (m_status->A->GetBinContent(x, y)!=2) { - D_A->Fill( (x-1)*8 + (y-1)/6 + 1, content); - } - } - } - nbinx = occupancy->C->GetNbinsX(); - nbiny = occupancy->C->GetNbinsY(); - for (unsigned int x = 1; x <= nbinx; ++x) { - for (unsigned int y = 1; y <= nbiny; ++y) { - const auto content = occupancy->C->GetBinContent(x, y) / events; - if (m_status->C->GetBinContent(x, y)!=2) { - D_C->Fill( (x-1)*8 + (y-1)/6 + 1, content); - } - } - } -} - -bool PixelMainMon::isOnTrack(Identifier id, bool isCluster) { - bool onTrack = false; - if (isCluster) { - std::pair<Identifier, double> searchVal = std::make_pair(id, -1.0); - onTrack = std::binary_search(m_ClusterIDs.begin(), m_ClusterIDs.end(), searchVal, - [](std::pair<Identifier, double> l, std::pair<Identifier, double> r) -> bool { return l.first < r.first; }); - } else { - onTrack = binary_search(m_RDOIDs.begin(), m_RDOIDs.end(), id); - } - return onTrack; -} - -bool PixelMainMon::isOnTrack(Identifier id, double& cosalpha) { - bool onTrack(false); - std::pair<Identifier, double> searchVal = std::make_pair(id, -1.0); - auto it = std::lower_bound(m_ClusterIDs.begin(), m_ClusterIDs.end(), searchVal, - [](std::pair<Identifier, double> l, std::pair<Identifier, double> r) -> bool { return l.first < r.first; }); - - if (it != m_ClusterIDs.end() && !(id < (*it).first)) { - onTrack = true; - cosalpha = (*it).second; - } - return onTrack; -} - -// Not yet updated to include IBL: -int PixelMainMon::parseDetailsString(std::string& detailsMod) { - int modID[4] = {0, 0, 0, 0}; - char* pch; - pch = new char[detailsMod.size() + 1]; - strncpy(pch, detailsMod.c_str(), detailsMod.size()); - const int nmod = 13; - const char* mod[nmod] = {"M6C", "M5C", "M4C", "M3C", "M2C", "M1C", "M0", "M1A", "M2A", "M3A", "M4A", "M5A", "M6A"}; - const int nstave0 = 22; - const char* stave0[nstave0] = {"B11_S2", "B01_S1", "B01_S2", "B02_S1", "B02_S2", "B03_S1", "B03_S2", "B04_S1", - "B04_S2", "B05_S1", "B05_S2", "B06_S1", "B06_S2", "B07_S1", "B07_S2", "B08_S1", - "B08_S2", "B09_S1", "B09_S2", "B10_S1", "B10_S2", "B11_S1"}; - const int nstave1 = 38; - const char* stave1[nstave1] = {"B01_S1", "B01_S2", "B02_S1", "B02_S2", "B03_S1", "B03_S2", "B04_S1", "B04_S2", - "B05_S1", "B05_S2", "B06_S1", "B06_S2", "B07_S1", "B07_S2", "B08_S1", "B08_S2", - "B09_S1", "B09_S2", "B10_S1", "B10_S2", "B11_S1", "B11_S2", "B12_S1", "B12_S2", - "B13_S1", "B13_S2", "B14_S1", "B14_S2", "B15_S1", "B15_S2", "B16_S1", "B16_S2", - "B17_S1", "B17_S2", "B18_S1", "B18_S2", "B19_S1", "B19_S2"}; - const int nstave2 = 52; - const char* stave2[nstave2] = {"B01_S2", "B02_S1", "B02_S2", "B03_S1", "B03_S2", "B04_S1", "B04_S2", "B05_S1", - "B05_S2", "B06_S1", "B06_S2", "B07_S1", "B07_S2", "B08_S1", "B08_S2", "B09_S1", - "B09_S2", "B10_S1", "B10_S2", "B11_S1", "B11_S2", "B12_S1", "B12_S2", "B13_S1", - "B13_S2", "B14_S1", "B14_S2", "B15_S1", "B15_S2", "B16_S1", "B16_S2", "B17_S1", - "B17_S2", "B18_S1", "B18_S2", "B19_S1", "B19_S2", "B20_S1", "B20_S2", "B21_S1", - "B21_S2", "B22_S1", "B22_S2", "B23_S1", "B23_S2", "B24_S1", "B24_S2", "B25_S1", - "B25_S2", "B26_S1", "B26_S2", "B01_S1"}; - const char* nstaveA[48] = {"B01_S2_M1", "B01_S2_M6", "B01_S2_M2", "B01_S2_M5", "B01_S2_M3", "B01_S2_M4", "B02_S1_M1", - "B02_S1_M6", "B02_S1_M2", "B02_S1_M5", "B02_S1_M3", "B02_S1_M4", "B02_S2_M1", "B02_S2_M6", - "B02_S2_M2", "B02_S2_M5", "B02_S2_M3", "B02_S2_M4", "B03_S1_M1", "B03_S1_M6", "B03_S1_M2", - "B03_S1_M5", "B03_S1_M3", "B03_S1_M4", "B03_S2_M1", "B03_S2_M6", "B03_S2_M2", "B03_S2_M5", - "B03_S2_M3", "B03_S2_M4", "B04_S1_M1", "B04_S1_M6", "B04_S1_M2", "B04_S1_M5", "B04_S1_M3", - "B04_S1_M4", "B04_S2_M1", "B04_S2_M6", "B04_S2_M2", "B04_S2_M5", "B04_S2_M3", "B04_S2_M4", - "B01_S1_M1", "B01_S1_M6", "B01_S1_M2", "B01_S1_M5", "B01_S1_M3", "B01_S1_M4"}; - const char* nstaveC[48] = {"B01_S2_M4", "B01_S2_M3", "B01_S2_M5", "B01_S2_M2", "B01_S2_M6", "B01_S2_M1", "B02_S1_M4", - "B02_S1_M3", "B02_S1_M5", "B02_S1_M2", "B02_S1_M6", "B02_S1_M1", "B02_S2_M4", "B02_S2_M3", - "B02_S2_M5", "B02_S2_M2", "B02_S2_M6", "B02_S2_M1", "B03_S1_M4", "B03_S1_M3", "B03_S1_M5", - "B03_S1_M2", "B03_S1_M6", "B03_S1_M1", "B03_S2_M4", "B03_S2_M3", "B03_S2_M5", "B03_S2_M2", - "B03_S2_M6", "B03_S2_M1", "B04_S1_M4", "B04_S1_M3", "B04_S1_M5", "B04_S1_M2", "B04_S1_M6", - "B04_S1_M1", "B04_S2_M4", "B04_S2_M3", "B04_S2_M5", "B04_S2_M2", "B04_S2_M6", "B04_S2_M1", - "B01_S1_M4", "B01_S1_M3", "B01_S1_M5", "B01_S1_M2", "B01_S1_M6", "B01_S1_M1"}; - - // parse string and get module name - if (strstr(pch, "D1C")) { - modID[0] = -2; - modID[1] = 0; - } else if (strstr(pch, "D2C")) { - modID[0] = -2; - modID[1] = 1; - } else if (strstr(pch, "D3C")) { - modID[0] = -2; - modID[1] = 2; - } else if (strstr(pch, "D1A")) { - modID[0] = 2; - modID[1] = 0; - } else if (strstr(pch, "D2A")) { - modID[0] = 2; - modID[1] = 1; - } else if (strstr(pch, "D3A")) { - modID[0] = 2; - modID[1] = 2; - } - - if (strstr(pch, "L0")) { - modID[0] = 0; - modID[1] = 0; - for (int i = 0; i < nstave0; i++) { - if (strstr(pch, stave0[i])) { - modID[2] = i; - break; - } - } - } else if (strstr(pch, "L1")) { - modID[0] = 0; - modID[1] = 1; - for (int i = 0; i < nstave1; i++) { - if (strstr(pch, stave1[i])) { - modID[2] = i; - break; - } - } - } else if (strstr(pch, "L2")) { - modID[0] = 0; - modID[1] = 2; - for (int i = 0; i < nstave2; i++) { - if (strstr(pch, stave2[i])) { - modID[2] = i; - break; - } - } - } - - if (modID[0] == 2 || modID[0] == -2) { - for (int i = 0; i < 48; i++) { - if (modID[0] == -2 && strstr(pch, nstaveC[i])) { - modID[2] = i; - break; - } - if (modID[0] == 2 && strstr(pch, nstaveA[i])) { - modID[2] = i; - break; - } - } - } - if (modID[0] == 0) { - for (int i = 0; i < nmod; i++) { - if (strstr(pch, mod[i])) { - modID[3] = i; - break; - } - } - } - - delete[] pch; - return (1000000 + (modID[0] + 2) * 100000 + (modID[1]) * 10000 + (modID[2]) * 100 + (modID[3] + 6)); -} - -bool PixelMainMon::getFEID(int pixlayer, int phiid, int etaid, int& oufephi, int& outfeeta) { - bool isValid = true; - int npixPerFe_phi, npixPerFe_eta; - if (pixlayer == PixLayer::kECA || pixlayer == PixLayer::kECC) { - npixPerFe_phi = 160 + 4; - npixPerFe_eta = 18; - } else if (pixlayer != PixLayer::kIBL) { - npixPerFe_phi = 160 + 4; - npixPerFe_eta = 18; - } else { - npixPerFe_phi = 336; - npixPerFe_eta = 80; - isValid = false; - } - oufephi = phiid / npixPerFe_phi; - outfeeta = etaid / npixPerFe_eta; - return isValid; -} - -void PixelMainMon::divide_TH1F_LW(TH1F_LW* num, TH1F_LW* den) { - if (!num || !den || (num->GetXaxis()->GetNbins() != den->GetXaxis()->GetNbins())) return; - unsigned int binidx; - double numVal, numErr; - double denVal, denErr; - const unsigned int entries = num->GetEntries(); - num->resetActiveBinLoop(); - while (num->getNextActiveBin(binidx, numVal, numErr)) { - den->GetBinContentAndError(binidx, denVal, denErr); - if (denVal == 0) - num->SetBinContentAndError(binidx, 0, 0); - else - num->SetBinContentAndError(binidx, numVal / denVal, sqrt(pow(numErr*denVal,2)+pow(denErr*numVal,2)) / pow(denVal,2)); - } - num->SetEntries(entries); -} diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/src/Hits.cxx b/InnerDetector/InDetMonitoring/PixelMonitoring/src/Hits.cxx deleted file mode 100644 index 26135c52d0e50d785b793193afcad13d6f189043..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetMonitoring/PixelMonitoring/src/Hits.cxx +++ /dev/null @@ -1,862 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -/////////////////////////////////////////////////////////////////////////////// -// Book and fill histograms showing pixel hit level information -/////////////////////////////////////////////////////////////////////////////// - -#include <sstream> -#include "InDetIdentifier/PixelID.h" -#include "InDetRawData/InDetTimeCollection.h" -#include "LWHists/TH1F_LW.h" -#include "LWHists/TH1I_LW.h" -#include "LWHists/TH2F_LW.h" -#include "LWHists/TH2I_LW.h" -#include "LWHists/TProfile2D_LW.h" -#include "LWHists/TProfile_LW.h" -#include "PixelMonitoring/PixelMainMon.h" -#include "TH1F.h" -#include "TH1I.h" -#include "TH2F.h" -#include "TH2I.h" -#include "TH3F.h" -#include "TProfile.h" - -#include "InDetRawData/InDetRawDataCLASS_DEF.h" -#include "InDetRawData/InDetRawDataContainer.h" -#include "PixelMonitoring/Components.h" -#include "PixelMonitoring/PixelMon2DLumiProfiles.h" -#include "PixelMonitoring/PixelMon2DMapsLW.h" -#include "PixelMonitoring/PixelMon2DProfilesLW.h" -#include "PixelMonitoring/PixelMonModules.h" - -#include "PixelCabling/IPixelCablingSvc.h" - -/////////////////////////////////////////////////////////////////////////////// -//////////////////////booking methods////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -StatusCode PixelMainMon::bookHitsMon(void) { - ATH_MSG_DEBUG("Start booking Hit histogtams.."); - std::string path = "Pixel/Hits"; - if (m_doOnTrack) path.replace(path.begin(), path.end(), "Pixel/HitsOnTrack"); - MonGroup rdoShift(this, path.c_str(), run, ATTRIB_MANAGED); // declare a group of histograms - MonGroup rdoExpert(this, path.c_str(), run, ATTRIB_MANAGED); // declare a group of histograms - - std::string pathT = "Pixel/Timing"; - if (m_doOnTrack) pathT.replace(pathT.begin(), pathT.end(), "Pixel/TimingOnTrack"); - MonGroup timeShift(this, pathT.c_str(), run, ATTRIB_MANAGED); // declare a group of histograms - MonGroup timeExpert(this, pathT.c_str(), run, ATTRIB_MANAGED); // declare a group of histograms - - std::string tmp; - std::string tmp2; - std::string atitles; - std::string hname; - std::string htitles; - - int nbins_LB = m_lbRange; - double min_LB = -0.5; - double max_LB = min_LB + (1.0 * nbins_LB); - int nbins_BCID = m_bcidRange; - double min_BCID = -0.5; - double max_BCID = min_BCID + (1.0 * nbins_BCID); - int nbins_tot3 = 300; - double min_tot3 = -0.5; - double max_tot3 = min_tot3 + (1.0 * nbins_tot3); - int nbins_tot4 = 20; - double min_tot4 = -0.5; - double max_tot4 = min_tot4 + (1.0 * nbins_tot4); - - static constexpr int nmod_eta[PixLayer::COUNT] = {3, 3, 13, 13, 13, 20}; - - std::string atext_LB = ";lumi block"; - std::string atext_BCID = ";BCID"; - std::string atext_nevt = ";# events"; - std::string atext_nhit = ";# hits"; - std::string atext_hit = ";# hits/event"; - std::string atext_occ = ";# hits/pixel/event"; - std::string atext_occ_mod = ";# hits/pixel"; - std::string atext_tot = ";ToT [BC]"; - std::string atext_lv1 = ";Level 1 Accept"; - - StatusCode sc; - - hname = makeHistname("Hits_per_lumi", false); - htitles = makeHisttitle("Average number of pixel hits per event", (atext_LB + atext_hit), false); - sc = rdoShift.regHist(m_hits_per_lumi = TProfile_LW::create(hname.c_str(), htitles.c_str(), nbins_LB, min_LB, max_LB)); - - hname = makeHistname("AvgOcc_per_lumi", false); - htitles = makeHisttitle("Average pixel occupancy per event over all layers", (atext_LB + atext_occ), false); - sc = rdoShift.regHist(m_avgocc_per_lumi = TProfile_LW::create(hname.c_str(), htitles.c_str(), nbins_LB, min_LB, max_LB)); - - for (int i = 0; i < PixLayer::COUNT - 1 + (int)(m_doIBL); i++) { // not include IBL2D and IBL3D - hname = makeHistname(("Hits_per_lumi_" + m_modLabel_PixLayerIBL2D3D[i]), false); - htitles = makeHisttitle(("Average number of pixel hits per event, " + m_modLabel_PixLayerIBL2D3D[i]), (atext_LB + atext_hit), false); - sc = rdoExpert.regHist(m_hits_per_lumi_mod[i] = TProfile_LW::create(hname.c_str(), htitles.c_str(), nbins_LB, min_LB, max_LB)); - - if (m_doOnline) { - hname = makeHistname(("AvgOccRatioToIBL_last100lb_" + m_modLabel_PixLayerIBL2D3D[i]), false); // use good modules only - htitles = makeHisttitle(("Relative occupancy to IBL per event, " + m_modLabel_PixLayerIBL2D3D[i]), ";last 100 lumi blocks;occ. ratio to IBL", false); - sc = rdoShift.regHist(m_avgocc_ratio_lastXlb_mod[i] = new TH1F(hname.c_str(), htitles.c_str(), 100, 0.5, 100.5)); - - hname = makeHistname(("AvgOccRatioToIBL_last100lb_prof_" + m_modLabel_PixLayerIBL2D3D[i]), false); // use good modules only - htitles = makeHisttitle(("Relative to IBL pixel occupancy per event, " + m_modLabel_PixLayerIBL2D3D[i]), ";last 100 lumi blocks;occ. ratio to IBL", false); - sc = rdoShift.regHist(m_avgocc_ratio_lastXlb_mod_prof[i] = new TProfile(hname.c_str(), htitles.c_str(), 100, 0.5, 100.5, "g")); - } - - hname = makeHistname(("nHits_per_module_per_event_" + m_modLabel_PixLayerIBL2D3D[i]), false); - htitles = makeHisttitle(("Number of hits in a module in an event, " + m_modLabel_PixLayerIBL2D3D[i]), ";#hits in a module in an event;#events #times #modules", false); - sc = rdoShift.regHist(m_nhits_mod[i] = TH1F_LW::create(hname.c_str(), htitles.c_str(), 1000, -0.5, -0.5 + 1000.0)); - - hname = makeHistname(("Hit_ToTMean_" + m_modLabel_PixLayerIBL2D3D[i]), false); - htitles = makeHisttitle(("Hit ToT Mean, " + m_modLabel_PixLayerIBL2D3D[i]), (atext_LB + ";Average Hit ToT"), false); - sc = rdoExpert.regHist(m_hit_ToTMean_mod[i] = TProfile_LW::create(hname.c_str(), htitles.c_str(), nbins_LB, min_LB, max_LB)); - - if (!m_doOnline) { - hname = makeHistname(("ModOcc_per_lumi_" + m_modLabel_PixLayerIBL2D3D[i]), false); - htitles = makeHisttitle(("Module occupancy per event, " + m_modLabel_PixLayerIBL2D3D[i]), (atext_LB + atext_occ_mod), false); - sc = rdoShift.regHist(m_modocc_per_lumi[i] = TH2F_LW::create(hname.c_str(), htitles.c_str(), nbins_LB, min_LB, max_LB, 100, 0.0001, 0.0101)); - } - } - - for (int i = 0; i < PixLayerIBL2D3DDBM::COUNT; i++) { - hname = makeHistname(("AvgOcc_per_lumi_" + m_modLabel_PixLayerIBL2D3DDBM[i]), false); - htitles = makeHisttitle(("Average pixel occupancy per event, " + m_modLabel_PixLayerIBL2D3DDBM[i]), (atext_LB + atext_occ), false); - sc = rdoExpert.regHist(m_avgocc_per_lumi_mod[i] = TProfile_LW::create(hname.c_str(), htitles.c_str(), nbins_LB, min_LB, max_LB)); - - hname = makeHistname(("AvgOcc_per_BCID_" + m_modLabel_PixLayerIBL2D3DDBM[i]), false); - htitles = makeHisttitle(("Average pixel occupancy per BCID, " + m_modLabel_PixLayerIBL2D3DDBM[i]), (atext_BCID + atext_occ), false); - sc = rdoExpert.regHist(m_avgocc_per_bcid_mod[i] = TProfile_LW::create(hname.c_str(), htitles.c_str(), nbins_BCID, min_BCID, max_BCID)); - } - - for (int i = 0; i < PixLayerIBL2D3D::COUNT; i++) { - hname = makeHistname(("AvgOcc_active_per_lumi_" + m_modLabel_PixLayerIBL2D3D[i]), false); - htitles = makeHisttitle(("Average pixel occupancy for active per event, " + m_modLabel_PixLayerIBL2D3D[i]), (atext_LB + atext_occ), false); - sc = rdoExpert.regHist(m_avgocc_active_per_lumi_mod[i] = TProfile_LW::create(hname.c_str(), htitles.c_str(), nbins_LB, min_LB, max_LB)); - - hname = makeHistname(("MaxOcc_per_lumi_" + m_modLabel_PixLayerIBL2D3D[i]), false); - htitles = makeHisttitle(("Max. pixel occupancy per event, " + m_modLabel_PixLayerIBL2D3D[i]), (atext_LB + atext_occ), false); - sc = rdoShift.regHist(m_maxocc_per_lumi_mod[i] = TH2F_LW::create(hname.c_str(), htitles.c_str(), nbins_LB, min_LB, max_LB, 500, 0.0001, 0.01)); - - hname = makeHistname(("MaxOcc_per_BCID_" + m_modLabel_PixLayerIBL2D3D[i]), false); - htitles = makeHisttitle(("Max. pixel occupancy per BCID, " + m_modLabel_PixLayerIBL2D3D[i]), (atext_BCID + atext_occ), false); - sc = rdoShift.regHist(m_maxocc_per_bcid_mod[i] = TH1F_LW::create(hname.c_str(), htitles.c_str(), nbins_BCID, min_BCID, max_BCID)); - - hname = makeHistname(("ToatlHits_per_BCID_" + m_modLabel_PixLayerIBL2D3D[i]), false); - htitles = makeHisttitle(("Total Number of hits per BCID, " + m_modLabel_PixLayerIBL2D3D[i]), (atext_BCID + ";#hits"), false); - sc = rdoExpert.regHist(m_totalhits_per_bcid_mod[i] = TH1F_LW::create(hname.c_str(), htitles.c_str(), nbins_BCID, min_BCID, max_BCID)); - } - - for (int i = 0; i < PixLayerIBL2D3DDBM::COUNT; i++) { - hname = makeHistname(("Hit_ToT_" + m_modLabel_PixLayerIBL2D3DDBM[i]), false); - htitles = makeHisttitle(("Hit ToT, " + m_modLabel_PixLayerIBL2D3DDBM[i]), (atext_tot + atext_nhit), false); - if (i < PixLayerIBL2D3DDBM::kDBMA) { - sc = rdoExpert.regHist(m_hit_ToT[i] = TH1F_LW::create(hname.c_str(), htitles.c_str(), nbins_tot3, min_tot3, max_tot3)); - } else if (m_doIBL) { - sc = rdoExpert.regHist(m_hit_ToT[i] = TH1F_LW::create(hname.c_str(), htitles.c_str(), nbins_tot4, min_tot4, max_tot4)); - } - } - - m_hitmap_tmp = std::make_unique<PixelMon2DMapsLW>("HitMap_tmp", ("Hit map for monitoring" + m_histTitleExt).c_str(), PixMon::HistConf::kPixDBMIBL2D3D); - sc = m_hitmap_tmp->regHist(rdoShift); - - for (int i = 0; i < PixLayer::COUNT; i++) { - hname = makeHistname(("nFEswithHits_" + m_modLabel_PixLayerIBL2D3D[i]), false); - htitles = makeHisttitle(("Number of FEs with hits, " + m_modLabel_PixLayerIBL2D3D[i]), ";lumi block;eta index of module;# FEs with hits in a module in an event;# event #times # modules", false); - sc = rdoExpert.regHist(m_nFEswithHits_mod[i] = new TH3F(hname.c_str(), htitles.c_str(), nbins_LB, min_LB, max_LB, nmod_eta[i], -0.5, -0.5 + nmod_eta[i], 18, -0.5, 17.5)); - } - - if (m_doOnline) { - m_hitmap_mon = std::make_unique<PixelMon2DMapsLW>("HitMap_Mon", ("Hit map for monitoring" + m_histTitleExt).c_str(), PixMon::HistConf::kPixDBMIBL2D3D); - sc = m_hitmap_mon->regHist(rdoShift); - - for (int i = 0; i < PixLayer::COUNT - 1 + (int)(m_doIBL); i++) { - hname = makeHistname(("Hit_ToT_Mon_" + m_modLabel_PixLayerIBL2D3D[i]), false); - htitles = makeHisttitle(("Hit ToT Monitoring, " + m_modLabel_PixLayerIBL2D3D[i]), (atext_tot + atext_nhit), false); - if (i < PixLayer::kIBL) { - sc = rdoExpert.regHist(m_hit_ToT_Mon_mod[i] = TH1F_LW::create(hname.c_str(), htitles.c_str(), nbins_tot3, min_tot3, max_tot3)); - } else { - sc = rdoExpert.regHist(m_hit_ToT_Mon_mod[i] = TH1F_LW::create(hname.c_str(), htitles.c_str(), nbins_tot4, min_tot4, max_tot4)); - } - - hname = makeHistname(("Hit_ToT_tmp_" + m_modLabel_PixLayerIBL2D3D[i]), false); - htitles = makeHisttitle(("Hit ToT tmp, " + m_modLabel_PixLayerIBL2D3D[i]), (atext_tot + atext_nhit), false); - if (i < PixLayer::kIBL) { - sc = rdoExpert.regHist(m_hit_ToT_tmp_mod[i] = TH1F_LW::create(hname.c_str(), htitles.c_str(), nbins_tot3, min_tot3, max_tot3)); - } else { - sc = rdoExpert.regHist(m_hit_ToT_tmp_mod[i] = TH1F_LW::create(hname.c_str(), htitles.c_str(), nbins_tot4, min_tot4, max_tot4)); - } - } - if (m_doIBL) { - hname = makeHistname("Occupancy_PP0_IBLA", false); - htitles = makeHisttitle("Average per FE occupancy reset every 5 min, IBL A-side", ";stave ;average # hits per FE per event", false); - sc = rdoExpert.regHist(m_occupancy_PP0_IBLA = TProfile_LW::create(hname.c_str(), htitles.c_str(), - PixMon::kNumStavesIBL, 0.5, 0.5 + PixMon::kNumStavesIBL)); - hname = makeHistname("Occupancy_PP0_IBLC", false); - htitles = makeHisttitle("Average per FE occupancy reset every 5 min, IBL C-side", ";stave ;average # hits per FE per event", false); - sc = rdoExpert.regHist(m_occupancy_PP0_IBLC = TProfile_LW::create(hname.c_str(), htitles.c_str(), - PixMon::kNumStavesIBL, 0.5, 0.5 + PixMon::kNumStavesIBL)); - } - hname = makeHistname("Occupancy_PP0_B0", false); - htitles = makeHisttitle("Average per module occupancy reset every 5 min, B0", ";stave ;average # hits per module per event", false); - sc = rdoExpert.regHist(m_occupancy_PP0_B0 = TProfile_LW::create(hname.c_str(), htitles.c_str(), - PixMon::kNumStavesL0, 0.5, 0.5 + PixMon::kNumStavesL0)); - hname = makeHistname("Occupancy_PP0_B1", false); - htitles = makeHisttitle("Average per module occupancy reset every 5 min, B1", ";stave ;average # hits per module per event", false); - sc = rdoExpert.regHist(m_occupancy_PP0_B1 = TProfile_LW::create(hname.c_str(), htitles.c_str(), - PixMon::kNumStavesL1, 0.5, 0.5 + PixMon::kNumStavesL1)); - hname = makeHistname("Occupancy_PP0_B2", false); - htitles = makeHisttitle("Average per module occupancy reset every 5 min, B2", ";stave ;average # hits per module per event", false); - sc = rdoExpert.regHist(m_occupancy_PP0_B2 = TProfile_LW::create(hname.c_str(), htitles.c_str(), - PixMon::kNumStavesL2, 0.5, 0.5 + PixMon::kNumStavesL2)); - hname = makeHistname("Occupancy_PP0_ECA", false); - htitles = makeHisttitle("Average per module occupancy reset every 5 min, ECA", ";sector ;average # hits per module per event", false); - sc = rdoExpert.regHist(m_occupancy_PP0_ECA = TProfile_LW::create(hname.c_str(), htitles.c_str(), - PixMon::kNumPP0sEC, 0.5, 0.5 + PixMon::kNumPP0sEC)); - hname = makeHistname("Occupancy_PP0_ECC", false); - htitles = makeHisttitle("Average per module occupancy reset every 5 min, ECC", ";sector ;average # hits per module per event", false); - sc = rdoExpert.regHist(m_occupancy_PP0_ECC = TProfile_LW::create(hname.c_str(), htitles.c_str(), - PixMon::kNumPP0sEC, 0.5, 0.5 + PixMon::kNumPP0sEC)); - formatPP0Histos(m_occupancy_PP0_ECA, m_occupancy_PP0_ECC, - m_occupancy_PP0_B0, m_occupancy_PP0_B1, m_occupancy_PP0_B2, - m_occupancy_PP0_IBLA, m_occupancy_PP0_IBLC); - } - - if (m_doTiming) { - sc = timeExpert.regHist(m_Lvl1ID_PIX = TH1I_LW::create("LvlID_PIX", ("Level 1 ID (PIX)" + m_histTitleExt + ";level 1 ID" + atext_nhit).c_str(), 20, -0.5, 19.5)); - sc = timeExpert.regHist(m_Lvl1ID_IBL = TH1I_LW::create("LvlID_IBL", ("Level 1 ID (IBL)" + m_histTitleExt + ";level 1 ID" + atext_nhit).c_str(), 40, -0.5, 39.5)); - sc = timeShift.regHist(m_BCID = TH1I_LW::create("Pixel_BCID", ("BCID" + m_histTitleExt + ";Pixel BCID" + atext_nhit).c_str(), 300, -0.5, 299.5)); - sc = timeShift.regHist(m_Atlas_BCID = TH1F_LW::create("Atlas_BCID", ("BCID" + m_histTitleExt + ";ATLAS BCID" + atext_nhit).c_str(), 3500, -0.5, 3499.5)); - sc = timeShift.regHist(m_Atlas_BCID_hits = TH2F_LW::create("Atlas_BCID_Hits", ("BCID" + m_histTitleExt + ";BCID" + atext_nhit).c_str(), 3500, -0.5, 3499.5, 100, 0, 25000)); - sc = timeExpert.regHist(m_BCID_Profile = TProfile_LW::create("Atlas_BCID_Profile", ("BCID_Profile" + m_histTitleExt + ";BCID" + atext_nhit).c_str(), 3500, -0.5, 3499.5)); - sc = timeShift.regHist(m_Lvl1A = TH1F_LW::create("Lvl1A", ("Hit Level 1 Accept" + m_histTitleExt + ";Level 1 Accept" + atext_nhit).c_str(), 14, -1.5, 12.5)); - - for (int i = 0; i < PixLayer::COUNT - 1 + (int)(m_doIBL); i++) { - tmp = "ROD_Module_BCID_" + m_modLabel_PixLayerIBL2D3D[i]; - tmp2 = "Difference between BCID of RODs and Modules, " + m_modLabel_PixLayerIBL2D3D[i] + m_histTitleExt + ";BCID:ROD-Module (#bc) ;Number of Pixels"; - sc = timeExpert.regHist(m_diff_ROD_vs_Module_BCID_mod[i] = TH1I_LW::create(tmp.c_str(), tmp2.c_str(), 101, -50.5, 50.5)); - - tmp = "Lvl1ID_diff_ATLAS_mod_" + m_modLabel_PixLayerIBL2D3D[i]; - tmp2 = "ATLAS_{Level 1 ID} - Module_{Level 1 ID}, " + m_modLabel_PixLayerIBL2D3D[i] + m_histTitleExt + ";#Delta Level 1 ID; # hits"; - sc = timeExpert.regHist(m_Lvl1ID_diff_mod_ATLAS_mod[i] = TH1I_LW::create(tmp.c_str(), tmp2.c_str(), 201, -200.5, 200.5)); - } - - for (int i = 0; i < PixLayerDBM::COUNT - 1 + (int)(m_doIBL); i++) { - hname = makeHistname(("Lvl1A_" + m_modLabel_PixLayerDBM[i]), false); - htitles = makeHisttitle(("Hit Level 1 Accept, " + m_modLabel_PixLayerDBM[i]), (atext_lv1 + atext_nhit), false); - sc = timeShift.regHist(m_Lvl1A_mod[i] = TH1F_LW::create(hname.c_str(), htitles.c_str(), 14, -1.5, 12.5)); - } - } - - if (m_do2DMaps) { - m_occupancy = std::make_unique<PixelMon2DMapsLW>("Occupancy", ("hit map" + m_histTitleExt).c_str(), PixMon::HistConf::kPixDBMIBL2D3D); - sc = m_occupancy->regHist(rdoShift); - - m_average_pixocc = std::make_unique<PixelMon2DMapsLW>("Occupancy_per_pixel", ("#hits / pixel" + m_histTitleExt).c_str(), PixMon::HistConf::kPixIBL, false); - sc = m_average_pixocc->regHist(rdoShift); - - m_occupancy_pix_evt = std::make_unique<PixelMon2DProfilesLW>("Occupancy_per_pixel_event", ("#hits / pixel / event" + m_histTitleExt).c_str(), PixMon::HistConf::kPixIBL2D3D); - sc = m_occupancy_pix_evt->regHist(rdoShift); - - m_Lvl1ID_diff_mod_ATLAS_per_LB = std::make_unique<PixelMon2DLumiProfiles>("Lvl1ID_diff_ATLAS_mod_per_LB", ("ATLAS_{Level 1 ID} - Module_{Level 1 ID} per LB" + m_histTitleExt).c_str(), "#Delta Level 1 ID", PixMon::HistConf::kPixIBL); - sc = m_Lvl1ID_diff_mod_ATLAS_per_LB->regHist(timeExpert); - - m_Lvl1ID_absdiff_mod_ATLAS_per_LB = std::make_unique<PixelMon2DLumiProfiles>("Lvl1ID_absdiff_ATLAS_mod_per_LB", ("ATLAS_{Level 1 ID} - Module_{Level 1 ID} per LB" + m_histTitleExt).c_str(), "#Delta Level 1 ID", PixMon::HistConf::kPixIBL); - sc = m_Lvl1ID_absdiff_mod_ATLAS_per_LB->regHist(timeExpert); - } - - if (m_doModules) { - if (m_doOnTrack) { - m_hiteff_mod = std::make_unique<PixelMonModulesProf>(PixelMonModulesProf("Hit_track_eff", ("Proportion of hits on track" + m_histTitleExt).c_str(), 2500, -0.5, 2499.5)); - sc = m_hiteff_mod->regHist(this, (path + "/Modules_HitEff").c_str(), run); - } - m_FE_chip_hit_summary = std::make_unique<PixelMonModules1D>(PixelMonModules1D("FE_Chip_Summary", ("FE Chip Summary" + m_histTitleExt).c_str(), 16, -0.5, 15.5)); - sc = m_FE_chip_hit_summary->regHist(this, (path + "/Modules_FEChipSummary").c_str(), run); - } - - if (m_doLowOccupancy || m_doHighOccupancy) { - int nbins_hits = 2000; - float max_hits = 80000.0; - int nbins_avhits = 100; - float max_avhits = 100.0; - - if (m_doLowOccupancy) { - nbins_hits = 200; - max_hits = 200.0; - nbins_avhits = 50; - max_avhits = 2.0; - } - - if (m_doHeavyIonMon) { - max_hits = 350000; - max_avhits = 2500; - } - - sc = rdoShift.regHist(m_num_hits = TH1I_LW::create("num_hits", ("Number of pixel hits in an event" + m_histTitleExt + ";# pixel hits/event;# events").c_str(), nbins_hits, 0., max_hits)); - - for (int i = 0; i < PixLayer::COUNT - 1 + (int)(m_doIBL); i++) { - hname = makeHistname(("Occupancy_Summary_" + m_modLabel_PixLayerIBL2D3D[i]), false); - htitles = makeHisttitle(("Average hit occupancy, " + m_modLabel_PixLayerIBL2D3D[i]), ";average # hits in a module in an event;# modules", false); - sc = rdoExpert.regHist(m_occupancy_summary_mod[i] = TH1F_LW::create(hname.c_str(), htitles.c_str(), nbins_avhits, 0., max_avhits)); - } - } - if (m_doPixelOccupancy) { - m_pixel_occupancy = std::make_unique<PixelMonModules2D>(PixelMonModules2D("Pixel_Occupancy", ("Pixel Occupancy" + m_histTitleExt).c_str(), 160, -0., 160., 336, 0., 336.)); - sc = m_pixel_occupancy->regHist(this, (path + "/PixelOccupancy").c_str(), run); - } - - if (m_doDetails) { - // evaluate for specific modules - sc = rdoExpert.regHist(m_Details_mod1_num_hits = TH1F_LW::create(("Details_num_hits_" + m_DetailsMod1).c_str(), ("number of pixel hits per event for mod1" + m_histTitleExt).c_str(), 100, -0., 100)); - sc = rdoExpert.regHist(m_Details_mod2_num_hits = TH1F_LW::create(("Details_num_hits_" + m_DetailsMod2).c_str(), ("number of pixel hits per event for mod2" + m_histTitleExt).c_str(), 100, -0., 100)); - sc = rdoExpert.regHist(m_Details_mod3_num_hits = TH1F_LW::create(("Details_num_hits_" + m_DetailsMod3).c_str(), ("number of pixel hits per event for mod3" + m_histTitleExt).c_str(), 100, -0., 100)); - sc = rdoExpert.regHist(m_Details_mod4_num_hits = TH1F_LW::create(("Details_num_hits_" + m_DetailsMod4).c_str(), ("number of pixel hits per event for mod4" + m_histTitleExt).c_str(), 100, -0., 100)); - // New ranges for 2 FEI4Bs: - sc = rdoExpert.regHist(m_Details_mod1_occupancy = TH2F_LW::create(("Details_occupancy_" + m_DetailsMod1).c_str(), ("column vs row hitmap for mod1" + m_histTitleExt).c_str(), 160, -0.5, 155.5, 336, -0.5, 335.5)); - sc = rdoExpert.regHist(m_Details_mod2_occupancy = TH2F_LW::create(("Details_occupancy_" + m_DetailsMod2).c_str(), ("column vs row hitmap for mod2" + m_histTitleExt).c_str(), 160, -0.5, 155.5, 336, -0.5, 335.5)); - sc = rdoExpert.regHist(m_Details_mod3_occupancy = TH2F_LW::create(("Details_occupancy_" + m_DetailsMod3).c_str(), ("column vs row hitmap for mod3" + m_histTitleExt).c_str(), 160, -0.5, 155.5, 336, -0.5, 335.5)); - sc = rdoExpert.regHist(m_Details_mod4_occupancy = TH2F_LW::create(("Details_occupancy_" + m_DetailsMod4).c_str(), ("column vs row hitmap for mod4" + m_histTitleExt).c_str(), 160, -0.5, 155.5, 336, -0.5, 335.5)); - sc = rdoExpert.regHist(m_Details_mod1_ToT = TH1F_LW::create(("Details_ToT_" + m_DetailsMod1).c_str(), ("ToT mod1" + m_histTitleExt).c_str(), 300, -0.5, 299.5)); - sc = rdoExpert.regHist(m_Details_mod2_ToT = TH1F_LW::create(("Details_ToT_" + m_DetailsMod2).c_str(), ("ToT mod2" + m_histTitleExt).c_str(), 300, -0.5, 299.5)); - sc = rdoExpert.regHist(m_Details_mod3_ToT = TH1F_LW::create(("Details_ToT_" + m_DetailsMod3).c_str(), ("ToT mod3" + m_histTitleExt).c_str(), 300, -0.5, 299.5)); - sc = rdoExpert.regHist(m_Details_mod4_ToT = TH1F_LW::create(("Details_ToT_" + m_DetailsMod4).c_str(), ("ToT mod4" + m_histTitleExt).c_str(), 300, -0.5, 299.5)); - } - - if (sc.isFailure()) ATH_MSG_WARNING("Problems with booking Hit histograms"); - return StatusCode::SUCCESS; -} - -StatusCode PixelMainMon::bookHitsLumiBlockMon(void) { - ATH_MSG_DEBUG("Start booking Hits histograms per LB (low stat)"); - - std::string path = "Pixel/LumiBlock"; - if (m_doOnTrack) path.replace(path.begin(), path.end(), "Pixel/LumiBlockOnTrack"); - MonGroup lumiBlockHist(this, path.c_str(), lowStat, ATTRIB_MANAGED); // declare a group of histograms - - std::string hname; - std::string htitles; - std::string atext_LB = ";lumi block"; - std::string atext_nevt = ";# events"; - std::string atext_nhit = ";# hits"; - std::string atext_hit = ";# hits/event"; - std::string atext_occ = ";# hits/pixel/event"; - std::string atext_tot = ";ToT [BC]"; - std::string atext_lv1 = ";Level 1 Accept"; - - StatusCode sc; - - if (m_doLowOccupancy || m_doHighOccupancy) { - int nbins_hits = 100; - double min_hits = -0.5; - double max_hits = min_hits + 25000.0; - if (m_doLowOccupancy) { - nbins_hits = 200; - max_hits = min_hits + 200.0; - } - hname = makeHistname("num_hits_LB", false); - htitles = makeHisttitle("Number of pixel hits in an event", (atext_hit + atext_nevt), false); - sc = lumiBlockHist.regHist(m_num_hits_LB = TH1I_LW::create(hname.c_str(), htitles.c_str(), nbins_hits, min_hits, max_hits)); - } - if (m_doModules) { - hname = makeHistname("num_Hits_mod_LB", false); - htitles = makeHisttitle("Number of pixel hits in a module in an event", (atext_hit + atext_nevt), false); - m_hit_num_mod_LB = std::make_unique<PixelMonModules1D>(PixelMonModules1D(hname.c_str(), htitles.c_str(), 20, -0.5, 19.5)); - sc = m_hit_num_mod_LB->regHist(this, (path + "/Modules_NumberOfHits").c_str(), lowStat); - } - for (int i = 0; i < PixLayer::COUNT; i++) { - hname = makeHistname(("Hit_ToT_LB_" + m_modLabel_PixLayerIBL2D3D[i]), false); - htitles = makeHisttitle(("Hit ToT, " + m_modLabel_PixLayerIBL2D3D[i]), (atext_tot + atext_nhit), false); - if (i != PixLayer::kIBL) { - sc = lumiBlockHist.regHist(m_hit_ToT_LB_mod[i] = TH1F_LW::create(hname.c_str(), htitles.c_str(), 300, -0.5, 299.5)); - } else { - sc = lumiBlockHist.regHist(m_hit_ToT_LB_mod[i] = TH1F_LW::create(hname.c_str(), htitles.c_str(), 20, -0.5, 19.5)); - } - - hname = makeHistname(("Lvl1A_10min_" + m_modLabel_PixLayerIBL2D3D[i]), false); - htitles = makeHisttitle(("Hit Level 1 Accept, " + m_modLabel_PixLayerIBL2D3D[i]), (atext_lv1 + atext_nhit), false); - sc = lumiBlockHist.regHist(m_Lvl1A_10min_mod[i] = TH1F_LW::create(hname.c_str(), htitles.c_str(), 14, -1.5, 12.5)); - } - - m_occupancy_10min = std::make_unique<PixelMon2DMapsLW>("Occupancy_10min", ("hit occupancy" + m_histTitleExt).c_str(), PixMon::HistConf::kPixDBMIBL2D3D); - sc = m_occupancy_10min->regHist(lumiBlockHist); - - if (sc.isFailure()) ATH_MSG_WARNING("Problems with booking Hit histograms per LB (low stat)"); - return StatusCode::SUCCESS; -} - -StatusCode PixelMainMon::fillHitsMon(void) // Called once per event -{ - int DetailsMod1 = 0; - int DetailsMod2 = 0; - int DetailsMod3 = 0; - int DetailsMod4 = 0; - int nhitsM1 = 0; - int nhitsM2 = 0; - int nhitsM3 = 0; - int nhitsM4 = 0; - if (m_doDetails) { - DetailsMod1 = parseDetailsString(m_DetailsMod1); - DetailsMod2 = parseDetailsString(m_DetailsMod2); - DetailsMod3 = parseDetailsString(m_DetailsMod3); - DetailsMod4 = parseDetailsString(m_DetailsMod4); - } - - static constexpr int nmod_phi[PixLayer::COUNT] = {48, 48, 22, 38, 52, 14}; - static constexpr int nmod_eta[PixLayer::COUNT] = {3, 3, 13, 13, 13, 20}; - - // Reset the centrally saved hit arrays back to zero. - memset(m_HitPerEventArray_disksA, 0, sizeof(m_HitPerEventArray_disksA[0][0]) * nmod_phi[PixLayer::kECA] * nmod_eta[PixLayer::kECA]); - memset(m_HitPerEventArray_disksC, 0, sizeof(m_HitPerEventArray_disksC[0][0]) * nmod_phi[PixLayer::kECC] * nmod_eta[PixLayer::kECC]); - memset(m_HitPerEventArray_l0, 0, sizeof(m_HitPerEventArray_l0[0][0]) * nmod_phi[PixLayer::kB0] * nmod_eta[PixLayer::kB0]); - memset(m_HitPerEventArray_l1, 0, sizeof(m_HitPerEventArray_l1[0][0]) * nmod_phi[PixLayer::kB1] * nmod_eta[PixLayer::kB1]); - memset(m_HitPerEventArray_l2, 0, sizeof(m_HitPerEventArray_l2[0][0]) * nmod_phi[PixLayer::kB2] * nmod_eta[PixLayer::kB2]); - memset(m_HitPerEventArray_lI, 0, sizeof(m_HitPerEventArray_lI[0][0]) * nmod_phi[PixLayer::kIBL] * nmod_eta[PixLayer::kIBL]); - memset(m_HitPerEventArray_lI_phi_paired, 0, sizeof(m_HitPerEventArray_lI_phi_paired[0][0]) * nmod_phi[PixLayer::kIBL] * nmod_eta[PixLayer::kIBL]); - - double nhits = 0; - double nhits_mod[PixLayerIBL2D3DDBM::COUNT] = {0}; - - int fewithHits_EA[nmod_phi[PixLayer::kECA]][nmod_eta[PixLayer::kECA]][16]; - int fewithHits_EC[nmod_phi[PixLayer::kECC]][nmod_eta[PixLayer::kECC]][16]; - int fewithHits_B0[nmod_phi[PixLayer::kB0]][nmod_eta[PixLayer::kB0]][16]; - int fewithHits_B1[nmod_phi[PixLayer::kB1]][nmod_eta[PixLayer::kB1]][16]; - int fewithHits_B2[nmod_phi[PixLayer::kB2]][nmod_eta[PixLayer::kB2]][16]; - for (int i = 0; i < PixLayer::COUNT; i++) { - for (int phi = 0; phi < nmod_phi[i]; phi++) { - for (int eta = 0; eta < nmod_eta[i]; eta++) { - for (int j = 0; j < 16; j++) { - if (i == PixLayer::kECA) fewithHits_EA[phi][eta][j] = 0; - if (i == PixLayer::kECC) fewithHits_EC[phi][eta][j] = 0; - if (i == PixLayer::kB0) fewithHits_B0[phi][eta][j] = 0; - if (i == PixLayer::kB1) fewithHits_B1[phi][eta][j] = 0; - if (i == PixLayer::kB2) fewithHits_B2[phi][eta][j] = 0; - } - } - } - } - - Identifier rdoID; - - int nChannels_mod[PixLayerIBL2D3D::COUNT] = {46080, 46080, 46080, 46080, 46080, 26880, 53760, 26880}; - double inv_nChannels_mod[PixLayerIBL2D3D::COUNT]; - double nGoodChannels_total = 0.; - double nGoodChannels_layer[PixLayerIBL2D3DDBM::COUNT]; - double nActiveChannels_layer[PixLayerIBL2D3DDBM::COUNT]; - for (int i = 0; i < PixLayerIBL2D3D::COUNT; i++) { - inv_nChannels_mod[i] = 1.0 / (1.0 * nChannels_mod[i]); - nGoodChannels_layer[getPixLayerIDWithDBM(i)] = 1.0 * nChannels_mod[i] * m_nGood_mod[getPixLayerIDWithDBM(i)]; - nActiveChannels_layer[getPixLayerIDWithDBM(i)] = 1.0 * nChannels_mod[i] * m_nActive_mod[getPixLayerIDWithDBM(i)]; - nGoodChannels_total += nGoodChannels_layer[getPixLayerIDWithDBM(i)]; - } - - auto Pixel_BCIDColl = SG::makeHandle(m_PixelBCIDName); - int pix_rod_bcid = 0; - if (Pixel_BCIDColl.isValid()) { - ATH_MSG_DEBUG("Found Pixel BCID collection"); - for (InDetTimeCollection::const_iterator ipix_bcid = Pixel_BCIDColl->begin(); ipix_bcid != Pixel_BCIDColl->end(); ++ipix_bcid) { - if (!(*ipix_bcid)) continue; - const unsigned int pix_bcid = (*ipix_bcid)->second; - pix_rod_bcid = pix_bcid; - } - } else { - ATH_MSG_WARNING("Could not find the data object PixelBCID !"); - return StatusCode::SUCCESS; - } - - int lvl1idATLAS(-1); - SG::ReadHandle<xAOD::EventInfo> thisEventInfo(m_eventxAODInfoKey); - if(!(thisEventInfo.isValid())) { - ATH_MSG_WARNING("No EventInfo object found"); - } else { - lvl1idATLAS = (int)((thisEventInfo->extendedLevel1ID()) & 0xf); - } - - // retrieve Pixel RDO container from storegate - auto rdocontainer = SG::makeHandle(m_Pixel_RDOName); - if (!(rdocontainer.isValid())) { - ATH_MSG_WARNING("Could not retrieve Pixel RDO container !"); - if (m_storegate_errors) m_storegate_errors->Fill(1., 3.); // first entry is for RDO, second is for retrieve problem - return StatusCode::SUCCESS; // fail gracefully and keep going in the next tool - } else { - ATH_MSG_DEBUG("Pixel RDO container " << m_Pixel_RDOName.key() << " found"); - } - - PixelRDO_Container::const_iterator colNext = rdocontainer->begin(); - PixelRDO_Container::const_iterator lastCol = rdocontainer->end(); - DataVector<PixelRDORawData>::const_iterator p_rdo; - - int last_ibl_eta_module = -50; - int last_ibl_phi_module = -50; - int last_ibl_eta_index = -1; - int last_ibl_phi_index = -1; - - for (; colNext != lastCol; ++colNext) { - const InDetRawDataCollection<PixelRDORawData>* PixelCollection(*colNext); - if (!PixelCollection) { - if (m_storegate_errors) m_storegate_errors->Fill(1., 5.); // first entry is for RDO, second is for data problem - continue; - } - - for (p_rdo = PixelCollection->begin(); p_rdo != PixelCollection->end(); ++p_rdo) { - rdoID = (*p_rdo)->identify(); - - if (m_hiteff_mod) { - if (isOnTrack(rdoID, false)) { - m_hiteff_mod->fill(m_manager->lumiBlockNumber(), 1., rdoID, m_pixelid); - } else { - m_hiteff_mod->fill(m_manager->lumiBlockNumber(), 0., rdoID, m_pixelid); - } - } - - if (m_doOnTrack && !isOnTrack(rdoID, false)) { - // if we only want hits on track, and the hit is NOT on the track, skip filling - continue; - } - - int pixlayer = getPixLayerID(m_pixelid->barrel_ec(rdoID), m_pixelid->layer_disk(rdoID), m_doIBL); - int pixlayerdbm = getPixLayerIDDBM(m_pixelid->barrel_ec(rdoID), m_pixelid->layer_disk(rdoID), m_doIBL); - int pixlayeribl2d3d = pixlayer; - if (pixlayeribl2d3d == PixLayerIBL2D3D::kIBL) { - pixlayeribl2d3d = getPixLayerIDIBL2D3D(m_pixelid->barrel_ec(rdoID), m_pixelid->layer_disk(rdoID), m_pixelid->eta_module(rdoID), m_doIBL); - } - int pixlayeribl2d3ddbm = pixlayerdbm; - if (pixlayeribl2d3ddbm == PixLayerDBM::kIBL) { - pixlayeribl2d3ddbm = getPixLayerIDIBL2D3DDBM(m_pixelid->barrel_ec(rdoID), m_pixelid->layer_disk(rdoID), m_pixelid->eta_module(rdoID), m_doIBL); - } - bool isIBL = false; - if (m_pixelid->barrel_ec(rdoID) == 0 && m_doIBL && m_Lvl1A_mod[PixLayerDBM::kIBL] && m_pixelid->layer_disk(rdoID) == 0) isIBL = true; - - // Fill Occupancy - if (m_occupancy) m_occupancy->fill(rdoID, m_pixelid); - if (m_occupancy_10min && m_doLumiBlock) m_occupancy_10min->fill(rdoID, m_pixelid); - if (m_hitmap_tmp) m_hitmap_tmp->fill(rdoID, m_pixelid); - if (m_average_pixocc && pixlayer!=99) m_average_pixocc->fill(rdoID, m_pixelid, inv_nChannels_mod[pixlayer]); - - // Fill Lvl1A - if (m_Lvl1A) { - m_Lvl1A->Fill((*p_rdo)->getLVL1A()); - if (pixlayerdbm != 99 && m_Lvl1A_mod[pixlayerdbm]) m_Lvl1A_mod[pixlayerdbm]->Fill((*p_rdo)->getLVL1A()); - } - if (pixlayer != 99 && m_Lvl1A_10min_mod[pixlayer] && m_doLumiBlock) m_Lvl1A_10min_mod[pixlayer]->Fill((*p_rdo)->getLVL1A()); - if (isIBL && m_Lvl1ID_IBL) m_Lvl1ID_IBL->Fill((*p_rdo)->getLVL1ID() % 32); - if (!isIBL && m_Lvl1ID_PIX) m_Lvl1ID_PIX->Fill((*p_rdo)->getLVL1ID()); - - // Fill difference of Lvl1 - int lvl1idMOD = (int)(*p_rdo)->getLVL1ID(); - int difflvl1id = lvl1idATLAS - lvl1idMOD % 32; - if (pixlayer != 99 && m_Lvl1ID_diff_mod_ATLAS_mod[pixlayer]) m_Lvl1ID_diff_mod_ATLAS_mod[pixlayer]->Fill(difflvl1id); - - if (m_Lvl1ID_diff_mod_ATLAS_per_LB) m_Lvl1ID_diff_mod_ATLAS_per_LB->fill(m_manager->lumiBlockNumber(), rdoID, m_pixelid, difflvl1id); - if (m_Lvl1ID_absdiff_mod_ATLAS_per_LB) m_Lvl1ID_absdiff_mod_ATLAS_per_LB->fill(m_manager->lumiBlockNumber(), rdoID, m_pixelid, fabs(difflvl1id)); - - // Fill BCID - if (m_BCID) m_BCID->Fill((*p_rdo)->getBCID()); - if (m_Atlas_BCID) m_Atlas_BCID->Fill(pix_rod_bcid); - if (m_BCID_Profile) m_BCID_Profile->Fill(double(pix_rod_bcid), double(nhits)); - if (pixlayer != 99 && m_diff_ROD_vs_Module_BCID_mod[pixlayer]) m_diff_ROD_vs_Module_BCID_mod[pixlayer]->Fill((pix_rod_bcid & 0x000000ff) - (*p_rdo)->getBCID()); - - if (m_FE_chip_hit_summary) m_FE_chip_hit_summary->fill(m_pixelCableSvc->getFE(&rdoID, rdoID), rdoID, m_pixelid); - - // Fill ToT - if (pixlayeribl2d3ddbm != 99 && m_hit_ToT[pixlayeribl2d3ddbm]) m_hit_ToT[pixlayeribl2d3ddbm]->Fill((*p_rdo)->getToT()); - if (pixlayerdbm == PixLayerDBM::kIBL && m_hit_ToT[pixlayerdbm]) m_hit_ToT[pixlayerdbm]->Fill((*p_rdo)->getToT()); - - if (pixlayer != 99 && m_hit_ToTMean_mod[pixlayer]) m_hit_ToTMean_mod[pixlayer]->Fill(m_manager->lumiBlockNumber(), (*p_rdo)->getToT()); - if (m_doLumiBlock && pixlayer != 99 && m_hit_ToT_LB_mod[pixlayer]) { - m_hit_ToT_LB_mod[pixlayer]->Fill((*p_rdo)->getToT()); - } - - if (m_doOnline && pixlayer != 99 && m_hit_ToT_tmp_mod[pixlayer]) { - m_hit_ToT_tmp_mod[pixlayer]->Fill((*p_rdo)->getToT()); - } - - // Not yet modified for IBL geometry: - if (m_doDetails) { - int currentID = 1000000 + (-m_pixelid->barrel_ec(rdoID) + 2) * 100000 + (m_pixelid->layer_disk(rdoID)) * 10000 + (m_pixelid->phi_module(rdoID)) * 100 + (m_pixelid->eta_module(rdoID) + 6); - if (m_Details_mod1_occupancy && currentID == DetailsMod1) m_Details_mod1_occupancy->Fill(m_pixelid->eta_index(rdoID), m_pixelid->phi_index(rdoID)); - if (m_Details_mod2_occupancy && currentID == DetailsMod2) m_Details_mod2_occupancy->Fill(m_pixelid->eta_index(rdoID), m_pixelid->phi_index(rdoID)); - if (m_Details_mod3_occupancy && currentID == DetailsMod3) m_Details_mod3_occupancy->Fill(m_pixelid->eta_index(rdoID), m_pixelid->phi_index(rdoID)); - if (m_Details_mod4_occupancy && currentID == DetailsMod4) m_Details_mod4_occupancy->Fill(m_pixelid->eta_index(rdoID), m_pixelid->phi_index(rdoID)); - if (m_Details_mod1_ToT && currentID == DetailsMod1) m_Details_mod1_ToT->Fill((*p_rdo)->getToT()); - if (m_Details_mod2_ToT && currentID == DetailsMod2) m_Details_mod2_ToT->Fill((*p_rdo)->getToT()); - if (m_Details_mod3_ToT && currentID == DetailsMod3) m_Details_mod3_ToT->Fill((*p_rdo)->getToT()); - if (m_Details_mod4_ToT && currentID == DetailsMod4) m_Details_mod4_ToT->Fill((*p_rdo)->getToT()); - } - if (m_pixel_occupancy) m_pixel_occupancy->fill(m_pixelid->eta_index(rdoID), m_pixelid->phi_index(rdoID), rdoID, m_pixelid); - - if (pixlayerdbm != 99) nhits_mod[pixlayerdbm]++; - if (pixlayerdbm == PixLayerDBM::kIBL && pixlayeribl2d3ddbm != 99) nhits_mod[pixlayeribl2d3ddbm]++; - nhits++; - nhitsM1++; - nhitsM2++; - nhitsM3++; - nhitsM4++; - - if (m_pixelid->barrel_ec(rdoID) == 2) m_HitPerEventArray_disksA[m_pixelid->phi_module(rdoID)][m_pixelid->layer_disk(rdoID)]++; - if (m_pixelid->barrel_ec(rdoID) == -2) m_HitPerEventArray_disksC[m_pixelid->phi_module(rdoID)][m_pixelid->layer_disk(rdoID)]++; - if (m_pixelid->barrel_ec(rdoID) == 0) { - if (m_doIBL && m_pixelid->layer_disk(rdoID) == 0) { - bool same_module = (m_pixelid->eta_module(rdoID) == last_ibl_eta_module && m_pixelid->phi_module(rdoID) == last_ibl_phi_module); - bool neighboring_pixel = (m_pixelid->eta_index(rdoID) == last_ibl_eta_index && m_pixelid->phi_index(rdoID) == last_ibl_phi_index - 1); - if (same_module && neighboring_pixel) { - last_ibl_eta_index = -1; - last_ibl_phi_index = -1; - } else if (same_module) { - last_ibl_eta_index = m_pixelid->eta_index(rdoID); - last_ibl_phi_index = m_pixelid->phi_index(rdoID); - m_HitPerEventArray_lI_phi_paired[m_pixelid->phi_module(rdoID)][m_pixelid->eta_module(rdoID) + 10]++; - } else { - last_ibl_eta_module = m_pixelid->eta_module(rdoID); - last_ibl_phi_module = m_pixelid->phi_module(rdoID); - last_ibl_eta_index = m_pixelid->eta_index(rdoID); - last_ibl_phi_index = m_pixelid->phi_index(rdoID); - m_HitPerEventArray_lI_phi_paired[m_pixelid->phi_module(rdoID)][m_pixelid->eta_module(rdoID) + 10]++; - } - } - if (m_doIBL && m_pixelid->layer_disk(rdoID) == 0) m_HitPerEventArray_lI[m_pixelid->phi_module(rdoID)][m_pixelid->eta_module(rdoID) + 10]++; - if (m_pixelid->layer_disk(rdoID) == 0 + m_doIBL) m_HitPerEventArray_l0[m_pixelid->phi_module(rdoID)][m_pixelid->eta_module(rdoID) + 6]++; - if (m_pixelid->layer_disk(rdoID) == 1 + m_doIBL) m_HitPerEventArray_l1[m_pixelid->phi_module(rdoID)][m_pixelid->eta_module(rdoID) + 6]++; - if (m_pixelid->layer_disk(rdoID) == 2 + m_doIBL) m_HitPerEventArray_l2[m_pixelid->phi_module(rdoID)][m_pixelid->eta_module(rdoID) + 6]++; - } - - // Quick Status - int fephi = 0; - int feeta = 0; - if (pixlayer == PixLayer::kB0 && getFEID(pixlayer, m_pixelid->phi_index(rdoID), m_pixelid->eta_index(rdoID), fephi, feeta)) { - fewithHits_B0[m_pixelid->phi_module(rdoID)][(int)(fabs(6 + m_pixelid->eta_module(rdoID)))][(int)((8 * fephi) + feeta)] = 1; - } - if (pixlayer == PixLayer::kB1 && getFEID(pixlayer, m_pixelid->phi_index(rdoID), m_pixelid->eta_index(rdoID), fephi, feeta)) { - fewithHits_B1[m_pixelid->phi_module(rdoID)][(int)(fabs(6 + m_pixelid->eta_module(rdoID)))][(int)((8 * fephi) + feeta)] = 1; - } - if (pixlayer == PixLayer::kB2 && getFEID(pixlayer, m_pixelid->phi_index(rdoID), m_pixelid->eta_index(rdoID), fephi, feeta)) { - fewithHits_B2[m_pixelid->phi_module(rdoID)][(int)(fabs(6 + m_pixelid->eta_module(rdoID)))][(int)((8 * fephi) + feeta)] = 1; - } - if (pixlayer == PixLayer::kECA && getFEID(pixlayer, m_pixelid->phi_index(rdoID), m_pixelid->eta_index(rdoID), fephi, feeta)) { - fewithHits_EA[m_pixelid->phi_module(rdoID)][(int)m_pixelid->layer_disk(rdoID)][(int)((8 * fephi) + feeta)] = 1; - } - if (pixlayer == PixLayer::kECC && getFEID(pixlayer, m_pixelid->phi_index(rdoID), m_pixelid->eta_index(rdoID), fephi, feeta)) { - fewithHits_EC[m_pixelid->phi_module(rdoID)][(int)m_pixelid->layer_disk(rdoID)][(int)((8 * fephi) + feeta)] = 1; - } - } - } // end of RDO (hit) loop - - if (m_doOnline) { - fillSummaryHistos(m_occupancy.get(), - m_occupancy_summary_mod[PixLayer::kECA], - m_occupancy_summary_mod[PixLayer::kECC], - m_occupancy_summary_mod[PixLayer::kIBL], - m_occupancy_summary_mod[PixLayer::kB0], - m_occupancy_summary_mod[PixLayer::kB1], - m_occupancy_summary_mod[PixLayer::kB2]); - if (m_doRefresh5min) { - if (m_occupancy_PP0_ECA) m_occupancy_PP0_ECA->Reset(); - if (m_occupancy_PP0_ECC) m_occupancy_PP0_ECC->Reset(); - if (m_occupancy_PP0_B0) m_occupancy_PP0_B0->Reset(); - if (m_occupancy_PP0_B1) m_occupancy_PP0_B1->Reset(); - if (m_occupancy_PP0_B2) m_occupancy_PP0_B2->Reset(); - if (m_occupancy_PP0_IBLA) m_occupancy_PP0_IBLA->Reset(); - if (m_occupancy_PP0_IBLC) m_occupancy_PP0_IBLC->Reset(); - } - if (m_doRefresh) { //set to true for testing - for (int i = 0; i < PixLayer::COUNT; i++) { - if (m_hit_ToT_Mon_mod[i] && m_hit_ToT_tmp_mod[i]) th1FillMonitoring(m_hit_ToT_Mon_mod[i], m_hit_ToT_tmp_mod[i]); - } - if (m_hitmap_tmp && m_hitmap_mon) { - if (m_occupancy_pix_evt) m_occupancy_pix_evt->fillFromMap(m_hitmap_tmp.get(), false); - fillPP0Histos(m_hitmap_tmp.get(), - m_occupancy_PP0_ECA, m_occupancy_PP0_ECC, - m_occupancy_PP0_B0, m_occupancy_PP0_B1, m_occupancy_PP0_B2, - m_occupancy_PP0_IBLA, m_occupancy_PP0_IBLC); - m_hitmap_mon->fill2DMon(m_hitmap_tmp.get()); - } - } - } - - if (m_hits_per_lumi) m_hits_per_lumi->Fill(m_manager->lumiBlockNumber(), nhits); - for (int i = 0; i < PixLayer::COUNT - 1 + (int)(m_doIBL); i++) { - if (m_hits_per_lumi_mod[i]) m_hits_per_lumi_mod[i]->Fill(m_manager->lumiBlockNumber(), nhits_mod[getPixLayerIDWithDBM(i)]); - } - - if (!m_doOnline && m_occupancy_pix_evt && m_hitmap_tmp) m_occupancy_pix_evt->fillFromMap(m_hitmap_tmp.get(), true); - - double avgocc = 0; - double avgocc_mod[PixLayerIBL2D3DDBM::COUNT] = {0}; - double avgocc_active_mod[PixLayerIBL2D3DDBM::COUNT] = {0}; - if (nGoodChannels_total > 0) avgocc = nhits / nGoodChannels_total; - if (m_avgocc_per_lumi) m_avgocc_per_lumi->Fill(m_manager->lumiBlockNumber(), avgocc); - - for (int i = 0; i < PixLayerIBL2D3DDBM::COUNT; i++) { - if (nGoodChannels_layer[i] > 0) avgocc_mod[i] = nhits_mod[i] / nGoodChannels_layer[i]; - if (nActiveChannels_layer[i] > 0) avgocc_active_mod[i] = nhits_mod[i] / nActiveChannels_layer[i]; - - if (m_avgocc_per_lumi_mod[i]) m_avgocc_per_lumi_mod[i]->Fill(m_manager->lumiBlockNumber(), avgocc_mod[i]); - if (m_avgocc_per_bcid_mod[i]) m_avgocc_per_bcid_mod[i]->Fill(pix_rod_bcid, avgocc_mod[i]); - } - - for (int i = 0; i < PixLayerIBL2D3D::COUNT; i++) { - if (m_avgocc_active_per_lumi_mod[i]) m_avgocc_active_per_lumi_mod[i]->Fill(m_manager->lumiBlockNumber(), avgocc_active_mod[getPixLayerIDWithDBM(i)]); - if (m_maxocc_per_lumi_mod[i]) m_maxocc_per_lumi_mod[i]->Fill(m_manager->lumiBlockNumber(), avgocc_active_mod[getPixLayerIDWithDBM(i)]); - if (m_maxocc_per_bcid_mod[i]) { - int bin = m_maxocc_per_bcid_mod[i]->GetXaxis()->FindBin(1.0 * pix_rod_bcid); - double content = m_maxocc_per_bcid_mod[i]->GetBinContent(bin); - if (avgocc_mod[getPixLayerIDWithDBM(i)] > content) m_maxocc_per_bcid_mod[i]->SetBinContent(bin, avgocc_mod[getPixLayerIDWithDBM(i)]); - } - if (m_totalhits_per_bcid_mod[i]) m_totalhits_per_bcid_mod[i]->Fill(1.0 * pix_rod_bcid, nhits_mod[getPixLayerIDWithDBM(i)]); - } - - if (m_Atlas_BCID_hits) m_Atlas_BCID_hits->Fill(pix_rod_bcid, nhits); - - // Fill the #hit per module per event - for (int i = 0; i < PixLayer::COUNT; i++) { - if (m_nhits_mod[i]) { - for (int phi = 0; phi < nmod_phi[i]; phi++) { - for (int eta = 0; eta < nmod_eta[i]; eta++) { - if (i == PixLayer::kECA) m_nhits_mod[i]->Fill(m_HitPerEventArray_disksA[phi][eta]); - if (i == PixLayer::kECC) m_nhits_mod[i]->Fill(m_HitPerEventArray_disksC[phi][eta]); - if (i == PixLayer::kB0) m_nhits_mod[i]->Fill(m_HitPerEventArray_l0[phi][eta]); - if (i == PixLayer::kB1) m_nhits_mod[i]->Fill(m_HitPerEventArray_l1[phi][eta]); - if (i == PixLayer::kB2) m_nhits_mod[i]->Fill(m_HitPerEventArray_l2[phi][eta]); - if (i == PixLayer::kIBL) m_nhits_mod[i]->Fill(m_HitPerEventArray_lI[phi][eta]); - } - } - } - } - - if (!m_doOnline) { - for (int i = 0; i < PixLayer::COUNT - 1 + (int)(m_doIBL); i++) { // not include IBL2D and IBL3D - if (m_modocc_per_lumi[i]) { - for (int phi = 0; phi < nmod_phi[i]; phi++) { - for (int eta = 0; eta < nmod_eta[i]; eta++) { - if (i == PixLayer::kECA) m_modocc_per_lumi[i]->Fill(m_manager->lumiBlockNumber(), m_HitPerEventArray_disksA[phi][eta] * inv_nChannels_mod[i]); - if (i == PixLayer::kECC) m_modocc_per_lumi[i]->Fill(m_manager->lumiBlockNumber(), m_HitPerEventArray_disksC[phi][eta] * inv_nChannels_mod[i]); - if (i == PixLayer::kB0) m_modocc_per_lumi[i]->Fill(m_manager->lumiBlockNumber(), m_HitPerEventArray_l0[phi][eta] * inv_nChannels_mod[i]); - if (i == PixLayer::kB1) m_modocc_per_lumi[i]->Fill(m_manager->lumiBlockNumber(), m_HitPerEventArray_l1[phi][eta] * inv_nChannels_mod[i]); - if (i == PixLayer::kB2) m_modocc_per_lumi[i]->Fill(m_manager->lumiBlockNumber(), m_HitPerEventArray_l2[phi][eta] * inv_nChannels_mod[i]); - if (i == PixLayer::kIBL) { - if (eta < 4 || eta > 15) { - m_modocc_per_lumi[i]->Fill(m_manager->lumiBlockNumber(), m_HitPerEventArray_lI[phi][eta] * inv_nChannels_mod[i]); - } else { - m_modocc_per_lumi[i]->Fill(m_manager->lumiBlockNumber(), m_HitPerEventArray_lI[phi][eta] * inv_nChannels_mod[i + 1]); - } - } - } - } - } - } - } - - // Fill these histograms only if =< 50% of modules disabled - if (!m_majorityDisabled) { - if (m_doDetails) { - if (m_Details_mod1_num_hits) m_Details_mod1_num_hits->Fill(nhitsM1); - if (m_Details_mod2_num_hits) m_Details_mod2_num_hits->Fill(nhitsM2); - if (m_Details_mod3_num_hits) m_Details_mod3_num_hits->Fill(nhitsM3); - if (m_Details_mod4_num_hits) m_Details_mod4_num_hits->Fill(nhitsM4); - } - if (m_num_hits) m_num_hits->Fill(nhits); - if (m_doLumiBlock && m_num_hits_LB) { - m_num_hits_LB->Fill(nhits); - } - - if (m_doModules) { - PixelID::const_id_iterator idIt = m_pixelid->wafer_begin(); - PixelID::const_id_iterator idItEnd = m_pixelid->wafer_end(); - for (; idIt != idItEnd; ++idIt) { - Identifier WaferID = *idIt; - if (m_doLumiBlock) { - if (m_pixelid->barrel_ec(WaferID) == 2) m_hit_num_mod_LB->fill(m_HitPerEventArray_disksA[m_pixelid->phi_module(WaferID)][m_pixelid->layer_disk(WaferID)], WaferID, m_pixelid); - if (m_pixelid->barrel_ec(WaferID) == -2) m_hit_num_mod_LB->fill(m_HitPerEventArray_disksC[m_pixelid->phi_module(WaferID)][m_pixelid->layer_disk(WaferID)], WaferID, m_pixelid); - if (m_pixelid->barrel_ec(WaferID) == 0) { - if (m_doIBL && m_pixelid->layer_disk(WaferID) == 0) m_hit_num_mod_LB->fill(m_HitPerEventArray_lI[m_pixelid->phi_module(WaferID)][m_pixelid->eta_module(WaferID) + 10], WaferID, m_pixelid); - if (m_pixelid->layer_disk(WaferID) == 0 + m_doIBL) m_hit_num_mod_LB->fill(m_HitPerEventArray_l0[m_pixelid->phi_module(WaferID)][m_pixelid->eta_module(WaferID) + 6], WaferID, m_pixelid); - if (m_pixelid->layer_disk(WaferID) == 1 + m_doIBL) m_hit_num_mod_LB->fill(m_HitPerEventArray_l1[m_pixelid->phi_module(WaferID)][m_pixelid->eta_module(WaferID) + 6], WaferID, m_pixelid); - if (m_pixelid->layer_disk(WaferID) == 2 + m_doIBL) m_hit_num_mod_LB->fill(m_HitPerEventArray_l2[m_pixelid->phi_module(WaferID)][m_pixelid->eta_module(WaferID) + 6], WaferID, m_pixelid); - } - } - } - } // if (m_doModules) - } // if (!m_majorityDisabled) - - for (int i = 0; i < PixLayer::COUNT; i++) { - for (int phi = 0; phi < nmod_phi[i]; phi++) { - for (int eta = 0; eta < nmod_eta[i]; eta++) { - int nfes = 0; - for (int j = 0; j < 16; j++) { - if (i == PixLayer::kECA) nfes += fewithHits_EA[phi][eta][j]; - if (i == PixLayer::kECC) nfes += fewithHits_EC[phi][eta][j]; - if (i == PixLayer::kB0) nfes += fewithHits_B0[phi][eta][j]; - if (i == PixLayer::kB1) nfes += fewithHits_B1[phi][eta][j]; - if (i == PixLayer::kB2) nfes += fewithHits_B2[phi][eta][j]; - } - if (m_nFEswithHits_mod[i]) m_nFEswithHits_mod[i]->Fill(m_manager->lumiBlockNumber(), eta, nfes); - } - } - } - - if (nhits == 0 && m_storegate_errors) m_storegate_errors->Fill(1., 4.); // first entry for RDO, second for size = 0 - - return StatusCode::SUCCESS; -} - -StatusCode PixelMainMon::procHitsMon(void) { - - if (m_doOffline) { - fillSummaryHistos(m_occupancy.get(), - m_occupancy_summary_mod[PixLayer::kECA], - m_occupancy_summary_mod[PixLayer::kECC], - m_occupancy_summary_mod[PixLayer::kIBL], - m_occupancy_summary_mod[PixLayer::kB0], - m_occupancy_summary_mod[PixLayer::kB1], - m_occupancy_summary_mod[PixLayer::kB2]); - } - - if (m_doOnline) { - int lastlb = m_manager->lumiBlockNumber()-1; //remove -1 for testing - double cont(0.0), err(0.0); - int entr(0); - for (int i = 0; i < PixLayer::COUNT - 1 + (int)(m_doIBL); i++) { - if (m_avgocc_per_lumi_mod[getPixLayerIDWithDBM(i)] && m_avgocc_ratio_lastXlb_mod[i] && m_avgocc_ratio_lastXlb_mod_prof[i]) { - int bing = m_avgocc_per_lumi_mod[getPixLayerIDWithDBM(i)]->GetXaxis()->FindBin(lastlb); - int nXbins = m_avgocc_ratio_lastXlb_mod[i]->GetNbinsX(); - m_avgocc_ratio_lastXlb_mod[i]->GetXaxis()->Set(nXbins, lastlb-nXbins+0.5, lastlb+0.5); - m_avgocc_ratio_lastXlb_mod[i]->Reset(); - m_avgocc_ratio_lastXlb_mod[i]->Sumw2(); - m_avgocc_ratio_lastXlb_mod_prof[i]->GetXaxis()->Set(nXbins, lastlb-nXbins+0.5, lastlb+0.5); - m_avgocc_ratio_lastXlb_mod_prof[i]->Reset(); - for (int binf=m_avgocc_ratio_lastXlb_mod[i]->GetNbinsX(); binf>0; binf--) { - if (bing>0) { - entr = m_avgocc_per_lumi_mod[getPixLayerIDWithDBM(i)]->GetBinEntries(bing); - if (entr>0) { - cont = m_avgocc_per_lumi_mod[getPixLayerIDWithDBM(i)]->GetBinContent(bing); - err = m_avgocc_per_lumi_mod[getPixLayerIDWithDBM(i)]->GetBinError(bing); - m_avgocc_ratio_lastXlb_mod[i]->SetBinContent(binf, cont); - m_avgocc_ratio_lastXlb_mod[i]->SetBinError(binf, err); - } - bing--; - } - } - //m_avgocc_ratio_lastXlb_mod[i]->SetEntries(lastlb); // for testing - } - } - - for (int i = 0; i < PixLayer::COUNT - 1 + (int)(m_doIBL); i++) { - if (m_avgocc_ratio_lastXlb_mod[i] && m_avgocc_ratio_lastXlb_mod_prof[i]) { - if (m_doIBL && m_avgocc_ratio_lastXlb_mod[PixLayer::kIBL]) m_avgocc_ratio_lastXlb_mod[i]->Divide(m_avgocc_ratio_lastXlb_mod[PixLayer::kIBL]); - else if (m_avgocc_ratio_lastXlb_mod[PixLayer::kB0]) m_avgocc_ratio_lastXlb_mod[i]->Divide(m_avgocc_ratio_lastXlb_mod[PixLayer::kB0]); - for (int ibin=1; ibin<=m_avgocc_ratio_lastXlb_mod[i]->GetNbinsX(); ibin++) { - double cont = m_avgocc_ratio_lastXlb_mod[i]->GetBinContent(ibin); - if (cont!=0.0) { - double err = m_avgocc_ratio_lastXlb_mod[i]->GetBinError(ibin); - if (err!=0.0) err = 1.0 / pow(err, 2); - else err = 1.0; - double binctr = m_avgocc_ratio_lastXlb_mod[i]->GetXaxis()->GetBinCenter(ibin); - m_avgocc_ratio_lastXlb_mod_prof[i]->Fill(binctr, cont, err); - } - } - } - } - } - - return StatusCode::SUCCESS; -} diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelAthClusterMonTool.cxx b/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelAthClusterMonTool.cxx new file mode 100644 index 0000000000000000000000000000000000000000..72011da339a75124db85f796708ca7496e3512e2 --- /dev/null +++ b/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelAthClusterMonTool.cxx @@ -0,0 +1,462 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#include "PixelMonitoring/PixelAthClusterMonTool.h" + +PixelAthClusterMonTool::PixelAthClusterMonTool( const std::string& name, ISvcLocator* pSvcLocator ) : + AthMonitorAlgorithm(name, pSvcLocator), + m_holeSearchTool("InDet::InDetTrackHoleSearchTool/InDetHoleSearchTool", this), + m_trackSelTool("InDet::InDetTrackSelectionTool/TrackSelectionTool", this), + m_atlasid(nullptr), + m_pixelid(nullptr) +{ + //jo flags go here, keys and some tools -> in class + declareProperty("HoleSearchTool", m_holeSearchTool); + declareProperty("TrackSelectionTool", m_trackSelTool); //needed for cfg in python jo + + declareProperty("doOnline", m_doOnline = false); + declareProperty("doModules", m_doModules = false); + declareProperty("doLumiBlock", m_doLumiBlock = false); + declareProperty("doLowOccupancy", m_doLowOccupancy = false); + declareProperty("doHighOccupancy", m_doHighOccupancy = true); + declareProperty("doHeavyIonMon", m_doHeavyIonMon = false); +} + + +PixelAthClusterMonTool::~PixelAthClusterMonTool() {} + + +StatusCode PixelAthClusterMonTool::initialize() { + + ATH_CHECK( detStore()->retrieve(m_atlasid, "AtlasID") ); + ATH_CHECK( detStore()->retrieve(m_pixelid, "PixelID") ); + ATH_CHECK( m_pixelCondSummaryTool.retrieve() ); + if ( !m_holeSearchTool.empty() ) ATH_CHECK( m_holeSearchTool.retrieve() ); + if ( !m_trackSelTool.empty() ) ATH_CHECK( m_trackSelTool.retrieve() ); + + ATH_CHECK( m_tracksKey.initialize() ); + ATH_CHECK( m_clustersKey.initialize() ); + return AthMonitorAlgorithm::initialize(); +} + + +StatusCode PixelAthClusterMonTool::fillHistograms( const EventContext& ctx ) const { + using namespace Monitored; + + int lb = GetEventInfo(ctx)->lumiBlock(); + + //******************************************************************************* + //************************** Begin of filling Status Histograms ****************** + //******************************************************************************* + + + ATH_MSG_DEBUG("Filling Status Monitoring Histograms"); + float index = 1.0; + float nBadMod[PixLayers::COUNT] = {0.}; + float nDisabledMod[PixLayers::COUNT] = {0.}; + int phiMod(-99); + int etaMod(-99); + bool copyFEval(false); + int clusPerEventArray_disksA[PixMon::kNumModulesDisk][PixMon::kNumLayersDisk] = { {0} }; + int clusPerEventArray_disksC[PixMon::kNumModulesDisk][PixMon::kNumLayersDisk] = { {0} }; + int clusPerEventArray_l0[PixMon::kNumStavesL0][PixMon::kNumModulesBarrel] = { {0} }; + int clusPerEventArray_l1[PixMon::kNumStavesL1][PixMon::kNumModulesBarrel] = { {0} }; + int clusPerEventArray_l2[PixMon::kNumStavesL2][PixMon::kNumModulesBarrel] = { {0} }; + int clusPerEventArray_lI[PixMon::kNumStavesIBL][PixMon::kNumFEsIBL] = { {0} }; + + for (auto idIt = m_pixelid->wafer_begin(); idIt!=m_pixelid->wafer_end(); ++idIt) { + Identifier waferID = *idIt; + IdentifierHash id_hash = m_pixelid->wafer_hash(waferID); + + int pixlayer = getPixLayersID(m_pixelid->barrel_ec(waferID), m_pixelid->layer_disk(waferID) ); + if (pixlayer == 99) continue; + + // read https://twiki.cern.ch/twiki/bin/view/AtlasComputing/MultiThreadingConditionsAccess + if (m_pixelCondSummaryTool->isActive(id_hash) == true && m_pixelCondSummaryTool->isGood(id_hash) == true) { + index = 0; + } else if (m_pixelCondSummaryTool->isActive(id_hash) == false) { + index = 2; // inactive or bad modules + nDisabledMod[pixlayer]++; + getPhiEtaMod(m_pixelid, waferID, phiMod, etaMod, copyFEval); + switch (pixlayer) { + case PixLayers::kECA : + clusPerEventArray_disksA[phiMod][etaMod] = -1; + break; + case PixLayers::kECC : + clusPerEventArray_disksC[phiMod][etaMod] = -1; + break; + case PixLayers::kB0 : + clusPerEventArray_l0[phiMod][etaMod] = -1; + break; + case PixLayers::kB1 : + clusPerEventArray_l1[phiMod][etaMod] = -1; + break; + case PixLayers::kB2 : + clusPerEventArray_l2[phiMod][etaMod] = -1; + break; + case PixLayers::kIBL : + clusPerEventArray_lI[phiMod][etaMod] = -1; + if (copyFEval) clusPerEventArray_lI[phiMod][++etaMod] = -1; + break; + } + } else { + index = 1; // bad but active modules + nBadMod[pixlayer]+= inv_nmod_per_layer[pixlayer]; + } + + CHECK( fill2DProfLayer("Map_Of_Modules_Status_"+pixLayersLabel[pixlayer], waferID, m_pixelid, index, true) ); + CHECK( fill2DProfLayer("Map_Of_Modules_Status_Mon_"+pixLayersLabel[pixlayer], waferID, m_pixelid, index, true) ); + if (m_doLumiBlock) CHECK( fill2DProfLayer("Map_Of_Modules_Status_LB_"+pixLayersLabel[pixlayer], waferID, m_pixelid, index, true) ); + } // end of pixelid wafer loop + + CHECK( fill1DProfLumiLayers("BadModules_per_lumi", lb, nBadMod) ); + CHECK( fill1DProfLumiLayers("DisabledModules_per_lumi", lb, nDisabledMod) ); + + //******************************************************************************* + //*************************** End of filling Status Histograms ****************** + //******************************************************************************* + + + //******************************************************************************* + //************************** Begin of filling Track Histograms ****************** + //******************************************************************************* + + + ATH_MSG_DEBUG("Filling Track Monitoring Histograms"); + + auto tracks = SG::makeHandle(m_tracksKey, ctx); + + if ( !(tracks.isValid()) ) { + ATH_MSG_ERROR("PixelMonitoring: Track container "<< m_tracksKey.key() << " could not be found."); + return StatusCode::RECOVERABLE; + } else { + ATH_MSG_DEBUG("PixelMonitoring: Track container "<< tracks.name() <<" is found."); + } + + int ntracksPerEvent = 0; + std::vector<std::pair<Identifier, double> > ClusterIDs; + + auto lbval = Monitored::Scalar<int>( "pixclusmontool_lb", lb ); + + TrackCollection::const_iterator itrack = tracks->begin(); + TrackCollection::const_iterator itrack_end = tracks->end(); + for (; itrack != itrack_end; ++itrack) { + if ((*itrack) == nullptr || (*itrack)->perigeeParameters() == nullptr || (*itrack)->trackSummary() == nullptr || (*itrack)->trackSummary()->get(Trk::numberOfPixelHits) == 0) { + ATH_MSG_DEBUG("PixelMonitoring: Track either invalid or it does not contain pixel hits, continuing..."); + continue; + } + + const Trk::Perigee* measPerigee = static_cast<const Trk::Perigee *>((*itrack)->perigeeParameters()); + std::unique_ptr<const Trk::Track> trackWithHoles( m_holeSearchTool->getTrackWithHoles(**itrack) ); + + int nPixelHits = 0; + bool passJOTrkTightCut = static_cast<bool>( m_trackSelTool->accept(**itrack) ); + bool pass1hole1GeVptTightCut = (passJOTrkTightCut && (measPerigee->pT() / 1000.0 > 1.0)); // misshit ratios + bool pass1hole5GeVptTightCut = (passJOTrkTightCut && (measPerigee->pT() / 1000.0 > 5.0)); // eff vs lumi + + const DataVector<const Trk::TrackStateOnSurface> *trackStates = trackWithHoles->trackStateOnSurfaces(); + for (DataVector<const Trk::TrackStateOnSurface>::const_iterator trackStateOnSurfaceIterator = trackStates->begin(); trackStateOnSurfaceIterator != trackStates->end(); trackStateOnSurfaceIterator++) { + + const Trk::MeasurementBase* mesBase = (*trackStateOnSurfaceIterator)->measurementOnTrack(); + + const Trk::RIO_OnTrack* RIOOnTrack = nullptr; + if ( mesBase && mesBase->type(Trk::MeasurementBaseType::RIO_OnTrack) ) { + RIOOnTrack = static_cast<const Trk::RIO_OnTrack*>(mesBase); + } + + if (mesBase && !RIOOnTrack) continue; // skip pseudomeasurements but not hits, holes, outliers + + const Trk::TrackParameters* trkParameters = (*trackStateOnSurfaceIterator)->trackParameters(); + Identifier surfaceID; + if (mesBase && mesBase->associatedSurface().associatedDetectorElement()) { + surfaceID = mesBase->associatedSurface().associatedDetectorElement()->identify(); + } else { // holes, perigee + if (trkParameters) { + surfaceID = trkParameters->associatedSurface().associatedDetectorElementIdentifier(); + } else { + ATH_MSG_INFO("PixelMonitoring: pointer of TSOS to track parameters or associated surface is null"); + continue; + } + } + if (!m_atlasid->is_pixel(surfaceID)) continue; + int pixlayer = getPixLayersID(m_pixelid->barrel_ec(surfaceID), m_pixelid->layer_disk(surfaceID) ); + if (pixlayer == 99) continue; + + float nOutlier = 0.; + float nHole = 0.; + auto effval = Monitored::Scalar<float>( "HitEff_all_val", 0. ); + auto efflb = Monitored::Scalar<float>( "HitEff_all_lb", lb ); + if ((*trackStateOnSurfaceIterator)->type(Trk::TrackStateOnSurface::Outlier)) { + nOutlier = 1.0; + if (!m_doOnline) CHECK( fill2DProfLayer("TSOS_Outlier_"+pixLayersLabel[pixlayer], surfaceID, m_pixelid, 1.0, true) ); + if (pass1hole5GeVptTightCut) fill("HitEff_all_" + pixLayersLabel[pixlayer], efflb, effval); + + } else if ((*trackStateOnSurfaceIterator)->type(Trk::TrackStateOnSurface::Hole)) { + nHole = 1.0; + if (!m_doOnline) CHECK( fill2DProfLayer("TSOS_Hole_"+pixLayersLabel[pixlayer], surfaceID, m_pixelid, 1.0, true) ); + if (pass1hole5GeVptTightCut) fill("HitEff_all_" + pixLayersLabel[pixlayer], efflb, effval); + + } else if ((*trackStateOnSurfaceIterator)->type(Trk::TrackStateOnSurface::Measurement)) { + + if (!m_doOnline) CHECK( fill2DProfLayer("TSOS_Measurement_"+pixLayersLabel[pixlayer], surfaceID, m_pixelid, 1.0, true) ); + effval = 1.; + if (pass1hole5GeVptTightCut) fill("HitEff_all_" + pixLayersLabel[pixlayer], efflb, effval); + + if (not mesBase) continue; + const InDetDD::SiDetectorElement *side = dynamic_cast<const InDetDD::SiDetectorElement *>(mesBase->associatedSurface().associatedDetectorElement()); + const InDet::SiClusterOnTrack *clus = dynamic_cast<const InDet::SiClusterOnTrack *>(mesBase); + if (!side || !clus) continue; + const InDet::SiCluster *RawDataClus = dynamic_cast<const InDet::SiCluster *>(clus->prepRawData()); + if (!RawDataClus || !RawDataClus->detectorElement()->isPixel()) continue; + + nPixelHits++; + + const Trk::AtaPlane *trackAtPlane = dynamic_cast<const Trk::AtaPlane *>(trkParameters); + if (trackAtPlane) { + const Amg::Vector2D localpos = trackAtPlane->localPosition(); + + // Get local error matrix for hit and track and calc pull + const AmgSymMatrix(5) trackErrMat = (*trackAtPlane->covariance()); + const Amg::MatrixX clusErrMat = clus->localCovariance(); + + double error_sum = sqrt(pow(Amg::error(trackErrMat, Trk::locX), 2) + pow(Amg::error(clusErrMat, Trk::locX), 2)); + auto resPhi = Monitored::Scalar<float>( "res_phi", clus->localParameters()[Trk::locX] - localpos[0]); + fill("Track_res_phi", resPhi); + if (error_sum != 0) { + auto pullPhi = Monitored::Scalar<float>( "pull_phi", resPhi / error_sum); + fill("Track_pulls_phi", pullPhi); + } + + error_sum = sqrt(pow(Amg::error(trackErrMat, Trk::locY), 2) + pow(Amg::error(clusErrMat, Trk::locY), 2)); + auto resEta = Monitored::Scalar<float>( "res_eta", clus->localParameters()[Trk::locY] - localpos[1]); + fill("Track_res_eta", resEta); + if (error_sum != 0) { + auto pullEta = Monitored::Scalar<float>( "pull_eta", resEta / error_sum); + fill("Track_pulls_eta", pullEta); + } + // Filling containers, which hold id's of hits and clusters on track + // _and_ incident angle information for later normalization + + Amg::Vector3D mynormal = side->normal(); + Amg::Vector3D mytrack = trackAtPlane->momentum(); + double trknormcomp = mytrack.dot(mynormal); + + double mytrack_mag = mytrack.mag(); + double cosalpha = 0.; + if (mytrack_mag != 0) cosalpha = fabs(trknormcomp / mytrack_mag); + ClusterIDs.push_back(std::make_pair(clus->identify(), cosalpha)); + } + + + } // end of measurement case + + if (pass1hole1GeVptTightCut) { + CHECK( fill2DProfLayer("HolesRatio_"+pixLayersLabel[pixlayer], surfaceID, m_pixelid, nHole, true) ); + CHECK( fill2DProfLayer("MissHitsRatio_"+pixLayersLabel[pixlayer], surfaceID, m_pixelid, nOutlier + nHole, true) ); + if (m_doOnline) { + CHECK( fill2DProfLayer("HolesRatio_5min_"+pixLayersLabel[pixlayer], surfaceID, m_pixelid, nHole, true) ); + CHECK( fill2DProfLayer("MissHitsRatio_5min_"+pixLayersLabel[pixlayer], surfaceID, m_pixelid, nOutlier + nHole, true) ); + } + } + + } // end of TSOS loop + + ntracksPerEvent++; + auto nph = Monitored::Scalar<int>( "npixhits_per_track", nPixelHits); + auto nphwgt = Monitored::Scalar<float>( "npixhits_per_track_wgt", 1.0 ); + fill("NPixhits_per_track_lumi", lbval, nph, nphwgt); + + int trkfitndf = (*itrack)->fitQuality()->numberDoF(); + double trkfitchi2 = (*itrack)->fitQuality()->chiSquared(); + if (trkfitndf != 0) { + auto trkChiN = Monitored::Scalar<float>( "fit_chi2byndf", trkfitchi2 / trkfitndf); + fill("Track_chi2byndf", trkChiN); + } + } // end of track loop + + sort(ClusterIDs.begin(), ClusterIDs.end(), [](const std::pair<Identifier, double> &left, const std::pair<Identifier, double> &right) { + return left.first < right.first; + }); + + + // Filling per-event histograms + // + auto nTrks = Monitored::Scalar<int>( "ntrks_per_event", ntracksPerEvent); + fill("tracksPerEvt_per_lumi", lbval, nTrks); + + //m_npixhits_per_track_lastXlb-> // m_npixhits_per_track_lumi TH2F vs lumi + //******************************************************************************* + //**************************** End of filling Track Histograms ****************** + //******************************************************************************* + + //******************************************************************************* + //************************ Begin of filling Cluster Histograms ****************** + //******************************************************************************* + + ATH_MSG_DEBUG("Filling Cluster Monitoring Histograms"); + + auto pixel_clcontainer = SG::makeHandle(m_clustersKey, ctx); + + if ( !(pixel_clcontainer.isValid()) ) { + ATH_MSG_ERROR("Pixel Monitoring: Pixel Cluster container "<< m_clustersKey.key() << " could not be found."); + return StatusCode::RECOVERABLE; + } else { + ATH_MSG_DEBUG("Pixel Monitoring: Pixel Cluster container "<< pixel_clcontainer.name() <<" is found."); + } + + int nclusters = 0; + int nclusters_ontrack = 0; + float nclusters_mod[PixLayers::COUNT] = {0.}; + float nclusters_ontrack_mod[PixLayers::COUNT] = {0.}; + + Identifier clusID; + InDet::PixelClusterContainer::const_iterator colNext = pixel_clcontainer->begin(); + InDet::PixelClusterContainer::const_iterator lastCol = pixel_clcontainer->end(); + DataVector<InDet::PixelCluster>::const_iterator p_clus; + + for (; colNext != lastCol; ++colNext) { + + const InDet::PixelClusterCollection* ClusterCollection(*colNext); + if (!ClusterCollection) { + ATH_MSG_DEBUG("Pixel Monitoring: Pixel Cluster container is empty."); + continue; + } + + for (p_clus = ClusterCollection->begin(); p_clus != ClusterCollection->end(); ++p_clus) { + clusID = (*p_clus)->identify(); + int pixlayer = getPixLayersID(m_pixelid->barrel_ec(clusID), m_pixelid->layer_disk(clusID) ); + if (pixlayer == 99) continue; + + const InDet::PixelCluster& cluster = **p_clus; + + nclusters++; + nclusters_mod[pixlayer]++; + + // begin timing histos + // + auto clLVL1A = Monitored::Scalar<float>( "Cluster_LVL1A_lvl1a", cluster.LVL1A() ); + fill( addTxt("Cluster_LVL1A", false), clLVL1A); + CHECK( fill2DProfLayer( addTxt("Cluster_LVL1A_Mod", false)+"_"+pixLayersLabel[pixlayer], clusID, m_pixelid, cluster.LVL1A() + 0.00001) ); + if (cluster.rdoList().size() > 1) CHECK( fill2DProfLayer( addTxt("Cluster_LVL1A_SizeCut", false)+"_"+pixLayersLabel[pixlayer], clusID, m_pixelid, cluster.LVL1A() + 0.00001) ); + if (cluster.totalToT() > clusterToTMinCut[pixlayer]) fill( addTxt("Cluster_LVL1A_ToTCut", false) + "_" + pixLayersLabel[pixlayer], clLVL1A); + + + // + // end timing histos + // begin cluster rate + // + if (m_doOnline) CHECK( fill2DProfLayer( addTxt("ClusterMap_Mon", false)+"_"+pixLayersLabel[pixlayer], clusID, m_pixelid) ); + // + // end cluster rate + // begin cluster occupancy + // + CHECK( fill2DProfLayer( addTxt("Cluster_Occupancy", false)+"_"+pixLayersLabel[pixlayer], clusID, m_pixelid) ); + if (cluster.rdoList().size() > 1) CHECK( fill2DProfLayer( addTxt("Clus_Occ_SizeCut", false)+"_"+pixLayersLabel[pixlayer], clusID, m_pixelid) ); + if (m_doLumiBlock) CHECK( fill2DProfLayer( addTxt("Cluster_Occupancy_LB", false)+"_"+pixLayersLabel[pixlayer], clusID, m_pixelid) ); + // + // end cluster occupancy + double cosalpha(0.); + if ( isClusterOnTrack(clusID, ClusterIDs, cosalpha) ) { + nclusters_ontrack++; + nclusters_ontrack_mod[pixlayer]++; + getPhiEtaMod(m_pixelid, clusID, phiMod, etaMod, copyFEval); + switch (pixlayer) { + case PixLayers::kECA : + clusPerEventArray_disksA[phiMod][etaMod]++; + break; + case PixLayers::kECC : + clusPerEventArray_disksC[phiMod][etaMod]++; + break; + case PixLayers::kB0 : + clusPerEventArray_l0[phiMod][etaMod]++; + break; + case PixLayers::kB1 : + clusPerEventArray_l1[phiMod][etaMod]++; + break; + case PixLayers::kB2 : + clusPerEventArray_l2[phiMod][etaMod]++; + break; + case PixLayers::kIBL : + clusPerEventArray_lI[phiMod][etaMod]++; + break; + } + // begin timing histos + // + clLVL1A = cluster.LVL1A(); + fill( addTxt("Cluster_LVL1A", true), clLVL1A); + CHECK( fill2DProfLayer( addTxt("Cluster_LVL1A_Mod", true)+"_"+pixLayersLabel[pixlayer], clusID, m_pixelid, cluster.LVL1A() + 0.00001) ); + if (cluster.rdoList().size() > 1) CHECK( fill2DProfLayer( addTxt("Cluster_LVL1A_SizeCut", true)+"_"+pixLayersLabel[pixlayer], clusID, m_pixelid, cluster.LVL1A() + 0.00001) ); + if (cluster.totalToT() > clusterToTMinCut[pixlayer]) fill( addTxt("Cluster_LVL1A_ToTCut", true) + "_" + pixLayersLabel[pixlayer], clLVL1A); + // + // end timing histos + // begin cluster sizes + // + auto clSize = Monitored::Scalar<float>( Form("%s_%s", addTxt("Cluster_Size", true).c_str(), "clsize"), cluster.rdoList().size()); + auto etaModule = Monitored::Scalar<float>( Form("%s_%s", addTxt("Cluster_Size", true).c_str(), "em"), m_pixelid->eta_module(clusID) ); + if ( abs(m_pixelid->barrel_ec(clusID))!=0 ) etaModule = m_pixelid->layer_disk(clusID) + 1; + fill( addTxt("Cluster_groupsize_vs_eta", true) + "_" + pixLayersLabel[pixlayer], etaModule, clSize ); + CHECK( fill2DProfLayer( addTxt("Cluster_Size_Map", true)+"_"+pixLayersLabel[pixlayer], clusID, m_pixelid, cluster.rdoList().size()) ); + // + // end cluster sizes + // begin cluster rate + // + if (m_doOnline) CHECK( fill2DProfLayer( addTxt("ClusterMap_Mon", true)+"_"+pixLayersLabel[pixlayer], clusID, m_pixelid) ); + // + // end cluster rate + // begin cluster occupancy + // + CHECK( fill2DProfLayer( addTxt("Cluster_Occupancy", true)+"_"+pixLayersLabel[pixlayer], clusID, m_pixelid) ); + if (cluster.rdoList().size() > 1) CHECK( fill2DProfLayer( addTxt("Clus_Occ_SizeCut", true)+"_"+pixLayersLabel[pixlayer], clusID, m_pixelid) ); + if (m_doLumiBlock) CHECK( fill2DProfLayer( addTxt("Cluster_Occupancy_LB", true)+"_"+pixLayersLabel[pixlayer], clusID, m_pixelid) ); + // + // end cluster occupancy + // begin cluster ToT and charge + // + auto clToTcosAlpha = Monitored::Scalar<float>( Form("%s_%s", addTxt("Cluster_ToTxCosAlpha", true).c_str(), "val"), cluster.totalToT() * cosalpha ); + fill( addTxt("Cluster_ToTxCosAlpha", true) + "_" + pixLayersLabel[pixlayer], clToTcosAlpha); + if (!m_doOnline) { + auto clQcosAlpha = Monitored::Scalar<float>( Form("%s_%s", addTxt("Cluster_QxCosAlpha", true).c_str(), "val"), cluster.totalCharge() * cosalpha); + fill( addTxt("Cluster_QxCosAlpha", true) + "_" + pixLayersLabel[pixlayer], clQcosAlpha); + } + // + // end cluster ToT and charge + } + } + + } + // begin cluster rates + // + auto nCls = Monitored::Scalar<int>( "ncls_per_event", nclusters ); + fill( addTxt("Clusters_per_lumi", false), lbval, nCls); + nCls = nclusters_ontrack; + fill( addTxt("Clusters_per_lumi", true), lbval, nCls); + + if (nclusters>0) { + auto clsFracOnTrack = Monitored::Scalar<float>( "cls_frac_ontrack", (float)nclusters_ontrack / nclusters ); + fill( "ClustersOnOffTrack_per_lumi", lbval, clsFracOnTrack); + } + + CHECK( fill1DProfLumiLayers( addTxt("Clusters_per_lumi", false), lb, nclusters_mod) ); + CHECK( fill1DProfLumiLayers( addTxt("Clusters_per_lumi", true), lb, nclusters_ontrack_mod) ); + + CHECK( fillPP0Histos( addTxt("Cluster_Occupancy_PP0", true), + clusPerEventArray_disksA, clusPerEventArray_disksC, + clusPerEventArray_l0, clusPerEventArray_l1, + clusPerEventArray_l2, clusPerEventArray_lI ) ); + + if (ntracksPerEvent>0) { + for (unsigned int ii=0; ii<PixLayers::COUNT; ii++) nclusters_ontrack_mod[ii]/= ntracksPerEvent; // keep as in Run 1,2 + CHECK( fill1DProfLumiLayers( "num_clusters_per_track_per_lumi", lb, nclusters_ontrack_mod) ); + } + // + // end cluster rate + ClusterIDs.clear(); + + //******************************************************************************* + //************************** End of filling Cluster Histograms ****************** + //******************************************************************************* + + return StatusCode::SUCCESS; +} + diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelAthErrorMonTool.cxx b/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelAthErrorMonTool.cxx new file mode 100644 index 0000000000000000000000000000000000000000..f6eb6dd2581af64ca73c4f6de01b656dbe26321e --- /dev/null +++ b/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelAthErrorMonTool.cxx @@ -0,0 +1,60 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#include "PixelMonitoring/PixelAthErrorMonTool.h" +#include "PixelMonitoring/PixelAthMonitoringBase.h" +#include "InDetIdentifier/PixelID.h" + +PixelAthErrorMonTool::PixelAthErrorMonTool( const std::string& name, ISvcLocator* pSvcLocator ) : + AthMonitorAlgorithm(name, pSvcLocator), + m_pixelid(nullptr) +{ + //jo flags + declareProperty("doOnline", m_doOnline = false); + declareProperty("doModules", m_doModules = false); + declareProperty("doLumiBlock", m_doLumiBlock = false); + declareProperty("doLowOccupancy", m_doLowOccupancy = false); + declareProperty("doHighOccupancy", m_doHighOccupancy = false); + declareProperty("doHeavyIonMon", m_doHeavyIonMon = false); +} + + +PixelAthErrorMonTool::~PixelAthErrorMonTool() {} + + +StatusCode PixelAthErrorMonTool::initialize() { + + ATH_CHECK( detStore()->retrieve(m_pixelid, "PixelID") ); + ATH_CHECK( m_pixelCondSummaryTool.retrieve() ); + ATH_CHECK( m_pixelErrorTool.retrieve() ); + + return AthMonitorAlgorithm::initialize(); +} + + +StatusCode PixelAthErrorMonTool::fillHistograms( const EventContext& ctx ) const { + using namespace Monitored; + + int lb = GetEventInfo(ctx)->lumiBlock(); + + //******************************************************************************* + //************************** Begin of filling Error Histograms ******************** + //******************************************************************************* + + + ATH_MSG_DEBUG("Filling Error Monitoring Histograms"); + + float num_errors[PixLayers::COUNT] = {0,1,2,3,4,5,6,7}; + // filling tbd + + CHECK( fill1DProfLumiLayers("errors_per_lumi", lb, num_errors) ); + + + //******************************************************************************* + //************************** End of filling Error Histograms ********************** + //******************************************************************************* + + return StatusCode::SUCCESS; +} + diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelAthHitMonTool.cxx b/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelAthHitMonTool.cxx new file mode 100644 index 0000000000000000000000000000000000000000..78929654598d645b21c19712bc1e138b97f53858 --- /dev/null +++ b/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelAthHitMonTool.cxx @@ -0,0 +1,89 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#include "PixelMonitoring/PixelAthHitMonTool.h" +#include "PixelMonitoring/PixelAthMonitoringBase.h" +#include "InDetIdentifier/PixelID.h" + +#include "PixelCabling/IPixelCablingSvc.h" + +PixelAthHitMonTool::PixelAthHitMonTool( const std::string& name, ISvcLocator* pSvcLocator ) : + AthMonitorAlgorithm(name, pSvcLocator), + m_pixelCableSvc("PixelCablingSvc", name), + m_pixelid(nullptr) +{ + //jo flags + declareProperty("doOnline", m_doOnline = false); + declareProperty("doModules", m_doModules = false); + declareProperty("doLumiBlock", m_doLumiBlock = false); + declareProperty("doLowOccupancy", m_doLowOccupancy = false); + declareProperty("doHighOccupancy", m_doHighOccupancy = false); + declareProperty("doHeavyIonMon", m_doHeavyIonMon = false); +} + + +PixelAthHitMonTool::~PixelAthHitMonTool() {} + + +StatusCode PixelAthHitMonTool::initialize() { + + ATH_CHECK( detStore()->retrieve(m_pixelid, "PixelID") ); + ATH_CHECK( m_pixelCondSummaryTool.retrieve() ); + ATH_CHECK( m_pixelCableSvc.retrieve() ); + ATH_CHECK( m_pixelRDOName.initialize() ); + + return AthMonitorAlgorithm::initialize(); +} + + +StatusCode PixelAthHitMonTool::fillHistograms( const EventContext& ctx ) const { + using namespace Monitored; + + //int lb = GetEventInfo(ctx)->lumiBlock(); + //unsigned int bcid = GetEventInfo(ctx)->bcid(); + auto rdocontainer = SG::makeHandle(m_pixelRDOName, ctx); + if ( !(rdocontainer.isValid()) ) { + ATH_MSG_ERROR("Pixel Monitoring: Pixel RDO container "<< m_pixelRDOName << " could not be found."); + return StatusCode::RECOVERABLE; + } else { + ATH_MSG_DEBUG("Pixel Monitoring: Pixel RDO container "<< rdocontainer.name() <<" is found."); + } + + int nGood_mod[PixLayers::COUNT] = {0}; + int nActive_mod[PixLayers::COUNT] = {0}; + + PixelID::const_id_iterator idIt = m_pixelid->wafer_begin(); + PixelID::const_id_iterator idItEnd = m_pixelid->wafer_end(); + for (; idIt != idItEnd; ++idIt) { + Identifier waferID = *idIt; + IdentifierHash id_hash = m_pixelid->wafer_hash(waferID); + int pixlayer = getPixLayersID(m_pixelid->barrel_ec(waferID), m_pixelid->layer_disk(waferID) ); + if (pixlayer == 99) continue; + + if (m_pixelCondSummaryTool->isActive(id_hash) == true) { + if (pixlayer == PixLayers::kIBL && m_pixelid->eta_module(waferID)>-7 && m_pixelid->eta_module(waferID)<6) nActive_mod[pixlayer]+=2; + else nActive_mod[pixlayer]++; + + if (m_pixelCondSummaryTool->isGood(id_hash) == true) { + if (pixlayer == PixLayers::kIBL && m_pixelid->eta_module(waferID)>-7 && m_pixelid->eta_module(waferID)<6) nGood_mod[pixlayer]+=2; + else nGood_mod[pixlayer]++; + } + } + } + + //******************************************************************************* + //************************** Begin of filling Hit Histograms ******************** + //******************************************************************************* + + + ATH_MSG_DEBUG("Filling Raw Hit (RDO) Monitoring Histograms"); + + + //******************************************************************************* + //************************** End of filling Hit Histograms ********************** + //******************************************************************************* + + return StatusCode::SUCCESS; +} + diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelAthMonitoringBase.cxx b/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelAthMonitoringBase.cxx new file mode 100644 index 0000000000000000000000000000000000000000..f179b08c31817dc55b5f38d98314f28c8cfd8a8a --- /dev/null +++ b/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelAthMonitoringBase.cxx @@ -0,0 +1,265 @@ +/* + Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +*/ + +#include "PixelMonitoring/PixelAthMonitoringBase.h" + +////////////////////////////////////////////// +/// +/// filling 2D(Prof) per-layer histogram, one of ["ECA","ECC","B0","B1","B2","IBL","DBMA","DBMC"] +/// +StatusCode PixelAthMonitoringBase::fill2DProfLayer( std::string prof2Dname, Identifier& id, const PixelID* pid, float value, bool copy2DFEval) const { + ATH_MSG_VERBOSE( "in fill2DProfLayer()" ); + + // Define the monitored variables + auto pm = Monitored::Scalar<int>( Form("%s_%s", prof2Dname.c_str(), "pm"), pid->phi_module(id)); + auto val = Monitored::Scalar<float>( Form("%s_%s", prof2Dname.c_str(), "val"), value); + + int ld = pid->layer_disk(id); + auto em = Monitored::Scalar<int>( Form("%s_%s", prof2Dname.c_str(), "em"), ld); + bool copy = false; + if (pid->barrel_ec(id) == 0) { + em = pid->eta_module(id); + if (ld == 0) { + int feid = 0; + int emf = 0; + if (em < -6) { + emf = em - 6; + } else if (em > -7 && em < 6) { + if (pid->eta_index(id) >= 80) feid = 1; + emf = 2 * em + feid; + copy = true; + } else { + emf = em + 6; + } + em = emf; + } + } + fill(prof2Dname, em, pm, val); + // next line is only for IBL: fill the (per-FE) histogram again to avoid holes in the histogram in case + // the filled information is available per module (and not per FE) + if ( copy2DFEval && copy ) { + em++; + fill(prof2Dname, em, pm, val); + } + return StatusCode::SUCCESS; +} +////////////////////////////////////////////// + +/// +/// filling 1DProf per-lumi per-layer histograms ["ECA","ECC","B0","B1","B2","IBL","DBMA","DBMC"] +/// +StatusCode PixelAthMonitoringBase::fill1DProfLumiLayers( std::string prof1Dname, int lumiblock, float* values) const { + ATH_MSG_VERBOSE( "in fill1DProfLumiLayers()" ); + + // Define the monitored variables + auto lb = Monitored::Scalar<int>( Form("%s_%s", prof1Dname.c_str(), "lb"), lumiblock ); + auto val = Monitored::Scalar<float>( Form("%s_%s", prof1Dname.c_str(), "val"), 1.0); + + for (int i = 0; i < PixLayers::COUNT; i++) { + val = values[i]; + fill( prof1Dname + "_" + pixLayersLabel[i], lb, val); + } + + return StatusCode::SUCCESS; +} +////////////////////////////////////////////// + +/// +/// filling 1D per-layer histograms ["ECA","ECC","B0","B1","B2","IBL","DBMA","DBMC"] +/// +StatusCode PixelAthMonitoringBase::fill1DProfLayers( std::string name, float* values) const { + ATH_MSG_VERBOSE( "in fill1DProfLayers()" ); + + // Define the monitored variables + auto val = Monitored::Scalar<float>( Form("%s_%s", name.c_str(), "val"), -999. ); + for (int i = 0; i < PixLayers::COUNT; i++) { + val = values[i]; + fill(name + "_" + pixLayersLabel[i], val); + } + return StatusCode::SUCCESS; +} +////////////////////////////////////////////// + +/// +/// filling 1DProfile per-pp0(ROD) histograms for ["ECA","ECC","B0","B1","B2","IBLA","IBLC"] +/// +StatusCode PixelAthMonitoringBase::fillPP0Histos( std::string name, int(&D_A)[PixMon::kNumModulesDisk][PixMon::kNumLayersDisk], int(&D_C)[PixMon::kNumModulesDisk][PixMon::kNumLayersDisk], int(&B0)[PixMon::kNumStavesL0][PixMon::kNumModulesBarrel], int(&B1)[PixMon::kNumStavesL1][PixMon::kNumModulesBarrel], int(&B2)[PixMon::kNumStavesL2][PixMon::kNumModulesBarrel], int(&IBL)[PixMon::kNumStavesIBL][PixMon::kNumFEsIBL]) const { + ATH_MSG_VERBOSE( "in fillPP0Histos()" ); + + + std::string posvar = Form("%s_%s", name.c_str(), "pos"); + std::string valvar = Form("%s_%s", name.c_str(), "val"); + + for (unsigned int x = 0; x < PixMon::kNumModulesDisk; ++x) { + for (unsigned int y = 0; y < PixMon::kNumLayersDisk; ++y) { + auto pos = Monitored::Scalar<int>( posvar, (y-1)*8 + (x-1)/6 + 1); + auto val = Monitored::Scalar<float>( valvar, D_A[x][y]); + if (D_A[x][y]>-1) { + fill(name + "_ECA", pos, val); + D_A[x][y] = 0; + } + } + } + for (unsigned int x = 0; x < PixMon::kNumModulesDisk; ++x) { + for (unsigned int y = 0; y < PixMon::kNumLayersDisk; ++y) { + auto pos = Monitored::Scalar<int>( posvar, (y-1)*8 + (x-1)/6 + 1); + auto val = Monitored::Scalar<float>( valvar, D_C[x][y]); + if (D_C[x][y]>-1) { + fill(name + "_ECC", pos, val); + D_C[x][y] = 0; + } + } + } + for (unsigned int x = 0; x < PixMon::kNumStavesL0; ++x) { + auto pos = Monitored::Scalar<int>( posvar, x); + for (unsigned int y = 0; y < PixMon::kNumModulesBarrel; ++y) { + auto val = Monitored::Scalar<float>( valvar, B0[x][y]); + if (B0[x][y]>-1) { + fill(name + "_B0", pos, val); + B0[x][y] = 0; + } + } + } + for (unsigned int x = 0; x < PixMon::kNumStavesL1; ++x) { + auto pos = Monitored::Scalar<int>( posvar, x); + for (unsigned int y = 0; y < PixMon::kNumModulesBarrel; ++y) { + auto val = Monitored::Scalar<float>( valvar, B1[x][y]); + if (B1[x][y]>-1) { + fill(name + "_B1", pos, val); + B1[x][y] = 0; + } + } + } + for (unsigned int x = 0; x < PixMon::kNumStavesL2; ++x) { + auto pos = Monitored::Scalar<int>( posvar, x); + for (unsigned int y = 0; y < PixMon::kNumModulesBarrel; ++y) { + auto val = Monitored::Scalar<float>( valvar, B2[x][y]); + if (B2[x][y]>-1) { + fill(name + "_B2", pos, val); + B2[x][y] = 0; + } + } + } + unsigned int nbinx = PixMon::kNumStavesIBL; + unsigned int nbiny = PixMon::kNumFEsIBL; + for (unsigned int x = 0; x < nbinx; ++x) { + auto pos = Monitored::Scalar<int>( posvar, x); + for (unsigned int y = 0; y < nbiny; ++y) { + auto val = Monitored::Scalar<float>( valvar, IBL[x][y]); + if (IBL[x][y]>-1) { + if (y>0.5*nbiny) { + fill(name + "_IBLA", pos, val); + } else { + fill(name + "_IBLC", pos, val); + } + IBL[x][y] = 0; + } + } + } + return StatusCode::SUCCESS; +} +////////////////////////////////////////////// + + +/// +/// helper function to get layers ID +/// +int PixelAthMonitoringBase::getPixLayersID(int ec, int ld) const { + int layer = 99; + if (ec == 2) { + layer = PixLayers::kECA; + } else if (ec == -2) { + layer = PixLayers::kECC; + } else if (ec == 0) { + if (ld == 0) layer = PixLayers::kIBL; + if (ld == 1) layer = PixLayers::kB0; + if (ld == 2) layer = PixLayers::kB1; + if (ld == 3) layer = PixLayers::kB2; + } else { + if (ec == 4) layer = PixLayers::kDBMA; + if (ec == -4) layer = PixLayers::kDBMC; + } + return layer; +} +////////////////////////////////////////////// + +/// +/// helper function to (optionally) append histogram title +/// +std::string PixelAthMonitoringBase::addTxt(std::string title, bool ontrack) const { + if (ontrack) { + title+="_OnTrack"; + } + return title; +} +////////////////////////////////////////////// + +/// +/// helper function to get eta phi coordinates of per-layer arrays +/// +void PixelAthMonitoringBase::getPhiEtaMod(const PixelID* pid, Identifier& id, int& phiMod, int& etaMod, bool& copyFE) const { + + phiMod = pid->phi_module(id); + + int layerDisk = pid->layer_disk(id); + etaMod = layerDisk; + copyFE = false; + if (pid->barrel_ec(id) == 0) { + etaMod = pid->eta_module(id); + if (layerDisk == 0) { + if (etaMod < -6) { + etaMod = etaMod - 6; + } else if (etaMod > -7 && etaMod < 6) { + int feid = 0; + if (pid->eta_index(id) >= 80) feid = 1; + etaMod = 2 * etaMod + feid; + copyFE = true; + } else { + etaMod = etaMod + 6; + } + etaMod = etaMod + 16; + } else etaMod = etaMod + 6; + } +} + +////////////////////////////////////////////// +/// +/// checks if hit is on track +/// + +bool PixelAthMonitoringBase::isHitOnTrack(Identifier id, std::vector<Identifier> const &RDOIDs) const { + return binary_search(RDOIDs.begin(), RDOIDs.end(), id);; +} +////////////////////////////////////////////// + + +/// +/// checks if cluster is on track +/// + +bool PixelAthMonitoringBase::isClusterOnTrack(Identifier id, std::vector<std::pair<Identifier, double> > const &ClusterIDs) const { + bool onTrack = false; + std::pair<Identifier, double> searchVal = std::make_pair(id, -1.0); + onTrack = std::binary_search(ClusterIDs.begin(), ClusterIDs.end(), searchVal, + [](std::pair<Identifier, double> l, std::pair<Identifier, double> r) -> bool { return l.first < r.first; }); + return onTrack; +} +////////////////////////////////////////////// + +/// +/// checks if cluster is on track and returns its cosalpha +/// +bool PixelAthMonitoringBase::isClusterOnTrack(Identifier id, std::vector<std::pair<Identifier, double> > const &ClusterIDs, double& cosalpha) const { + bool onTrack(false); + std::pair<Identifier, double> searchVal = std::make_pair(id, -1.0); + auto it = std::lower_bound(ClusterIDs.begin(), ClusterIDs.end(), searchVal, + [](std::pair<Identifier, double> l, std::pair<Identifier, double> r) -> bool { return l.first < r.first; }); + + if (it != ClusterIDs.end() && !(id < (*it).first)) { + onTrack = true; + cosalpha = (*it).second; + } + return onTrack; +} +////////////////////////////////////////////// diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelDCSMon.cxx b/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelDCSMon.cxx deleted file mode 100644 index 29b96ada975afff61711f7109960c517bd56740d..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelDCSMon.cxx +++ /dev/null @@ -1,1118 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -/////////////////////////////////////////////////////////////////////////////// -// Book and fill offline histograms showing status of modules -/////////////////////////////////////////////////////////////////////////////// - -#include <map> -#include <sstream> -#include <string> -#include <vector> -#include "AthenaPoolUtilities/CondAttrListCollection.h" -#include "InDetIdentifier/PixelID.h" -#include "LWHists/TH1F_LW.h" -#include "LWHists/TH1I_LW.h" -#include "LWHists/TH2F_LW.h" -#include "LWHists/TH2I_LW.h" -#include "LWHists/TProfile2D_LW.h" -#include "LWHists/TProfile_LW.h" -#include "PixelMonitoring/PixelMainMon.h" -#include "PixelMonitoring/PixelMonModules.h" -#include "TH1F.h" -#include "TH1I.h" -#include "TH2F.h" -#include "TH2I.h" -#include "TMath.h" -#include "TProfile2D.h" -#include "TString.h" - -/////////////////////////////////////////////////////////////////////////////// -//////////////////////booking methods////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -StatusCode PixelMainMon::bookPixelDCSMon(void) { - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "starting Book Status" << endmsg; - - msg(MSG::DEBUG) << "[BookPixelDCSMon]" << endmsg; - - std::string path = "Pixel/DCS"; - if (m_doOnTrack) path.replace(path.begin(), path.end(), "Pixel/DCSOnTrack"); - MonGroup dcsExpert(this, path.c_str(), run, ATTRIB_MANAGED); // declare a group of histograms - - float min_temperature = -20.; - float max_temperature = 0.; - int nbins_temperature = 100; - float min_LB = 0.; - float max_LB = 1500.; - int nbins_LB = 1500; - float min_module = -10.; - float max_module = 10.; - int nbins_module = 20; - float min_HV = 0.; - float max_HV = 150.; - int nbins_HV = 150; - float min_HVcurrent = 0.; - float max_HVcurrent = 0.1; - int nbins_HVcurrent = 100; - float min_LV = 0.; - float max_LV = 5.; - int nbins_LV = 50; - float min_LVcurrent = 0.; - float max_LVcurrent = 5.; - int nbins_LVcurrent = 50; - float min_moduleGroup = 0.; - float max_moduleGroup = 8.; - int nbins_moduleGroup = 8; - float min_staveID = 1; - float max_staveID = 15; - int nbins_staveID = 14; - float min_FSM = 0; - float max_FSM = 11; - int nbins_FSM = 11; - TString label_moduleTemp = "Module Temperature [#circC]"; - TString label_inletTemp = "Cooling Pipe Inlet Temperature [#circC]"; - TString label_outletTemp = "Cooling Pipe Outlet Temperature [#circC]"; - TString label_HVoltage = "HV [-V]"; - TString label_LVoltage = "LV [V]"; - TString label_HVcurrent = "HV current [-mA]"; - TString label_LVcurrent = "LV current [A]"; - TString label_dT = "Module - Cooling Pipe Outlet Temperature [#circC]"; - TString label_HVPC = "HV Power Consumption [mW]"; - TString label_LVPC = "LV Power Consumption [W]"; - TString label_LVHVPC = "LV+HV Power Consumption [W]"; - TString label_effFLEXtemp = "Effective FLEX Temperature [#circC]"; - TString label_tfm = "Thermal Figure of Merit [#circC/W]"; - TString label_FSMstate = "FSM State"; - TString label_FSMstatus = "FSM Status"; - const int NUMMODULEGROUP = 8; - const char* moduleGroup[NUMMODULEGROUP] = {"M4C", "M3C", "M2C", "M1C", "M1A", "M2A", "M3A", "M4A"}; - const int NUMMODULEETA = 20; - const char* moduleEta[NUMMODULEETA] = {"C8_2", "C8_1", "C7_2", "C7_1", - "C6", "C5", "C4", "C3", "C2", "C1", - "A1", "A2", "A3", "A4", "A5", "A6", - "A7_1", "A7_2", "A8_1", "A8_2"}; - const int NUMFSM = 11; - const char* FSMSTATE[NUMFSM] = {"READY", "ON", "STANDBY", "LV_ON", "TRANSITION", "UNDEFINED", "LOCKED_OUT", "DISABLED", "OFF", "DEAD", "UNKNOWN"}; - const char* FSMSTATUS[NUMFSM] = {"OK", "WARNING", "ERROR", "UNINITIALIZED", "DEAD", "5", "6", "7", "8", "9", "UNKNOWN"}; - TAxis* txaxis; - TAxis* tyaxis; - LWHist::LWHistAxis* xaxis; - LWHist::LWHistAxis* yaxis; - StatusCode sc; - for (int ii = 0; ii < IBLStave::COUNT; ii++) { - // temperature - sc = dcsExpert.regHist(m_hist_moduleTemperature2Dscatter[ii] = TH2F_LW::create( - Form("moduleTemperature_ModuleNumber_S%02d", ii + 1), "Module Temprerature vs Module Number; Module Number;" + label_moduleTemp + ";Number of LBs", - nbins_module, min_module, max_module, nbins_temperature, min_temperature, max_temperature)); - xaxis = m_hist_moduleTemperature2Dscatter[ii]->GetXaxis(); - for (int jj = 0; jj < NUMMODULEETA; jj++) { - xaxis->SetBinLabel(jj + 1, moduleEta[jj]); - } - sc = dcsExpert.regHist(m_hist_moduleTemperatureLB[ii] = TProfile_LW::create(Form("moduleTemperature_S%02dvsLB", ii + 1), "Module Temperature vs LB; LB;" + label_moduleTemp, nbins_LB, min_LB, max_LB)); - m_hist_moduleTemperatureLB[ii]->SetMarkerSize(0.5); - - sc = dcsExpert.regHist(m_hist_LB_moduleGroup_moduleTemperature[ii] = TProfile2D_LW::create( - Form("LB_moduleGroup_moduleTemperature_S%02dvsLB", ii + 1), "LB_moduleGroup_moduleTemperature; LB;moduleGoup;" + label_moduleTemp, - nbins_LB, min_LB, max_LB, nbins_moduleGroup, min_moduleGroup, max_moduleGroup)); - yaxis = m_hist_LB_moduleGroup_moduleTemperature[ii]->GetYaxis(); - for (int jj = 0; jj < NUMMODULEGROUP; jj++) { - yaxis->SetBinLabel(jj + 1, moduleGroup[jj]); - } - - sc = dcsExpert.regHist(m_hist_HVoltage2Dscatter[ii] = TH2F_LW::create( - Form("HVvoltage_ModuleNumber_S%02d", ii + 1), "HV vs Module Number; Module Number;" + label_HVoltage + ";Number of LBs", - nbins_module, min_module, max_module, nbins_HV, min_HV, max_HV)); - xaxis = m_hist_HVoltage2Dscatter[ii]->GetXaxis(); - for (int jj = 0; jj < NUMMODULEETA; jj++) { - xaxis->SetBinLabel(jj + 1, moduleEta[jj]); - } - - sc = dcsExpert.regHist(m_hist_HVoltageLB[ii] = TProfile_LW::create(Form("HVvoltage_S%02dvsLB", ii + 1), "HV vs LB; LB;" + label_HVoltage, nbins_LB, min_LB, max_LB)); - m_hist_HVoltageLB[ii]->SetMarkerSize(0.5); - - sc = dcsExpert.regHist(m_hist_LB_moduleGroup_HVoltage[ii] = TProfile2D_LW::create( - Form("LB_moduleGroup_HV_S%02dvsLB", ii + 1), "LB_moduleGroup_HV; LB;moduleGoup;" + label_HVoltage, - nbins_LB, min_LB, max_LB, nbins_moduleGroup, min_moduleGroup, max_moduleGroup)); - yaxis = m_hist_LB_moduleGroup_HVoltage[ii]->GetYaxis(); - for (int jj = 0; jj < NUMMODULEGROUP; jj++) { - yaxis->SetBinLabel(jj + 1, moduleGroup[jj]); - } - - sc = dcsExpert.regHist(m_hist_Pipes_inletLB[ii] = TProfile_LW::create( - Form("Pipes_inlet_temperature_S%02dvsLB", ii + 1), "Pipes_inlet_temperature vs LB; LB;" + label_inletTemp + ";Number of LBs", nbins_LB, min_LB, max_LB)); - m_hist_Pipes_inletLB[ii]->SetMarkerSize(0.5); - - sc = dcsExpert.regHist(m_hist_Pipes_outletLB[ii] = TProfile_LW::create( - Form("Pipes_outlet_temperature_S%02dvsLB", ii + 1), "Pipes_outlet_temperature vs LB; LB;" + label_outletTemp + ";Number of LBs", nbins_LB, min_LB, max_LB)); - m_hist_Pipes_outletLB[ii]->SetMarkerSize(0.5); - - sc = dcsExpert.regHist(m_hist_LVoltage2Dscatter[ii] = TH2F_LW::create( - Form("LVvoltage_ModuleNumber_S%02d", ii + 1), "LV vs Module Number; Module Number;" + label_LVoltage + ";Number of LBs", - nbins_module, min_module, max_module, nbins_LV, min_LV, max_LV)); - xaxis = m_hist_LVoltage2Dscatter[ii]->GetXaxis(); - for (int jj = 0; jj < NUMMODULEETA; jj++) { - xaxis->SetBinLabel(jj + 1, moduleEta[jj]); - } - - sc = dcsExpert.regHist(m_hist_LVoltageLB[ii] = TProfile_LW::create(Form("LVvoltage_S%02dvsLB", ii + 1), "LV vs LB; LB;" + label_LVoltage, nbins_LB, min_LB, max_LB)); - m_hist_LVoltageLB[ii]->SetMarkerSize(0.5); - - sc = dcsExpert.regHist(m_hist_LB_moduleGroup_LVoltage[ii] = TProfile2D_LW::create( - Form("LB_moduleGroup_LVoltage_S%02dvsLB", ii + 1), "LB_moduleGroup_LVoltage; LB;moduleGoup;" + label_LVoltage, - nbins_LB, min_LB, max_LB, nbins_moduleGroup, min_moduleGroup, max_moduleGroup)); - yaxis = m_hist_LB_moduleGroup_LVoltage[ii]->GetYaxis(); - for (int jj = 0; jj < NUMMODULEGROUP; jj++) { - yaxis->SetBinLabel(jj + 1, moduleGroup[jj]); - } - - sc = dcsExpert.regHist(m_hist_LVcurrent2Dscatter[ii] = TH2F_LW::create( - Form("LVcurrent_ModuleNumber_S%02d", ii + 1), "LV current vs Module Number; Module Number;" + label_LVcurrent + ";Number of LBs", - nbins_module, min_module, max_module, nbins_LVcurrent, min_LVcurrent, max_LVcurrent)); - xaxis = m_hist_LVcurrent2Dscatter[ii]->GetXaxis(); - for (int jj = 0; jj < NUMMODULEETA; jj++) { - xaxis->SetBinLabel(jj + 1, moduleEta[jj]); - } - - sc = dcsExpert.regHist(m_hist_LVcurrentLB[ii] = TProfile_LW::create(Form("LVcurrent_S%02dvsLB", ii + 1), "LV current vs LB; LB;" + label_LVcurrent, nbins_LB, min_LB, max_LB)); - m_hist_LVcurrentLB[ii]->SetMarkerSize(0.5); - - sc = dcsExpert.regHist(m_hist_LB_moduleGroup_LVcurrent[ii] = TProfile2D_LW::create( - Form("LB_moduleGroup_LVcurrent_S%02dvsLB", ii + 1), "LB_moduleGroup_LVcurrent; LB;moduleGoup;" + label_LVcurrent, - nbins_LB, min_LB, max_LB, nbins_moduleGroup, min_moduleGroup, max_moduleGroup)); - yaxis = m_hist_LB_moduleGroup_LVcurrent[ii]->GetYaxis(); - for (int jj = 0; jj < NUMMODULEGROUP; jj++) { - yaxis->SetBinLabel(jj + 1, moduleGroup[jj]); - } - - sc = dcsExpert.regHist(m_hist_HVcurrent2Dscatter[ii] = TH2F_LW::create( - Form("HVcurrent_ModuleNumber_S%02d", ii + 1), "HV current vs Module Number; Module Number;" + label_HVcurrent + ";Number of LBs", - nbins_module, min_module, max_module, nbins_HVcurrent, min_HVcurrent, max_HVcurrent)); - xaxis = m_hist_HVcurrent2Dscatter[ii]->GetXaxis(); - for (int jj = 0; jj < NUMMODULEETA; jj++) { - xaxis->SetBinLabel(jj + 1, moduleEta[jj]); - } - - sc = dcsExpert.regHist(m_hist_HVcurrentLB[ii] = TProfile_LW::create(Form("HVcurrent_S%02dvsLB", ii + 1), "HV current vs LB; LB;" + label_HVcurrent, nbins_LB, min_LB, max_LB)); - m_hist_HVcurrentLB[ii]->SetMarkerSize(0.5); - - sc = dcsExpert.regHist(m_hist_LB_moduleGroup_HVcurrent[ii] = TProfile2D_LW::create( - Form("LB_moduleGroup_HVcurrent_S%02dvsLB", ii + 1), "LB_moduleGroup_HVcurrent; LB;moduleGoup;" + label_HVcurrent, - nbins_LB, min_LB, max_LB, nbins_moduleGroup, min_moduleGroup, max_moduleGroup)); - yaxis = m_hist_LB_moduleGroup_HVcurrent[ii]->GetYaxis(); - for (int jj = 0; jj < NUMMODULEGROUP; jj++) { - yaxis->SetBinLabel(jj + 1, moduleGroup[jj]); - } - - sc = dcsExpert.regHist(m_hist_LB_moduleGroup_dT[ii] = TProfile2D_LW::create( - Form("LB_moduleGroup_dT_S%02dvsLB", ii + 1), "LB_moduleGroup_dT; LB;moduleGoup;" + label_dT, - nbins_LB, min_LB, max_LB, nbins_moduleGroup, min_moduleGroup, max_moduleGroup)); - yaxis = m_hist_LB_moduleGroup_dT[ii]->GetYaxis(); - for (int jj = 0; jj < NUMMODULEGROUP; jj++) { - yaxis->SetBinLabel(jj + 1, moduleGroup[jj]); - } - - sc = dcsExpert.regHist(m_hist_LB_moduleGroup_LVPowerConsumption[ii] = TProfile2D_LW::create( - Form("LB_moduleGroup_LVPowerConsumption_S%02dvsLB", ii + 1), "LB_moduleGroup_LVPowerConsumption; LB;moduleGoup;" + label_LVPC, - nbins_LB, min_LB, max_LB, nbins_moduleGroup, min_moduleGroup, max_moduleGroup)); - yaxis = m_hist_LB_moduleGroup_LVPowerConsumption[ii]->GetYaxis(); - for (int jj = 0; jj < NUMMODULEGROUP; jj++) { - yaxis->SetBinLabel(jj + 1, moduleGroup[jj]); - } - - sc = dcsExpert.regHist(m_hist_LB_moduleGroup_HVPowerConsumption[ii] = TProfile2D_LW::create( - Form("LB_moduleGroup_HVPowerConsumption_S%02dvsLB", ii + 1), "LB_moduleGroup_HVPowerConsumption; LB;moduleGoup;" + label_HVPC, - nbins_LB, min_LB, max_LB, nbins_moduleGroup, min_moduleGroup, max_moduleGroup)); - yaxis = m_hist_LB_moduleGroup_HVPowerConsumption[ii]->GetYaxis(); - for (int jj = 0; jj < NUMMODULEGROUP; jj++) { - yaxis->SetBinLabel(jj + 1, moduleGroup[jj]); - } - - sc = dcsExpert.regHist(m_hist_LB_moduleGroup_LVHVPowerConsumption[ii] = TProfile2D_LW::create( - Form("LB_moduleGroup_LVHVPowerConsumption_S%02dvsLB", ii + 1), "LB_moduleGroup_LVHVPowerConsumption; LB;moduleGoup;" + label_LVHVPC, - nbins_LB, min_LB, max_LB, nbins_moduleGroup, min_moduleGroup, max_moduleGroup)); - yaxis = m_hist_LB_moduleGroup_LVHVPowerConsumption[ii]->GetYaxis(); - for (int jj = 0; jj < NUMMODULEGROUP; jj++) { - yaxis->SetBinLabel(jj + 1, moduleGroup[jj]); - } - - sc = dcsExpert.regHist(m_hist_LB_moduleGroup_effFLEXtemp[ii] = TProfile2D_LW::create( - Form("LB_moduleGroup_effFLEXtemp_S%02dvsLB", ii + 1), "LB_moduleGroup_effFLEXtemp; LB;moduleGoup;" + label_effFLEXtemp, - nbins_LB, min_LB, max_LB, nbins_moduleGroup, min_moduleGroup, max_moduleGroup)); - yaxis = m_hist_LB_moduleGroup_effFLEXtemp[ii]->GetYaxis(); - for (int jj = 0; jj < NUMMODULEGROUP; jj++) { - yaxis->SetBinLabel(jj + 1, moduleGroup[jj]); - } - - sc = dcsExpert.regHist(m_hist_LB_moduleGroup_thermalFigureMerit[ii] = TProfile2D_LW::create( - Form("LB_moduleGroup_thermalFigureMerit_S%02dvsLB", ii + 1), "LB_moduleGroup_thermalFigureMerit; LB;moduleGoup;" + label_tfm, - nbins_LB, min_LB, max_LB, nbins_moduleGroup, min_moduleGroup, max_moduleGroup)); - yaxis = m_hist_LB_moduleGroup_thermalFigureMerit[ii]->GetYaxis(); - for (int jj = 0; jj < NUMMODULEGROUP; jj++) { - yaxis->SetBinLabel(jj + 1, moduleGroup[jj]); - } - - sc = dcsExpert.regHist(m_hist_FSMstate2Dscatter[ii] = TH2F_LW::create( - Form("FSMstate_ModuleNumber_S%02d", ii + 1), "FSM State vs Module Number; Module Number;" + label_FSMstate + ";Number of LBs", - nbins_module, min_module, max_module, nbins_FSM, min_FSM, max_FSM)); - xaxis = m_hist_FSMstate2Dscatter[ii]->GetXaxis(); - for (int jj = 0; jj < NUMMODULEETA; jj++) { - xaxis->SetBinLabel(jj + 1, moduleEta[jj]); - } - yaxis = m_hist_FSMstate2Dscatter[ii]->GetYaxis(); - for (int jj = 0; jj < NUMFSM; jj++) { - yaxis->SetBinLabel(jj + 1, FSMSTATE[jj]); - } - - sc = dcsExpert.regHist(m_hist_FSMstateLB[ii] = TH2F_LW::create( - Form("FSMstate_S%02dvsLB", ii + 1), "FSM State vs LB; LB;" + label_FSMstate + ";Number of Modules", - nbins_LB, min_LB, max_LB, nbins_FSM, min_FSM, max_FSM)); - yaxis = m_hist_FSMstateLB[ii]->GetYaxis(); - for (int jj = 0; jj < NUMFSM; jj++) { - yaxis->SetBinLabel(jj + 1, FSMSTATE[jj]); - } - - sc = dcsExpert.regHist(m_hist_LB_moduleGroup_FSMstate[ii] = new TH2F( - Form("LB_moduleGroup_FSMstate_S%02dvsLB", ii + 1), "LB_moduleGroup_FSMstate; LB;moduleGoup;" + label_FSMstate, - nbins_LB, min_LB, max_LB, nbins_moduleGroup, min_moduleGroup, max_moduleGroup)); - m_hist_LB_moduleGroup_FSMstate[ii]->SetMaximum(NUMFSM); - m_hist_LB_moduleGroup_FSMstate[ii]->SetMinimum(0); - m_hist_LB_moduleGroup_FSMstate[ii]->SetContour(NUMFSM); - tyaxis = m_hist_LB_moduleGroup_FSMstate[ii]->GetYaxis(); - for (int jj = 0; jj < NUMMODULEGROUP; jj++) { - tyaxis->SetBinLabel(jj + 1, moduleGroup[jj]); - } - - sc = dcsExpert.regHist(m_hist_FSMstatus2Dscatter[ii] = TH2F_LW::create( - Form("FSMstatus_ModuleNumber_S%02d", ii + 1), "FSM Status vs Module Number; Module Number;" + label_FSMstatus + ";Number of LBs", - nbins_module, min_module, max_module, nbins_FSM, min_FSM, max_FSM)); - xaxis = m_hist_FSMstatus2Dscatter[ii]->GetXaxis(); - for (int jj = 0; jj < NUMMODULEETA; jj++) { - xaxis->SetBinLabel(jj + 1, moduleEta[jj]); - } - yaxis = m_hist_FSMstatus2Dscatter[ii]->GetYaxis(); - for (int jj = 0; jj < NUMFSM; jj++) { - yaxis->SetBinLabel(jj + 1, FSMSTATUS[jj]); - } - - sc = dcsExpert.regHist(m_hist_FSMstatusLB[ii] = TH2F_LW::create( - Form("FSMstatus_S%02dvsLB", ii + 1), "FSM Status vs LB; LB;" + label_FSMstatus + ";Number of Modules", - nbins_LB, min_LB, max_LB, nbins_FSM, min_FSM, max_FSM)); - yaxis = m_hist_FSMstatusLB[ii]->GetYaxis(); - for (int jj = 0; jj < NUMFSM; jj++) { - yaxis->SetBinLabel(jj + 1, FSMSTATUS[jj]); - } - - sc = dcsExpert.regHist(m_hist_LB_moduleGroup_FSMstatus[ii] = new TH2F( - Form("LB_moduleGroup_FSMstatus_S%02dvsLB", ii + 1), "LB_moduleGroup_FSMstatus; LB;moduleGoup;" + label_FSMstatus, - nbins_LB, min_LB, max_LB, nbins_moduleGroup, min_moduleGroup, max_moduleGroup)); - m_hist_LB_moduleGroup_FSMstatus[ii]->SetMaximum(NUMFSM); - m_hist_LB_moduleGroup_FSMstatus[ii]->SetMinimum(0); - m_hist_LB_moduleGroup_FSMstatus[ii]->SetContour(NUMFSM); - tyaxis = m_hist_LB_moduleGroup_FSMstatus[ii]->GetYaxis(); - for (int jj = 0; jj < NUMMODULEGROUP; jj++) { - tyaxis->SetBinLabel(jj + 1, moduleGroup[jj]); - } - } - - sc = dcsExpert.regHist(m_hist_moduleTemperatureEtaPhi = TProfile2D_LW::create( - "moduleTemperature_EtaPhi", "Module Temperature EtaPhi; Module #eta Index;staveID;" + label_moduleTemp, - nbins_module, min_module, max_module, nbins_staveID, min_staveID, max_staveID)); - xaxis = m_hist_moduleTemperatureEtaPhi->GetXaxis(); - for (int jj = 0; jj < NUMMODULEETA; jj++) { - xaxis->SetBinLabel(jj + 1, moduleEta[jj]); - } - - sc = dcsExpert.regHist(m_hist_LB_staveID_moduleTemperature = TProfile2D_LW::create( - "LB_staveID_moduleTemperature", "LB_staveID_moduleTemperature; LB;staveID;" + label_moduleTemp, - nbins_LB, min_LB, max_LB, nbins_staveID, min_staveID, max_staveID)); - - sc = dcsExpert.regHist(m_hist_HVoltageEtaPhi = TProfile2D_LW::create( - "HV_EtaPhi", "HV EtaPhi; Module #eta Index;staveID;" + label_HVoltage, - nbins_module, min_module, max_module, nbins_staveID, min_staveID, max_staveID)); - xaxis = m_hist_HVoltageEtaPhi->GetXaxis(); - for (int jj = 0; jj < NUMMODULEETA; jj++) { - xaxis->SetBinLabel(jj + 1, moduleEta[jj]); - } - - sc = dcsExpert.regHist(m_hist_LB_staveID_HVoltage = TProfile2D_LW::create( - "LB_staveID_HV", "LB_staveID_HV; LB;staveID;" + label_HVoltage, - nbins_LB, min_LB, max_LB, nbins_staveID, min_staveID, max_staveID)); - sc = dcsExpert.regHist(m_hist_Pipes_inlet2Dscatter = TH2F_LW::create( - "Pipes_inlet_temperature_StaveNumber", "Pipes_inlet_temperature vs Stave Number; Stave Number;" + label_inletTemp, - nbins_staveID, min_staveID, max_staveID, nbins_temperature, min_temperature, max_temperature)); - sc = dcsExpert.regHist(m_hist_LB_staveID_coolingPipeInlet = TProfile2D_LW::create( - "LB_staveID_coolingPipeInlet", "LB_staveID_coolingPipeInlet; LB;staveID;" + label_inletTemp, - nbins_LB, min_LB, max_LB, nbins_staveID, min_staveID, max_staveID)); - sc = dcsExpert.regHist(m_hist_Pipes_outlet2Dscatter = TH2F_LW::create( - "Pipes_outlet_temperature_StaveNumber", "Pipes_outlet_temperature vs Stave Number; Stave Number;" + label_outletTemp, - nbins_staveID, min_staveID, max_staveID, nbins_temperature, min_temperature, max_temperature)); - sc = dcsExpert.regHist(m_hist_LB_staveID_coolingPipeOutlet = TProfile2D_LW::create( - "LB_staveID_coolingPipeOutlet", "LB_staveID_coolingPipeOutlet; LB;staveID;" + label_outletTemp, - nbins_LB, min_LB, max_LB, nbins_staveID, min_staveID, max_staveID)); - - sc = dcsExpert.regHist(m_hist_LVoltageEtaPhi = TProfile2D_LW::create( - "LV_EtaPhi", "LV EtaPhi; Module #eta Index;staveID;" + label_LVoltage, - nbins_module, min_module, max_module, nbins_staveID, min_staveID, max_staveID)); - xaxis = m_hist_LVoltageEtaPhi->GetXaxis(); - for (int jj = 0; jj < NUMMODULEETA; jj++) { - xaxis->SetBinLabel(jj + 1, moduleEta[jj]); - } - sc = dcsExpert.regHist(m_hist_LB_staveID_LVoltage = TProfile2D_LW::create( - "LB_staveID_LV", "LB_staveID_LV; LB;staveID;" + label_LVoltage, - nbins_LB, min_LB, max_LB, nbins_staveID, min_staveID, max_staveID)); - - sc = dcsExpert.regHist(m_hist_LVcurrentEtaPhi = TProfile2D_LW::create( - "LVcurrent_EtaPhi", "LV current EtaPhi; Module #eta Index;staveID;" + label_LVcurrent, - nbins_module, min_module, max_module, nbins_staveID, min_staveID, max_staveID)); - xaxis = m_hist_LVcurrentEtaPhi->GetXaxis(); - for (int jj = 0; jj < NUMMODULEETA; jj++) { - xaxis->SetBinLabel(jj + 1, moduleEta[jj]); - } - sc = dcsExpert.regHist(m_hist_LB_staveID_LVcurrent = TProfile2D_LW::create( - "LB_staveID_LVcurrent", "LB_staveID_LVcurrent; LB;staveID;" + label_LVcurrent, - nbins_LB, min_LB, max_LB, nbins_staveID, min_staveID, max_staveID)); - - sc = dcsExpert.regHist(m_hist_HVcurrentEtaPhi = TProfile2D_LW::create( - "HVcurrent_EtaPhi", "HV current EtaPhi; Module #eta Index;staveID;" + label_HVcurrent, - nbins_module, min_module, max_module, nbins_staveID, min_staveID, max_staveID)); - xaxis = m_hist_HVcurrentEtaPhi->GetXaxis(); - for (int jj = 0; jj < NUMMODULEETA; jj++) { - xaxis->SetBinLabel(jj + 1, moduleEta[jj]); - } - - sc = dcsExpert.regHist(m_hist_LB_staveID_HVcurrent = TProfile2D_LW::create( - "LB_staveID_HVcurrent", "LB_staveID_HVcurrent; LB;staveID;" + label_HVcurrent, - nbins_LB, min_LB, max_LB, nbins_staveID, min_staveID, max_staveID)); - sc = dcsExpert.regHist(m_hist_FSMstateEtaPhi = new TH2F( - "FSMstate_EtaPhi", "FSMstate EtaPhi; Module #eta Index;staveID;" + label_FSMstate, - nbins_module, min_module, max_module, nbins_staveID, min_staveID, max_staveID)); - m_hist_FSMstateEtaPhi->SetMaximum(NUMFSM); - m_hist_FSMstateEtaPhi->SetMinimum(0); - m_hist_FSMstateEtaPhi->SetContour(NUMFSM); - txaxis = m_hist_FSMstateEtaPhi->GetXaxis(); - for (int jj = 0; jj < NUMMODULEETA; jj++) { - //xaxis->SetBinLabel(jj+1, moduleEta[jj]); - txaxis->SetBinLabel(jj + 1, moduleEta[jj]); - } - - sc = dcsExpert.regHist(m_hist_LB_staveID_FSMstate = new TH2F( - "LB_staveID_FSMstate", "LB_staveID_FSMstate; LB;staveID;" + label_FSMstate, - nbins_LB, min_LB, max_LB, nbins_staveID, min_staveID, max_staveID)); - m_hist_LB_staveID_FSMstate->SetMaximum(NUMFSM); - m_hist_LB_staveID_FSMstate->SetMinimum(0); - m_hist_LB_staveID_FSMstate->SetContour(NUMFSM); - - sc = dcsExpert.regHist(m_hist_FSMstatusEtaPhi = new TH2F( - "FSMstatus_EtaPhi", "FSMstatus EtaPhi; Module #eta Index;staveID;" + label_FSMstatus, - nbins_module, min_module, max_module, nbins_staveID, min_staveID, max_staveID)); - m_hist_FSMstatusEtaPhi->SetMaximum(NUMFSM); - m_hist_FSMstatusEtaPhi->SetMinimum(0); - m_hist_FSMstatusEtaPhi->SetContour(NUMFSM); - txaxis = m_hist_FSMstatusEtaPhi->GetXaxis(); - for (int jj = 0; jj < NUMMODULEETA; jj++) { - txaxis->SetBinLabel(jj + 1, moduleEta[jj]); - } - - sc = dcsExpert.regHist(m_hist_LB_staveID_FSMstatus = new TH2F( - "LB_staveID_FSMstatus", "LB_staveID_FSMstatus; LB;staveID;" + label_FSMstatus, - nbins_LB, min_LB, max_LB, nbins_staveID, min_staveID, max_staveID)); - m_hist_LB_staveID_FSMstatus->SetMaximum(NUMFSM); - m_hist_LB_staveID_FSMstatus->SetMinimum(0); - m_hist_LB_staveID_FSMstatus->SetContour(NUMFSM); - - sc = dcsExpert.regHist(m_hist_dTEtaPhi = TProfile2D_LW::create( - "dT_EtaPhi", "dT EtaPhi; Module #eta Index;staveID;" + label_dT, - nbins_module, min_module, max_module, nbins_staveID, min_staveID, max_staveID)); - xaxis = m_hist_dTEtaPhi->GetXaxis(); - for (int jj = 0; jj < NUMMODULEETA; jj++) { - xaxis->SetBinLabel(jj + 1, moduleEta[jj]); - } - - sc = dcsExpert.regHist(m_hist_LB_staveID_dT = TProfile2D_LW::create( - "LB_staveID_dT", "LB_staveID_dT; LB;staveID;" + label_dT, - nbins_LB, min_LB, max_LB, nbins_staveID, min_staveID, max_staveID)); - sc = dcsExpert.regHist(m_hist_LVPowerConsumptionEtaPhi = TProfile2D_LW::create( - "LVPowerConsumption_EtaPhi", "LV Power Consumption EtaPhi; Module #eta Index;staveID;" + label_LVPC, - nbins_module, min_module, max_module, nbins_staveID, min_staveID, max_staveID)); - xaxis = m_hist_LVPowerConsumptionEtaPhi->GetXaxis(); - for (int jj = 0; jj < NUMMODULEETA; jj++) { - xaxis->SetBinLabel(jj + 1, moduleEta[jj]); - } - - sc = dcsExpert.regHist(m_hist_LB_staveID_LVPowerConsumption = TProfile2D_LW::create( - "LB_staveID_LVPowerConsumption", "LB_staveID_LVPowerConsumption; LB;staveID;" + label_LVPC, - nbins_LB, min_LB, max_LB, nbins_staveID, min_staveID, max_staveID)); - sc = dcsExpert.regHist(m_hist_HVPowerConsumptionEtaPhi = TProfile2D_LW::create( - "HVPowerConsumption_EtaPhi", "HV Power Consumption EtaPhi; Module #eta Index;staveID;" + label_HVPC, - nbins_module, min_module, max_module, nbins_staveID, min_staveID, max_staveID)); - xaxis = m_hist_HVPowerConsumptionEtaPhi->GetXaxis(); - for (int jj = 0; jj < NUMMODULEETA; jj++) { - xaxis->SetBinLabel(jj + 1, moduleEta[jj]); - } - - sc = dcsExpert.regHist(m_hist_LB_staveID_HVPowerConsumption = TProfile2D_LW::create( - "LB_staveID_HVPowerConsumption", "LB_staveID_HVPowerConsumption; LB;staveID;" + label_HVPC, - nbins_LB, min_LB, max_LB, nbins_staveID, min_staveID, max_staveID)); - sc = dcsExpert.regHist(m_hist_LVHVPowerConsumptionEtaPhi = TProfile2D_LW::create( - "LVHVPowerConsumption_EtaPhi", "LV+HV Power Consumption EtaPhi; Module #eta Index;staveID;" + label_LVHVPC, - nbins_module, min_module, max_module, nbins_staveID, min_staveID, max_staveID)); - xaxis = m_hist_LVHVPowerConsumptionEtaPhi->GetXaxis(); - for (int jj = 0; jj < NUMMODULEETA; jj++) { - xaxis->SetBinLabel(jj + 1, moduleEta[jj]); - } - - sc = dcsExpert.regHist(m_hist_LB_staveID_LVHVPowerConsumption = TProfile2D_LW::create( - "LB_staveID_LVHVPowerConsumption", "LB_staveID_LVHVPowerConsumption; LB;staveID;" + label_LVHVPC, - nbins_LB, min_LB, max_LB, nbins_staveID, min_staveID, max_staveID)); - sc = dcsExpert.regHist(m_hist_effFLEXtempEtaPhi = TProfile2D_LW::create( - "effFLEXtemp_EtaPhi", "Effective FLEX Temperature EtaPhi; Module #eta Index;staveID;" + label_effFLEXtemp, - nbins_module, min_module, max_module, nbins_staveID, min_staveID, max_staveID)); - xaxis = m_hist_effFLEXtempEtaPhi->GetXaxis(); - for (int jj = 0; jj < NUMMODULEETA; jj++) { - xaxis->SetBinLabel(jj + 1, moduleEta[jj]); - } - - sc = dcsExpert.regHist(m_hist_LB_staveID_effFLEXtemp = TProfile2D_LW::create( - "LB_staveID_effFLEXtemp", "LB_staveID_effFLEXtemp; LB;staveID;" + label_effFLEXtemp, - nbins_LB, min_LB, max_LB, nbins_staveID, min_staveID, max_staveID)); - sc = dcsExpert.regHist(m_hist_thermalFigureMeritEtaPhi = TProfile2D_LW::create( - "thermalFigureMerit_EtaPhi", "Thermal Figure of Merit EtaPhi; Module #eta Index;staveID;" + label_tfm, - nbins_module, min_module, max_module, nbins_staveID, min_staveID, max_staveID)); - xaxis = m_hist_thermalFigureMeritEtaPhi->GetXaxis(); - for (int jj = 0; jj < NUMMODULEETA; jj++) { - xaxis->SetBinLabel(jj + 1, moduleEta[jj]); - } - - sc = dcsExpert.regHist(m_hist_LB_staveID_thermalFigureMerit = TProfile2D_LW::create( - "LB_staveID_thermalFigureMerit", "LB_staveID_thermalFigureMerit; LB;staveID;" + label_tfm, - nbins_LB, min_LB, max_LB, nbins_staveID, min_staveID, max_staveID)); - - if (sc.isFailure() && msgLvl(MSG::WARNING)) { - msg(MSG::WARNING) << "histograms not booked" << endmsg; - } - return StatusCode::SUCCESS; -} - -StatusCode PixelMainMon::fillPixelDCSMon(void) { - // see only the first event of LB - if (m_lumiBlockNum != m_currentLumiBlockNumber) { - ATH_MSG_DEBUG("Current LB Number has been changed from " << m_currentLumiBlockNumber << " to " << m_lumiBlockNum); - m_currentLumiBlockNumber = m_lumiBlockNum; - } else { - return StatusCode::SUCCESS; - } - - msg(MSG::DEBUG) << "[FillPixelDCSMon]" << endmsg; - - // loop over DCS directories - const CondAttrListCollection* atrlistcol = nullptr; - const CondAttrListCollection* atrlistcol_temperature; - const CondAttrListCollection* atrlistcol_hv; - const CondAttrListCollection* atrlistcol_hvcurrent; - const CondAttrListCollection* atrlistcol_pipes; - const CondAttrListCollection* atrlistcol_lv; - const CondAttrListCollection* atrlistcol_fsmstate; - const CondAttrListCollection* atrlistcol_fsmstatus; - - // m_atrcollist is initialised in PixelMainMon.cxx, containing DCS folder names (e.g. /PIXEL/DCS/TEMPERATURE) - for (std::vector<std::string>::const_iterator itr = m_atrcollist.begin(); itr != m_atrcollist.end(); ++itr) { - ATH_MSG_DEBUG("execute(): Reading the data from " << *itr); - StatusCode sc = StatusCode::FAILURE; - if (*itr == "/PIXEL/DCS/TEMPERATURE") { - sc = detStore()->retrieve(atrlistcol_temperature, *itr); - atrlistcol = atrlistcol_temperature; - } else if (*itr == "/PIXEL/DCS/HV") { - sc = detStore()->retrieve(atrlistcol_hv, *itr); - atrlistcol = atrlistcol_hv; - } else if (*itr == "/PIXEL/DCS/HVCURRENT") { - sc = detStore()->retrieve(atrlistcol_hvcurrent, *itr); - atrlistcol = atrlistcol_hvcurrent; - } else if (*itr == "/PIXEL/DCS/PIPES") { - sc = detStore()->retrieve(atrlistcol_pipes, *itr); - atrlistcol = atrlistcol_pipes; - } else if (*itr == "/PIXEL/DCS/LV") { - sc = detStore()->retrieve(atrlistcol_lv, *itr); - atrlistcol = atrlistcol_lv; - } else if (*itr == "/PIXEL/DCS/FSMSTATE") { - sc = detStore()->retrieve(atrlistcol_fsmstate, *itr); - atrlistcol = atrlistcol_fsmstate; - } else if (*itr == "/PIXEL/DCS/FSMSTATUS") { - sc = detStore()->retrieve(atrlistcol_fsmstatus, *itr); - atrlistcol = atrlistcol_fsmstatus; - } - if (sc == StatusCode::SUCCESS && atrlistcol != nullptr) { - for (CondAttrListCollection::const_iterator citr = atrlistcol->begin(); citr != atrlistcol->end(); ++citr) { - // the following code dumps the attribute list into a string for printing - // to access individual elements by name, use e.g. - // float var1=(((*citr).second)["T04"]).data<float>(); - // to get the value of a float column called T04 into var1 - float tmp_value = 0.; - int chanNum = 0; - try { - auto& value = (*citr).second; - chanNum = (*citr).first; - if (*itr == "/PIXEL/DCS/TEMPERATURE") { - if (m_moduleTemperature->m_values->find(chanNum) == m_moduleTemperature->m_values->end()) { - m_moduleTemperature->m_values->insert(std::make_pair(chanNum, new std::map<int, float>)); - } - auto itr_moduleTemp = m_moduleTemperature->m_values->find(chanNum); - tmp_value = value["temperature"].data<float>(); - itr_moduleTemp->second->insert(std::make_pair(m_currentLumiBlockNumber, tmp_value)); - } else if (*itr == "/PIXEL/DCS/PIPES") { - if (m_coolingPipeTemperatureInlet->m_values->find(chanNum) == m_coolingPipeTemperatureInlet->m_values->end()) { - m_coolingPipeTemperatureInlet->m_values->insert(std::make_pair(chanNum, new std::map<int, float>)); - } - tmp_value = value["temp_inlet"].data<float>(); - auto itr_coolingPipeTempInlet = m_coolingPipeTemperatureInlet->m_values->find(chanNum); - itr_coolingPipeTempInlet->second->insert(std::make_pair(m_currentLumiBlockNumber, tmp_value)); - if (m_coolingPipeTemperatureOutlet->m_values->find(chanNum) == m_coolingPipeTemperatureOutlet->m_values->end()) { - m_coolingPipeTemperatureOutlet->m_values->insert(std::make_pair(chanNum, new std::map<int, float>)); - } - tmp_value = value["temp_outlet"].data<float>(); - auto itr_coolingPipeTempOutlet = m_coolingPipeTemperatureOutlet->m_values->find(chanNum); - itr_coolingPipeTempOutlet->second->insert(std::make_pair(m_currentLumiBlockNumber, tmp_value)); - } else if (*itr == "/PIXEL/DCS/HV") { - if (m_HV->m_values->find(chanNum) == m_HV->m_values->end()) { - m_HV->m_values->insert(std::make_pair(chanNum, new std::map<int, float>)); - } - tmp_value = value["HV"].data<float>(); - auto itr_HV = m_HV->m_values->find(chanNum); - itr_HV->second->insert(std::make_pair(m_currentLumiBlockNumber, tmp_value)); - } else if (*itr == "/PIXEL/DCS/HVCURRENT") { - if (m_HV_current->m_values->find(chanNum) == m_HV_current->m_values->end()) { - m_HV_current->m_values->insert(std::make_pair(chanNum, new std::map<int, float>)); - } - tmp_value = value["hv_current"].data<float>(); - auto itr_HV_current = m_HV_current->m_values->find(chanNum); - itr_HV_current->second->insert(std::make_pair(m_currentLumiBlockNumber, tmp_value)); - } else if (*itr == "/PIXEL/DCS/LV") { - if (m_LV_voltage->m_values->find(chanNum) == m_LV_voltage->m_values->end()) { - m_LV_voltage->m_values->insert(std::make_pair(chanNum, new std::map<int, float>)); - } - tmp_value = value["lv_voltage"].data<float>(); - auto itr_LV_voltage = m_LV_voltage->m_values->find(chanNum); - itr_LV_voltage->second->insert(std::make_pair(m_currentLumiBlockNumber, tmp_value)); - if (m_LV_current->m_values->find(chanNum) == m_LV_current->m_values->end()) { - m_LV_current->m_values->insert(std::make_pair(chanNum, new std::map<int, float>)); - } - tmp_value = value["lv_current"].data<float>(); - auto itr_LV_current = m_LV_current->m_values->find(chanNum); - itr_LV_current->second->insert(std::make_pair(m_currentLumiBlockNumber, tmp_value)); - } else if (*itr == "/PIXEL/DCS/FSMSTATE") { - if (m_FSM_state->m_values->find(chanNum) == m_FSM_state->m_values->end()) { - m_FSM_state->m_values->insert(std::make_pair(chanNum, new std::map<int, float>)); - } - try { - tmp_value = m_fsmState2enum.at(value["FSM_state"].data<std::string>()); - } catch (...) { - tmp_value = 10; // Unknown key - ATH_MSG_WARNING("FSM State: " << value["FSM_state"].data<std::string>()); - } - auto itr_FSM_state = m_FSM_state->m_values->find(chanNum); - itr_FSM_state->second->insert(std::make_pair(m_currentLumiBlockNumber, tmp_value)); - } else if (*itr == "/PIXEL/DCS/FSMSTATUS") { - if (m_FSM_status->m_values->find(chanNum) == m_FSM_status->m_values->end()) { - m_FSM_status->m_values->insert(std::make_pair(chanNum, new std::map<int, float>)); - } - try { - tmp_value = m_fsmStatus2enum.at(value["FSM_status"].data<std::string>()); - } catch (...) { - tmp_value = 10; // Unknown key - ATH_MSG_WARNING("FSM Status: " << value["FSM_status"].data<std::string>()); - } - auto itr_FSM_status = m_FSM_status->m_values->find(chanNum); - itr_FSM_status->second->insert(std::make_pair(m_currentLumiBlockNumber, tmp_value)); - } - } catch (...) { - ATH_MSG_WARNING("Channel " << chanNum << " does not have any values!"); - continue; - } - } // end for loop over - } else { - ATH_MSG_WARNING("Could not retrieve CondAttrListCollection " << *itr); - } - } - - return StatusCode::SUCCESS; -} - -StatusCode PixelMainMon::procPixelDCSMon(void) { - msg(MSG::DEBUG) << "[ProcPixelDCSMon]" << endmsg; - - //--------------------------------------- - // fill dcs data in moduleDcsDataHolder - //-------------------------------------- - int LB = 0; - float value = 0; - for (const auto& nameMap : *(m_moduleDCSDataHolder->m_moduleMap)) { - if (nameMap.first == "") { - ATH_MSG_WARNING("ProcPixelDCSMon(): Channel " << nameMap.second << " does not have module name"); - continue; - } - std::string moduleName = nameMap.first; - int moduleNum = nameMap.second; - if (moduleName.find("LI_") == std::string::npos || - moduleName.find("LI_S15") != std::string::npos) continue; // if not IBL - int staveNum = PixelMainMon::getIBLstaveIdFromModuleName(moduleName); - int moduleGroup = PixelMainMon::getIBLmoduleGroupFromModuleName(moduleName); - if (m_moduleDCSDataHolder->m_tempModule->find(moduleNum) == m_moduleDCSDataHolder->m_tempModule->end()) { - m_moduleDCSDataHolder->m_tempModule->insert(std::make_pair(moduleNum, new std::map<int, float>)); - } - if (m_moduleDCSDataHolder->m_hv_voltage->find(moduleNum) == m_moduleDCSDataHolder->m_hv_voltage->end()) { - m_moduleDCSDataHolder->m_hv_voltage->insert(std::make_pair(moduleNum, new std::map<int, float>)); - } - if (m_moduleDCSDataHolder->m_fsm_state->find(moduleNum) == m_moduleDCSDataHolder->m_fsm_state->end()) { - m_moduleDCSDataHolder->m_fsm_state->insert(std::make_pair(moduleNum, new std::map<int, float>)); - } - if (m_moduleDCSDataHolder->m_fsm_status->find(moduleNum) == m_moduleDCSDataHolder->m_fsm_status->end()) { - m_moduleDCSDataHolder->m_fsm_status->insert(std::make_pair(moduleNum, new std::map<int, float>)); - } - - if (m_moduleTemperature->m_values->find(moduleNum) != m_moduleTemperature->m_values->end()) { - for (const auto& valueMap : *(m_moduleTemperature->m_values->at(moduleNum))) { - try { - LB = valueMap.first; - value = valueMap.second; - auto itr_tempModule = m_moduleDCSDataHolder->m_tempModule->find(moduleNum); - itr_tempModule->second->insert(std::make_pair(LB, value)); - } catch (const std::out_of_range& oor) { - ATH_MSG_DEBUG("Out of Range error: " << oor.what() << " , m_moduleTemperature: chanNum = " << moduleNum); - continue; - } - } - } - - if (m_HV->m_values->find(moduleNum) != m_HV->m_values->end()) { - for (const auto& valueMap : *(m_HV->m_values->at(moduleNum))) { - try { - LB = valueMap.first; - value = valueMap.second; - auto itr_hv_voltage = m_moduleDCSDataHolder->m_hv_voltage->find(moduleNum); - itr_hv_voltage->second->insert(std::make_pair(LB, value)); - } catch (const std::out_of_range& oor) { - ATH_MSG_DEBUG("Out of Range error: " << oor.what() << " , m_HV: chanNum = " << moduleNum); - continue; - } - } - } - - if (m_FSM_state->m_values->find(moduleNum) != m_FSM_state->m_values->end()) { - for (const auto& valueMap : *(m_FSM_state->m_values->at(moduleNum))) { - try { - LB = valueMap.first; - value = valueMap.second; - auto itr_fsm_state = m_moduleDCSDataHolder->m_fsm_state->find(moduleNum); - itr_fsm_state->second->insert(std::make_pair(LB, value)); - } catch (const std::out_of_range& oor) { - ATH_MSG_DEBUG("Out of Range error: " << oor.what() << " , m_FSM_state: chanNum = " << moduleNum); - continue; - } - } - } - - if (m_FSM_status->m_values->find(moduleNum) != m_FSM_status->m_values->end()) { - for (const auto& valueMap : *(m_FSM_status->m_values->at(moduleNum))) { - try { - LB = valueMap.first; - value = valueMap.second; - auto itr_fsm_status = m_moduleDCSDataHolder->m_fsm_status->find(moduleNum); - itr_fsm_status->second->insert(std::make_pair(LB, value)); - } catch (const std::out_of_range& oor) { - ATH_MSG_DEBUG("Out of Range error: " << oor.what() << " , m_FSM_status: chanNum = " << moduleNum); - continue; - } - } - } - - if (m_moduleDCSDataHolder->m_tempInlet->find(moduleNum) == m_moduleDCSDataHolder->m_tempInlet->end()) { - m_moduleDCSDataHolder->m_tempInlet->insert(std::make_pair(moduleNum, new std::map<int, float>)); - } - if (m_moduleDCSDataHolder->m_tempOutlet->find(moduleNum) == m_moduleDCSDataHolder->m_tempOutlet->end()) { - m_moduleDCSDataHolder->m_tempOutlet->insert(std::make_pair(moduleNum, new std::map<int, float>)); - } - for (const auto& pipeNameMap : *(m_coolingPipeTemperatureInlet->m_maps)) { - std::string pipeName = pipeNameMap.first; - int chanNum = pipeNameMap.second; - if (staveNum != PixelMainMon::getIBLstaveIdFromModuleName(pipeName)) continue; - if (m_coolingPipeTemperatureInlet->m_values->find(chanNum) != m_coolingPipeTemperatureInlet->m_values->end()) { - for (const auto& valueMap : *(m_coolingPipeTemperatureInlet->m_values->at(chanNum))) { - try { - LB = valueMap.first; - value = valueMap.second; - auto itr_tempInlet = m_moduleDCSDataHolder->m_tempInlet->find(moduleNum); - itr_tempInlet->second->insert(std::make_pair(LB, value)); - } catch (const std::out_of_range& oor) { - ATH_MSG_DEBUG("Out of Range error: " << oor.what() << " , m_coolingPipeTemperatureInlet: chanNum = " << chanNum); - continue; - } - } - } - if (m_coolingPipeTemperatureOutlet->m_values->find(chanNum) != m_coolingPipeTemperatureOutlet->m_values->end()) { - for (const auto& valueMap : *(m_coolingPipeTemperatureOutlet->m_values->at(chanNum))) { - try { - LB = valueMap.first; - value = valueMap.second; - auto itr_tempOutlet = m_moduleDCSDataHolder->m_tempOutlet->find(moduleNum); - itr_tempOutlet->second->insert(std::make_pair(LB, value)); - } catch (const std::out_of_range& oor) { - ATH_MSG_DEBUG("Out of Range error: " << oor.what() << " , m_coolingPipeTemperatureOutlet: chanNum = " << chanNum); - continue; - } - } - } - } - - if (m_moduleDCSDataHolder->m_lv_voltage->find(moduleNum) == m_moduleDCSDataHolder->m_lv_voltage->end()) { - m_moduleDCSDataHolder->m_lv_voltage->insert(std::make_pair(moduleNum, new std::map<int, float>)); - } - if (m_moduleDCSDataHolder->m_lv_current->find(moduleNum) == m_moduleDCSDataHolder->m_lv_current->end()) { - m_moduleDCSDataHolder->m_lv_current->insert(std::make_pair(moduleNum, new std::map<int, float>)); - } - if (m_moduleDCSDataHolder->m_hv_current->find(moduleNum) == m_moduleDCSDataHolder->m_hv_current->end()) { - m_moduleDCSDataHolder->m_hv_current->insert(std::make_pair(moduleNum, new std::map<int, float>)); - } - for (const auto& lvNameMap : *(m_LV_voltage->m_maps)) { - std::string lvName = lvNameMap.first; - int chanNum = lvNameMap.second; - if (staveNum != PixelMainMon::getIBLstaveIdFromModuleName(lvName) || moduleGroup != PixelMainMon::getIBLmoduleGroupFromModuleName(lvName)) continue; - if (m_LV_voltage->m_values->find(chanNum) != m_LV_voltage->m_values->end()) { - for (const auto& valueMap : *(m_LV_voltage->m_values->at(chanNum))) { - try { - LB = valueMap.first; - value = valueMap.second; - auto itr_lv_voltage = m_moduleDCSDataHolder->m_lv_voltage->find(moduleNum); - itr_lv_voltage->second->insert(std::make_pair(LB, value)); - } catch (const std::out_of_range& oor) { - ATH_MSG_DEBUG("Out of Range error: " << oor.what() << " , m_LV_voltage: chanNum = " << chanNum); - continue; - } - } - } - - if (m_LV_current->m_values->find(chanNum) != m_LV_current->m_values->end()) { - for (const auto& valueMap : *(m_LV_current->m_values->at(chanNum))) { - try { - LB = valueMap.first; - value = valueMap.second; - auto itr_lv_current = m_moduleDCSDataHolder->m_lv_current->find(moduleNum); - itr_lv_current->second->insert(std::make_pair(LB, value)); - } catch (const std::out_of_range& oor) { - ATH_MSG_DEBUG("Out of Range error: " << oor.what() << " , m_LV_current: chanNum = " << chanNum); - continue; - } - } - } - - if (m_HV_current->m_values->find(chanNum) != m_HV_current->m_values->end()) { - for (const auto& valueMap : *(m_HV_current->m_values->at(chanNum))) { - try { - LB = valueMap.first; - value = valueMap.second; - auto itr_hv_current = m_moduleDCSDataHolder->m_hv_current->find(moduleNum); - itr_hv_current->second->insert(std::make_pair(LB, value)); - } catch (const std::out_of_range& oor) { - ATH_MSG_DEBUG("Out of Range error: " << oor.what() << " , m_HV_current: chanNum = " << chanNum); - continue; - } - } - } - } // end lv/hv - } // end fill moduleDcsDataHolder - - //---------------------------- - // loop over modules - //--------------------------- - for (const auto& nameMap : *(m_moduleDCSDataHolder->m_moduleMap)) { - // nameMap.first is module name. nameMap.second is channel number. - if (nameMap.first == "") { - ATH_MSG_WARNING("ProcPixelDCSMon(): Channel " << nameMap.second << " does not have module name"); - continue; - } - std::string moduleName = nameMap.first; - int moduleNum = nameMap.second; - if (moduleName.find("LI_") == std::string::npos || moduleName.find("LI_S15") != std::string::npos) { - continue; // if not IBL - } - int staveNum = PixelMainMon::getIBLstaveIdFromModuleName(moduleName); - int module_eta = PixelMainMon::getIBLetaIndexFromModuleName(moduleName); - int moduleGroup = PixelMainMon::getIBLmoduleGroupFromModuleName(moduleName); - try { - for (const auto& valueMap : *(m_moduleDCSDataHolder->m_tempModule->at(moduleNum))) { - int LB = valueMap.first; - float tempModule = valueMap.second; - float tempInlet = m_moduleDCSDataHolder->m_tempInlet->at(moduleNum)->at(LB); - float tempOutlet = m_moduleDCSDataHolder->m_tempOutlet->at(moduleNum)->at(LB); - float hv_voltage = TMath::Abs(m_moduleDCSDataHolder->m_hv_voltage->at(moduleNum)->at(LB)); - float lv_voltage = m_moduleDCSDataHolder->m_lv_voltage->at(moduleNum)->at(LB); - float hv_current = TMath::Abs(m_moduleDCSDataHolder->m_hv_current->at(moduleNum)->at(LB)); - float lv_current = m_moduleDCSDataHolder->m_lv_current->at(moduleNum)->at(LB); - float fsm_state = m_moduleDCSDataHolder->m_fsm_state->at(moduleNum)->at(LB); - if (fsm_state > m_fsmState2enum.size()) { - fsm_state = m_fsmState2enum["READY"]; - } - float fsm_status = m_moduleDCSDataHolder->m_fsm_status->at(moduleNum)->at(LB); - if (fsm_status > m_fsmState2enum.size()) { - fsm_status = m_fsmStatus2enum["OK"]; - } - m_hist_moduleTemperatureEtaPhi->Fill(module_eta, staveNum, tempModule); - m_hist_moduleTemperature2Dscatter[staveNum - 1]->Fill(module_eta, tempModule); - m_hist_moduleTemperatureLB[staveNum - 1]->Fill(LB, tempModule); - m_hist_LB_staveID_moduleTemperature->Fill(LB, staveNum, tempModule); - m_hist_LB_moduleGroup_moduleTemperature[staveNum - 1]->Fill(LB, moduleGroup, tempModule); - float dT = tempModule - tempOutlet; - m_hist_dTEtaPhi->Fill(module_eta, staveNum, dT); - m_hist_LB_staveID_dT->Fill(LB, staveNum, dT); - m_hist_LB_moduleGroup_dT[staveNum - 1]->Fill(LB, moduleGroup, dT); - - m_hist_Pipes_inlet2Dscatter->Fill(staveNum, tempInlet); - m_hist_Pipes_inletLB[staveNum - 1]->Fill(LB, tempInlet); - m_hist_LB_staveID_coolingPipeInlet->Fill(LB, staveNum, tempInlet); - - m_hist_Pipes_outlet2Dscatter->Fill(staveNum, tempOutlet); - m_hist_Pipes_outletLB[staveNum - 1]->Fill(LB, tempOutlet); - m_hist_LB_staveID_coolingPipeOutlet->Fill(LB, staveNum, tempOutlet); - - m_hist_HVoltageEtaPhi->Fill(module_eta, staveNum, hv_voltage); - m_hist_HVoltage2Dscatter[staveNum - 1]->Fill(module_eta, hv_voltage); - m_hist_HVoltageLB[staveNum - 1]->Fill(LB, hv_voltage); - m_hist_LB_staveID_HVoltage->Fill(LB, staveNum, hv_voltage); - m_hist_LB_moduleGroup_HVoltage[staveNum - 1]->Fill(LB, moduleGroup, hv_voltage); - - m_hist_HVcurrentEtaPhi->Fill(module_eta, staveNum, hv_current); - m_hist_HVcurrent2Dscatter[staveNum - 1]->Fill(module_eta, hv_current); - m_hist_HVcurrentLB[staveNum - 1]->Fill(LB, hv_current); - m_hist_LB_moduleGroup_HVcurrent[staveNum - 1]->Fill(LB, moduleGroup, hv_current); - m_hist_LB_staveID_HVcurrent->Fill(LB, staveNum, hv_current); - - m_hist_LVoltageEtaPhi->Fill(module_eta, staveNum, lv_voltage); - m_hist_LVoltage2Dscatter[staveNum - 1]->Fill(module_eta, lv_voltage); - m_hist_LVoltageLB[staveNum - 1]->Fill(LB, lv_voltage); - m_hist_LB_staveID_LVoltage->Fill(LB, staveNum, lv_voltage); - m_hist_LB_moduleGroup_LVoltage[staveNum - 1]->Fill(LB, moduleGroup, lv_voltage); - - m_hist_LVcurrentEtaPhi->Fill(module_eta, staveNum, lv_current); - m_hist_LVcurrent2Dscatter[staveNum - 1]->Fill(module_eta, lv_current); - m_hist_LVcurrentLB[staveNum - 1]->Fill(LB, lv_current); - m_hist_LB_moduleGroup_LVcurrent[staveNum - 1]->Fill(LB, moduleGroup, lv_current); - m_hist_LB_staveID_LVcurrent->Fill(LB, staveNum, lv_current); - - if (fsm_state > m_hist_FSMstateEtaPhi->GetBinContent(module_eta + 11, staveNum)) { // -10 <= module_eta <= 9, - m_hist_FSMstateEtaPhi->SetBinContent(module_eta + 11, staveNum, fsm_state); // 1 <= staveNum <= 14 - } - m_hist_FSMstate2Dscatter[staveNum - 1]->Fill(module_eta, fsm_state); - m_hist_FSMstateLB[staveNum - 1]->Fill(LB, fsm_state); - if (fsm_state > m_hist_LB_staveID_FSMstate->GetBinContent(LB + 1, staveNum)) { - m_hist_LB_staveID_FSMstate->SetBinContent(LB + 1, staveNum, fsm_state); - } - if (fsm_state > m_hist_LB_moduleGroup_FSMstate[staveNum - 1]->GetBinContent(LB + 1, moduleGroup + 1)) { - m_hist_LB_moduleGroup_FSMstate[staveNum - 1]->SetBinContent(LB + 1, moduleGroup + 1, fsm_state); - } - - if (fsm_status > m_hist_FSMstatusEtaPhi->GetBinContent(module_eta + 11, staveNum)) { // -10 <= module_eta <= 9, - m_hist_FSMstatusEtaPhi->SetBinContent(module_eta + 11, staveNum, fsm_status); // 1 <= staveNum <= 14 - } - m_hist_FSMstatus2Dscatter[staveNum - 1]->Fill(module_eta, fsm_status); - m_hist_FSMstatusLB[staveNum - 1]->Fill(LB, fsm_status); - if (fsm_status > m_hist_LB_staveID_FSMstatus->GetBinContent(LB + 1, staveNum)) { - m_hist_LB_staveID_FSMstatus->SetBinContent(LB + 1, staveNum, fsm_status); - } - if (fsm_status > m_hist_LB_moduleGroup_FSMstatus[staveNum - 1]->GetBinContent(LB + 1, moduleGroup + 1)) { - m_hist_LB_moduleGroup_FSMstatus[staveNum - 1]->SetBinContent(LB + 1, moduleGroup + 1, fsm_status); - } - m_hist_LB_moduleGroup_FSMstatus[staveNum - 1]->Fill(LB, moduleGroup, fsm_status); - - float hvpc = TMath::Abs(hv_voltage * hv_current); - m_hist_HVPowerConsumptionEtaPhi->Fill(module_eta, staveNum, hvpc); - m_hist_LB_staveID_HVPowerConsumption->Fill(LB, staveNum, hvpc); - m_hist_LB_moduleGroup_HVPowerConsumption[staveNum - 1]->Fill(LB, moduleGroup, hvpc); - - float lvpc = TMath::Abs(lv_voltage * lv_current); - m_hist_LVPowerConsumptionEtaPhi->Fill(module_eta, staveNum, lvpc); - m_hist_LB_staveID_LVPowerConsumption->Fill(LB, staveNum, lvpc); - m_hist_LB_moduleGroup_LVPowerConsumption[staveNum - 1]->Fill(LB, moduleGroup, lvpc); - - m_hist_LVHVPowerConsumptionEtaPhi->Fill(module_eta, staveNum, lvpc + hvpc * 0.001); - m_hist_LB_staveID_LVHVPowerConsumption->Fill(LB, staveNum, lvpc + hvpc * 0.001); - m_hist_LB_moduleGroup_LVHVPowerConsumption[staveNum - 1]->Fill(LB, moduleGroup, lvpc + hvpc * 0.001); - - float tempFlex = dT * 0.6 + tempOutlet; // 0.6 is measured value - m_hist_effFLEXtempEtaPhi->Fill(module_eta, staveNum, tempFlex); - m_hist_LB_staveID_effFLEXtemp->Fill(LB, staveNum, tempFlex); - m_hist_LB_moduleGroup_effFLEXtemp[staveNum - 1]->Fill(LB, moduleGroup, tempFlex); - - if (lvpc + hvpc * 0.001 != 0) { - float tfm = dT / (lvpc + hvpc * 0.001); - m_hist_thermalFigureMeritEtaPhi->Fill(module_eta, staveNum, tfm); - m_hist_LB_staveID_thermalFigureMerit->Fill(LB, staveNum, tfm); - m_hist_LB_moduleGroup_thermalFigureMerit[staveNum - 1]->Fill(LB, moduleGroup, tfm); - } - } - } catch (const std::out_of_range& oor) { - ATH_MSG_DEBUG("moduleNum " << moduleNum << ", Out of Range error: " << oor.what()); - continue; - } - } // end loop over modules - -#if 0 - for (const auto& nameMap : *(m_moduleTemperature->m_maps)) { - // nameMap.first is module name. nameMap.second is channel number. - if (nameMap.first == "") { - ATH_MSG_WARNING("ProcPixelDCSMon(): Channel " << nameMap.second << " does not have module name"); - continue; - } - std::string moduleName = nameMap.first; - int chanNum = nameMap.second; - if (moduleName.find("LI_") == std::string::npos || moduleName.find("LI_S15") != std::string::npos) { - continue; // if not IBL - } - int staveNum = PixelMainMon::getIBLstaveIdFromModuleName(moduleName); - int module_eta = PixelMainMon::getIBLetaIndexFromModuleName(moduleName); - int moduleGroup = PixelMainMon::getIBLmoduleGroupFromModuleName(moduleName); - try { - for (const auto& valueMap : *(m_moduleTemperature->m_values->at(chanNum))) { - // valueMap.first is LB. valueMap.second is value. - LB = valueMap.first; - value = valueMap.second; - m_hist_moduleTemperatureEtaPhi->Fill(module_eta, staveNum, value); - m_hist_moduleTemperature2Dscatter[staveNum - 1]->Fill(module_eta, value); - m_hist_moduleTemperatureLB[staveNum - 1]->Fill(LB, value); - m_hist_LB_staveID_moduleTemperature->Fill(LB, staveNum, value); - m_hist_LB_moduleGroup_moduleTemperature[staveNum - 1]->Fill(LB, moduleGroup, value); - try { - float dT = value - m_coolingPipeTemperatureOutlet->m_values->at(staveNum)->at(LB); - m_hist_dTEtaPhi->Fill(module_eta, staveNum, dT); - m_hist_LB_staveID_dT->Fill(LB, staveNum, dT); - m_hist_LB_moduleGroup_dT[staveNum - 1]->Fill(LB, moduleGroup, dT); - } catch (const std::out_of_range& oor) { - std::cerr << "Out of Range error: " << oor.what() << " , m_coolingPipeTemperatureOutlet: chanNum = " << chanNum << '\n'; - continue; - } - } - } catch (const std::out_of_range& oor) { - std::cerr << "Out of Range error: " << oor.what() << " , m_moduleTemperature: chanNum = " << chanNum << '\n'; - continue; - } - try { - for (const auto& valueMap : *(m_HV->m_values->at(chanNum))) { - LB = valueMap.first; - value = valueMap.second; - m_hist_HVoltageEtaPhi->Fill(module_eta, staveNum, value); - m_hist_HVoltage2Dscatter[staveNum - 1]->Fill(module_eta, value); - m_hist_HVoltageLB[staveNum - 1]->Fill(LB, value); - m_hist_LB_staveID_HVoltage->Fill(LB, staveNum, value); - m_hist_LB_moduleGroup_HVoltage[staveNum - 1]->Fill(LB, moduleGroup, value); - } - } catch (const std::out_of_range& oor) { - std::cerr << "Out of Range error: " << oor.what() << " , m_HV: chanNum = " << chanNum << '\n'; - continue; - } - } - - //-------------------------------- - // loop over cooling pipes - //-------------------------------- - for (const auto& nameMap : *(m_coolingPipeTemperatureInlet->m_maps)) { - ATH_MSG_DEBUG("ProcPixelDCSMon(): Pipe Name: " << nameMap.first << ", Channel Num: " << nameMap.second); - if (nameMap.first == "") { - ATH_MSG_WARNING("ProcPixelDCSMon(): Channel " << nameMap.second << " does not have pipe name"); - continue; - } - std::string moduleName = nameMap.first; - int chanNum = nameMap.second; - int staveNum = PixelMainMon::getIBLstaveIdFromModuleName(moduleName); - try { - std::map<int, float>* test = m_coolingPipeTemperatureInlet->m_values->at(chanNum); - test = nullptr; // just to avoid warning message "unused variable..." - } catch (const std::out_of_range& oor) { - std::cerr << "Out of Range error: " << oor.what() << " , m_coolingPipeTemperatureInlet: chanNum = " << chanNum << '\n'; - continue; - } - - for (const auto& valueMap : *(m_coolingPipeTemperatureInlet->m_values->at(chanNum))) { - LB = valueMap.first; - value = valueMap.second; - m_hist_Pipes_inlet2Dscatter->Fill(staveNum, value); - m_hist_Pipes_inletLB[staveNum - 1]->Fill(LB, value); - m_hist_LB_staveID_coolingPipeInlet->Fill(LB, staveNum, value); - } - try { - std::map<int, float>* test = m_coolingPipeTemperatureOutlet->m_values->at(chanNum); - test = nullptr; // just to avoid warning message "unused variable..." - } catch (const std::out_of_range& oor) { - std::cerr << "Out of Range error: " << oor.what() << " , m_coolingPipeTemperatureOutlet: chanNum = " << chanNum << '\n'; - continue; - } - - for (const auto& valueMap : *(m_coolingPipeTemperatureOutlet->m_values->at(chanNum))) { - LB = valueMap.first; - value = valueMap.second; - m_hist_Pipes_outlet2Dscatter->Fill(staveNum, value); - m_hist_Pipes_outletLB[staveNum - 1]->Fill(LB, value); - m_hist_LB_staveID_coolingPipeOutlet->Fill(LB, staveNum, value); - } - } - - //-------------------- - // loop over LV - //-------------------- - for (const auto& nameMap : *(m_LV_voltage->m_maps)) { - ATH_MSG_DEBUG("ProcPixelDCSMon(): LV Name: " << nameMap.first << ", Channel Num: " << nameMap.second); - if (nameMap.first == "") { - ATH_MSG_WARNING("ProcPixelDCSMon(): Channel " << nameMap.second << " does not have LV channel name"); - continue; - } - std::string moduleName = nameMap.first; - int chanNum = nameMap.second; - int staveNum = PixelMainMon::getIBLstaveIdFromModuleName(moduleName); - int moduleGroup = PixelMainMon::getIBLmoduleGroupFromModuleName(moduleName); - try { - std::map<int, float>* test = m_LV_voltage->m_values->at(chanNum); - test = nullptr; // just to avoid warning message "unused variable..." - } catch (const std::out_of_range& oor) { - std::cerr << "Out of Range error: " << oor.what() << " , m_LV_voltage: chanNum = " << chanNum << '\n'; - continue; - } - - for (const auto& valueMap : *(m_LV_voltage->m_values->at(chanNum))) { - LB = valueMap.first; - value = valueMap.second; - m_hist_LB_moduleGroup_LVoltage[staveNum - 1]->Fill(LB, moduleGroup, value); - m_hist_LB_staveID_LVoltage->Fill(LB, staveNum, value); - try { - float lvpc = value * m_LV_current->m_values->at(chanNum)->at(LB); - m_hist_LB_staveID_LVPowerConsumption->Fill(LB, staveNum, lvpc); - m_hist_LB_moduleGroup_LVPowerConsumption[staveNum - 1]->Fill(LB, moduleGroup, lvpc); - } catch (const std::out_of_range& oor) { - std::cerr << "Out of Range error: " << oor.what() << " , m_coolingPipeTemperatureOutlet: chanNum = " << chanNum << '\n'; - continue; - } - } - try { - std::map<int, float>* test = m_LV_current->m_values->at(chanNum); - test = nullptr; // just to avoid warning message "unused variable..." - } catch (const std::out_of_range& oor) { - std::cerr << "Out of Range error: " << oor.what() << " , m_LV_current: chanNum = " << chanNum << '\n'; - continue; - } - - for (const auto& valueMap : *(m_LV_current->m_values->at(chanNum))) { - LB = valueMap.first; - value = valueMap.second; - m_hist_LB_moduleGroup_LVcurrent[staveNum - 1]->Fill(LB, moduleGroup, value); - m_hist_LB_staveID_LVcurrent->Fill(LB, staveNum, value); - } - - for (const auto& valueMap : *(m_HV_current->m_values->at(chanNum))) { - LB = valueMap.first; - value = valueMap.second; - m_hist_LB_moduleGroup_HVcurrent[staveNum - 1]->Fill(LB, moduleGroup, value); - m_hist_LB_staveID_HVcurrent->Fill(LB, staveNum, value); - } - - } // end loop over LV -#endif - - return StatusCode::SUCCESS; -} diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelMainMon.cxx b/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelMainMon.cxx deleted file mode 100755 index 134e80b59ee32c4e86968274e0cc9e355423c533..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelMainMon.cxx +++ /dev/null @@ -1,862 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -/////////////////////////////////////////////////////////////////////////////// -// This tool is the head of the monitoring. It is called by the job options and -// given all the flags. This tool the does the common overhead jobs and calls -// functions which do each individual job. One function to book and fill each -// storegate type for each environment. -// For example, filling cluster histograms for Details modules. -/////////////////////////////////////////////////////////////////////////////// - -#include "PixelMonitoring/PixelMainMon.h" - -#include "InDetRIO_OnTrack/SiClusterOnTrack.h" -#include "InDetReadoutGeometry/SiDetectorElement.h" -#include "LWHists/TH1F_LW.h" -#include "LWHists/TH1I_LW.h" -#include "LWHists/TH2F_LW.h" -#include "LWHists/TProfile2D_LW.h" -#include "LWHists/TProfile_LW.h" -#include "TH2S.h" -#include "TProfile2D.h" -#include "TrkParameters/TrackParameters.h" -#include "TrkSpacePoint/SpacePointContainer.h" -#include "TrkTrack/TrackCollection.h" - -#include <cstdlib> -#include <fstream> -#include <sstream> - -#include "GaudiKernel/StatusCode.h" -#include "InDetIdentifier/PixelID.h" -#include "InDetReadoutGeometry/SiDetectorElement.h" -#include "InDetReadoutGeometry/SiDetectorElementCollection.h" -#include "InDetTrackSelectionTool/IInDetTrackSelectionTool.h" -#include "PathResolver/PathResolver.h" -#include "PixelCabling/IPixelCablingSvc.h" -#include "PixelMonitoring/PixelMon2DLumiMaps.h" -#include "PixelMonitoring/PixelMon2DLumiProfiles.h" -#include "PixelMonitoring/PixelMon2DMapsLW.h" -#include "PixelMonitoring/PixelMon2DProfilesLW.h" -#include "PixelMonitoring/PixelMonModules.h" -#include "TrkToolInterfaces/ITrackHoleSearchTool.h" - -PixelMainMon::PixelMainMon(const std::string& type, const std::string& name, const IInterface* parent) : - ManagedMonitorToolBase(type, name, parent), - m_pixelCableSvc("PixelCablingSvc", name), - m_IBLParameterSvc("IBLParameterSvc", name), - m_holeSearchTool("InDet::InDetTrackHoleSearchTool/InDetHoleSearchTool"), - m_trackSelTool("InDet::InDetTrackSelectionTool/TrackSelectionTool", this), - m_moduleTemperature(new dcsDataHolder()), - m_coolingPipeTemperatureInlet(new dcsDataHolder()), - m_coolingPipeTemperatureOutlet(new dcsDataHolder()), - m_HV(new dcsDataHolder()), - m_HV_current(new dcsDataHolder()), - m_LV_voltage(new dcsDataHolder()), - m_LV_current(new dcsDataHolder()), - m_FSM_state(new dcsDataHolder()), - m_FSM_status(new dcsDataHolder()), - m_moduleDCSDataHolder(new moduleDcsDataHolder()) { - // all job options flags go here - declareProperty("PixelCablingSvc", m_pixelCableSvc); - declareProperty("HoleSearchTool", m_holeSearchTool); - declareProperty("TrackSelectionTool", m_trackSelTool); - - declareProperty("RDOName", m_Pixel_RDOName = "PixelRDOs"); // storegate container names - declareProperty("RODErrorName", m_detector_error_name = "pixel_error_summary"); - declareProperty("SpacePointName", m_Pixel_SpacePointsName = "PixelSpacePoints"); - declareProperty("ClusterName", m_Pixel_SiClustersName = "PixelClusters"); - declareProperty("TrackName", m_TracksName = "Pixel_Cosmic_Tracks"); - declareProperty("PixelBCIDName", m_PixelBCIDName = "PixelBCID"); - - declareProperty("onTrack", m_doOnTrack = false); // use inner detector tracks - declareProperty("do2DMaps", m_do2DMaps = false); - declareProperty("doModules", m_doModules = false); - declareProperty("doOffline", m_doOffline = false); - declareProperty("doOnline", m_doOnline = false); - declareProperty("doLowOccupancy", m_doLowOccupancy = false); - declareProperty("doHighOccupancy", m_doHighOccupancy = false); - declareProperty("doPixelOccupancy", m_doPixelOccupancy = false); - declareProperty("doDetails", m_doDetails = false); - declareProperty("doTiming", m_doTiming = false); - declareProperty("doLumiBlock", m_doLumiBlock = false); - - // flags to turn on/off parts of the code - declareProperty("doRDO", m_doRDO = false); - declareProperty("doErrors", m_doRODError = false); - declareProperty("doSpacePoint", m_doSpacePoint = false); - declareProperty("doCluster", m_doCluster = false); - declareProperty("doTrack", m_doTrack = false); - declareProperty("doHoleSearch", m_doHoleSearch = false); - declareProperty("doStatus", m_doStatus = false); - declareProperty("doDCS", m_doDCS = false); - declareProperty("doHeavyIonMon", m_doHeavyIonMon = false); - - declareProperty("doIBL", m_doIBL = false); - declareProperty("DetailsMod1", m_DetailsMod1 = ""); - declareProperty("DetailsMod2", m_DetailsMod2 = ""); - declareProperty("DetailsMod3", m_DetailsMod3 = ""); - declareProperty("DetailsMod4", m_DetailsMod4 = ""); - - m_lbRange = 3000; - m_bcidRange = 3600; - m_isNewRun = false; - m_newLowStatInterval = false; - m_doRefresh = false; - m_doRefresh5min = false; - m_firstBookTime = 0; - m_currentBCID = 0; - m_isFirstBook = false; - m_nRefresh = 0; - m_nRefresh5min = 0; - m_ntracksPerEvent = 0; - memset(m_nGood_mod, 0, sizeof(m_nGood_mod)); - memset(m_nActive_mod, 0, sizeof(m_nActive_mod)); - m_pixelid = 0; - m_event = 0; - m_event_ref = 0; - m_startTime = 0; - m_majorityDisabled = 0; - m_lumiBlockNum = 0; - m_currentTime = 0; - m_runNum = 0; - m_idHelper = 0; - m_eventxAODInfoKey = "EventInfo"; - // Initalize all pointers for histograms - - // Event info - m_events_per_lumi = 0; - m_mu_vs_bcid = 0; - m_mu_vs_lumi = 0; - m_storegate_errors = 0; - - // number of hits - m_hits_per_lumi = 0; - m_num_hits = 0; - memset(m_nhits_mod, 0, sizeof(m_nhits_mod)); - memset(m_hits_per_lumi_mod, 0, sizeof(m_hits_per_lumi_mod)); - memset(m_avgocc_ratio_lastXlb_mod, 0, sizeof(m_avgocc_ratio_lastXlb_mod)); - memset(m_avgocc_ratio_lastXlb_mod_prof, 0, sizeof(m_avgocc_ratio_lastXlb_mod_prof)); - memset(m_totalhits_per_bcid_mod, 0, sizeof(m_totalhits_per_bcid_mod)); - - // hit occupancy - m_avgocc_per_lumi = 0; - memset(m_avgocc_per_lumi_mod, 0, sizeof(m_avgocc_per_lumi_mod)); - memset(m_modocc_per_lumi, 0, sizeof(m_modocc_per_lumi)); - memset(m_avgocc_per_bcid_mod, 0, sizeof(m_avgocc_per_bcid_mod)); - memset(m_avgocc_active_per_lumi_mod, 0, sizeof(m_avgocc_active_per_lumi_mod)); - memset(m_maxocc_per_lumi_mod, 0, sizeof(m_maxocc_per_lumi_mod)); - memset(m_maxocc_per_bcid_mod, 0, sizeof(m_maxocc_per_bcid_mod)); - memset(m_occupancy_summary_mod, 0, sizeof(m_occupancy_summary_mod)); - m_occupancy_PP0_ECA = 0; - m_occupancy_PP0_ECC = 0; - m_occupancy_PP0_B0 = 0; - m_occupancy_PP0_B1 = 0; - m_occupancy_PP0_B2 = 0; - m_occupancy_PP0_IBLA = 0; - m_occupancy_PP0_IBLC = 0; - m_cluster_occupancy_PP0_ECA = 0; - m_cluster_occupancy_PP0_ECC = 0; - m_cluster_occupancy_PP0_B0 = 0; - m_cluster_occupancy_PP0_B1 = 0; - m_cluster_occupancy_PP0_B2 = 0; - m_cluster_occupancy_PP0_IBLA = 0; - m_cluster_occupancy_PP0_IBLC = 0; - - memset(m_nFEswithHits_mod, 0, sizeof(m_nFEswithHits_mod)); - - // hit tot - memset(m_hit_ToT, 0, sizeof(m_hit_ToT)); - memset(m_hit_ToT_tmp_mod, 0, sizeof(m_hit_ToT_tmp_mod)); - memset(m_hit_ToT_Mon_mod, 0, sizeof(m_hit_ToT_Mon_mod)); - memset(m_hit_ToTMean_mod, 0, sizeof(m_hit_ToTMean_mod)); - - // timing - m_Lvl1ID_PIX = 0; - m_Lvl1ID_IBL = 0; - m_Atlas_BCID = 0; - m_Atlas_BCID_hits = 0; - m_BCID = 0; - m_BCID_Profile = 0; - m_Lvl1A = 0; - memset(m_Lvl1A_mod, 0, sizeof(m_Lvl1A_mod)); - memset(m_Lvl1A_10min_mod, 0, sizeof(m_Lvl1A_10min_mod)); - memset(m_Lvl1ID_diff_mod_ATLAS_mod, 0, sizeof(m_Lvl1ID_diff_mod_ATLAS_mod)); - memset(m_diff_ROD_vs_Module_BCID_mod, 0, sizeof(m_diff_ROD_vs_Module_BCID_mod)); - - // details - m_Details_mod1_num_hits = 0; - m_Details_mod2_num_hits = 0; - m_Details_mod3_num_hits = 0; - m_Details_mod4_num_hits = 0; - m_Details_mod1_occupancy = 0; - m_Details_mod2_occupancy = 0; - m_Details_mod3_occupancy = 0; - m_Details_mod4_occupancy = 0; - m_Details_mod1_ToT = 0; - m_Details_mod2_ToT = 0; - m_Details_mod3_ToT = 0; - m_Details_mod4_ToT = 0; - - // track quality - m_track_res_phi = 0; - m_track_pull_phi = 0; - m_track_res_eta = 0; - m_track_pull_eta = 0; - m_track_chi2 = 0; - - // the number of tracks - m_tracksPerEvt_per_lumi = 0; - m_tracksPerEvtPerMu_per_lumi = 0; - memset(m_hiteff_incl_mod, 0, sizeof(m_hiteff_incl_mod)); - memset(m_hiteff_lastXlb_mod, 0, sizeof(m_hiteff_lastXlb_mod)); - - // cluster size - memset(m_clusize_ontrack_mod, 0, sizeof(m_clusize_ontrack_mod)); - memset(m_clusize_offtrack_mod, 0, sizeof(m_clusize_offtrack_mod)); - - // cluster histograms - m_clusters_per_lumi = 0; - memset(m_clusters_per_lumi_mod, 0, sizeof(m_clusters_per_lumi_mod)); - memset(m_clusters_col_width_per_lumi_mod, 0, sizeof(m_clusters_col_width_per_lumi_mod)); - memset(m_clusters_row_width_per_lumi_mod, 0, sizeof(m_clusters_row_width_per_lumi_mod)); - memset(m_clusters_col_width_per_bcid_mod, 0, sizeof(m_clusters_col_width_per_bcid_mod)); - memset(m_clusters_row_width_per_bcid_mod, 0, sizeof(m_clusters_row_width_per_bcid_mod)); - m_totalclusters_per_lumi = 0; - memset(m_totalclusters_per_lumi_mod, 0, sizeof(m_totalclusters_per_lumi_mod)); - memset(m_totalclusters_per_bcid_mod, 0, sizeof(m_totalclusters_per_bcid_mod)); - memset(m_cluster_ToT1d_mod, 0, sizeof(m_cluster_ToT1d_mod)); - memset(m_cluster_ToT1d_corr, 0, sizeof(m_cluster_ToT1d_corr)); - memset(m_cluster_Q_mod, 0, sizeof(m_cluster_Q_mod)); - memset(m_cluster_Q_corr, 0, sizeof(m_cluster_Q_corr)); - m_cluster_groupsize = 0; - m_cluster_col_width = 0; - m_cluster_row_width = 0; - memset(m_cluster_col_width_mod, 0, sizeof(m_cluster_col_width_mod)); - memset(m_cluster_row_width_mod, 0, sizeof(m_cluster_row_width_mod)); - memset(m_cluster_groupsize_mod, 0, sizeof(m_cluster_groupsize_mod)); - m_cluster_LVL1A = 0; - memset(m_cluster_LVL1A1d_mod, 0, sizeof(m_cluster_LVL1A1d_mod)); - m_clusterSize_eta = 0; - memset(m_clussize_vs_eta_mod, 0, sizeof(m_clussize_vs_eta_mod)); - m_num_clusters = 0; - memset(m_clusters_per_track_per_lumi_mod, 0, sizeof(m_clusters_per_track_per_lumi_mod)); - memset(m_num_clusters_mod, 0, sizeof(m_num_clusters_mod)); - memset(m_cluster_occupancy_summary_mod, 0, sizeof(m_cluster_occupancy_summary_mod)); - m_cluster_LVL1A_mod = 0; - m_clustersOnOffTrack_per_lumi = 0; - - // module status - m_disabledModules_per_lumi_PIX = 0; - memset(m_badModules_per_lumi_mod, 0, sizeof(m_badModules_per_lumi_mod)); - memset(m_disabledModules_per_lumi_mod, 0, sizeof(m_disabledModules_per_lumi_mod)); - memset(m_baddisabledModules_per_lumi_mod, 0, sizeof(m_baddisabledModules_per_lumi_mod)); - - // errors - memset(m_errhist_errcat_avg, 0, sizeof(m_errhist_errcat_avg)); - memset(m_errhist_errtype_avg, 0, sizeof(m_errhist_errtype_avg)); - memset(m_errhist_tot_LB, 0, sizeof(m_errhist_tot_LB)); - m_errhist_syncerr_LB_pix = 0; - memset(m_errhist_errcat_LB, 0, sizeof(m_errhist_errcat_LB)); - memset(m_errhist_errtype_LB, 0, sizeof(m_errhist_errtype_LB)); - memset(m_errhist_expert_LB, 0, sizeof(m_errhist_expert_LB)); - memset(m_errhist_expert_DBMIBL_LB, 0, sizeof(m_errhist_expert_DBMIBL_LB)); - memset(m_errhist_per_bit_LB, 0, sizeof(m_errhist_per_bit_LB)); - memset(m_errhist_per_type_LB, 0, sizeof(m_errhist_per_type_LB)); - memset(m_errhist_expert_fe_trunc_err_3d, 0, sizeof(m_errhist_expert_fe_trunc_err_3d)); - m_errhist_expert_servrec_ibl_unweighted = 0; - m_errhist_expert_servrec_ibl_weighted = 0; - m_errhist_expert_servrec_ibl_count = 0; - - // space point - m_num_spacepoints = 0; - m_num_spacepoints_low = 0; - m_spHit_x = 0; - m_spHit_y = 0; - m_spHit_z = 0; - m_spHit_r = 0; - m_spHit_phi = 0; - m_spHit_xy = 0; - m_spHit_rz = 0; - - m_num_hits_LB = 0; - memset(m_hit_ToT_LB_mod, 0, sizeof(m_hit_ToT_LB_mod)); - m_cluster_ToT_LB = 0; - m_num_clusters_LB = 0; - - // DCS monitoring - m_hist_moduleTemperatureEtaPhi = 0; - memset(m_hist_moduleTemperature2Dscatter, 0, sizeof(m_hist_moduleTemperature2Dscatter)); - memset(m_hist_moduleTemperatureLB, 0, sizeof(m_hist_moduleTemperatureLB)); - m_hist_LB_staveID_moduleTemperature = 0; - memset(m_hist_LB_moduleGroup_moduleTemperature, 0, sizeof(m_hist_LB_moduleGroup_moduleTemperature)); - m_hist_HVoltageEtaPhi = 0; - memset(m_hist_HVoltage2Dscatter, 0, sizeof(m_hist_HVoltage2Dscatter)); - memset(m_hist_HVoltageLB, 0, sizeof(m_hist_HVoltageLB)); - m_hist_LB_staveID_HVoltage = 0; - memset(m_hist_LB_moduleGroup_HVoltage, 0, sizeof(m_hist_LB_moduleGroup_HVoltage)); - memset(m_hist_Pipes_inletLB, 0, sizeof(m_hist_Pipes_inletLB)); - m_hist_Pipes_inlet2Dscatter = 0; - m_hist_LB_staveID_coolingPipeInlet = 0; - memset(m_hist_Pipes_outletLB, 0, sizeof(m_hist_Pipes_outletLB)); - m_hist_Pipes_outlet2Dscatter = 0; - m_hist_LB_staveID_coolingPipeOutlet = 0; - - m_hist_LVoltageEtaPhi = 0; - memset(m_hist_LVoltage2Dscatter, 0, sizeof(m_hist_LVoltage2Dscatter)); - memset(m_hist_LVoltageLB, 0, sizeof(m_hist_LVoltageLB)); - m_hist_LB_staveID_LVoltage = 0; - memset(m_hist_LB_moduleGroup_LVoltage, 0, sizeof(m_hist_LB_moduleGroup_LVoltage)); - - m_hist_LVcurrentEtaPhi = 0; - memset(m_hist_LVcurrent2Dscatter, 0, sizeof(m_hist_LVcurrent2Dscatter)); - m_hist_LB_staveID_LVcurrent = 0; - memset(m_hist_LVcurrentLB, 0, sizeof(m_hist_LVcurrentLB)); - memset(m_hist_LB_moduleGroup_LVcurrent, 0, sizeof(m_hist_LB_moduleGroup_LVcurrent)); - - m_hist_HVcurrentEtaPhi = 0; - memset(m_hist_HVcurrent2Dscatter, 0, sizeof(m_hist_HVcurrent2Dscatter)); - memset(m_hist_HVcurrentLB, 0, sizeof(m_hist_HVcurrentLB)); - m_hist_LB_staveID_HVcurrent = 0; - memset(m_hist_LB_moduleGroup_HVcurrent, 0, sizeof(m_hist_LB_moduleGroup_HVcurrent)); - - m_hist_FSMstateEtaPhi = 0; - memset(m_hist_FSMstate2Dscatter, 0, sizeof(m_hist_FSMstate2Dscatter)); - memset(m_hist_FSMstateLB, 0, sizeof(m_hist_FSMstateLB)); - m_hist_LB_staveID_FSMstate = 0; - memset(m_hist_LB_moduleGroup_FSMstate, 0, sizeof(m_hist_LB_moduleGroup_FSMstate)); - - m_hist_FSMstatusEtaPhi = 0; - memset(m_hist_FSMstatus2Dscatter, 0, sizeof(m_hist_FSMstatus2Dscatter)); - memset(m_hist_FSMstatusLB, 0, sizeof(m_hist_FSMstatusLB)); - m_hist_LB_staveID_FSMstatus = 0; - memset(m_hist_LB_moduleGroup_FSMstatus, 0, sizeof(m_hist_LB_moduleGroup_FSMstatus)); - - m_hist_dTEtaPhi = 0; - m_hist_LB_staveID_dT = 0; - memset(m_hist_LB_moduleGroup_dT, 0, sizeof(m_hist_LB_moduleGroup_dT)); // dT := module temp - cooling pipe outlet - - // power consumption - m_hist_LVPowerConsumptionEtaPhi = 0; - m_hist_LB_staveID_LVPowerConsumption = 0; - memset(m_hist_LB_moduleGroup_LVPowerConsumption, 0, sizeof(m_hist_LB_moduleGroup_LVPowerConsumption)); - m_hist_HVPowerConsumptionEtaPhi = 0; - m_hist_LB_staveID_HVPowerConsumption = 0; - memset(m_hist_LB_moduleGroup_HVPowerConsumption, 0, sizeof(m_hist_LB_moduleGroup_HVPowerConsumption)); - m_hist_LVHVPowerConsumptionEtaPhi = 0; - m_hist_LB_staveID_LVHVPowerConsumption = 0; - memset(m_hist_LB_moduleGroup_LVHVPowerConsumption, 0, sizeof(m_hist_LB_moduleGroup_LVHVPowerConsumption)); - - m_hist_effFLEXtempEtaPhi = 0; - m_hist_LB_staveID_effFLEXtemp = 0; - memset(m_hist_LB_moduleGroup_effFLEXtemp, 0, sizeof(m_hist_LB_moduleGroup_effFLEXtemp)); - m_hist_thermalFigureMeritEtaPhi = 0; - m_hist_LB_staveID_thermalFigureMerit = 0; - memset(m_hist_LB_moduleGroup_thermalFigureMerit, 0, sizeof(m_hist_LB_moduleGroup_thermalFigureMerit)); -} - -PixelMainMon::~PixelMainMon() { - delete m_moduleTemperature; - delete m_coolingPipeTemperatureInlet; - delete m_coolingPipeTemperatureOutlet; - delete m_HV; - delete m_HV_current; - delete m_LV_voltage; - delete m_LV_current; - delete m_FSM_state; - delete m_FSM_status; - delete m_moduleDCSDataHolder; -} - -StatusCode PixelMainMon::initialize() { - ATH_CHECK(ManagedMonitorToolBase::initialize()); - time(&m_startTime); // mark time for start of run - - ATH_CHECK(m_Pixel_RDOName.initialize()); - ATH_CHECK(m_Pixel_SpacePointsName.initialize()); - ATH_CHECK(m_Pixel_SiClustersName.initialize()); - ATH_CHECK(m_TracksName.initialize()); - ATH_CHECK(m_PixelBCIDName.initialize()); - ATH_CHECK(m_eventxAODInfoKey.initialize()); - // Retrieve tools - if (detStore()->retrieve(m_pixelid, "PixelID").isFailure()) { - msg(MSG::FATAL) << "Could not get Pixel ID helper" << endmsg; - return StatusCode::FAILURE; - } - - ATH_CHECK(detStore()->retrieve(m_idHelper, "AtlasID")); - - ATH_CHECK(m_pixelCondSummaryTool.retrieve()); - - if (m_pixelCableSvc.retrieve().isFailure()) { - if (msgLvl(MSG::FATAL)) msg(MSG::FATAL) << "Failed to retrieve tool " << m_pixelCableSvc << endmsg; - return StatusCode::FAILURE; - } else { - if (msgLvl(MSG::INFO)) msg(MSG::INFO) << "Retrieved tool " << m_pixelCableSvc << endmsg; - } - - ATH_CHECK(m_ErrorSvc.retrieve()); - - if (m_IBLParameterSvc.retrieve().isFailure()) { - if (msgLvl(MSG::FATAL)) msg(MSG::FATAL) << "Could not retrieve IBLParameterSvc" << endmsg; - return StatusCode::FAILURE; - } else { - if (msgLvl(MSG::INFO)) msg(MSG::INFO) << "Retrieved tool " << m_IBLParameterSvc << endmsg; - } - - m_doIBL = m_IBLParameterSvc->containsIBL(); - msg(MSG::INFO) << "doIBL set to " << m_doIBL << endmsg; - - if (m_doIBL && !m_IBLParameterSvc->contains3D()) { - msg(MSG::WARNING) << "Assuming hybrid 2D/3D IBL module composition, but geometry is all-planar" << endmsg; - } - - if (m_doHoleSearch) { - if (m_holeSearchTool.retrieve().isFailure()) { - msg(MSG::FATAL) << "Failed to retrieve tool " << m_holeSearchTool << endmsg; - return StatusCode::FAILURE; - } else { - msg(MSG::INFO) << "Retrieved tool " << m_holeSearchTool << endmsg; - } - } - else { - m_holeSearchTool.disable(); - } - - if (m_doOnTrack) { - ATH_CHECK(m_trackSelTool.retrieve()); - } - else { - m_trackSelTool.disable(); - } - - if (!m_doDCS) return StatusCode::SUCCESS; - - m_atrcollist.push_back(std::string("/PIXEL/DCS/TEMPERATURE")); - m_atrcollist.push_back(std::string("/PIXEL/DCS/HV")); - m_atrcollist.push_back(std::string("/PIXEL/DCS/FSMSTATE")); - m_atrcollist.push_back(std::string("/PIXEL/DCS/FSMSTATUS")); - m_atrcollist.push_back(std::string("/PIXEL/DCS/PIPES")); - m_atrcollist.push_back(std::string("/PIXEL/DCS/HVCURRENT")); - m_atrcollist.push_back(std::string("/PIXEL/DCS/LV")); - m_currentLumiBlockNumber = 0; - - std::string modMapFileName = PathResolver::find_file("PixelDQMonitoring/wincc2cool.csv", "CALIBPATH"); - std::string coolPipeFileName = PathResolver::find_file("PixelDQMonitoring/coolingPipeMap.csv", "CALIBPATH"); - std::string lvMapFileName = PathResolver::find_file("PixelDQMonitoring/lvMap.csv", "CALIBPATH"); - - if (modMapFileName == "" || coolPipeFileName == "" || lvMapFileName == "") { - ATH_MSG_WARNING("initialize(): can't find DCS mapping files - m_doDCS flag has been changed to False."); - m_doDCS = false; - } else { - std::ifstream moduleMapfile(modMapFileName.c_str()); - std::ifstream coolingPipeMapfile(coolPipeFileName.c_str()); - std::ifstream lvMapfile(lvMapFileName.c_str()); - - if (moduleMapfile.fail() || coolingPipeMapfile.fail() || lvMapfile.fail()) { - ATH_MSG_WARNING("initialize(): can't read DCS mapping files - m_doDCS flag has been changed to False."); - m_doDCS = false; - } else { - ATH_MSG_INFO("initialize(): found all DCS channel mapping files accessible, start reading them."); - int channel; - std::string moduleName; - std::string rest; - std::string inletName; - std::string outletName; - std::string lvVoltageName; - std::string lvCurrentName; - while (moduleMapfile >> channel >> moduleName >> rest) { - m_moduleTemperature->m_maps->insert(std::make_pair(moduleName, channel)); - m_HV->m_maps->insert(std::make_pair(moduleName, channel)); - m_moduleDCSDataHolder->m_moduleMap->insert(std::make_pair(moduleName, channel)); - ATH_MSG_DEBUG("initialize(): channel " << channel << ", moduleName " << moduleName); - } - while (coolingPipeMapfile >> channel >> inletName >> outletName) { - m_coolingPipeTemperatureInlet->m_maps->insert(std::make_pair(inletName, channel)); - m_coolingPipeTemperatureOutlet->m_maps->insert(std::make_pair(outletName, channel)); - } - while (lvMapfile >> channel >> lvVoltageName >> lvCurrentName) { - m_LV_voltage->m_maps->insert(std::make_pair(lvVoltageName, channel)); - m_LV_current->m_maps->insert(std::make_pair(lvCurrentName, channel)); - } - } - } - - m_name2etaIndex["A_M4_A8_2"] = 9; - m_name2etaIndex["A_M4_A8_1"] = 8; - m_name2etaIndex["A_M4_A7_2"] = 7; - m_name2etaIndex["A_M4_A7_1"] = 6; - m_name2etaIndex["A_M3_A6"] = 5; - m_name2etaIndex["A_M3_A5"] = 4; - m_name2etaIndex["A_M2_A4"] = 3; - m_name2etaIndex["A_M2_A3"] = 2; - m_name2etaIndex["A_M1_A2"] = 1; - m_name2etaIndex["A_M1_A1"] = 0; - m_name2etaIndex["C_M1_C1"] = -1; - m_name2etaIndex["C_M1_C2"] = -2; - m_name2etaIndex["C_M2_C3"] = -3; - m_name2etaIndex["C_M2_C4"] = -4; - m_name2etaIndex["C_M3_C5"] = -5; - m_name2etaIndex["C_M3_C6"] = -6; - m_name2etaIndex["C_M4_C7_1"] = -7; - m_name2etaIndex["C_M4_C7_2"] = -8; - m_name2etaIndex["C_M4_C8_1"] = -9; - m_name2etaIndex["C_M4_C8_2"] = -10; - - m_name2moduleGroup["C_M4"] = 0; - m_name2moduleGroup["C_M3"] = 1; - m_name2moduleGroup["C_M2"] = 2; - m_name2moduleGroup["C_M1"] = 3; - m_name2moduleGroup["A_M1"] = 4; - m_name2moduleGroup["A_M2"] = 5; - m_name2moduleGroup["A_M3"] = 6; - m_name2moduleGroup["A_M4"] = 7; - - m_fsmState2enum["READY"] = 0.; - m_fsmState2enum["ON"] = 1.; - m_fsmState2enum["STANDBY"] = 2.; - m_fsmState2enum["LV_ON"] = 3.; - m_fsmState2enum["TRANSITION"] = 4.; - m_fsmState2enum["UNDEFINED"] = 5.; - m_fsmState2enum["LOCKED_OUT"] = 6.; - m_fsmState2enum["DISABLED"] = 7.; - m_fsmState2enum["OFF"] = 8.; - m_fsmState2enum["DEAD"] = 9.; - - m_fsmStatus2enum["OK"] = 0.; - m_fsmStatus2enum["WARNING"] = 1.; - m_fsmStatus2enum["ERROR"] = 2.; - m_fsmStatus2enum["UNINITIALIZED"] = 3.; - m_fsmStatus2enum["DEAD"] = 4.; - - return StatusCode::SUCCESS; -} - -StatusCode PixelMainMon::bookHistograms() { - auto thisEventInfo = SG::makeHandle(m_eventxAODInfoKey); - if(!(thisEventInfo.isValid())) { - if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "No EventInfo object found" << endmsg; - } else { - m_lumiBlockNum = thisEventInfo->lumiBlock(); - - if (m_doOnline) { - m_runNum = thisEventInfo->runNumber(); - std::stringstream runNumStr; - runNumStr << m_runNum; - m_histTitleExt = " (Run " + runNumStr.str() + ")"; - } else { - m_histTitleExt = ""; - } - if (!m_isFirstBook) { - m_firstBookTime = thisEventInfo->timeStamp(); - m_isFirstBook = true; - } - } - - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "bookHistograms()" << endmsg; - - if (m_environment == AthenaMonManager::tier0ESD && !m_doOnline) { - m_doRDO = false; - m_doRODError = false; - m_doSpacePoint = false; - m_doCluster = false; - m_doStatus = false; - m_doDCS = false; - m_doTrack = false; - } - - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "[PixelMonitoring] flags in bookHisto" << endmsg; - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "m_doRDO " << m_doRDO << endmsg; - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "m_doRODError " << m_doRODError << endmsg; - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "m_doSpacePoint" << m_doSpacePoint << endmsg; - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "m_doCluster " << m_doCluster << endmsg; - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "m_doStatus " << m_doStatus << endmsg; - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "m_doDCS " << m_doDCS << endmsg; - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "m_doTrack " << m_doTrack << endmsg; - - // Book histograms - if (m_doLumiBlock) { - if (m_doRDO) { - if (bookHitsLumiBlockMon().isFailure()) { - if (msgLvl(MSG::INFO)) msg(MSG::INFO) << "Could not book lowStat histograms" << endmsg; - } - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Done booking RDO for lowStat" << endmsg; - } - if (m_doRODError) { - if (bookRODErrorLumiBlockMon().isFailure()) { - if (msgLvl(MSG::INFO)) msg(MSG::INFO) << "Could not book lowStat histograms" << endmsg; - } - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Done booking ROD Error for lowStat" << endmsg; - } - if (m_doCluster) { - if (bookClustersLumiBlockMon().isFailure()) { - if (msgLvl(MSG::INFO)) msg(MSG::INFO) << "Could not book lowStat histograms" << endmsg; - } - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Done booking Cluster for lowStat" << endmsg; - } - if (m_doStatus) { - if (bookStatusLumiBlockMon().isFailure()) { - if (msgLvl(MSG::INFO)) msg(MSG::INFO) << "Could not book lowStat histograms" << endmsg; - } - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Done booking Status for lowStat" << endmsg; - } - } - - if (m_doRDO) { - std::string path_hits = "Pixel/Hits"; - if (m_doOnTrack) path_hits.replace(path_hits.begin(), path_hits.end(), "Pixel/HitsOnTrack"); - MonGroup hitsHistos(this, path_hits.c_str(), run, ATTRIB_MANAGED); // declare a group of histograms - StatusCode sc; - sc = hitsHistos.regHist(m_mu_vs_bcid = TProfile_LW::create("Interactions_vs_bcid", "<Interactions> vs BCID;BCID;<#Interactions/event>", m_bcidRange, -0.5, -0.5 + (1.0 * m_bcidRange))); - sc = hitsHistos.regHist(m_mu_vs_lumi = TProfile_LW::create("Interactions_vs_lumi", "<Interactions> vs LB;lumi block;<#Interactions/event>", m_lbRange, -0.5, -0.5 + (1.0 * m_lbRange))); - sc = hitsHistos.regHist(m_events_per_lumi = TH1F_LW::create("Events_per_lumi", "nEvents vs LB;lumi block;#events", m_lbRange, -0.5, -0.5 + (1.0 * m_lbRange))); - - std::string path = "Pixel/Errors"; - if (m_doOnTrack) path.replace(path.begin(), path.end(), "Pixel/ErrorsOnTrack"); - MonGroup errorHistos(this, path.c_str(), run, ATTRIB_MANAGED); //declare a group of histograms - sc = errorHistos.regHist(m_storegate_errors = TH2F_LW::create("storegate_errors", ("Storegate Errors" + m_histTitleExt + ";Container Name;Error Type").c_str(), 6, 0.5, 6.5, 5, 0.5, 5.5)); - if (sc.isFailure()) { - if (msgLvl(MSG::INFO)) msg(MSG::INFO) << "Could not book histograms" << endmsg; - } - - if(m_storegate_errors) m_storegate_errors->SetOption("colz"); - const char* xlabel[6] = {"RDOs", "SpacePoints", "Clusters", "Tracks", "RODErrors", "DCS"}; - for (int i = 0; i < 6; i++) { - if (m_storegate_errors) m_storegate_errors->GetXaxis()->SetBinLabel(i + 1, xlabel[i]); // bin 0 is underflow - } - const char* ylabel[5] = {"Not flagged", "Container not found", "Can't retrieve container", "Container empty", "Data is bad"}; - for (int i = 0; i < 5; i++) { - if (m_storegate_errors) m_storegate_errors->GetYaxis()->SetBinLabel(i + 1, ylabel[i]); // bin 0 is underflow - } - } - - // Initialize histograms - if (m_doTrack) { - if (bookTrackMon().isFailure()) { - if (msgLvl(MSG::INFO)) msg(MSG::INFO) << "Could not book histograms" << endmsg; - } - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Done booking Track" << endmsg; - } - if (m_doRDO) { - if (bookHitsMon().isFailure()) { - if (msgLvl(MSG::INFO)) msg(MSG::INFO) << "Could not book histograms" << endmsg; - } - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Done booking RDO" << endmsg; - } - if (m_doRODError) { - if (bookRODErrorMon().isFailure()) { - if (msgLvl(MSG::INFO)) msg(MSG::INFO) << "Could not book histograms" << endmsg; - } - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Done booking ROD Error" << endmsg; - } - if (m_doSpacePoint) { - if (bookSpacePointMon().isFailure()) { - if (msgLvl(MSG::INFO)) msg(MSG::INFO) << "Could not book histograms" << endmsg; - } - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Done booking SP" << endmsg; - } - if (m_doCluster) { - if (bookClustersMon().isFailure()) { - if (msgLvl(MSG::INFO)) msg(MSG::INFO) << "Could not book histograms" << endmsg; - } - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Done booking Cluster" << endmsg; - } - if (m_doStatus) { - if (bookStatusMon().isFailure()) { - if (msgLvl(MSG::INFO)) msg(MSG::INFO) << "Could not book histograms" << endmsg; - } - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Done booking Status" << endmsg; - } - if (m_doDCS) { - if (bookPixelDCSMon().isFailure()) { - if (msgLvl(MSG::INFO)) msg(MSG::INFO) << "Could not book histograms" << endmsg; - } - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Done booking DCS" << endmsg; - } - - return StatusCode::SUCCESS; -} - -StatusCode PixelMainMon::fillHistograms() { - // Get required services, we want to repeat as little as possible in the function calls - // Part 1: Get the messaging service, print where you are - - m_event++; - m_majorityDisabled = false; - - auto thisEventInfo = SG::makeHandle(m_eventxAODInfoKey); - if(!(thisEventInfo.isValid())) { - if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "No EventInfo object found" << endmsg; - } else { - m_currentTime = thisEventInfo->timeStamp(); - m_currentBCID = thisEventInfo->bcid(); - int currentdiff = (int)(m_currentTime - m_firstBookTime) / 100; - int currentdiff5min = (int)(m_currentTime - m_firstBookTime) / 300; - // for 100 sec - if (currentdiff > m_nRefresh) { - m_doRefresh = true; - m_nRefresh = currentdiff; - } else { - m_doRefresh = false; - } - // for 5min - if (currentdiff5min > m_nRefresh5min) { - m_doRefresh5min = true; - m_nRefresh5min = currentdiff5min; - } else { - m_doRefresh5min = false; - } - } - - PixelID::const_id_iterator idIt = m_pixelid->wafer_begin(); - PixelID::const_id_iterator idItEnd = m_pixelid->wafer_end(); - - for (int i = 0; i < PixLayerIBL2D3DDBM::COUNT; i++) { - m_nGood_mod[i] = 0; - m_nActive_mod[i] = 0; - } - - for (; idIt != idItEnd; ++idIt) { - Identifier WaferID = *idIt; - IdentifierHash id_hash = m_pixelid->wafer_hash(WaferID); - - int pixlayeribl2d3ddbm = getPixLayerIDDBM(m_pixelid->barrel_ec(WaferID), m_pixelid->layer_disk(WaferID), m_doIBL); - if (pixlayeribl2d3ddbm == PixLayerDBM::kIBL) { - pixlayeribl2d3ddbm = getPixLayerIDIBL2D3DDBM(m_pixelid->barrel_ec(WaferID), m_pixelid->layer_disk(WaferID), m_pixelid->eta_module(WaferID), m_doIBL); - } - if (pixlayeribl2d3ddbm == 99) continue; - if (m_pixelCondSummaryTool->isActive(id_hash) == true) { - m_nActive_mod[pixlayeribl2d3ddbm]++; - } - if (m_pixelCondSummaryTool->isActive(id_hash) == true && m_pixelCondSummaryTool->isGood(id_hash) == true) { - m_nGood_mod[pixlayeribl2d3ddbm]++; - } - } - m_nActive_mod[PixLayerIBL2D3DDBM::kIBL] = 2 * m_nActive_mod[PixLayerIBL2D3DDBM::kIBL2D] + m_nActive_mod[PixLayerIBL2D3DDBM::kIBL3D]; - m_nGood_mod[PixLayerIBL2D3DDBM::kIBL] = 2 * m_nGood_mod[PixLayerIBL2D3DDBM::kIBL2D] + m_nGood_mod[PixLayerIBL2D3DDBM::kIBL3D]; - - // event info - if (m_doRDO) { - if (m_mu_vs_bcid) m_mu_vs_bcid->Fill(m_currentBCID, thisEventInfo->actualInteractionsPerCrossing()); - if (m_mu_vs_lumi) m_mu_vs_lumi->Fill(m_manager->lumiBlockNumber(), thisEventInfo->actualInteractionsPerCrossing()); - if (m_events_per_lumi) m_events_per_lumi->Fill(m_manager->lumiBlockNumber()); - } - - // pixel info - if (m_doStatus) { - if (fillStatusMon().isFailure()) { - if (msgLvl(MSG::INFO)) msg(MSG::INFO) << "Could not fill histograms" << endmsg; - } - } - - // track - if (m_doTrack) { - if (fillTrackMon().isFailure()) { - if (msgLvl(MSG::INFO)) msg(MSG::INFO) << "Could not fill histograms" << endmsg; - } - } else { - if (m_storegate_errors) m_storegate_errors->Fill(4., 1.); - } - - // hits - if (m_doRDO) { - if (fillHitsMon().isFailure()) { - if (msgLvl(MSG::INFO)) { - msg(MSG::INFO) << "Could not fill histograms" << endmsg; - } - } - } else { - if (m_storegate_errors) m_storegate_errors->Fill(1., 1.); - } - - if (m_doRODError) { - if (fillRODErrorMon().isFailure()) { - if (msgLvl(MSG::INFO)) { - msg(MSG::INFO) << "Could not fill histograms" << endmsg; - } - } - } else { - if (m_storegate_errors) m_storegate_errors->Fill(5., 1.); - } - - // cluster - if (m_doCluster) { - if (fillClustersMon().isFailure()) { - if (msgLvl(MSG::INFO)) msg(MSG::INFO) << "Could not fill histograms" << endmsg; - } - } else { - if (m_storegate_errors) m_storegate_errors->Fill(3., 1.); - } - - // space point - if (m_doSpacePoint) { - if (fillSpacePointMon().isFailure()) { - if (msgLvl(MSG::INFO)) msg(MSG::INFO) << "Could not fill histograms" << endmsg; - } - } else { - if (m_storegate_errors) m_storegate_errors->Fill(2., 1.); - } - - // DCS - if (m_doDCS) { - if (fillPixelDCSMon().isFailure()) { - if (msgLvl(MSG::INFO)) msg(MSG::INFO) << "Could not fill histograms" << endmsg; - } - } else { - if (m_storegate_errors) m_storegate_errors->Fill(6., 1.); - } - - if (m_doRefresh) m_event_ref = m_event; - return StatusCode::SUCCESS; -} - -StatusCode PixelMainMon::procHistograms() { - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "finalize()" << endmsg; - - if (!m_doOnline && endOfRunFlag()) { - if (m_doRDO) { - if (procHitsMon().isFailure()) { - if (msgLvl(MSG::INFO)) msg(MSG::INFO) << "Could not proc Hit histograms" << endmsg; - } - } - if (m_doCluster) { - if (procClustersMon().isFailure()) { - if (msgLvl(MSG::INFO)) msg(MSG::INFO) << "Could not proc Cluster histograms" << endmsg; - } - } - if (m_doStatus) { - if (procStatusMon().isFailure()) { - if (msgLvl(MSG::INFO)) msg(MSG::INFO) << "Could not proc Status histograms" << endmsg; - } - } - if (m_doDCS) { - if (procPixelDCSMon().isFailure()) { - if (msgLvl(MSG::INFO)) msg(MSG::INFO) << "Could not proc DCS histograms" << endmsg; - } - } - if (m_doTrack) { - if (procTrackMon().isFailure()) { - if (msgLvl(MSG::INFO)) msg(MSG::INFO) << "Could not proc Track histograms" << endmsg; - } - } - } else if (m_doOnline && (endOfLumiBlockFlag() || endOfRunFlag())) { - if (m_doRDO) { - if (procHitsMon().isFailure()) { - if (msgLvl(MSG::INFO)) msg(MSG::INFO) << "Could not proc Hit histograms" << endmsg; - } - } - if (m_doCluster) { - if (procClustersMon().isFailure()) { - if (msgLvl(MSG::INFO)) msg(MSG::INFO) << "Could not proc Cluster histograms" << endmsg; - } - } - if (m_doTrack) { - if (procTrackMon().isFailure()) { - if (msgLvl(MSG::INFO)) msg(MSG::INFO) << "Could not proc Track histograms" << endmsg; - } - } - } - return StatusCode::SUCCESS; -} diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelMon2DLumiMaps.cxx b/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelMon2DLumiMaps.cxx deleted file mode 100644 index 8a8647c197362688d5593817a27abac1746ada05..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelMon2DLumiMaps.cxx +++ /dev/null @@ -1,172 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/////////////////////////////////////////////////////////////////////////////// -// Function to handle 2D maps of modules, one for each region -/////////////////////////////////////////////////////////////////////////////// - -#include "PixelMonitoring/PixelMon2DLumiMaps.h" -#include <string.h> -#include "GaudiKernel/StatusCode.h" -#include "InDetIdentifier/PixelID.h" -#include "LWHists/TH2F_LW.h" -#include "PixelMonitoring/Components.h" -#include "PixelMonitoring/HolderTemplate.h" - -PixelMon2DLumiMaps::PixelMon2DLumiMaps(std::string name, std::string title, std::string zlabel, const PixMon::HistConf& config) - : HolderTemplate<TH2F_LW>(config) { - const int lbRange = 3000; - int num_modules; - if (m_doIBL && PixMon::HasComponent(m_config, PixMon::LayerIBL2D3DDBM::kIBL)) { - num_modules = PixMon::kNumStavesIBL * (PixMon::kNumModulesIBL2D + PixMon::kNumModulesIBL3D); - m_histograms.at(0).reset(TH2F_LW::create((name + "_2D_Map_IBL").c_str(), (title + ", IBL " + " (Map);LB;Module;" + zlabel).c_str(), - lbRange, -0.5, -0.5 + lbRange, - num_modules, -0.5, -0.5 + num_modules)); - } - if (PixMon::HasComponent(m_config, PixMon::LayerIBL2D3DDBM::kB0)) { - num_modules = PixMon::kNumStavesL0 * PixMon::kNumModulesBarrel; - m_histograms.at(3).reset(TH2F_LW::create((name + "_2D_Map_B0").c_str(), (title + ", B0 " + " (Map);LB;Module;" + zlabel).c_str(), - lbRange, -0.5, -0.5 + lbRange, - num_modules, -0.5, -0.5 + num_modules)); - } - if (PixMon::HasComponent(m_config, PixMon::LayerIBL2D3DDBM::kB1)) { - num_modules = PixMon::kNumStavesL1 * PixMon::kNumModulesBarrel; - m_histograms.at(4).reset(TH2F_LW::create((name + "_2D_Map_B1").c_str(), (title + ", B1 " + " (Map);LB;Module;" + zlabel).c_str(), - lbRange, -0.5, -0.5 + lbRange, - num_modules, -0.5, -0.5 + num_modules)); - } - if (PixMon::HasComponent(m_config, PixMon::LayerIBL2D3DDBM::kB2)) { - num_modules = PixMon::kNumStavesL2 * PixMon::kNumModulesBarrel; - m_histograms.at(5).reset(TH2F_LW::create((name + "_2D_Map_B2").c_str(), (title + ", B2 " + " (Map);LB;Module;" + zlabel).c_str(), - lbRange, -0.5, -0.5 + lbRange, - num_modules, -0.5, -0.5 + num_modules)); - } - if (PixMon::HasComponent(m_config, PixMon::LayerIBL2D3DDBM::kECA)) { - num_modules = PixMon::kNumLayersDisk * PixMon::kNumModulesDisk; - m_histograms.at(6).reset(TH2F_LW::create((name + "_2D_Map_ECA").c_str(), (title + ", ECA " + " (Map);LB;Module;" + zlabel).c_str(), - lbRange, -0.5, -0.5 + lbRange, - num_modules, -0.5, -0.5 + num_modules)); - } - if (PixMon::HasComponent(m_config, PixMon::LayerIBL2D3DDBM::kECC)) { - num_modules = PixMon::kNumLayersDisk * PixMon::kNumModulesDisk; - m_histograms.at(7).reset(TH2F_LW::create((name + "_2D_Map_ECC").c_str(), (title + ", ECC " + " (Map);LB;Module;" + zlabel).c_str(), - lbRange, -0.5, -0.5 + lbRange, - num_modules, -0.5, -0.5 + num_modules)); - } - if (PixMon::HasComponent(m_config, PixMon::LayerIBL2D3DDBM::kDBMA)) { - num_modules = PixMon::kNumLayersDBM * PixMon::kNumModulesDBM; - m_histograms.at(8).reset(TH2F_LW::create((name + "_2D_Map_DBMA").c_str(), (title + ", DBMA " + " (Map);LB;Module;" + zlabel).c_str(), - lbRange, -0.5, -0.5 + lbRange, - num_modules, -0.5, -0.5 + num_modules)); - } - if (PixMon::HasComponent(m_config, PixMon::LayerIBL2D3DDBM::kDBMC)) { - num_modules = PixMon::kNumLayersDBM * PixMon::kNumModulesDBM; - m_histograms.at(9).reset(TH2F_LW::create((name + "_2D_Map_DBMC").c_str(), (title + ", DBMC " + " (Map);LB;Module;" + zlabel).c_str(), - lbRange, -0.5, -0.5 + lbRange, - num_modules, -0.5, -0.5 + num_modules)); - } - - setHistogramPointers(); - formatHist(); -} - -void PixelMon2DLumiMaps::fill(double LB, Identifier& id, const PixelID* pixID, float weight) { - const int bec = pixID->barrel_ec(id); - const int pm = pixID->phi_module(id); - int ld = pixID->layer_disk(id); - - if (bec == 2 && A) { - A->Fill(LB, ld * 48 + pm, weight); - } else if (bec == -2 && C) { - C->Fill(LB, ld * 48 + pm, weight); - } else if (bec == 4 && DBMA) { - DBMA->Fill(LB, ld * 4 + pm, weight); - } else if (bec == -4 && DBMC) { - DBMC->Fill(LB, ld * 4 + pm, weight); - } else if (bec == 0) { - if (m_doIBL) ld--; - const int em = pixID->eta_module(id) + 6; - if (ld == 0 && B0) { - B0->Fill(LB, em + 13 * pm, weight); - } else if (ld == 1 && B1) { - B1->Fill(LB, em + 13 * pm, weight); - } else if (ld == 2 && B2) { - B2->Fill(LB, em + 13 * pm, weight); - } else if (ld == -1 && IBL) { - IBL->Fill(LB, em + 4 + 20 * pm, weight); - } - } -} - -void PixelMon2DLumiMaps::formatHist() { - std::string label; - unsigned int count = 1; - if (A && C) { - for (unsigned int j = 0; j < PixMon::kNumLayersDisk; ++j) { - for (unsigned int i = 0; i < PixMon::kNumModulesDisk; ++i) { - label = PixMon::LayersDisk.at(j) + "A_" + PixMon::ModulesECA.at(i); - A->GetYaxis()->SetBinLabel(count, label.c_str()); - label = PixMon::LayersDisk.at(j) + "C_" + PixMon::ModulesECC.at(i); - C->GetYaxis()->SetBinLabel(count, label.c_str()); - count++; - } - } - count = 1; - } - if (DBMA && DBMC) { - for (unsigned int j = 0; j < PixMon::kNumLayersDBM; ++j) { - for (unsigned int i = 0; i < PixMon::kNumModulesDBM; ++i) { - label = PixMon::LayersDBM.at(j) + "A_" + PixMon::ModulesDBM.at(i); - DBMA->GetYaxis()->SetBinLabel(count, label.c_str()); - label = PixMon::LayersDBM.at(j) + "C_" + PixMon::ModulesDBM.at(i); - DBMC->GetYaxis()->SetBinLabel(count, label.c_str()); - count++; - } - } - count = 1; - } - if (B0 && B1 && B2) { - for (unsigned int i = 0; i < PixMon::kNumStavesL0; ++i) { - for (unsigned int j = 0; j < PixMon::kNumModulesBarrel; ++j) { - label = "L0_" + PixMon::StavesL0.at(i) + "_" + PixMon::ModulesBarrel.at(j); - B0->GetYaxis()->SetBinLabel(count, label.c_str()); - count++; - } - } - count = 1; - for (unsigned int i = 0; i < PixMon::kNumStavesL1; ++i) { - for (unsigned int j = 0; j < PixMon::kNumModulesBarrel; ++j) { - label = "L1_" + PixMon::StavesL1.at(i) + "_" + PixMon::ModulesBarrel.at(j); - B1->GetYaxis()->SetBinLabel(count, label.c_str()); - count++; - } - } - count = 1; - for (unsigned int i = 0; i < PixMon::kNumStavesL2; ++i) { - for (unsigned int j = 0; j < PixMon::kNumModulesBarrel; ++j) { - label = "L2_" + PixMon::StavesL2.at(i) + "_" + PixMon::ModulesBarrel.at(j); - B2->GetYaxis()->SetBinLabel(count, label.c_str()); - count++; - } - } - count = 1; - } - - if (IBL) { - for (unsigned int i = 0; i < PixMon::kNumStavesIBL; ++i) { - for (unsigned int j = 0; j < PixMon::kNumModulesIBL; ++j) { - label = "IBL_" + PixMon::StavesIBL.at(i) + "_" + PixMon::ModulesIBL.at(j); - IBL->GetYaxis()->SetBinLabel(count, label.c_str()); - count++; - } - } - } - - for (auto& hist : m_histograms) { - if (!hist) continue; - hist->GetYaxis()->SetLabelSize(0.04); - hist->SetOption("colz"); - hist->SetMinimum(0.); - } -} diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelMon2DLumiProfiles.cxx b/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelMon2DLumiProfiles.cxx deleted file mode 100644 index 0e445c0b918e1f3dc12887cb4da47cac9223a184..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelMon2DLumiProfiles.cxx +++ /dev/null @@ -1,173 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/////////////////////////////////////////////////////////////////////////////// -// Function to handle 2D maps of modules, one for each region -/////////////////////////////////////////////////////////////////////////////// - -#include "PixelMonitoring/PixelMon2DLumiProfiles.h" -#include <string.h> -#include "GaudiKernel/StatusCode.h" -#include "InDetIdentifier/PixelID.h" -#include "LWHists/TProfile2D_LW.h" -#include "PixelMonitoring/Components.h" - -PixelMon2DLumiProfiles::PixelMon2DLumiProfiles(std::string name, std::string title, std::string zlabel, const PixMon::HistConf& config) - : HolderTemplate<TProfile2D_LW>(config) { - const int lbRange = 3000; - int num_modules; - if (m_doIBL && PixMon::HasComponent(m_config, PixMon::LayerIBL2D3DDBM::kIBL)) { - num_modules = PixMon::kNumStavesIBL * (PixMon::kNumModulesIBL2D + PixMon::kNumModulesIBL3D); - m_histograms.at(0).reset(TProfile2D_LW::create((name + "_2D_Profile_IBL").c_str(), (title + ", IBL " + title + " (Profile);LB;Module;" + zlabel).c_str(), - lbRange, -0.5, -0.5 + lbRange, - num_modules, -0.5, -0.5 + num_modules)); - } - if (m_doIBL && PixMon::HasComponent(m_config, PixMon::LayerIBL2D3DDBM::kB0)) { - num_modules = PixMon::kNumStavesL0 * PixMon::kNumModulesBarrel; - m_histograms.at(3).reset(TProfile2D_LW::create((name + "_2D_Profile_B0").c_str(), (title + ", B0 " + title + " (Profile);LB;Module;" + zlabel).c_str(), - lbRange, -0.5, -0.5 + lbRange, - num_modules, -0.5, -0.5 + num_modules)); - } - if (m_doIBL && PixMon::HasComponent(m_config, PixMon::LayerIBL2D3DDBM::kB1)) { - num_modules = PixMon::kNumStavesL1 * PixMon::kNumModulesBarrel; - m_histograms.at(4).reset(TProfile2D_LW::create((name + "_2D_Profile_B1").c_str(), (title + ", B1 " + title + " (Profile);LB;Module;" + zlabel).c_str(), - lbRange, -0.5, -0.5 + lbRange, - num_modules, -0.5, -0.5 + num_modules)); - } - if (m_doIBL && PixMon::HasComponent(m_config, PixMon::LayerIBL2D3DDBM::kB2)) { - num_modules = PixMon::kNumStavesL2 * PixMon::kNumModulesBarrel; - m_histograms.at(5).reset(TProfile2D_LW::create((name + "_2D_Profile_B2").c_str(), (title + ", B2 " + title + " (Profile);LB;Module;" + zlabel).c_str(), - lbRange, -0.5, -0.5 + lbRange, - num_modules, -0.5, -0.5 + num_modules)); - } - if (m_doIBL && PixMon::HasComponent(m_config, PixMon::LayerIBL2D3DDBM::kECA)) { - num_modules = PixMon::kNumLayersDisk * PixMon::kNumModulesDisk; - m_histograms.at(6).reset(TProfile2D_LW::create((name + "_2D_Profile_ECA").c_str(), (title + ", ECA " + title + " (Profile);LB;Module;" + zlabel).c_str(), - lbRange, -0.5, -0.5 + lbRange, - num_modules, -0.5, -0.5 + num_modules)); - } - if (m_doIBL && PixMon::HasComponent(m_config, PixMon::LayerIBL2D3DDBM::kECC)) { - num_modules = PixMon::kNumLayersDisk * PixMon::kNumModulesDisk; - m_histograms.at(7).reset(TProfile2D_LW::create((name + "_2D_Profile_ECC").c_str(), (title + ", ECC " + title + " (Profile);LB;Module;" + zlabel).c_str(), - lbRange, -0.5, -0.5 + lbRange, - num_modules, -0.5, -0.5 + num_modules)); - } - if (PixMon::HasComponent(m_config, PixMon::LayerIBL2D3DDBM::kDBMA)) { - num_modules = PixMon::kNumLayersDBM * PixMon::kNumModulesDBM; - m_histograms.at(8).reset(TProfile2D_LW::create((name + "_2D_Profile_DBMA").c_str(), (title + ", DBMA " + title + " (Profile);LB;Module;" + zlabel).c_str(), - lbRange, -0.5, -0.5 + lbRange, - num_modules, -0.5, -0.5 + num_modules)); - } - if (PixMon::HasComponent(m_config, PixMon::LayerIBL2D3DDBM::kDBMC)) { - num_modules = PixMon::kNumLayersDBM * PixMon::kNumModulesDBM; - m_histograms.at(9).reset(TProfile2D_LW::create((name + "_2D_Profile_DBMC").c_str(), (title + ", DBMC " + title + " (Profile);LB;Module;" + zlabel).c_str(), - lbRange, -0.5, -0.5 + lbRange, - num_modules, -0.5, -0.5 + num_modules)); - } - - setHistogramPointers(); - formatHist(); -} - -void PixelMon2DLumiProfiles::fill(double LB, Identifier& id, const PixelID* pixID, double weight) { - const int bec = pixID->barrel_ec(id); - const int pm = pixID->phi_module(id); - int ld = pixID->layer_disk(id); - - if (bec == 2 && A) { - A->Fill(LB, ld * 48 + pm, weight); - } else if (bec == -2 && C) { - C->Fill(LB, ld * 48 + pm, weight); - } else if (bec == 4 && DBMA) { - DBMA->Fill(LB, ld * 4 + pm, weight); - } else if (bec == -4 && DBMC) { - DBMC->Fill(LB, ld * 4 + pm, weight); - } else if (bec == 0) { - if (m_doIBL) ld--; - const int em = pixID->eta_module(id) + 6; - if (ld == 0 && B0) { - B0->Fill(LB, em + 13 * pm, weight); - } else if (ld == 1 && B1) { - B1->Fill(LB, em + 13 * pm, weight); - } else if (ld == 2 && B2) { - B2->Fill(LB, em + 13 * pm, weight); - } else if (ld == -1 && IBL) { - IBL->Fill(LB, em + 4 + 20 * pm, weight); - } - } -} - -void PixelMon2DLumiProfiles::formatHist() { - std::string label; - unsigned int count = 1; - if (A && C) { - for (unsigned int j = 0; j < PixMon::kNumLayersDisk; ++j) { - for (unsigned int i = 0; i < PixMon::kNumModulesDisk; ++i) { - label = PixMon::LayersDisk.at(j) + "A_" + PixMon::ModulesECA.at(i); - A->GetYaxis()->SetBinLabel(count, label.c_str()); - label = PixMon::LayersDisk.at(j) + "C_" + PixMon::ModulesECC.at(i); - C->GetYaxis()->SetBinLabel(count, label.c_str()); - count++; - } - } - count = 1; - } - if (DBMA && DBMC) { - for (unsigned int j = 0; j < PixMon::kNumLayersDBM; ++j) { - for (unsigned int i = 0; i < PixMon::kNumModulesDBM; ++i) { - label = PixMon::LayersDBM.at(j) + "A_" + PixMon::ModulesDBM.at(i); - DBMA->GetYaxis()->SetBinLabel(count, label.c_str()); - label = PixMon::LayersDBM.at(j) + "C_" + PixMon::ModulesDBM.at(i); - DBMC->GetYaxis()->SetBinLabel(count, label.c_str()); - count++; - } - } - count = 1; - } - if (B0 && B1 && B2) { - for (unsigned int i = 0; i < PixMon::kNumStavesL0; ++i) { - for (unsigned int j = 0; j < PixMon::kNumModulesBarrel; ++j) { - label = "L0_" + PixMon::StavesL0.at(i) + "_" + PixMon::ModulesBarrel.at(j); - B0->GetYaxis()->SetBinLabel(count, label.c_str()); - count++; - } - } - count = 1; - for (unsigned int i = 0; i < PixMon::kNumStavesL1; ++i) { - for (unsigned int j = 0; j < PixMon::kNumModulesBarrel; ++j) { - label = "L1_" + PixMon::StavesL1.at(i) + "_" + PixMon::ModulesBarrel.at(j); - B1->GetYaxis()->SetBinLabel(count, label.c_str()); - count++; - } - } - count = 1; - for (unsigned int i = 0; i < PixMon::kNumStavesL2; ++i) { - for (unsigned int j = 0; j < PixMon::kNumModulesBarrel; ++j) { - label = "L2_" + PixMon::StavesL2.at(i) + "_" + PixMon::ModulesBarrel.at(j); - B2->GetYaxis()->SetBinLabel(count, label.c_str()); - count++; - } - } - count = 1; - } - if (IBL) { - for (unsigned int i = 0; i < PixMon::kNumStavesIBL; ++i) { - for (unsigned int j = 0; j < PixMon::kNumModulesIBL; ++j) { - label = "IBL_" + PixMon::StavesIBL.at(i) + "_" + PixMon::ModulesIBL.at(j); - IBL->GetYaxis()->SetBinLabel(count, label.c_str()); - count++; - } - } - } - - for (auto& hist : m_histograms) { - if (!hist) continue; - if (hist.get() == A || hist.get() == C) { - hist->GetYaxis()->SetLabelSize(0.02); - } else { - hist->GetYaxis()->SetLabelSize(0.03); - } - hist->SetOption("colz"); - } -} diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelMon2DMapsLW.cxx b/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelMon2DMapsLW.cxx deleted file mode 100644 index e866cecdac14d82a1ec7d9b08ee52cd1f699df35..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelMon2DMapsLW.cxx +++ /dev/null @@ -1,207 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -////////////////////////////////////////////////////////////////////////////// -// Function to handle 2D maps of modules, one for each region -/////////////////////////////////////////////////////////////////////////////// - -#include "PixelMonitoring/PixelMon2DMapsLW.h" -#include <string.h> -#include "GaudiKernel/StatusCode.h" -#include "InDetIdentifier/PixelID.h" -#include "LWHists/TH2F_LW.h" -#include "PixelMonitoring/Components.h" - -PixelMon2DMapsLW::PixelMon2DMapsLW(std::string name, std::string title, const PixMon::HistConf& config, bool copy2DFEval) - : HolderTemplate<TH2F_LW>(config, copy2DFEval) { - std::string setatext = ";shifted eta index of module"; - std::string etatext = ";eta index of module"; - std::string phitext = ";phi index of module"; - std::string disktext = ";disk number"; - std::string layertext = ";layer number"; - - if (m_doIBL && PixMon::HasComponent(m_config, PixMon::LayerIBL2D3DDBM::kIBL)) { - m_histograms.at(0).reset(TH2F_LW::create((name + "_IBL").c_str(), (title + ", IBL " + setatext + phitext).c_str(), - PixMon::kNumModulesIBL, -16.5, -16.5 + PixMon::kNumModulesIBL, - PixMon::kNumStavesIBL, -0.5, -0.5 + PixMon::kNumStavesIBL)); - } - if (m_doIBL && PixMon::HasComponent(m_config, PixMon::LayerIBL2D3DDBM::kIBL2D)) { - m_histograms.at(1).reset(TH2F_LW::create((name + "_IBL2D").c_str(), (title + ", IBL planar modules " + setatext + phitext).c_str(), - PixMon::kNumModulesIBL2D, -6.5, -6.5 + PixMon::kNumModulesIBL2D, - PixMon::kNumStavesIBL, -0.5, -0.5 + PixMon::kNumStavesIBL)); - } - if (m_doIBL && PixMon::HasComponent(m_config, PixMon::LayerIBL2D3DDBM::kIBL3D)) { - m_histograms.at(2).reset(TH2F_LW::create((name + "_IBL3D").c_str(), (title + ", IBL 3D modules " + etatext + phitext).c_str(), - PixMon::kNumModulesIBL3D, -0.5, -0.5 + PixMon::kNumModulesIBL3D, - PixMon::kNumStavesIBL, -0.5, -0.5 + PixMon::kNumStavesIBL)); - } - if (PixMon::HasComponent(m_config, PixMon::LayerIBL2D3DDBM::kB0)) { - m_histograms.at(3).reset(TH2F_LW::create((name + "_B0").c_str(), (title + ", B0 " + etatext + phitext).c_str(), - PixMon::kNumModulesBarrel, -6.5, -6.5 + PixMon::kNumModulesBarrel, - PixMon::kNumStavesL0, -0.5, -0.5 + PixMon::kNumStavesL0)); - } - if (PixMon::HasComponent(m_config, PixMon::LayerIBL2D3DDBM::kB1)) { - m_histograms.at(4).reset(TH2F_LW::create((name + "_B1").c_str(), (title + ", B1 " + etatext + phitext).c_str(), - PixMon::kNumModulesBarrel, -6.5, -6.5 + PixMon::kNumModulesBarrel, - PixMon::kNumStavesL1, -0.5, -0.5 + PixMon::kNumStavesL1)); - } - if (PixMon::HasComponent(m_config, PixMon::LayerIBL2D3DDBM::kB2)) { - m_histograms.at(5).reset(TH2F_LW::create((name + "_B2").c_str(), (title + ", B2 " + etatext + phitext).c_str(), - PixMon::kNumModulesBarrel, -6.5, -6.5 + PixMon::kNumModulesBarrel, - PixMon::kNumStavesL2, -0.5, -0.5 + PixMon::kNumStavesL2)); - } - if (PixMon::HasComponent(m_config, PixMon::LayerIBL2D3DDBM::kECA)) { - m_histograms.at(6).reset(TH2F_LW::create((name + "_ECA").c_str(), (title + ", ECA " + disktext + phitext).c_str(), - PixMon::kNumLayersDisk, -0.5, -0.5 + PixMon::kNumLayersDisk, - PixMon::kNumModulesDisk, -0.5, -0.5 + PixMon::kNumModulesDisk)); - } - if (PixMon::HasComponent(m_config, PixMon::LayerIBL2D3DDBM::kECC)) { - m_histograms.at(7).reset(TH2F_LW::create((name + "_ECC").c_str(), (title + ", ECC " + disktext + phitext).c_str(), - PixMon::kNumLayersDisk, -0.5, -0.5 + PixMon::kNumLayersDisk, - PixMon::kNumModulesDisk, -0.5, -0.5 + PixMon::kNumModulesDisk)); - } - if (PixMon::HasComponent(m_config, PixMon::LayerIBL2D3DDBM::kDBMA)) { - m_histograms.at(8).reset(TH2F_LW::create((name + "_DBMA").c_str(), (title + ", DBMA " + layertext + phitext).c_str(), - PixMon::kNumLayersDBM, -0.5, -0.5 + PixMon::kNumLayersDBM, - PixMon::kNumModulesDBM, -0.5, -0.5 + PixMon::kNumModulesDBM)); - } - if (PixMon::HasComponent(m_config, PixMon::LayerIBL2D3DDBM::kDBMC)) { - m_histograms.at(9).reset(TH2F_LW::create((name + "_DBMC").c_str(), (title + ", DBMC " + layertext + phitext).c_str(), - PixMon::kNumLayersDBM, -0.5, -0.5 + PixMon::kNumLayersDBM, - PixMon::kNumModulesDBM, -0.5, -0.5 + PixMon::kNumModulesDBM)); - } - - setHistogramPointers(); - formatHist(); -} - -void PixelMon2DMapsLW::fill(Identifier& id, const PixelID* pixID, float weight) { - const int bec = pixID->barrel_ec(id); - const int pm = pixID->phi_module(id); - int ld = pixID->layer_disk(id); - - if (bec == 2 && A) { - A->Fill(ld, pm, weight); - } else if (bec == -2 && C) { - C->Fill(ld, pm, weight); - } else if (bec == 4 && DBMA) { - DBMA->Fill(ld, pm, weight); - } else if (bec == -4 && DBMC) { - DBMC->Fill(ld, pm, weight); - } else if (bec == 0) { - if (m_doIBL) ld--; - const int em = pixID->eta_module(id); - if (ld == 0 && B0) { - B0->Fill(em, pm, weight); - } else if (ld == 1 && B1) { - B1->Fill(em, pm, weight); - } else if (ld == 2 && B2) { - B2->Fill(em, pm, weight); - } else if (ld == -1 && IBL) { - int feid = 0; - int emf = 0; - bool copy = false; - if (em < 6 && em > -7) { - if (pixID->eta_index(id) >= 80) feid = 1; - emf = 2 * em + feid; - if (IBL2D) IBL2D->Fill(em, pm, weight); - copy = true; - } else if (em < -6) { - emf = em - 6; - if (IBL3D) IBL3D->Fill(em + 10, pm, weight); - } else { - emf = em + 6; - if (IBL3D) IBL3D->Fill(em - 2, pm, weight); - } - IBL->Fill(emf, pm, weight); - if (m_copy2DFEval && copy) IBL->Fill(emf + 1, pm, weight); - } - } -} - -void PixelMon2DMapsLW::fill2DMon(PixelMon2DMapsLW* oldmap) { - for (unsigned int index = 0; index < m_histograms.size(); ++index) { - auto& hist = m_histograms.at(index); - auto& oldhist = oldmap->m_histograms.at(index); - if (!hist) continue; - if (!oldhist) continue; - for (unsigned int x = 1; x <= hist->GetNbinsX(); ++x) { - for (unsigned int y = 1; y <= hist->GetNbinsY(); ++y) { - const auto content = oldhist->GetBinContent(x, y); - hist->SetBinContent(x, y, content); - oldhist->SetBinContent(x, y, 0); - } - } - } -} - -void PixelMon2DMapsLW::formatHist() { - if (A && C) { - for (unsigned int i = 0; i < PixMon::kNumModulesDisk; ++i) { - A->GetYaxis()->SetBinLabel(i + 1, PixMon::ModulesECA.at(i).c_str()); - C->GetYaxis()->SetBinLabel(i + 1, PixMon::ModulesECC.at(i).c_str()); - } - for (unsigned int i = 0; i < PixMon::kNumLayersDisk; ++i) { - A->GetXaxis()->SetBinLabel(i + 1, PixMon::LayersDisk.at(i).c_str()); - C->GetXaxis()->SetBinLabel(i + 1, PixMon::LayersDisk.at(i).c_str()); - } - } - if (DBMA && DBMC) { - for (unsigned int i = 0; i < PixMon::kNumModulesDBM; ++i) { - DBMA->GetYaxis()->SetBinLabel(i + 1, PixMon::ModulesDBM.at(i).c_str()); - DBMC->GetYaxis()->SetBinLabel(i + 1, PixMon::ModulesDBM.at(i).c_str()); - } - for (unsigned int i = 0; i < PixMon::kNumLayersDBM; ++i) { - DBMA->GetXaxis()->SetBinLabel(i + 1, PixMon::LayersDBM.at(i).c_str()); - DBMC->GetXaxis()->SetBinLabel(i + 1, PixMon::LayersDBM.at(i).c_str()); - } - } - if (B0 && B1 && B2) { - for (unsigned int i = 0; i < PixMon::kNumModulesBarrel; ++i) { - B0->GetXaxis()->SetBinLabel(i + 1, PixMon::ModulesBarrel.at(i).c_str()); - B1->GetXaxis()->SetBinLabel(i + 1, PixMon::ModulesBarrel.at(i).c_str()); - B2->GetXaxis()->SetBinLabel(i + 1, PixMon::ModulesBarrel.at(i).c_str()); - } - for (unsigned int i = 0; i < PixMon::kNumStavesL0; ++i) { - B0->GetYaxis()->SetBinLabel(i + 1, PixMon::StavesL0.at(i).c_str()); - } - for (unsigned int i = 0; i < PixMon::kNumStavesL1; ++i) { - B1->GetYaxis()->SetBinLabel(i + 1, PixMon::StavesL1.at(i).c_str()); - } - for (unsigned int i = 0; i < PixMon::kNumStavesL2; ++i) { - B2->GetYaxis()->SetBinLabel(i + 1, PixMon::StavesL2.at(i).c_str()); - } - } - if (IBL) { - for (unsigned int i = 0; i < PixMon::kNumModulesIBL; ++i) { - IBL->GetXaxis()->SetBinLabel(i + 1, PixMon::ModulesIBL.at(i).c_str()); - } - for (unsigned int i = 0; i < PixMon::kNumStavesIBL; ++i) { - IBL->GetYaxis()->SetBinLabel(i + 1, PixMon::StavesIBL.at(i).c_str()); - } - } - if (IBL2D && IBL3D) { - for (unsigned int i = 0; i < PixMon::kNumModulesIBL2D; ++i) { - IBL2D->GetXaxis()->SetBinLabel(i + 1, PixMon::ModulesIBL2D.at(i).c_str()); - } - for (unsigned int i = 0; i < PixMon::kNumModulesIBL3D; ++i) { - IBL3D->GetXaxis()->SetBinLabel(i + 1, PixMon::ModulesIBL3D.at(i).c_str()); - } - for (unsigned int i = 0; i < PixMon::kNumStavesIBL; ++i) { - IBL2D->GetYaxis()->SetBinLabel(i + 1, PixMon::StavesIBL.at(i).c_str()); - IBL3D->GetYaxis()->SetBinLabel(i + 1, PixMon::StavesIBL.at(i).c_str()); - } - } - - for (auto& hist : m_histograms) { - if (!hist) continue; - if (hist.get() == A || hist.get() == C) { - hist->GetYaxis()->SetLabelSize(0.02); - } else { - hist->GetYaxis()->SetLabelSize(0.03); - } - hist->SetOption("colz"); - hist->SetMinimum(0.); - } -} diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelMon2DProfilesLW.cxx b/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelMon2DProfilesLW.cxx deleted file mode 100644 index 9fc9119f20b972066597cdc87c8b9baf8b5997d2..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelMon2DProfilesLW.cxx +++ /dev/null @@ -1,247 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/////////////////////////////////////////////////////////////////////////////// -// Function to handle 2D profile histograms of modules, one for each region -/////////////////////////////////////////////////////////////////////////////// - -#include "PixelMonitoring/PixelMon2DProfilesLW.h" -#include <string.h> -#include "GaudiKernel/StatusCode.h" -#include "InDetIdentifier/PixelID.h" -#include "LWHists/TH2F_LW.h" -#include "LWHists/TProfile2D_LW.h" -#include "PixelMonitoring/Components.h" -#include "PixelMonitoring/PixelMon2DMapsLW.h" - -PixelMon2DProfilesLW::PixelMon2DProfilesLW(std::string name, std::string title, const PixMon::HistConf& config, bool copy2DFEval) - : HolderTemplate<TProfile2D_LW>(config, copy2DFEval) { - std::string setatext = ";shifted eta index of module"; - std::string etatext = ";eta index of module"; - std::string phitext = ";phi index of module"; - std::string disktext = ";disk number"; - std::string layertext = ";layer number"; - - if (m_doIBL && PixMon::HasComponent(m_config, PixMon::LayerIBL2D3DDBM::kIBL)) { - m_histograms.at(0).reset(TProfile2D_LW::create((name + "_IBL").c_str(), (title + ", IBL " + setatext + phitext).c_str(), - PixMon::kNumModulesIBL, -16.5, -16.5 + PixMon::kNumModulesIBL, - PixMon::kNumStavesIBL, -0.5, -0.5 + PixMon::kNumStavesIBL)); - } - if (m_doIBL && PixMon::HasComponent(m_config, PixMon::LayerIBL2D3DDBM::kIBL2D)) { - m_histograms.at(1).reset(TProfile2D_LW::create((name + "_IBL2D").c_str(), (title + ", IBL planar modules " + setatext + phitext).c_str(), - PixMon::kNumModulesIBL2D, -6.5, -6.5 + PixMon::kNumModulesIBL2D, - PixMon::kNumStavesIBL, -0.5, -0.5 + PixMon::kNumStavesIBL)); - } - if (m_doIBL && PixMon::HasComponent(m_config, PixMon::LayerIBL2D3DDBM::kIBL3D)) { - m_histograms.at(2).reset(TProfile2D_LW::create((name + "_IBL3D").c_str(), (title + ", IBL 3D modules " + etatext + phitext).c_str(), - PixMon::kNumModulesIBL3D, -.5, -.5 + PixMon::kNumModulesIBL3D, - PixMon::kNumStavesIBL, -0.5, -0.5 + PixMon::kNumStavesIBL)); - } - if (PixMon::HasComponent(m_config, PixMon::LayerIBL2D3DDBM::kB0)) { - m_histograms.at(3).reset(TProfile2D_LW::create((name + "_B0").c_str(), (title + ", B0 " + etatext + phitext).c_str(), - PixMon::kNumModulesBarrel, -6.5, -6.5 + PixMon::kNumModulesBarrel, - PixMon::kNumStavesL0, -0.5, -0.5 + PixMon::kNumStavesL0)); - } - if (PixMon::HasComponent(m_config, PixMon::LayerIBL2D3DDBM::kB1)) { - m_histograms.at(4).reset(TProfile2D_LW::create((name + "_B1").c_str(), (title + ", B1 " + etatext + phitext).c_str(), - PixMon::kNumModulesBarrel, -6.5, -6.5 + PixMon::kNumModulesBarrel, - PixMon::kNumStavesL1, -0.5, -0.5 + PixMon::kNumStavesL1)); - } - if (PixMon::HasComponent(m_config, PixMon::LayerIBL2D3DDBM::kB2)) { - m_histograms.at(5).reset(TProfile2D_LW::create((name + "_B2").c_str(), (title + ", B2 " + etatext + phitext).c_str(), - PixMon::kNumModulesBarrel, -6.5, -6.5 + PixMon::kNumModulesBarrel, - PixMon::kNumStavesL2, -0.5, -0.5 + PixMon::kNumStavesL2)); - } - if (PixMon::HasComponent(m_config, PixMon::LayerIBL2D3DDBM::kECA)) { - m_histograms.at(6).reset(TProfile2D_LW::create((name + "_ECA").c_str(), (title + ", ECA " + disktext + phitext).c_str(), - PixMon::kNumLayersDisk, -0.5, -0.5 + PixMon::kNumLayersDisk, - PixMon::kNumModulesDisk, -0.5, -0.5 + PixMon::kNumModulesDisk)); - } - if (PixMon::HasComponent(m_config, PixMon::LayerIBL2D3DDBM::kECC)) { - m_histograms.at(7).reset(TProfile2D_LW::create((name + "_ECC").c_str(), (title + ", ECC " + disktext + phitext).c_str(), - PixMon::kNumLayersDisk, -0.5, -0.5 + PixMon::kNumLayersDisk, - PixMon::kNumModulesDisk, -0.5, -0.5 + PixMon::kNumModulesDisk)); - } - if (PixMon::HasComponent(m_config, PixMon::LayerIBL2D3DDBM::kDBMA)) { - m_histograms.at(8).reset(TProfile2D_LW::create((name + "_DBMA").c_str(), (title + ", DBMA " + layertext + phitext).c_str(), - PixMon::kNumLayersDBM, -0.5, -0.5 + PixMon::kNumLayersDBM, - PixMon::kNumModulesDBM, -0.5, -0.5 + PixMon::kNumModulesDBM)); - } - if (PixMon::HasComponent(m_config, PixMon::LayerIBL2D3DDBM::kDBMC)) { - m_histograms.at(9).reset(TProfile2D_LW::create((name + "_DBMC").c_str(), (title + ", DBMC " + layertext + phitext).c_str(), - PixMon::kNumLayersDBM, -0.5, -0.5 + PixMon::kNumLayersDBM, - PixMon::kNumModulesDBM, -0.5, -0.5 + PixMon::kNumModulesDBM)); - } - - setHistogramPointers(); - formatHist(); -} - -void PixelMon2DProfilesLW::setMaxValue(float max) { - for (auto& hist : m_histograms) { - if (hist) hist->SetMaximum(max); - } -} - -void PixelMon2DProfilesLW::reset() { - for (auto& hist : m_histograms) { - if (hist) hist->Reset(); - } -} - -void PixelMon2DProfilesLW::fill(Identifier& id, const PixelID* pixID, float weight) { - const int bec = pixID->barrel_ec(id); - const int pm = pixID->phi_module(id); - int ld = pixID->layer_disk(id); - - if (bec == 2 && A) { - A->Fill(ld, pm, weight); - } else if (bec == -2 && C) { - C->Fill(ld, pm, weight); - } else if (bec == 4 && DBMA) { - DBMA->Fill(ld, pm, weight); - } else if (bec == -4 && DBMC) { - DBMC->Fill(ld, pm, weight); - } else if (bec == 0) { - if (m_doIBL) ld--; - const int em = pixID->eta_module(id); - if (ld == 0 && B0) { - B0->Fill(em, pm, weight); - } else if (ld == 1 && B1) { - B1->Fill(em, pm, weight); - } else if (ld == 2 && B2) { - B2->Fill(em, pm, weight); - } else if (ld == -1 && IBL) { - int feid = 0; - int emf = 0; - bool copy = false; - if (em < 6 && em > -7) { - if (pixID->eta_index(id) >= 80) feid = 1; - emf = 2 * em + feid; - if (IBL2D) IBL2D->Fill(em, pm, weight); - copy = true; - } else if (em < -6) { - emf = em - 6; - if (IBL3D) IBL3D->Fill(em + 10, pm, weight); - } else { - emf = em + 6; - if (IBL3D) IBL3D->Fill(em - 2, pm, weight); - } - IBL->Fill(emf, pm, weight); - if (m_copy2DFEval && copy) IBL->Fill(emf + 1, pm, weight); - } - } -} - -void PixelMon2DProfilesLW::formatHist() { - if (A && C) { - for (unsigned int i = 0; i < PixMon::kNumModulesDisk; ++i) { - A->GetYaxis()->SetBinLabel(i + 1, PixMon::ModulesECA.at(i).c_str()); - C->GetYaxis()->SetBinLabel(i + 1, PixMon::ModulesECC.at(i).c_str()); - } - for (unsigned int i = 0; i < PixMon::kNumLayersDisk; ++i) { - A->GetXaxis()->SetBinLabel(i + 1, PixMon::LayersDisk.at(i).c_str()); - C->GetXaxis()->SetBinLabel(i + 1, PixMon::LayersDisk.at(i).c_str()); - } - } - if (DBMA && DBMC) { - for (unsigned int i = 0; i < PixMon::kNumModulesDBM; ++i) { - DBMA->GetYaxis()->SetBinLabel(i + 1, PixMon::ModulesDBM.at(i).c_str()); - DBMC->GetYaxis()->SetBinLabel(i + 1, PixMon::ModulesDBM.at(i).c_str()); - } - for (unsigned int i = 0; i < PixMon::kNumLayersDBM; ++i) { - DBMA->GetXaxis()->SetBinLabel(i + 1, PixMon::LayersDBM.at(i).c_str()); - DBMC->GetXaxis()->SetBinLabel(i + 1, PixMon::LayersDBM.at(i).c_str()); - } - } - if (B0 && B1 && B2) { - for (unsigned int i = 0; i < PixMon::kNumModulesBarrel; ++i) { - B0->GetXaxis()->SetBinLabel(i + 1, PixMon::ModulesBarrel.at(i).c_str()); - B1->GetXaxis()->SetBinLabel(i + 1, PixMon::ModulesBarrel.at(i).c_str()); - B2->GetXaxis()->SetBinLabel(i + 1, PixMon::ModulesBarrel.at(i).c_str()); - } - for (unsigned int i = 0; i < PixMon::kNumStavesL0; ++i) { - B0->GetYaxis()->SetBinLabel(i + 1, PixMon::StavesL0.at(i).c_str()); - } - for (unsigned int i = 0; i < PixMon::kNumStavesL1; ++i) { - B1->GetYaxis()->SetBinLabel(i + 1, PixMon::StavesL1.at(i).c_str()); - } - for (unsigned int i = 0; i < PixMon::kNumStavesL2; ++i) { - B2->GetYaxis()->SetBinLabel(i + 1, PixMon::StavesL2.at(i).c_str()); - } - } - if (IBL) { - for (unsigned int i = 0; i < PixMon::kNumModulesIBL; ++i) { - IBL->GetXaxis()->SetBinLabel(i + 1, PixMon::ModulesIBL.at(i).c_str()); - } - for (unsigned int i = 0; i < PixMon::kNumStavesIBL; ++i) { - IBL->GetYaxis()->SetBinLabel(i + 1, PixMon::StavesIBL.at(i).c_str()); - } - } - if (IBL2D && IBL3D) { - for (unsigned int i = 0; i < PixMon::kNumModulesIBL2D; ++i) { - IBL2D->GetXaxis()->SetBinLabel(i + 1, PixMon::ModulesIBL2D.at(i).c_str()); - } - for (unsigned int i = 0; i < PixMon::kNumModulesIBL3D; ++i) { - IBL3D->GetXaxis()->SetBinLabel(i + 1, PixMon::ModulesIBL3D.at(i).c_str()); - } - for (unsigned int i = 0; i < PixMon::kNumStavesIBL; ++i) { - IBL2D->GetYaxis()->SetBinLabel(i + 1, PixMon::StavesIBL.at(i).c_str()); - IBL3D->GetYaxis()->SetBinLabel(i + 1, PixMon::StavesIBL.at(i).c_str()); - } - } - - for (auto& hist : m_histograms) { - if (!hist) continue; - if (hist.get() == A || hist.get() == C) { - hist->GetYaxis()->SetLabelSize(0.02); - } else { - hist->GetYaxis()->SetLabelSize(0.03); - } - hist->SetOption("colz"); - hist->SetMinimum(0.); - } -} - -void PixelMon2DProfilesLW::fill2DMon(PixelMon2DProfilesLW* oldmap) { - for (unsigned int index = 0; index < m_histograms.size(); ++index) { - auto& hist = m_histograms.at(index); - auto& oldhist = oldmap->m_histograms.at(index); - if (!hist) continue; - if (!oldhist) continue; - for (unsigned int x = 1; x <= hist->GetNbinsX(); ++x) { - for (unsigned int y = 1; y <= hist->GetNbinsY(); ++y) { - const auto content = oldhist->GetBinContent(x, y); - hist->SetBinContent(x, y, content); - oldhist->SetBinContent(x, y, 0); - } - } - } -} - -void PixelMon2DProfilesLW::fillFromMap(PixelMon2DMapsLW* inputmap, bool clear_inputmap) { - const float weightIBL = 1.0 / 26880.0; - const float weightPixel = 1.0 / 46080.0; - - for (unsigned int index = 0; index < m_histograms.size(); ++index) { - auto& hist = m_histograms.at(index); - auto& map = inputmap->m_histograms.at(index); - if (!hist) continue; - if (!map) continue; - for (unsigned int x = 1; x <= hist->GetNbinsX(); x++) { - for (unsigned int y = 1; y <= hist->GetNbinsY(); y++) { - auto content = map->GetBinContent(x, y); - if (hist.get() == IBL || hist.get() == IBL3D || hist.get() == DBMA || hist.get() == DBMC) { - content *= weightIBL; - } else if (hist.get() == IBL2D) { - content *= weightIBL * 0.5; - } else { - content *= weightPixel; - } - hist->Fill(map->GetXaxis()->GetBinCenter(x), map->GetYaxis()->GetBinCenter(y), content); - } - } - if (clear_inputmap) map->Reset(); - } -} diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelMonModules.cxx b/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelMonModules.cxx deleted file mode 100644 index bf8839aa7ac22f3bc681bd4c43fc878bd40bc119..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelMonModules.cxx +++ /dev/null @@ -1,425 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/////////////////////////////////////////////////////////////////////////////// -// Function to handle 1D module histograms -/////////////////////////////////////////////////////////////////////////////// - -#include "PixelMonitoring/PixelMonModules.h" -#include <string.h> -#include "AthenaMonitoring/ManagedMonitorToolBase.h" -#include "GaudiKernel/StatusCode.h" -#include "InDetIdentifier/PixelID.h" -#include "LWHists/TH1F_LW.h" -#include "LWHists/TProfile_LW.h" - -PixelMonModulesProf::PixelMonModulesProf(std::string name, std::string title, int nbins, double* arr) { - m_nBins = nbins; - for (int i = 0; i < 1744 + 280 * m_doIBL; i++) { - getHist(i) = TProfile_LW::create((getHistName(i, false) + "_" + name).c_str(), - (getHistName(i, false) + " " + title).c_str(), nbins, arr); - } - if (m_doIBL == false) { - for (int i = 1744; i < 2024; i++) { - getHist(i) = nullptr; - } - } - formatHist(""); - m_Dummy = 0; -} - -PixelMonModulesProf::PixelMonModulesProf(std::string name, std::string title, int nbins, double low, double high) { - m_nBins = nbins; - for (int i = 0; i < 1744 + 280 * m_doIBL; i++) { - getHist(i) = TProfile_LW::create((getHistName(i, false) + "_" + name).c_str(), - (getHistName(i, false) + " " + title).c_str(), nbins, low, high); - } - if (m_doIBL == false) { - for (int i = 1744; i < 2024; i++) { - getHist(i) = nullptr; - } - } - formatHist(""); - m_Dummy = 0; -} - -PixelMonModules1D::PixelMonModules1D(std::string name, std::string title, int nbins, double* arr) { - m_nBins = nbins; - for (int i = 0; i < 1744 + 280 * m_doIBL; i++) { - getHist(i) = new TH1F((getHistName(i, false) + "_" + name).c_str(), - (getHistName(i, false) + " " + title).c_str(), nbins, arr); - } - if (m_doIBL == false) { - for (int i = 1744; i < 2024; i++) { - getHist(i) = nullptr; - } - } - formatHist(""); - m_Dummy = 0; -} - -PixelMonModules1D::PixelMonModules1D(std::string name, std::string title, int nbins, double low, double high) { - m_nBins = nbins; - for (int i = 0; i < 1744 + 280 * m_doIBL; i++) { - getHist(i) = new TH1F((getHistName(i, false) + "_" + name).c_str(), - (getHistName(i, false) + " " + title).c_str(), nbins, low, high); - } - if (m_doIBL == false) { - for (int i = 1744; i < 2024; i++) { - getHist(i) = nullptr; - } - } - formatHist(""); - m_Dummy = 0; -} - -PixelMonModules2D::PixelMonModules2D(std::string name, std::string title, int nbins0, double low0, double high0, int nbins1, double low1, double high1) { - m_nBins = nbins0 * nbins1; - for (int i = 0; i < 1744 + 280 * m_doIBL; i++) { - getHist(i) = new TH2F((getHistName(i, false) + "_" + name).c_str(), - (getHistName(i, false) + " " + title).c_str(), - nbins0, low0, high0, nbins1, low1, high1); - } - if (m_doIBL == false) { - for (int i = 1744; i < 2024; i++) { - getHist(i) = nullptr; - } - } - formatHist(""); - m_Dummy = 0; -} - -void PixelMonModulesProf::reset() { - for (int i = 0; i < 2024; i++) { - if (getHist(i)) getHist(i)->Reset(); - } -} - -StatusCode PixelMonModulesProf::regHist(ManagedMonitorToolBase* thisptr, std::string path, ManagedMonitorToolBase::Interval_t Run) { - for (int i = 0; i < 1744 + 280 * m_doIBL; i++) { - ManagedMonitorToolBase::MonGroup mgroup(thisptr, (path + "/" + getHistName(i, true)).c_str(), Run); - if (mgroup.regHist(getHist(i)).isFailure()) { - return StatusCode::FAILURE; - } - } - return StatusCode::SUCCESS; -} - -void PixelMonModules1D::reset() { - for (int i = 0; i < 2024; i++) { - if (getHist(i)) getHist(i)->Reset(); - } -} - -void PixelMonModules2D::reset() { - for (int i = 0; i < 2024; i++) { - if (getHist(i)) getHist(i)->Reset(); - } -} - -void PixelMonModulesProf::fill(double value0, double value1, Identifier& id, const PixelID* pixID) { - const int bec = pixID->barrel_ec(id); - const int pm = pixID->phi_module(id); - int ld = pixID->layer_disk(id); - - if (bec == 2) { - A[ld][pm]->Fill(value0, value1); - } else if (bec == -2) { - C[ld][pm]->Fill(value0, value1); - } else if (bec == 0) { - if (m_doIBL) ld--; - const int em = pixID->eta_module(id); - if (ld == 0) { - B0[em + 6][pm]->Fill(value0, value1); - } else if (ld == 1) { - B1[em + 6][pm]->Fill(value0, value1); - } else if (ld == 2) { - B2[em + 6][pm]->Fill(value0, value1); - } else if (ld == -1) { - IBL[em + 10][pm]->Fill(value0, value1); - } - } -} - -void PixelMonModules2D::fill(double value0, double value1, Identifier& id, const PixelID* pixID, double weight) { - const int bec = pixID->barrel_ec(id); - const int pm = pixID->phi_module(id); - int ld = pixID->layer_disk(id); - - if (bec == 2) { - A[ld][pm]->Fill(value0, value1, weight); - } else if (bec == -2) { - C[ld][pm]->Fill(value0, value1, weight); - } else if (bec == 0) { - if (m_doIBL) ld--; - int em = pixID->eta_module(id); - if (ld == 0) { - B0[em + 6][pm]->Fill(value0, value1, weight); - } else if (ld == 1) { - B1[em + 6][pm]->Fill(value0, value1, weight); - } else if (ld == 2) { - B2[em + 6][pm]->Fill(value0, value1, weight); - } else if (ld == -1) { - IBL[em + 10][pm]->Fill(value0, value1, weight); - } - } -} - -double PixelMonModules1D::getBinContent(double value, Identifier& id, const PixelID* pixID) { - const int bec = pixID->barrel_ec(id); - const int pm = pixID->phi_module(id); - int ld = pixID->layer_disk(id); - - if (bec == 2) { - return A[ld][pm]->GetBinContent(A[ld][pm]->GetXaxis()->FindBin(value)); - } else if (bec == -2) { - return C[ld][pm]->GetBinContent(C[ld][pm]->GetXaxis()->FindBin(value)); - } else if (bec == 0) { - const int em = pixID->eta_module(id); - if (ld == 0) { - return B0[em + 6][pm]->GetBinContent(B0[em + 6][pm]->GetXaxis()->FindBin(value)); - } else if (ld == 1) { - return B1[em + 6][pm]->GetBinContent(B1[em + 6][pm]->GetXaxis()->FindBin(value)); - } else if (ld == 2) { - return B2[em + 6][pm]->GetBinContent(B2[em + 6][pm]->GetXaxis()->FindBin(value)); - } else if (ld == -1) { - return IBL[em + 10][pm]->GetBinContent(IBL[em + 10][pm]->GetXaxis()->FindBin(value)); - } - } - return 0.0; -} - -void PixelMonModules1D::fill(double value, Identifier& id, const PixelID* pixID) { - const int bec = pixID->barrel_ec(id); - const int pm = pixID->phi_module(id); - int ld = pixID->layer_disk(id); - - if (bec == 2) { - A[ld][pm]->Fill(value); - } else if (bec == -2) { - C[ld][pm]->Fill(value); - } else if (bec == 0) { - if (m_doIBL) ld--; - const int em = pixID->eta_module(id); - if (ld == 0) { - B0[em + 6][pm]->Fill(value); - } else if (ld == 1) { - B1[em + 6][pm]->Fill(value); - } else if (ld == 2) { - B2[em + 6][pm]->Fill(value); - } else if (ld == -1) { - IBL[em + 10][pm]->Fill(value); - } - } -} - -StatusCode PixelMonModules1D::regHist(ManagedMonitorToolBase* thisptr, std::string path, ManagedMonitorToolBase::Interval_t Run) { - for (int i = 0; i < 1744 + 280 * m_doIBL; i++) { - ManagedMonitorToolBase::MonGroup mgroup(thisptr, (path + "/" + getHistName(i, true)).c_str(), Run); - if (mgroup.regHist(getHist(i)).isFailure()) { - return StatusCode::FAILURE; - } - } - return StatusCode::SUCCESS; -} - -StatusCode PixelMonModules2D::regHist(ManagedMonitorToolBase* thisptr, std::string path, ManagedMonitorToolBase::Interval_t Run) { - for (int i = 0; i < 1744 + 280 * m_doIBL; i++) { - ManagedMonitorToolBase::MonGroup mgroup(thisptr, (path + "/" + getHistName(i, true)).c_str(), Run); - if (mgroup.regHist(getHist(i)).isFailure()) { - return StatusCode::FAILURE; - } - } - - return StatusCode::SUCCESS; -} - -void PixelMonModules1D::formatHist(std::string opt) { - for (int i = 0; i < 1744 + 280 * m_doIBL; i++) { - if (!opt.compare("status")) getHist(i)->GetXaxis()->SetRangeUser(1., 2.); - getHist(i)->SetMinimum(0); - } -} - -void PixelMonModulesProf::formatHist(std::string /*opt*/) { - for (int i = 0; i < 1744 + 280 * m_doIBL; i++) { - getHist(i)->SetMinimum(0); - } -} - -void PixelMonModules2D::formatHist(std::string /*opt*/) { - for (int i = 0; i < 1744 + 280 * m_doIBL; i++) { - getHist(i)->SetMinimum(0); - getHist(i)->SetOption("colz"); - getHist(i)->SetStats(0.); - } -} - -void PixelMonModules1D::setBinLabel(const char* label, int binN) { - if (binN > m_nBins) return; - for (int i = 0; i < 2024; i++) { - if (getHist(i)) getHist(i)->GetXaxis()->SetBinLabel(binN, label); - } -} - -TProfile_LW*& PixelMonModulesProf::getHist(int i) { - if (i < 286) return B0[i / 22][i % 22]; - i -= 286; - if (i < 494) return B1[i / 38][i % 38]; - i -= 494; - if (i < 676) return B2[i / 52][i % 52]; - i -= 676; - if (i < 144) return A[i / 48][i % 48]; - i -= 144; - if (i < 144) return C[i / 48][i % 48]; - i -= 144; - if (i < 280) return IBL[i / 14][i % 14]; - return m_Dummy; -} - -TH1F*& PixelMonModules1D::getHist(int i) { - if (i < 286) return B0[i / 22][i % 22]; - i -= 286; - if (i < 494) return B1[i / 38][i % 38]; - i -= 494; - if (i < 676) return B2[i / 52][i % 52]; - i -= 676; - if (i < 144) return A[i / 48][i % 48]; - i -= 144; - if (i < 144) return C[i / 48][i % 48]; - i -= 144; - if (i < 280) return IBL[i / 14][i % 14]; - return m_Dummy; -} - -TH2F*& PixelMonModules2D::getHist(int i) { - if (i < 286) return B0[i / 22][i % 22]; - i -= 286; - if (i < 494) return B1[i / 38][i % 38]; - i -= 494; - if (i < 676) return B2[i / 52][i % 52]; - i -= 676; - if (i < 144) return A[i / 48][i % 48]; - i -= 144; - if (i < 144) return C[i / 48][i % 48]; - i -= 144; - if (i < 280) return IBL[i / 14][i % 14]; - return m_Dummy; -} - -std::string PixelMonModules::getHistName(int i, bool forPath) { - const int ndisk = 3; - const int nphi = 48; - const int nmod = 13; - const int nmodIBL = 20; - const int nstaveb = 14; - const int nstave0 = 22; - const int nstave1 = 38; - const int nstave2 = 52; - std::string diskA[ndisk] = {"D1A", "D2A", "D3A"}; - std::string diskC[ndisk] = {"D1C", "D2C", "D3C"}; - std::string barrel[3] = {"L0", "L1", "L2"}; - std::string newbarrel[4] = {"LI", "L0", "L1", "L2"}; - if (forPath) { - diskA[0].replace(diskA[0].begin(), diskA[0].end(), "ECA/Disk1"); - diskA[1].replace(diskA[1].begin(), diskA[1].end(), "ECA/Disk2"); - diskA[2].replace(diskA[2].begin(), diskA[2].end(), "ECA/Disk3"); - diskC[0].replace(diskC[0].begin(), diskC[0].end(), "ECC/Disk1"); - diskC[1].replace(diskC[1].begin(), diskC[1].end(), "ECC/Disk2"); - diskC[2].replace(diskC[2].begin(), diskC[2].end(), "ECC/Disk3"); - } - std::string mod[nmod] = {"M6C", "M5C", "M4C", "M3C", "M2C", "M1C", "M0", - "M1A", "M2A", "M3A", "M4A", "M5A", "M6A"}; - std::string modIBL[nmodIBL] = { - "M4_C8_2", "M4_C8_1", "M4_C7_2", "M4_C7_1", "M3_C6", "M3_C5", "M2_C4", - "M2_C3", "M1_C2", "M1_C1", "M1_A1", "M1_A2", "M2_A3", "M2_A4", - "M3_A5", "M3_A6", "M4_A7_1", "M4_A7_2", "M4_A8_1", "M4_A8_2"}; - std::string staveb[nstaveb] = {"S01", "S02", "S03", "S04", "S05", - "S06", "S07", "S08", "S09", "S10", - "S11", "S12", "S13", "S14"}; - std::string stave0[nstave0] = { - "B11_S2", "B01_S1", "B01_S2", "B02_S1", "B02_S2", "B03_S1", - "B03_S2", "B04_S1", "B04_S2", "B05_S1", "B05_S2", "B06_S1", - "B06_S2", "B07_S1", "B07_S2", "B08_S1", "B08_S2", "B09_S1", - "B09_S2", "B10_S1", "B10_S2", "B11_S1"}; - std::string stave1[nstave1] = { - "B01_S1", "B01_S2", "B02_S1", "B02_S2", "B03_S1", "B03_S2", "B04_S1", - "B04_S2", "B05_S1", "B05_S2", "B06_S1", "B06_S2", "B07_S1", "B07_S2", - "B08_S1", "B08_S2", "B09_S1", "B09_S2", "B10_S1", "B10_S2", "B11_S1", - "B11_S2", "B12_S1", "B12_S2", "B13_S1", "B13_S2", "B14_S1", "B14_S2", - "B15_S1", "B15_S2", "B16_S1", "B16_S2", "B17_S1", "B17_S2", "B18_S1", - "B18_S2", "B19_S1", "B19_S2"}; - std::string stave2[nstave2] = { - "B01_S2", "B02_S1", "B02_S2", "B03_S1", "B03_S2", "B04_S1", "B04_S2", - "B05_S1", "B05_S2", "B06_S1", "B06_S2", "B07_S1", "B07_S2", "B08_S1", - "B08_S2", "B09_S1", "B09_S2", "B10_S1", "B10_S2", "B11_S1", "B11_S2", - "B12_S1", "B12_S2", "B13_S1", "B13_S2", "B14_S1", "B14_S2", "B15_S1", - "B15_S2", "B16_S1", "B16_S2", "B17_S1", "B17_S2", "B18_S1", "B18_S2", - "B19_S1", "B19_S2", "B20_S1", "B20_S2", "B21_S1", "B21_S2", "B22_S1", - "B22_S2", "B23_S1", "B23_S2", "B24_S1", "B24_S2", "B25_S1", "B25_S2", - "B26_S1", "B26_S2", "B01_S1"}; - std::string staveA[nphi] = { - "B01_S2_M1", "B01_S2_M6", "B01_S2_M2", "B01_S2_M5", "B01_S2_M3", - "B01_S2_M4", "B02_S1_M1", "B02_S1_M6", "B02_S1_M2", "B02_S1_M5", - "B02_S1_M3", "B02_S1_M4", "B02_S2_M1", "B02_S2_M6", "B02_S2_M2", - "B02_S2_M5", "B02_S2_M3", "B02_S2_M4", "B03_S1_M1", "B03_S1_M6", - "B03_S1_M2", "B03_S1_M5", "B03_S1_M3", "B03_S1_M4", "B03_S2_M1", - "B03_S2_M6", "B03_S2_M2", "B03_S2_M5", "B03_S2_M3", "B03_S2_M4", - "B04_S1_M1", "B04_S1_M6", "B04_S1_M2", "B04_S1_M5", "B04_S1_M3", - "B04_S1_M4", "B04_S2_M1", "B04_S2_M6", "B04_S2_M2", "B04_S2_M5", - "B04_S2_M3", "B04_S2_M4", "B01_S1_M1", "B01_S1_M6", "B01_S1_M2", - "B01_S1_M5", "B01_S1_M3", "B01_S1_M4"}; - std::string staveC[nphi] = { - "B01_S2_M4", "B01_S2_M3", "B01_S2_M5", "B01_S2_M2", "B01_S2_M6", - "B01_S2_M1", "B02_S1_M4", "B02_S1_M3", "B02_S1_M5", "B02_S1_M2", - "B02_S1_M6", "B02_S1_M1", "B02_S2_M4", "B02_S2_M3", "B02_S2_M5", - "B02_S2_M2", "B02_S2_M6", "B02_S2_M1", "B03_S1_M4", "B03_S1_M3", - "B03_S1_M5", "B03_S1_M2", "B03_S1_M6", "B03_S1_M1", "B03_S2_M4", - "B03_S2_M3", "B03_S2_M5", "B03_S2_M2", "B03_S2_M6", "B03_S2_M1", - "B04_S1_M4", "B04_S1_M3", "B04_S1_M5", "B04_S1_M2", "B04_S1_M6", - "B04_S1_M1", "B04_S2_M4", "B04_S2_M3", "B04_S2_M5", "B04_S2_M2", - "B04_S2_M6", "B04_S2_M1", "B01_S1_M4", "B01_S1_M3", "B01_S1_M5", - "B01_S1_M2", "B01_S1_M6", "B01_S1_M1"}; - - if (forPath) { - std::string joint = "/"; - if (i < 286) return barrel[0] + joint + stave0[i % 22]; - i -= 286; - if (i < 494) return barrel[1] + joint + stave1[i % 38]; - i -= 494; - if (i < 676) return barrel[2] + joint + stave2[i % 52]; - i -= 676; - if (i < 144) return diskA[i / 48]; - i -= 144; - if (i < 144) return diskC[i / 48]; - i -= 144; - if (m_doIBL && i < 280) return newbarrel[0] + joint + staveb[i % 14]; - - } else { - std::string joint = "_"; - if (i < 286) { - return barrel[0] + joint + stave0[i % 22] + joint + mod[i / 22]; - } - i -= 286; - if (i < 494) { - return barrel[1] + joint + stave1[i % 38] + joint + mod[i / 38]; - } - i -= 494; - if (i < 676) { - return barrel[2] + joint + stave2[i % 52] + joint + mod[i / 52]; - } - i -= 676; - if (i < 144) return diskA[i / 48] + joint + staveA[i % 48]; - i -= 144; - if (i < 144) return diskC[i / 48] + joint + staveC[i % 48]; - i -= 144; - if (m_doIBL && i < 280) { - return newbarrel[0] + joint + staveb[i % 14] + joint + modIBL[i / 14]; - } - } - std::string dummy = "wrong initialization"; - return dummy; // should never get here -} - -const bool PixelMonModules::m_doIBL{true}; diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/src/SpacePoints.cxx b/InnerDetector/InDetMonitoring/PixelMonitoring/src/SpacePoints.cxx deleted file mode 100644 index f982eb777c43bd22a1bf97bdef7a4295bebe142e..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetMonitoring/PixelMonitoring/src/SpacePoints.cxx +++ /dev/null @@ -1,99 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/////////////////////////////////////////////////////////////////////////////// -// Book and fill histograms for pixel spacepoints -/////////////////////////////////////////////////////////////////////////////// - -#include <sstream> -#include "InDetIdentifier/PixelID.h" -#include "LWHists/TH1F_LW.h" -#include "LWHists/TH1I_LW.h" -#include "LWHists/TH2F_LW.h" -#include "LWHists/TH2I_LW.h" -#include "PixelMonitoring/PixelMainMon.h" -#include "TH1F.h" -#include "TH1I.h" -#include "TH2F.h" -#include "TH2I.h" -#include "TrkSpacePoint/SpacePointContainer.h" - -#include "GeoPrimitives/GeoPrimitives.h" -#include "PixelMonitoring/PixelMonModules.h" - -/////////////////////////////////////////////////////////////////////////////// -//////////////////////booking methods////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -StatusCode PixelMainMon::bookSpacePointMon(void) { - ATH_MSG_DEBUG("Start booking SpacePoint histogtams.."); - std::string path = "Pixel/SpacePoint"; - if (m_doOnTrack) path.replace(path.begin(), path.end(), "Pixel/SpacePointOnTrack"); - - bool st(true); - MonGroup spacePointHistos(this, path.c_str(), run, ATTRIB_MANAGED); - if (m_doHighOccupancy) { - st &= spacePointHistos.regHist(m_num_spacepoints = TH1I_LW::create("num_spacepoints", ("number of pixel spacepoint hits per event" + m_histTitleExt + ";# spacepoints;# events").c_str(), 100, 0., 25000)).isSuccess(); - } - if (m_doLowOccupancy) { - st &= spacePointHistos.regHist(m_num_spacepoints_low = TH1I_LW::create("num_spacepoints_low_occupancy", ("number of pixel spacepoint hits per event" + m_histTitleExt + ";# spacepoints;# events").c_str(), 100, -0.5, 99.5)).isSuccess(); - } - st &= spacePointHistos.regHist(m_spHit_x = TH1F_LW::create("pixel_sp_x", ("x location of hit" + m_histTitleExt + ";x (mm);# hits").c_str(), 320, -160., 160.)).isSuccess(); - st &= spacePointHistos.regHist(m_spHit_y = TH1F_LW::create("pixel_sp_y", ("y location of hit" + m_histTitleExt + ";y (mm);# hits").c_str(), 320, -160., 160.)).isSuccess(); - st &= spacePointHistos.regHist(m_spHit_z = TH1F_LW::create("pixel_sp_z", ("z location of hit" + m_histTitleExt + ";z (mm);# hits").c_str(), 660, -660., 660.)).isSuccess(); - st &= spacePointHistos.regHist(m_spHit_r = TH1F_LW::create("pixel_sp_r", ("r location of hit" + m_histTitleExt + ";r (mm);# hits").c_str(), 230, -0., 230.)).isSuccess(); - st &= spacePointHistos.regHist(m_spHit_phi = TH1F_LW::create("pixel_sp_phi", ("phi location of hit" + m_histTitleExt + ";phi (mm);# hits").c_str(), 60, -4., 4.)).isSuccess(); - st &= spacePointHistos.regHist(m_spHit_xy = TH2F_LW::create("pixel_sp_x_vs_y", ("xy location of barrel hits" + m_histTitleExt + ";x (mm);y (mm)").c_str(), 100, -160, 160, 100, -160, 160)).isSuccess(); - st &= spacePointHistos.regHist(m_spHit_rz = TH2F_LW::create("pixel_sp_r_vs_z", ("rz location of hit" + m_histTitleExt + ";z (mm);r (mm)").c_str(), 200, -665, 665, 200, -0, 165)).isSuccess(); - - if (!st) ATH_MSG_WARNING("Problems with booking SpacePoint histograms"); - return StatusCode::SUCCESS; -} - -StatusCode PixelMainMon::fillSpacePointMon(void) { - auto pixel_spcontainer = SG::makeHandle(m_Pixel_SpacePointsName); - if (!(pixel_spcontainer.isValid())) { - ATH_MSG_WARNING("SpacePoint container for Pixels not found"); - if (m_storegate_errors) m_storegate_errors->Fill(2., 3.); - return StatusCode::SUCCESS; - } else { - ATH_MSG_DEBUG("Si SpacePoint container for Pixels found"); - } - - DataVector<SpacePoint>::const_iterator p_sp; - Identifier PixelModuleId; - int nhits = 0; - - //loop over Pixel space points collections - for (SpacePointContainer::const_iterator it = pixel_spcontainer->begin(); it != pixel_spcontainer->end(); ++it) { - const SpacePointCollection* colNext = &(**it); - if (!colNext) { - if (m_storegate_errors) m_storegate_errors->Fill(2., 5.); // first entry is for SP, second is for data problem - continue; - } - for (p_sp = colNext->begin(); p_sp != colNext->end(); ++p_sp) { - const SpacePoint& sp = **p_sp; - PixelModuleId = sp.clusterList().first->identify(); - - if (m_doOnTrack && !isOnTrack(PixelModuleId, true)) { - // if we only want hits on track, and the hit is NOT on the track, skip filling - continue; - } - Amg::Vector3D point = sp.globalPosition(); - - if (m_spHit_x) m_spHit_x->Fill(point.x()); - if (m_spHit_y) m_spHit_y->Fill(point.y()); - if (m_spHit_z) m_spHit_z->Fill(point.z()); - if (m_spHit_r) m_spHit_r->Fill(sqrt(point.y() * point.y() + point.x() * point.x())); // spacepoint r. - if (m_spHit_phi) m_spHit_phi->Fill(point.phi()); // spacepoint phi. - if (m_spHit_xy && fabs(point.z()) < 400) m_spHit_xy->Fill(point.x(), point.y()); - if (m_spHit_rz) m_spHit_rz->Fill(point.z(), sqrt(point.y() * point.y() + point.x() * point.x())); - nhits++; - } - } - if (m_num_spacepoints) m_num_spacepoints->Fill(nhits); - if (m_num_spacepoints_low) m_num_spacepoints_low->Fill(nhits); - if (nhits == 0 && m_storegate_errors) m_storegate_errors->Fill(2., 4.); // first entry for sp, second for size = 0 - return StatusCode::SUCCESS; -} diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/src/Status.cxx b/InnerDetector/InDetMonitoring/PixelMonitoring/src/Status.cxx deleted file mode 100644 index 965d1c2d617037d4e4fbe03995fae3b199aa1c9b..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetMonitoring/PixelMonitoring/src/Status.cxx +++ /dev/null @@ -1,217 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -/////////////////////////////////////////////////////////////////////////////// -// Book and fill offline histograms showing status of modules -/////////////////////////////////////////////////////////////////////////////// - -#include <sstream> -#include "InDetIdentifier/PixelID.h" -#include "LWHists/TH1F_LW.h" -#include "LWHists/TH1I_LW.h" -#include "LWHists/TH2F_LW.h" -#include "LWHists/TH2I_LW.h" -#include "LWHists/TProfile2D_LW.h" -#include "LWHists/TProfile_LW.h" -#include "PixelMonitoring/PixelMainMon.h" -#include "TH1F.h" -#include "TH1I.h" -#include "TH2F.h" -#include "TH2I.h" -#include "TProfile2D.h" - -#include "PixelMonitoring/Components.h" -#include "PixelMonitoring/PixelMon2DMapsLW.h" -#include "PixelMonitoring/PixelMon2DProfilesLW.h" -#include "PixelMonitoring/PixelMonModules.h" - -/////////////////////////////////////////////////////////////////////////////// -//////////////////////booking methods////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -StatusCode PixelMainMon::bookStatusMon(void) { - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "starting Book Status" << endmsg; - - std::string path = "Pixel/Status"; - if (m_doOnTrack) path.replace(path.begin(), path.end(), "Pixel/StatusOnTrack"); - MonGroup statusHistos(this, path.c_str(), run, ATTRIB_MANAGED); // declare a group of histograms - - StatusCode sc; - - m_status = std::make_unique<PixelMon2DProfilesLW>("Map_Of_Modules_Status", ("Modules Status (0=Active+Good, 1=Active+Bad, 2=Inactive)" + m_histTitleExt).c_str(), PixMon::HistConf::kPixIBL2D3D, true); - sc = m_status->regHist(statusHistos); - m_status->setMaxValue(2.0); - - m_status_mon = std::make_unique<PixelMon2DProfilesLW>("Map_Of_Modules_Status_Mon", ("Modules Status (0=Active+Good, 1=Active+Bad, 2=Inactive) for monitoring" + m_histTitleExt).c_str(), PixMon::HistConf::kPixIBL2D3D, true); - sc = m_status_mon->regHist(statusHistos); - m_status_mon->setMaxValue(2.0); - - if (!m_doOnTrack) { // skip the rest - if (m_doOffline) { - m_dqStatus = std::make_unique<PixelMon2DMapsLW>("Ok_modules", ("module problems, empty bin means dead module not listed in status database" + m_histTitleExt).c_str(), PixMon::HistConf::kPixDBMIBL2D3D); - sc = m_dqStatus->regHist(statusHistos); - } - - std::string tmp; - std::string tmp2; - - int nbins_LB = m_lbRange; - double min_LB = -0.5; - double max_LB = min_LB + (1.0 * nbins_LB); - std::string atext_LB = ";lumi block"; - std::string atext_nmod = ";# modules/event"; - const std::string modlabel[PixLayerIBL2D3D::COUNT] = {"ECA", "ECC", "B0", "B1", "B2", "IBL", "IBL2D", "IBL3D"}; - - for (int i = 0; i < PixLayerIBL2D3D::COUNT; i++) { - tmp = makeHistname(("BadModules_per_lumi_" + modlabel[i]), false); - tmp2 = makeHisttitle(("Number of bad modules (bad+active) per event per LB, " + modlabel[i]), (atext_LB + atext_nmod), false); - sc = statusHistos.regHist(m_badModules_per_lumi_mod[i] = TProfile_LW::create(tmp.c_str(), (tmp2 + m_histTitleExt + atext_LB + atext_nmod).c_str(), nbins_LB, min_LB, max_LB)); - - tmp = makeHistname(("DisabledModules_per_lumi_" + modlabel[i]), false); - tmp2 = makeHisttitle(("Number of disabled modules per event per LB, " + modlabel[i]), (atext_LB + atext_nmod), false); - sc = statusHistos.regHist(m_disabledModules_per_lumi_mod[i] = TProfile_LW::create(tmp.c_str(), (tmp2 + m_histTitleExt + atext_LB + atext_nmod).c_str(), nbins_LB, min_LB, max_LB)); - - tmp = makeHistname(("BadDisabledModules_per_lumi_" + modlabel[i]), false); - tmp2 = makeHisttitle(("Number of disabled & bad modules per event per LB, " + modlabel[i]), (atext_LB + atext_nmod), false); - sc = statusHistos.regHist(m_baddisabledModules_per_lumi_mod[i] = TProfile_LW::create(tmp.c_str(), (tmp2 + m_histTitleExt + atext_LB + atext_nmod).c_str(), nbins_LB, min_LB, max_LB)); - } - - tmp = makeHistname("DisabledModules_per_lumi_PIX", false); - tmp2 = makeHisttitle("Number of disabled modules per event per LB for Pixel barrel", (atext_LB + atext_nmod), false); - sc = statusHistos.regHist(m_disabledModules_per_lumi_PIX = TProfile_LW::create(tmp.c_str(), (tmp2 + m_histTitleExt + atext_LB + atext_nmod).c_str(), nbins_LB, min_LB, max_LB)); - } - - if (sc.isFailure()) { - if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "histograms not booked" << endmsg; - } - return StatusCode::SUCCESS; -} - -StatusCode PixelMainMon::bookStatusLumiBlockMon(void) { - if (m_doOnTrack) return StatusCode::SUCCESS; - - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "starting Book Status for lowStat" << endmsg; - - std::string path = "Pixel/LumiBlock"; - if (m_doOnTrack) path.replace(path.begin(), path.end(), "Pixel/LumiBlockOnTrack"); - MonGroup lumiBlockHist(this, path.c_str(), lowStat, ATTRIB_MANAGED); - - m_status_LB = std::make_unique<PixelMon2DProfilesLW>("Map_Of_Modules_Status_LB", ("Module Status (0=Active+Good, 1=Active+Bad, 2=Inactive)" + m_histTitleExt).c_str(), PixMon::HistConf::kPixIBL2D3D, true); - StatusCode sc = m_status_LB->regHist(lumiBlockHist); - m_status_LB->setMaxValue(2.0); - - if (sc.isFailure()) { - if (msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "histograms not booked" << endmsg; - } - return StatusCode::SUCCESS; -} - -StatusCode PixelMainMon::fillStatusMon(void) { - int Index = -1; - PixelID::const_id_iterator idIt = m_pixelid->wafer_begin(); - PixelID::const_id_iterator idItEnd = m_pixelid->wafer_end(); - - int nBad = 0; - int nBad_mod[PixLayerIBL2D3D::COUNT] = {0}; - - int nDisabled = 0; - int nDisabled_mod[PixLayerIBL2D3D::COUNT] = {0}; - - for (; idIt != idItEnd; ++idIt) { - Identifier WaferID = *idIt; - IdentifierHash id_hash = m_pixelid->wafer_hash(WaferID); - int pixlayer = getPixLayerID(m_pixelid->barrel_ec(WaferID), m_pixelid->layer_disk(WaferID), m_doIBL); - int pixlayeribl2d3d = 0; - if (pixlayer == PixLayer::kIBL) { - pixlayeribl2d3d = getPixLayerIDIBL2D3D(m_pixelid->barrel_ec(WaferID), m_pixelid->layer_disk(WaferID), m_pixelid->eta_module(WaferID), m_doIBL); - } - if (pixlayer == 99) continue; - - // check in order of occurrence to reduce number of calls to conditions service - if (m_pixelCondSummaryTool->isActive(id_hash) == true && m_pixelCondSummaryTool->isGood(id_hash) == true) { - Index = 0; - } else if (m_pixelCondSummaryTool->isActive(id_hash) == false) { - Index = 2; - } else { - Index = 1; - } - - if (m_status) m_status->fill(WaferID, m_pixelid, Index); - if (m_status_mon) m_status_mon->fill(WaferID, m_pixelid, Index); - if (m_doOnTrack) continue; - - if (m_doLumiBlock) { - if (m_status_LB) m_status_LB->fill(WaferID, m_pixelid, Index); - } - - if (Index > 0) { // bad but active modules - if (Index == 1) { - nBad++; - nBad_mod[pixlayer]++; - if (pixlayeribl2d3d != 0) nBad_mod[pixlayeribl2d3d]++; - } - // inactive or bad modules - if (Index == 2) { - nDisabled++; - nDisabled_mod[pixlayer]++; - if (pixlayeribl2d3d != 0) nDisabled_mod[pixlayeribl2d3d]++; - } - } - } // end of pixelid wafer loop - - if (m_doRefresh && m_status_mon) m_status_mon->reset(); - - if (!m_doOnTrack) { - static float nmod_per_layer[PixLayerIBL2D3D::COUNT] = {144., 144., 286., 494., 676., 280., 168., 112.}; - - for (int i = 0; i < PixLayerIBL2D3D::COUNT; i++) { - if (m_badModules_per_lumi_mod[i] && nmod_per_layer[i] > 0) m_badModules_per_lumi_mod[i]->Fill(m_manager->lumiBlockNumber(), nBad_mod[i] / nmod_per_layer[i]); - if (m_disabledModules_per_lumi_mod[i]) m_disabledModules_per_lumi_mod[i]->Fill(m_manager->lumiBlockNumber(), nDisabled_mod[i]); - if (m_baddisabledModules_per_lumi_mod[i]) m_baddisabledModules_per_lumi_mod[i]->Fill(m_manager->lumiBlockNumber(), nDisabled_mod[i] + nBad_mod[i]); - } - if (m_disabledModules_per_lumi_PIX) m_disabledModules_per_lumi_PIX->Fill(m_manager->lumiBlockNumber(), nDisabled_mod[PixLayerIBL2D3D::kB0] + nDisabled_mod[PixLayerIBL2D3D::kB1] + nDisabled_mod[PixLayerIBL2D3D::kB2]); - - if (nDisabled > (1744 + 280 * m_doIBL) * 0.50) { - m_majorityDisabled = true; - } else { - m_majorityDisabled = false; - } - } - return StatusCode::SUCCESS; -} - -StatusCode PixelMainMon::procStatusMon(void) { - if (!m_doOnTrack && m_status && m_dqStatus && m_occupancy) { - if (m_doIBL) { - for (int i = 1; i <= 12; i++) { - for (int j = 1; j <= 14; j++) { - m_dqStatus->IBL2D->SetBinContent(i, j, m_occupancy->IBL2D->GetBinContent(i, j) + m_status->IBL2D->GetBinContent(i, j)); - } - } - for (int i = 1; i <= 8; i++) { - for (int j = 1; j <= 14; j++) { - m_dqStatus->IBL3D->SetBinContent(i, j, m_occupancy->IBL3D->GetBinContent(i, j) + m_status->IBL3D->GetBinContent(i, j)); - } - } - } - for (int i = 1; i <= 13; i++) { - for (int j = 1; j <= 22; j++) { - m_dqStatus->B0->SetBinContent(i, j, m_occupancy->B0->GetBinContent(i, j) + m_status->B0->GetBinContent(i, j)); - } - for (int j = 1; j <= 38; j++) { - m_dqStatus->B1->SetBinContent(i, j, m_occupancy->B1->GetBinContent(i, j) + m_status->B1->GetBinContent(i, j)); - } - for (int j = 1; j <= 52; j++) { - m_dqStatus->B2->SetBinContent(i, j, m_occupancy->B2->GetBinContent(i, j) + m_status->B2->GetBinContent(i, j)); - } - } - for (int i = 1; i <= 48; i++) { - for (int j = 1; j <= 3; j++) { - m_dqStatus->A->SetBinContent(j, i, m_occupancy->A->GetBinContent(j, i) + m_status->A->GetBinContent(j, i)); - m_dqStatus->C->SetBinContent(j, i, m_occupancy->C->GetBinContent(j, i) + m_status->C->GetBinContent(j, i)); - } - } - } - return StatusCode::SUCCESS; -} diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/src/Track.cxx b/InnerDetector/InDetMonitoring/PixelMonitoring/src/Track.cxx deleted file mode 100644 index ed26e5e62064fb667b14d33ba320d82b949b86b5..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetMonitoring/PixelMonitoring/src/Track.cxx +++ /dev/null @@ -1,348 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -/////////////////////////////////////////////////////////////////////////////// -// Book and fill histograms for tracks (combined ID and pixel only tracks) -/////////////////////////////////////////////////////////////////////////////// - -#include <algorithm> -#include <sstream> -#include "InDetIdentifier/PixelID.h" -#include "InDetPrepRawData/PixelClusterContainer.h" -#include "InDetRIO_OnTrack/SiClusterOnTrack.h" -#include "InDetRawData/InDetTimeCollection.h" -#include "LWHists/TH1F_LW.h" -#include "LWHists/TH1I_LW.h" -#include "LWHists/TH2F_LW.h" -#include "LWHists/TH2I_LW.h" -#include "LWHists/TProfile2D_LW.h" -#include "LWHists/TProfile_LW.h" -#include "PixelMonitoring/PixelMainMon.h" -#include "TH1F.h" -#include "TH1I.h" -#include "TH2F.h" -#include "TH2I.h" -#include "TProfile.h" -#include "TrkParameters/TrackParameters.h" -#include "TrkSpacePoint/SpacePointContainer.h" - -#include "EventPrimitives/EventPrimitives.h" -#include "EventPrimitives/EventPrimitivesHelpers.h" -#include "InDetRawData/InDetRawDataCLASS_DEF.h" -#include "InDetRawData/InDetRawDataContainer.h" -#include "InDetReadoutGeometry/SiDetectorElement.h" -#include "InDetTrackSelectionTool/IInDetTrackSelectionTool.h" -#include "PixelMonitoring/Components.h" -#include "PixelMonitoring/PixelMon2DMapsLW.h" -#include "PixelMonitoring/PixelMon2DProfilesLW.h" -#include "PixelMonitoring/PixelMonModules.h" -#include "TrkToolInterfaces/ITrackHoleSearchTool.h" -#include "TrkTrack/TrackCollection.h" -#include "TrkTrackSummary/InDetTrackSummary.h" -#include "TrkTrackSummary/TrackSummary.h" - -/////////////////////////////////////////////////////////////////////////////// -//////////////////////booking methods////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -StatusCode PixelMainMon::bookTrackMon(void) { - ATH_MSG_DEBUG("Start booking Track histogtams.."); - - std::string path = "Pixel/Track"; - if (m_doOnTrack) path.replace(path.begin(), path.end(), "Pixel/TrackOnTrack"); - MonGroup trackHistos(this, path.c_str(), run, ATTRIB_MANAGED); //declare a group of track histograms - - std::string hname; - std::string htitles; - - StatusCode sc; - - int nbins_LB = m_lbRange; - double min_LB = -0.5; - double max_LB = min_LB + (1.0 * nbins_LB); - - sc = trackHistos.regHist(m_track_res_phi = TH1F_LW::create("Track_res_phi", ("Pixel Residual LocX(phi)" + m_histTitleExt).c_str(), 100, -0.1, 0.1)); - sc = trackHistos.regHist(m_track_res_eta = TH1F_LW::create("Track_res_eta", ("Pixel Residual LocY(eta)" + m_histTitleExt).c_str(), 100, -0.3, 0.3)); - sc = trackHistos.regHist(m_track_pull_phi = TH1F_LW::create("Track_pull_phi", ("Pixel pull LocX(phi)" + m_histTitleExt).c_str(), 100, -1.2, 1.2)); - sc = trackHistos.regHist(m_track_pull_eta = TH1F_LW::create("Track_pull_eta", ("Pixel pull LocY(eta)" + m_histTitleExt).c_str(), 100, -2.0, 2.0)); - sc = trackHistos.regHist(m_track_chi2 = TH1F_LW::create("Track_chi2", ("chi2 of rec. track" + m_histTitleExt + ";#chi^{2}/DoF;#tracks").c_str(), 50, -0., 10.)); - sc = trackHistos.regHist(m_tracksPerEvt_per_lumi = TProfile_LW::create("tracksPerEvt_per_lumi", ("Number of tracks per event per LB" + m_histTitleExt + ";lumi block;tracks/event").c_str(), nbins_LB, min_LB, max_LB)); - - if (m_do2DMaps && !m_doOnline) { - m_tsos_hitmap = std::make_unique<PixelMon2DMapsLW>("TSOS_Measurement", ("TSOS of type Measurement" + m_histTitleExt), PixMon::HistConf::kPixDBMIBL2D3D, true); - sc = m_tsos_hitmap->regHist(trackHistos); - m_tsos_holemap = std::make_unique<PixelMon2DMapsLW>("TSOS_Hole", ("TSOS of type Hole" + m_histTitleExt), PixMon::HistConf::kPixDBMIBL2D3D, true); - sc = m_tsos_holemap->regHist(trackHistos); - m_tsos_outliermap = std::make_unique<PixelMon2DMapsLW>("TSOS_Outlier", ("TSOS of type Outlier" + m_histTitleExt), PixMon::HistConf::kPixDBMIBL2D3D, true); - sc = m_tsos_outliermap->regHist(trackHistos); - } - - m_tsos_holeratio_tmp = std::make_unique<PixelMon2DProfilesLW>("HolesRatio", ("Holes per track" + m_histTitleExt), PixMon::HistConf::kPixIBL2D3D, true); - sc = m_tsos_holeratio_tmp->regHist(trackHistos); - m_misshits_ratio_tmp = std::make_unique<PixelMon2DProfilesLW>("MissHitsRatio", ("Hole+Outlier per track" + m_histTitleExt), PixMon::HistConf::kPixIBL2D3D, true); - sc = m_misshits_ratio_tmp->regHist(trackHistos); - - if (m_doOnline) { - m_tsos_holeratio_mon = std::make_unique<PixelMon2DProfilesLW>("HolesRatio_mon", ("Holes per track reset every 5 min" + m_histTitleExt), PixMon::HistConf::kPixIBL2D3D, true); - sc = m_tsos_holeratio_mon->regHist(trackHistos); - m_misshits_ratio_mon = std::make_unique<PixelMon2DProfilesLW>("MissHitsRatio_mon", ("Hole+Outlier per track reset every 5 min" + m_histTitleExt), PixMon::HistConf::kPixIBL2D3D, true); - sc = m_misshits_ratio_mon->regHist(trackHistos); - } - - for (int i = 0; i < PixLayer::COUNT - 1 + (int)(m_doIBL); i++) { - hname = makeHistname(("HitEff_all_" + m_modLabel_PixLayerIBL2D3D[i]), false); - htitles = makeHisttitle(("hit efficiency, " + m_modLabel_PixLayerIBL2D3D[i]), ";lumi block;hit efficiency", false); - sc = trackHistos.regHist(m_hiteff_incl_mod[i] = TProfile_LW::create(hname.c_str(), htitles.c_str(), nbins_LB, min_LB, max_LB)); - if (m_doOnline) { - hname = makeHistname(("HitEff_last100lb_" + m_modLabel_PixLayerIBL2D3D[i]), false); - htitles = makeHisttitle(("hit efficiency last 100 LB, " + m_modLabel_PixLayerIBL2D3D[i]), ";last 100 lumi blocks;hit efficiency", false); - sc = trackHistos.regHist(m_hiteff_lastXlb_mod[i] = new TProfile(hname.c_str(), htitles.c_str(), 100, 0.5, 100.5)); - } - } - - hname = makeHistname("NPixhits_per_track_lumi", false); - htitles = makeHisttitle("Number of pixhits per track", ";lumi block;number of hits", false); - sc = trackHistos.regHist(m_npixhits_per_track_lumi = TH2F_LW::create(hname.c_str(), htitles.c_str(), nbins_LB, min_LB, max_LB, 10, -0.5, 9.5)); - if (m_doOnline) { - hname = makeHistname("NPixhits_per_track_last100lb", false); - htitles = makeHisttitle("Number of pixhits per track last 100 LB", ";last 100 lumi blocks;number of hits", false); - sc = trackHistos.regHist(m_npixhits_per_track_lastXlb = new TH2F(hname.c_str(), htitles.c_str(), 100, 0.5, 100.5, 10, -0.5, 9.5)); - if (m_npixhits_per_track_lastXlb) m_npixhits_per_track_lastXlb->SetOption("colz"); - } - - if (sc.isFailure()) ATH_MSG_WARNING("Problems with booking Track histograms"); - return StatusCode::SUCCESS; -} - -StatusCode PixelMainMon::fillTrackMon(void) { - ATH_MSG_DEBUG("Filling Track Monitoring Histograms"); - - auto tracks = SG::makeHandle(m_TracksName); - if (!(tracks.isValid())) { - ATH_MSG_INFO("No tracks in StoreGate found"); - if (m_storegate_errors) m_storegate_errors->Fill(4., 3.); - return StatusCode::SUCCESS; - } else { - ATH_MSG_DEBUG("Tracks in StoreGate found"); - } - - m_ntracksPerEvent = 0; - - if (m_doOnTrack) { - m_RDOIDs.clear(); - m_ClusterIDs.clear(); - } - - TrackCollection::const_iterator itrack = tracks->begin(); - TrackCollection::const_iterator itrack_end = tracks->end(); - for (; itrack != itrack_end; ++itrack) { - const Trk::Track *track0 = (*itrack); - if (track0 == 0 || track0->perigeeParameters() == 0 || track0->trackSummary() == 0 || track0->trackSummary()->get(Trk::numberOfPixelHits) == 0) { - ATH_MSG_DEBUG("Track either invalid or it does not contain pixel hits, continuing..."); - continue; - } - - const Trk::TrackSummary *summary = track0->trackSummary(); - const Trk::Perigee *measPerigee = dynamic_cast<const Trk::Perigee *>(track0->perigeeParameters()); - const Trk::Track *track = track0; - - int npixholes = summary->get(Trk::numberOfPixelHoles); - if (m_doHoleSearch && npixholes > 0) { - track = m_holeSearchTool->getTrackWithHoles(*track0); - } - int nPixelHits = 0; - bool passJOTrkTightCut = static_cast<bool>(m_trackSelTool->accept(*track0)); - bool pass1hole1GeVptTightCut = (passJOTrkTightCut && (measPerigee->pT() / 1000.0 > 1.0)); // misshit ratios - bool pass1hole5GeVptTightCut = (passJOTrkTightCut && (measPerigee->pT() / 1000.0 > 5.0)); // eff vs lumi - - const DataVector<const Trk::TrackStateOnSurface> *trackStates = track->trackStateOnSurfaces(); - for (DataVector<const Trk::TrackStateOnSurface>::const_iterator trackStateOnSurfaceIterator = trackStates->begin(); trackStateOnSurfaceIterator != trackStates->end(); trackStateOnSurfaceIterator++) { - - const Trk::MeasurementBase *mesb = (*trackStateOnSurfaceIterator)->measurementOnTrack(); - const Trk::RIO_OnTrack *hit = mesb ? dynamic_cast<const Trk::RIO_OnTrack *>(mesb) : 0; - if (mesb && !hit) continue; // skip pseudomeasurements but not holes, outliers - - const Trk::TrackParameters *trkParameters = (*trackStateOnSurfaceIterator)->trackParameters(); - Identifier surfaceID; - if (mesb && mesb->associatedSurface().associatedDetectorElement()) { - surfaceID = mesb->associatedSurface().associatedDetectorElement()->identify(); - } else { // holes, perigee - if (trkParameters) { - surfaceID = trkParameters->associatedSurface().associatedDetectorElementIdentifier(); - } else { - ATH_MSG_INFO("pointer of TSOS to track parameters or associated surface is null"); - continue; - } - } - - if (!m_idHelper->is_pixel(surfaceID)) continue; - int pixlayer = getPixLayerID(m_pixelid->barrel_ec(surfaceID), m_pixelid->layer_disk(surfaceID), m_doIBL); - if (pixlayer == 99) continue; - - float nOutlier = 0.; - float nHole = 0.; - - if ((*trackStateOnSurfaceIterator)->type(Trk::TrackStateOnSurface::Outlier)) { - nOutlier = 1.0; - if (m_tsos_holemap) m_tsos_holemap->fill(surfaceID, m_pixelid); - if (m_hiteff_incl_mod[pixlayer] && pass1hole5GeVptTightCut) m_hiteff_incl_mod[pixlayer]->Fill(m_manager->lumiBlockNumber(), 0.0); - } - if ((*trackStateOnSurfaceIterator)->type(Trk::TrackStateOnSurface::Hole)) { - nHole = 1.0; - if (m_tsos_outliermap) m_tsos_outliermap->fill(surfaceID, m_pixelid); - if (m_hiteff_incl_mod[pixlayer] && pass1hole5GeVptTightCut) m_hiteff_incl_mod[pixlayer]->Fill(m_manager->lumiBlockNumber(), 0.0); - } - if (pass1hole1GeVptTightCut) { - if (m_tsos_holeratio_tmp) m_tsos_holeratio_tmp->fill(surfaceID, m_pixelid, nHole); - if (m_misshits_ratio_tmp) m_misshits_ratio_tmp->fill(surfaceID, m_pixelid, nOutlier + nHole); - if (m_doOnline) { - if (m_tsos_holeratio_mon) m_tsos_holeratio_mon->fill(surfaceID, m_pixelid, nHole); - if (m_misshits_ratio_mon) m_misshits_ratio_mon->fill(surfaceID, m_pixelid, nOutlier + nHole); - } - } - if ((*trackStateOnSurfaceIterator)->type(Trk::TrackStateOnSurface::Measurement)) { - if (m_tsos_hitmap) m_tsos_hitmap->fill(surfaceID, m_pixelid); - if (m_hiteff_incl_mod[pixlayer] && pass1hole5GeVptTightCut) m_hiteff_incl_mod[pixlayer]->Fill(m_manager->lumiBlockNumber(), 1.0); - } else { - continue; - // working only with real hits (not outliers or holes) from now on - } - //need the mesb to be sensible before dereferencing it - if (not mesb) continue; - const InDetDD::SiDetectorElement *side = dynamic_cast<const InDetDD::SiDetectorElement *>(mesb->associatedSurface().associatedDetectorElement()); - const InDet::SiClusterOnTrack *clus = dynamic_cast<const InDet::SiClusterOnTrack *>(mesb); - if (!side || !clus) continue; - const InDet::SiCluster *RawDataClus = dynamic_cast<const InDet::SiCluster *>(clus->prepRawData()); - if (!RawDataClus || !RawDataClus->detectorElement()->isPixel()) continue; - - nPixelHits++; //add another pixel hit - - const Trk::AtaPlane *trackAtPlane = dynamic_cast<const Trk::AtaPlane *>(trkParameters); - if (trackAtPlane) { - const Amg::Vector2D localpos = trackAtPlane->localPosition(); - - // Get local error matrix for hit and track and calc pull - const AmgSymMatrix(5) trackErrMat = (*trackAtPlane->covariance()); - const Amg::MatrixX clusErrMat = clus->localCovariance(); - - double error_sum = sqrt(pow(Amg::error(trackErrMat, Trk::locX), 2) + pow(Amg::error(clusErrMat, Trk::locX), 2)); - double res = clus->localParameters()[Trk::locX] - localpos[0]; - if (m_track_res_phi) m_track_res_phi->Fill(res); - double pull = 0; - if (error_sum != 0) pull = (res) / error_sum; - if (m_track_pull_phi) m_track_pull_phi->Fill(pull); - - error_sum = sqrt(pow(Amg::error(trackErrMat, Trk::locY), 2) + pow(Amg::error(clusErrMat, Trk::locY), 2)); - res = clus->localParameters()[Trk::locY] - localpos[1]; - if (m_track_res_eta) m_track_res_eta->Fill(res); - if (error_sum != 0) pull = (res) / error_sum; - if (m_track_pull_eta) m_track_pull_eta->Fill(pull); - - Amg::Vector3D mynormal = side->normal(); - Amg::Vector3D mytrack = trackAtPlane->momentum(); - double trknormcomp = mytrack.dot(mynormal); - - // Fill containers, which hold id's of hits and clusters on track _and_ incident angle information for later normalization - double mytrack_mag = mytrack.mag(); - double cosalpha = 0.; - if (mytrack_mag != 0) cosalpha = fabs(trknormcomp / mytrack_mag); - if (m_doOnTrack) { - for (unsigned int loopSize = 0; loopSize < RawDataClus->rdoList().size(); loopSize++) { - m_RDOIDs.push_back(RawDataClus->rdoList().at(loopSize)); - } - m_ClusterIDs.push_back(std::make_pair(clus->identify(), cosalpha)); - } - } - } // end of TSOS loop - - if (m_track_chi2 && track0->fitQuality()->numberDoF() != 0) m_track_chi2->Fill(track0->fitQuality()->chiSquared() / track0->fitQuality()->numberDoF()); - if (m_npixhits_per_track_lumi) m_npixhits_per_track_lumi->Fill(m_manager->lumiBlockNumber(), nPixelHits); - m_ntracksPerEvent++; - - if (m_doHoleSearch && npixholes > 0) delete track; - } // end of track loop - - // Fill histograms per event - if (m_tracksPerEvt_per_lumi) m_tracksPerEvt_per_lumi->Fill(m_manager->lumiBlockNumber(), m_ntracksPerEvent); - - if (m_doOnTrack) { - sort(m_RDOIDs.begin(), m_RDOIDs.end()); - sort(m_ClusterIDs.begin(), m_ClusterIDs.end(), [](const std::pair<Identifier, double> &left, const std::pair<Identifier, double> &right) { - return left.first < right.first; - }); - } - - if (m_doOnline) { - if (m_doRefresh5min) { - if (m_tsos_holeratio_mon) m_tsos_holeratio_mon->reset(); - if (m_misshits_ratio_mon) m_misshits_ratio_mon->reset(); - } - } - - return StatusCode::SUCCESS; -} - -StatusCode PixelMainMon::procTrackMon(void) { - if (m_doOnline) { - int lastlb = m_manager->lumiBlockNumber()-1; //remove -1 for testing - double cont(0.0); - int entr(0), entries(0); - for (int i = 0; i < PixLayer::COUNT - 1 + (int)(m_doIBL); i++) { - if (m_hiteff_incl_mod[i] && m_hiteff_lastXlb_mod[i]) { - int bing = m_hiteff_incl_mod[i]->GetXaxis()->FindBin(lastlb); - - int nXbins = m_hiteff_lastXlb_mod[i]->GetNbinsX(); - m_hiteff_lastXlb_mod[i]->GetXaxis()->Set(nXbins, lastlb-nXbins+0.5, lastlb+0.5); - m_hiteff_lastXlb_mod[i]->Reset(); - - for (int binf=m_hiteff_lastXlb_mod[i]->GetNbinsX(); binf>0; binf--) { - if (bing>0) { - cont = m_hiteff_incl_mod[i]->GetBinContent(bing); - entr = m_hiteff_incl_mod[i]->GetBinEntries(bing); - entries += entr; - if (entr>0) { - m_hiteff_lastXlb_mod[i]->SetBinEntries(binf, entr); - m_hiteff_lastXlb_mod[i]->SetBinContent(binf, cont * entr); - (*m_hiteff_lastXlb_mod[i]->GetSumw2())[binf] = cont * entr; // works only for this type of histogram - } - bing--; - } - } - m_hiteff_lastXlb_mod[i]->SetMinimum(0.8); - m_hiteff_lastXlb_mod[i]->SetMaximum(1.01); - m_hiteff_lastXlb_mod[i]->SetEntries(entries); - //m_hiteff_lastXlb_mod[i]->SetEntries(lastlb); // for testing - } - } - if (m_npixhits_per_track_lumi && m_npixhits_per_track_lastXlb) { - int bingx = m_npixhits_per_track_lumi->GetXaxis()->FindBin(lastlb); - int nbingy = m_npixhits_per_track_lumi->GetNbinsY(); - - int nXbins = m_npixhits_per_track_lastXlb->GetNbinsX(); - m_npixhits_per_track_lastXlb->GetXaxis()->Set(nXbins, lastlb-nXbins+0.5, lastlb+0.5); - m_npixhits_per_track_lastXlb->Reset(); - - for (int binfx=m_npixhits_per_track_lastXlb->GetNbinsX(); binfx>0; binfx--) { - if (bingx>0) { - for (int bingy = 1; bingy <= nbingy; bingy++) { - cont = m_npixhits_per_track_lumi->GetBinContent(bingx, bingy); - if (cont!=0) { - m_npixhits_per_track_lastXlb->SetBinContent(binfx, bingy, cont); - } - } - bingx--; - } - } - //m_npixhits_per_track_lastXlb->SetEntries(lastlb); // for testing - } - } - if (m_doOffline) { - for (int i = 0; i < PixLayer::COUNT - 1 + (int)(m_doIBL); i++) { - if (m_hiteff_incl_mod[i]) { - m_hiteff_incl_mod[i]->SetMinimum(0.8); - m_hiteff_incl_mod[i]->SetMaximum(1.01); - } - } - } - return StatusCode::SUCCESS; -} diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/src/components/PixelMonitoring_entries.cxx b/InnerDetector/InDetMonitoring/PixelMonitoring/src/components/PixelMonitoring_entries.cxx index c518195f476afc47edde6eec1722e9883e84cd9f..8945afb890cf868605255f562b3e56c77509a68c 100644 --- a/InnerDetector/InDetMonitoring/PixelMonitoring/src/components/PixelMonitoring_entries.cxx +++ b/InnerDetector/InDetMonitoring/PixelMonitoring/src/components/PixelMonitoring_entries.cxx @@ -1,5 +1,7 @@ -#include "PixelMonitoring/PixelMainMon.h" - - -DECLARE_COMPONENT( PixelMainMon ) +#include "PixelMonitoring/PixelAthClusterMonTool.h" +#include "PixelMonitoring/PixelAthErrorMonTool.h" +#include "PixelMonitoring/PixelAthHitMonTool.h" +DECLARE_COMPONENT( PixelAthClusterMonTool ) +DECLARE_COMPONENT( PixelAthErrorMonTool ) +DECLARE_COMPONENT( PixelAthHitMonTool )