ATLAS Offline Software
Loading...
Searching...
No Matches
SCT_ClusteringTool.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
9#ifndef SiClusterizationTool_SCT_ClusteringTool_H
10#define SiClusterizationTool_SCT_ClusteringTool_H
11
14#include "Identifier/Identifier.h"
24
26#include "GaudiKernel/ToolHandle.h"
27
29#include <bitset>
30#include <string>
31#include <vector>
32
33class SCT_ChannelStatusAlg;
34class StatusCode;
35
36namespace InDetDD {
38}
39
40namespace InDet {
48 : public extends<AthAlgTool, ISCT_ClusteringTool> {
49
50 using IdVec_t = std::vector<Identifier>;
51 public:
53 SCT_ClusteringTool(const std::string& type, const std::string& name,
54 const IInterface* parent);
56 virtual StatusCode initialize() override;
58 virtual ~SCT_ClusteringTool() = default;
59
61 SCT_ClusterCollection* clusterize(
63 const SCT_ID& idHelper,
64 const InDet::SiDetectorElementStatus* sctDetElementStatus,
65 SCTClusteringCache& cache,
66 DataPool<SCT_Cluster>* dataItemsPool,
67 const EventContext& ctx) const override;
68
71 SCT_ClusterCollection* fastClusterize(
73 const SCT_ID& idHelper,
74 const InDet::SiDetectorElementStatus* sctDetElementStatus,
75 SCTClusteringCache& cache,
76 DataPool<SCT_Cluster>* dataItemsPool,
77 const EventContext& ctx) const;
78
79 private:
80
85 ToolHandle<IInDetConditionsTool> m_conditionsTool{
86 this, "conditionsTool",
87 "SCT_ConditionsSummaryTool/InDetSCT_ConditionsSummaryTool",
88 "Tool to retrieve SCT Conditions summary"};
89 ToolHandle<ClusterMakerTool> m_clusterMaker{this, "globalPosAlg",
90 "InDet::ClusterMakerTool"};
91 ToolHandle<ISiLorentzAngleTool> m_lorentzAngleTool{
92 this, "LorentzAngleTool", "SiLorentzAngleTool/SCTLorentzAngleTool",
93 "Tool to retreive Lorentz angle of SCT"};
94
95
100 IntegerProperty m_errorStrategy{this, "errorStrategy", 1};
101 BooleanProperty m_checkBadChannels{this, "checkBadChannels", true};
102 StringProperty m_timeBinStr{this, "timeBins", ""};
103 BooleanProperty m_innermostBarrelX1X{this, "innermostBarrelX1X", false};
104 BooleanProperty m_innertwoBarrelX1X{this, "innertwoBarrelX1X", false};
105 BooleanProperty m_majority01X{this, "majority01X", false};
106 BooleanProperty m_useRowInformation{this, "useRowInformation", false};
107 BooleanProperty m_doFastClustering{this, "doFastClustering", true};
108 BooleanProperty m_doSimplePosWidth{this, "doSimplePositionWidthCalculation", false, "Always use the simpler position and width calculation in fast clustering"};
110
116 m_SCTDetEleCollKey{this, "SCTDetEleCollKey",
117 "SCT_DetectorElementCollection",
118 "Key of SiDetectorElementCollection for SCT. "
119 "Necessary for alignment"};
120
121
126 this, "SCTDetElStatus", "", "Key of SiDetectorElementStatus for SCT"};
127
130 int m_timeBinBits[3]{-1, -1, -1};
131
133 static void addStripsToCluster(const Identifier& firstStripId,
134 unsigned int nStrips, IdVec_t& clusterVector,
135 const SCT_ID& idHelper);
136
139 const Identifier& firstStripId, unsigned int nStrips,
140 IdVec_t& clusterVector, std::vector<IdVec_t>& idGroups,
141 const SCT_ID& idHelper,
142 const InDet::SiDetectorElementStatus* det_el_status,
143 const EventContext& ctx) const;
144
147 const Identifier& firstStripId, unsigned int nStrips,
148 IdVec_t& clusterVector, std::vector<IdVec_t>& idGroups,
149 const SCT_ID& idHelper,
150 const InDet::SiDetectorElementStatus* det_el_status,
151 const EventContext& ctx) const;
152
158 IdVec_t recluster(IdVec_t& clusterVector,
159 std::vector<IdVec_t>& idGroups) const;
160
168
171 static DimensionAndPosition clusterDimensions(
172 int firstStrip, int lastStrip, const InDetDD::SiDetectorElement* element,
173 const SCT_ID& idHelper);
174
177 static DimensionAndPosition clusterDimensionsInclRow(
178 int firstStrip, int lastStrip, int row,
179 const InDetDD::SiDetectorElement* element,
180 const InDetDD::SCT_ModuleSideDesign* design);
181
183 bool isBad(const InDet::SiDetectorElementStatus* sctDetElStatus,
184 const SCT_ID& sctID, const IdentifierHash& waferHash,
185 const Identifier& stripId, const EventContext& ctx) const;
186
188 StatusCode decodeTimeBins();
190 StatusCode decodeTimeBin(char timeBin, int& bit) const;
192
193 bool testTimeBins(int timeBin) const;
194 static bool testTimeBins01X(int timeBin);
195 static bool testTimeBinsX1X(int timeBin);
196 bool testTimeBinsN(const std::bitset<3>& timePattern) const;
198}; // end of class
199
201// Inline methods
203
205 const InDet::SiDetectorElementStatus* sctDetElStatus, const SCT_ID& sctID,
206 const IdentifierHash& waferHash, const Identifier& stripId,
207 const EventContext& ctx) const {
208 if (sctDetElStatus) {
209 const int strip_i{sctID.strip(stripId)};
211 sctDetElStatus, sctDetElStatus->isCellGood(waferHash.value(), strip_i),
212 m_conditionsTool->isGood(stripId, InDetConditions::SCT_STRIP, ctx));
213 return !sctDetElStatus->isCellGood(waferHash.value(), strip_i);
214 } else {
215 return (
216 not m_conditionsTool->isGood(stripId, InDetConditions::SCT_STRIP, ctx));
217 }
218}
219
221 const std::bitset<3>& timePattern) const {
222 // Convert the given timebin to a bit set and test each bit
223 // if bit is -1 (i.e. X) it always passes, other wise require exact match of
224 // 0/1 N.B bitset has opposite order to the bit pattern we define
225
226 if (m_timeBinBits[0] != -1 and
227 timePattern.test(2) != static_cast<bool>(m_timeBinBits[0]))
228 return false;
229 if (m_timeBinBits[1] != -1 and
230 timePattern.test(1) != static_cast<bool>(m_timeBinBits[1]))
231 return false;
232 if (m_timeBinBits[2] != -1 and
233 timePattern.test(0) != static_cast<bool>(m_timeBinBits[2]))
234 return false;
235 return true;
236}
237
238} // namespace InDet
239#endif // SiClusterizationTool_SCT_ClusteringTool_H
Header file for the ISCT_ClusteringTool class.
This is an Identifier helper class for the SCT subdetector.
#define VALIDATE_STATUS_ARRAY(use_info, info_val, summary_val)
a typed memory pool that saves time spent allocation small object.
Definition DataPool.h:63
This is a "hash" representation of an Identifier.
value_type value() const
Base class for the SCT module side design, extended by the Forward and Barrel module design.
Class to hold geometrical description of a silicon detector element.
Class to represent a position in the natural frame of a silicon sensor, for Pixel and SCT For Pixel: ...
static bool testTimeBinsX1X(int timeBin)
virtual StatusCode initialize() override
Retrieve the necessary services in initialize.
SCT_ClusterCollection * fastClusterize(const InDetRawDataCollection< SCT_RDORawData > &RDOs, const SCT_ID &idHelper, const InDet::SiDetectorElementStatus *sctDetElementStatus, SCTClusteringCache &cache, DataPool< SCT_Cluster > *dataItemsPool, const EventContext &ctx) const
A new fast method originally implemented for ITk.
int m_timeBinBits[3]
Time bin bits for timing requirement.
static bool testTimeBins01X(int timeBin)
SCT_ClusterCollection * clusterize(const InDetRawDataCollection< SCT_RDORawData > &RDOs, const SCT_ID &idHelper, const InDet::SiDetectorElementStatus *sctDetElementStatus, SCTClusteringCache &cache, DataPool< SCT_Cluster > *dataItemsPool, const EventContext &ctx) const override
Clusterize method the SCT RDOs. This method is the main one of this class.
bool testTimeBins(int timeBin) const
ToolHandle< ClusterMakerTool > m_clusterMaker
SG::ReadHandleKey< InDet::SiDetectorElementStatus > m_sctDetElStatus
Optional read handle to get status data to test whether a SCT detector element is good.
void addStripsToClusterWithChecks(const Identifier &firstStripId, unsigned int nStrips, IdVec_t &clusterVector, std::vector< IdVec_t > &idGroups, const SCT_ID &idHelper, const InDet::SiDetectorElementStatus *det_el_status, const EventContext &ctx) const
Add strips to a cluster vector checking for bad strips.
bool isBad(const InDet::SiDetectorElementStatus *sctDetElStatus, const SCT_ID &sctID, const IdentifierHash &waferHash, const Identifier &stripId, const EventContext &ctx) const
In-class facade on the 'isGood' method for a strip identifier.
StatusCode decodeTimeBins()
Convert time bin string to array of 3 bits.
static DimensionAndPosition clusterDimensionsInclRow(int firstStrip, int lastStrip, int row, const InDetDD::SiDetectorElement *element, const InDetDD::SCT_ModuleSideDesign *design)
Calculate the cluster position and width given the first,last strip, and row numbers for this element...
ToolHandle< ISiLorentzAngleTool > m_lorentzAngleTool
std::vector< Identifier > IdVec_t
void addStripsToClusterInclRows(const Identifier &firstStripId, unsigned int nStrips, IdVec_t &clusterVector, std::vector< IdVec_t > &idGroups, const SCT_ID &idHelper, const InDet::SiDetectorElementStatus *det_el_status, const EventContext &ctx) const
Add strips to a cluster vector including row variable for ITk.
virtual ~SCT_ClusteringTool()=default
Defaul destructor.
bool testTimeBinsN(const std::bitset< 3 > &timePattern) const
IdVec_t recluster(IdVec_t &clusterVector, std::vector< IdVec_t > &idGroups) const
Recluster the current vector, splitting on bad strips, and insert those new groups to the idGroups ve...
StatusCode decodeTimeBin(char timeBin, int &bit) const
Convert a single time bin char to an int, bit is modified.
static void addStripsToCluster(const Identifier &firstStripId, unsigned int nStrips, IdVec_t &clusterVector, const SCT_ID &idHelper)
Add strips to a cluster vector without checking for bad strips.
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection > m_SCTDetEleCollKey
static DimensionAndPosition clusterDimensions(int firstStrip, int lastStrip, const InDetDD::SiDetectorElement *element, const SCT_ID &idHelper)
Calculate the cluster position and width given the first and last strip numbers for this element.
SCT_ClusteringTool(const std::string &type, const std::string &name, const IInterface *parent)
Normal constructor for an AlgTool; 'properties' are also declared here.
ToolHandle< IInDetConditionsTool > m_conditionsTool
bool isCellGood(IdentifierHash hash, unsigned short cell_i) const
This is an Identifier helper class for the SCT subdetector.
Definition SCT_ID.h:68
int strip(const Identifier &id) const
Definition SCT_ID.h:717
Property holding a SG store/key/clid from which a ReadHandle is made.
Message Stream Member.
Primary Vertex Finder.
DimensionAndPosition(const InDetDD::SiLocalPosition &c, double w)