13#include "GeoModelKernel/throwExcept.h"
23 const float time = cluster.
time();
26 Eigen::Matrix<float,3,1> localPosition = Eigen::Matrix<float,3,1>::Zero();
27 localPosition(0, 0) = localPos.x();
28 localPosition(1, 0) = localPos.y();
29 localPosition(2, 0) = time;
31 Eigen::Matrix<float,3,3> localCovariance = Eigen::Matrix<float,3,3>::Zero();
32 localCovariance(0, 0) = localCov(0, 0);
33 localCovariance(1, 1) = localCov(1, 1);
34 localCovariance(2, 2) = timeResolution * timeResolution;
36 return {localPosition, localCovariance};
47 const auto& RDOs = indetCluster.
rdoList();
48 const auto& ToTs = indetCluster.
totList();
50 xaodCluster.
setMeasurement<3>(idHash, localPosition, localCovariance);
55 return StatusCode::SUCCESS;
62 Eigen::Matrix<float,2,1> localPosition(localPos.x(), localPos.y());
64 Eigen::Matrix<float,2,2> localCovariance;
65 localCovariance.setZero();
66 localCovariance(0, 0) = localCov(0, 0);
67 localCovariance(1, 1) = localCov(1, 1);
69 return {localPosition, localCovariance};
81 Eigen::Matrix<float, 3, 1> globalPosition(globalPos.x(), globalPos.y(), globalPos.z());
83 const auto& RDOs = indetCluster.
rdoList();
84 const auto& ToTs = indetCluster.
totList();
85 const auto& charges = indetCluster.
chargeList();
87 auto isSplit = indetCluster.
isSplit();
91 xaodCluster.
setMeasurement<2>(idHash, localPosition, localCovariance);
103 return StatusCode::SUCCESS;
110 float localPosition = 0.f, localCovariance = 0.f;
111 if (element.
isBarrel() or (not isITk)) {
112 localPosition = localPos.x();
117 if ( design ==
nullptr ) {
121 localPosition = localInPolar.
xPhi();
122 localCovariance = design->phiPitchPhi() * design->phiPitchPhi() *
one_over_twelve;
139 Eigen::Matrix<float, 3, 1> globalPosition(globalPos.x(), globalPos.y(), globalPos.z());
141 const auto& RDOs = indetCluster.
rdoList();
144 xaodCluster.
setMeasurement<1>(idHash, localPosition, localCovariance);
150 return StatusCode::SUCCESS;
159 if (design ==
nullptr) {
160 return StatusCode::FAILURE;
170 Amg::Vector3D globalPosition(globalPos(0, 0), globalPos(1, 0), globalPos(2, 0));
173 errorMatrix.setIdentity();
174 errorMatrix.fillSymmetric(0, 0, xaodCluster.
localCovariance<2>()(0, 0));
175 errorMatrix.fillSymmetric(1, 1, xaodCluster.
localCovariance<2>()(1, 1));
177 int colmax = std::numeric_limits<int>::min();
178 int rowmax = std::numeric_limits<int>::min();
179 int colmin = std::numeric_limits<int>::max();
180 int rowmin = std::numeric_limits<int>::max();
187 const std::vector<Identifier>& rod_list_cluster = xaodCluster.
rdoList();
188 const std::vector<float>& charge_list_cluster = xaodCluster.
chargeList();
190 if (rod_list_cluster.size() == charge_list_cluster.size()) {
192 for (std::size_t i(0); i<rod_list_cluster.size(); ++i) {
193 const Identifier& this_rdo = rod_list_cluster[i];
194 const float this_charge = charge_list_cluster[i];
196 const int row = pixelID.
phi_index(this_rdo);
199 qRowMax = this_charge;
200 }
else if (row == rowmax) {
201 qRowMax += this_charge;
206 qRowMin = this_charge;
207 }
else if (row == rowmin) {
208 qRowMin += this_charge;
211 const int col = pixelID.
eta_index(this_rdo);
214 qColMax = this_charge;
215 }
else if (col == colmax) {
216 qColMax += this_charge;
221 qColMin = this_charge;
222 }
else if (col == colmin) {
223 qColMin += this_charge;
233 if(qRowMin + qRowMax > 0) omegax = qRowMax/(qRowMin + qRowMax);
234 if(qColMin + qColMax > 0) omegay = qColMax/(qColMin + qColMax);
244 std::vector<Identifier>(xaodCluster.
rdoList()),
246 std::vector<int>(xaodCluster.
totList()),
250 std::move(errorMatrix),
257 return StatusCode::SUCCESS;
274 if (design ==
nullptr) {
275 return StatusCode::FAILURE;
278 const auto designShape = design->
shape();
281 const auto& rdoList = xaodCluster.
rdoList();
286 double pos_x = localPos(0, 0);
289 const Identifier firstStripId = rdoList.front();
290 int firstStrip = stripID.
strip(firstStripId);
291 int stripRow = stripID.
row(firstStripId);
294 pos_x = clusterPosition.
xPhi() + shift;
295 pos_y = clusterPosition.xEta();
303 const auto& firstStrip = stripID.
strip(rdoList.front());
304 const auto& lastStrip = stripID.
strip(rdoList.back());
305 const auto& row = stripID.
row(rdoList.front());
306 const int firstStrip1D = design->
strip1Dim (firstStrip, row );
307 const int lastStrip1D = design->
strip1Dim( lastStrip, row );
313 const double clusterWidth = design->
stripPitch() * ( lastStrip - firstStrip + 1 );
315 const std::pair<InDetDD::SiLocalPosition, InDetDD::SiLocalPosition> ends( design->
endsOfStrip(centre) );
316 const double stripLength( std::abs(ends.first.xEta() - ends.second.xEta()) );
321 const double col_x =
width.colRow().x();
322 const double col_y =
width.colRow().y();
324 double scale_factor = 1.;
327 else if ( col_x == 2 )
331 errorMatrix.setIdentity();
344 double sn2 = sn * sn;
345 double cs2 = 1. - sn2;
347 double v0 = errorMatrix(0,0) * w * w;
348 double v1 = errorMatrix(1,1);
349 errorMatrix.fillSymmetric( 0, 0, cs2 * v0 + sn2 * v1 );
350 errorMatrix.fillSymmetric( 0, 1, sn * std::sqrt(cs2) * (v0 - v1) );
351 errorMatrix.fillSymmetric( 1, 1, sn2 * v0 + cs2 * v1 );
356 std::vector<Identifier>(rdoList),
359 std::move(errorMatrix));
361 return StatusCode::SUCCESS;
370 float time = locPos(2,0);
376 errorMatrix.setIdentity();
377 errorMatrix.fillSymmetric(0, 0, xaodCluster.
localCovariance<3>()(0, 0));
378 errorMatrix.fillSymmetric(1, 1, xaodCluster.
localCovariance<3>()(1, 1));
379 float time_resolution = std::sqrt(xaodCluster.
localCovariance<3>()(2, 2));
381 double etaWidth = 1.3;
382 double phiWidth = 1.3;
387 indetCluster = new ::HGTD_Cluster(
id,
389 std::vector<Identifier>(xaodCluster.
rdoList()),
392 std::move(errorMatrix),
395 std::vector<int>(xaodCluster.
totList()));
397 return StatusCode::SUCCESS;
static constexpr double one_over_twelve
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration.
virtual float time() const
virtual const std::vector< int > & totList() const
virtual float timeResolution() const
This is a "hash" representation of an Identifier.
value_type get_compact() const
Get the compact id.
virtual DetectorShape shape() const
Shape of element.
Class to hold geometrical description of an HGTD detector element.
Class used to describe the design of a module (diode segmentation and readout scheme)
double widthFromRowRange(const int rowMin, const int rowMax) const
Method to calculate phi width from a row range.
double widthFromColumnRange(const int colMin, const int colMax) const
Method to calculate eta width from a column range.
Base class for the SCT module side design, extended by the Forward and Barrel module design.
virtual double stripPitch(const SiLocalPosition &chargePos) const =0
give the strip pitch (dependence on position needed for forward)
virtual int strip1Dim(int strip, int row) const override
only relevant for SCT.
virtual SiLocalPosition localPositionOfCluster(const SiCellId &cellId, int cluserSize) const =0
virtual std::pair< SiLocalPosition, SiLocalPosition > endsOfStrip(const SiLocalPosition &position) const override=0
give the ends of strips
Identifier for the strip or pixel cell.
Class to hold geometrical description of a silicon detector element.
virtual const SiDetectorDesign & design() const override final
access to the local description (inline):
double phiPitch() const
Pitch (inline methods)
double sinStereoLocal(const Amg::Vector2D &localPos) const
Angle of strip in local frame with respect to the etaAxis.
Class to represent a position in the natural frame of a silicon sensor, for Pixel and SCT For Pixel: ...
double xPhi() const
position along phi direction:
SiCellId cellIdOfPosition(const Amg::Vector2D &localPos) const
As in previous method but returns SiCellId.
virtual IdentifierHash identifyHash() const override final
identifier hash (inline)
Identifier identifierOfPosition(const Amg::Vector2D &localPos) const
Full identifier of the cell for a given position: assumes a raw local position (no Lorentz shift)
Amg::Vector2D rawLocalPositionOfCell(const SiCellId &cellId) const
Returns position (center) of cell.
double splitProbability1() const
double splitProbability2() const
const std::vector< int > & totList() const
const std::vector< float > & chargeList() const
bool isSplit() const
access mehtods for splitting
const Amg::Vector3D & globalPosition() const
return global position reference
const InDet::SiWidth & width() const
return width class reference
virtual const InDetDD::SiDetectorElement * detectorElement() const override final
return the detector element corresponding to this PRD The pointer will be zero if the det el is not d...
This is an Identifier helper class for the Pixel subdetector.
int eta_index(const Identifier &id) const
int phi_index(const Identifier &id) const
This is an Identifier helper class for the SCT subdetector.
int row(const Identifier &id) const
int strip(const Identifier &id) const
const Amg::Vector2D & localPosition() const
return the local position reference
Identifier identify() const
return the identifier
const Amg::MatrixX & localCovariance() const
return const ref to the error matrix
const std::vector< Identifier > & rdoList() const
return the List of rdo identifiers (pointers)
const std::vector< int > & totList() const
Returns the list of Time Over Threshold of the channels building the cluster.
void setToTlist(const std::vector< int > &tots)
Sets the list of ToT of the channels building the cluster.
const std::vector< Identifier > rdoList() const
Returns the list of identifiers of the channels building the cluster.
void setRDOlist(const std::vector< Identifier > &rdolist)
Sets the list of identifiers of the channels building the cluster.
const std::vector< float > & chargeList() const
Returns the list of charges of the channels building the cluster.
const std::vector< int > & totList() const
Returns the list of ToT of the channels building the cluster.
void setChannelsInPhiEta(int channelsInPhi, int channelsInEta)
Sets the dimensions of the cluster in numbers of channels in phi (x) and eta (y) directions.
int channelsInPhi() const
Returns the dimensions of the cluster in numbers of channels in phi (x) and eta (y) directions,...
void setSplitProbabilities(float prob1, float prob2)
Sets the splitting probabilities for the cluster.
const std::vector< Identifier > rdoList() const
Returns the list of identifiers of the channels building the cluster.
ConstVectorMap< 3 > globalPosition() const
Returns the global position of the pixel cluster.
int lvl1a() const
Return the LVL1 accept.
void setChargelist(const std::vector< float > &charges)
Sets the list of charges of the channels building the cluster.
int channelsInEta() const
void setToTlist(const std::vector< int > &tots)
Sets the list of ToT of the channels building the cluster.
void setLVL1A(int lvl1a)
Sets the LVL1 accept.
float splitProbability1() const
Returns the splitting probabilities for the cluster.
bool isSplit() const
Returns if the cluster is split or not.
void setRDOlist(const std::vector< Identifier > &rdolist)
Sets the list of identifiers of the channels building the cluster.
float splitProbability2() const
void setIsSplit(bool isSplit)
Sets if the cluster is split or not.
void setWidthInEta(float widthInEta)
Sets the width of the cluster in eta (y) direction.
ConstVectorMap< 3 > globalPosition() const
Returns the global position of the strip cluster.
void setRDOlist(const std::vector< Identifier > &rdolist)
Sets the list of identifiers of the channels building the cluster.
int channelsInPhi() const
Returns the dimensions of the cluster in numbers of channels in phi (x), respectively.
const std::vector< Identifier > rdoList() const
Returns the list of identifiers of the channels building the cluster.
void setChannelsInPhi(int channelsInPhi)
Sets the dimensions of the cluster in numbers of channels in phi (x)
void setMeasurement(const DetectorIDHashType idHash, MeasVector< N > locPos, MeasMatrix< N > locCov)
Sets IdentifierHash, local position and local covariance of the measurement.
ConstMatrixMap< N > localCovariance() const
Returns the local covariance of the measurement.
ConstVectorMap< N > localPosition() const
Returns the local position of the measurement.
void setIdentifier(const DetectorIdentType measId)
Sets the full Identifier of the measurement.
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Eigen::Matrix< double, 2, 1 > Vector2D
Eigen::Matrix< double, 3, 1 > Vector3D
std::pair< xAOD::MeasVector< 1 >, xAOD::MeasMatrix< 1 > > convertSCT_LocalPosCov(const InDet::SCT_Cluster &cluster, bool isITk=true)
std::pair< xAOD::MeasVector< 2 >, xAOD::MeasMatrix< 2 > > convertPix_LocalPosCov(const InDet::PixelCluster &cluster)
StatusCode convertXaodToInDetCluster(const xAOD::PixelCluster &xaodCluster, const InDetDD::SiDetectorElement &element, const PixelID &pixelID, InDet::PixelCluster *&indetCluster)
StatusCode convertInDetToXaodCluster(const InDet::PixelCluster &indetCluster, const InDetDD::SiDetectorElement &element, xAOD::PixelCluster &xaodCluster)
std::pair< xAOD::MeasVector< 3 >, xAOD::MeasMatrix< 3 > > convertHGTD_LocalPosCov(const HGTD_Cluster &cluster)
StripCluster_v1 StripCluster
Define the version of the strip cluster class.
Eigen::Matrix< float, N, N > MeasMatrix
Eigen::Matrix< float, N, 1 > MeasVector
Abrivation of the Matrix & Covariance definitions.
PixelCluster_v1 PixelCluster
Define the version of the pixel cluster class.
HGTDCluster_v1 HGTDCluster
Define the version of the pixel cluster class.
#define THROW_EXCEPTION(MESSAGE)