ATLAS Offline Software
Loading...
Searching...
No Matches
TrackingUtilities Namespace Reference

Functions

StatusCode convertInDetToXaodCluster (const InDet::PixelCluster &indetCluster, const InDetDD::SiDetectorElement &element, xAOD::PixelCluster &xaodCluster)
StatusCode convertInDetToXaodCluster (const InDet::SCT_Cluster &indetCluster, const InDetDD::SiDetectorElement &element, xAOD::StripCluster &xaodCluster, bool isITk=true)
StatusCode convertXaodToInDetCluster (const xAOD::PixelCluster &xaodCluster, const InDetDD::SiDetectorElement &element, const PixelID &pixelID, InDet::PixelCluster *&indetCluster)
StatusCode convertXaodToInDetCluster (const xAOD::StripCluster &xaodCluster, const InDetDD::SiDetectorElement &element, const SCT_ID &stripID, InDet::SCT_Cluster *&indetCluster, double shift=0.)
StatusCode convertInDetToXaodCluster (const HGTD_Cluster &indetCluster, const InDetDD::HGTD_DetectorElement &element, xAOD::HGTDCluster &xaodCluster)
StatusCode convertXaodToInDetCluster (const xAOD::HGTDCluster &xaodCluster, const InDetDD::HGTD_DetectorElement &element, ::HGTD_Cluster *&indetCluster)
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)
std::pair< xAOD::MeasVector< 3 >, xAOD::MeasMatrix< 3 > > convertHGTD_LocalPosCov (const HGTD_Cluster &cluster)
std::pair< float, float > computeOmegas (const xAOD::PixelCluster &cluster, const PixelID &pixelID)
StatusCode convertTrkToXaodPixelSpacePoint (const InDet::PixelSpacePoint &trkSpacePoint, xAOD::SpacePoint &xaodSpacePoint)
StatusCode convertTrkToXaodStripSpacePoint (const InDet::SCT_SpacePoint &trkSpacePoint, const Amg::Vector3D &vertex, xAOD::SpacePoint &xaodSpacePoint)

Function Documentation

◆ computeOmegas()

std::pair< float, float > TrackingUtilities::computeOmegas ( const xAOD::PixelCluster & cluster,
const PixelID & pixelID )

Definition at line 9 of file InnerDetector/InDetMeasurementUtilities/src/Helpers.cxx.

11 {
13 rdo_list_cluster = cluster.rdoList();
15 charge_list_cluster = cluster.chargeList();
17 tot_list_cluster = cluster.totList();
18
19 // Prefer the calibrated charge for the omega weights. When charge calibration
20 // is unavailable (e.g. digital clustering) the charge list is left empty, so
21 // fall back to the ToT list, mirroring InDet::ClusterMakerTool. This keeps the
22 // analogue charge-interpolation correction defined instead of silently
23 // disabling it (returning -1) whenever the charge list is missing.
24 const bool useCharge = rdo_list_cluster.size() == charge_list_cluster.size();
25 if (not useCharge and rdo_list_cluster.size() != tot_list_cluster.size()) {
26 return {-1.f, -1.f};
27 }
28
29 int colmax = std::numeric_limits<int>::min();
30 int rowmax = std::numeric_limits<int>::min();
31 int colmin = std::numeric_limits<int>::max();
32 int rowmin = std::numeric_limits<int>::max();
33
34 float qRowMin = 0.f;
35 float qRowMax = 0.f;
36 float qColMin = 0.f;
37 float qColMax = 0.f;
38
39 for (std::size_t i(0); i<rdo_list_cluster.size(); ++i) {
40 Identifier this_rdo(rdo_list_cluster.at(i));
41 const float this_charge = useCharge ? charge_list_cluster.at(i)
42 : static_cast<float>(tot_list_cluster.at(i));
43
44 const int row = pixelID.phi_index(this_rdo);
45 if (row > rowmax) {
46 rowmax = row;
47 qRowMax = this_charge;
48 } else if (row == rowmax) {
49 qRowMax += this_charge;
50 }
51
52 if (row < rowmin) {
53 rowmin = row;
54 qRowMin = this_charge;
55 } else if (row == rowmin) {
56 qRowMin += this_charge;
57 }
58
59 const int col = pixelID.eta_index(this_rdo);
60 if (col > colmax) {
61 colmax = col;
62 qColMax = this_charge;
63 } else if (col == colmax) {
64 qColMax += this_charge;
65 }
66
67 if (col < colmin) {
68 colmin = col;
69 qColMin = this_charge;
70 } else if (col == colmin) {
71 qColMin += this_charge;
72 }
73 } // loop on rdos and charges
74
75 float omegax = -1.f;
76 float omegay = -1.f;
77 if(qRowMin + qRowMax > 0) omegax = qRowMax/(qRowMin + qRowMax);
78 if(qColMin + qColMax > 0) omegay = qColMax/(qColMin + qColMax);
79
80 return std::make_pair(omegax, omegay);
81 }
int eta_index(const Identifier &id) const
Definition PixelID.h:640
int phi_index(const Identifier &id) const
Definition PixelID.h:634
Helper class to provide constant type-safe access to aux data.
SG::ConstAccessor< SG::JaggedVecElt< Identifier::value_type > >::element_type rdoList() const
Returns the list of identifiers of the channels building the cluster.
SG::ConstAccessor< SG::JaggedVecElt< float > >::element_type chargeList() const
Returns the list of charges of the channels building the cluster.
SG::ConstAccessor< SG::JaggedVecElt< int > >::element_type totList() const
Returns the list of ToT of the channels building the cluster.
row
Appending html table to final .html summary file.

◆ convertHGTD_LocalPosCov()

std::pair< xAOD::MeasVector< 3 >, xAOD::MeasMatrix< 3 > > TrackingUtilities::convertHGTD_LocalPosCov ( const HGTD_Cluster & cluster)

Definition at line 19 of file ClusterConversionUtilities.cxx.

19 {
20 auto localPos = cluster.localPosition();
21 auto localCov = cluster.localCovariance();
22
23 const float time = cluster.time();
24 const float timeResolution = cluster.timeResolution();
25
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;
30
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;
35
36 return {localPosition, localCovariance};
37 }
float time() const
float timeResolution() const
const Amg::Vector2D & localPosition() const
return the local position reference
const Amg::MatrixX & localCovariance() const
return const ref to the error matrix

◆ convertInDetToXaodCluster() [1/3]

StatusCode TrackingUtilities::convertInDetToXaodCluster ( const HGTD_Cluster & indetCluster,
const InDetDD::HGTD_DetectorElement & element,
xAOD::HGTDCluster & xaodCluster )

Definition at line 39 of file ClusterConversionUtilities.cxx.

42 {
43 IdentifierHash idHash = element.identifyHash();
44
45 const auto [localPosition, localCovariance] = convertHGTD_LocalPosCov(indetCluster);
46
47 const auto& RDOs = indetCluster.rdoList();
48 const auto& ToTs = indetCluster.totList();
49
50 xaodCluster.setMeasurement<3>(idHash, localPosition, localCovariance);
51 xaodCluster.setIdentifier( indetCluster.identify().get_compact() );
52 xaodCluster.setRDOlist(RDOs);
53 xaodCluster.setToTlist(ToTs);
54
55 return StatusCode::SUCCESS;
56 }
const std::vector< int > & totList() const
This is a "hash" representation of an Identifier.
value_type get_compact() const
Get the compact id.
virtual IdentifierHash identifyHash() const override final
identifier hash (inline)
Identifier identify() const
return the identifier
const std::vector< Identifier > & rdoList() const
return the List of rdo identifiers (pointers)
void setRDOlist(std::vector< Identifier::value_type > &&rdoList)
Sets the list of identifiers of the channels building the cluster.
void setToTlist(const std::vector< int > &tots)
Sets the list of ToT of the channels building the cluster.
void setMeasurement(const DetectorIDHashType idHash, MeasVector< N > locPos, MeasMatrix< N > locCov)
Sets IdentifierHash, local position and local covariance of the measurement.
void setIdentifier(const DetectorIdentType measId)
Sets the full Identifier of the measurement.
std::pair< xAOD::MeasVector< 3 >, xAOD::MeasMatrix< 3 > > convertHGTD_LocalPosCov(const HGTD_Cluster &cluster)

◆ convertInDetToXaodCluster() [2/3]

StatusCode TrackingUtilities::convertInDetToXaodCluster ( const InDet::PixelCluster & indetCluster,
const InDetDD::SiDetectorElement & element,
xAOD::PixelCluster & xaodCluster )

Definition at line 72 of file ClusterConversionUtilities.cxx.

75 {
76 IdentifierHash idHash = element.identifyHash();
77
78 const auto [localPosition, localCovariance] = convertPix_LocalPosCov(indetCluster);
79
80 xAOD::MeasVector<3> globalPosition = xAOD::toStorage(indetCluster.globalPosition());
81
82 const auto& RDOs = indetCluster.rdoList();
83 const auto& ToTs = indetCluster.totList();
84 const auto& charges = indetCluster.chargeList();
85 const auto& width = indetCluster.width();
86
87 xaodCluster.setMeasurement<2>(idHash, localPosition, localCovariance);
88 xaodCluster.setIdentifier( indetCluster.identify().get_compact() );
89 xaodCluster.setRDOlist(RDOs);
90 xaodCluster.globalPosition() = globalPosition;
91 xaodCluster.setToTlist(ToTs);
92 xaodCluster.setChargelist(charges);
93 xaodCluster.setLVL1A(indetCluster.LVL1A());
94 xaodCluster.setChannelsInPhiEta(width.colRow()[0], width.colRow()[1]);
95 xaodCluster.setWidthInEta(static_cast<float>(width.widthPhiRZ()[1]));
96
97 return StatusCode::SUCCESS;
98 }
const double width
const Amg::Vector3D & globalPosition() const
return global position reference
const InDet::SiWidth & width() const
return width class reference
void setChannelsInPhiEta(int channelsInPhi, int channelsInEta)
Sets the dimensions of the cluster in numbers of channels in phi (x) and eta (y) directions.
ConstVectorMap< 3 > globalPosition() const
Returns the global position of the pixel cluster.
void setChargelist(const std::vector< float > &charges)
Sets the list of charges of the channels building the cluster.
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.
void setRDOlist(const std::vector< Identifier > &rdolist)
Sets the list of identifiers of the channels building the cluster.
void setWidthInEta(float widthInEta)
Sets the width of the cluster in eta (y) direction.
std::pair< xAOD::MeasVector< 2 >, xAOD::MeasMatrix< 2 > > convertPix_LocalPosCov(const InDet::PixelCluster &cluster)
Eigen::Matrix< float, N, 1 > MeasVector
Abrivation of the Matrix & Covariance definitions.
MeasVector< N > toStorage(const AmgVector(N)&amgVec)
Converts the double precision of the AmgVector into the floating point storage precision of the MeasV...

◆ convertInDetToXaodCluster() [3/3]

StatusCode TrackingUtilities::convertInDetToXaodCluster ( const InDet::SCT_Cluster & indetCluster,
const InDetDD::SiDetectorElement & element,
xAOD::StripCluster & xaodCluster,
bool isITk = true )

Definition at line 123 of file ClusterConversionUtilities.cxx.

127 {
128 IdentifierHash idHash = element.identifyHash();
129
130 const auto [localPosition, localCovariance] = convertSCT_LocalPosCov(indetCluster, isITk);
131
132 auto globalPos = indetCluster.globalPosition();
133 Eigen::Matrix<float, 3, 1> globalPosition(globalPos.x(), globalPos.y(), globalPos.z());
134
135 const auto& RDOs = indetCluster.rdoList();
136 const auto& width = indetCluster.width();
137
138 xaodCluster.setMeasurement<1>(idHash, localPosition, localCovariance);
139 xaodCluster.setIdentifier( indetCluster.identify().get_compact() );
140 xaodCluster.setRDOlist(RDOs);
141 xaodCluster.globalPosition() = globalPosition;
142 xaodCluster.setChannelsInPhi(width.colRow()[0]);
143
144 return StatusCode::SUCCESS;
145 }
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.
void setChannelsInPhi(int channelsInPhi)
Sets the dimensions of the cluster in numbers of channels in phi (x).
std::pair< xAOD::MeasVector< 1 >, xAOD::MeasMatrix< 1 > > convertSCT_LocalPosCov(const InDet::SCT_Cluster &cluster, bool isITk=true)

◆ convertPix_LocalPosCov()

std::pair< xAOD::MeasVector< 2 >, xAOD::MeasMatrix< 2 > > TrackingUtilities::convertPix_LocalPosCov ( const InDet::PixelCluster & cluster)

Definition at line 58 of file ClusterConversionUtilities.cxx.

58 {
59 auto localCov = cluster.localCovariance();
60
61 xAOD::MeasVector<2> localPosition = xAOD::toStorage(cluster.localPosition());
62
63 Eigen::Matrix<float,2,2> localCovariance;
64 localCovariance.setZero();
65 localCovariance(0, 0) = localCov(0, 0);
66 localCovariance(1, 1) = localCov(1, 1);
67 //cid 23274
68 //coverity[UNINIT:FALSE]
69 return {localPosition, localCovariance};
70 }

◆ convertSCT_LocalPosCov()

std::pair< xAOD::MeasVector< 1 >, xAOD::MeasMatrix< 1 > > TrackingUtilities::convertSCT_LocalPosCov ( const InDet::SCT_Cluster & cluster,
bool isITk = true )

Definition at line 100 of file ClusterConversionUtilities.cxx.

100 {
101 const InDetDD::SiDetectorElement& element{*cluster.detectorElement()};
102 auto localPos = cluster.localPosition();
103
104 float localPosition = 0.f, localCovariance = 0.f;
105 if (element.isBarrel() or (not isITk)) {
106 localPosition = localPos.x();
107 localCovariance = element.phiPitch() * element.phiPitch() * one_over_twelve;
108 } else {
109 InDetDD::SiCellId cellId = element.cellIdOfPosition(localPos);
110 const auto* design = dynamic_cast<const InDetDD::StripStereoAnnulusDesign *>(&element.design());
111 if ( design == nullptr ) {
112 THROW_EXCEPTION("Invalid bounds from "<<cluster);
113 }
114 InDetDD::SiLocalPosition localInPolar = design->localPositionOfCellPC(cellId);
115 localPosition = localInPolar.xPhi();
116 localCovariance = design->phiPitchPhi() * design->phiPitchPhi() * one_over_twelve;
117 }
118
119 return std::make_pair(xAOD::MeasVector<1>{localPosition},
120 xAOD::MeasMatrix<1>{localCovariance});
121 }
static constexpr double one_over_twelve
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 xPhi() const
position along phi direction:
SiCellId cellIdOfPosition(const Amg::Vector2D &localPos) const
As in previous method but returns SiCellId.
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...
Eigen::Matrix< float, N, N > MeasMatrix
#define THROW_EXCEPTION(MESSAGE)
Definition throwExcept.h:10

◆ convertTrkToXaodPixelSpacePoint()

StatusCode TrackingUtilities::convertTrkToXaodPixelSpacePoint ( const InDet::PixelSpacePoint & trkSpacePoint,
xAOD::SpacePoint & xaodSpacePoint )

Definition at line 12 of file SpacePointConversionUtilities.cxx.

14 {
15 unsigned int idHash = trkSpacePoint.elementIdList().first;
16 const auto& globPos = trkSpacePoint.globalPosition();
17
18 const InDet::SiCluster* c = static_cast<const InDet::SiCluster*>(trkSpacePoint.clusterList().first);
19 const InDetDD::SiDetectorElement *de = c->detectorElement();
20 const Amg::Transform3D &Tp = de->surface().transform();
21
22 float r_3 = static_cast<float>( Tp(0,2) );
23 float r_4 = static_cast<float>( Tp(1,2) );
24 float r_5 = static_cast<float>( Tp(2,2) );
25
26 const Amg::MatrixX& v = c->localCovariance();
27 float f22 = static_cast<float>( v(1,1) );
28 float wid = static_cast<float>( c->width().z() );
29 float cov = wid*wid*.08333;
30 if(cov < f22) cov = f22;
31 float covr = 6 * cov * (r_5*r_5);
32 float covz = 6 * cov * (r_3*r_3 + r_4*r_4);
33
34 xaodSpacePoint.setSpacePoint(idHash,
35 globPos.cast<float>(),
36 covr,
37 covz,
38 {});
39
40 return StatusCode::SUCCESS;
41 }
static Double_t Tp(Double_t *t, Double_t *par)
#define z
Trk::Surface & surface()
Element Surface.
const std::pair< const PrepRawData *, const PrepRawData * > & clusterList() const
return the pair of cluster pointers by reference
virtual const Amg::Vector3D & globalPosition() const override final
Interface method to get the global Position.
const std::pair< IdentifierHash, IdentifierHash > & elementIdList() const
return the pair of Ids of the element by reference
const Amg::Transform3D & transform() const
Returns HepGeom::Transform3D by reference.
void setSpacePoint(DetectorIDHashType idHash, const Eigen::Matrix< float, 3, 1 > &globPos, float cov_r, float cov_z, std::vector< const xAOD::UncalibratedMeasurement * > &&measurementIndexes)
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Eigen::Affine3d Transform3D

◆ convertTrkToXaodStripSpacePoint()

StatusCode TrackingUtilities::convertTrkToXaodStripSpacePoint ( const InDet::SCT_SpacePoint & trkSpacePoint,
const Amg::Vector3D & vertex,
xAOD::SpacePoint & xaodSpacePoint )

Definition at line 43 of file SpacePointConversionUtilities.cxx.

46 {
47 std::pair<unsigned int, unsigned int> idHashes = trkSpacePoint.elementIdList();
48 const auto& globPos = trkSpacePoint.globalPosition();
49
50 const InDet::SiCluster *c0 = static_cast<const InDet::SiCluster *>(trkSpacePoint.clusterList().first);
51 const InDet::SiCluster *c1 = static_cast<const InDet::SiCluster *>(trkSpacePoint.clusterList().second);
52 const InDetDD::SiDetectorElement *d0 = c0->detectorElement();
53 const InDetDD::SiDetectorElement *d1 = c1->detectorElement();
54
55 Amg::Vector2D lc0 = c0->localPosition();
56 Amg::Vector2D lc1 = c1->localPosition();
57
58 std::pair<Amg::Vector3D, Amg::Vector3D> e0 =
59 (d0->endsOfStrip(InDetDD::SiLocalPosition(lc0.y(), lc0.x(), 0.)));
60 std::pair<Amg::Vector3D, Amg::Vector3D> e1 =
61 (d1->endsOfStrip(InDetDD::SiLocalPosition(lc1.y(), lc1.x(), 0.)));
62
63 auto stripCenter_1 = 0.5 * (e0.first + e0.second);
64 auto stripDir_1 = e0.first - e0.second;
65 auto trajDir_1 = 2. * ( stripCenter_1 - vertex);
66
67 auto stripCenter_2 = 0.5 * (e1.first + e1.second);
68 auto stripDir_2 = e1.first - e1.second;
69
70 float topHalfStripLength = 0.5 * stripDir_1.norm();
71 Eigen::Matrix<double, 3, 1> topStripDirection = - stripDir_1 / (2. * topHalfStripLength);
72 Eigen::Matrix<double, 3, 1> topStripCenter = 0.5 * trajDir_1;
73 float bottomHalfStripLength = 0.5 * stripDir_2.norm();
74 Eigen::Matrix<double, 3, 1> bottomStripDirection = - stripDir_2 / (2. * bottomHalfStripLength);
75 Eigen::Matrix<double, 3, 1> stripCenterDistance = stripCenter_1 - stripCenter_2;
76
77 const Amg::MatrixX& v = trkSpacePoint.localCovariance();
78 float f22 = static_cast<float>( v(1,1) );
79
80 float covr = d0->isBarrel() ? .1 : 8.*f22;
81 float covz = d0->isBarrel() ? 8.*f22 : .1;
82
83 xaodSpacePoint.setSpacePoint({idHashes.first, idHashes.second},
84 globPos.cast<float>(),
85 covr,
86 covz,
87 {},
88 topHalfStripLength,
89 bottomHalfStripLength,
90 topStripDirection.cast<float>(),
91 bottomStripDirection.cast<float>(),
92 stripCenterDistance.cast<float>(),
93 topStripCenter.cast<float>());
94
95 return StatusCode::SUCCESS;
96 }
Class to represent a position in the natural frame of a silicon sensor, for Pixel and SCT For Pixel: ...
const Amg::MatrixX & localCovariance() const
Interface method to get the localError.
Eigen::Matrix< double, 2, 1 > Vector2D

◆ convertXaodToInDetCluster() [1/3]

StatusCode TrackingUtilities::convertXaodToInDetCluster ( const xAOD::HGTDCluster & xaodCluster,
const InDetDD::HGTD_DetectorElement & element,
::HGTD_Cluster *& indetCluster )

Definition at line 363 of file ClusterConversionUtilities.cxx.

365 {
366
367 const auto& locPos = xaodCluster.localPosition<3>();
368 Amg::Vector2D localPosition(locPos(0,0), locPos(1,0));
369 float time = xAOD::HGTDCluster::time(locPos);
370
371 InDetDD::SiLocalPosition centroid(localPosition);
372 const Identifier id = element.identifierOfPosition(centroid);
373
374 xAOD::ConstMatrixMap<3> local_covariance(xaodCluster.localCovariance<3>());
375 auto errorMatrix = Amg::MatrixX(2,2);
376 errorMatrix.setIdentity();
377 errorMatrix.fillSymmetric(0, 0, local_covariance(0, 0));
378 errorMatrix.fillSymmetric(1, 1, local_covariance(1, 1));
379 float time_resolution = std::sqrt(xAOD::HGTDCluster::timeCovariance(local_covariance));
380
381 double etaWidth = 1.3;
382 double phiWidth = 1.3;
383 int channelsPhi = 1;
384 int channelsEta = 1;
385 InDet::SiWidth width( Amg::Vector2D(channelsPhi, channelsEta), Amg::Vector2D(phiWidth, etaWidth) );
386 std::vector<Identifier> rdo_list;
387 rdo_list.reserve(xaodCluster.rdoList().size());
388 for (const Identifier::value_type rdo_id_value : xaodCluster.rdoList()) {
389 rdo_list.emplace_back(rdo_id_value);
390 }
391
392 indetCluster = new ::HGTD_Cluster(id,
393 localPosition,
394 std::move(rdo_list),
395 width,
396 &element,
397 std::move(errorMatrix),
398 time,
399 time_resolution,
400 std::vector<int>(xaodCluster.totList()));
401
402 return StatusCode::SUCCESS;
403 }
Identifier identifierOfPosition(const Amg::Vector2D &localPos) const
Full identifier of the cell for a given position: assumes a raw local position (no Lorentz shift).
float timeCovariance() const
Return the covariance of the measured time in ns squared.
SG::ConstAccessor< SG::JaggedVecElt< int > >::element_type totList() const
Returns the list of Time Over Threshold of the channels building the cluster.
float time() const
Return the measured time in ns.
SG::ConstAccessor< SG::JaggedVecElt< Identifier::value_type > >::element_type rdoList() const
Returns the list of identifiers of the channels building the cluster.
ConstMatrixMap< N > localCovariance() const
Returns the local covariance of the measurement.
ConstVectorMap< N > localPosition() const
Returns the local position of the measurement.
Eigen::Map< const MeasMatrix< N > > ConstMatrixMap

◆ convertXaodToInDetCluster() [2/3]

StatusCode TrackingUtilities::convertXaodToInDetCluster ( const xAOD::PixelCluster & xaodCluster,
const InDetDD::SiDetectorElement & element,
const PixelID & pixelID,
InDet::PixelCluster *& indetCluster )

Definition at line 147 of file ClusterConversionUtilities.cxx.

151 {
152 const InDetDD::PixelModuleDesign* design(dynamic_cast<const InDetDD::PixelModuleDesign*>(&element.design()));
153 if (design == nullptr) {
154 return StatusCode::FAILURE;
155 }
156
157 Amg::Vector2D localPosition = xAOD::toEigen(xaodCluster.localPosition<2>());
158
159 InDetDD::SiLocalPosition centroid(localPosition);
160 const Identifier id = element.identifierOfPosition(centroid);
161
162 Amg::Vector3D globalPosition = xAOD::toEigen(xaodCluster.globalPosition());
163 auto errorMatrix = Amg::MatrixX(2,2);
164 errorMatrix.setIdentity();
165 errorMatrix.fillSymmetric(0, 0, xaodCluster.localCovariance<2>()(0, 0));
166 errorMatrix.fillSymmetric(1, 1, xaodCluster.localCovariance<2>()(1, 1));
167
168 int colmax = std::numeric_limits<int>::min();
169 int rowmax = std::numeric_limits<int>::min();
170 int colmin = std::numeric_limits<int>::max();
171 int rowmin = std::numeric_limits<int>::max();
172
173 float qRowMin = 0.f;
174 float qRowMax = 0.f;
175 float qColMin = 0.f;
176 float qColMax = 0.f;
177
179 rdo_list_cluster = xaodCluster.rdoList();
181 charge_list_cluster = xaodCluster.chargeList();
182 std::vector<Identifier> rdo_list_new;
183
184 auto tot_list = xaodCluster.totList();
185
186 rdo_list_new.reserve(rdo_list_cluster.size());
187
188 if (rdo_list_cluster.size() == charge_list_cluster.size()) {
189 for (std::size_t i(0); i<rdo_list_cluster.size(); ++i) {
190 Identifier this_rdo(rdo_list_cluster[i]);
191 rdo_list_new.push_back(this_rdo);
192 const float this_charge=charge_list_cluster[i];
193 const int row = pixelID.phi_index(this_rdo);
194 if (row > rowmax) {
195 rowmax = row;
196 qRowMax = this_charge;
197 } else if (row == rowmax) {
198 qRowMax += this_charge;
199 }
200 if (row < rowmin) {
201 rowmin = row;
202 qRowMin = this_charge;
203 } else if (row == rowmin) {
204 qRowMin += this_charge;
205 }
206
207 const int col = pixelID.eta_index(this_rdo);
208 if (col > colmax) {
209 colmax = col;
210 qColMax = this_charge;
211 } else if (col == colmax) {
212 qColMax += this_charge;
213 }
214
215 if (col < colmin) {
216 colmin = col;
217 qColMin = this_charge;
218 } else if (col == colmin) {
219 qColMin += this_charge;
220 }
221
222 }//loop on rdo list
223 } // check that rdo list has the same size of charge list
224 else {
225 std::ranges::transform(rdo_list_cluster, std::back_inserter(rdo_list_new),
226 [](const Identifier::value_type& rdo) { return Identifier{rdo}; });
227 }
228 // Compute omega for charge interpolation correction (if required)
229 // Two pixels may have charge=0 (very rarely, hopefully)
230 float omegax = -1.f;
231 float omegay = -1.f;
232 if(qRowMin + qRowMax > 0) omegax = qRowMax/(qRowMin + qRowMax);
233 if(qColMin + qColMax > 0) omegay = qColMax/(qColMin + qColMax);
234
235 double etaWidth = design->widthFromColumnRange(colmin, colmax);
236 double phiWidth = design->widthFromRowRange(rowmin, rowmax);
237 InDet::SiWidth width( Amg::Vector2D(xaodCluster.channelsInPhi(), xaodCluster.channelsInEta()),
238 Amg::Vector2D(phiWidth,etaWidth) );
239 indetCluster = new InDet::PixelCluster(id,
240 localPosition,
241 globalPosition,
242 std::move(rdo_list_new),
243 xaodCluster.lvl1a(),
244 std::vector<int>(tot_list.begin(), tot_list.end()),
245 std::vector<float>(charge_list_cluster.begin(),charge_list_cluster.end()),
246 width,
247 &element,
248 std::move(errorMatrix),
249 omegax, omegay,
250 false, 0, 0);
251
252 return StatusCode::SUCCESS;
253 }
Class used to describe the design of a module (diode segmentation and readout scheme).
int channelsInPhi() const
Returns the dimensions of the cluster in numbers of channels in phi (x) and eta (y) directions,...
int lvl1a() const
Return the LVL1 accept.
int channelsInEta() const
Eigen::Matrix< double, 3, 1 > Vector3D

◆ convertXaodToInDetCluster() [3/3]

StatusCode TrackingUtilities::convertXaodToInDetCluster ( const xAOD::StripCluster & xaodCluster,
const InDetDD::SiDetectorElement & element,
const SCT_ID & stripID,
InDet::SCT_Cluster *& indetCluster,
double shift = 0. )

Definition at line 255 of file ClusterConversionUtilities.cxx.

260 {
261 bool isBarrel = element.isBarrel();
262 const InDetDD::SCT_ModuleSideDesign* design = nullptr;
263 if (not isBarrel) {
264 design = dynamic_cast<const InDetDD::StripStereoAnnulusDesign*>(&element.design());
265 } else {
266 design = dynamic_cast<const InDetDD::SCT_ModuleSideDesign*>(&element.design());
267 }
268
269 if (design == nullptr) {
270 return StatusCode::FAILURE;
271 }
272
273 const auto designShape = design->shape();
274
275
277 rdo_list_cluster = xaodCluster.rdoList();
278 Identifier id(rdo_list_cluster.front());
279
280 const auto& localPos = xaodCluster.localPosition<1>();
281
282 double pos_x = localPos(0, 0);
283 double pos_y = 0;
284 if (not isBarrel) {
285 const Identifier firstStripId(id);
286 int firstStrip = stripID.strip(firstStripId);
287 int stripRow = stripID.row(firstStripId);
288 int clusterSizeInStrips = xaodCluster.channelsInPhi();
289 auto clusterPosition = design->localPositionOfCluster(design->strip1Dim(firstStrip, stripRow), clusterSizeInStrips);
290 pos_x = clusterPosition.xPhi() + shift;
291 pos_y = clusterPosition.xEta();
292 }
293
294 Amg::Vector2D locpos = Amg::Vector2D( pos_x, pos_y );
295
296 // Most of the following is taken from what is done in ClusterMakerTool
297 // Need to make this computation instead of using the local pos
298 // with local pos instead some differences w.r.t. reference are observed
299 const auto& firstStrip = stripID.strip(Identifier(rdo_list_cluster.front()));
300 const auto& lastStrip = stripID.strip(Identifier(rdo_list_cluster.back()));
301 const auto& row = stripID.row(Identifier(rdo_list_cluster.front()));
302 const int firstStrip1D = design->strip1Dim (firstStrip, row );
303 const int lastStrip1D = design->strip1Dim( lastStrip, row );
304 const InDetDD::SiCellId cell1(firstStrip1D);
305 const InDetDD::SiCellId cell2(lastStrip1D);
306 const InDetDD::SiLocalPosition firstStripPos( element.rawLocalPositionOfCell(cell1 ));
307 const InDetDD::SiLocalPosition lastStripPos( element.rawLocalPositionOfCell(cell2) );
308 const InDetDD::SiLocalPosition centre( (firstStripPos+lastStripPos) * 0.5 );
309 const double clusterWidth = design->stripPitch() * ( lastStrip - firstStrip + 1 );
310
311 const std::pair<InDetDD::SiLocalPosition, InDetDD::SiLocalPosition> ends( design->endsOfStrip(centre) );
312 const double stripLength( std::abs(ends.first.xEta() - ends.second.xEta()) );
313
314 InDet::SiWidth width( Amg::Vector2D(xaodCluster.channelsInPhi(), 1),
315 Amg::Vector2D(clusterWidth, stripLength) );
316
317 const double col_x = width.colRow().x();
318 const double col_y = width.colRow().y();
319
320 double scale_factor = 1.;
321 if ( col_x == 1 )
322 scale_factor = 1.05;
323 else if ( col_x == 2 )
324 scale_factor = 0.27;
325
326 auto errorMatrix = Amg::MatrixX(2,2);
327 errorMatrix.setIdentity();
328 errorMatrix.fillSymmetric(0, 0, scale_factor * scale_factor * width.phiR() * width.phiR() * one_over_twelve);
329 errorMatrix.fillSymmetric(1, 1, width.z() * width.z() / col_y / col_y * one_over_twelve);
330
331 if( designShape == InDetDD::Trapezoid or designShape == InDetDD::Annulus) {
332 // rotation for endcap SCT
333
334 // The following is being computed with the local position,
335 // without considering the lorentz shift
336 // So we remove it from the local position
337 Amg::Vector2D local(pos_x - shift, pos_y);
338 double sn = element.sinStereoLocal(local);
339 double sn2 = sn * sn;
340 double cs2 = 1. - sn2;
341 double w = element.phiPitch(local) / element.phiPitch();
342 double v0 = errorMatrix(0,0) * w * w;
343 double v1 = errorMatrix(1,1);
344 errorMatrix.fillSymmetric( 0, 0, cs2 * v0 + sn2 * v1 );
345 errorMatrix.fillSymmetric( 0, 1, sn * std::sqrt(cs2) * (v0 - v1) );
346 errorMatrix.fillSymmetric( 1, 1, sn2 * v0 + cs2 * v1 );
347 }
348 std::vector<Identifier> rdo_list_new;
349 for(Identifier::value_type rdo_id_value : rdo_list_cluster) {
350 rdo_list_new.emplace_back(rdo_id_value);
351 }
352
353 indetCluster = new InDet::SCT_Cluster(id,
354 locpos,
355 std::move(rdo_list_new),
356 width,
357 &element,
358 std::move(errorMatrix));
359
360 return StatusCode::SUCCESS;
361 }
virtual DetectorShape shape() const
Shape of element.
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
double sinStereoLocal(const Amg::Vector2D &localPos) const
Angle of strip in local frame with respect to the etaAxis.
Amg::Vector2D rawLocalPositionOfCell(const SiCellId &cellId) const
Returns position (center) of cell.
int row(const Identifier &id) const
Definition SCT_ID.h:711
int strip(const Identifier &id) const
Definition SCT_ID.h:717
SG::ConstAccessor< SG::JaggedVecElt< Identifier::value_type > >::element_type rdoList() const
Returns 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.
SG::ConstAccessor< T, ALLOC > ConstAccessor
Definition AuxElement.h:570
virtual void shift(size_t pos, ptrdiff_t offs) override
Shift the elements of the container.