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};
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"};
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 
164  double width;
166  : centre(c), width(w) {}
167  };
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 
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
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:220
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:125
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:116
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:130
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 >
InDet::SCT_ClusteringTool::DimensionAndPosition::centre
InDetDD::SiLocalPosition centre
Definition: SCT_ClusteringTool.h:163
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
SCT_CalibAlgs::firstStrip
@ firstStrip
Definition: SCT_CalibNumbers.h:10
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
InDet::SCT_ClusteringTool::m_doSimplePosWidth
BooleanProperty m_doSimplePosWidth
Definition: SCT_ClusteringTool.h:108
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:204
InDet::SCT_ClusteringTool::DimensionAndPosition::DimensionAndPosition
DimensionAndPosition(const InDetDD::SiLocalPosition &c, double w)
Definition: SCT_ClusteringTool.h:165
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:228
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:162
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:164
InDet::SCT_ClusteringTool::m_lorentzAngleTool
ToolHandle< ISiLorentzAngleTool > m_lorentzAngleTool
Definition: SCT_ClusteringTool.h:91
SCT_CalibAlgs::lastStrip
@ lastStrip
Definition: SCT_CalibNumbers.h:10
DataPool
a typed memory pool that saves time spent allocation small object. This is typically used by containe...
Definition: DataPool.h:63
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