ATLAS Offline Software
ITkPixelDataRateMonTool.h
Go to the documentation of this file.
1 /*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 /*
6 * Author: Paul Chabrillat, starting from Ondra Kovanda and Noemi Calace work
7 * Date: 12/11/2024
8 * Description: Athena tool wrapper around the ITkPix encoder to study data rate as a function of chip's position in detector
9 */
10 
11 #ifndef ITKPIXELBYTESTREAMCNV_ITKPIXELDATARATEMONTOOL_H
12 #define ITKPIXELBYTESTREAMCNV_ITKPIXELDATARATEMONTOOL_H
13 
15 #include "GaudiKernel/ServiceHandle.h"
16 #include "GaudiKernel/ITHistSvc.h"
17 
21 
23 #include "Identifier/Identifier.h"
25 #include "ITkPixLayout.h"
26 
29 
30 #include "TH1.h"
31 #include "TH2.h"
32 #include "TProfile.h"
33 
34 class PixelID;
35 
37 
38  public:
39 
40  ITkPixelDataRateMonTool(const std::string& type,const std::string& name,const IInterface* parent);
41  virtual ~ITkPixelDataRateMonTool()=default;
42 
43  virtual StatusCode initialize() override;
44 
45  void fill(const uint32_t offlineID,
46  const std::vector<unsigned int>& encodedstream,
47  const ITkPixLayout<uint16_t>& hitMap) const;
48 
49  private:
50  // Function to book histograms
51  StatusCode bookHistograms(const std::vector<std::vector<float >>& barrel_z,
52  const std::vector<std::vector<float >>& endcap_z);
53 
54  void fillExpertPlots(const uint32_t offlineID,
55  const ITkPixLayout<uint16_t>& hitMap) const;
56 
57  // Path to histograms
58  Gaudi::Property< std::string > m_path { this, "MonitoringPath", "/DataRateMon/", "Name of directory for plots" };
59 
60  // boolean histogram to save expert plots
61  Gaudi::Property< bool > m_doExpertPlots { this, "DoExpertPlots", false, "Enable expert plots" };
62 
63  // Histogram service
64  ServiceHandle<ITHistSvc> m_thistSvc{this, "HistSvc", "THistSvc", "The histogram service"};
65 
66  // Readout service manager
67  ServiceHandle< InDetDD::IPixelReadoutManager > m_pixelReadout {this, "PixelReadoutManager", "ITkPixelReadoutManager", "Pixel readout manager" };
68 
69  // Detector manager with same method as in hitSortigTool
71 
72  // Pixel id helper tool
73  const PixelID* m_pixIdHelper = nullptr;
74 
75  // Parameters of the analysis
76 
77  // Number of bits contained in a pack from the encoder
78  const static int s_bitsPerPack = 32;
79 
80  // Readout frequency for a chip
81  const static int s_chipReadoutFrequency = 1000000;
82 
83  // Number of columns in one chip
84  const static int s_col_chip = 400;
85 
86  // Number of rows in one chip
87  const static int s_row_chip = 384;
88 
89  // --------------For all detector--------------
90 
91  // Number of layers
92  const static int N_LAYERS=9;
93 
94  // Regions of the detector
95  enum Region {
97  };
98 
99  // Labels of regions
100  std::map<int, std::string > m_regionLabels {
101  {INVALID_REGION, "invalid"}, {REGION_BARREL, "barrel"}, {REGION_ENDCAP, "endcap"}
102  };
103 
104  // Side of the detector
105  enum Side {
107  };
108 
109  // Labels of side if the sides are in different histograms
110  std::map<int, std::string > m_sideLabels {
111  {INVALID_SIDE, "invalid"}, {SIDE_POSITIVE, "pos"}, {SIDE_NEGATIVE, "neg"}
112  };
113 
114 
115  // Histogram of stream length distribution in bits for the whole detector and all the chips
116  mutable TH1* m_encoded_streamLength ATLAS_THREAD_SAFE = nullptr;
117 
118  // --------------Each region and no z dependance--------------
119 
120  // Chip hit map
121  mutable TH2* m_h2_chip_hitmap[N_LAYERS][N_REGIONS] ATLAS_THREAD_SAFE = {};
122 
123  // Chip ToT map
124  mutable TH2* m_h2_chip_totmap[N_LAYERS][N_REGIONS] ATLAS_THREAD_SAFE = {};
125 
126  // --------------Each region and separated positive and negative z--------------
127 
128  // T profile of the stream length for different layers and regions
129  mutable TProfile* m_p_streamLength[N_LAYERS][N_REGIONS][N_SIDES] ATLAS_THREAD_SAFE = {};
130 
131  // Two dimensional histogram of the stream length for different layers and regions
132  mutable TH2* m_h2_streamLength[N_LAYERS][N_REGIONS][N_SIDES] ATLAS_THREAD_SAFE = {};
133 
134  // T profile of the data rate from chips for different layers and regions
135  mutable TProfile* m_p_dataRate[N_LAYERS][N_REGIONS][N_SIDES] ATLAS_THREAD_SAFE = {};
136 
137  // Two dimensional histogem of the data rate from chips for different layers and regions
138  mutable TH2* m_h2_dataRate[N_LAYERS][N_REGIONS][N_SIDES] ATLAS_THREAD_SAFE = {};
139 
140  // T profile of the hits from chips for different layers and regions
142 
143  // Two dimensional histogram of the hits from chips for different layers and regions
144  mutable TH2* m_h2_hits[N_LAYERS][N_REGIONS][N_SIDES] ATLAS_THREAD_SAFE = {};
145 
146 
147 };
148 
149 
150 #endif // ITKPIXELBYTESTREAMCNV_ITKPIXELDATARATEMONTOOL_H
PixelID.h
This is an Identifier helper class for the Pixel subdetector. This class is a factory for creating co...
ITkPixelDataRateMonTool::m_thistSvc
ServiceHandle< ITHistSvc > m_thistSvc
Definition: ITkPixelDataRateMonTool.h:64
ITkPixelCablingData.h
ITkPixelDataRateMonTool::fillExpertPlots
void fillExpertPlots(const uint32_t offlineID, const ITkPixLayout< uint16_t > &hitMap) const
Definition: ITkPixelDataRateMonTool.cxx:124
ITkPixLayout.h
ITkPixelDataRateMonTool::m_pixelReadout
ServiceHandle< InDetDD::IPixelReadoutManager > m_pixelReadout
Definition: ITkPixelDataRateMonTool.h:67
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
ITkPixelDataRateMonTool::s_bitsPerPack
static const int s_bitsPerPack
Definition: ITkPixelDataRateMonTool.h:78
ITkPixelDataRateMonTool::N_LAYERS
static const int N_LAYERS
Definition: ITkPixelDataRateMonTool.h:92
ITkPixelDataRateMonTool::~ITkPixelDataRateMonTool
virtual ~ITkPixelDataRateMonTool()=default
ITkPixelDataRateMonTool::m_detManager
const InDetDD::PixelDetectorManager * m_detManager
Definition: ITkPixelDataRateMonTool.h:70
ITkPixelDataRateMonTool::m_regionLabels
std::map< int, std::string > m_regionLabels
Definition: ITkPixelDataRateMonTool.h:100
ITkPixelDataRateMonTool::N_REGIONS
@ N_REGIONS
Definition: ITkPixelDataRateMonTool.h:96
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
ITkPixelDataRateMonTool::s_row_chip
static const int s_row_chip
Definition: ITkPixelDataRateMonTool.h:87
ITkPixelDataRateMonTool::fill
void fill(const uint32_t offlineID, const std::vector< unsigned int > &encodedstream, const ITkPixLayout< uint16_t > &hitMap) const
Definition: ITkPixelDataRateMonTool.cxx:84
ITkPixelDataRateMonTool
Definition: ITkPixelDataRateMonTool.h:36
ITkPixelDataRateMonTool::ITkPixelDataRateMonTool
ITkPixelDataRateMonTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: ITkPixelDataRateMonTool.cxx:14
PixelDetectorManager.h
ITkPixelDataRateMonTool::m_path
Gaudi::Property< std::string > m_path
Definition: ITkPixelDataRateMonTool.h:58
python.TrigEgammaMonitorHelper.TProfile
def TProfile(*args, **kwargs)
Definition: TrigEgammaMonitorHelper.py:81
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ITkPixelDataRateMonTool::N_SIDES
@ N_SIDES
Definition: ITkPixelDataRateMonTool.h:106
AthAlgTool.h
Side
Definition: WaferTree.h:36
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ITkPixelDataRateMonTool::s_chipReadoutFrequency
static const int s_chipReadoutFrequency
Definition: ITkPixelDataRateMonTool.h:81
ITkPixelDataRateMonTool::m_doExpertPlots
Gaudi::Property< bool > m_doExpertPlots
Definition: ITkPixelDataRateMonTool.h:61
ITkPixelDataRateMonTool::REGION_BARREL
@ REGION_BARREL
Definition: ITkPixelDataRateMonTool.h:96
ITkPixelDataRateMonTool::bookHistograms
StatusCode bookHistograms(const std::vector< std::vector< float >> &barrel_z, const std::vector< std::vector< float >> &endcap_z)
Definition: ITkPixelDataRateMonTool.cxx:150
ITkPixelDataRateMonTool::INVALID_REGION
@ INVALID_REGION
Definition: ITkPixelDataRateMonTool.h:96
ITkPixelDataRateMonTool::SIDE_NEGATIVE
@ SIDE_NEGATIVE
Definition: ITkPixelDataRateMonTool.h:106
IPixelReadoutManager.h
DetectorDesign.h
ITkPixelDataRateMonTool::SIDE_POSITIVE
@ SIDE_POSITIVE
Definition: ITkPixelDataRateMonTool.h:106
InDetDD::PixelDetectorManager
Definition: PixelDetectorManager.h:47
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
ITkPixelDataRateMonTool::s_col_chip
static const int s_col_chip
Definition: ITkPixelDataRateMonTool.h:84
ITkPixelDataRateMonTool::m_sideLabels
std::map< int, std::string > m_sideLabels
Definition: ITkPixelDataRateMonTool.h:110
SiDetectorElement.h
ITkPixelDataRateMonTool::Region
Region
Definition: ITkPixelDataRateMonTool.h:95
PixelModuleDesign.h
ITkPixLayout
Definition: ITkPixLayout.h:18
AthAlgTool
Definition: AthAlgTool.h:26
ITkPixelDataRateMonTool::REGION_ENDCAP
@ REGION_ENDCAP
Definition: ITkPixelDataRateMonTool.h:96
PixelID
Definition: PixelID.h:67
ITkPixelDataRateMonTool::m_pixIdHelper
const PixelID * m_pixIdHelper
Definition: ITkPixelDataRateMonTool.h:73
ITkPixelDataRateMonTool::initialize
virtual StatusCode initialize() override
Definition: ITkPixelDataRateMonTool.cxx:20
ITkPixelDataRateMonTool::INVALID_SIDE
@ INVALID_SIDE
Definition: ITkPixelDataRateMonTool.h:106
ServiceHandle< ITHistSvc >
ITkPixelDataRateMonTool::ATLAS_THREAD_SAFE
TH1 *m_encoded_streamLength ATLAS_THREAD_SAFE
Definition: ITkPixelDataRateMonTool.h:116