From 071331aa4ba9e29206776449f6486b27dbd8543d Mon Sep 17 00:00:00 2001 From: Hass AbouZeid <hass.abouzeid@cern.ch> Date: Mon, 14 Aug 2017 08:58:02 +0000 Subject: [PATCH] Merge branch 'mr-2017-02' into '21.0' PixelMonitoring: revised job options, added histograms, cleaned up classes See merge request !3917 --- .../share/InDetMonitoringPixel.py | 91 +-- .../PixelMonitoring/Components.h | 71 +++ .../PixelMonitoring/PixelMainMon.h | 18 +- .../PixelMonitoring/PixelMon2DLumiMaps.h | 23 +- .../PixelMonitoring/PixelMon2DLumiProfiles.h | 23 +- .../PixelMonitoring/PixelMon2DMapsLW.h | 12 +- .../PixelMonitoring/PixelMon2DProfilesLW.h | 19 +- .../PixelMonitoring/PixelMonModules.h | 16 +- .../PixelMonitoring/src/Clusters.cxx | 83 ++- .../PixelMonitoring/src/Components.cxx | 115 ++++ .../PixelMonitoring/src/Errors.cxx | 139 ++++- .../PixelMonitoring/src/HelperFunctions.cxx | 2 - .../PixelMonitoring/src/Hits.cxx | 45 +- .../PixelMonitoring/src/PixelDCSMon.cxx | 44 -- .../PixelMonitoring/src/PixelMainMon.cxx | 28 +- .../src/PixelMon2DLumiMaps.cxx | 288 +++++----- .../src/PixelMon2DLumiProfiles.cxx | 289 +++++----- .../PixelMonitoring/src/PixelMon2DMapsLW.cxx | 456 ++++++--------- .../src/PixelMon2DProfilesLW.cxx | 527 ++++++------------ .../PixelMonitoring/src/PixelMonModules.cxx | 33 +- .../PixelMonitoring/src/SpacePoints.cxx | 139 ++--- .../PixelMonitoring/src/Status.cxx | 14 +- .../PixelMonitoring/src/Track.cxx | 411 ++++++-------- 23 files changed, 1347 insertions(+), 1539 deletions(-) create mode 100644 InnerDetector/InDetMonitoring/PixelMonitoring/PixelMonitoring/Components.h create mode 100644 InnerDetector/InDetMonitoring/PixelMonitoring/src/Components.cxx diff --git a/InnerDetector/InDetExample/InDetRecExample/share/InDetMonitoringPixel.py b/InnerDetector/InDetExample/InDetRecExample/share/InDetMonitoringPixel.py index 48ce0c7eb18..7ad6440b165 100644 --- a/InnerDetector/InDetExample/InDetRecExample/share/InDetMonitoringPixel.py +++ b/InnerDetector/InDetExample/InDetRecExample/share/InDetMonitoringPixel.py @@ -1,9 +1,5 @@ # configure the pixel main monitoring tool doAllHits = True -# online: only run pixel tracks, offline: only combined tracks available -#doHitsOnPixelTrack = True if athenaCommonFlags.isOnline() else False -#doHitsOnTrack = False if athenaCommonFlags.isOnline() else True -doHitsOnPixelTrack = False doHitsOnTrack = True # switch on all modules histograms for all hits if pixel online monitoring @@ -20,8 +16,7 @@ if doAllHits: doDCS = True InDetPixelMainsMon=PixelMainMon(name = "InDetPixelMonitoringAllHits", onTrack = False, - onPixelTrack = False, - #TrkSummaryTool = InDetTrackSummaryTool, + ##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 @@ -29,14 +24,10 @@ if doAllHits: do2DMaps = True, #Turn on/off the sets of 2D module maps doModules = doAllHitsModules, #Turn on/off the sets of 1744 module histograms (for dqmf) - doFEChipSummary = doAllHitsModules, #Turn on/off the 1744 module FE chip summary histograms (low memory version of doModules) doLowOccupancy = False, #Turn on/off histograms with binning for cosmics/single beam doHighOccupancy = True, #Turn on/off histograms with binning for collisions - doRodSim = False, #Turn on/off histograms specific for the rod simulator 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! - doSpectrum = False, #Turn on/off histograms displaying pixel occupancy spectrum. VERY memory heavy! - doNoiseMap = False, #Turn on/off histograms displaying pixel occupancy noise map. 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 @@ -55,13 +46,11 @@ if doAllHits: 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", #this for you - OccupancyCut = 1e-5) + DetailsMod4 = "D2C_B01_S1_M6") InDetPixelMainsMon.TrackName = InDetKeys.PixelTracks() if InDetFlags.doTrackSegmentsPixel() else InDetKeys.Tracks() ##Other parameters - #PixelMainsMon.OfflineDoPixelOccupancy = False #pixel occupancy plots for offline analysis. Leave off except for private analysis if jobproperties.Beam.beamType()=='collisions' and hasattr(ToolSvc, 'DQFilledBunchFilterTool'): InDetPixelMainsMon.FilterTools.append(monFilledBunchFilterTool) @@ -75,29 +64,24 @@ if doAllHits: if doHitsOnTrack: InDetPixelMainsMonOnTrack=PixelMainMon(name = "InDetPixelMonitoringOnTrack", onTrack = True, - onPixelTrack = False, - #TrkSummaryTool = InDetTrackSummaryTool, + ##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 = False, #Turn on/off the sets of 1744 module histograms (for dqmf) - doFEChipSummary = False, #Turn on/off the 1744 module FE chip summary histograms (low memory version of doModules) + doModules = doAllHitsModules, #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 - doRodSim = False, #Turn on/off histograms specific for the rod simulator 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! - doSpectrum = False, #Turn on/off histograms displaying pixel occupancy spectrum. VERY memory heavy! - doNoiseMap = False, #Turn on/off histograms displaying pixel occupancy noise map. 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 = False, #Turn on/off histograms with Spacepoint 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 = False, #Turn on/off histograms with Module Status information @@ -112,13 +96,11 @@ if doHitsOnTrack: 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", #this for you - OccupancyCut = 1e-5) + DetailsMod4 = "D2C_B01_S1_M6") InDetPixelMainsMonOnTrack.TrackName = InDetKeys.Tracks() ##Other parameters - #PixelMainsMon.OfflineDoPixelOccupancy = False #pixel occupancy plots for offline analysis. Leave off except for private analysis if jobproperties.Beam.beamType()=='collisions' and hasattr(ToolSvc, 'DQFilledBunchFilterTool'): InDetPixelMainsMonOnTrack.FilterTools.append(monFilledBunchFilterTool) @@ -129,65 +111,6 @@ if doHitsOnTrack: ########################################################################## -if doHitsOnPixelTrack: - InDetPixelMainsMonOnPixelTrack=PixelMainMon(name = "InDetPixelMonitoringOnPixelTrack", - onTrack = False, - onPixelTrack = True, - #TrkSummaryTool = InDetTrackSummaryTool, - ##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 = False, #Turn on/off the sets of 1744 module histograms (for dqmf) - doFEChipSummary = False, #Turn on/off the 1744 module FE chip summary histograms (low memory version of doModules) - doLowOccupancy = True, #Turn on/off histograms with binning for cosmics/single beam - doHighOccupancy = True, #Turn on/off histograms with binning for collisions - doRodSim = False, #Turn on/off histograms specific for the rod simulator - 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! - doSpectrum = False, #Turn on/off histograms displaying pixel occupancy spectrum. VERY memory heavy! - doNoiseMap = False, #Turn on/off histograms displaying pixel occupancy noise map. VERY memory heavy! - doLumiBlock = False if athenaCommonFlags.isOnline() else True, #Turn on/off histograms stored for each lumi block - - 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 = False, #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 = False, #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", #this for you - OccupancyCut = 1e-5) - - InDetPixelMainsMonOnPixelTrack.TrackName = InDetKeys.PixelTracks() - - ##Other parameters - #PixelMainsMon.OfflineDoPixelOccupancy = False #pixel occupancy plots for offline analysis. Leave off except for private analysis - - if jobproperties.Beam.beamType()=='collisions' and hasattr(ToolSvc, 'DQFilledBunchFilterTool'): - InDetPixelMainsMonOnPixelTrack.FilterTools.append(monFilledBunchFilterTool) - - ToolSvc += InDetPixelMainsMonOnPixelTrack - if (InDetFlags.doPrintConfigurables()): - print InDetPixelMainsMonOnPixelTrack - - -###################################### - - # configure the pixel mon manager and add main pixel monitoring tool from AthenaMonitoring.AthenaMonitoringConf import AthenaMonManager from AthenaMonitoring.DQMonFlags import DQMonFlags @@ -204,8 +127,6 @@ if doAllHits: InDetPixMonMan.AthenaMonTools += [ InDetPixelMainsMon ] if doHitsOnTrack: InDetPixMonMan.AthenaMonTools += [ InDetPixelMainsMonOnTrack ] -if doHitsOnPixelTrack: - InDetPixMonMan.AthenaMonTools += [ InDetPixelMainsMonOnPixelTrack ] topSequence += InDetPixMonMan if (InDetFlags.doPrintConfigurables()): diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/PixelMonitoring/Components.h b/InnerDetector/InDetMonitoring/PixelMonitoring/PixelMonitoring/Components.h new file mode 100644 index 00000000000..bbab10c2b77 --- /dev/null +++ b/InnerDetector/InDetMonitoring/PixelMonitoring/PixelMonitoring/Components.h @@ -0,0 +1,71 @@ +/* + 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}; + +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; + +/** + * 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); +} + +#endif // PIXMON_COMPONENTS_H_ diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/PixelMonitoring/PixelMainMon.h b/InnerDetector/InDetMonitoring/PixelMonitoring/PixelMonitoring/PixelMainMon.h index 20ed770db07..185c1de10d3 100755 --- a/InnerDetector/InDetMonitoring/PixelMonitoring/PixelMonitoring/PixelMainMon.h +++ b/InnerDetector/InDetMonitoring/PixelMonitoring/PixelMonitoring/PixelMainMon.h @@ -261,24 +261,18 @@ private: bool m_doESD; bool m_do2DMaps; bool m_doModules; - bool m_doFEChipSummary; bool m_doOffline; bool m_doOnline; bool m_doLowOccupancy; bool m_doHighOccupancy; bool m_doOnTrack; - bool m_doOnPixelTrack; bool m_doPixelOccupancy; - bool m_doRodSim; bool m_doDetails; - bool m_doSpectrum; - bool m_doNoiseMap; bool m_doTiming; bool m_doLumiBlock; //store module status, error etc for each lumiblock bool m_doRefresh; bool m_doRefresh5min; bool m_isFirstBook; - bool m_doDegFactorMap; bool m_doOfflineAnalysis; bool m_doHeavyIonMon; //modifications for heavy ion monitoring @@ -382,9 +376,6 @@ private: PixelMonModulesProf* m_hiteff_mod; PixelMonModules1D* m_FE_chip_hit_summary; PixelMonModules2D* m_pixel_occupancy; - /// ROD Sim - TH1F_LW* m_RodSim_BCID_minus_ToT; - TH1F_LW* m_RodSim_FrontEnd_minus_Lvl1ID; /// details TH1F_LW* m_Details_mod1_num_hits; TH1F_LW* m_Details_mod2_num_hits; @@ -432,9 +423,6 @@ private: TProfile2D_LW* m_LorentzAngle_B0; TProfile2D_LW* m_LorentzAngle_B1; TProfile2D_LW* m_LorentzAngle_B2; - /// degradation factor - TProfile2D_LW* m_degFactorMap; - TProfile_LW* m_degFactorMap_per_lumi; /// cluster size TH1F_LW* m_clusize_ontrack_mod[PixLayerIBL2D3D::COUNT]; @@ -540,6 +528,7 @@ private: /// static const int kNumErrorBits{32}; static const int kNumErrorStates{16}; + static const int kNumErrorStatesIBL{27}; TProfile_LW* m_errhist_errcat_LB[PixLayerIBL2D3D::COUNT][ErrorCategory::COUNT]; TProfile_LW* m_errhist_errtype_LB[PixLayerIBL2D3D::COUNT][ErrorCategoryMODROD::COUNT - 3]; PixelMon2DMapsLW* m_errhist_errcat_map[ErrorCategory::COUNT]; @@ -557,9 +546,10 @@ private: PixelMon2DProfilesLW* m_errhist_femcc_errwords_map; // Histograms in 'ErrorsExpert' folder - PixelMon2DLumiMaps* m_errhist_expert_LB_maps[kNumErrorStates]; - PixelMon2DMapsLW* m_errhist_expert_maps[kNumErrorStates]; + PixelMon2DLumiMaps* m_errhist_expert_LB_maps[kNumErrorStates + kNumErrorStatesIBL]; + PixelMon2DMapsLW* m_errhist_expert_maps[kNumErrorStates + kNumErrorStatesIBL]; TProfile_LW* m_errhist_expert_LB[PixLayer::COUNT-1][kNumErrorStates]; + TProfile_LW* m_errhist_expert_IBL_LB[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; diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/PixelMonitoring/PixelMon2DLumiMaps.h b/InnerDetector/InDetMonitoring/PixelMonitoring/PixelMonitoring/PixelMon2DLumiMaps.h index f99b8d88806..bef854c508c 100644 --- a/InnerDetector/InDetMonitoring/PixelMonitoring/PixelMonitoring/PixelMon2DLumiMaps.h +++ b/InnerDetector/InDetMonitoring/PixelMonitoring/PixelMonitoring/PixelMon2DLumiMaps.h @@ -5,6 +5,7 @@ #ifndef PIXELMON2DLUMIMAPS_H_ #define PIXELMON2DLUMIMAPS_H_ #include "AthenaMonitoring/ManagedMonitorToolBase.h" +#include <array> #include <string.h> class TH2F_LW; @@ -12,17 +13,25 @@ class Identifier; class PixelID; class StatusCode; +namespace PixMon { +enum class HistConf; +} + // A helper class to remove a lot of the code duplication. -// This is a collection of 5 2D histograms which make up the '2D maps' used a lot of in the monitoring. -// Each of the 2D maps correspond to a detector region (B0, B1, B2, ECA, ECC). +// This is a collection of 6 2D histograms which make up the '2D luminosity maps' used a lot of in the monitoring. +// Each of the 2D maps correspond to a detector region (IBL, B0, B1, B2, ECA, ECC). // This books and formats the histograms in the constructor. 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 formated/accessed like any other histograms in the monitoring. +// +// N.B. Currently no support for IBL2D/3D histograms as well as DBM monitoring. 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: - PixelMon2DLumiMaps(std::string name, std::string title, std::string zlabel, bool doIBL, bool errorHist = false); + PixelMon2DLumiMaps(std::string name, std::string title, std::string zlabel, const PixMon::HistConf& config); ~PixelMon2DLumiMaps(); TH2F_LW* IBLlbm; TH2F_LW* B0lbm; @@ -30,13 +39,15 @@ class PixelMon2DLumiMaps TH2F_LW* B2lbm; TH2F_LW* Albm; TH2F_LW* Clbm; + TH2F_LW* DBMAlbm; + TH2F_LW* DBMClbm; void Fill(double LB,Identifier &id, const PixelID* pixID, double weight = 1); StatusCode regHist(ManagedMonitorToolBase::MonGroup &group); private: void formatHist(); - const bool m_doIBL; - const bool m_errorHist; - + std::array<TH2F_LW*, 10> m_histograms; + const PixMon::HistConf m_config; + static const bool m_doIBL; }; #endif diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/PixelMonitoring/PixelMon2DLumiProfiles.h b/InnerDetector/InDetMonitoring/PixelMonitoring/PixelMonitoring/PixelMon2DLumiProfiles.h index e1083c72f96..83925fdbcc4 100644 --- a/InnerDetector/InDetMonitoring/PixelMonitoring/PixelMonitoring/PixelMon2DLumiProfiles.h +++ b/InnerDetector/InDetMonitoring/PixelMonitoring/PixelMonitoring/PixelMon2DLumiProfiles.h @@ -5,6 +5,7 @@ #ifndef PIXELMON2DLUMIPROFILES_H_ #define PIXELMON2DLUMIPROFILES_H_ #include "AthenaMonitoring/ManagedMonitorToolBase.h" +#include <array> #include <string.h> class TProfile2D_LW; @@ -12,17 +13,25 @@ class Identifier; class PixelID; class StatusCode; +namespace PixMon { +enum class HistConf; +} + // A helper class to remove a lot of the code duplication. -// This is a collection of 5 2D histograms which make up the '2D maps' used a lot of in the monitoring. -// Each of the 2D maps correspond to a detector region (B0, B1, B2, ECA, ECC). +// This is a collection of 6 2D histograms which make up the '2D lumi profiles' used a lot of in the monitoring. +// Each of the 2D maps correspond to a detector region (IBL, B0, B1, B2, ECA, ECC). // This books and formats the histograms in the constructor. 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 formated/accessed like any other histograms in the monitoring. +// +// N.B. Currently no support for IBL2D/3D histograms as well as DBM monitoring. 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: - PixelMon2DLumiProfiles(std::string name, std::string title, std::string zlabel, bool doIBL, bool errorHist = false); + PixelMon2DLumiProfiles(std::string name, std::string title, std::string zlabel, const PixMon::HistConf& config); ~PixelMon2DLumiProfiles(); TProfile2D_LW* IBLlbp; TProfile2D_LW* B0lbp; @@ -30,13 +39,15 @@ class PixelMon2DLumiProfiles TProfile2D_LW* B2lbp; TProfile2D_LW* Albp; TProfile2D_LW* Clbp; + TProfile2D_LW* DBMAlbp; + TProfile2D_LW* DBMClbp; void Fill(double LB, Identifier &id, const PixelID* pixID, double weight = 1); StatusCode regHist(ManagedMonitorToolBase::MonGroup &group); private: void formatHist(); - const bool m_doIBL; - const bool m_errorHist; - + std::array<TProfile2D_LW*, 10> m_histograms; + const PixMon::HistConf m_config; + static const bool m_doIBL; }; #endif diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/PixelMonitoring/PixelMon2DMapsLW.h b/InnerDetector/InDetMonitoring/PixelMonitoring/PixelMonitoring/PixelMon2DMapsLW.h index c1bb2f419dc..1edcf7452fb 100644 --- a/InnerDetector/InDetMonitoring/PixelMonitoring/PixelMonitoring/PixelMon2DMapsLW.h +++ b/InnerDetector/InDetMonitoring/PixelMonitoring/PixelMonitoring/PixelMon2DMapsLW.h @@ -5,12 +5,16 @@ #ifndef PIXELMON2DMAPSLW_H_ #define PIXELMON2DMAPSLW_H_ #include "AthenaMonitoring/ManagedMonitorToolBase.h" +#include <array> #include <string.h> class TH2F_LW; class Identifier; class PixelID; class StatusCode; +namespace PixMon { +enum class HistConf; +} // A helper class to remove a lot of the code duplication. // This is a collection of 5 2D histograms which make up the '2D mapsLW' used a lot of in the monitoring. @@ -22,7 +26,7 @@ class StatusCode; class PixelMon2DMapsLW { public: - PixelMon2DMapsLW(std::string name, std::string title, bool doIBL, bool errorHist = false, bool copy2DFEval = false); + PixelMon2DMapsLW(std::string name, std::string title, const PixMon::HistConf& config, bool copy2DFEval = false); ~PixelMon2DMapsLW(); TH2F_LW* IBL; TH2F_LW* IBL2D; @@ -39,9 +43,11 @@ class PixelMon2DMapsLW void Fill2DMon(PixelMon2DMapsLW* oldmap); StatusCode regHist(ManagedMonitorToolBase::MonGroup &group); private: + friend class PixelMon2DProfilesLW; void formatHist(); - const bool m_doIBL; - const bool m_errorHist; + std::array<TH2F_LW*, 10> m_histograms; + const PixMon::HistConf m_config; + static const bool m_doIBL; const bool m_copy2DFEval; }; diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/PixelMonitoring/PixelMon2DProfilesLW.h b/InnerDetector/InDetMonitoring/PixelMonitoring/PixelMonitoring/PixelMon2DProfilesLW.h index 29235a30a7b..83cffbcc8d6 100644 --- a/InnerDetector/InDetMonitoring/PixelMonitoring/PixelMonitoring/PixelMon2DProfilesLW.h +++ b/InnerDetector/InDetMonitoring/PixelMonitoring/PixelMonitoring/PixelMon2DProfilesLW.h @@ -13,6 +13,10 @@ class PixelID; class StatusCode; class PixelMon2DMapsLW; +namespace PixMon { +enum class HistConf; +} + // A helper class to facilitate definition of per-layer 2D profile maps. // It defines a collection of TProfile2D_LW histograms for each pixel layer, which then can be declared or // filled in a single call. @@ -23,18 +27,18 @@ class PixelMon2DMapsLW; class PixelMon2DProfilesLW { public: - PixelMon2DProfilesLW(std::string name, std::string title, bool doIBL, bool errorHist = false, bool copy2DFEval = false); + PixelMon2DProfilesLW(std::string name, std::string title, const PixMon::HistConf& config, bool copy2DFEval = false); ~PixelMon2DProfilesLW(); - TProfile2D_LW* IBL; - TProfile2D_LW* IBL2D; TProfile2D_LW* IBL3D; + TProfile2D_LW* IBL2D; + TProfile2D_LW* IBL; TProfile2D_LW* B0; TProfile2D_LW* B1; TProfile2D_LW* B2; TProfile2D_LW* A; TProfile2D_LW* C; - //TProfile2D_LW* DBMA; - //TProfile2D_LW* DBMC; + TProfile2D_LW* DBMA; + TProfile2D_LW* DBMC; void Fill(Identifier &id, const PixelID* pixID, float value); void Fill2DMon(PixelMon2DProfilesLW* oldmap); void FillFromMap(PixelMon2DMapsLW* inputmap, bool clear_inputmap); @@ -43,8 +47,9 @@ public: StatusCode regHist(ManagedMonitorToolBase::MonGroup &group); private: void formatHist(); - const bool m_doIBL; - const bool m_errorHist; + std::array<TProfile2D_LW*, 10> m_histograms; + const PixMon::HistConf m_config; + static const bool m_doIBL; const bool m_copy2DFEval; }; diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/PixelMonitoring/PixelMonModules.h b/InnerDetector/InDetMonitoring/PixelMonitoring/PixelMonitoring/PixelMonModules.h index 387f2ec8901..a7677590ec8 100644 --- a/InnerDetector/InDetMonitoring/PixelMonitoring/PixelMonitoring/PixelMonModules.h +++ b/InnerDetector/InDetMonitoring/PixelMonitoring/PixelMonitoring/PixelMonModules.h @@ -31,14 +31,15 @@ class PixelMonModules 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, bool doIBL = false); + 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, bool doIBL); - PixelMonModules1D(std::string name, std::string title, int nbins, double *arr, bool doIBL); + PixelMonModules1D(std::string name, std::string title, int nbins, double low, double high); + PixelMonModules1D(std::string name, std::string title, int nbins, double *arr); virtual ~PixelMonModules1D(); StatusCode regHist(ManagedMonitorToolBase* thisptr, std::string path, ManagedMonitorToolBase::Interval_t Run); TH1F* IBL[20][14]; @@ -55,14 +56,13 @@ class PixelMonModules1D : public PixelMonModules private: TH1F* m_Dummy; //shouldn't be used unless messed up; TH1F* &getHist(int i); //make looping over all the histos easier. - const bool m_doIBL; }; class PixelMonModulesProf : public PixelMonModules { public: - PixelMonModulesProf(std::string name, std::string title, int nbins, double low, double high, bool doIBL); - PixelMonModulesProf(std::string name, std::string title, int nbins, double *arr, bool doIBL); + PixelMonModulesProf(std::string name, std::string title, int nbins, double low, double high); + PixelMonModulesProf(std::string name, std::string title, int nbins, double *arr); virtual ~PixelMonModulesProf(); StatusCode regHist(ManagedMonitorToolBase* thisptr, std::string path, ManagedMonitorToolBase::Interval_t Run); TProfile_LW* IBL[20][14]; @@ -78,13 +78,12 @@ class PixelMonModulesProf : public PixelMonModules private: TProfile_LW* m_Dummy; //shouldn't be used unless messed up; TProfile_LW* &getHist(int i); //make looping over all the histos easier. - const bool m_doIBL; }; class PixelMonModules2D : public PixelMonModules { public: - PixelMonModules2D(std::string name, std::string title, int nbins0, double low0, double high0,int nbins1, double low1, double high1, bool doIBL); + PixelMonModules2D(std::string name, std::string title, int nbins0, double low0, double high0,int nbins1, double low1, double high1); virtual ~PixelMonModules2D(); StatusCode regHist(ManagedMonitorToolBase* thisptr, std::string path, ManagedMonitorToolBase::Interval_t Run); TH2F* IBL[20][14]; @@ -99,7 +98,6 @@ class PixelMonModules2D : public PixelMonModules private: TH2F* m_Dummy; //shouldn't be used unless messed up; TH2F* &getHist(int i); //make looping over all the histos easier. - const bool m_doIBL; }; #endif diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/src/Clusters.cxx b/InnerDetector/InDetMonitoring/PixelMonitoring/src/Clusters.cxx index 029bf5a411d..5cca08c061e 100644 --- a/InnerDetector/InDetMonitoring/PixelMonitoring/src/Clusters.cxx +++ b/InnerDetector/InDetMonitoring/PixelMonitoring/src/Clusters.cxx @@ -25,6 +25,7 @@ #include "LWHists/TProfile2D_LW.h" #include <sstream> +#include "PixelMonitoring/Components.h" #include "PixelMonitoring/PixelMon2DMapsLW.h" #include "PixelMonitoring/PixelMonModules.h" #include "PixelMonitoring/PixelMon2DProfilesLW.h" @@ -42,13 +43,11 @@ StatusCode PixelMainMon::BookClustersMon(void) std::string path = "Pixel/Clusters"; if(m_doOnTrack) path.replace(path.begin(), path.end(), "Pixel/ClustersOnTrack"); - if(m_doOnPixelTrack) path.replace(path.begin(), path.end(), "Pixel/ClustersOnPixelTrack"); 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"); - if(m_doOnPixelTrack) pathT.replace(pathT.begin(), pathT.end(), "Pixel/TimingOnPixelTrack"); 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 @@ -61,7 +60,7 @@ StatusCode PixelMainMon::BookClustersMon(void) 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 = 150; double min_ibl_tot = -0.5; double max_ibl_tot = min_tot + (1.0*nbins_tot); - int nbins_Q = 70; double min_Q = -0.5; double max_Q = min_Q + (3000.0*nbins_Q); + int nbins_Q = 140; double min_Q = -0.5; double max_Q = min_Q + (1500.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"; @@ -241,7 +240,7 @@ StatusCode PixelMainMon::BookClustersMon(void) } - if (m_doOnTrack || m_doOnPixelTrack) { + 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)); } @@ -249,41 +248,41 @@ StatusCode PixelMainMon::BookClustersMon(void) if (m_do2DMaps) { tmp = "Cluster_Occupancy"; tmp2 = "Cluster occupancy"; - m_cluster_occupancy = new PixelMon2DMapsLW(tmp.c_str(), (tmp2 + m_histTitleExt).c_str(), m_doIBL); + m_cluster_occupancy = new 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 = new PixelMon2DProfilesLW(tmp.c_str(), (tmp2 + m_histTitleExt).c_str(), m_doIBL, false, true); + m_cluster_LVL1A_mod = new PixelMon2DProfilesLW(tmp.c_str(), (tmp2 + m_histTitleExt).c_str(), PixMon::HistConf::kPixIBL2D3D, true); sc = m_cluster_LVL1A_mod->regHist(timeShift); tmp = "Clus_Occ_SizeCut"; tmp2 = "Size>1 Cluster occupancy"; - m_clusocc_sizenot1 = new PixelMon2DMapsLW(tmp.c_str(), (tmp2 + m_histTitleExt).c_str(), m_doIBL); + m_clusocc_sizenot1 = new 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 = new PixelMon2DProfilesLW(tmp.c_str(), (tmp2 + m_histTitleExt).c_str(), m_doIBL, false, true); + m_clus_LVL1A_sizenot1 = new PixelMon2DProfilesLW(tmp.c_str(), (tmp2 + m_histTitleExt).c_str(), PixMon::HistConf::kPixIBL2D3D, true); sc = m_clus_LVL1A_sizenot1->regHist(timeShift); if (m_doOnline){ tmp = "ClusterMap_Mon"; tmp2 = "Cluster map for monitoring"; - m_clustermap_mon = new PixelMon2DMapsLW(tmp.c_str(), (tmp2 + m_histTitleExt).c_str(), m_doIBL); + m_clustermap_mon = new 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 = new PixelMon2DMapsLW(tmp.c_str(), (tmp2 + m_histTitleExt).c_str(), m_doIBL); + m_clustermap_tmp = new 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 = new PixelMon2DProfilesLW(tmp.c_str(), (tmp2 + m_histTitleExt).c_str(), m_doIBL, false, true); + m_clussize_map = new PixelMon2DProfilesLW(tmp.c_str(), (tmp2 + m_histTitleExt).c_str(), PixMon::HistConf::kPixIBL2D3D, true); sc = m_clussize_map->regHist(clusterExpert); tmp = "Cluster_Charge_Map"; tmp2 = "Average cluster charge map"; - m_cluscharge_map = new PixelMon2DProfilesLW(tmp.c_str(), (tmp2 + m_histTitleExt).c_str(), m_doIBL, false, true); + m_cluscharge_map = new PixelMon2DProfilesLW(tmp.c_str(), (tmp2 + m_histTitleExt).c_str(), PixMon::HistConf::kPixIBL2D3D, true); sc = m_cluscharge_map->regHist(clusterExpert); tmp = "Cluster_ToT_Map"; tmp2 = "Average cluster ToT map"; - m_clusToT_map = new PixelMon2DProfilesLW(tmp.c_str(), (tmp2 + m_histTitleExt).c_str(), m_doIBL, false, true); + m_clusToT_map = new PixelMon2DProfilesLW(tmp.c_str(), (tmp2 + m_histTitleExt).c_str(), PixMon::HistConf::kPixIBL2D3D, true); sc = m_clusToT_map->regHist(clusterExpert); @@ -314,18 +313,18 @@ StatusCode PixelMainMon::BookClustersMon(void) } } - if (m_doModules) + if (m_doModules && m_doOnTrack) { - m_cluseff_mod = new PixelMonModulesProf("Clus_track_eff", ("Proportion of clusters on track vs t in module" + m_histTitleExt).c_str(), 2500,-0.5,2499.5,m_doIBL); + m_cluseff_mod = new 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 = new PixelMonModules1D("Cluster_size", ("Cluster size in Module" + m_histTitleExt).c_str(), 20,-0.5,19.5,m_doIBL); + m_cluster_size_mod = new 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 = new PixelMonModules1D("Cluster_num", ("Number of clusters per event in module" + m_histTitleExt).c_str(), 30,-0.5,29.5,m_doIBL); + m_cluster_num_mod = new 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 = new PixelMonModules1D("Cluster_ToT", ("Cluster ToT in Module" + m_histTitleExt).c_str(), 200,0.,200.,m_doIBL); + m_cluster_ToT_mod = new 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) @@ -364,7 +363,7 @@ StatusCode PixelMainMon::BookClustersMon(void) 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 || m_doOnPixelTrack) { + 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)); @@ -376,7 +375,7 @@ StatusCode PixelMainMon::BookClustersMon(void) /// Quick Status if (m_doOfflineAnalysis) { - if (m_doOnTrack || m_doOnPixelTrack) { + if (m_doOnTrack) { hname = makeHistname("Clusters_onTrack_per_lumi_L0_B11_S2_C6", false); htitles = makeHisttitle("Number of clusters on track, L0_B11_S2_C6", ";lumi block;FE ID (16*(6-eta_mod) + 8*(pix_phi/164) + (eta_pix/18);#hits", false); sc = clusterExpert.regHist(m_clusters_onTrack_L0_B11_S2_C6 = TH2F_LW::create(hname.c_str(), htitles.c_str(), nbins_LB, min_LB, max_LB, 96, -0.5, -0.5+96)); @@ -401,7 +400,6 @@ StatusCode PixelMainMon::BookClustersLumiBlockMon(void) std::string path = "Pixel/LumiBlock"; if (m_doOnTrack) path.replace(path.begin(), path.end(), "Pixel/LumiBlockOnTrack"); - if (m_doOnPixelTrack) path.replace(path.begin(), path.end(), "Pixel/LumiBlockOnPixelTrack"); MonGroup lumiBlockHist( this, path.c_str(), lowStat, ATTRIB_MANAGED); //declare a group of histograms StatusCode sc; @@ -409,7 +407,7 @@ StatusCode PixelMainMon::BookClustersLumiBlockMon(void) 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 = new PixelMon2DMapsLW("Cluster_Occupancy_LB", ("Cluster Occupancy" + m_histTitleExt).c_str(), m_doIBL); + m_cluster_occupancy_LB = new 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) { @@ -418,10 +416,10 @@ StatusCode PixelMainMon::BookClustersLumiBlockMon(void) 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)); } - if (m_doModules) { - m_cluster_num_mod_LB = new PixelMonModules1D("Cluster_num_LB", ("Number of clusters per event in module" + m_histTitleExt).c_str(), 20,-0.5,59.5,m_doIBL); + if (m_doModules && m_doOnTrack) { // normally not booked, as doModules is online, doLumiBlock is offline + m_cluster_num_mod_LB = new 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 = new PixelMonModules1D("Cluster_ToT_mod_LB", ("Cluster ToT in Module" + m_histTitleExt).c_str(), 75,0.,300.,m_doIBL); + m_cluster_ToT_mod_LB = new 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); } @@ -448,19 +446,18 @@ StatusCode PixelMainMon::FillClustersMon(void) int nclusters_all=0; int nclusters_ontrack=0; - if (m_doModules){ - if(m_doIBL){ - for(int i=0;i<20;i++){ - for(int j=0;j<14;j++) m_ClusPerEventArray_lI[j][i]=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 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++){ + 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; } @@ -516,7 +513,7 @@ StatusCode PixelMainMon::FillClustersMon(void) int feeta=0; if ( m_doOfflineAnalysis ) { if ( pixlayer == PixLayer::kB0 && GetFEID( pixlayer, m_pixelid->phi_index(clusID), m_pixelid->eta_index(clusID), fephi, feeta) ) { - if ( m_doOnTrack || m_doOnPixelTrack ) { + if ( m_doOnTrack ) { if ( m_pixelid->phi_module(clusID) == 0 && m_pixelid->eta_module(clusID) < 0 ) { if ( OnTrack(clusID,true) ) { if ( m_clusters_onTrack_L0_B11_S2_C6 ) m_clusters_onTrack_L0_B11_S2_C6->Fill( m_manager->lumiBlockNumber(), (16*fabs(6+m_pixelid->eta_module(clusID)))+(8.0*fephi)+feeta ); @@ -530,7 +527,7 @@ StatusCode PixelMainMon::FillClustersMon(void) if (pixlayer != 99) nclusters_all++; // count all (no DBM) clusters on and off track - if( (m_doOnTrack || m_doOnPixelTrack) && !OnTrack(clusID,true) ){ + if( m_doOnTrack && !OnTrack(clusID,true) ){ 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 @@ -660,7 +657,7 @@ StatusCode PixelMainMon::FillClustersMon(void) if (cluster.rdoList().size() > 10) nlargeclusters++; if (cluster.rdoList().size() > 50) nverylargeclusters++; - if (m_doModules)//fill module cluster arrays + if (m_doModules && m_doOnTrack) // fill module cluster arrays { 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)]++; @@ -675,7 +672,7 @@ StatusCode PixelMainMon::FillClustersMon(void) 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_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); } @@ -713,7 +710,7 @@ StatusCode PixelMainMon::FillClustersMon(void) //if(m_clusters_per_lumi_PIX)m_clusters_per_lumi_PIX->Fill(m_manager->lumiBlockNumber(),nclusters-nclusters_IBL); 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_doOnPixelTrack) { + if (m_doOnTrack) { if (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)); } } @@ -721,7 +718,7 @@ StatusCode PixelMainMon::FillClustersMon(void) if (m_largeclusters_per_lumi)m_largeclusters_per_lumi->Fill(m_manager->lumiBlockNumber(), nlargeclusters); if (m_verylargeclusters_per_lumi)m_verylargeclusters_per_lumi->Fill(m_manager->lumiBlockNumber(),nverylargeclusters); if ((nclusters>=1000) && m_highNclusters_per_lumi) m_highNclusters_per_lumi->Fill(m_manager->lumiBlockNumber()); - if (m_doOnTrack || m_doOnPixelTrack) { + if (m_doOnTrack) { if (m_clustersOnOffTrack_per_lumi && nclusters_all>0) m_clustersOnOffTrack_per_lumi->Fill(m_manager->lumiBlockNumber(),(float)nclusters_ontrack/nclusters_all); } @@ -739,7 +736,7 @@ StatusCode PixelMainMon::FillClustersMon(void) if (m_cluster_occupancy_time1&&m_cluster_occupancy_time2&&m_cluster_occupancy_time3) FillTimeHisto(double(nclusters/(1744.0+280*m_doIBL)),m_cluster_occupancy_time1, m_cluster_occupancy_time2, m_cluster_occupancy_time3,10.,60.,360. ); if (m_doLumiBlock && m_num_clusters_LB) m_num_clusters_LB->Fill(nclusters); - if (m_doModules) + if (m_doModules && m_doOnTrack) { PixelID::const_id_iterator idIt = m_pixelid->wafer_begin(); PixelID::const_id_iterator idItEnd = m_pixelid->wafer_end(); diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/src/Components.cxx b/InnerDetector/InDetMonitoring/PixelMonitoring/src/Components.cxx new file mode 100644 index 00000000000..13a7735e91a --- /dev/null +++ b/InnerDetector/InDetMonitoring/PixelMonitoring/src/Components.cxx @@ -0,0 +1,115 @@ +#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"}}; + +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 index 3b0040dacdc..cf2ab68095a 100644 --- a/InnerDetector/InDetMonitoring/PixelMonitoring/src/Errors.cxx +++ b/InnerDetector/InDetMonitoring/PixelMonitoring/src/Errors.cxx @@ -25,6 +25,7 @@ #include <sstream> #include "InDetReadoutGeometry/SiDetectorElement.h" +#include "PixelMonitoring/Components.h" #include "PixelMonitoring/PixelMon2DMapsLW.h" #include "PixelMonitoring/PixelMon2DProfilesLW.h" #include "PixelMonitoring/PixelMonModules.h" @@ -42,7 +43,6 @@ StatusCode PixelMainMon::BookRODErrorMon(void) std::string path = "Pixel/Errors"; std::string path2 = "Pixel/ErrorsExpert"; if (m_doOnTrack) path.replace(path.begin(), path.end(), "Pixel/ErrorsOnTrack"); - if (m_doOnPixelTrack) path.replace(path.begin(), path.end(), "Pixel/ErrorsOnPixelTrack"); 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 @@ -65,6 +65,36 @@ StatusCode PixelMainMon::BookRODErrorMon(void) 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 Trunc FIFO Overflow", "ROD Trunc H/T Limit", "2", "3", "Module Trunc EoC", "SEU Hit Parity", "SEU Reg Parity", "SEU Hamming Code", @@ -190,25 +220,29 @@ StatusCode PixelMainMon::BookRODErrorMon(void) } if (m_doModules) { - m_errors = new PixelMonModules1D("errors", ("Errors in module:ErrorType" + m_histTitleExt + ";Number of Errors").c_str(), 7, 0.5, 7.5, m_doIBL); + m_errors = new 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] = new PixelMon2DMapsLW(error_type_labels[i].first, (error_type_labels[i].second + m_histTitleExt).c_str(), m_doIBL, false, true); + m_errhist_errtype_map[i] = new PixelMon2DMapsLW(error_type_labels[i].first, (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] = new PixelMon2DMapsLW(error_cat_labels[i].first.c_str(), (error_cat_labels[i].second + m_histTitleExt).c_str(), m_doIBL, false, true); + m_errhist_errcat_map[i] = new PixelMon2DMapsLW(error_cat_labels[i].first.c_str(), (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_doOnline) { for (int j = 0; j < kNumErrorStates; j++) { - m_errhist_expert_LB_maps[j] = new PixelMon2DLumiMaps(error_state_labels[j].first + "_int_LB", error_state_labels[j].second + " per event per LB" + m_histTitleExt, "# Errors", m_doIBL, true); + m_errhist_expert_LB_maps[j] = new PixelMon2DLumiMaps(error_state_labels[j].first + "_int_LB", error_state_labels[j].second + " per event per LB" + m_histTitleExt, "# Errors", PixMon::HistConf::kPix); + sc = m_errhist_expert_LB_maps[j]->regHist(rodExpert); + } + for (int j = kNumErrorStates; j < kNumErrorStates+kNumErrorStatesIBL; j++) { + m_errhist_expert_LB_maps[j] = new PixelMon2DLumiMaps(error_state_labelsIBL[j - kNumErrorStates].first + "_int_LB", error_state_labelsIBL[j - kNumErrorStates].second + " per event per LB" + m_histTitleExt, "# Errors", PixMon::HistConf::kIBL); sc = m_errhist_expert_LB_maps[j]->regHist(rodExpert); } } @@ -221,15 +255,28 @@ StatusCode PixelMainMon::BookRODErrorMon(void) } 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] = new PixelMon2DMapsLW(hname.c_str(), htitles.c_str(), m_doIBL, true, true); + m_errhist_expert_maps[j] = new PixelMon2DMapsLW(hname.c_str(), htitles.c_str(), PixMon::HistConf::kPix, true); sc = m_errhist_expert_maps[j]->regHist(rodExpert); } if (m_do2DMaps) { - m_errhist_femcc_errwords_map = new PixelMon2DProfilesLW("femcc_errorwords", ("Average FE/MCC Error Words" + m_histTitleExt).c_str(), m_doIBL); + m_errhist_femcc_errwords_map = new PixelMon2DProfilesLW("femcc_errorwords", ("Average FE/MCC Error Words" + m_histTitleExt).c_str(), PixMon::HistConf::kPixIBL2D3D); sc = m_errhist_femcc_errwords_map->regHist(rodHistos); } + for (int j = 0; j < kNumErrorStatesIBL; j++) { + hname = makeHistname((error_state_labelsIBL[j].first + "_per_lumi_" + modlabel2[PixLayerIBL2D3D::kIBL]), false); + htitles = makeHisttitle(("Average " + error_state_labelsIBL[j].second + " per event per LB, " + modlabel2[PixLayerIBL2D3D::kIBL]), (atext_LB + atext_erf), false); + sc = rodExpert.regHist(m_errhist_expert_IBL_LB[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] = new PixelMon2DMapsLW(hname.c_str(), htitles.c_str(), PixMon::HistConf::kIBL, 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)); @@ -270,19 +317,18 @@ StatusCode PixelMainMon::BookRODErrorLumiBlockMon(void) std::string path = "Pixel/LumiBlock"; if (m_doOnTrack) path.replace(path.begin(), path.end(), "Pixel/LumiBlockOnTrack"); - if (m_doOnPixelTrack) path.replace(path.begin(), path.end(), "Pixel/LumiBlockOnPixelTrack"); MonGroup lumiBlockHist(this, path.c_str(), lowStat, ATTRIB_MANAGED); //declare a group of histograms StatusCode sc; if (m_do2DMaps && !m_doOnline) { - m_errors_LB = new PixelMon2DMapsLW("Errors_LB", ("Errors" + m_histTitleExt).c_str(), m_doIBL, false, true); + m_errors_LB = new PixelMon2DMapsLW("Errors_LB", ("Errors" + m_histTitleExt).c_str(), PixMon::HistConf::kPixDBMIBL2D3D, true); sc = m_errors_LB->regHist(lumiBlockHist); - m_errors_RODSync_mod = new PixelMon2DMapsLW("Errors_RODSync_LB", ("Errors_RODSync" + m_histTitleExt).c_str(), m_doIBL, false, true); + m_errors_RODSync_mod = new 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 = new PixelMon2DMapsLW("Errors_ModSync_LB", ("Errors_ModSync" + m_histTitleExt).c_str(), m_doIBL, false, true); + m_errors_ModSync_mod = new PixelMon2DMapsLW("Errors_ModSync_LB", ("Errors_ModSync" + m_histTitleExt).c_str(), PixMon::HistConf::kPixDBMIBL2D3D, true); sc = m_errors_ModSync_mod->regHist(lumiBlockHist); } @@ -302,6 +348,7 @@ StatusCode PixelMainMon::FillRODErrorMon(void) int num_errors[PixLayerIBL2D3D::COUNT] = {0}; int num_errors_per_bit[PixLayerIBL2D3D::COUNT][kNumErrorBits] = {0}; int num_errors_per_state[PixLayer::COUNT - 1][kNumErrorStates] = {0}; // no IBL here + int num_errors_per_stateIBL[kNumErrorStatesIBL] = {0}; // IBL // Counter for erroneous modules on the layer, per error type and // category (error cat. = error type w/o ROD/MOD distinction). @@ -425,6 +472,7 @@ StatusCode PixelMainMon::FillRODErrorMon(void) if (getErrorState(bit, is_ibl) != 99) { num_errors_per_state[kLayer][getErrorState(bit, is_ibl)]++; + num_errors_per_stateIBL[getErrorState(bit, is_ibl)]++; if (m_errhist_expert_maps[getErrorState(bit, is_ibl)]) m_errhist_expert_maps[getErrorState(bit, is_ibl)]->Fill(WaferID, m_pixelid); if (m_errhist_expert_LB_maps[getErrorState(bit, is_ibl)]) @@ -442,7 +490,7 @@ StatusCode PixelMainMon::FillRODErrorMon(void) unsigned int num_femcc_errwords = 0; // Do the same bit-shifting again, this time for FE/MCC error words. - if (kFeErrorWords.find(id_hash) != kFeErrorWords.end()) { + if (!is_ibl && 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; if (fe_errorword_map.size() > 0) { @@ -535,6 +583,12 @@ StatusCode PixelMainMon::FillRODErrorMon(void) } } + for (int j = 0; j < kNumErrorStatesIBL; j++) { + if (m_errhist_expert_IBL_LB[j]) { + m_errhist_expert_IBL_LB[j]->Fill(kLumiBlock, (float) num_errors_per_stateIBL[j]/m_nActive_mod[PixLayerIBL2D3D::kIBL]); + } + } + for (int i = 0; i < PixLayerIBL2D3D::COUNT; i++) { if (m_errhist_per_bit_LB[i] && m_nActive_mod[i] > 0) { for (int j = 0; j < kNumErrorBits; j++) { @@ -677,6 +731,67 @@ int PixelMainMon::getErrorState(int bit, bool isibl) erstate = 99; break; } } + else { + switch (bit) { + case 3: + erstate = 16; break; // BCID, Synch + case 4: + erstate = 17; break; // LVL1ID, Synch + case 8: + erstate = 18; break; // BCID counter, Synch + case 12: + erstate = 19; break; // L1 trigger input in EODCL counter (write pointer), Synch + case 13: + erstate = 20; break; // L1 trigger request counter to EODCL (read pointer), Synch + case 14: + erstate = 21; break; // L1 register, register is full, Synch + case 15: + erstate = 22; break; // L1 trigger ID in BC register, Synch + case 17: + erstate = 23; break; // Skipped trigger because the L1 register is full, Synch + case 0: + erstate = 24; break; // Row/Column, Trunc + case 18: + erstate = 25; break; // Truncated event, Trunc + case 1: + erstate = 26; break; // Limit error ROD, Trunc + case 5: + erstate = 27; break; // Preamble error, Optical + case 9: + erstate = 28; break; // Hamming code in word 0 in EOCHL, SEU + case 10: + erstate = 29; break; // Hamming code in word 1 in EOCHL, SEU + case 11: + erstate = 30; break; // Hamming code in word 2 in EOCHL, SEU + case 19: + erstate = 31; break; // Triple redundant mismatch in Global Configuration Memory (CNFGMEM,) SEU + case 23: + erstate = 32; break; // Bit flip in CMD, SEU + case 24: + erstate = 33; break; // Triple redundant mismatch in CMD, SEU + case 26: + erstate = 34; break; // Triple redundant mismatch in EFUSE, SEU + case 2: + erstate = 35; break; // Trailer timeout, Timeout + case 7: + erstate = 36; break; // Timeout ROD, Timeout + case 6: + erstate = 37; break; // Masked link + case 16: + erstate = 38; break; // FE readout process error + case 20: + erstate = 39; break; // Write register data error + case 21: + erstate = 40; break; // Address error + case 22: + erstate = 41; break; // Other CMD decoder error + case 25: + erstate = 42; break; // Data bus address + default: + erstate = 99; break; + } + } + return erstate; } diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/src/HelperFunctions.cxx b/InnerDetector/InDetMonitoring/PixelMonitoring/src/HelperFunctions.cxx index 3e32387d704..a7fab828199 100644 --- a/InnerDetector/InDetMonitoring/PixelMonitoring/src/HelperFunctions.cxx +++ b/InnerDetector/InDetMonitoring/PixelMonitoring/src/HelperFunctions.cxx @@ -26,7 +26,6 @@ std::string PixelMainMon :: makeHistname(std::string set, bool ontrk) { std::string name = set; if( ontrk && m_doOnTrack ) name += "_OnTrack"; - if( ontrk && m_doOnPixelTrack ) name += "_OnPixelTrack"; return name; } @@ -34,7 +33,6 @@ std::string PixelMainMon :: makeHisttitle(std::string set, std::string axis, boo { std::string name = set; if( ontrk && m_doOnTrack ) name += "_OnTrack"; - if( ontrk && m_doOnPixelTrack ) name += "_OnPixelTrack"; name = name + m_histTitleExt + axis; return name; } diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/src/Hits.cxx b/InnerDetector/InDetMonitoring/PixelMonitoring/src/Hits.cxx index a8ec82d59cf..2d4be4f21fe 100644 --- a/InnerDetector/InDetMonitoring/PixelMonitoring/src/Hits.cxx +++ b/InnerDetector/InDetMonitoring/PixelMonitoring/src/Hits.cxx @@ -26,6 +26,7 @@ #include "InDetRawData/InDetRawDataContainer.h" #include "InDetRawData/InDetRawDataCLASS_DEF.h" +#include "PixelMonitoring/Components.h" #include "PixelMonitoring/PixelMon2DMapsLW.h" #include "PixelMonitoring/PixelMon2DProfilesLW.h" #include "PixelMonitoring/PixelMonModules.h" @@ -46,13 +47,11 @@ 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"); - if(m_doOnPixelTrack) path.replace(path.begin(), path.end(), "Pixel/HitsOnPixelTrack"); 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"); - if(m_doOnPixelTrack) pathT.replace(pathT.begin(), pathT.end(), "Pixel/TimingOnPixelTrack"); 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 @@ -159,7 +158,7 @@ StatusCode PixelMainMon::BookHitsMon(void) } } - m_hitmap_tmp = new PixelMon2DMapsLW("HitMap_tmp", ("Hit map for monitoring" + m_histTitleExt).c_str(), m_doIBL); + m_hitmap_tmp = new 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++){ @@ -174,7 +173,7 @@ StatusCode PixelMainMon::BookHitsMon(void) sc = rdoShift.regHist(m_occupancy_time2= new TProfile("occupancy_time_1hr", ("Module hit occupancy as function of time over 1 hour. 36 sec/bin" + m_histTitleExt + ";time;module occupancy").c_str(), 99,0.,1.,"i")); sc = rdoShift.regHist(m_occupancy_time3= new TProfile("occupancy_time_6hr", ("Module hit occupancy as function of time over 6 hours. 3.6 min/bin" + m_histTitleExt + ";time;module occupancy").c_str(), 99,0.,1.,"i")); - m_hitmap_mon = new PixelMon2DMapsLW("HitMap_Mon", ("Hit map for monitoring" + m_histTitleExt).c_str(), m_doIBL); + m_hitmap_mon = new 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++){ @@ -234,34 +233,32 @@ StatusCode PixelMainMon::BookHitsMon(void) if (m_do2DMaps) { - m_occupancy = new PixelMon2DMapsLW("Occupancy", ("hit map"+ m_histTitleExt).c_str(), m_doIBL); + m_occupancy = new PixelMon2DMapsLW("Occupancy", ("hit map"+ m_histTitleExt).c_str(), PixMon::HistConf::kPixDBMIBL2D3D); sc = m_occupancy->regHist(rdoShift); - m_average_pixocc = new PixelMon2DMapsLW("Occupancy_per_pixel", ("#hits / pixel" + m_histTitleExt).c_str(), m_doIBL, false, true); + m_average_pixocc = new PixelMon2DMapsLW("Occupancy_per_pixel", ("#hits / pixel" + m_histTitleExt).c_str(), PixMon::HistConf::kPixDBMIBL2D3D, true); sc = m_average_pixocc->regHist(rdoShift); - m_occupancy_pix_evt = new PixelMon2DProfilesLW("Occupancy_per_pixel_event", ("#hits / pixel / event" + m_histTitleExt).c_str(), m_doIBL); + m_occupancy_pix_evt = new 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 = new 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",m_doIBL); + m_Lvl1ID_diff_mod_ATLAS_per_LB = new 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 = new 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",m_doIBL); + m_Lvl1ID_absdiff_mod_ATLAS_per_LB = new 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) { - m_hit_num_mod = new PixelMonModules1D("Hit_num", ("Number of hits in a module in an event" + m_histTitleExt).c_str(), 15,-0.5,149.5,m_doIBL); + m_hit_num_mod = new PixelMonModules1D("Hit_num", ("Number of hits in a module in an event" + m_histTitleExt).c_str(), 15,-0.5,149.5); sc = m_hit_num_mod->regHist(this,(path+"/Modules_NumberOfHits").c_str(),run); - m_hiteff_mod = new PixelMonModulesProf("Hit_track_eff", ("Proportion of hits on track" + m_histTitleExt).c_str(), 2500,-0.5,2499.5,m_doIBL); + m_hiteff_mod = new 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); - } - if (m_doFEChipSummary) - { - m_FE_chip_hit_summary = new PixelMonModules1D("FE_Chip_Summary", ("FE Chip Summary" + m_histTitleExt).c_str(), 16,-0.5,15.5,m_doIBL); + m_FE_chip_hit_summary = new 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; @@ -284,14 +281,9 @@ StatusCode PixelMainMon::BookHitsMon(void) } if (m_doPixelOccupancy) { - m_pixel_occupancy = new PixelMonModules2D("Pixel_Occupancy", ("Pixel Occupancy" + m_histTitleExt).c_str(), 160, -0.,160.,336,0.,336.,m_doIBL); + m_pixel_occupancy = new 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_doRodSim) - { - sc = rdoExpert.regHist(m_RodSim_BCID_minus_ToT= TH1F_LW::create("RodSim_BCID_minus_ToT", ("BCID - ToT" + m_histTitleExt).c_str(), 300,-0.5,299.5)); - sc = rdoExpert.regHist(m_RodSim_FrontEnd_minus_Lvl1ID= TH1F_LW::create("RodSim_FrontEnd_minus_Lvl1ID", ("Front End Chip - Lvl1ID" + m_histTitleExt).c_str(), 33,-16.5,16.5)); - } if (m_doDetails) /// 4 special modules @@ -346,7 +338,6 @@ StatusCode PixelMainMon::BookHitsLumiBlockMon(void) std::string path = "Pixel/LumiBlock"; if(m_doOnTrack) path.replace(path.begin(), path.end(), "Pixel/LumiBlockOnTrack"); - if(m_doOnPixelTrack) path.replace(path.begin(), path.end(), "Pixel/LumiBlockOnPixelTrack"); MonGroup lumiBlockHist( this, path.c_str(), lowStat, ATTRIB_MANAGED); //declare a group of histograms std::string hname; @@ -373,7 +364,7 @@ StatusCode PixelMainMon::BookHitsLumiBlockMon(void) 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 = new PixelMonModules1D(hname.c_str(), htitles.c_str(), 20, -0.5, 19.5, m_doIBL); + m_hit_num_mod_LB = new 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++){ @@ -390,7 +381,7 @@ StatusCode PixelMainMon::BookHitsLumiBlockMon(void) 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 = new PixelMon2DMapsLW("Occupancy_10min", ("hit occupancy" + m_histTitleExt).c_str(), m_doIBL); + m_occupancy_10min = new 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)"); @@ -523,7 +514,7 @@ StatusCode PixelMainMon::FillHitsMon(void) //Called once per event for (p_rdo=PixelCollection->begin(); p_rdo!=PixelCollection->end(); ++p_rdo) { rdoID=(*p_rdo)->identify(); - if (m_doOnTrack || m_doOnPixelTrack) if(!OnTrack(rdoID,false) ) continue; //if we only want hits on track, and the hit is NOT on the track, skip filling + if (m_doOnTrack) if(!OnTrack(rdoID,false) ) continue; //if we only want hits on track, and the hit is NOT on the track, skip filling 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); @@ -577,10 +568,6 @@ StatusCode PixelMainMon::FillHitsMon(void) //Called once per event if (m_Atlas_BCID) m_Atlas_BCID->Fill(pix_rod_bcid); //defined at the start of the method 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_doRodSim) { - if (m_RodSim_FrontEnd_minus_Lvl1ID) m_RodSim_FrontEnd_minus_Lvl1ID->Fill(m_pixelCableSvc->getFE(&rdoID,rdoID) -(*p_rdo)->getLVL1ID()); - if (m_RodSim_BCID_minus_ToT) m_RodSim_BCID_minus_ToT->Fill((*p_rdo)->getBCID() - (*p_rdo)->getToT() ); - } if (m_FE_chip_hit_summary) m_FE_chip_hit_summary->Fill(m_pixelCableSvc->getFE(&rdoID,rdoID),rdoID,m_pixelid); diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelDCSMon.cxx b/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelDCSMon.cxx index 17f2be0b484..9ba2564b161 100644 --- a/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelDCSMon.cxx +++ b/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelDCSMon.cxx @@ -41,18 +41,10 @@ StatusCode PixelMainMon::BookPixelDCSMon(void) msg(MSG::DEBUG) << "[BookPixelDCSMon]" << endmsg; - //if(m_doOnTrack) return StatusCode::SUCCESS; - std::string path = "Pixel/DCS"; if(m_doOnTrack) path.replace(path.begin(), path.end(), "Pixel/DCSOnTrack"); - if(m_doOnPixelTrack) path.replace(path.begin(), path.end(), "Pixel/DCSOnPixelTrack"); - //MonGroup dcsShift( this, path.c_str(), run, ATTRIB_MANAGED ); //declare a group of histograms MonGroup dcsExpert ( this, path.c_str(), run, ATTRIB_MANAGED ); //declare a group of histograms - //sc = dcsExpert.regHist(m_hist_moduleTemperature2D = TH2F_LW::create("module Temperature_chanNum_all", "Module Temprerature vs Channel Number; Channel Number;Temperature",2048,0,2048,100,-15,5)); - //sc = dcsExpert.regHist(m_hist_coolingPipeTemperatureInlet2D = TH2F_LW::create("cooling Pipe TemperatureInlet_chanNum", "cooling Pipe TempreratureInlet vs Channel Number; Channel Number;Temperature",14,1,15,150,-15,15)); - //sc = dcsExpert.regHist(m_hist_coolingPipeTemperatureOutlet2D = TH2F_LW::create("cooling Pipe TemperatureOutlet_chanNum", "cooling Pipe TempreratureOutlet vs Channel Number; Channel Number;Temperature",14,1,15,150,-15,15)); - //sc = dcsExpert.regHist(m_hist_HV_voltage2D = TH2F_LW::create("HV voltage_chanNum", "HV vs Channel Number; Channel Number;HV",14,1,15,100,-100,0)); 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; @@ -579,39 +571,6 @@ StatusCode PixelMainMon::FillPixelDCSMon(void) msg(MSG::DEBUG) << "[FillPixelDCSMon]" << endmsg; - // loop over DCS directories -// const CondAttrListCollection* atrlistcol; -// for (std::vector<std::string>::const_iterator itr=m_atrcollist.begin(); -// itr!=m_atrcollist.end();++itr) { -// if (StatusCode::SUCCESS==detStore()->retrieve(atrlistcol,*itr)) { -// // loop over collection -// int chanNum(0); // loop counter -// 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 var = 0.; -// int element_index = 0; // 0 or 1 -// for (auto& chan : (*citr).second) { -// try { -// var = chan.data<float>(); -// if( m_elementsMap[*itr][element_index] == "temperature") m_moduleTemperature2D->Fill(chanNum, var); -// } -// catch (...) -// { -// ATH_MSG_ERROR("Channel " << (*citr).first << " does not have any values!"); -// continue; -// } -// } -// chanNum++; -// } -// } else { -// ATH_MSG_INFO("Could not retrieve CondAttrListCollection " << *itr); -// } -// } - // loop over DCS directories const CondAttrListCollection* atrlistcol; const CondAttrListCollection* atrlistcol_temperature; @@ -1199,7 +1158,6 @@ StatusCode PixelMainMon::ProcPixelDCSMon(void) for(const auto& valueMap : *( m_coolingPipeTemperatureInlet->m_values->at( chanNum ) ) ){ LB = valueMap.first; value = valueMap.second; - //m_hist_coolingPipeTemperatureInlet2D->Fill(chanNum, 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); @@ -1253,7 +1211,6 @@ StatusCode PixelMainMon::ProcPixelDCSMon(void) for(const auto& valueMap : *( m_LV_voltage->m_values->at( chanNum ) ) ){ LB = valueMap.first; value = valueMap.second; - //m_hist_coolingPipeTemperatureInlet2D->Fill(chanNum, valueMap.second); //m_hist_Pipes_inlet2D->Fill(staveNum, value); //m_hist_Pipes_inletLB[staveNum - 1]->Fill(LB,value); //std::cout << "ProcPixelDCSMon(): LB " << LB << ", value " << value << std::endl; @@ -1284,7 +1241,6 @@ StatusCode PixelMainMon::ProcPixelDCSMon(void) LB = valueMap.first; value = valueMap.second; //m_hist_Pipes_outlet2D->Fill(staveNum, value); - ////m_hist_coolingPipeTemperatureOutlet2D->Fill(chanNum, valueMap.second); //m_hist_Pipes_outletLB[staveNum - 1]->Fill(LB,value); m_hist_LB_moduleGroup_LVcurrent[staveNum - 1]->Fill(LB, moduleGroup, value); m_hist_LB_staveID_LVcurrent->Fill(LB,staveNum,value); diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelMainMon.cxx b/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelMainMon.cxx index 39d3f795209..7980fa5dccb 100755 --- a/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelMainMon.cxx +++ b/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelMainMon.cxx @@ -90,19 +90,14 @@ PixelMainMon::PixelMainMon(const std::string & type, declareProperty("TrackName", m_TracksName = "Pixel_Cosmic_Tracks"); declareProperty("onTrack", m_doOnTrack = false); //using inner detector tracks - declareProperty("onPixelTrack", m_doOnPixelTrack = false); //using pixel only tracks declareProperty("do2DMaps", m_do2DMaps = false); declareProperty("doModules", m_doModules = false); - declareProperty("doFEChipSummary", m_doFEChipSummary = 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("doRodSim", m_doRodSim = false); declareProperty("doDetails", m_doDetails = false); - declareProperty("doSpectrum", m_doSpectrum = false); - declareProperty("doNoiseMap", m_doNoiseMap = false); declareProperty("doTiming", m_doTiming = false); declareProperty("doLumiBlock", m_doLumiBlock = false); declareProperty("doOfflineAnalysis",m_doOfflineAnalysis = false); // !!! if true using a lot of memory to be absolutely avoided for monitoring @@ -116,7 +111,6 @@ PixelMainMon::PixelMainMon(const std::string & type, declareProperty("doStatus", m_doStatus = false); declareProperty("doDCS", m_doDCS = false); - declareProperty("doDegFactorMap", m_doDegFactorMap = true); declareProperty("doHeavyIonMon", m_doHeavyIonMon = false); declareProperty("doIBL", m_doIBL = false); @@ -126,7 +120,7 @@ PixelMainMon::PixelMainMon(const std::string & type, declareProperty("DetailsMod2", m_DetailsMod2 = ""); declareProperty("DetailsMod3", m_DetailsMod3 = ""); declareProperty("DetailsMod4", m_DetailsMod4 = ""); - declareProperty("OccupancyCut", m_occupancy_cut = 1e-5); + m_lbRange = 3000; m_bcidRange = 3600; @@ -227,9 +221,6 @@ PixelMainMon::PixelMainMon(const std::string & type, m_hiteff_mod = 0; m_FE_chip_hit_summary = 0; m_pixel_occupancy = 0; - /// ROD Sim - m_RodSim_BCID_minus_ToT = 0; - m_RodSim_FrontEnd_minus_Lvl1ID = 0; /// details m_Details_mod1_num_hits = 0; m_Details_mod2_num_hits = 0; @@ -275,9 +266,6 @@ PixelMainMon::PixelMainMon(const std::string & type, m_LorentzAngle_B0 = 0; m_LorentzAngle_B1 = 0; m_LorentzAngle_B2 = 0; - /// degradation factor - m_degFactorMap = 0; - m_degFactorMap_per_lumi = 0; /// cluster size memset(m_clusize_ontrack_mod, 0, sizeof(m_clusize_ontrack_mod)); memset(m_clusize_offtrack_mod, 0, sizeof(m_clusize_offtrack_mod)); @@ -714,15 +702,6 @@ StatusCode PixelMainMon::bookHistograms() if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "bookHistograms()" << endmsg; - if(m_environment==AthenaMonManager::tier0Raw&&!m_doOnline) - { - //m_doRDO = false; - //m_doRODError = false; - //m_doSpacePoint = false; - //m_doCluster = false; - //m_doStatus = false; - //m_doTrack = false; - } if(m_environment==AthenaMonManager::tier0ESD&&!m_doOnline) { m_doRDO = false; @@ -782,7 +761,6 @@ StatusCode PixelMainMon::bookHistograms() /// std::string path_hits = "Pixel/Hits"; if(m_doOnTrack) path_hits.replace(path_hits.begin(), path_hits.end(), "Pixel/HitsOnTrack"); - if(m_doOnPixelTrack) path_hits.replace(path_hits.begin(), path_hits.end(), "Pixel/HitsOnPixelTrack"); 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))); @@ -793,7 +771,6 @@ StatusCode PixelMainMon::bookHistograms() /// std::string path = "Pixel/Errors"; if(m_doOnTrack) path.replace(path.begin(), path.end(), "Pixel/ErrorsOnTrack"); - if(m_doOnPixelTrack) path.replace(path.begin(), path.end(), "Pixel/ErrorsOnPixelTrack"); 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; @@ -1037,8 +1014,6 @@ StatusCode PixelMainMon::procHistograms() if ( endOfLumiBlockFlag() ) { m_LBendTime = m_currentTime; - //if (m_doTrack) { sc=ProcTrackMon(); } - //if (sc.isFailure()) if(msgLvl(MSG::INFO)) msg(MSG::INFO) << "Could not proc histograms" << endmsg; } if ( !m_doOnline && endOfRunFlag() ) @@ -1073,4 +1048,3 @@ StatusCode PixelMainMon::procHistograms() return StatusCode::SUCCESS; } - diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelMon2DLumiMaps.cxx b/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelMon2DLumiMaps.cxx index 49b22a83e66..ae9aabbc4c1 100644 --- a/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelMon2DLumiMaps.cxx +++ b/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelMon2DLumiMaps.cxx @@ -7,36 +7,87 @@ /////////////////////////////////////////////////////////////////////////////// #include "PixelMonitoring/PixelMon2DLumiMaps.h" +#include "PixelMonitoring/Components.h" #include "InDetIdentifier/PixelID.h" #include "LWHists/TH2F_LW.h" #include "GaudiKernel/StatusCode.h" #include <string.h> -PixelMon2DLumiMaps::PixelMon2DLumiMaps(std::string name, std::string title, std::string zlabel, bool doIBL, bool errorHist) : m_doIBL(doIBL), m_errorHist(errorHist) +PixelMon2DLumiMaps::PixelMon2DLumiMaps(std::string name, std::string title, std::string zlabel, const PixMon::HistConf& config) + : IBLlbm(nullptr), + B0lbm(nullptr), + B1lbm(nullptr), + B2lbm(nullptr), + Albm(nullptr), + Clbm(nullptr), + DBMAlbm(nullptr), + DBMClbm(nullptr), + m_config(config) { const int lbRange = 3000; - if (m_doIBL && !m_errorHist) { - IBLlbm = TH2F_LW::create((name+"_2D_Map_IBL").c_str(),(title + ", IBL " + " (Map);LB;Module;" + zlabel).c_str(),lbRange,-0.5,-0.5 + (float)lbRange,280,-0.5,279.5); - } - B0lbm = TH2F_LW::create((name+"_2D_Map_B0").c_str(), (title + ", B0 " + " (Map);LB;Module;" + zlabel).c_str(),lbRange,-0.5,-0.5 + (float)lbRange,286,-0.5,285.5); - B1lbm = TH2F_LW::create((name+"_2D_Map_B1").c_str(), (title + ", B1 " + " (Map);LB;Module;" + zlabel).c_str(),lbRange,-0.5,-0.5 + (float)lbRange,494,-0.5,493.5); - B2lbm = TH2F_LW::create((name+"_2D_Map_B2").c_str(), (title + ", B2 " + " (Map);LB;Module;" + zlabel).c_str(),lbRange,-0.5,-0.5 + (float)lbRange,676,-0.5,675.5); - Albm = TH2F_LW::create((name+"_2D_Map_ECA" ).c_str(),(title + ", ECA " + " (Map);LB;Module;" + zlabel).c_str(),lbRange,-0.5,-0.5 + (float)lbRange,144,-0.5,143.5); - Clbm = TH2F_LW::create((name+"_2D_Map_ECC" ).c_str(),(title + ", ECC " + " (Map);LB;Module;" + zlabel).c_str(),lbRange,-0.5,-0.5 + (float)lbRange,144,-0.5,143.5); + int num_modules; + if (m_doIBL && PixMon::HasComponent(m_config, PixMon::LayerIBL2D3DDBM::kIBL)) { + num_modules = PixMon::kNumStavesIBL * (PixMon::kNumModulesIBL2D + PixMon::kNumModulesIBL3D); + IBLlbm = 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; + B0lbm = 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; + B1lbm = 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; + B2lbm = 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; + Albm = 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; + Clbm = 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; + DBMAlbm = 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; + DBMClbm = 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); + } + + // We do not have support for IBL2D/3D in this class, but the histogram + // array should look the same for all classes. Therefore, we fill the + // blanks for IBL2D/3d with null pointers. + m_histograms = {IBLlbm, nullptr, nullptr, B0lbm, B1lbm, B2lbm, Albm, Clbm, DBMAlbm, DBMClbm}; formatHist(); } PixelMon2DLumiMaps::~PixelMon2DLumiMaps() { - if (m_doIBL && !m_errorHist) { - LWHist::safeDelete(IBLlbm);//includes null pointer check - } - LWHist::safeDelete(B0lbm); - LWHist::safeDelete(B1lbm); - LWHist::safeDelete(B2lbm); - LWHist::safeDelete(Albm); - LWHist::safeDelete(Clbm); + for (auto& hist : m_histograms) { + if (hist) LWHist::safeDelete(hist); + } } void PixelMon2DLumiMaps::Fill(double LB,Identifier &id, const PixelID* pixID,double weight) @@ -45,20 +96,24 @@ void PixelMon2DLumiMaps::Fill(double LB,Identifier &id, const PixelID* pixID,dou const int pm = pixID->phi_module(id); int ld = pixID->layer_disk(id); - if (bec == 2) { + if (bec == 2 && Albm) { Albm->Fill(LB, ld * 48 + pm, weight); - } else if (bec == -2) { + } else if (bec == -2 && Clbm) { Clbm->Fill(LB, ld * 48 + pm, weight); + } else if (bec == 4 && DBMAlbm) { + DBMAlbm->Fill(LB, ld * 4 + pm, weight); + } else if (bec == -4 && DBMClbm) { + DBMClbm->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) { + if (ld == 0 && B0lbm) { B0lbm->Fill(LB, em + 13 * pm, weight); - }else if (ld == 1) { + }else if (ld == 1 && B1lbm) { B1lbm->Fill(LB, em + 13 * pm, weight); - } else if (ld == 2) { + } else if (ld == 2 && B2lbm) { B2lbm->Fill(LB, em + 13 * pm, weight); - } else if (ld == -1 && !m_errorHist && m_doIBL) { + } else if (ld == -1 && IBLlbm) { IBLlbm->Fill(LB, em + 4 + 20 * pm, weight); } } @@ -66,140 +121,89 @@ void PixelMon2DLumiMaps::Fill(double LB,Identifier &id, const PixelID* pixID,dou void PixelMon2DLumiMaps::formatHist() { - const int ndisk = 3; - const int nphi = 48; - const char *disk[ndisk] = { "D1", "D2", "D3" }; - const int nmod = 13; - const int nmodIBL = 20; - const char *mod[nmod] = { "M6C", "M5C", "M4C", "M3C", "M2C", "M1C", "M0", "M1A", "M2A", "M3A", "M4A", "M5A", "M6A" }; - const char *modIBL[nmodIBL] = { - "M4_C8_2", "M4_C8_1", "M4_C7_2", "M4_C7_1", "M3_C6", "M3_C5", "M2_C4", "M1_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" }; - char label[30]; - const int nstaveb = 14; - const char *staveb[nstaveb] = { - "S01", "S02", "S03", "S04", "S05", "S06","S07", - "S08", "S09", "S10", "S11", "S12", "S13","S14"}; - 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[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"}; - const char *nstaveC[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"}; - - int count = 1; - for (int j = 0; j < ndisk; j++) { - for (int i = 0; i < nphi; i++) { - sprintf(label, "%sA_%s", disk[j], nstaveA[i]); - Albm->GetYaxis()->SetBinLabel(count, label); - sprintf(label, "%sC_%s", disk[j], nstaveC[i]); - Clbm->GetYaxis()->SetBinLabel(count, label); - count++; + std::string label; + unsigned int count = 1; + if (Albm && Clbm) { + 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); + Albm->GetYaxis()->SetBinLabel(count, label.c_str()); + label = PixMon::LayersDisk.at(j) + "C_" + PixMon::ModulesECC.at(i); + Clbm->GetYaxis()->SetBinLabel(count, label.c_str()); + count++; + } } + count = 1; } - count = 1; - for (int i = 0; i < nstave0; i++) { - for (int j = 0; j < nmod; j++) { - sprintf(label, "L0_%s_%s", stave0[i], mod[j]); - B0lbm->GetYaxis()->SetBinLabel(count, label); - count++; + if (DBMAlbm && DBMClbm) { + 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); + DBMAlbm->GetYaxis()->SetBinLabel(count, label.c_str()); + label = PixMon::LayersDBM.at(j) + "C_" + PixMon::ModulesDBM.at(i); + DBMClbm->GetYaxis()->SetBinLabel(count, label.c_str()); + count++; + } } + count = 1; } - count = 1; - for (int i = 0; i < nstave1; i++) { - for (int j = 0; j < nmod; j++) { - sprintf(label, "L1_%s_%s", stave1[i], mod[j]); - B1lbm->GetYaxis()->SetBinLabel(count, label); - count++; + if (B0lbm && B1lbm && B2lbm) { + 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); + B0lbm->GetYaxis()->SetBinLabel(count, label.c_str()); + count++; + } } - } - count = 1; - for (int i = 0; i < nstave2; i++) { - for (int j = 0; j < nmod; j++) { - sprintf(label, "L2_%s_%s", stave2[i], mod[j]); - B2lbm->GetYaxis()->SetBinLabel(count, label); - count++; - } - } - count = 1; - if (!m_errorHist && m_doIBL) { - for (int i = 0; i < nstaveb; i++) { - for (int j = 0; j < nmodIBL; j++) { - sprintf(label, "IBL_%s_%s", staveb[i], modIBL[j]); - IBLlbm->GetYaxis()->SetBinLabel(count, label); + 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); + B1lbm->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); + B2lbm->GetYaxis()->SetBinLabel(count, label.c_str()); count++; - } + } } + count = 1; } - - if (!m_errorHist && m_doIBL) { - IBLlbm->GetYaxis()->SetLabelSize(0.04); - IBLlbm->SetOption("colz"); + + if (IBLlbm) { + 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); + IBLlbm->GetYaxis()->SetBinLabel(count, label.c_str()); + count++; + } + } } - //Make the text smaller - B0lbm->GetYaxis()->SetLabelSize(0.04); - B1lbm->GetYaxis()->SetLabelSize(0.04); - B2lbm->GetYaxis()->SetLabelSize(0.04); - Albm->GetYaxis()->SetLabelSize(0.04); - Clbm->GetYaxis()->SetLabelSize(0.04); - //put histograms in the easier to read colz format - B0lbm->SetOption("colz"); - B1lbm->SetOption("colz"); - B2lbm->SetOption("colz"); - Albm->SetOption("colz"); - Clbm->SetOption("colz"); + for (auto& hist : m_histograms) { + if (!hist) continue; + hist->GetYaxis()->SetLabelSize(0.04); + hist->SetOption("colz"); + hist->SetMinimum(0.); + } } StatusCode PixelMon2DLumiMaps::regHist(ManagedMonitorToolBase::MonGroup &group) { StatusCode sc = StatusCode::SUCCESS; - if (!m_errorHist && m_doIBL) { - if (group.regHist(IBLlbm).isFailure()) sc = StatusCode::FAILURE; - } - if (group.regHist(B0lbm).isFailure()) sc = StatusCode::FAILURE; - if (group.regHist(B1lbm).isFailure()) sc = StatusCode::FAILURE; - if (group.regHist(B2lbm).isFailure()) sc = StatusCode::FAILURE; - if (group.regHist(Albm).isFailure()) sc = StatusCode::FAILURE; - if (group.regHist(Clbm).isFailure()) sc = StatusCode::FAILURE; + + for (auto& hist : m_histograms) { + if (!hist) continue; + if (group.regHist(hist).isFailure()) { + sc = StatusCode::FAILURE; + } + } return sc; } + +const bool PixelMon2DLumiMaps::m_doIBL{true}; diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelMon2DLumiProfiles.cxx b/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelMon2DLumiProfiles.cxx index 9ba7d2df3cb..3e64dcf54f0 100644 --- a/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelMon2DLumiProfiles.cxx +++ b/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelMon2DLumiProfiles.cxx @@ -6,37 +6,88 @@ // Function to handle 2D maps of modules, one for each region /////////////////////////////////////////////////////////////////////////////// +#include "PixelMonitoring/Components.h" #include "PixelMonitoring/PixelMon2DLumiProfiles.h" #include "InDetIdentifier/PixelID.h" #include "LWHists/TProfile2D_LW.h" #include "GaudiKernel/StatusCode.h" #include <string.h> -PixelMon2DLumiProfiles::PixelMon2DLumiProfiles(std::string name, std::string title, std::string zlabel, bool doIBL, bool errorHist) : m_doIBL(doIBL), m_errorHist(errorHist) +PixelMon2DLumiProfiles::PixelMon2DLumiProfiles(std::string name, std::string title, std::string zlabel, const PixMon::HistConf& config) + : IBLlbp(nullptr), + B0lbp(nullptr), + B1lbp(nullptr), + B2lbp(nullptr), + Albp(nullptr), + Clbp(nullptr), + DBMAlbp(nullptr), + DBMClbp(nullptr), + m_config(config) { const int lbRange = 3000; - if (m_doIBL && !m_errorHist) { - IBLlbp= TProfile2D_LW::create((name+"_2D_Profile_IBL").c_str(), (title + ", IBL " + title + " (Profile);LB;Module;" + zlabel).c_str(),lbRange,-0.5,-0.5+(float)lbRange,280,-0.5,279.5); - } - B0lbp = TProfile2D_LW::create((name+"_2D_Profile_B0").c_str(), (title + ", B0 " + title + " (Profile);LB;Module;" + zlabel).c_str(),lbRange,-0.5,-0.5+(float)lbRange,286,-0.5,285.5); - B1lbp = TProfile2D_LW::create((name+"_2D_Profile_B1").c_str(), (title + ", B1 " + title + " (Profile);LB;Module;" + zlabel).c_str(),lbRange,-0.5,-0.5+(float)lbRange,494,-0.5,493.5); - B2lbp = TProfile2D_LW::create((name+"_2D_Profile_B2").c_str(), (title + ", B2 " + title + " (Profile);LB;Module;" + zlabel).c_str(),lbRange,-0.5,-0.5+(float)lbRange,676,-0.5,675.5); - Albp = TProfile2D_LW::create((name+"_2D_Profile_ECA" ).c_str(),(title + ", ECA " + title + " (Profile);LB;Module;" + zlabel).c_str(),lbRange,-0.5,-0.5+(float)lbRange,144,-0.5,143.5); - Clbp = TProfile2D_LW::create((name+"_2D_Profile_ECC" ).c_str(),(title + ", ECC " + title + " (Profile);LB;Module;" + zlabel).c_str(),lbRange,-0.5,-0.5+(float)lbRange,144,-0.5,143.5); + int num_modules; + if (m_doIBL && PixMon::HasComponent(m_config, PixMon::LayerIBL2D3DDBM::kIBL)) { + num_modules = PixMon::kNumStavesIBL * (PixMon::kNumModulesIBL2D + PixMon::kNumModulesIBL3D); + IBLlbp= 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; + B0lbp = 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; + B1lbp = 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;; + B2lbp = 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; + Albp = 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; + Clbp = 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; + DBMAlbp = 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; + DBMClbp = 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); + } + + // We do not have support for IBL2D/3D in this class, but the histogram + // array should look the same for all classes. Therefore, we fill the + // blanks for IBL2D/3d with null pointers. + m_histograms = {IBLlbp, nullptr, nullptr, B0lbp, B1lbp, B2lbp, Albp, Clbp, DBMAlbp, DBMClbp}; formatHist(); } PixelMon2DLumiProfiles::~PixelMon2DLumiProfiles() { - if (m_doIBL && !m_errorHist) { - LWHist::safeDelete(IBLlbp); - } - LWHist::safeDelete(B0lbp); - LWHist::safeDelete(B1lbp); - LWHist::safeDelete(B2lbp); - LWHist::safeDelete(Albp); - LWHist::safeDelete(Clbp); + for (auto& hist : m_histograms) { + if (hist) LWHist::safeDelete(hist); + } } void PixelMon2DLumiProfiles::Fill(double LB,Identifier &id, const PixelID* pixID, double weight) @@ -45,20 +96,24 @@ void PixelMon2DLumiProfiles::Fill(double LB,Identifier &id, const PixelID* pixID const int pm = pixID->phi_module(id); int ld = pixID->layer_disk(id); - if (bec == 2) { + if (bec == 2 && Albp) { Albp->Fill(LB, ld * 48 + pm, weight); - } else if (bec == -2) { + } else if (bec == -2 && Clbp) { Clbp->Fill(LB, ld * 48 + pm, weight); + } else if (bec == 4 && DBMAlbp) { + DBMAlbp->Fill(LB, ld * 4 + pm, weight); + } else if (bec == -4 && DBMClbp) { + DBMClbp->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) { + if (ld == 0 && B0lbp) { B0lbp->Fill(LB, em + 13 * pm, weight); - } else if (ld == 1) { + } else if (ld == 1 && B1lbp) { B1lbp->Fill(LB, em + 13 * pm, weight); - } else if (ld == 2) { + } else if (ld == 2 && B2lbp) { B2lbp->Fill(LB, em + 13 * pm, weight); - } else if (ld == -1 && !m_errorHist && m_doIBL) { + } else if (ld == -1 && IBLlbp) { IBLlbp->Fill(LB, em + 4 + 20 * pm, weight); } } @@ -67,141 +122,91 @@ void PixelMon2DLumiProfiles::Fill(double LB,Identifier &id, const PixelID* pixID void PixelMon2DLumiProfiles::formatHist() { - const int ndisk = 3; - const int nphi = 48; - const char *disk[ndisk] = { "D1", "D2", "D3" }; - const int nmod = 13; - const int nmodIBL = 20; - const char *mod[nmod] = { "M6C", "M5C", "M4C", "M3C", "M2C", "M1C", "M0", "M1A", "M2A", "M3A", "M4A", "M5A", "M6A" } ; - const char *modIBL[nmodIBL] = { - "M4_C8_2", "M4_C8_1", "M4_C7_2", "M4_C7_1", "M3_C6", "M3_C5", "M2_C4", "M1_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" }; - char label[30]; - - const int nstaveb = 14; - const char *staveb[nstaveb] = { - "S01", "S02", "S03", "S04", "S05", "S06","S07", - "S08", "S09", "S10", "S11", "S12", "S13","S14"}; - 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[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"}; - const char *nstaveC[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"}; - - int count = 1; - for (int j = 0; j < ndisk; j++) { - for (int i = 0; i < nphi; i++) { - sprintf(label, "%sA_%s", disk[j], nstaveA[i]); - Albp->GetYaxis()->SetBinLabel(count, label); - sprintf(label, "%sC_%s", disk[j], nstaveC[i]); - Clbp->GetYaxis()->SetBinLabel(count, label); - count++; + std::string label; + unsigned int count = 1; + if (Albp && Clbp) { + 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); + Albp->GetYaxis()->SetBinLabel(count, label.c_str()); + label = PixMon::LayersDisk.at(j) + "C_" + PixMon::ModulesECC.at(i); + Clbp->GetYaxis()->SetBinLabel(count, label.c_str()); + count++; + } } + count = 1; } - count = 1; - for (int i = 0; i < nstave0; i++) { - for (int j = 0; j < nmod; j++) { - sprintf(label, "L0_%s_%s", stave0[i], mod[j]); - B0lbp->GetYaxis()->SetBinLabel(count, label); - count++; + if (DBMAlbp && DBMClbp) { + 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); + DBMAlbp->GetYaxis()->SetBinLabel(count, label.c_str()); + label = PixMon::LayersDBM.at(j) + "C_" + PixMon::ModulesDBM.at(i); + DBMClbp->GetYaxis()->SetBinLabel(count, label.c_str()); + count++; + } } + count = 1; } - count = 1; - for (int i = 0; i < nstave1; i++) { - for (int j = 0; j < nmod; j++) { - sprintf(label, "L1_%s_%s", stave1[i], mod[j]); - B1lbp->GetYaxis()->SetBinLabel(count,label); - count++; + if (B0lbp && B1lbp && B2lbp) { + 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); + B0lbp->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); + B1lbp->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); + B2lbp->GetYaxis()->SetBinLabel(count, label.c_str()); + count++; + } } + count = 1; } - count = 1; - for (int i = 0; i < nstave2; i++) { - for (int j = 0; j < nmod; j++) { - sprintf(label, "L2_%s_%s", stave2[i], mod[j]); - B2lbp->GetYaxis()->SetBinLabel(count, label); - count++; - } - } - count = 1; - if (!m_errorHist && m_doIBL) { - for (int i = 0; i < nstaveb; i++) { - for (int j = 0; j < nmodIBL; j++) { - sprintf(label, "IBL_%s_%s", staveb[i], modIBL[j]); - IBLlbp->GetYaxis()->SetBinLabel(count, label); + if (IBLlbp) { + 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); + IBLlbp->GetYaxis()->SetBinLabel(count, label.c_str()); count++; } } } - if (!m_errorHist && m_doIBL) { - IBLlbp->GetYaxis()->SetLabelSize(0.03); - IBLlbp->SetOption("colz"); + for (auto& hist : m_histograms) { + if (!hist) continue; + if (hist == Albp || hist == Clbp) { + hist->GetYaxis()->SetLabelSize(0.02); + } else { + hist->GetYaxis()->SetLabelSize(0.03); + } + hist->SetOption("colz"); } - - //Make the text smaller - B0lbp->GetYaxis()->SetLabelSize(0.03); - B1lbp->GetYaxis()->SetLabelSize(0.03); - B2lbp->GetYaxis()->SetLabelSize(0.03); - Albp->GetYaxis()->SetLabelSize(0.02); - Clbp->GetYaxis()->SetLabelSize(0.02); - //put histograms in the easier to read colz format - B0lbp->SetOption("colz"); - B1lbp->SetOption("colz"); - B2lbp->SetOption("colz"); - Albp->SetOption("colz"); - Clbp->SetOption("colz"); } StatusCode PixelMon2DLumiProfiles::regHist(ManagedMonitorToolBase::MonGroup &group) { StatusCode sc = StatusCode::SUCCESS; - if (!m_errorHist && m_doIBL) { - if (group.regHist(IBLlbp).isFailure()) sc = StatusCode::FAILURE; - } - if (group.regHist(B0lbp).isFailure()) sc = StatusCode::FAILURE; - if (group.regHist(B1lbp).isFailure()) sc = StatusCode::FAILURE; - if (group.regHist(B2lbp).isFailure()) sc = StatusCode::FAILURE; - if (group.regHist(Albp).isFailure()) sc = StatusCode::FAILURE; - if (group.regHist(Clbp).isFailure()) sc = StatusCode::FAILURE; - + + for (auto& hist : m_histograms) { + if (!hist) continue; + if (group.regHist(hist).isFailure()) { + sc = StatusCode::FAILURE; + } + } + return sc; } + +const bool PixelMon2DLumiProfiles::m_doIBL{true}; diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelMon2DMapsLW.cxx b/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelMon2DMapsLW.cxx index a1cdd70e485..4ddabf175e1 100644 --- a/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelMon2DMapsLW.cxx +++ b/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelMon2DMapsLW.cxx @@ -7,51 +7,92 @@ /////////////////////////////////////////////////////////////////////////////// #include "PixelMonitoring/PixelMon2DMapsLW.h" +#include "PixelMonitoring/Components.h" #include "InDetIdentifier/PixelID.h" #include "LWHists/TH2F_LW.h" #include "GaudiKernel/StatusCode.h" #include <string.h> -PixelMon2DMapsLW::PixelMon2DMapsLW(std::string name, std::string title, bool doIBL, bool errorHist, bool copy2DFEval) : m_doIBL(doIBL), m_errorHist(errorHist), m_copy2DFEval(copy2DFEval) +PixelMon2DMapsLW::PixelMon2DMapsLW(std::string name, std::string title, const PixMon::HistConf& config, bool copy2DFEval) + : IBL(nullptr), + IBL2D(nullptr), + IBL3D(nullptr), + B0(nullptr), + B1(nullptr), + B2(nullptr), + A(nullptr), + C(nullptr), + DBMA(nullptr), + DBMC(nullptr), + m_config(config), + m_copy2DFEval(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 && !m_errorHist) { - IBL3D = TH2F_LW::create((name+"_IBL3D").c_str(), (title + ", IBL 3D modules " + etatext + phitext).c_str(),8,-.5,7.5,14,-0.5,13.5); - IBL2D = TH2F_LW::create((name+"_IBL2D").c_str(), (title + ", IBL planar modules " + setatext + phitext).c_str(),12,-6.5,5.5,14,-0.5,13.5); - IBL = TH2F_LW::create((name+"_IBL").c_str(), (title + ", IBL " + setatext + phitext).c_str(),32,-16.5,15.5,14,-0.5,13.5); + if (m_doIBL && PixMon::HasComponent(m_config, PixMon::LayerIBL2D3DDBM::kIBL)) { + IBL = 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); } - B0 = TH2F_LW::create((name+"_B0").c_str(), (title + ", B0 " + etatext + phitext).c_str(),13,-6.5,6.5,22,-0.5,21.5); - B1 = TH2F_LW::create((name+"_B1").c_str(), (title + ", B1 " + etatext + phitext).c_str(),13,-6.5,6.5,38,-0.5,37.5); - B2 = TH2F_LW::create((name+"_B2").c_str(), (title + ", B2 " + etatext + phitext).c_str(),13,-6.5,6.5,52,-0.5,51.5); - A = TH2F_LW::create((name+"_ECA" ).c_str(), (title + ", ECA " + disktext + phitext).c_str(),3,-0.5,2.5,48,-0.5,47.5); - C = TH2F_LW::create((name+"_ECC" ).c_str(), (title + ", ECC " + disktext + phitext).c_str(),3,-0.5,2.5,48,-0.5,47.5); - if (!m_errorHist) { - DBMA = TH2F_LW::create((name+"_DBMA" ).c_str(), (title + ", DBMA " + disktext + phitext).c_str(),3,-0.5,2.5,4,-0.5,3.5); - DBMC = TH2F_LW::create((name+"_DBMC" ).c_str(), (title + ", DBMC " + disktext + phitext).c_str(),3,-0.5,2.5,4,-0.5,3.5); + if (m_doIBL && PixMon::HasComponent(m_config, PixMon::LayerIBL2D3DDBM::kIBL2D)) { + IBL2D = 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)) { + IBL3D = 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)) { + B0 = 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)) { + B1 = 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)) { + B2 = 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)) { + A = 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)) { + C = 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)) { + DBMA = 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)) { + DBMC = 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); + } + + m_histograms = {IBL, IBL2D, IBL3D, B0, B1, B2, A, C, DBMA, DBMC}; formatHist(); } PixelMon2DMapsLW::~PixelMon2DMapsLW() { - if (m_doIBL && !m_errorHist) { - LWHist::safeDelete(IBL3D); - LWHist::safeDelete(IBL2D); - LWHist::safeDelete(IBL); - } - LWHist::safeDelete(B0); - LWHist::safeDelete(B1); - LWHist::safeDelete(B2); - LWHist::safeDelete(A); - LWHist::safeDelete(C); - if (!m_errorHist) { - LWHist::safeDelete(DBMA); - LWHist::safeDelete(DBMC); + for (auto& hist : m_histograms) { + if (hist) LWHist::safeDelete(hist); } } @@ -61,36 +102,36 @@ void PixelMon2DMapsLW::Fill(Identifier &id, const PixelID* pixID) const int pm = pixID->phi_module(id); int ld = pixID->layer_disk(id); - if (bec == 2) A->Fill(ld, pm); - else if (bec == -2) C->Fill(ld, pm); - else if (bec == 4 && !m_errorHist) DBMA->Fill(ld, pm); - else if (bec == -4 && !m_errorHist) DBMC->Fill(ld, pm); + if (bec == 2 && A) A->Fill(ld, pm); + else if (bec == -2 && C) C->Fill(ld, pm); + else if (bec == 4 && DBMA) DBMA->Fill(ld, pm); + else if (bec == -4 && DBMC) DBMC->Fill(ld, pm); else if (bec == 0) { if (m_doIBL) ld--; const int em = pixID->eta_module(id); - if (ld == 0) { - B0->Fill(em, pm); - } else if (ld == 1) { - B1->Fill(em,pm); - } else if (ld == 2) { - B2->Fill(em,pm); - } else if (ld == -1 && m_doIBL && !m_errorHist) { - int feid = 0; - int emf = 0; + if (ld == 0 && B0) { + B0->Fill(em, pm); + } else if (ld == 1 && B1) { + B1->Fill(em,pm); + } else if (ld == 2 && B2) { + B2->Fill(em,pm); + } else if (ld == -1 && IBL) { + int feid = 0; + int emf = 0; bool copy = false; - if (em < 6 && em > -7) { + if (em < 6 && em > -7) { if (pixID->eta_index(id) >= 80) feid = 1; emf = 2 * em + feid; - IBL2D->Fill(em, pm); + if (IBL2D) IBL2D->Fill(em, pm); copy = true; - } else if (em < -6) { + } else if (em < -6) { emf = em - 6; - IBL3D->Fill(em + 10, pm); - } else { + if (IBL3D) IBL3D->Fill(em + 10, pm); + } else { emf = em + 6; - IBL3D->Fill(em - 2,pm); - } - IBL->Fill(emf, pm); + if (IBL3D) IBL3D->Fill(em - 2, pm); + } + IBL->Fill(emf, pm); if (m_copy2DFEval && copy) IBL->Fill(emf + 1, pm); } } @@ -102,33 +143,32 @@ void PixelMon2DMapsLW::WeightingFill(Identifier &id, const PixelID* pixID, float const int pm = pixID->phi_module(id); int ld = pixID->layer_disk(id); - if (bec == 2) A->Fill(ld, pm, weight); - else if (bec == -2) C->Fill(ld, pm, weight); - else if (bec == 4 && !m_errorHist) DBMA->Fill(ld, pm, weight); - else if (bec == -4 && !m_errorHist) DBMC->Fill(ld, pm, weight); - + 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) { + if (ld == 0 && B0) { B0->Fill(em, pm, weight); - } else if (ld == 1) { + } else if (ld == 1 && B1) { B1->Fill(em, pm, weight); - } else if (ld == 2) { + } else if (ld == 2 && B2) { B2->Fill(em, pm, weight); - } else if (ld == -1 && m_doIBL && !m_errorHist) { + } else if (ld == -1 && IBL) { int feid = 0; int emf = 0; if (em < 6 && em > -7) { if (pixID->eta_index(id) >= 80) feid = 1; emf = 2 * em + feid; - IBL2D->Fill(em, pm, weight); + if (IBL2D) IBL2D->Fill(em, pm, weight); } else if (em < -6) { emf = em - 6; - IBL3D->Fill(em + 10, pm, weight); + if (IBL3D) IBL3D->Fill(em + 10, pm, weight); } else { emf = em + 6; - IBL3D->Fill(em - 2, pm, weight); + if (IBL3D) IBL3D->Fill(em - 2, pm, weight); } IBL->Fill(emf, pm, weight); } @@ -137,266 +177,104 @@ void PixelMon2DMapsLW::WeightingFill(Identifier &id, const PixelID* pixID, float void PixelMon2DMapsLW::Fill2DMon(PixelMon2DMapsLW* oldmap) { - if (!m_errorHist) { - for (unsigned int x = 1; x <= DBMA->GetNbinsX(); x++) { - for (unsigned int y = 1; y <= DBMA->GetNbinsY(); y++) { - float content = oldmap->DBMA->GetBinContent(x, y); - DBMA->SetBinContent(x, y, content); - oldmap->DBMA->SetBinContent(x, y, 0); - } - } - for (unsigned int x = 1; x <= DBMC->GetNbinsX(); x++) { - for (unsigned int y = 1; y <= DBMC->GetNbinsY(); y++) { - float content = oldmap->DBMC->GetBinContent(x, y); - DBMC->SetBinContent(x, y, content); - oldmap->DBMC->SetBinContent(x, y, 0); + 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); } } } - for (unsigned int x = 1; x <= A->GetNbinsX(); x++) { - for (unsigned int y = 1; y <= A->GetNbinsY(); y++) { - float content = oldmap->A->GetBinContent(x, y); - A->SetBinContent(x, y, content); - oldmap->A->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 x = 1; x <= C->GetNbinsX(); x++) { - for (unsigned int y = 1; y <= C->GetNbinsY(); y++) { - float content = oldmap->C->GetBinContent(x, y); - C->SetBinContent(x, y, content); - oldmap->C->SetBinContent(x, y, 0); + 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()); } } - for (unsigned int x = 1; x <= B0->GetNbinsX(); x++) { - for (unsigned int y = 1; y <= B0->GetNbinsY(); y++) { - float content = oldmap->B0->GetBinContent(x, y); - B0->SetBinContent(x, y, content); - oldmap->B0->SetBinContent(x, y, 0); + 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 x = 1; x <= B1->GetNbinsX(); x++) { - for (unsigned int y = 1; y <= B1->GetNbinsY(); y++) { - float content = oldmap->B1->GetBinContent(x, y); - B1->SetBinContent(x, y, content); - oldmap->B1->SetBinContent(x, y, 0); + 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()); } } - for (unsigned int x = 1; x <= B2->GetNbinsX(); x++) { - for (unsigned int y = 1; y <= B2->GetNbinsY(); y++) { - float content = oldmap->B2->GetBinContent(x, y); - B2->SetBinContent(x, y, content ); - oldmap->B2->SetBinContent(x, y, 0); + 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()); } - } - if (m_doIBL && !m_errorHist) { - for (unsigned int x = 1; x <= IBL->GetNbinsX(); x++) { - for (unsigned int y = 1; y <= IBL->GetNbinsY(); y++) { - float content = oldmap->IBL->GetBinContent(x, y); - IBL->SetBinContent(x, y, content); - oldmap->IBL->SetBinContent(x, y, 0); - } + for (unsigned int i = 0; i < PixMon::kNumStavesL0; ++i) { + B0->GetYaxis()->SetBinLabel(i + 1, PixMon::StavesL0.at(i).c_str()); } - for (unsigned int x = 1; x <= IBL2D->GetNbinsX(); x++) { - for (unsigned int y = 1; y <= IBL2D->GetNbinsY(); y++) { - float content = oldmap->IBL2D->GetBinContent(x, y); - IBL2D->SetBinContent(x, y, content); - oldmap->IBL2D->SetBinContent(x, y, 0); - } + for (unsigned int i = 0; i < PixMon::kNumStavesL1; ++i) { + B1->GetYaxis()->SetBinLabel(i + 1, PixMon::StavesL1.at(i).c_str()); } - for (unsigned int x = 1; x <= IBL3D->GetNbinsX(); x++) { - for (unsigned int y = 1; y <= IBL3D->GetNbinsY(); y++) { - float content = oldmap->IBL3D->GetBinContent(x, y); - IBL3D->SetBinContent(x, y, content); - oldmap->IBL3D->SetBinContent(x, y, 0); - } + for (unsigned int i = 0; i < PixMon::kNumStavesL2; ++i) { + B2->GetYaxis()->SetBinLabel(i + 1, PixMon::StavesL2.at(i).c_str()); } } -} - -void PixelMon2DMapsLW::formatHist() -{ - const int ndisk = 3; - const int nphi = 48; - const int nphi_dbm = 4; - const char *disk[ndisk] = { "Disk 1", "Disk 2", "Disk 3" }; - const char *phi_dbm[nphi_dbm] = { "M1","M2","M3","M4"}; - const int nmod = 13; - const int nmodIBL2D = 12; - const int nmodIBL3D = 8; - const int nmodIBL = 32; - const char *mod[nmod] = { "M6C", "M5C", "M4C", "M3C", "M2C", "M1C", "M0","M1A", "M2A", "M3A", "M4A", "M5A", "M6A" } ; - const char *modIBL2D[nmodIBL2D] = { "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 char *modIBL3D[nmodIBL3D] = {"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 char *modIBL[nmodIBL] = {"C8","","C7","", - "C6","","C5","", - "C4","","C3","", - "C2","","C1","", - "A1","","A2","", - "A3","","A4","", - "A5","","A6","", - "A7","","A8",""}; - const int nstaveb = 14; - const char *staveb[nstaveb] = { - "S01", "S02", "S03", "S04", "S05", "S06","S07", - "S08", "S09", "S10", "S11", "S12", "S13","S14"}; - 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[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"}; - const char *nstaveC[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"}; - - for (int i = 0; i < nphi; i++) { - A->GetYaxis()->SetBinLabel(i + 1, nstaveA[i]); - C->GetYaxis()->SetBinLabel(i + 1, nstaveC[i]); - } - if (!m_errorHist) { - for (int i = 0; i < nphi_dbm; i++) { - DBMA->GetYaxis()->SetBinLabel(i + 1, phi_dbm[i]); - DBMC->GetYaxis()->SetBinLabel(i + 1, phi_dbm[i]); + if (IBL) { + for (unsigned int i = 0; i < PixMon::kNumModulesIBL; ++i) { + IBL->GetXaxis()->SetBinLabel(i + 1, PixMon::ModulesIBL.at(i).c_str()); } - for (int i = 0; i < ndisk; i++) { - DBMA->GetXaxis()->SetBinLabel(i + 1, disk[i]); - DBMC->GetXaxis()->SetBinLabel(i + 1, disk[i]); + for (unsigned int i = 0; i < PixMon::kNumStavesIBL; ++i) { + IBL->GetYaxis()->SetBinLabel(i + 1, PixMon::StavesIBL.at(i).c_str()); } } - for (int i = 0; i < ndisk; i++) { - A->GetXaxis()->SetBinLabel(i + 1, disk[i]); - C->GetXaxis()->SetBinLabel(i + 1, disk[i]); - } - for (int i = 0; i < nmod; i++) { - B0->GetXaxis()->SetBinLabel(i + 1, mod[i]); // bin 0 is underflow - B1->GetXaxis()->SetBinLabel(i + 1, mod[i]); - B2->GetXaxis()->SetBinLabel(i + 1, mod[i]); - } - if (m_doIBL && !m_errorHist) { - for (int i = 0; i < nmodIBL; i++) { - IBL->GetXaxis()->SetBinLabel(i + 1, modIBL[i]); - } - for (int i = 0; i < nstaveb; i++) { - IBL->GetYaxis()->SetBinLabel(i + 1, staveb[i]); - } - for (int i = 0; i < nmodIBL2D; i++){ - IBL2D->GetXaxis()->SetBinLabel(i + 1, modIBL2D[i]); + if (IBL2D && IBL3D) { + for (unsigned int i = 0; i < PixMon::kNumModulesIBL2D; ++i){ + IBL2D->GetXaxis()->SetBinLabel(i + 1, PixMon::ModulesIBL2D.at(i).c_str()); } - for (int i = 0; i < nstaveb; i++) { - IBL2D->GetYaxis()->SetBinLabel(i + 1, staveb[i]); + for (unsigned int i = 0; i < PixMon::kNumModulesIBL3D; ++i) { + IBL3D->GetXaxis()->SetBinLabel(i + 1, PixMon::ModulesIBL3D.at(i).c_str()); } - for (int i = 0; i < nmodIBL3D; i++) { - IBL3D->GetXaxis()->SetBinLabel(i + 1, modIBL3D[i]); + 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 (int i = 0; i < nstaveb; i++) { - IBL3D->GetYaxis()->SetBinLabel(i + 1, staveb[i]); - } - } - - for (int i = 0; i < nstave0; i++) { - B0->GetYaxis()->SetBinLabel(i + 1, stave0[i]); - } - for (int i = 0; i < nstave1; i++) { - B1->GetYaxis()->SetBinLabel(i + 1, stave1[i]); - } - for (int i = 0; i < nstave2; i++) { - B2->GetYaxis()->SetBinLabel(i + 1, stave2[i]); - } - - if (m_doIBL && !m_errorHist) { - IBL->GetYaxis()->SetLabelSize(0.03); - IBL2D->GetYaxis()->SetLabelSize(0.03); - IBL3D->GetYaxis()->SetLabelSize(0.03); - IBL->SetOption("colz"); - IBL2D->SetOption("colz"); - IBL3D->SetOption("colz"); - IBL->SetMinimum(0.); - IBL2D->SetMinimum(0.); - IBL3D->SetMinimum(0.); } - if (!m_errorHist) { - DBMA->GetYaxis()->SetLabelSize(0.02); - DBMC->GetYaxis()->SetLabelSize(0.02); - DBMA->SetOption("colz"); - DBMC->SetOption("colz"); - DBMA->SetMinimum(0.); - DBMC->SetMinimum(0.); + for (auto& hist : m_histograms) { + if (!hist) continue; + if (hist == A || hist == C) { + hist->GetYaxis()->SetLabelSize(0.02); + } else { + hist->GetYaxis()->SetLabelSize(0.03); + } + hist->SetOption("colz"); + hist->SetMinimum(0.); } - - //Make the text smaller - B0->GetYaxis()->SetLabelSize(0.03); - B1->GetYaxis()->SetLabelSize(0.03); - B2->GetYaxis()->SetLabelSize(0.03); - A->GetYaxis()->SetLabelSize(0.02); - C->GetYaxis()->SetLabelSize(0.02); - //put histograms in the easier to read colz format - B0->SetOption("colz"); - B1->SetOption("colz"); - B2->SetOption("colz"); - A->SetOption("colz"); - C->SetOption("colz"); - //force the minimum to be 0 so you can spot empty blocks easily - B0->SetMinimum(0.); - B1->SetMinimum(0.); - B2->SetMinimum(0.); - A->SetMinimum(0.); - C->SetMinimum(0.); } StatusCode PixelMon2DMapsLW::regHist(ManagedMonitorToolBase::MonGroup &group) { StatusCode sc = StatusCode::SUCCESS; - if(m_doIBL && !m_errorHist){ - if (group.regHist(IBL).isFailure()) sc = StatusCode::FAILURE; - if (group.regHist(IBL2D).isFailure()) sc = StatusCode::FAILURE; - if (group.regHist(IBL3D).isFailure()) sc = StatusCode::FAILURE; - } - if (group.regHist(B0).isFailure()) sc = StatusCode::FAILURE; - if (group.regHist(B1).isFailure()) sc = StatusCode::FAILURE; - if (group.regHist(B2).isFailure()) sc = StatusCode::FAILURE; - if (group.regHist(A).isFailure()) sc = StatusCode::FAILURE; - if (group.regHist(C).isFailure()) sc = StatusCode::FAILURE; - if (!m_errorHist) { - if (group.regHist(DBMA).isFailure()) sc = StatusCode::FAILURE; - if (group.regHist(DBMC).isFailure()) sc = StatusCode::FAILURE; + for (auto& hist : m_histograms) { + if (!hist) continue; + if (group.regHist(hist).isFailure()) { + sc = StatusCode::FAILURE; + } } return sc; } + +const bool PixelMon2DMapsLW::m_doIBL{true}; diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelMon2DProfilesLW.cxx b/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelMon2DProfilesLW.cxx index 603a19f45ef..d7b9628d546 100644 --- a/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelMon2DProfilesLW.cxx +++ b/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelMon2DProfilesLW.cxx @@ -6,6 +6,7 @@ // Function to handle 2D profile histograms of modules, one for each region /////////////////////////////////////////////////////////////////////////////// +#include "PixelMonitoring/Components.h" #include "PixelMonitoring/PixelMon2DProfilesLW.h" #include "PixelMonitoring/PixelMon2DMapsLW.h" #include "InDetIdentifier/PixelID.h" @@ -14,70 +15,101 @@ #include "GaudiKernel/StatusCode.h" #include <string.h> -PixelMon2DProfilesLW::PixelMon2DProfilesLW(std::string name, std::string title, bool doIBL, bool errorHist, bool copy2DFEval) : m_doIBL(doIBL), m_errorHist(errorHist), m_copy2DFEval(copy2DFEval) +PixelMon2DProfilesLW::PixelMon2DProfilesLW(std::string name, std::string title, const PixMon::HistConf& config, bool copy2DFEval) + : IBL3D(nullptr), + IBL2D(nullptr), + IBL(nullptr), + B0(nullptr), + B1(nullptr), + B2(nullptr), + A(nullptr), + C(nullptr), + DBMA(nullptr), + DBMC(nullptr), + m_config(config), + m_copy2DFEval(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 && !m_errorHist) { - IBL3D = TProfile2D_LW::create((name+"_IBL3D").c_str(), (title + ", IBL 3D modules " + etatext + phitext).c_str(),8,-.5,7.5,14,-0.5,13.5); - IBL2D = TProfile2D_LW::create((name+"_IBL2D").c_str(), (title + ", IBL planar modules " + setatext + phitext).c_str(),12,-6.5,5.5,14,-0.5,13.5); - IBL = TProfile2D_LW::create((name+"_IBL").c_str(), (title + ", IBL " + setatext + phitext).c_str(),32,-16.5,15.5,14,-0.5,13.5); + if (m_doIBL && PixMon::HasComponent(m_config, PixMon::LayerIBL2D3DDBM::kIBL3D)) { + IBL3D = 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); } - B0 = TProfile2D_LW::create((name+"_B0").c_str(), (title + ", B0 " + etatext + phitext).c_str(),13,-6.5,6.5,22,-0.5,21.5); - B1 = TProfile2D_LW::create((name+"_B1").c_str(), (title + ", B1 " + etatext + phitext).c_str(),13,-6.5,6.5,38,-0.5,37.5); - B2 = TProfile2D_LW::create((name+"_B2").c_str(), (title + ", B2 " + etatext + phitext).c_str(),13,-6.5,6.5,52,-0.5,51.5); - A = TProfile2D_LW::create((name+"_ECA" ).c_str(), (title + ", ECA " + disktext + phitext).c_str(),3,-0.5,2.5,48,-0.5,47.5); - C = TProfile2D_LW::create((name+"_ECC" ).c_str(), (title + ", ECC " + disktext + phitext).c_str(),3,-0.5,2.5,48,-0.5,47.5); - //DBMA = TProfile2D_LW::create((name+"_DBMA" ).c_str(), (title + ", DBMA " + disktext + phitext).c_str(),3,-0.5,2.5,4,-0.5,3.5); - //DBMC = TProfile2D_LW::create((name+"_DBMC" ).c_str(), (title + ", DBMC " + disktext + phitext).c_str(),3,-0.5,2.5,4,-0.5,3.5); + if (m_doIBL && PixMon::HasComponent(m_config, PixMon::LayerIBL2D3DDBM::kIBL2D) ){ + IBL2D = 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::kIBL)) { + IBL = 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 (PixMon::HasComponent(m_config, PixMon::LayerIBL2D3DDBM::kB0)) { + B0 = 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)) { + B1 = 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)) { + B2 = 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)) { + A = 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)) { + C = 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)) { + DBMA = 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)) { + DBMC = 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); + } + + m_histograms = {IBL, IBL2D, IBL3D, B0, B1, B2, A, C, DBMA, DBMC}; + formatHist(); } PixelMon2DProfilesLW::~PixelMon2DProfilesLW() { - if (m_doIBL && !m_errorHist) { - LWHist::safeDelete(IBL3D); - LWHist::safeDelete(IBL2D); - LWHist::safeDelete(IBL); + for (auto& hist : m_histograms) { + if (hist) LWHist::safeDelete(hist); } - LWHist::safeDelete(B0); - LWHist::safeDelete(B1); - LWHist::safeDelete(B2); - LWHist::safeDelete(A); - LWHist::safeDelete(C); - //LWHist::safeDelete(DBMA); - //LWHist::safeDelete(DBMC); } void PixelMon2DProfilesLW::SetMaxValue(float max) { - if (m_doIBL && !m_errorHist) { - IBL->SetMaximum(max); - IBL2D->SetMaximum(max); - IBL3D->SetMaximum(max); + for (auto& hist : m_histograms) { + if (hist) hist->SetMaximum(max); } - B0->SetMaximum(max); - B1->SetMaximum(max); - B2->SetMaximum(max); - A->SetMaximum(max); - C->SetMaximum(max); } void PixelMon2DProfilesLW::Reset() { - if (m_doIBL && !m_errorHist) { - IBL->Reset(); - IBL2D->Reset(); - IBL3D->Reset(); + for (auto& hist : m_histograms) { + if (hist) hist->Reset(); } - B0->Reset(); - B1->Reset(); - B2->Reset(); - A->Reset(); - C->Reset(); } void PixelMon2DProfilesLW::Fill(Identifier &id, const PixelID* pixID, float weight) @@ -86,34 +118,34 @@ void PixelMon2DProfilesLW::Fill(Identifier &id, const PixelID* pixID, float weig const int pm = pixID->phi_module(id); int ld = pixID->layer_disk(id); - if (bec == 2) A->Fill(ld, pm, weight); - else if (bec == -2) C->Fill(ld, pm, weight); - //else if (bec == 4) DBMA->Fill(ld, pm, weight); - //else if (bec == -4) DBMC->Fill(ld, pm, weight); + 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) { + if (ld == 0 && B0) { B0->Fill(em, pm, weight); - } else if (ld == 1) { + } else if (ld == 1 && B1) { B1->Fill(em, pm, weight); - } else if (ld == 2) { + } else if (ld == 2 && B2) { B2->Fill(em, pm, weight); - } else if (ld == -1 && m_doIBL && !m_errorHist) { + } 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; - IBL2D->Fill(em, pm, weight); + if (IBL2D) IBL2D->Fill(em, pm, weight); copy = true; } else if (em < -6) { emf = em - 6; - IBL3D->Fill(em + 10, pm, weight); + if (IBL3D) IBL3D->Fill(em + 10, pm, weight); } else { emf = em + 6; - IBL3D->Fill(em - 2, pm, weight); + if (IBL3D) IBL3D->Fill(em - 2, pm, weight); } IBL->Fill(emf, pm, weight); if (m_copy2DFEval && copy) IBL->Fill(emf + 1, pm, weight); @@ -123,221 +155,87 @@ void PixelMon2DProfilesLW::Fill(Identifier &id, const PixelID* pixID, float weig void PixelMon2DProfilesLW::formatHist() { - const int ndisk = 3; - const int nphi = 48; - // const int nphi_dbm = 4; - const char *disk[ndisk] = { "Disk 1", "Disk 2", "Disk 3" }; - // const char *phi_dbm[nphi_dbm] = { "M1","M2","M3","M4"}; - const int nmod = 13; - const int nmodIBL2D = 12; - const int nmodIBL3D = 8; - const int nmodIBL = 32; - const char *mod[nmod] = { "M6C", "M5C", "M4C", "M3C", "M2C", "M1C", "M0","M1A", "M2A", "M3A", "M4A", "M5A", "M6A" } ; - const char *modIBL2D[nmodIBL2D] = { "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 char *modIBL3D[nmodIBL3D] = {"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 char *modIBL[nmodIBL] = {"C8","","C7","", - "C6","","C5","", - "C4","","C3","", - "C2","","C1","", - "A1","","A2","", - "A3","","A4","", - "A5","","A6","", - "A7","","A8",""}; - const int nstaveb = 14; - const char *staveb[nstaveb] = { - "S01", "S02", "S03", "S04", "S05", "S06","S07", - "S08", "S09", "S10", "S11", "S12", "S13","S14"}; - 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[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"}; - const char *nstaveC[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"}; - - for (int i = 0; i < nphi; i++) { - A->GetYaxis()->SetBinLabel(i + 1, nstaveA[i]); - C->GetYaxis()->SetBinLabel(i + 1, nstaveC[i]); - } - - // for (int i=0; i<nphi_dbm; i++) { - // DBMA->GetYaxis()->SetBinLabel(i + 1, phi_dbm[i]); - // DBMC->GetYaxis()->SetBinLabel(i + 1, phi_dbm[i]); - // } - - for (int i = 0; i < ndisk; i++) { - A->GetXaxis()->SetBinLabel(i + 1, disk[i]); - C->GetXaxis()->SetBinLabel(i + 1, disk[i]); - //DBMA->GetXaxis()->SetBinLabel(i + 1, disk[i]); - //DBMC->GetXaxis()->SetBinLabel(i + 1, disk[i]); - } - - for (int i = 0; i < nmod; i++) { - B0->GetXaxis()->SetBinLabel(i + 1, mod[i]); // bin 0 is underflow - B1->GetXaxis()->SetBinLabel(i + 1, mod[i]); - B2->GetXaxis()->SetBinLabel(i + 1, mod[i]); - } - - if (m_doIBL && !m_errorHist) { - for (int i = 0; i < nmodIBL; i++) IBL->GetXaxis()->SetBinLabel(i + 1, modIBL[i]); - for (int i = 0; i < nstaveb; i++) IBL->GetYaxis()->SetBinLabel(i + 1, staveb[i]); - for (int i = 0; i < nmodIBL2D; i++) IBL2D->GetXaxis()->SetBinLabel(i + 1, modIBL2D[i]); - for (int i = 0; i < nstaveb; i++) IBL2D->GetYaxis()->SetBinLabel(i + 1, staveb[i]); - for (int i = 0; i < nmodIBL3D; i++) IBL3D->GetXaxis()->SetBinLabel(i + 1, modIBL3D[i]); - for (int i = 0; i < nstaveb; i++) IBL3D->GetYaxis()->SetBinLabel(i + 1, staveb[i]); - } - - for (int i = 0; i < nstave0; i++) B0->GetYaxis()->SetBinLabel(i + 1, stave0[i]); - for (int i = 0; i < nstave1; i++) B1->GetYaxis()->SetBinLabel(i + 1, stave1[i]); - for (int i = 0; i < nstave2; i++) B2->GetYaxis()->SetBinLabel(i + 1, stave2[i]); - - - if (m_doIBL && !m_errorHist){ - IBL->GetYaxis()->SetLabelSize(0.03); - IBL2D->GetYaxis()->SetLabelSize(0.03); - IBL3D->GetYaxis()->SetLabelSize(0.03); - IBL->SetOption("colz"); - IBL2D->SetOption("colz"); - IBL3D->SetOption("colz"); - IBL->SetMinimum(0.); - IBL2D->SetMinimum(0.); - IBL3D->SetMinimum(0.); - } - - //Make the text smaller - B0->GetYaxis()->SetLabelSize(0.03); - B1->GetYaxis()->SetLabelSize(0.03); - B2->GetYaxis()->SetLabelSize(0.03); - A->GetYaxis()->SetLabelSize(0.02); - C->GetYaxis()->SetLabelSize(0.02); - //DBMA->GetYaxis()->SetLabelSize(0.02); - //DBMC->GetYaxis()->SetLabelSize(0.02); - //put histograms in the easier to read colz format - B0->SetOption("colz"); - B1->SetOption("colz"); - B2->SetOption("colz"); - A->SetOption("colz"); - C->SetOption("colz"); - //DBMA->SetOption("colz"); - //DBMC->SetOption("colz"); - //force the minimum to be 0 so you can spot empty blocks easily - B0->SetMinimum(0.); - B1->SetMinimum(0.); - B2->SetMinimum(0.); - A->SetMinimum(0.); - C->SetMinimum(0.); - //DBMA->SetMinimum(0.); - //DBMC->SetMinimum(0.); -} - -void PixelMon2DProfilesLW::Fill2DMon(PixelMon2DProfilesLW* oldmap) -{ - //for (int x = 1; x <= DBMA->GetNbinsX(); x++) { - // for (int y = 1; y <= DBMA->GetNbinsY(); y++) { - // float content = oldmap->DBMA->GetBinContent(x, y); - // DBMA->SetBinContent(x, y, content); - // oldmap->DBMA->SetBinContent(x, y, 0); - // } - //} - //for (int x = 1; x <= DBMC->GetNbinsX(); x++) { - // for (int y = 1; y <= DBMC->GetNbinsY(); y++) { - // float content = oldmap->DBMC->GetBinContent(x, y); - // DBMC->SetBinContent(x, y, content); - // oldmap->DBMC->SetBinContent(x, y, 0); - // } - //} - for (unsigned int x = 1; x <= A->GetNbinsX(); x++) { - for (unsigned int y = 1; y <= A->GetNbinsY(); y++) { - float content = oldmap->A->GetBinContent(x, y); - A->SetBinContent(x, y, content); - oldmap->A->SetBinContent(x, y, 0); + 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 x = 1; x <= C->GetNbinsX(); x++) { - for (unsigned int y = 1; y <= C->GetNbinsY(); y++) { - float content = oldmap->C->GetBinContent(x, y); - C->SetBinContent(x, y, content); - oldmap->C->SetBinContent(x, y, 0); + 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()); } } - for (unsigned int x = 1; x <= B0->GetNbinsX(); x++) { - for (unsigned int y = 1; y <= B0->GetNbinsY(); y++) { - float content = oldmap->B0->GetBinContent(x, y); - B0->SetBinContent(x, y, content); - oldmap->B0->SetBinContent(x, y, 0); + 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()); } } - for (unsigned int x = 1; x <= B1->GetNbinsX(); x++) { - for (unsigned int y = 1; y <= B1->GetNbinsY(); y++) { - float content = oldmap->B1->GetBinContent(x, y); - B1->SetBinContent(x, y, content); - oldmap->B1->SetBinContent(x, y, 0); + 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()); } } - for (unsigned int x = 1; x <= B2->GetNbinsX(); x++) { - for (unsigned int y = 1; y <= B2->GetNbinsY(); y++) { - float content = oldmap->B2->GetBinContent(x, y); - B2->SetBinContent(x, y, content ); - oldmap->B2->SetBinContent(x, y, 0); + 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 (m_doIBL && !m_errorHist) { - for (unsigned int x = 1; x <= IBL->GetNbinsX(); x++) { - for (unsigned int y = 1; y <= IBL->GetNbinsY(); y++) { - float content = oldmap->IBL->GetBinContent(x, y); - IBL->SetBinContent(x, y, content); - oldmap->IBL->SetBinContent(x, y, 0); - } + 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 x = 1; x <= IBL2D->GetNbinsX(); x++) { - for (unsigned int y = 1; y <= IBL2D->GetNbinsY(); y++) { - float content = oldmap->IBL2D->GetBinContent(x, y); - IBL2D->SetBinContent(x, y, content); - oldmap->IBL2D->SetBinContent(x, y, 0); - } + 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 == A || hist == C) { + hist->GetYaxis()->SetLabelSize(0.02); + } else { + hist->GetYaxis()->SetLabelSize(0.03); } - for (unsigned int x = 1; x <= IBL3D->GetNbinsX(); x++) { - for (unsigned int y = 1; y <= IBL3D->GetNbinsY(); y++) { - float content = oldmap->IBL3D->GetBinContent(x, y); - IBL3D->SetBinContent(x, y, content); - oldmap->IBL3D->SetBinContent(x, y, 0); + 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); } } } @@ -345,100 +243,43 @@ void PixelMon2DProfilesLW::Fill2DMon(PixelMon2DProfilesLW* oldmap) void PixelMon2DProfilesLW::FillFromMap(PixelMon2DMapsLW* inputmap, bool clear_inputmap) { - float weightIBL = 1.0 / 26880.0; - float weightPixel = 1.0 / 46080.0; + const float weightIBL = 1.0 / 26880.0; + const float weightPixel = 1.0 / 46080.0; - // for (int x = 1; x <= DBMA->GetNbinsX(); x++) { - // for (int y = 1; y <= DBMA->GetNbinsY(); y++) { - // float content = inputmap->DBMA->GetBinContent(x, y); - // DBMA->Fill(inputmap->DBMA->GetXaxis()->GetBinCenter(x), inputmap->DBMA->GetYaxis()->GetBinCenter(y), content * weightIBL); - // } - // } - // if (clear_inputmap) inputmap->DBMA->Reset(); - // for (int x = 1; x <= DBMC->GetNbinsX(); x++) { - // for (int y = 1; y <= DBMC->GetNbinsY(); y++) { - // float content = inputmap->DBMC->GetBinContent(x, y); - // DBMC->Fill(inputmap->DBMC->GetXaxis()->GetBinCenter(x), inputmap->DBMC->GetYaxis()->GetBinCenter(y), content * weightIBL); - // } - // } - // if (clear_inputmap) inputmap->DBMC->Reset(); - - for (unsigned int x = 1; x <= A->GetNbinsX(); x++) { - for (unsigned int y = 1; y <= A->GetNbinsY(); y++) { - float content = inputmap->A->GetBinContent(x, y); - A->Fill(inputmap->A->GetXaxis()->GetBinCenter(x), inputmap->A->GetYaxis()->GetBinCenter(y), content * weightPixel); - } - } - if (clear_inputmap) inputmap->A->Reset(); - for (unsigned int x = 1; x <= C->GetNbinsX(); x++) { - for (unsigned int y = 1; y <= C->GetNbinsY(); y++) { - float content = inputmap->C->GetBinContent(x, y); - C->Fill(inputmap->C->GetXaxis()->GetBinCenter(x), inputmap->C->GetYaxis()->GetBinCenter(y), content * weightPixel); - } - } - if (clear_inputmap) inputmap->C->Reset(); - for (unsigned int x = 1; x <= B0->GetNbinsX(); x++) { - for (unsigned int y = 1; y <= B0->GetNbinsY(); y++) { - float content = inputmap->B0->GetBinContent(x, y); - B0->Fill(inputmap->B0->GetXaxis()->GetBinCenter(x), inputmap->B0->GetYaxis()->GetBinCenter(y), content * weightPixel); - } - } - if (clear_inputmap) inputmap->B0->Reset(); - for (unsigned int x = 1; x <= B1->GetNbinsX(); x++) { - for (unsigned int y = 1; y <= B1->GetNbinsY(); y++) { - float content = inputmap->B1->GetBinContent(x, y); - B1->Fill(inputmap->B1->GetXaxis()->GetBinCenter(x), inputmap->B1->GetYaxis()->GetBinCenter(y), content * weightPixel); - } - } - if (clear_inputmap) inputmap->B1->Reset(); - for (unsigned int x = 1; x <= B2->GetNbinsX(); x++) { - for (unsigned int y = 1; y <= B2->GetNbinsY(); y++) { - float content = inputmap->B2->GetBinContent(x, y); - B2->Fill(inputmap->B2->GetXaxis()->GetBinCenter(x), inputmap->B2->GetYaxis()->GetBinCenter(y), content * weightPixel); - } - } - if (clear_inputmap) inputmap->B2->Reset(); - if (m_doIBL && !m_errorHist) { - for (unsigned int x = 1; x <= IBL->GetNbinsX(); x++) { - for (unsigned int y = 1; y <= IBL->GetNbinsY(); y++) { - float content = inputmap->IBL->GetBinContent(x, y); - IBL->Fill(inputmap->IBL->GetXaxis()->GetBinCenter(x), inputmap->IBL->GetYaxis()->GetBinCenter(y), content * weightIBL); - } - } - if (clear_inputmap) inputmap->IBL->Reset(); - for (unsigned int x = 1; x <= IBL2D->GetNbinsX(); x++) { - for (unsigned int y = 1; y <= IBL2D->GetNbinsY(); y++) { - float content = inputmap->IBL2D->GetBinContent(x, y); - IBL2D->Fill(inputmap->IBL2D->GetXaxis()->GetBinCenter(x), inputmap->IBL2D->GetYaxis()->GetBinCenter(y), content * weightIBL*0.5); - } - } - if (clear_inputmap) inputmap->IBL2D->Reset(); - for (unsigned int x = 1; x <= IBL3D->GetNbinsX(); x++) { - for (unsigned int y = 1; y <= IBL3D->GetNbinsY(); y++) { - float content = inputmap->IBL3D->GetBinContent(x, y); - IBL3D->Fill(inputmap->IBL3D->GetXaxis()->GetBinCenter(x), inputmap->IBL3D->GetYaxis()->GetBinCenter(y), content * weightIBL); - } - } - if (clear_inputmap) inputmap->IBL3D->Reset(); - } + 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 == IBL || hist == IBL3D || hist == DBMA || hist == DBMC) { + content *= weightIBL; + } else if (hist == IBL2D) { + content *= weightIBL * 0.5; + } else { + content *= weightPixel; + } + hist->Fill(map->GetXaxis()->GetBinCenter(x), map->GetYaxis()->GetBinCenter(y), content); + } + } + if (clear_inputmap) map->Reset(); + } } - StatusCode PixelMon2DProfilesLW::regHist(ManagedMonitorToolBase::MonGroup &group) { StatusCode sc = StatusCode::SUCCESS; - if (m_doIBL && !m_errorHist) { - if (group.regHist(IBL).isFailure()) sc = StatusCode::FAILURE; - if (group.regHist(IBL2D).isFailure()) sc = StatusCode::FAILURE; - if (group.regHist(IBL3D).isFailure()) sc = StatusCode::FAILURE; + + for (auto& hist : m_histograms) { + if (!hist) continue; + if (group.regHist(hist).isFailure()) { + sc = StatusCode::FAILURE; + } } - if (group.regHist(B0).isFailure()) sc = StatusCode::FAILURE; - if (group.regHist(B1).isFailure()) sc = StatusCode::FAILURE; - if (group.regHist(B2).isFailure()) sc = StatusCode::FAILURE; - if (group.regHist(A).isFailure()) sc = StatusCode::FAILURE; - if (group.regHist(C).isFailure()) sc = StatusCode::FAILURE; - //sc = group.regHist(DBMA); - //sc = group.regHist(DBMC); return sc; } + +const bool PixelMon2DProfilesLW::m_doIBL{true}; diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelMonModules.cxx b/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelMonModules.cxx index dcd3db9f86e..606ee96b65f 100644 --- a/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelMonModules.cxx +++ b/InnerDetector/InDetMonitoring/PixelMonitoring/src/PixelMonModules.cxx @@ -18,11 +18,11 @@ PixelMonModules::~PixelMonModules() { } -PixelMonModulesProf::PixelMonModulesProf(std::string name, std::string title, int nbins, double* arr, bool doIBL) : m_doIBL(doIBL) +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,m_doIBL)+"_"+name).c_str(), (getHistName(i,false,m_doIBL)+" "+title).c_str(), nbins, arr); + 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++) { @@ -33,11 +33,11 @@ PixelMonModulesProf::PixelMonModulesProf(std::string name, std::string title, in m_Dummy = 0; } -PixelMonModulesProf::PixelMonModulesProf(std::string name, std::string title, int nbins, double low, double high, bool doIBL) : m_doIBL(doIBL) +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,m_doIBL)+"_"+name).c_str(), (getHistName(i,false,m_doIBL)+" "+title).c_str(), nbins, low, high); + 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++) { @@ -55,11 +55,11 @@ PixelMonModulesProf::~PixelMonModulesProf() } } -PixelMonModules1D::PixelMonModules1D(std::string name, std::string title, int nbins, double* arr, bool doIBL) : m_doIBL(doIBL) +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,m_doIBL)+"_"+name).c_str(), (getHistName(i,false,m_doIBL)+" "+title).c_str(), nbins, arr); + 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++) { @@ -70,11 +70,11 @@ PixelMonModules1D::PixelMonModules1D(std::string name, std::string title, int nb m_Dummy = 0; } -PixelMonModules1D::PixelMonModules1D(std::string name, std::string title, int nbins, double low, double high, bool doIBL) : m_doIBL(doIBL) +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,m_doIBL)+"_"+name).c_str(), (getHistName(i,false,m_doIBL)+" "+title).c_str(), nbins, low, high); + 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++) { @@ -92,11 +92,11 @@ PixelMonModules1D::~PixelMonModules1D() } } -PixelMonModules2D::PixelMonModules2D(std::string name, std::string title, int nbins0, double low0, double high0, int nbins1, double low1, double high1, bool doIBL) : m_doIBL(doIBL) +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,m_doIBL)+"_"+name).c_str(), (getHistName(i,false,m_doIBL)+" "+title).c_str(), nbins0, low0, high0, nbins1, low1, high1); + 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++) { @@ -124,7 +124,7 @@ void PixelMonModulesProf::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,m_doIBL)).c_str(),Run); + ManagedMonitorToolBase::MonGroup mgroup(thisptr, (path+"/"+getHistName(i,true)).c_str(),Run); if (mgroup.regHist(getHist(i)).isFailure()) { return StatusCode::FAILURE; } @@ -222,7 +222,7 @@ void PixelMonModules1D::Fill(double value, Identifier &id, const PixelID* pixID) 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,m_doIBL)).c_str(),Run); + ManagedMonitorToolBase::MonGroup mgroup(thisptr, (path+"/"+getHistName(i,true)).c_str(),Run); if (mgroup.regHist(getHist(i)).isFailure()) { return StatusCode::FAILURE; } @@ -233,7 +233,7 @@ StatusCode PixelMonModules1D::regHist(ManagedMonitorToolBase* thisptr, std::stri 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,m_doIBL)).c_str(),Run); + ManagedMonitorToolBase::MonGroup mgroup(thisptr, (path+"/"+getHistName(i,true)).c_str(),Run); if (mgroup.regHist(getHist(i)).isFailure()) { return StatusCode::FAILURE; } @@ -322,7 +322,7 @@ TH2F* &PixelMonModules2D::getHist(int i) return m_Dummy; } -std::string PixelMonModules::getHistName(int i, bool forPath, bool doIBL) +std::string PixelMonModules::getHistName(int i, bool forPath) { const int ndisk = 3; const int nphi = 48; @@ -404,7 +404,7 @@ std::string PixelMonModules::getHistName(int i, bool forPath, bool doIBL) i -= 144; if (i < 144) return diskC[i/48]; i -= 144; - if (doIBL && i < 280) return newbarrel[0]+joint+staveb[i%14]; + if (m_doIBL && i < 280) return newbarrel[0]+joint+staveb[i%14]; } else { std::string joint = "_"; @@ -418,9 +418,10 @@ std::string PixelMonModules::getHistName(int i, bool forPath, bool doIBL) i -= 144; if (i < 144) return diskC[i/48]+joint+staveC[i%48]; i -= 144; - if (doIBL && i < 280) return newbarrel[0]+joint+staveb[i%14]+joint+modIBL[i/14];; + 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 index c33c236dd43..000c95300fb 100644 --- a/InnerDetector/InDetMonitoring/PixelMonitoring/src/SpacePoints.cxx +++ b/InnerDetector/InDetMonitoring/PixelMonitoring/src/SpacePoints.cxx @@ -7,13 +7,7 @@ /////////////////////////////////////////////////////////////////////////////// #include "PixelMonitoring/PixelMainMon.h" -//#include "InDetRawData/InDetTimeCollection.h" #include "TrkSpacePoint/SpacePointContainer.h" -//#include "InDetPrepRawData/PixelClusterContainer.h" -//#include "TrkParameters/MeasuredAtaPlane.h" -//#include "TrkParameters/MeasuredPerigee.h" -//#include "InDetRIO_OnTrack/SiClusterOnTrack.h" -//#include "PixelConditionsServices/IPixelByteStreamErrorsSvc.h" #include "InDetIdentifier/PixelID.h" #include "TH1F.h" #include "TH1I.h" @@ -25,11 +19,6 @@ #include "LWHists/TH2I_LW.h" #include <sstream> -//#include "InDetRawData/InDetRawDataContainer.h" -//#include "InDetRawData/InDetRawDataCLASS_DEF.h" -//#include "TrkTrack/TrackCollection.h" -//#include "InDetReadoutGeometry/SiDetectorElement.h" -//#include "TrkTrackSummary/TrackSummary.h" #include "PixelMonitoring/PixelMonModules.h" #include "GeoPrimitives/GeoPrimitives.h" @@ -40,83 +29,73 @@ 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"); - if(m_doOnPixelTrack) path.replace(path.begin(), path.end(), "Pixel/SpacePointOnPixelTrack"); + if (m_doOnTrack) path.replace(path.begin(), path.end(), "Pixel/SpacePointOnTrack"); - StatusCode sc; - MonGroup spacePointHistos( this, path.c_str(),run,ATTRIB_MANAGED ); //declare a group of histograms - if(m_doHighOccupancy) - { - sc = 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)); - } - if(m_doLowOccupancy) - { - sc = 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)); - } - sc = 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.)); //add each histogram to this group - sc = 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.)); //summary means the type of histogram (summary, shifter, expert) - sc = 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.)); //all is for what to integrate over (all, lumiblock, run....) - sc = 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.)); //all is for what to integrate over (all, lumiblock, run....) - sc = 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.)); //all is for what to integrate over (all, lumiblock, run....) - sc = 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)); //all is for what to integrate over (all, lumiblock, run....) - sc = 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)); //all is for what to integrate over (all, lumiblock, run....) + 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(sc.isFailure())if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "histograms not booked" << endmsg; - - return StatusCode::SUCCESS; + if (!st) ATH_MSG_WARNING("Problems with booking SpacePoint histograms"); + return StatusCode::SUCCESS; } StatusCode PixelMainMon::FillSpacePointMon(void) { - StatusCode sc = evtStore()->retrieve(m_Pixel_spcontainer, m_Pixel_SpacePointsName ); - if (sc.isFailure() || !m_Pixel_spcontainer) - { - if(msgLvl(MSG::INFO)) msg(MSG::INFO) <<"SpacePoint container for Pixels not found"<< endmsg; - if(m_storegate_errors) m_storegate_errors->Fill(2.,3.); + StatusCode sc = evtStore()->retrieve(m_Pixel_spcontainer, m_Pixel_SpacePointsName ); + if (sc.isFailure() || !m_Pixel_spcontainer) + { + ATH_MSG_WARNING("SpacePoint container for Pixels not found"); + if (m_storegate_errors) m_storegate_errors->Fill(2.,3.); return StatusCode::SUCCESS; - } else{ - if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) <<"Si SpacePoint container for Pixels found" <<endmsg; - } - - DataVector<SpacePoint>::const_iterator p_sp; - //std::pair<IdentifierHash, IdentifierHash> sp_clusInfo; - //IdentifierHash first_clus; - Identifier PixelModuleId; - int nhits=0; - - //loop over Pixel space points collections //loop over rows - for(SpacePointContainer::const_iterator it=m_Pixel_spcontainer->begin(); it!=m_Pixel_spcontainer->end(); ++it) - { + } 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=m_Pixel_spcontainer->begin(); it!=m_Pixel_spcontainer->end(); ++it) + { const SpacePointCollection *colNext=&(**it); if (!colNext) - { - if(m_storegate_errors) m_storegate_errors->Fill(2.,5.); //first entry (1). is for SP, second (4) is for data problem - continue; - } - - for(p_sp=colNext->begin(); p_sp!=colNext->end(); ++p_sp) //loop over columns - { - const SpacePoint& sp = **p_sp; - //sp_clusInfo = sp.elementIdList(); - //first_clus = sp_clusInfo.first; - PixelModuleId = sp.clusterList().first->identify(); - - if(m_doOnTrack || m_doOnPixelTrack) if(!OnTrack(PixelModuleId,true) )continue; //if we only want hits on track, and the hit is NOT on the track, skip filling - Amg::Vector3D point = sp.globalPosition(); - - if(m_spHit_x)m_spHit_x->Fill(point.x()); // spacepoint x. - if(m_spHit_y)m_spHit_y->Fill(point.y()); // spacepoint y. - if(m_spHit_z)m_spHit_z->Fill(point.z()); // spacepoint 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++; - } //end cols - } //end rows - 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; + { + if (m_storegate_errors) m_storegate_errors->Fill(2.,5.); //first entry (1). is for SP, second (4) 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) if (!OnTrack(PixelModuleId,true) ) continue; //if we only want hits on track, and the hit is NOT on the track, skip filling + 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 index fcbf2432de7..4d64a8ffad0 100644 --- a/InnerDetector/InDetMonitoring/PixelMonitoring/src/Status.cxx +++ b/InnerDetector/InDetMonitoring/PixelMonitoring/src/Status.cxx @@ -21,6 +21,8 @@ #include "LWHists/TProfile_LW.h" #include "InDetIdentifier/PixelID.h" #include <sstream> + +#include "PixelMonitoring/Components.h" #include "PixelMonitoring/PixelMon2DMapsLW.h" #include "PixelMonitoring/PixelMon2DProfilesLW.h" #include "PixelMonitoring/PixelMonModules.h" @@ -35,7 +37,6 @@ StatusCode PixelMainMon::BookStatusMon(void) std::string path = "Pixel/Status"; if (m_doOnTrack) path.replace(path.begin(), path.end(), "Pixel/StatusOnTrack"); - if (m_doOnPixelTrack) path.replace(path.begin(), path.end(), "Pixel/StatusOnPixelTrack"); MonGroup statusHistos( this, path.c_str(), run, ATTRIB_MANAGED ); //declare a group of histograms // use the following definitions for modules states: @@ -45,24 +46,24 @@ StatusCode PixelMainMon::BookStatusMon(void) StatusCode sc; - m_status = new PixelMon2DProfilesLW("Map_Of_Modules_Status", ("Modules Status (0=Active+Good, 1=Active+Bad, 2=Inactive)" + m_histTitleExt).c_str(), m_doIBL, false, true); + m_status = new 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 = new PixelMon2DProfilesLW("Map_Of_Modules_Status_Mon", ("Modules Status (0=Active+Good, 1=Active+Bad, 2=Inactive) for monitoring" + m_histTitleExt).c_str(), m_doIBL, false, true); + m_status_mon = new 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_doModules) { - m_Status_modules = new PixelMonModules1D("Status_of_Module", ("Module Status (0=Active+Good, 1=Active+Bad, 2=Inactive)" + m_histTitleExt + ";Status").c_str(),2,0,2,m_doIBL); + m_Status_modules = new PixelMonModules1D("Status_of_Module", ("Module Status (0=Active+Good, 1=Active+Bad, 2=Inactive)" + m_histTitleExt + ";Status").c_str(),2,0,2); sc = m_Status_modules->regHist(this, (path+"/Modules_Status").c_str(),run); m_Status_modules->SetBinLabel( "Status",2 ); m_Status_modules->formatHist("status"); } if (m_doOffline) { - m_dqStatus = new PixelMon2DMapsLW("Ok_modules", ("module problems, empty bin means dead module not listed in status database"+ m_histTitleExt).c_str(), m_doIBL); + m_dqStatus = new 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); } @@ -103,10 +104,9 @@ StatusCode PixelMainMon::BookStatusLumiBlockMon(void) std::string path = "Pixel/LumiBlock"; if (m_doOnTrack) path.replace(path.begin(), path.end(), "Pixel/LumiBlockOnTrack"); - if (m_doOnPixelTrack) path.replace(path.begin(), path.end(), "Pixel/LumiBlockOnPixelTrack"); MonGroup lumiBlockHist(this, path.c_str(), lowStat, ATTRIB_MANAGED); - m_status_LB = new PixelMon2DProfilesLW("Map_Of_Modules_Status_LB", ("Module Status (0=Active+Good, 1=Active+Bad, 2=Inactive)"+ m_histTitleExt).c_str(), m_doIBL, false, true); + m_status_LB = new 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 ); diff --git a/InnerDetector/InDetMonitoring/PixelMonitoring/src/Track.cxx b/InnerDetector/InDetMonitoring/PixelMonitoring/src/Track.cxx index d9b07c2b340..b16e89dd2ba 100644 --- a/InnerDetector/InDetMonitoring/PixelMonitoring/src/Track.cxx +++ b/InnerDetector/InDetMonitoring/PixelMonitoring/src/Track.cxx @@ -35,6 +35,7 @@ #include "TrkTrackSummary/TrackSummary.h" #include "TrkTrackSummary/InDetTrackSummary.h" #include "TrkToolInterfaces/ITrackHoleSearchTool.h" +#include "PixelMonitoring/Components.h" #include "PixelMonitoring/PixelMon2DMapsLW.h" #include "PixelMonitoring/PixelMon2DProfilesLW.h" #include "PixelMonitoring/PixelMonModules.h" @@ -47,12 +48,11 @@ /////////////////////////////////////////////////////////////////////////////// StatusCode PixelMainMon::BookTrackMon(void) { - if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "starting Book Tracks" << endmsg; + ATH_MSG_DEBUG("Start booking Track histogtams.."); std::string path = "Pixel/Track"; - if(m_doOnTrack) path.replace(path.begin(), path.end(), "Pixel/TrackOnTrack"); - if(m_doOnPixelTrack) path.replace(path.begin(), path.end(), "Pixel/TrackOnPixelTrack"); - MonGroup trackHistos( this, path.c_str(), run, ATTRIB_MANAGED ); //declare a group of histograms + 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 modlabel[9]; modlabel[0]="ECA"; modlabel[1]="ECC"; @@ -103,41 +103,35 @@ StatusCode PixelMainMon::BookTrackMon(void) if (m_LorentzAngle_B0) m_LorentzAngle_B0->SetOption("colz"); if (m_LorentzAngle_B1) m_LorentzAngle_B1->SetOption("colz"); if (m_LorentzAngle_B2) m_LorentzAngle_B2->SetOption("colz"); - - sc=trackHistos.regHist(m_degFactorMap_per_lumi = TProfile_LW::create("degFactorMap_per_lumi", ("deg. factor per lumi" + m_histTitleExt + ";lumi block;avg deg. factor").c_str(), nbins_LB, min_LB, max_LB)); - sc=trackHistos.regHist(m_degFactorMap = TProfile2D_LW::create("degFactorMap", ("deg. factor map" + m_histTitleExt + ";track #eta;track #phi").c_str(), 60, -3.0, 3.0, 60, -3.0, 3.0)); - m_degFactorMap->SetOption("colz"); - m_degFactorMap->SetMinimum(1.0); - m_degFactorMap->SetMaximum(2.0); - + if (m_do2DMaps && !m_doOnline) { - m_tsos_hitmap = new PixelMon2DMapsLW("TSOS_Measurement", ("TSOS of type Measurement" + m_histTitleExt), m_doIBL, false, true); + m_tsos_hitmap = new PixelMon2DMapsLW("TSOS_Measurement", ("TSOS of type Measurement" + m_histTitleExt), PixMon::HistConf::kPixDBMIBL2D3D, true); sc = m_tsos_hitmap->regHist(trackHistos); - m_tsos_holemap = new PixelMon2DMapsLW("TSOS_Hole", ("TSOS of type Hole" + m_histTitleExt), m_doIBL, false, true); + m_tsos_holemap = new PixelMon2DMapsLW("TSOS_Hole", ("TSOS of type Hole" + m_histTitleExt), PixMon::HistConf::kPixDBMIBL2D3D, true); sc = m_tsos_holemap->regHist(trackHistos); - m_tsos_outliermap = new PixelMon2DMapsLW("TSOS_Outlier", ("TSOS of type Outlier" + m_histTitleExt), m_doIBL, false, true); + m_tsos_outliermap = new PixelMon2DMapsLW("TSOS_Outlier", ("TSOS of type Outlier" + m_histTitleExt), PixMon::HistConf::kPixDBMIBL2D3D, true); sc = m_tsos_outliermap->regHist(trackHistos); - //m_tsos_measratio = new PixelMon2DProfilesLW("TSOS_MeasRatio", ("TSOS of type Meas per track" + m_histTitleExt), m_doIBL, false, true); + //m_tsos_measratio = new PixelMon2DProfilesLW("TSOS_MeasRatio", ("TSOS of type Meas per track" + m_histTitleExt), PixMon::HistConf::kPixIBL2D3D, true); //sc = m_tsos_measratio->regHist(trackHistos); - //m_tsos_holeratio = new PixelMon2DProfilesLW("TSOS_HoleRatio", ("TSOS of type Hole per track" + m_histTitleExt), m_doIBL, false, true); + //m_tsos_holeratio = new PixelMon2DProfilesLW("TSOS_HoleRatio", ("TSOS of type Hole per track" + m_histTitleExt), PixMon::HistConf::kPixIBL2D3D, true); //sc = m_tsos_holeratio->regHist(trackHistos); - //m_misshits_ratio = new PixelMon2DProfilesLW("MissHitsRatioOnTrack", ("Hole+Outlier per track" + m_histTitleExt), m_doIBL, false, true); + //m_misshits_ratio = new PixelMon2DProfilesLW("MissHitsRatioOnTrack", ("Hole+Outlier per track" + m_histTitleExt), PixMon::HistConf::kPixIBL2D3D, true); //sc = m_misshits_ratio->regHist(trackHistos); } if (m_doOnline) { - m_tsos_holeratio_tmp = new PixelMon2DProfilesLW("HoleRatio_tmp", ("TSOS of type Hole per track tmp" + m_histTitleExt), m_doIBL, false, true); + m_tsos_holeratio_tmp = new PixelMon2DProfilesLW("HoleRatio_tmp", ("TSOS of type Hole per track tmp" + m_histTitleExt), PixMon::HistConf::kPixIBL2D3D, true); sc = m_tsos_holeratio_tmp->regHist(trackHistos); - m_tsos_holeratio_mon = new PixelMon2DProfilesLW("HoleRatio_mon", ("TSOS of type Hole per track for monitoring" + m_histTitleExt), m_doIBL, false, true); + m_tsos_holeratio_mon = new PixelMon2DProfilesLW("HoleRatio_mon", ("TSOS of type Hole per track for monitoring" + m_histTitleExt), PixMon::HistConf::kPixIBL2D3D, true); sc = m_tsos_holeratio_mon->regHist(trackHistos); - m_misshits_ratio_tmp = new PixelMon2DProfilesLW("MissHitsRatioOnTrack_tmp", ("Hole+Outlier per track" + m_histTitleExt), m_doIBL, false, true); + m_misshits_ratio_tmp = new PixelMon2DProfilesLW("MissHitsRatioOnTrack_tmp", ("Hole+Outlier per track" + m_histTitleExt), PixMon::HistConf::kPixIBL2D3D, true); sc = m_misshits_ratio_tmp->regHist(trackHistos); - m_misshits_ratio_mon = new PixelMon2DProfilesLW("MissHitsRatioOnTrack_mon", ("Hole+Outlier per track for monitoring" + m_histTitleExt), m_doIBL, false, true); + m_misshits_ratio_mon = new PixelMon2DProfilesLW("MissHitsRatioOnTrack_mon", ("Hole+Outlier per track for monitoring" + m_histTitleExt), PixMon::HistConf::kPixIBL2D3D, true); sc = m_misshits_ratio_mon->regHist(trackHistos); } - if (m_doModules) { - m_tsos_hiteff_vs_lumi = new PixelMonModulesProf("TSOS_HitEfficiency",("TSOS-based hit efficiency in module" + m_histTitleExt).c_str(),2500,-0.5,2499.5,m_doIBL); + if (m_doModules && !m_doOnTrack) { // tbc essentially code weren't used since doModules was enabled only for AllHits; to keep it disabled also now !m_doOnTrack switch was added + m_tsos_hiteff_vs_lumi = new PixelMonModulesProf("TSOS_HitEfficiency",("TSOS-based hit efficiency in module" + m_histTitleExt).c_str(),2500,-0.5,2499.5); sc = m_tsos_hiteff_vs_lumi->regHist(this,(path+"/Modules_TSOSHitEff").c_str(),run); if (!m_doOnline) { sc=trackHistos.regHist(m_clustot_lowpt = TH1F_LW::create("m_clustot_lowpt",("Cluster ToT vs Track pT (pT<10GeV)" + m_histTitleExt + "; Track pT; Cluster ToT (on track)").c_str(),250,0,250)); @@ -162,13 +156,13 @@ StatusCode PixelMainMon::BookTrackMon(void) sc = trackHistos.regHist(m_hiteff_incl_mod[i] = TProfile_LW::create(hname.c_str(), htitles.c_str(), nbins_LB, min_LB, max_LB)); } - if (sc.isFailure())if(msgLvl(MSG::WARNING)) msg(MSG::WARNING) << "histograms not booked" << endmsg; + if (sc.isFailure()) ATH_MSG_WARNING("Problems with booking Track histograms"); return StatusCode::SUCCESS; } StatusCode PixelMainMon::FillTrackMon(void) { - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "MainFillTrackMon" << endmsg; + ATH_MSG_DEBUG("Filling Track Monitoring Histograms"); /// /// Retrieve and Check Store Gate Error @@ -177,13 +171,13 @@ StatusCode PixelMainMon::FillTrackMon(void) sc = evtStore()->retrieve(m_tracks, m_TracksName); if (sc.isFailure()) { - if (msgLvl(MSG::INFO)) msg(MSG::INFO) <<"No tracks in StoreGate found"<< endmsg; + ATH_MSG_INFO("No tracks in StoreGate found"); if (m_storegate_errors) m_storegate_errors->Fill(4.,3.); return StatusCode::SUCCESS; } else { - if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) <<"Tracks in StoreGate found" <<endmsg; + ATH_MSG_DEBUG("Tracks in StoreGate found"); } m_ntracksPerEvent = 0; @@ -192,8 +186,10 @@ StatusCode PixelMainMon::FillTrackMon(void) /// /// Clear /// - if (m_doOnTrack || m_doOnPixelTrack)m_RDOIDs.clear();//reset these so you can fill them with the new id's - if (m_doOnTrack || m_doOnPixelTrack)m_ClusterIDs.clear(); + if (m_doOnTrack) { + m_RDOIDs.clear();//reset these so you can fill them with the new id's + m_ClusterIDs.clear(); + } /// @@ -203,18 +199,16 @@ StatusCode PixelMainMon::FillTrackMon(void) { const Trk::Track *track0=(*m_tracks)[i]; if (track0 == 0) { - if (msgLvl(MSG::ERROR) ) msg(MSG::ERROR) << "no pointer to track!!!" << endmsg; + ATH_MSG_ERROR("no valid pointer to track!!!"); break; } - float degradationFactor = 1.0; int nholes=-1; int nbadclus=0; int ngoodclus=0; bool passQualityCut = false; bool passTightCut = false; bool pass1hole2GeVTightCut = false; - int hitsArrayLayer[PixLayer::COUNT] = {0}; const Trk::TrackParameters *trkParameters = 0; const Trk::TrackSummary* summary = track0->trackSummary(); @@ -226,7 +220,7 @@ StatusCode PixelMainMon::FillTrackMon(void) if (summary) { if (summary->get(Trk::numberOfPixelHits)==0) continue; } else { - if (msgLvl(MSG::INFO)) msg(MSG::INFO) << "No Track Summary Found" << endmsg; + ATH_MSG_INFO("No Track Summary Found"); continue; } @@ -270,7 +264,7 @@ StatusCode PixelMainMon::FillTrackMon(void) /// TSOS Loop /// const DataVector< const Trk::TrackStateOnSurface>* trackStates=track->trackStateOnSurfaces(); - for(DataVector< const Trk::TrackStateOnSurface>::const_iterator trackStateOnSurfaceIterator=trackStates->begin(); trackStateOnSurfaceIterator!=trackStates->end(); trackStateOnSurfaceIterator++) + for (DataVector< const Trk::TrackStateOnSurface>::const_iterator trackStateOnSurfaceIterator=trackStates->begin(); trackStateOnSurfaceIterator!=trackStates->end(); trackStateOnSurfaceIterator++) { /// Change the track state on 1 surface into the cluster it represents Identifier clusID; @@ -299,8 +293,8 @@ StatusCode PixelMainMon::FillTrackMon(void) surfaceID = mesb->associatedSurface().associatedDetectorElement()->identify(); side = dynamic_cast<const InDetDD::SiDetectorElement *>( mesb->associatedSurface().associatedDetectorElement() ); } else { // holes, perigee - if(not (*trackStateOnSurfaceIterator)->trackParameters() ) { - msg(MSG::INFO) << "pointer of TSOS to track parameters or associated surface is null" << endmsg; + if (not (*trackStateOnSurfaceIterator)->trackParameters() ) { + ATH_MSG_INFO("pointer of TSOS to track parameters or associated surface is null"); continue; } surfaceID = (*trackStateOnSurfaceIterator)->trackParameters()->associatedSurface().associatedDetectorElementIdentifier();//check ptr @@ -310,7 +304,6 @@ StatusCode PixelMainMon::FillTrackMon(void) int pixlayer = GetPixLayerID(m_pixelid->barrel_ec(surfaceID), m_pixelid->layer_disk(surfaceID), m_doIBL); int pixlayerdisk = GetPixLayerDiskID(m_pixelid->barrel_ec(surfaceID), m_pixelid->layer_disk(surfaceID), m_doIBL); - //int pixlayerdbm = GetPixLayerIDDBM(m_pixelid->barrel_ec(surfaceID), m_pixelid->layer_disk(surfaceID), m_doIBL); int pixlayeribl2d3d = pixlayer; if ( pixlayeribl2d3d == PixLayer::kIBL ){ pixlayeribl2d3d = GetPixLayerIDIBL2D3D(m_pixelid->barrel_ec(surfaceID), m_pixelid->layer_disk(surfaceID), m_pixelid->eta_module(surfaceID), m_doIBL); @@ -320,8 +313,7 @@ StatusCode PixelMainMon::FillTrackMon(void) id_hash = m_pixelid->wafer_hash(surfaceID); //bool active = m_pixelCondSummarySvc->isActive(id_hash); - - if ((*trackStateOnSurfaceIterator)->type(Trk::TrackStateOnSurface::Measurement)){ + if ((*trackStateOnSurfaceIterator)->type(Trk::TrackStateOnSurface::Measurement)) { clus = dynamic_cast< const InDet::SiClusterOnTrack*>(mesb); if (clus) clusID = clus->identify(); //nMeasurement = 1.0; @@ -332,117 +324,108 @@ StatusCode PixelMainMon::FillTrackMon(void) if ( m_hiteff_incl_mod[pixlayerdisk] && pass1hole2GeVTightCut ) m_hiteff_incl_mod[pixlayerdisk]->Fill( m_manager->lumiBlockNumber(), 1.0 ); } - if((*trackStateOnSurfaceIterator)->type(Trk::TrackStateOnSurface::Outlier)){ - clus = dynamic_cast< const InDet::SiClusterOnTrack*>((*trackStateOnSurfaceIterator)->measurementOnTrack()); - if(clus) clusID = clus->identify(); - nOutlier = 1.0; - - if( m_tsos_holemap ) m_tsos_holemap->Fill(surfaceID, m_pixelid); - if( m_tsos_hiteff_vs_lumi ) m_tsos_hiteff_vs_lumi->Fill(m_manager->lumiBlockNumber(),0.,surfaceID,m_pixelid); - //if( m_hiteff_incl_mod[pixlayerdisk] && passQualityCut ) m_hiteff_incl_mod[pixlayerdisk]->Fill( m_manager->lumiBlockNumber(), 0.0 ); - if( m_hiteff_incl_mod[pixlayerdisk] && pass1hole2GeVTightCut ) m_hiteff_incl_mod[pixlayerdisk]->Fill( m_manager->lumiBlockNumber(), 0.0 ); - } + if ((*trackStateOnSurfaceIterator)->type(Trk::TrackStateOnSurface::Outlier)) { + clus = dynamic_cast< const InDet::SiClusterOnTrack*>((*trackStateOnSurfaceIterator)->measurementOnTrack()); + if (clus) clusID = clus->identify(); + nOutlier = 1.0; + + if ( m_tsos_holemap ) m_tsos_holemap->Fill(surfaceID, m_pixelid); + if ( m_tsos_hiteff_vs_lumi ) m_tsos_hiteff_vs_lumi->Fill(m_manager->lumiBlockNumber(),0.,surfaceID,m_pixelid); + //if( m_hiteff_incl_mod[pixlayerdisk] && passQualityCut ) m_hiteff_incl_mod[pixlayerdisk]->Fill( m_manager->lumiBlockNumber(), 0.0 ); + if ( m_hiteff_incl_mod[pixlayerdisk] && pass1hole2GeVTightCut ) m_hiteff_incl_mod[pixlayerdisk]->Fill( m_manager->lumiBlockNumber(), 0.0 ); + } - if((*trackStateOnSurfaceIterator)->type(Trk::TrackStateOnSurface::Hole)){ - clus = dynamic_cast< const InDet::SiClusterOnTrack*>((*trackStateOnSurfaceIterator)->measurementOnTrack()); - if(clus) clusID = clus->identify(); - nHole = 1.0; - - if( m_tsos_outliermap)m_tsos_outliermap->Fill(surfaceID, m_pixelid); - if( m_tsos_hiteff_vs_lumi) m_tsos_hiteff_vs_lumi->Fill(m_manager->lumiBlockNumber(),0.,surfaceID,m_pixelid); - //if( m_hiteff_incl_mod[pixlayerdisk] && passQualityCut ) m_hiteff_incl_mod[pixlayerdisk]->Fill( m_manager->lumiBlockNumber(), 0.0 ); - if( m_hiteff_incl_mod[pixlayerdisk] && pass1hole2GeVTightCut ) m_hiteff_incl_mod[pixlayerdisk]->Fill( m_manager->lumiBlockNumber(), 0.0 ); - } - - - //if(m_tsos_measratio && passQualityCut) m_tsos_measratio->Fill(surfaceID,m_pixelid,nMeasurement); - //if(m_tsos_holeratio && passQualityCut) m_tsos_holeratio->Fill(surfaceID,m_pixelid,nHole); - if (m_doOnline && m_tsos_holeratio_tmp && passQualityCut) m_tsos_holeratio_tmp->Fill(surfaceID,m_pixelid,nHole); - if (passQualityCut) { - if (nOutlier + nHole > 0.) { - if (m_misshits_ratio) m_misshits_ratio->Fill(surfaceID,m_pixelid,1.0); - if (m_doOnline && m_misshits_ratio_tmp) m_misshits_ratio_tmp->Fill(surfaceID,m_pixelid,1.0); - } else { - if (m_misshits_ratio) m_misshits_ratio->Fill(surfaceID,m_pixelid,0.0); - if (m_doOnline && m_misshits_ratio_tmp) m_misshits_ratio_tmp->Fill(surfaceID,m_pixelid,0.0); - } - } - - /// - /// PixelClusters are valid - /// - if(!(*trackStateOnSurfaceIterator)->type(Trk::TrackStateOnSurface::Measurement)){continue;} - if(!clus)continue; - const InDet::SiCluster *RawDataClus = dynamic_cast< const InDet::SiCluster*>(clus->prepRawData()); - if(!RawDataClus)continue; - if(!RawDataClus->detectorElement()->isPixel()) continue; - - nPixelHits++;//add another pixel hit - for(unsigned int loopSize=0;loopSize < RawDataClus->rdoList().size(); loopSize++) { - if(m_doOnTrack || m_doOnPixelTrack) m_RDOIDs.push_back(RawDataClus->rdoList().at(loopSize)); - } - if(m_doOnTrack || m_doOnPixelTrack) m_ClusterIDs.push_back( clus->identify()); + if ((*trackStateOnSurfaceIterator)->type(Trk::TrackStateOnSurface::Hole)) { + clus = dynamic_cast< const InDet::SiClusterOnTrack*>((*trackStateOnSurfaceIterator)->measurementOnTrack()); + if (clus) clusID = clus->identify(); + nHole = 1.0; - const InDet::PixelCluster* pixelCluster=dynamic_cast<const InDet::PixelCluster*>(RawDataClus); - - if(pixelCluster){ - /// - /// Pixel Cluster Selection - /// - if( !RawDataClus->gangedPixel() && /// not include ganged-pixel - !pixelCluster->isFake() && /// not fake - ( (pixlayer == PixLayer::kIBL && fabs(clus->localParameters()[Trk::locX])<8.3) - || (pixlayer != PixLayer::kIBL && fabs(clus->localParameters()[Trk::locX])<8.1) ) && - ( (pixlayeribl2d3d == PixLayerIBL2D3D::kIBL2D && fabs(clus->localParameters()[Trk::locY])<19.7) - || (pixlayeribl2d3d == PixLayerIBL2D3D::kIBL3D && fabs(clus->localParameters()[Trk::locY])<9.5) - || (pixlayer != PixLayer::kIBL && fabs(clus->localParameters()[Trk::locY])<28.7) ) - ){ - passClusterSelection = true; - } - /// - /// Cluster Variables - /// - npixHitsInCluster = pixelCluster->rdoList().size(); - //colWidthOfCluster = pixelCluster->width().colRow().y(); - rowWidthOfCluster = pixelCluster->width().colRow().x(); - totalToTOfCluster = pixelCluster->totalToT(); + if ( m_tsos_outliermap) m_tsos_outliermap->Fill(surfaceID, m_pixelid); + if ( m_tsos_hiteff_vs_lumi) m_tsos_hiteff_vs_lumi->Fill(m_manager->lumiBlockNumber(),0.,surfaceID,m_pixelid); + //if( m_hiteff_incl_mod[pixlayerdisk] && passQualityCut ) m_hiteff_incl_mod[pixlayerdisk]->Fill( m_manager->lumiBlockNumber(), 0.0 ); + if ( m_hiteff_incl_mod[pixlayerdisk] && pass1hole2GeVTightCut ) m_hiteff_incl_mod[pixlayerdisk]->Fill( m_manager->lumiBlockNumber(), 0.0 ); + } + + + //if(m_tsos_measratio && passQualityCut) m_tsos_measratio->Fill(surfaceID,m_pixelid,nMeasurement); + //if(m_tsos_holeratio && passQualityCut) m_tsos_holeratio->Fill(surfaceID,m_pixelid,nHole); + if (m_doOnline && m_tsos_holeratio_tmp && passQualityCut) m_tsos_holeratio_tmp->Fill(surfaceID,m_pixelid,nHole); + if (passQualityCut) { + if (nOutlier + nHole > 0.) { + if (m_misshits_ratio) m_misshits_ratio->Fill(surfaceID,m_pixelid,1.0); + if (m_doOnline && m_misshits_ratio_tmp) m_misshits_ratio_tmp->Fill(surfaceID,m_pixelid,1.0); + } else { + if (m_misshits_ratio) m_misshits_ratio->Fill(surfaceID,m_pixelid,0.0); + if (m_doOnline && m_misshits_ratio_tmp) m_misshits_ratio_tmp->Fill(surfaceID,m_pixelid,0.0); + } + } + + /// + /// PixelClusters are valid + /// + if (!(*trackStateOnSurfaceIterator)->type(Trk::TrackStateOnSurface::Measurement)) continue; + if (!clus) continue; + const InDet::SiCluster *RawDataClus = dynamic_cast< const InDet::SiCluster*>(clus->prepRawData()); + if (!RawDataClus) continue; + if (!RawDataClus->detectorElement()->isPixel()) continue; + + nPixelHits++; //add another pixel hit + for (unsigned int loopSize=0;loopSize < RawDataClus->rdoList().size(); loopSize++) { + if (m_doOnTrack) m_RDOIDs.push_back(RawDataClus->rdoList().at(loopSize)); + } + if (m_doOnTrack) m_ClusterIDs.push_back( clus->identify()); + + const InDet::PixelCluster* pixelCluster = dynamic_cast<const InDet::PixelCluster*>(RawDataClus); + if (pixelCluster) { + /// + /// Pixel Cluster Selection + /// + if ( !RawDataClus->gangedPixel() && /// not include ganged-pixel + !pixelCluster->isFake() && /// not fake + ( (pixlayer == PixLayer::kIBL && fabs(clus->localParameters()[Trk::locX])<8.3) + || (pixlayer != PixLayer::kIBL && fabs(clus->localParameters()[Trk::locX])<8.1) ) && + ( (pixlayeribl2d3d == PixLayerIBL2D3D::kIBL2D && fabs(clus->localParameters()[Trk::locY])<19.7) + || (pixlayeribl2d3d == PixLayerIBL2D3D::kIBL3D && fabs(clus->localParameters()[Trk::locY])<9.5) + || (pixlayer != PixLayer::kIBL && fabs(clus->localParameters()[Trk::locY])<28.7) ) + ){ + passClusterSelection = true; + } + /// + /// Cluster Variables + /// + npixHitsInCluster = pixelCluster->rdoList().size(); + //colWidthOfCluster = pixelCluster->width().colRow().y(); + rowWidthOfCluster = pixelCluster->width().colRow().x(); + totalToTOfCluster = pixelCluster->totalToT(); - if( npixHitsInCluster == 1 && totalToTOfCluster < 8) { nbadclus++; } - else{ ngoodclus++; } + if ( npixHitsInCluster == 1 && totalToTOfCluster < 8) { nbadclus++; } + else { ngoodclus++; } - if(m_doModules && !m_doOnline){ - if(measPerigee){ - float pt = measPerigee->pT()/1000.0; - if(m_clustot_vs_pt) m_clustot_vs_pt->Fill(pt, totalToTOfCluster); - if(pt<10){ - if(m_clustot_lowpt) m_clustot_lowpt->Fill(totalToTOfCluster); - if(npixHitsInCluster==1){ if(m_1hitclustot_lowpt) m_1hitclustot_lowpt->Fill(totalToTOfCluster);} - if(npixHitsInCluster==2){ if(m_2hitclustot_lowpt) m_2hitclustot_lowpt->Fill(totalToTOfCluster);} - }else{ - if(m_clustot_highpt) m_clustot_highpt->Fill(totalToTOfCluster); - if(npixHitsInCluster==1){ if(m_1hitclustot_highpt) m_1hitclustot_highpt->Fill(totalToTOfCluster);} - if(npixHitsInCluster==2){ if(m_2hitclustot_highpt) m_2hitclustot_highpt->Fill(totalToTOfCluster);} - } - } - } - /// - /// Hole module map - /// - - /// - /// Categorize tracks for IP resolution degradation - /// - hitsArrayLayer[pixlayer] = 1; + if (m_doModules && !m_doOnline) { //indirectly disabled + if (measPerigee) { + float pt = measPerigee->pT()/1000.0; + if (m_clustot_vs_pt) m_clustot_vs_pt->Fill(pt, totalToTOfCluster); + if (pt<10) { + if (m_clustot_lowpt) m_clustot_lowpt->Fill(totalToTOfCluster); + if (npixHitsInCluster==1){ if(m_1hitclustot_lowpt) m_1hitclustot_lowpt->Fill(totalToTOfCluster);} + if (npixHitsInCluster==2){ if(m_2hitclustot_lowpt) m_2hitclustot_lowpt->Fill(totalToTOfCluster);} + } else { + if (m_clustot_highpt) m_clustot_highpt->Fill(totalToTOfCluster); + if (npixHitsInCluster==1){ if(m_1hitclustot_highpt) m_1hitclustot_highpt->Fill(totalToTOfCluster);} + if (npixHitsInCluster==2){ if(m_2hitclustot_highpt) m_2hitclustot_highpt->Fill(totalToTOfCluster);} } + } + } + } - /// - /// Get track parameters for current surface (with AtaPlane) - /// - trkParameters = (*trackStateOnSurfaceIterator)->trackParameters(); - const Trk::AtaPlane *trackAtPlane = dynamic_cast<const Trk::AtaPlane*>(trkParameters); - if(trackAtPlane) - { + /// + /// Get track parameters for current surface (with AtaPlane) + /// + trkParameters = (*trackStateOnSurfaceIterator)->trackParameters(); + 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 @@ -452,17 +435,17 @@ StatusCode PixelMainMon::FillTrackMon(void) //pulls and residuals Phi 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); + 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); + if (error_sum != 0) pull = (res)/error_sum; + if (m_track_pull_phi) m_track_pull_phi->Fill(pull); //pulls and residuals Eta 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); + 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); /// LorentzAngle Amg::Vector3D mynormal = side->normal(); @@ -471,39 +454,39 @@ StatusCode PixelMainMon::FillTrackMon(void) double trkphicomp = mytrack.dot(myphiax); double trknormcomp = mytrack.dot(mynormal); double phiIncident = atan2(trkphicomp,trknormcomp); - if(npixHitsInCluster > 0 && passTightCut && passClusterSelection){ - if(pixlayer == PixLayer::kIBL && m_LorentzAngle_IBL) m_LorentzAngle_IBL->Fill(phiIncident, m_pixelid->phi_module(surfaceID), 1.0*rowWidthOfCluster); - if(pixlayeribl2d3d == PixLayerIBL2D3D::kIBL2D && m_LorentzAngle_IBL2D) m_LorentzAngle_IBL2D->Fill(phiIncident, m_pixelid->phi_module(surfaceID), 1.0*rowWidthOfCluster); - if(pixlayeribl2d3d == PixLayerIBL2D3D::kIBL3D && m_LorentzAngle_IBL3D) m_LorentzAngle_IBL3D->Fill(phiIncident, m_pixelid->phi_module(surfaceID), 1.0*rowWidthOfCluster); - if(pixlayer == PixLayer::kB0 && m_LorentzAngle_B0) m_LorentzAngle_B0->Fill(phiIncident, m_pixelid->phi_module(surfaceID), 1.0*rowWidthOfCluster); - if(pixlayer == PixLayer::kB1 && m_LorentzAngle_B1) m_LorentzAngle_B1->Fill(phiIncident, m_pixelid->phi_module(surfaceID), 1.0*rowWidthOfCluster); - if(pixlayer == PixLayer::kB2 && m_LorentzAngle_B2) m_LorentzAngle_B2->Fill(phiIncident, m_pixelid->phi_module(surfaceID), 1.0*rowWidthOfCluster); + if (npixHitsInCluster > 0 && passTightCut && passClusterSelection){ + if (pixlayer == PixLayer::kIBL && m_LorentzAngle_IBL) m_LorentzAngle_IBL->Fill(phiIncident, m_pixelid->phi_module(surfaceID), 1.0*rowWidthOfCluster); + if (pixlayeribl2d3d == PixLayerIBL2D3D::kIBL2D && m_LorentzAngle_IBL2D) m_LorentzAngle_IBL2D->Fill(phiIncident, m_pixelid->phi_module(surfaceID), 1.0*rowWidthOfCluster); + if (pixlayeribl2d3d == PixLayerIBL2D3D::kIBL3D && m_LorentzAngle_IBL3D) m_LorentzAngle_IBL3D->Fill(phiIncident, m_pixelid->phi_module(surfaceID), 1.0*rowWidthOfCluster); + if (pixlayer == PixLayer::kB0 && m_LorentzAngle_B0) m_LorentzAngle_B0->Fill(phiIncident, m_pixelid->phi_module(surfaceID), 1.0*rowWidthOfCluster); + if (pixlayer == PixLayer::kB1 && m_LorentzAngle_B1) m_LorentzAngle_B1->Fill(phiIncident, m_pixelid->phi_module(surfaceID), 1.0*rowWidthOfCluster); + if (pixlayer == PixLayer::kB2 && m_LorentzAngle_B2) m_LorentzAngle_B2->Fill(phiIncident, m_pixelid->phi_module(surfaceID), 1.0*rowWidthOfCluster); } - } + } } // end of TSOS loop - if(!m_doOnline && m_doModules){ - float pt = measPerigee->pT()/1000.0; - if(nbadclus==1){ - if(m_track_chi2_bcl1 && track0->fitQuality()->numberDoF() != 0) m_track_chi2_bcl1->Fill(track0->fitQuality()->chiSquared()/track0->fitQuality()->numberDoF()); - } - if(nbadclus==0){ - if(m_track_chi2_bcl0 && track0->fitQuality()->numberDoF() != 0) m_track_chi2_bcl0->Fill(track0->fitQuality()->chiSquared()/track0->fitQuality()->numberDoF()); - } - if(nbadclus>1){ - if(m_track_chi2_bclgt1 && track0->fitQuality()->numberDoF() != 0) m_track_chi2_bclgt1->Fill(track0->fitQuality()->chiSquared()/track0->fitQuality()->numberDoF()); - } - if(pt>=10){ - if(nbadclus==1){ - if(m_track_chi2_bcl1_highpt && track0->fitQuality()->numberDoF() != 0) m_track_chi2_bcl1_highpt->Fill(track0->fitQuality()->chiSquared()/track0->fitQuality()->numberDoF()); - } - if(nbadclus==0){ - if(m_track_chi2_bcl1_highpt && track0->fitQuality()->numberDoF() != 0) m_track_chi2_bcl0_highpt->Fill(track0->fitQuality()->chiSquared()/track0->fitQuality()->numberDoF()); - } - if(nbadclus>1){ - if(m_track_chi2_bclgt1_highpt && track0->fitQuality()->numberDoF() != 0) m_track_chi2_bclgt1_highpt->Fill(track0->fitQuality()->chiSquared()/track0->fitQuality()->numberDoF()); - } - } + if (m_doModules && !m_doOnline) { //indirectly disabled + float pt = measPerigee->pT()/1000.0; + if (nbadclus==1) { + if (m_track_chi2_bcl1 && track0->fitQuality()->numberDoF() != 0) m_track_chi2_bcl1->Fill(track0->fitQuality()->chiSquared()/track0->fitQuality()->numberDoF()); + } + if (nbadclus==0) { + if (m_track_chi2_bcl0 && track0->fitQuality()->numberDoF() != 0) m_track_chi2_bcl0->Fill(track0->fitQuality()->chiSquared()/track0->fitQuality()->numberDoF()); + } + if (nbadclus>1) { + if (m_track_chi2_bclgt1 && track0->fitQuality()->numberDoF() != 0) m_track_chi2_bclgt1->Fill(track0->fitQuality()->chiSquared()/track0->fitQuality()->numberDoF()); + } + if (pt>=10) { + if (nbadclus==1) { + if (m_track_chi2_bcl1_highpt && track0->fitQuality()->numberDoF() != 0) m_track_chi2_bcl1_highpt->Fill(track0->fitQuality()->chiSquared()/track0->fitQuality()->numberDoF()); + } + if (nbadclus==0) { + if (m_track_chi2_bcl1_highpt && track0->fitQuality()->numberDoF() != 0) m_track_chi2_bcl0_highpt->Fill(track0->fitQuality()->chiSquared()/track0->fitQuality()->numberDoF()); + } + if (nbadclus>1) { + if (m_track_chi2_bclgt1_highpt && track0->fitQuality()->numberDoF() != 0) m_track_chi2_bclgt1_highpt->Fill(track0->fitQuality()->chiSquared()/track0->fitQuality()->numberDoF()); + } + } } if (nPixelHits>0) @@ -511,39 +494,7 @@ StatusCode PixelMainMon::FillTrackMon(void) m_ntracksPerEvent++; } - /// IP degradation factor map - if( m_doDegFactorMap ){ - if (measPerigee){ - - double pt = measPerigee->pT(); - double eta = measPerigee->eta(); - double phi = measPerigee->parameters()[Trk::phi0]; - - if(hitsArrayLayer[PixLayer::kECA]==1 || hitsArrayLayer[PixLayer::kECC]==1){ - degradationFactor = 1.0; - }else{ - if ( hitsArrayLayer[PixLayer::kIBL] == 1 && hitsArrayLayer[PixLayer::kB0] == 1 && hitsArrayLayer[PixLayer::kB1] == 1 && hitsArrayLayer[PixLayer::kB2] == 1 ) degradationFactor = 1.0; - else if( hitsArrayLayer[PixLayer::kIBL] == 0 && hitsArrayLayer[PixLayer::kB0] == 1 && hitsArrayLayer[PixLayer::kB1] == 1 && hitsArrayLayer[PixLayer::kB2] == 1 ) degradationFactor = 1.8; - else if( hitsArrayLayer[PixLayer::kIBL] == 1 && hitsArrayLayer[PixLayer::kB0] == 0 && hitsArrayLayer[PixLayer::kB1] == 1 && hitsArrayLayer[PixLayer::kB2] == 1 ) degradationFactor = 1.16; - else if( hitsArrayLayer[PixLayer::kIBL] == 1 && hitsArrayLayer[PixLayer::kB0] == 1 && hitsArrayLayer[PixLayer::kB1] == 0 && hitsArrayLayer[PixLayer::kB2] == 1 ) degradationFactor = 1.0; - else if( hitsArrayLayer[PixLayer::kIBL] == 1 && hitsArrayLayer[PixLayer::kB0] == 1 && hitsArrayLayer[PixLayer::kB1] == 1 && hitsArrayLayer[PixLayer::kB2] == 0 ) degradationFactor = 1.0; - else if( hitsArrayLayer[PixLayer::kIBL] == 0 && hitsArrayLayer[PixLayer::kB0] == 0 && hitsArrayLayer[PixLayer::kB1] == 1 && hitsArrayLayer[PixLayer::kB2] == 1 ) degradationFactor = 3.5; - else if( hitsArrayLayer[PixLayer::kIBL] == 0 && hitsArrayLayer[PixLayer::kB0] == 1 && hitsArrayLayer[PixLayer::kB1] == 1 && hitsArrayLayer[PixLayer::kB2] == 0 ) degradationFactor = 1.8; - else if( hitsArrayLayer[PixLayer::kIBL] == 1 && hitsArrayLayer[PixLayer::kB0] == 0 && hitsArrayLayer[PixLayer::kB1] == 1 && hitsArrayLayer[PixLayer::kB2] == 0 ) degradationFactor = 1.17; - else if( hitsArrayLayer[PixLayer::kIBL] == 1 && hitsArrayLayer[PixLayer::kB0] == 1 && hitsArrayLayer[PixLayer::kB1] == 0 && hitsArrayLayer[PixLayer::kB2] == 0 ) degradationFactor = 1.0; - else if( hitsArrayLayer[PixLayer::kIBL] == 0 && hitsArrayLayer[PixLayer::kB0] == 0 && hitsArrayLayer[PixLayer::kB1] == 0 && hitsArrayLayer[PixLayer::kB2] == 1 ) degradationFactor = 6.0; - else if( hitsArrayLayer[PixLayer::kIBL] == 0 && hitsArrayLayer[PixLayer::kB0] == 0 && hitsArrayLayer[PixLayer::kB1] == 0 && hitsArrayLayer[PixLayer::kB2] == 0 ) degradationFactor = 6.0; - else degradationFactor = 1.0; - } - - if( fabs(eta) < 2.5 && pt > 400.0 ){ // requirement of tracks - if(m_degFactorMap_per_lumi) m_degFactorMap_per_lumi->Fill(m_manager->lumiBlockNumber(), degradationFactor); - if(m_degFactorMap) m_degFactorMap->Fill( eta, phi, degradationFactor); - } - } - } - - if(m_doHoleSearch && !m_doOnline && nholes>0){delete (track);} + if (m_doHoleSearch && !m_doOnline && nholes>0) delete track; } // end of track loop @@ -551,17 +502,19 @@ StatusCode PixelMainMon::FillTrackMon(void) /// Fill histograms per event /// - if(m_tracksPerEvt_per_lumi) m_tracksPerEvt_per_lumi->Fill(m_manager->lumiBlockNumber(), m_ntracksPerEvent); + if (m_tracksPerEvt_per_lumi) m_tracksPerEvt_per_lumi->Fill(m_manager->lumiBlockNumber(), m_ntracksPerEvent); - if(m_doOnTrack || m_doOnPixelTrack)sort (m_RDOIDs.begin(), m_RDOIDs.end()); - if(m_doOnTrack || m_doOnPixelTrack)sort (m_ClusterIDs.begin(), m_ClusterIDs.end()); + if (m_doOnTrack) { + sort( m_RDOIDs.begin(), m_RDOIDs.end() ); + sort( m_ClusterIDs.begin(), m_ClusterIDs.end() ); + } - if(m_doOnline){ - if(m_doRefresh5min) { - if(m_tsos_holeratio_mon && m_tsos_holeratio_tmp) m_tsos_holeratio_mon->Fill2DMon(m_tsos_holeratio_tmp); - if(m_misshits_ratio_mon && m_misshits_ratio_tmp) m_misshits_ratio_mon->Fill2DMon(m_misshits_ratio_tmp); + if (m_doOnline) { + if (m_doRefresh5min) { + if (m_tsos_holeratio_mon && m_tsos_holeratio_tmp) m_tsos_holeratio_mon->Fill2DMon(m_tsos_holeratio_tmp); + if (m_misshits_ratio_mon && m_misshits_ratio_tmp) m_misshits_ratio_mon->Fill2DMon(m_misshits_ratio_tmp); } - }//end of doOnline loop processing + } return StatusCode::SUCCESS; @@ -572,7 +525,7 @@ StatusCode PixelMainMon::ProcTrackMon(void) double lengthLB = 0; lengthLB = m_LBendTime - m_LBstartTime; if (lengthLB <= 0) { - if(msgLvl(MSG::INFO)) msg(MSG::INFO) << "Luminosity block has length <= 0 sec, cannot calculate track rate." << endmsg; + ATH_MSG_INFO("Luminosity block has length <= 0 sec, cannot calculate track rate."); return StatusCode::SUCCESS; //if LB length is zero, the rest is pointless and would divide by 0 } @@ -582,17 +535,9 @@ StatusCode PixelMainMon::ProcTrackMon(void) // m_trackRate_per_lumi->Fill(m_manager->lumiBlockNumber(),trackRateLB); //} //for(int i=0; i<PixLayer::COUNT-1+(int)(m_doIBL); i++){ - for(int i=0; i<PixLayerDisk::COUNT; i++){ - if(m_hiteff_incl_mod[i]) m_hiteff_incl_mod[i]->SetMinimum(0.8); - if(m_hiteff_incl_mod[i]) m_hiteff_incl_mod[i]->SetMaximum(1.01); - //if(m_hiteff_actv_mod[i]) m_hiteff_actv_mod[i]->SetMinimum(0.8); - //if(m_hiteff_actv_mod[i]) m_hiteff_actv_mod[i]->SetMaximum(1.01); - //if(m_hiteff_newtrkreq_mod[i]) m_hiteff_newtrkreq_mod[i]->SetMinimum(0.8); - //if(m_hiteff_newtrkreq_mod[i]) m_hiteff_newtrkreq_mod[i]->SetMaximum(1.01); + for (int i=0; i<PixLayerDisk::COUNT; i++){ + if (m_hiteff_incl_mod[i]) m_hiteff_incl_mod[i]->SetMinimum(0.8); + if (m_hiteff_incl_mod[i]) m_hiteff_incl_mod[i]->SetMaximum(1.01); } - return StatusCode::SUCCESS; - + return StatusCode::SUCCESS; } - - - -- GitLab