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 {
12 const std::vector<Identifier>& rod_list_cluster = cluster.rdoList();
13 const std::vector<float>& charge_list_cluster = cluster.chargeList();
14
15 if (rod_list_cluster.size() != charge_list_cluster.size()) {
16 return {-1.f, -1.f};
17 }
18
19 int colmax = std::numeric_limits<int>::min();
20 int rowmax = std::numeric_limits<int>::min();
21 int colmin = std::numeric_limits<int>::max();
22 int rowmin = std::numeric_limits<int>::max();
23
24 float qRowMin = 0.f;
25 float qRowMax = 0.f;
26 float qColMin = 0.f;
27 float qColMax = 0.f;
28
29 for (std::size_t i(0); i<rod_list_cluster.size(); ++i) {
30 const Identifier& this_rdo = rod_list_cluster.at(i);
31 const float this_charge = charge_list_cluster.at(i);
32
33 const int row = pixelID.phi_index(this_rdo);
34 if (row > rowmax) {
35 rowmax = row;
36 qRowMax = this_charge;
37 } else if (row == rowmax) {
38 qRowMax += this_charge;
39 }
40
41 if (row < rowmin) {
42 rowmin = row;
43 qRowMin = this_charge;
44 } else if (row == rowmin) {
45 qRowMin += this_charge;
46 }
47
48 const int col = pixelID.eta_index(this_rdo);
49 if (col > colmax) {
50 colmax = col;
51 qColMax = this_charge;
52 } else if (col == colmax) {
53 qColMax += this_charge;
54 }
55
56 if (col < colmin) {
57 colmin = col;
58 qColMin = this_charge;
59 } else if (col == colmin) {
60 qColMin += this_charge;
61 }
62 } // loop on rdos and charges
63
64 float omegax = -1.f;
65 float omegay = -1.f;
66 if(qRowMin + qRowMax > 0) omegax = qRowMax/(qRowMin + qRowMax);
67 if(qColMin + qColMax > 0) omegay = qColMax/(qColMin + qColMax);
68
69 return std::make_pair(omegax, omegay);
70 }
int eta_index(const Identifier &id) const
Definition PixelID.h:645
int phi_index(const Identifier &id) const
Definition PixelID.h:639
const std::vector< float > & chargeList() const
Returns the list of charges of the channels building the cluster.
const std::vector< Identifier > rdoList() const
Returns the list of identifiers 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 21 of file ClusterConversionUtilities.cxx.

21 {
22 auto localPos = cluster.localPosition();
23 auto localCov = cluster.localCovariance();
24
25 const float time = cluster.time();
26 const float timeResolution = cluster.timeResolution();
27
28 Eigen::Matrix<float,3,1> localPosition = Eigen::Matrix<float,3,1>::Zero();
29 localPosition(0, 0) = localPos.x();
30 localPosition(1, 0) = localPos.y();
31 localPosition(2, 0) = time;
32
33 Eigen::Matrix<float,3,3> localCovariance = Eigen::Matrix<float,3,3>::Zero();
34 localCovariance(0, 0) = localCov(0, 0);
35 localCovariance(1, 1) = localCov(1, 1);
36 localCovariance(2, 2) = timeResolution * timeResolution;
37
38 return {localPosition, localCovariance};
39 }
virtual float time() const
virtual 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 41 of file ClusterConversionUtilities.cxx.

44 {
45 IdentifierHash idHash = element.identifyHash();
46
47 const auto [localPosition, localCovariance] = convertHGTD_LocalPosCov(indetCluster);
48
49 const auto& RDOs = indetCluster.rdoList();
50 const auto& ToTs = indetCluster.totList();
51
52 xaodCluster.setMeasurement<3>(idHash, localPosition, localCovariance);
53 xaodCluster.setIdentifier( indetCluster.identify().get_compact() );
54 xaodCluster.setRDOlist(RDOs);
55 xaodCluster.setToTlist(ToTs);
56
57 return StatusCode::SUCCESS;
58 }
virtual 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 setToTlist(const std::vector< int > &tots)
Sets the list of ToT of the channels building the cluster.
void setRDOlist(const std::vector< Identifier > &rdolist)
Sets the list of identifiers 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 74 of file ClusterConversionUtilities.cxx.

77 {
78 IdentifierHash idHash = element.identifyHash();
79
80 const auto [localPosition, localCovariance] = convertPix_LocalPosCov(indetCluster);
81
82 auto globalPos = indetCluster.globalPosition();
83 Eigen::Matrix<float, 3, 1> globalPosition(globalPos.x(), globalPos.y(), globalPos.z());
84
85 const auto& RDOs = indetCluster.rdoList();
86 const auto& ToTs = indetCluster.totList();
87 const auto& charges = indetCluster.chargeList();
88 const auto& width = indetCluster.width();
89 auto isSplit = indetCluster.isSplit();
90 auto splitProbability1 = indetCluster.splitProbability1();
91 auto splitProbability2 = indetCluster.splitProbability2();
92
93 xaodCluster.setMeasurement<2>(idHash, localPosition, localCovariance);
94 xaodCluster.setIdentifier( indetCluster.identify().get_compact() );
95 xaodCluster.setRDOlist(RDOs);
96 xaodCluster.globalPosition() = globalPosition;
97 xaodCluster.setToTlist(ToTs);
99 xaodCluster.setChargelist(charges);
101 xaodCluster.setLVL1A(indetCluster.LVL1A());
102 xaodCluster.setChannelsInPhiEta(width.colRow()[0], width.colRow()[1]);
103 xaodCluster.setWidthInEta(static_cast<float>(width.widthPhiRZ()[1]));
104 xaodCluster.setIsSplit(isSplit);
105 xaodCluster.setSplitProbabilities(splitProbability1, splitProbability2);
106
107 return StatusCode::SUCCESS;
108 }
const double width
const Amg::Vector3D & globalPosition() const
return global position reference
const InDet::SiWidth & width() const
return width class reference
void setTotalCharge(float totalCharge)
Sets the total charge.
void setChannelsInPhiEta(int channelsInPhi, int channelsInEta)
Sets the dimensions of the cluster in numbers of channels in phi (x) and eta (y) directions.
void setTotalToT(int totalToT)
Sets the total ToT.
void setSplitProbabilities(float prob1, float prob2)
Sets the splitting probabilities for the cluster.
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 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.
std::pair< xAOD::MeasVector< 2 >, xAOD::MeasMatrix< 2 > > convertPix_LocalPosCov(const InDet::PixelCluster &cluster)

◆ convertInDetToXaodCluster() [3/3]

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

Definition at line 133 of file ClusterConversionUtilities.cxx.

137 {
138 IdentifierHash idHash = element.identifyHash();
139
140 const auto [localPosition, localCovariance] = convertSCT_LocalPosCov(indetCluster, isITk);
141
142 auto globalPos = indetCluster.globalPosition();
143 Eigen::Matrix<float, 3, 1> globalPosition(globalPos.x(), globalPos.y(), globalPos.z());
144
145 const auto& RDOs = indetCluster.rdoList();
146 const auto& width = indetCluster.width();
147
148 xaodCluster.setMeasurement<1>(idHash, localPosition, localCovariance);
149 xaodCluster.setIdentifier( indetCluster.identify().get_compact() );
150 xaodCluster.setRDOlist(RDOs);
151 xaodCluster.globalPosition() = globalPosition;
152 xaodCluster.setChannelsInPhi(width.colRow()[0]);
153
154 return StatusCode::SUCCESS;
155 }
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 60 of file ClusterConversionUtilities.cxx.

60 {
61 auto localPos = cluster.localPosition();
62 auto localCov = cluster.localCovariance();
63
64 Eigen::Matrix<float,2,1> localPosition(localPos.x(), localPos.y());
65
66 Eigen::Matrix<float,2,2> localCovariance;
67 localCovariance.setZero();
68 localCovariance(0, 0) = localCov(0, 0);
69 localCovariance(1, 1) = localCov(1, 1);
70
71 return {localPosition, localCovariance};
72 }

◆ convertSCT_LocalPosCov()

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

Definition at line 110 of file ClusterConversionUtilities.cxx.

110 {
111 const InDetDD::SiDetectorElement& element{*cluster.detectorElement()};
112 auto localPos = cluster.localPosition();
113
114 float localPosition = 0.f, localCovariance = 0.f;
115 if (element.isBarrel() or (not isITk)) {
116 localPosition = localPos.x();
117 localCovariance = element.phiPitch() * element.phiPitch() * one_over_twelve;
118 } else {
119 InDetDD::SiCellId cellId = element.cellIdOfPosition(localPos);
120 const auto* design = dynamic_cast<const InDetDD::StripStereoAnnulusDesign *>(&element.design());
121 if ( design == nullptr ) {
122 THROW_EXCEPTION("Invalid bounds from "<<cluster);
123 }
124 InDetDD::SiLocalPosition localInPolar = design->localPositionOfCellPC(cellId);
125 localPosition = localInPolar.xPhi();
126 localCovariance = design->phiPitchPhi() * design->phiPitchPhi() * one_over_twelve;
127 }
128
129 return std::make_pair(xAOD::MeasVector<1>{localPosition},
130 xAOD::MeasMatrix<1>{localCovariance});
131 }
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
Eigen::Matrix< float, N, 1 > MeasVector
Abrivation of the Matrix & Covariance definitions.
#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.
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 std::pair< const PrepRawData *, const PrepRawData * > & clusterList() const
return the pair of cluster pointers 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 368 of file ClusterConversionUtilities.cxx.

370 {
371
372 const auto& locPos = xaodCluster.localPosition<3>();
373 Amg::Vector2D localPosition(locPos(0,0), locPos(1,0));
374 float time = locPos(2,0);
375
376 InDetDD::SiLocalPosition centroid(localPosition);
377 const Identifier id = element.identifierOfPosition(centroid);
378
379 auto errorMatrix = Amg::MatrixX(2,2);
380 errorMatrix.setIdentity();
381 errorMatrix.fillSymmetric(0, 0, xaodCluster.localCovariance<3>()(0, 0));
382 errorMatrix.fillSymmetric(1, 1, xaodCluster.localCovariance<3>()(1, 1));
383 float time_resolution = std::sqrt(xaodCluster.localCovariance<3>()(2, 2));
384
385 double etaWidth = 1.3;
386 double phiWidth = 1.3;
387 int channelsPhi = 1;
388 int channelsEta = 1;
389 InDet::SiWidth width( Amg::Vector2D(channelsPhi, channelsEta), Amg::Vector2D(phiWidth, etaWidth) );
390
391 indetCluster = new ::HGTD_Cluster(id,
392 localPosition,
393 std::vector<Identifier>(xaodCluster.rdoList()),
394 width,
395 &element,
396 std::move(errorMatrix),
397 time,
398 time_resolution,
399 std::vector<int>(xaodCluster.totList()));
400
401 return StatusCode::SUCCESS;
402 }
Identifier identifierOfPosition(const Amg::Vector2D &localPos) const
Full identifier of the cell for a given position: assumes a raw local position (no Lorentz shift)
const std::vector< int > & totList() const
Returns the list of Time Over Threshold of the channels building the cluster.
const std::vector< Identifier > 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.

◆ convertXaodToInDetCluster() [2/3]

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

Definition at line 157 of file ClusterConversionUtilities.cxx.

161 {
162 const InDetDD::PixelModuleDesign* design(dynamic_cast<const InDetDD::PixelModuleDesign*>(&element.design()));
163 if (design == nullptr) {
164 return StatusCode::FAILURE;
165 }
166
167 const auto& locPos = xaodCluster.localPosition<2>();
168 Amg::Vector2D localPosition(locPos(0,0), locPos(1,0));
169
170 InDetDD::SiLocalPosition centroid(localPosition);
171 const Identifier id = element.identifierOfPosition(centroid);
172
173 const auto& globalPos = xaodCluster.globalPosition();
174 Amg::Vector3D globalPosition(globalPos(0, 0), globalPos(1, 0), globalPos(2, 0));
175
176 auto errorMatrix = Amg::MatrixX(2,2);
177 errorMatrix.setIdentity();
178 errorMatrix.fillSymmetric(0, 0, xaodCluster.localCovariance<2>()(0, 0));
179 errorMatrix.fillSymmetric(1, 1, xaodCluster.localCovariance<2>()(1, 1));
180
181 int colmax = std::numeric_limits<int>::min();
182 int rowmax = std::numeric_limits<int>::min();
183 int colmin = std::numeric_limits<int>::max();
184 int rowmin = std::numeric_limits<int>::max();
185
186 float qRowMin = 0.f;
187 float qRowMax = 0.f;
188 float qColMin = 0.f;
189 float qColMax = 0.f;
190
191 const std::vector<Identifier>& rod_list_cluster = xaodCluster.rdoList();
192 const std::vector<float>& charge_list_cluster = xaodCluster.chargeList();
193
194 if (rod_list_cluster.size() == charge_list_cluster.size()) {
195
196 for (std::size_t i(0); i<rod_list_cluster.size(); ++i) {
197 const Identifier& this_rdo = rod_list_cluster[i];
198 const float this_charge = charge_list_cluster[i];
199
200 const int row = pixelID.phi_index(this_rdo);
201 if (row > rowmax) {
202 rowmax = row;
203 qRowMax = this_charge;
204 } else if (row == rowmax) {
205 qRowMax += this_charge;
206 }
207
208 if (row < rowmin) {
209 rowmin = row;
210 qRowMin = this_charge;
211 } else if (row == rowmin) {
212 qRowMin += this_charge;
213 }
214
215 const int col = pixelID.eta_index(this_rdo);
216 if (col > colmax) {
217 colmax = col;
218 qColMax = this_charge;
219 } else if (col == colmax) {
220 qColMax += this_charge;
221 }
222
223 if (col < colmin) {
224 colmin = col;
225 qColMin = this_charge;
226 } else if (col == colmin) {
227 qColMin += this_charge;
228 }
229
230 }//loop on rdo list
231 } // check that rdo list has the same size of charge list
232
233 // Compute omega for charge interpolation correction (if required)
234 // Two pixels may have charge=0 (very rarely, hopefully)
235 float omegax = -1.f;
236 float omegay = -1.f;
237 if(qRowMin + qRowMax > 0) omegax = qRowMax/(qRowMin + qRowMax);
238 if(qColMin + qColMax > 0) omegay = qColMax/(qColMin + qColMax);
239
240 double etaWidth = design->widthFromColumnRange(colmin, colmax);
241 double phiWidth = design->widthFromRowRange(rowmin, rowmax);
242 InDet::SiWidth width( Amg::Vector2D(xaodCluster.channelsInPhi(), xaodCluster.channelsInEta()),
243 Amg::Vector2D(phiWidth,etaWidth) );
244
245 indetCluster = new InDet::PixelCluster(id,
246 localPosition,
247 globalPosition,
248 std::vector<Identifier>(xaodCluster.rdoList()),
249 xaodCluster.lvl1a(),
250 std::vector<int>(xaodCluster.totList()),
251 std::vector<float>(xaodCluster.chargeList()),
252 width,
253 &element,
254 std::move(errorMatrix),
255 omegax,
256 omegay,
257 xaodCluster.isSplit(),
258 xaodCluster.splitProbability1(),
259 xaodCluster.splitProbability2());
260
261 return StatusCode::SUCCESS;
262 }
Class used to describe the design of a module (diode segmentation and readout scheme)
const std::vector< int > & totList() const
Returns the list of ToT of the channels building the cluster.
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
float splitProbability1() const
Returns the splitting probabilities for the cluster.
bool isSplit() const
Returns if the cluster is split or not.
float splitProbability2() 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 264 of file ClusterConversionUtilities.cxx.

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