ATLAS Offline Software
Loading...
Searching...
No Matches
PixelAthMonitoringBase.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4
5#ifndef PIXELATHMONITORINGBASE_H
6#define PIXELATHMONITORINGBASE_H
7
10
14
16
17#include <tuple>
18
19class PixelID;
20
33const std::string pixLayersLabel[PixLayers::COUNT] = {
34 "ECA", "ECC", "BLayer", "Layer1", "Layer2", "IBL2D", "IBL3D"
35};
37 "ECA", "ECC", "BLayer", "Layer1", "Layer2", "IBL"
38};
40 1.f / 144.f, 1.f / 144.f, 1.f / 286.f, 1.f / 494.f, 1.f / 676.f, 1.f / 336.f, 1.f / 112.f
41};
43 15, 15, 15, 15, 15, 4, 4
44};
45
46namespace PixMon {
47 const unsigned int kNumLayersDisk {
48 3
49 };
50 const unsigned int kNumStavesIBL {
51 14
52 };
53 const unsigned int kNumStavesL0 {
54 22
55 };
56 const unsigned int kNumStavesL1 {
57 38
58 };
59 const unsigned int kNumStavesL2 {
60 52
61 };
62 const unsigned int kNumFEsIBL {
63 32
64 };
65 const unsigned int kNumModulesBarrel {
66 13
67 };
68 const unsigned int kNumModulesDisk {
69 48
70 };
71 const unsigned int kNumPP0sEC {
72 24
73 };
76}
77
78const std::vector<float> iblFEetaEdges = { 0.5894, 1.0531, 1.3851, 1.6499, 1.8559, 2.0336, 2.1805, 2.3132,
79 2.4268, 2.5324, 2.6249, 2.7116, 2.7906, 2.8638, 2.9321, 2.9953 };
80const std::vector<float> iblFEphiLoEdges = { -3.0551, -2.6063, -2.1575, -1.7087, -1.2599, -0.8111, -0.3623,
81 0.0865, 0.5353, 0.9841, 1.4329, 1.8817, 2.3305, 2.7793 };
82const std::vector<float> iblFEphiUpEdges = { -3.0215, -2.5727, -2.1239, -1.6751, -1.2263, -0.7775, -0.3287,
83 0.1201, 0.5689, 1.0177, 1.4665, 1.9153, 2.3641, 2.8129 };
84
86public:
87 virtual StatusCode initialize() override;
88
89 void fill1DProfLumiLayers(const std::string& prof1Dname, int lb, float* weights,
90 int nlayers = PixLayers::COUNT) const;
91 void fill2DProfLumiLayers(const std::string& prof2Dname, int lb, float (*weights)[PixLayers::COUNT],
92 const int* nCategories) const;
93
94 int getPixLayersID(int ec, int ld) const;
95 bool isIBL2D(int hashID) const;
96 bool isIBL3D(int hashID) const;
97 int getNumberOfFEs(int pixlayer, int etaMod) const;
98 void getPhiEtaMod(Identifier& id, int& phiMod, int& etaMod, bool& copyFE) const;
99 bool isHitOnTrack(Identifier id, std::vector<Identifier> const& RDOIDs) const;
100 bool isClusterOnTrack(Identifier id, std::vector<std::pair<Identifier, double> > const& ClusterIDs) const;
101 bool isClusterOnTrack(Identifier id, std::vector<std::pair<Identifier, double> > const& ClusterIDs,
102 double& cosalpha) const;
105 std::unordered_map<int, std::vector<int> > m_pm;
106 std::unordered_map<int, std::vector<int> > m_em;
107 std::unordered_map<int, std::vector<float> > m_val;
109 std::string m_prof2Dname;
111
112 VecAccumulator2DMap(const PixelAthMonitoringBase& host, const std::string& prof2Dname, bool copy2DFEval = false)
113 : m_host(host),
114 m_prof2Dname(prof2Dname),
115 m_copy2DFEval(copy2DFEval) {}
116 void add(const int layer, const Identifier& id, float value = 1.0);
117 void add(const int layer, const Identifier& id,
118 int iFE, float value);
119 };
120 void fill2DProfLayerAccum(const VecAccumulator2DMap& accumulator) const;
121 void fill1DModProfAccum(const VecAccumulator2DMap& accumulator, int lumiblock) const;
122
131 void fillFromArrays(const std::string& namePP0, AccumulatorArrays& pixarrays,
132 const std::string& name2DMap = "") const;
133
134protected:
135 ToolHandle<IInDetConditionsTool> m_pixelCondSummaryTool {
136 this, "PixelConditionsSummaryTool", "PixelConditionsSummaryTool", "Tool to retrieve Pixel Conditions summary"
137 };
139 {
140 this, "PixelReadoutManager", "PixelReadoutManager", "Pixel readout manager"
141 };
144
149 {this, "PixelDetElStatus", "", "Key of SiDetectorElementStatus for Pixel"};
150
156 {this, "PixelDetElStatusActiveOnly", "", "Key of SiDetectorElementStatus for Pixel which reflects only whether modules or chips are active rather than delivering good data"};
157
160 if (!key.empty()) {
161 pixelDetElStatus = SG::ReadHandle<InDet::SiDetectorElementStatus>(key, ctx);
162 if (!pixelDetElStatus.isValid()) {
163 std::stringstream msg;
164 msg << "Failed to get " << key.key() << " from StoreGate in " << name();
165 throw std::runtime_error(msg.str());
166 }
167 }
168 return pixelDetElStatus;
169 }
170 bool isActive(const InDet::SiDetectorElementStatus *element_status,
171 const IdentifierHash &module_hash) const {
172 const EventContext& ctx{Gaudi::Hive::currentContext()};
173 bool ret { element_status ? element_status->isGood(module_hash) : m_pixelCondSummaryTool->isActive(module_hash, ctx) };
174 VALIDATE_STATUS_ARRAY(element_status, element_status->isGood(module_hash), m_pixelCondSummaryTool->isActive(module_hash, ctx) );
175 return ret;
176 }
177 bool isGood(const InDet::SiDetectorElementStatus *element_status,
178 const IdentifierHash &module_hash) const {
179 const EventContext& ctx{Gaudi::Hive::currentContext()};
180 bool ret ( element_status ? element_status->isGood(module_hash) : m_pixelCondSummaryTool->isGood(module_hash, ctx));
181 VALIDATE_STATUS_ARRAY(element_status, element_status->isGood(module_hash), m_pixelCondSummaryTool->isGood(module_hash, ctx) );
182 return ret;
183 }
184 std::tuple<bool,bool> isChipGood(const IdentifierHash &module_hash,
185 unsigned int chip_i) const {
186 bool is_active=false;
187 bool is_good=false;
188 Identifier pixelID = m_pixelReadout->getPixelIdfromHash(module_hash, chip_i, 1, 1);
189 if (pixelID.is_valid()) {
190 const EventContext& ctx{Gaudi::Hive::currentContext()};
191 is_active = m_pixelCondSummaryTool->isActive(module_hash,pixelID, ctx);
192 if (is_active) {
193 is_good = m_pixelCondSummaryTool->isGood(module_hash, pixelID, ctx);
194 }
195 }
196 return std::make_tuple(is_active,is_good);
197 }
198 bool isChipActive(const IdentifierHash &module_hash,
199 unsigned int chip_i) const {
200 bool is_active=false;
201 Identifier pixelID = m_pixelReadout->getPixelIdfromHash(module_hash, chip_i, 1, 1);
202 if (pixelID.is_valid()) {
203 const EventContext& ctx{Gaudi::Hive::currentContext()};
204 is_active = m_pixelCondSummaryTool->isActive(module_hash,pixelID, ctx);
205 }
206 return is_active;
207 }
208 std::tuple<bool,bool> isChipGood(const InDet::SiDetectorElementStatus &element_active,
209 const InDet::SiDetectorElementStatus &element_status,
210 const IdentifierHash &module_hash,
211 unsigned int chip_i) const {
212 return std::make_tuple(element_active.isChipGood(module_hash, chip_i), element_status.isChipGood(module_hash, chip_i) );
213 }
214 std::tuple<bool,bool> isChipGood(const InDet::SiDetectorElementStatus *element_active,
215 const InDet::SiDetectorElementStatus *element_status,
216 const IdentifierHash &module_hash,
217 unsigned int chip_i) const {
218 std::tuple<bool,bool> ret( element_active && element_status
219 ? isChipGood( *element_active, *element_status, module_hash, chip_i)
220 : isChipGood( module_hash, chip_i) );
221#ifdef DO_VALIDATE_STATUS_ARRAY
222 Identifier pixelID = m_pixelReadout->getPixelIdfromHash(module_hash, chip_i, 1, 1);
223 const EventContext& ctx{Gaudi::Hive::currentContext()};
224 VALIDATE_STATUS_ARRAY(element_active, element_active->isChipGood(module_hash, chip_i), m_pixelCondSummaryTool->isActive(module_hash,pixelID, ctx) );
225 VALIDATE_STATUS_ARRAY(element_status, element_status->isChipGood(module_hash, chip_i), m_pixelCondSummaryTool->isGood(module_hash,pixelID, ctx) );
226#endif
227 return ret;
228 }
230 const IdentifierHash &module_hash,
231 unsigned int chip_i) const {
232 bool ret( element_active
233 ? element_active->isChipGood(module_hash, chip_i)
234 : isChipActive( module_hash, chip_i) );
235#ifdef DO_VALIDATE_STATUS_ARRAY
236 const EventContext& ctx{Gaudi::Hive::currentContext()};
237 Identifier pixelID = m_pixelReadout->getPixelIdfromHash(module_hash, chip_i, 1, 1);
238 VALIDATE_STATUS_ARRAY(element_active, element_active->isChipGood(module_hash, chip_i), m_pixelCondSummaryTool->isActive(module_hash,pixelID, ctx) );
239#endif
240 return ret;
241 }
242};
243
244#endif
Header file to be included by clients of the Monitored infrastructure.
const std::string pixBaseLayersLabel[PixLayers::NBASELAYERS]
const std::string pixLayersLabel[PixLayers::COUNT]
const std::vector< float > iblFEphiLoEdges
const int clusterToTMinCut[PixLayers::COUNT]
const std::vector< float > iblFEphiUpEdges
const std::vector< float > iblFEetaEdges
const float inv_nmod_per_layer[PixLayers::COUNT]
This is an Identifier helper class for the Pixel subdetector.
#define VALIDATE_STATUS_ARRAY(use_info, info_val, summary_val)
AthMonitorAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
This is a "hash" representation of an Identifier.
bool is_valid() const
Check if id is in a valid state.
bool isChipGood(IdentifierHash hash, unsigned int chip) const
bool isGood(IdentifierHash hash) const
SG::ReadHandleKey< InDet::SiDetectorElementStatus > m_pixelDetElStatusActiveOnly
Optional read handle to get status data to test whether a pixel detector element is active.
bool isChipActive(const IdentifierHash &module_hash, unsigned int chip_i) const
int getNumberOfFEs(int pixlayer, int etaMod) const
helper function to get number of FEs per module
ToolHandle< IInDetConditionsTool > m_pixelCondSummaryTool
bool isClusterOnTrack(Identifier id, std::vector< std::pair< Identifier, double > > const &ClusterIDs) const
checks if cluster is on track
void fill2DProfLumiLayers(const std::string &prof2Dname, int lb, float(*weights)[PixLayers::COUNT], const int *nCategories) const
filling 2DProf per-lumi per-layer histograms ["ECA","ECC","BLayer","Layer1","Layer2",...
bool isHitOnTrack(Identifier id, std::vector< Identifier > const &RDOIDs) const
checks if hit is on track
void getPhiEtaMod(Identifier &id, int &phiMod, int &etaMod, bool &copyFE) const
helper function to get eta phi coordinates of per-layer arrays
bool isIBL3D(int hashID) const
helper function to check if module is IBL 3D based on pixel hash ID
ServiceHandle< InDetDD::IPixelReadoutManager > m_pixelReadout
bool isGood(const InDet::SiDetectorElementStatus *element_status, const IdentifierHash &module_hash) const
std::tuple< bool, bool > isChipGood(const InDet::SiDetectorElementStatus *element_active, const InDet::SiDetectorElementStatus *element_status, const IdentifierHash &module_hash, unsigned int chip_i) const
void fill1DProfLumiLayers(const std::string &prof1Dname, int lb, float *weights, int nlayers=PixLayers::COUNT) const
filling 1DProf per-lumi per-layer histograms ["ECA","ECC","BLayer","Layer1","Layer2",...
int getPixLayersID(int ec, int ld) const
helper function to get layers ID
std::tuple< bool, bool > isChipGood(const InDet::SiDetectorElementStatus &element_active, const InDet::SiDetectorElementStatus &element_status, const IdentifierHash &module_hash, unsigned int chip_i) const
std::vector< int > m_modData[PixLayers::NBASELAYERS]
bool isIBL2D(int hashID) const
helper function to check if module is IBL planar based on pixel hash ID
std::tuple< bool, bool > isChipGood(const IdentifierHash &module_hash, unsigned int chip_i) const
SG::ReadHandleKey< InDet::SiDetectorElementStatus > m_pixelDetElStatus
Optional read handle to get status data to test whether a pixel detector element is good.
bool isChipActive(const InDet::SiDetectorElementStatus *element_active, const IdentifierHash &module_hash, unsigned int chip_i) const
bool isActive(const InDet::SiDetectorElementStatus *element_status, const IdentifierHash &module_hash) const
SG::ReadHandle< InDet::SiDetectorElementStatus > getPixelDetElStatus(const SG::ReadHandleKey< InDet::SiDetectorElementStatus > &key, const EventContext &ctx) const
This is an Identifier helper class for the Pixel subdetector.
Definition PixelID.h:67
Property holding a SG store/key/clid from which a ReadHandle is made.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
int lb
Definition globals.cxx:23
const int pixPhiSteps[PixLayers::NBASELAYERS]
const unsigned int kNumStavesL0
const unsigned int kNumPP0sEC
const unsigned int kNumStavesL1
const unsigned int kNumFEsIBL
const unsigned int kNumStavesIBL
const unsigned int kNumModulesDisk
const int pixEtaSteps[PixLayers::NBASELAYERS]
const unsigned int kNumStavesL2
const unsigned int kNumLayersDisk
const unsigned int kNumModulesBarrel
void initialize()
int DA[PixMon::kNumModulesDisk][PixMon::kNumLayersDisk]
int DC[PixMon::kNumModulesDisk][PixMon::kNumLayersDisk]
int IBL[PixMon::kNumStavesIBL][PixMon::kNumFEsIBL]
int B1[PixMon::kNumStavesL1][PixMon::kNumModulesBarrel]
int B0[PixMon::kNumStavesL0][PixMon::kNumModulesBarrel]
int B2[PixMon::kNumStavesL2][PixMon::kNumModulesBarrel]
std::unordered_map< int, std::vector< float > > m_val
void add(const int layer, const Identifier &id, float value=1.0)
helper class to accumulate points to fill a 2D per-module plot with
std::unordered_map< int, std::vector< int > > m_pm
VecAccumulator2DMap(const PixelAthMonitoringBase &host, const std::string &prof2Dname, bool copy2DFEval=false)
std::unordered_map< int, std::vector< int > > m_em