ATLAS Offline Software
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"
17 #include "InDetIdentifier/SCT_ID.h"
24 
26 #include "GaudiKernel/ToolHandle.h"
27 
29 #include <bitset>
30 #include <string>
31 #include <vector>
32 
33 class SCT_ChannelStatusAlg;
34 class StatusCode;
35 
36 namespace InDetDD {
37 class SCT_ModuleSideDesign;
38 }
39 
40 namespace InDet {
47 class SCT_ClusteringTool final
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 
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 
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"};
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};
109 
115  m_SCTDetEleCollKey{this, "SCTDetEleCollKey",
116  "SCT_DetectorElementCollection",
117  "Key of SiDetectorElementCollection for SCT. "
118  "Necessary for alignment"};
120 
125  this, "SCTDetElStatus", "", "Key of SiDetectorElementStatus for SCT"};
126 
129  int m_timeBinBits[3]{-1, -1, -1};
130 
132  static void addStripsToCluster(const Identifier& firstStripId,
133  unsigned int nStrips, IdVec_t& clusterVector,
134  const SCT_ID& idHelper);
135 
138  const Identifier& firstStripId, unsigned int nStrips,
139  IdVec_t& clusterVector, std::vector<IdVec_t>& idGroups,
140  const SCT_ID& idHelper,
141  const InDet::SiDetectorElementStatus* det_el_status,
142  const EventContext& ctx) const;
143 
146  const Identifier& firstStripId, unsigned int nStrips,
147  IdVec_t& clusterVector, std::vector<IdVec_t>& idGroups,
148  const SCT_ID& idHelper,
149  const InDet::SiDetectorElementStatus* det_el_status,
150  const EventContext& ctx) const;
151 
157  IdVec_t recluster(IdVec_t& clusterVector,
158  std::vector<IdVec_t>& idGroups) const;
159 
163  double width;
165  : centre(c), width(w) {}
166  };
167 
170  static DimensionAndPosition clusterDimensions(
171  int firstStrip, int lastStrip, const InDetDD::SiDetectorElement* element,
172  const SCT_ID& idHelper);
173 
176  static DimensionAndPosition clusterDimensionsInclRow(
177  int firstStrip, int lastStrip, int row,
178  const InDetDD::SiDetectorElement* element,
179  const InDetDD::SCT_ModuleSideDesign* design);
180 
182  bool isBad(const InDet::SiDetectorElementStatus* sctDetElStatus,
183  const SCT_ID& sctID, const IdentifierHash& waferHash,
184  const Identifier& stripId, const EventContext& ctx) const;
185 
189  StatusCode decodeTimeBin(char timeBin, int& bit) const;
191 
192  bool testTimeBins(int timeBin) const;
193  static bool testTimeBins01X(int timeBin);
194  static bool testTimeBinsX1X(int timeBin);
195  bool testTimeBinsN(const std::bitset<3>& timePattern) const;
197 }; // end of class
198 
200 // Inline methods
202 
204  const InDet::SiDetectorElementStatus* sctDetElStatus, const SCT_ID& sctID,
205  const IdentifierHash& waferHash, const Identifier& stripId,
206  const EventContext& ctx) const {
207  if (sctDetElStatus) {
208  const int strip_i{sctID.strip(stripId)};
210  sctDetElStatus, sctDetElStatus->isCellGood(waferHash.value(), strip_i),
211  m_conditionsTool->isGood(stripId, InDetConditions::SCT_STRIP, ctx));
212  return !sctDetElStatus->isCellGood(waferHash.value(), strip_i);
213  } else {
214  return (
215  not m_conditionsTool->isGood(stripId, InDetConditions::SCT_STRIP, ctx));
216  }
217 }
218 
220  const std::bitset<3>& timePattern) const {
221  // Convert the given timebin to a bit set and test each bit
222  // if bit is -1 (i.e. X) it always passes, other wise require exact match of
223  // 0/1 N.B bitset has opposite order to the bit pattern we define
224 
225  if (m_timeBinBits[0] != -1 and
226  timePattern.test(2) != static_cast<bool>(m_timeBinBits[0]))
227  return false;
228  if (m_timeBinBits[1] != -1 and
229  timePattern.test(1) != static_cast<bool>(m_timeBinBits[1]))
230  return false;
231  if (m_timeBinBits[2] != -1 and
232  timePattern.test(0) != static_cast<bool>(m_timeBinBits[2]))
233  return false;
234  return true;
235 }
236 
237 } // namespace InDet
238 #endif // SiClusterizationTool_SCT_ClusteringTool_H
InDet::SCT_ClusteringTool::clusterDimensions
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.
Definition: SCT_ClusteringTool.cxx:765
InDet::SCT_ClusteringTool::fastClusterize
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.
Definition: SCT_ClusteringTool.cxx:506
InDet::SCT_ClusteringTool::m_doFastClustering
BooleanProperty m_doFastClustering
Definition: SCT_ClusteringTool.h:107
InDet::SCT_ClusteringTool::testTimeBinsN
bool testTimeBinsN(const std::bitset< 3 > &timePattern) const
Definition: SCT_ClusteringTool.h:219
query_example.row
row
Definition: query_example.py:24
InDet::SCT_ClusteringTool::testTimeBins01X
static bool testTimeBins01X(int timeBin)
Definition: SCT_ClusteringTool.cxx:101
SCT_ID.h
This is an Identifier helper class for the SCT subdetector. This class is a factory for creating comp...
InDet::SCT_ClusteringTool
AlgTool for SCT_Clusterization. Input is from RDOs, assumed to be sorted. They are then scanned in or...
Definition: SCT_ClusteringTool.h:48
InDet::SCT_ClusteringTool::m_sctDetElStatus
SG::ReadHandleKey< InDet::SiDetectorElementStatus > m_sctDetElStatus
Optional read handle to get status data to test whether a SCT detector element is good.
Definition: SCT_ClusteringTool.h:124
IInDetConditionsTool.h
InDet::SCT_ClusteringTool::clusterize
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.
Definition: SCT_ClusteringTool.cxx:306
InDet::SCT_ClusteringTool::m_timeBinStr
StringProperty m_timeBinStr
Definition: SCT_ClusteringTool.h:102
IdentifierHash::value
unsigned int value() const
SiDetectorElementStatus.h
InDetDD::SCT_ModuleSideDesign
Definition: SCT_ModuleSideDesign.h:40
InDet::SCT_ClusteringTool::m_SCTDetEleCollKey
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection > m_SCTDetEleCollKey
Definition: SCT_ClusteringTool.h:115
InDet::SCT_ClusteringTool::initialize
virtual StatusCode initialize() override
Retrieve the necessary services in initialize.
Definition: SCT_ClusteringTool.cxx:124
InDet
Primary Vertex Finder.
Definition: VP1ErrorUtils.h:36
InDet::SCT_ClusteringTool::m_clusterMaker
ToolHandle< ClusterMakerTool > m_clusterMaker
Definition: SCT_ClusteringTool.h:89
SCT_ChipUtils.h
InDet::SCT_ClusteringTool::addStripsToCluster
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.
Definition: SCT_ClusteringTool.cxx:174
InDet::SCT_ClusteringTool::~SCT_ClusteringTool
virtual ~SCT_ClusteringTool()=default
Defaul destructor.
InDet::SCT_ClusteringTool::clusterDimensionsInclRow
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...
Definition: SCT_ClusteringTool.cxx:781
InDet::SCT_ClusteringTool::m_timeBinBits
int m_timeBinBits[3]
Time bin bits for timing requirement.
Definition: SCT_ClusteringTool.h:129
ISiLorentzAngleTool.h
InDet::SCT_ClusteringTool::recluster
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...
Definition: SCT_ClusteringTool.cxx:279
InDet::SiDetectorElementStatus::isCellGood
bool isCellGood(IdentifierHash hash, unsigned short cell_i) const
Definition: SiDetectorElementStatus.h:107
SG::ReadHandleKey< InDet::SiDetectorElementStatus >
SCT_CalibAlgs::lastStrip
@ lastStrip
Definition: SCT_CalibNumbers.h:10
InDet::SCT_ClusteringTool::DimensionAndPosition::centre
InDetDD::SiLocalPosition centre
Definition: SCT_ClusteringTool.h:162
SCT_CalibAlgs::firstStrip
@ firstStrip
Definition: SCT_CalibNumbers.h:10
InDetDD::SiLocalPosition
Definition: SiLocalPosition.h:31
InDet::SCT_ClusteringTool::m_innertwoBarrelX1X
BooleanProperty m_innertwoBarrelX1X
Definition: SCT_ClusteringTool.h:104
InDet::SCT_ClusteringTool::m_errorStrategy
IntegerProperty m_errorStrategy
Definition: SCT_ClusteringTool.h:100
InDet::SCT_ClusteringTool::decodeTimeBins
StatusCode decodeTimeBins()
Convert time bin string to array of 3 bits.
Definition: SCT_ClusteringTool.cxx:60
ClusterMakerTool.h
VALIDATE_STATUS_ARRAY
#define VALIDATE_STATUS_ARRAY(use_info, info_val, summary_val)
Definition: SiDetectorElementStatus.h:51
InDet::SiDetectorElementStatus
Definition: SiDetectorElementStatus.h:62
InDet::SCT_ClusteringTool::addStripsToClusterInclRows
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.
Definition: SCT_ClusteringTool.cxx:233
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
InDet::SCT_ClusteringTool::addStripsToClusterWithChecks
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.
Definition: SCT_ClusteringTool.cxx:192
AthAlgTool.h
InDetRawDataCollection
Definition: InDetRawDataCollection.h:31
test_pyathena.parent
parent
Definition: test_pyathena.py:15
InDet::SCT_ClusteringTool::m_innermostBarrelX1X
BooleanProperty m_innermostBarrelX1X
Definition: SCT_ClusteringTool.h:103
InDet::SCT_ClusteringTool::m_majority01X
BooleanProperty m_majority01X
Definition: SCT_ClusteringTool.h:105
ReadCondHandleKey.h
InDet::SCT_ClusteringTool::isBad
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.
Definition: SCT_ClusteringTool.h:203
InDet::SCT_ClusteringTool::DimensionAndPosition::DimensionAndPosition
DimensionAndPosition(const InDetDD::SiLocalPosition &c, double w)
Definition: SCT_ClusteringTool.h:164
MuonGM::nStrips
int nStrips(const MuonGM::TgcReadoutElement &readoutEle, int layer)
Definition: MuonDetDescr/MuonGeoModelTest/src/GeoModelTgcTest.cxx:46
InDet::SCT_ClusteringTool::testTimeBinsX1X
static bool testTimeBinsX1X(int timeBin)
Definition: SCT_ClusteringTool.cxx:113
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
InDet::SCT_ClusteringTool::m_useRowInformation
BooleanProperty m_useRowInformation
Definition: SCT_ClusteringTool.h:106
InDetDD::SiDetectorElement
Definition: SiDetectorElement.h:109
SiDetectorElementCollection.h
ISCT_ClusteringTool.h
InDet::SCT_ClusteringTool::DimensionAndPosition
In-class struct to store the centre and width of a cluster.
Definition: SCT_ClusteringTool.h:161
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection >
InDet::SCT_ClusteringTool::testTimeBins
bool testTimeBins(int timeBin) const
Definition: SCT_ClusteringTool.cxx:92
InDet::SCT_ClusteringTool::m_checkBadChannels
BooleanProperty m_checkBadChannels
Definition: SCT_ClusteringTool.h:101
SCT_ID
Definition: SCT_ID.h:68
SCT_ID::strip
int strip(const Identifier &id) const
Definition: SCT_ID.h:764
InDetDD
Message Stream Member.
Definition: FakeTrackBuilder.h:8
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
InDet::SCT_ClusteringTool::DimensionAndPosition::width
double width
Definition: SCT_ClusteringTool.h:163
InDet::SCT_ClusteringTool::m_lorentzAngleTool
ToolHandle< ISiLorentzAngleTool > m_lorentzAngleTool
Definition: SCT_ClusteringTool.h:91
DataPool
a typed memory pool that saves time spent allocation small object. This is typically used by containe...
Definition: DataPool.h:47
InDet::SCT_ClusteringTool::IdVec_t
std::vector< Identifier > IdVec_t
Definition: SCT_ClusteringTool.h:50
IdentifierHash
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
Definition: IdentifierHash.h:25
python.IoTestsLib.w
def w
Definition: IoTestsLib.py:200
InDet::SCTClusteringCache
Definition: ISCT_ClusteringTool.h:29
InDetConditions::SCT_STRIP
@ SCT_STRIP
Definition: InDetHierarchy.h:14
InDet::SCT_ClusterCollection
Trk::PrepRawDataCollection< SCT_Cluster > SCT_ClusterCollection
Definition: SCT_ClusterCollection.h:26
python.compressB64.c
def c
Definition: compressB64.py:93
InDet::SCT_ClusteringTool::decodeTimeBin
StatusCode decodeTimeBin(char timeBin, int &bit) const
Convert a single time bin char to an int, bit is modified.
Definition: SCT_ClusteringTool.cxx:82
InDet::SCT_ClusteringTool::SCT_ClusteringTool
SCT_ClusteringTool(const std::string &type, const std::string &name, const IInterface *parent)
Normal constructor for an AlgTool; 'properties' are also declared here.
Definition: SCT_ClusteringTool.cxx:55
InDet::SCT_ClusteringTool::m_conditionsTool
ToolHandle< IInDetConditionsTool > m_conditionsTool
Definition: SCT_ClusteringTool.h:85
Identifier
Definition: IdentifierFieldParser.cxx:14