ATLAS Offline Software
Loading...
Searching...
No Matches
PixelConditionsSummaryTool.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
10
11#ifndef PIXELCONDITIONSSERVICES_PIXELCONDITIONSSUMMARYTOOL_H
12#define PIXELCONDITIONSSERVICES_PIXELCONDITIONSSUMMARYTOOL_H
13
14
15
19
20#include "GaudiKernel/ServiceHandle.h"
21#include "Gaudi/Property.h"
22
24
26#include "Identifier/Identifier.h"
29
34
39
40#include <string>
41#include <mutex>
42#include <tuple>
43#include <memory>
44#include <cstdint>//uint64_t
45#include <vector>
46#include <bitset>
47#include <limits>
48
50 public:
51 static InterfaceID& interfaceID();
52
53 PixelConditionsSummaryTool(const std::string& type, const std::string& name, const IInterface* parent);
55 virtual StatusCode initialize() override;
56
57 virtual bool isActive(const Identifier& elementId, const InDetConditions::Hierarchy h, const EventContext& ctx) const override final;
58 virtual bool isActive(const IdentifierHash& moduleHash, const EventContext& ctx) const override final;
59 virtual bool isActive(const IdentifierHash& moduleHash, const Identifier& elementId, const EventContext& ctx) const override final;
60 virtual double activeFraction(const IdentifierHash& moduleHash, const Identifier & idStart, const Identifier & idEnd, const EventContext& ctx) const override final;
61
62 virtual bool isGood(const Identifier& elementId, const InDetConditions::Hierarchy h, const EventContext& ctx) const override final;
63 virtual bool isGood(const IdentifierHash& moduleHash, const EventContext& ctx) const override final;
64 virtual bool isGood(const IdentifierHash& moduleHash, const Identifier& elementId, const EventContext& ctx, const IDCCacheEntry* cacheEntry=nullptr) const override final;
65 virtual double goodFraction(const IdentifierHash & moduleHash, const Identifier & idStart, const Identifier & idEnd, const EventContext& ctx) const override final;
66
67 virtual std::unique_ptr<InDet::SiDetectorElementStatus>
68 getDetectorElementStatus(const EventContext& ctx,
69 SG::WriteCondHandle<InDet::SiDetectorElementStatus>* whandle) const override;
70
71 virtual bool hasBSError(const IdentifierHash& moduleHash, const EventContext& ctx, const IDCCacheEntry* cacheEntry=nullptr) const override final;
72 virtual bool hasBSError(const IdentifierHash& moduleHash, Identifier pixid, const EventContext& ctx, const IDCCacheEntry* cacheEntry=nullptr) const override final;
73 virtual uint64_t getBSErrorWord(const IdentifierHash& moduleHash, const EventContext& ctx, const IDCCacheEntry* cacheEntry=nullptr) const override final;
74 virtual uint64_t getBSErrorWord(const IdentifierHash& moduleHash, const int index, const EventContext& ctx, const IDCCacheEntry* cacheEntry=nullptr) const override final;
75
76 // public version of getCacheEntry
77 virtual IDCCacheEntry* getCacheEntryOut(const EventContext& ctx) const override final;
78
79 bool checkChipStatus(IdentifierHash moduleHash, Identifier pixid, const EventContext& ctx) const;
80
81 private:
82 uint64_t getBSErrorWord(const InDetDD::PixelModuleDesign *p_design,
83 const int index,
84 const EventContext& ctx,
86 bool hasBSError(const InDetDD::PixelModuleDesign *p_design,
87 const IdentifierHash& moduleHash,
88 const EventContext& ctx,
92
93 std::vector<std::string> m_isActiveStatus;
94 std::vector<std::string> m_isActiveStates;
95 std::vector<int> m_activeState;
96 std::vector<int> m_activeStatus;
97 unsigned int m_activeStateMask{};
98 unsigned int m_activeStatusMask{};
99
100 Gaudi::Property<bool> m_useByteStreamFEI4
101 {this, "UseByteStreamFEI4", false, "Switch of the ByteStream error for FEI4"};
102
103 Gaudi::Property<bool> m_useByteStreamFEI3
104 {this, "UseByteStreamFEI3", false, "Switch of the ByteStream error for FEI3"};
105
106 Gaudi::Property<bool> m_useByteStreamRD53
107 {this, "UseByteStreamRD53", false, "Switch of the ByteStream error for RD53"};
108
110 {this, "PixelDCSStateCondData", "PixelDCSStateCondData", "Pixel FSM state key"};
111
113 {this, "PixelDCSStatusCondData", "PixelDCSStatusCondData", "Pixel FSM status key"};
114
116 {this, "PixelTDAQCondData", "", "Pixel TDAQ conditions key"}; //Default empty - legacy option
117
119 {this, "PixelDeadMapCondData", "PixelDeadMapCondData", "Pixel deadmap conditions key"};
120
122 {this, "PixelByteStreamErrs", "PixelByteStreamErrs", "PixelByteStreamErrs container key"};
123
125 {this, "PixelDetEleCollKey", "PixelDetectorElementCollection", "Key of SiDetectorElementCollection for Pixel"};
126
128 {this, "PixelDetElStatusEventDataBaseKey", "", "Optional event data key of an input SiDetectorElementStatus on which the newly created object will be based."};
130 {this, "PixelDetElStatusCondDataBaseKey", "" , "Optional conditions data key of an input SiDetectorElementStatus on which the newly created object will be based."};
131
132 Gaudi::Property< bool> m_activeOnly
133 {this, "ActiveOnly", false, "Module and chip status will only reflect whether the modules or chips are active not necessarily whether the signals are good."};
134
135 const uint64_t m_missingErrorInfo{std::numeric_limits<uint64_t>::max()-3000000000};
136
138
139 /*struct IDCCacheEntry {
140 EventContext::ContextEvt_t eventId = EventContext::INVALID_CONTEXT_EVT; // invalid event ID for the start
141 const IDCInDetBSErrContainer_Cache* IDCCache = nullptr;
142
143 void reset( EventContext::ContextEvt_t evtId, const IDCInDetBSErrContainer_Cache* cache) {
144 eventId = evtId;
145 IDCCache = cache;
146 }
147
148 bool needsUpdate( const EventContext& ctx) const {
149 return eventId != ctx.evt() or eventId == EventContext::INVALID_CONTEXT_EVT;
150 }
151
152 };*/
153 mutable SG::SlotSpecificObj<IDCCacheEntry> m_eventCache ATLAS_THREAD_SAFE; // Guarded by m_cacheMutex
154
158 [[nodiscard]] const IDCInDetBSErrContainer* getContainer(const EventContext& ctx) const;
159
165 [[nodiscard]] IDCCacheEntry* getCacheEntry(const EventContext& ctx) const;
166
170 std::unique_ptr<InDet::SiDetectorElementStatus>
171 createDetectorElementStatus(const EventContext& ctx,
173
174};
175
177 static InterfaceID IID_PixelConditionsSummaryTool("PixelConditionsSummaryTool", 1, 0);
178 return IID_PixelConditionsSummaryTool;
179}
180
181inline bool PixelConditionsSummaryTool::checkChipStatus(IdentifierHash moduleHash, Identifier pixid, const EventContext& ctx) const {
182 std::bitset<16> chipStatus(SG::ReadCondHandle<PixelDeadMapCondData>(m_condDeadMapKey, ctx)->getChipStatus(moduleHash));
183 if (chipStatus.any()) {
184
185 const InDetDD::SiDetectorElement *element = getDetectorEelement(moduleHash,ctx);
186 const InDetDD::PixelModuleDesign *p_design = static_cast<const InDetDD::PixelModuleDesign*>(&element->design());
187
188 std::array<InDetDD::PixelDiodeTree::CellIndexType,2> diode_idx
190 m_pixelID->eta_index(pixid));
191 InDetDD::PixelDiodeTree::DiodeProxy si_param ( p_design->diodeProxyFromIdx(diode_idx));
192 std::uint32_t chFE = p_design->getFE(si_param);
193
194 std::bitset<16> circ;
195 circ.set(chFE);
196 if ((chipStatus&circ).any()) { return false; }
197 }
198 return true;
199}
200
201#endif
Maintain a set of objects, one per slot.
Store pixel DCS module state in PixelDCSStateData.
Store pixel DCS module status in PixelDCSStatusData.
This is an Identifier helper class for the Pixel subdetector.
Store pixel TDAQ information to PixelTDAQData.
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Header file for AthHistogramAlgorithm.
IDC like storage for BS errors, TODO, customise implementation further so that we store int rather th...
Interface class for service providing summary of status of a detector element.
This is a "hash" representation of an Identifier.
static constexpr std::array< PixelDiodeTree::CellIndexType, 2 > makeCellIndex(T local_x_idx, T local_y_idx)
Create a 2D cell index from the indices in local-x (phi, row) and local-y (eta, column) direction.
Class used to describe the design of a module (diode segmentation and readout scheme)
PixelDiodeTree::DiodeProxy diodeProxyFromIdx(const std::array< PixelDiodeTree::IndexType, 2 > &idx) const
static unsigned int getFE(const PixelDiodeTree::DiodeProxy &diode_proxy)
Class to hold geometrical description of a silicon detector element.
virtual const SiDetectorDesign & design() const override final
access to the local description (inline):
Gaudi::Property< bool > m_useByteStreamFEI3
SG::ReadCondHandleKey< PixelDCSStatusData > m_condDCSStatusKey
std::vector< std::string > m_isActiveStates
virtual ~PixelConditionsSummaryTool()
Gaudi::Property< bool > m_useByteStreamFEI4
virtual std::unique_ptr< InDet::SiDetectorElementStatus > getDetectorElementStatus(const EventContext &ctx, SG::WriteCondHandle< InDet::SiDetectorElementStatus > *whandle) const override
get the module and chip status of Si detector elements
virtual bool isActive(const Identifier &elementId, const InDetConditions::Hierarchy h, const EventContext &ctx) const override final
virtual IDCCacheEntry * getCacheEntryOut(const EventContext &ctx) const override final
unsigned int m_activeStateMask
mask in which each state is represented by a bit and for states which are cnsidered active the corres...
IDCCacheEntry * getCacheEntry(const EventContext &ctx) const
Return cache for the current event If, for current slot, the cache is outdated it is retrieved from t...
std::unique_ptr< InDet::SiDetectorElementStatus > createDetectorElementStatus(const EventContext &ctx, SG::WriteCondHandle< InDet::SiDetectorElementStatus > *whandle) const
Create a new detector element status element container.
SG::ReadCondHandleKey< PixelDCSStateData > m_condDCSStateKey
virtual double goodFraction(const IdentifierHash &moduleHash, const Identifier &idStart, const Identifier &idEnd, const EventContext &ctx) const override final
bool checkChipStatus(IdentifierHash moduleHash, Identifier pixid, const EventContext &ctx) const
virtual double activeFraction(const IdentifierHash &moduleHash, const Identifier &idStart, const Identifier &idEnd, const EventContext &ctx) const override final
virtual uint64_t getBSErrorWord(const IdentifierHash &moduleHash, const EventContext &ctx, const IDCCacheEntry *cacheEntry=nullptr) const override final
SG::ReadHandleKey< IDCInDetBSErrContainer > m_BSErrContReadKey
std::vector< std::string > m_isActiveStatus
SG::SlotSpecificObj< std::mutex > m_cacheMutex ATLAS_THREAD_SAFE
SG::ReadCondHandleKey< PixelDeadMapCondData > m_condDeadMapKey
SG::ReadHandleKey< InDet::SiDetectorElementStatus > m_pixelDetElStatusEventKey
SG::ReadCondHandleKey< InDet::SiDetectorElementStatus > m_pixelDetElStatusCondKey
virtual bool isGood(const Identifier &elementId, const InDetConditions::Hierarchy h, const EventContext &ctx) const override final
const IDCInDetBSErrContainer * getContainer(const EventContext &ctx) const
Obtains container form the SG, if it is missing it will complain (hard-coded 3 times per job) and ret...
virtual bool hasBSError(const IdentifierHash &moduleHash, const EventContext &ctx, const IDCCacheEntry *cacheEntry=nullptr) const override final
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection > m_pixelDetEleCollKey
const InDetDD::SiDetectorElement * getDetectorEelement(const IdentifierHash &moduleHash, const EventContext &ctx) const
Gaudi::Property< bool > m_useByteStreamRD53
PixelConditionsSummaryTool(const std::string &type, const std::string &name, const IInterface *parent)
SG::ReadCondHandleKey< PixelTDAQData > m_condTDAQKey
unsigned int m_activeStatusMask
mask in which each status is represented by a bit and for status values which are cnsidered active th...
virtual StatusCode initialize() override
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.
Maintain a set of objects, one per slot.
Class to hold geometrical description of a silicon detector element.
STL class.
Message Stream Member.
Primary Vertex Finder.
Forward declaration.
Definition index.py:1
STL namespace.
Helper class to access parameters of a diode.
#define private