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)
const InDetDD::PixelModuleDesignpixelModuleDesign (const InDetDD::SiDetectorElement &element)
 Resolve the readout design of a pixel/strip detector element.
const InDetDD::SCT_ModuleSideDesignstripModuleSideDesign (const InDetDD::SiDetectorElement &element)
std::unique_ptr< InDet::PixelClusterconvertXaodToInDetCluster (const xAOD::PixelCluster &xaodCluster, const InDetDD::SiDetectorElement &element, const InDetDD::PixelModuleDesign &design, const PixelID &pixelID)
std::unique_ptr< InDet::SCT_ClusterconvertXaodToInDetCluster (const xAOD::StripCluster &xaodCluster, const InDetDD::SiDetectorElement &element, const InDetDD::SCT_ModuleSideDesign &design, const SCT_ID &stripID, double shift=0.)
StatusCode convertInDetToXaodCluster (const ::HGTD_Cluster &indetCluster, const InDetDD::HGTD_DetectorElement &element, xAOD::HGTDCluster &xaodCluster)
std::unique_ptr<::HGTD_ClusterconvertXaodToInDetCluster (const xAOD::HGTDCluster &xaodCluster, const InDetDD::HGTD_DetectorElement &element)
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, 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 25 of file ClusterConversionUtilities.cxx.

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

48 {
49 IdentifierHash idHash = element.identifyHash();
50
51 const auto [localPosition, localCovariance] = convertHGTD_LocalPosCov(indetCluster);
52
53 const auto& RDOs = indetCluster.rdoList();
54 const auto& ToTs = indetCluster.totList();
55
56 xaodCluster.setMeasurement<3>(idHash, localPosition, localCovariance);
57 xaodCluster.setIdentifier( indetCluster.identify().get_compact() );
58 xaodCluster.setRDOlist(RDOs);
59 xaodCluster.setToTlist(ToTs);
60
61 return StatusCode::SUCCESS;
62 }
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 78 of file ClusterConversionUtilities.cxx.

81 {
82 IdentifierHash idHash = element.identifyHash();
83
84 const auto [localPosition, localCovariance] = convertPix_LocalPosCov(indetCluster);
85
86 xAOD::MeasVector<3> globalPosition = xAOD::toStorage(indetCluster.globalPosition());
87
88 const auto& RDOs = indetCluster.rdoList();
89 const auto& ToTs = indetCluster.totList();
90 const auto& charges = indetCluster.chargeList();
91 const auto& width = indetCluster.width();
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);
98 xaodCluster.setChargelist(charges);
100 xaodCluster.setLVL1A(indetCluster.LVL1A());
101 xaodCluster.setChannelsInPhiEta(width.colRow()[0], width.colRow()[1]);
102 xaodCluster.setWidthInEta(static_cast<float>(width.widthPhiRZ()[1]));
103
104 return StatusCode::SUCCESS;
105 }
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.
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 130 of file ClusterConversionUtilities.cxx.

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

64 {
65 auto localCov = cluster.localCovariance();
66
67 xAOD::MeasVector<2> localPosition = xAOD::toStorage(cluster.localPosition());
68
69 Eigen::Matrix<float,2,2> localCovariance;
70 localCovariance.setZero();
71 localCovariance(0, 0) = localCov(0, 0);
72 localCovariance(1, 1) = localCov(1, 1);
73 //cid 23274
74 //coverity[UNINIT:FALSE]
75 return {localPosition, localCovariance};
76 }

◆ convertSCT_LocalPosCov()

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

Definition at line 107 of file ClusterConversionUtilities.cxx.

107 {
108 const InDetDD::SiDetectorElement& element{*cluster.detectorElement()};
109 auto localPos = cluster.localPosition();
110
111 float localPosition = 0.f, localCovariance = 0.f;
112 if (element.isBarrel() or (not isITk)) {
113 localPosition = localPos.x();
114 localCovariance = element.phiPitch() * element.phiPitch() * one_over_twelve;
115 } else {
116 InDetDD::SiCellId cellId = element.cellIdOfPosition(localPos);
117 const auto* design = dynamic_cast<const InDetDD::StripStereoAnnulusDesign *>(&element.design());
118 if ( design == nullptr ) {
119 THROW_EXCEPTION("Invalid bounds from "<<cluster);
120 }
121 InDetDD::SiLocalPosition localInPolar = design->localPositionOfCellPC(cellId);
122 localPosition = localInPolar.xPhi();
123 localCovariance = design->phiPitchPhi() * design->phiPitchPhi() * one_over_twelve;
124 }
125
126 return std::make_pair(xAOD::MeasVector<1>{localPosition},
127 xAOD::MeasMatrix<1>{localCovariance});
128 }
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,
xAOD::SpacePoint & xaodSpacePoint )

Definition at line 43 of file SpacePointConversionUtilities.cxx.

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

std::unique_ptr<::HGTD_Cluster > TrackingUtilities::convertXaodToInDetCluster ( const xAOD::HGTDCluster & xaodCluster,
const InDetDD::HGTD_DetectorElement & element )

Definition at line 369 of file ClusterConversionUtilities.cxx.

369 {
370 const auto& locPos = xaodCluster.localPosition<3>();
371 Amg::Vector2D localPosition(locPos(0,0), locPos(1,0));
372 float time = xAOD::HGTDCluster::time(locPos);
373
374 InDetDD::SiLocalPosition centroid(localPosition);
375 const Identifier id = element.identifierOfPosition(centroid);
376
377 xAOD::ConstMatrixMap<3> local_covariance(xaodCluster.localCovariance<3>());
378 auto errorMatrix = Amg::MatrixX(2,2);
379 errorMatrix.setIdentity();
380 errorMatrix.fillSymmetric(0, 0, local_covariance(0, 0));
381 errorMatrix.fillSymmetric(1, 1, local_covariance(1, 1));
382 float time_resolution = std::sqrt(xAOD::HGTDCluster::timeCovariance(local_covariance));
383
384 double etaWidth = 1.3;
385 double phiWidth = 1.3;
386 int channelsPhi = 1;
387 int channelsEta = 1;
388 InDet::SiWidth width( Amg::Vector2D(channelsPhi, channelsEta), Amg::Vector2D(phiWidth, etaWidth) );
389 std::vector<Identifier> rdo_list;
390 rdo_list.reserve(xaodCluster.rdoList().size());
391 for (const Identifier::value_type rdo_id_value : xaodCluster.rdoList()) {
392 rdo_list.emplace_back(rdo_id_value);
393 }
394
395 return std::make_unique<::HGTD_Cluster>(id,
396 localPosition,
397 std::move(rdo_list),
398 width,
399 &element,
400 std::move(errorMatrix),
401 time,
402 time_resolution,
403 std::vector<int>(xaodCluster.totList()));
404
405 }
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]

std::unique_ptr< InDet::PixelCluster > TrackingUtilities::convertXaodToInDetCluster ( const xAOD::PixelCluster & xaodCluster,
const InDetDD::SiDetectorElement & element,
const InDetDD::PixelModuleDesign & design,
const PixelID & pixelID )

Definition at line 168 of file ClusterConversionUtilities.cxx.

172 {
173 const InDetDD::PixelModuleDesign* design = &moduleDesign;
174
175 Amg::Vector2D localPosition = xAOD::toEigen(xaodCluster.localPosition<2>());
176
177 InDetDD::SiLocalPosition centroid(localPosition);
178 const Identifier id = element.identifierOfPosition(centroid);
179
180 Amg::Vector3D globalPosition = xAOD::toEigen(xaodCluster.globalPosition());
181 auto errorMatrix = Amg::MatrixX(2,2);
182 errorMatrix.setIdentity();
183 errorMatrix.fillSymmetric(0, 0, xaodCluster.localCovariance<2>()(0, 0));
184 errorMatrix.fillSymmetric(1, 1, xaodCluster.localCovariance<2>()(1, 1));
185
186 int colmax = std::numeric_limits<int>::min();
187 int rowmax = std::numeric_limits<int>::min();
188 int colmin = std::numeric_limits<int>::max();
189 int rowmin = std::numeric_limits<int>::max();
190
191 float qRowMin = 0.f;
192 float qRowMax = 0.f;
193 float qColMin = 0.f;
194 float qColMax = 0.f;
195
197 rdo_list_cluster = xaodCluster.rdoList();
199 charge_list_cluster = xaodCluster.chargeList();
200 std::vector<Identifier> rdo_list_new;
201
202 auto tot_list = xaodCluster.totList();
203
204 rdo_list_new.reserve(rdo_list_cluster.size());
205
206 if (rdo_list_cluster.size() == charge_list_cluster.size()) {
207 for (std::size_t i(0); i<rdo_list_cluster.size(); ++i) {
208 Identifier this_rdo(rdo_list_cluster[i]);
209 rdo_list_new.push_back(this_rdo);
210 const float this_charge=charge_list_cluster[i];
211 const int row = pixelID.phi_index(this_rdo);
212 if (row > rowmax) {
213 rowmax = row;
214 qRowMax = this_charge;
215 } else if (row == rowmax) {
216 qRowMax += this_charge;
217 }
218 if (row < rowmin) {
219 rowmin = row;
220 qRowMin = this_charge;
221 } else if (row == rowmin) {
222 qRowMin += this_charge;
223 }
224
225 const int col = pixelID.eta_index(this_rdo);
226 if (col > colmax) {
227 colmax = col;
228 qColMax = this_charge;
229 } else if (col == colmax) {
230 qColMax += this_charge;
231 }
232
233 if (col < colmin) {
234 colmin = col;
235 qColMin = this_charge;
236 } else if (col == colmin) {
237 qColMin += this_charge;
238 }
239
240 }//loop on rdo list
241 } // check that rdo list has the same size of charge list
242 else {
243 std::ranges::transform(rdo_list_cluster, std::back_inserter(rdo_list_new),
244 [](const Identifier::value_type& rdo) { return Identifier{rdo}; });
245 }
246 // Compute omega for charge interpolation correction (if required)
247 // Two pixels may have charge=0 (very rarely, hopefully)
248 float omegax = -1.f;
249 float omegay = -1.f;
250 if(qRowMin + qRowMax > 0) omegax = qRowMax/(qRowMin + qRowMax);
251 if(qColMin + qColMax > 0) omegay = qColMax/(qColMin + qColMax);
252
253 double etaWidth = design->widthFromColumnRange(colmin, colmax);
254 double phiWidth = design->widthFromRowRange(rowmin, rowmax);
255 InDet::SiWidth width( Amg::Vector2D(xaodCluster.channelsInPhi(), xaodCluster.channelsInEta()),
256 Amg::Vector2D(phiWidth,etaWidth) );
257 return std::make_unique<InDet::PixelCluster>(id,
258 localPosition,
259 globalPosition,
260 std::move(rdo_list_new),
261 xaodCluster.lvl1a(),
262 std::vector<int>(tot_list.begin(), tot_list.end()),
263 std::vector<float>(charge_list_cluster.begin(),charge_list_cluster.end()),
264 width,
265 &element,
266 std::move(errorMatrix),
267 omegax, omegay,
268 false, 0, 0);
269
270 }
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.
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]

std::unique_ptr< InDet::SCT_Cluster > TrackingUtilities::convertXaodToInDetCluster ( const xAOD::StripCluster & xaodCluster,
const InDetDD::SiDetectorElement & element,
const InDetDD::SCT_ModuleSideDesign & design,
const SCT_ID & stripID,
double shift = 0. )

Definition at line 273 of file ClusterConversionUtilities.cxx.

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

◆ pixelModuleDesign()

const InDetDD::PixelModuleDesign * TrackingUtilities::pixelModuleDesign ( const InDetDD::SiDetectorElement & element)

Resolve the readout design of a pixel/strip detector element.

The result only depends on the element, so callers converting many clusters of the same element should hoist this out of their loop: the cast is not free and the conversion is run once per cluster in the event.

Definition at line 154 of file ClusterConversionUtilities.cxx.

155 {
156 return dynamic_cast<const InDetDD::PixelModuleDesign*>(&element.design());
157 }

◆ stripModuleSideDesign()

const InDetDD::SCT_ModuleSideDesign * TrackingUtilities::stripModuleSideDesign ( const InDetDD::SiDetectorElement & element)

Definition at line 159 of file ClusterConversionUtilities.cxx.

160 {
161 if (not element.isBarrel()) {
162 return dynamic_cast<const InDetDD::StripStereoAnnulusDesign*>(&element.design());
163 }
164 return dynamic_cast<const InDetDD::SCT_ModuleSideDesign*>(&element.design());
165 }