ATLAS Offline Software
Loading...
Searching...
No Matches
FPGAClusterConverter Class Reference

#include <FPGAClusterConverter.h>

Inheritance diagram for FPGAClusterConverter:
Collaboration diagram for FPGAClusterConverter:

Public Member Functions

 FPGAClusterConverter (const std::string &type, const std::string &name, const IInterface *parent)
virtual ~FPGAClusterConverter ()=default
virtual StatusCode initialize () override final
virtual StatusCode convertHits (const std::vector< FPGATrackSimHit > &, InDet::PixelClusterCollection &, InDet::SCT_ClusterCollection &) const override final
virtual StatusCode convertHits (const std::vector< const FPGATrackSimHit * > &, InDet::PixelClusterCollection &, InDet::SCT_ClusterCollection &) const override final
virtual StatusCode convertHits (const std::vector< FPGATrackSimHit > &hits, xAOD::PixelClusterContainer &pixelCont, xAOD::StripClusterContainer &SCTCont) const override final
virtual StatusCode convertClusters (const std::vector< FPGATrackSimCluster > &, InDet::PixelClusterCollection &, InDet::SCT_ClusterCollection &) const override final
virtual StatusCode convertClusters (const std::vector< FPGATrackSimCluster > &cl, xAOD::PixelClusterContainer &pixelCont, xAOD::StripClusterContainer &SCTCont) const override final
virtual StatusCode convertSpacePoints (const std::vector< FPGATrackSimCluster > &fpgaSPs, xAOD::SpacePointContainer &SPStripCont, xAOD::SpacePointContainer &SPPixelCont, xAOD::StripClusterContainer &stripClusterCont, xAOD::PixelClusterContainer &pixelClusterCont) const override final
virtual StatusCode createPixelCluster (const FPGATrackSimHit &h, const std::vector< Identifier > &rdoList, std::unique_ptr< InDet::PixelCluster > &) const override final
virtual StatusCode createPixelCluster (const FPGATrackSimHit &h, const std::vector< Identifier > &rdoList, xAOD::PixelCluster &) const override final
virtual StatusCode createSCTCluster (const FPGATrackSimHit &h, const std::vector< Identifier > &rdoList, std::unique_ptr< InDet::SCT_Cluster > &) const override final
virtual StatusCode createSCTCluster (const FPGATrackSimHit &h, const std::vector< Identifier > &rdoList, xAOD::StripCluster &) const override final
virtual StatusCode createPixelCluster (const FPGATrackSimCluster &, std::unique_ptr< InDet::PixelCluster > &) const override final
virtual StatusCode createPixelCluster (const FPGATrackSimCluster &, xAOD::PixelCluster &) const override final
virtual StatusCode createSCTCluster (const FPGATrackSimCluster &, std::unique_ptr< InDet::SCT_Cluster > &) const override final
virtual StatusCode createSCTCluster (const FPGATrackSimCluster &, xAOD::StripCluster &) const override final
virtual StatusCode createSP (const FPGATrackSimCluster &cl, xAOD::SpacePoint &sp, xAOD::StripClusterContainer &clustersCont) const override final
virtual StatusCode createPixelSPs (xAOD::SpacePointContainer &pixelSPs, xAOD::PixelClusterContainer &clustersCont) const override final
virtual StatusCode getRdoList (std::vector< Identifier > &rdoList, const FPGATrackSimCluster &cluster) const override final
virtual StatusCode getStripsInfo (const xAOD::StripCluster &cl, float &halfStripLength, Amg::Vector3D &stripDirection, Amg::Vector3D &stripCenter) const override final

Public Attributes

SG::ReadHandleKey< FPGATrackSimClusterCollectionm_FPGAClusterKey {this, "FPGATrackSimClusterKey","FPGAClusters","FPGATrackSim Clusters key"}
SG::ReadCondHandleKey< InDet::BeamSpotDatam_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" }

Private Attributes

const PixelIDm_pixelId {nullptr}
const SCT_IDm_SCTId {nullptr}
const InDetDD::PixelDetectorManagerm_pixelManager {nullptr}
const InDetDD::SCT_DetectorManagerm_SCTManager {nullptr}
ToolHandle< ISiLorentzAngleToolm_lorentzAngleToolPixel {this, "LorentzAngleToolPixel", "SiLorentzAngleTool/PixelLorentzAngleTool", "Tool to retrieve Lorentz angle of Pixel"}
ToolHandle< ISiLorentzAngleToolm_lorentzAngleToolStrip {this, "LorentzAngleToolStrip", "SiLorentzAngleTool/SCTLorentzAngleTool", "Tool to retrieve Lorentz angle of SCT"}
Gaudi::Property< bool > m_skipStripSpacePointFormation {this, "skipStripSpFormation", true, "Should be enabled in case we want to test strip seeding"}
Gaudi::Property< bool > m_doShift {this, "doLorentzShift", false, "Apply Lorentz angle shift to the clusters"}
Gaudi::Property< bool > m_useInherentLocalCoordinates {this, "useFPGALocalCoordinates", true, "instead of getting indirectly the local coordinates from the cell position, use the values stored in FPGATrackSimHit objects"}
Gaudi::Property< bool > m_broadErrors {this, "broadErrors", false, "If true use cluster width to set errors, otherwise use avg pixel width"}

Detailed Description

Definition at line 40 of file FPGAClusterConverter.h.

Constructor & Destructor Documentation

◆ FPGAClusterConverter()

FPGAClusterConverter::FPGAClusterConverter ( const std::string & type,
const std::string & name,
const IInterface * parent )

Definition at line 19 of file FPGAClusterConverter.cxx.

19 :
20 base_class(type, name, parent) {}

◆ ~FPGAClusterConverter()

virtual FPGAClusterConverter::~FPGAClusterConverter ( )
virtualdefault

Member Function Documentation

◆ convertClusters() [1/2]

StatusCode FPGAClusterConverter::convertClusters ( const std::vector< FPGATrackSimCluster > & clusters,
InDet::PixelClusterCollection & pixelColl,
InDet::SCT_ClusterCollection & SCTColl ) const
finaloverridevirtual

Definition at line 161 of file FPGAClusterConverter.cxx.

163 {
164 ATH_MSG_DEBUG("Found " << clusters.size() << " FPGATrackSimClusters [InDet]");
165 // reserve some memory
166 pixelColl.reserve(clusters.size());
167 SCTColl.reserve(clusters.size());
168 for(const FPGATrackSimCluster& cl : clusters) {
169
170 FPGATrackSimHit clEq = cl.getClusterEquiv();
171 std::vector<Identifier> rdoList;
172 ATH_CHECK(getRdoList(rdoList, cl));
173
174 std::unique_ptr<InDet::PixelCluster> pixelCl{};
175 std::unique_ptr<InDet::SCT_Cluster> SCTCl{};
176
177 if (clEq.isPixel()) {
178 ATH_CHECK(createPixelCluster(clEq, rdoList, pixelCl));
179 if (pixelCl) pixelColl.push_back(std::move(pixelCl));
180 }
181 if (clEq.isStrip()) {
182 ATH_CHECK(createSCTCluster(clEq, rdoList, SCTCl));
183 if (SCTCl) SCTColl.push_back(std::move(SCTCl));
184 }
185 }
186
187 ATH_MSG_DEBUG("pixelColl size: " << pixelColl.size() << " SCTColl size: " << SCTColl.size());
188
189 return StatusCode::SUCCESS;
190}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x)
virtual StatusCode createPixelCluster(const FPGATrackSimHit &h, const std::vector< Identifier > &rdoList, std::unique_ptr< InDet::PixelCluster > &) const override final
virtual StatusCode getRdoList(std::vector< Identifier > &rdoList, const FPGATrackSimCluster &cluster) const override final
virtual StatusCode createSCTCluster(const FPGATrackSimHit &h, const std::vector< Identifier > &rdoList, std::unique_ptr< InDet::SCT_Cluster > &) const override final
bool isPixel() const
bool isStrip() const
cl
print [x.__class__ for x in toList(dqregion.getSubRegions()) ]

◆ convertClusters() [2/2]

StatusCode FPGAClusterConverter::convertClusters ( const std::vector< FPGATrackSimCluster > & cl,
xAOD::PixelClusterContainer & pixelCont,
xAOD::StripClusterContainer & SCTCont ) const
finaloverridevirtual

Definition at line 192 of file FPGAClusterConverter.cxx.

194 {
195 ATH_MSG_DEBUG("Found " << clusters.size() << " FPGATrackSimClusters [xAOD]");
196 // reserve some memory
197 pixelCont.reserve(clusters.size());
198 SCTCont.reserve(clusters.size());
199
200 for(const FPGATrackSimCluster& cl : clusters) {
201
202 FPGATrackSimHit clEq = cl.getClusterEquiv();
203
204 std::vector<Identifier> rdoList;
205 ATH_CHECK(getRdoList(rdoList, cl));
206
207 if (clEq.isPixel()) {
208 xAOD::PixelCluster *xaod_pcl = new xAOD::PixelCluster();
209 pixelCont.push_back(xaod_pcl);
210 ATH_CHECK(createPixelCluster(clEq, rdoList, *xaod_pcl));
211 }
212 if (clEq.isStrip()) {
213 xAOD::StripCluster *xaod_scl = new xAOD::StripCluster();
214 SCTCont.push_back(xaod_scl);
215 ATH_CHECK(createSCTCluster(clEq, rdoList, *xaod_scl));
216 }
217 }
218
219 ATH_MSG_DEBUG("xAOD pixelCont size: " << pixelCont.size() << " xAOD SCTCont size: " << SCTCont.size());
220
221 return StatusCode::SUCCESS;
222}
void reserve(size_type n)
Attempt to preallocate enough memory for a specified number of elements.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
StripCluster_v1 StripCluster
Define the version of the strip cluster class.
PixelCluster_v1 PixelCluster
Define the version of the pixel cluster class.

◆ convertHits() [1/3]

StatusCode FPGAClusterConverter::convertHits ( const std::vector< const FPGATrackSimHit * > & hits,
InDet::PixelClusterCollection & pixelColl,
InDet::SCT_ClusterCollection & SCTColl ) const
finaloverridevirtual

Definition at line 73 of file FPGAClusterConverter.cxx.

75 {
76 ATH_MSG_DEBUG("Found " << hits.size() << " FPGATrackSimHits [InDet]");
77
78 // *** Match FPGATrackSimHit to FPGATrackSimCluster
79 SG::ReadHandle<FPGATrackSimClusterCollection> FPGAClustersHandle (m_FPGAClusterKey);
80 if (!FPGAClustersHandle.isValid()) {
81 ATH_MSG_FATAL("Failed to retrieve FPGATrackSimClusterCollection");
82 return StatusCode::FAILURE;
83 }
84 const FPGATrackSimClusterCollection *FPGAClusterColl = FPGAClustersHandle.cptr();
85
86 for(const FPGATrackSimHit *h : hits){
87 IdentifierHash hash = h->getIdentifierHash();
88 FPGATrackSimCluster cl;
89 for (const FPGATrackSimCluster& cluster: *FPGAClusterColl){
90 FPGATrackSimHit clusterEq = cluster.getClusterEquiv();
91 if (hash == clusterEq.getIdentifierHash()) {
92 cl = cluster;
93 break;
94 }
95 }
96 FPGATrackSimHit clEq = cl.getClusterEquiv();
97
98 // --- DEBUG
99 ATH_MSG_DEBUG("Hit identifier " << h->getIdentifierHash());
100 ATH_MSG_DEBUG("Cluster identifier " << clEq.getIdentifierHash());
101 // ---
102
103 // *** FPGATrackSimCluster matched
104
105 std::vector<Identifier> rdoList;
106 ATH_CHECK(getRdoList(rdoList,cl));
107
108 std::unique_ptr<InDet::PixelCluster> pixelCl{};
109 std::unique_ptr<InDet::SCT_Cluster> SCTCl{};
110
111 if (clEq.isPixel()) {
112 ATH_CHECK(createPixelCluster(clEq, rdoList, pixelCl));
113 if (pixelCl) pixelColl.push_back(std::move(pixelCl));
114 }
115 if (clEq.isStrip()) {
116 ATH_CHECK(createSCTCluster(clEq, rdoList, SCTCl));
117 if (SCTCl) SCTColl.push_back(std::move(SCTCl));
118 }
119
120 }
121
122 ATH_MSG_DEBUG("pixelColl size: " << pixelColl.size() << " SCTColl size: " << SCTColl.size());
123
124 return StatusCode::SUCCESS;
125
126}
#define ATH_MSG_FATAL(x)
std::vector< FPGATrackSimCluster > FPGATrackSimClusterCollection
SG::ReadHandleKey< FPGATrackSimClusterCollection > m_FPGAClusterKey
unsigned getIdentifierHash() const

◆ convertHits() [2/3]

StatusCode FPGAClusterConverter::convertHits ( const std::vector< FPGATrackSimHit > & hits,
InDet::PixelClusterCollection & pixelColl,
InDet::SCT_ClusterCollection & SCTColl ) const
finaloverridevirtual

Definition at line 43 of file FPGAClusterConverter.cxx.

45 {
46 ATH_MSG_DEBUG("Found " << hits.size() << " FPGATrackSimHits [InDet]");
47 // reserve some memory
48 pixelColl.reserve(hits.size());
49 SCTColl.reserve(hits.size());
50 for(const FPGATrackSimHit& h : hits) {
51
52 std::vector<Identifier> rdoList{Identifier(h.getRdoIdentifier())};
53
54 std::unique_ptr<InDet::PixelCluster> pixelCl{};
55 std::unique_ptr<InDet::SCT_Cluster> SCTCl{};
56
57 if (h.isPixel()) {
58 ATH_CHECK(createPixelCluster(h, rdoList, pixelCl));
59 if (pixelCl) pixelColl.push_back(std::move(pixelCl));
60 }
61 if (h.isStrip()) {
62 ATH_CHECK(createSCTCluster(h, rdoList, SCTCl));
63 if (SCTCl) SCTColl.push_back(std::move(SCTCl));
64 }
65 }
66
67 ATH_MSG_DEBUG("pixelColl size: " << pixelColl.size() << " SCTColl size: " << SCTColl.size() );
68
69 return StatusCode::SUCCESS;
70}

◆ convertHits() [3/3]

StatusCode FPGAClusterConverter::convertHits ( const std::vector< FPGATrackSimHit > & hits,
xAOD::PixelClusterContainer & pixelCont,
xAOD::StripClusterContainer & SCTCont ) const
finaloverridevirtual

Definition at line 129 of file FPGAClusterConverter.cxx.

131 {
132 ATH_MSG_DEBUG("Found " << hits.size() << " FPGATrackSimHits [xAOD]");
133 // reserve some memory
134 pixelCont.reserve(hits.size());
135 SCTCont.reserve(hits.size());
136 for(const FPGATrackSimHit& h : hits) {
137
138 std::vector<Identifier> rdoList{Identifier(h.getIdentifier())};
139
140 if (h.isPixel()) {
141 xAOD::PixelCluster *xaod_pcl = new xAOD::PixelCluster();
142 pixelCont.push_back(xaod_pcl);
143 ATH_CHECK(createPixelCluster(h, rdoList, *xaod_pcl));
144 }
145 if (h.isStrip()) {
146 xAOD::StripCluster *xaod_scl = new xAOD::StripCluster();
147 SCTCont.push_back(xaod_scl);
148 ATH_CHECK(createSCTCluster(h, rdoList, *xaod_scl));
149 if(!xaod_scl->rdoList().size())
150 SCTCont.pop_back();
151 }
152 }
153
154 ATH_MSG_DEBUG("xAOD pixelCont size: " << pixelCont.size() << " xAOD pixelCont size: " << SCTCont.size());
155
156 return StatusCode::SUCCESS;
157}
void pop_back()
Remove the last element from the collection.
const std::vector< Identifier > rdoList() const
Returns the list of identifiers of the channels building the cluster.

◆ convertSpacePoints()

StatusCode FPGAClusterConverter::convertSpacePoints ( const std::vector< FPGATrackSimCluster > & fpgaSPs,
xAOD::SpacePointContainer & SPStripCont,
xAOD::SpacePointContainer & SPPixelCont,
xAOD::StripClusterContainer & stripClusterCont,
xAOD::PixelClusterContainer & pixelClusterCont ) const
finaloverridevirtual

Definition at line 224 of file FPGAClusterConverter.cxx.

228 {
229 ATH_MSG_INFO("Converting Pixel SPs");
230 SPPixelCont.reserve(pixelClusterCont.size());
231 ATH_CHECK(createPixelSPs(SPPixelCont, pixelClusterCont));
232
234 ATH_MSG_INFO("Converting Strip SPs");
235 SPStripCont.reserve(fpgaSPs.size());
236 for (const FPGATrackSimCluster& cl : fpgaSPs) {
237 xAOD::SpacePoint* xaod_sp = new xAOD::SpacePoint();
238 SPStripCont.push_back(xaod_sp);
239 ATH_CHECK(createSP(cl, *xaod_sp, stripClusterCont));
240 if (!xaod_sp->elementIdList().size()) SPStripCont.pop_back();
241 }
242 }
243
244 return StatusCode::SUCCESS;
245}
#define ATH_MSG_INFO(x)
Gaudi::Property< bool > m_skipStripSpacePointFormation
virtual StatusCode createSP(const FPGATrackSimCluster &cl, xAOD::SpacePoint &sp, xAOD::StripClusterContainer &clustersCont) const override final
virtual StatusCode createPixelSPs(xAOD::SpacePointContainer &pixelSPs, xAOD::PixelClusterContainer &clustersCont) const override final
const std::vector< DetectorIDHashType > & elementIdList() const
Returns the IdentifierHash of the spacepoint (corresponds to the detector element IdentifierHash)

◆ createPixelCluster() [1/4]

StatusCode FPGAClusterConverter::createPixelCluster ( const FPGATrackSimCluster & cluster,
std::unique_ptr< InDet::PixelCluster > & cl ) const
finaloverridevirtual

Definition at line 649 of file FPGAClusterConverter.cxx.

649 {
650 ATH_MSG_DEBUG("\t Create InDet::PixelCluster from FPGATrackSimCluster");
651 FPGATrackSimHit clEq = cluster.getClusterEquiv();
652 std::vector<Identifier> rdoList;
653 ATH_CHECK(getRdoList(rdoList, cluster));
654 ATH_CHECK(createPixelCluster(clEq, rdoList, cl));
655 return StatusCode::SUCCESS;
656}
FPGATrackSimHit const & getClusterEquiv() const

◆ createPixelCluster() [2/4]

StatusCode FPGAClusterConverter::createPixelCluster ( const FPGATrackSimCluster & cluster,
xAOD::PixelCluster & cl ) const
finaloverridevirtual

Definition at line 658 of file FPGAClusterConverter.cxx.

658 {
659 ATH_MSG_DEBUG("\t Create xAOD::PixelCluster from FPGATrackSimCluster");
660 FPGATrackSimHit clEq = cluster.getClusterEquiv();
661 std::vector<Identifier> rdoList;
662 ATH_CHECK(getRdoList(rdoList, cluster));
663 ATH_CHECK(createPixelCluster(clEq, rdoList, cl));
664 return StatusCode::SUCCESS;
665}

◆ createPixelCluster() [3/4]

StatusCode FPGAClusterConverter::createPixelCluster ( const FPGATrackSimHit & h,
const std::vector< Identifier > & rdoList,
std::unique_ptr< InDet::PixelCluster > & cl ) const
finaloverridevirtual

Definition at line 247 of file FPGAClusterConverter.cxx.

247 {
248 ATH_MSG_DEBUG("\tCreate InDet::PixelCluster from FPGATrackSimHit");
249
250 IdentifierHash hash = h.getIdentifierHash();
251
252 float etaWidth = h.getEtaWidth();
253 float phiWidth = h.getPhiWidth();
254 int phiIndex = h.getPhiIndex();
255 int etaIndex = h.getEtaIndex();
256
257 const InDetDD::SiDetectorElement* pDE = m_pixelManager->getDetectorElement(hash);
258
259 if( !pDE ) {
260 ATH_MSG_ERROR("Detector Element doesn't exist " << hash);
261 return StatusCode::FAILURE;
262 }
263
264 // *** Get cell from id
265 Identifier wafer_id = m_pixelId->wafer_id(hash);
266 Identifier hit_id = m_pixelId->pixel_id(wafer_id, phiIndex, etaIndex);
267 InDetDD::SiCellId cell = pDE->cellIdFromIdentifier(hit_id);
268 if(!cell.isValid()) {
269 ATH_MSG_DEBUG("\t\tcell not valid");
270 return StatusCode::FAILURE;
271 }
272 const InDetDD::PixelModuleDesign* design (dynamic_cast<const InDetDD::PixelModuleDesign*>(&pDE->design()));
273
274 // **** Get InDet::SiWidth
275
276 int colMin = static_cast<int>(etaIndex-0.5*etaWidth);
277 int colMax = colMin+etaWidth;
278
279 int rowMin = static_cast<int>(phiIndex-0.5*phiWidth);
280 int rowMax = rowMin+phiWidth;
281
282 double etaW = design->widthFromColumnRange(colMin, colMax-1);
283 double phiW = design->widthFromRowRange(rowMin, rowMax-1);
284
285 InDet::SiWidth siWidth(Amg::Vector2D(phiWidth,etaWidth),Amg::Vector2D(phiW,etaW));
286
287 // **** Get SiLocalPosition from cell id and define Amg::Vector2D position
288 InDetDD::SiLocalPosition silPos(pDE->rawLocalPositionOfCell(cell));
289 Amg::Vector2D localPos(silPos);
290
291 //TODO: understand if shift is needed
292 if (m_doShift) {
293 double shift = m_lorentzAngleToolPixel->getLorentzShift(hash,Gaudi::Hive::currentContext());
294 Amg::Vector2D localPosShift(localPos[Trk::locX]+shift,localPos[Trk::locY]);
295 localPos = localPosShift;
296 }
297
298 Amg::Vector3D globalPos = pDE->globalPosition(localPos);
299 ATH_MSG_DEBUG("\t\tLocal position: x=" << localPos.x() << " y=" << localPos.y() );
300 ATH_MSG_DEBUG("\t\tGlobal position: x=" << globalPos.x() << " y=" << globalPos.y() << " z=" << globalPos.z() );
301
302 Amg::MatrixX cov(2,2);
303 cov.setZero();
304
305 if (m_broadErrors) {
306 cov(0,0) = siWidth.phiR()*siWidth.phiR()/12;
307 cov(1,1) = siWidth.z()*siWidth.z()/12;
308 }
309 else {
310 cov(0,0) = siWidth.phiR()*siWidth.phiR()/(12*siWidth.colRow().x()*siWidth.colRow().x());
311 cov(1,1) = siWidth.z()*siWidth.z()/(12*siWidth.colRow().y()*siWidth.colRow().y());
312 }
313
314 float dummy_omegax = 0.5;
315 float dummy_omegay = 0.5;
316 bool split = false;
317 float splitProb1 = 0;
318 float splitProb2 = 0;
319
320 cl = std::make_unique<InDet::PixelCluster>(hit_id, localPos, std::vector<Identifier>(rdoList), siWidth, pDE, Amg::MatrixX(cov), dummy_omegax, dummy_omegay, split, splitProb1, splitProb2);
321
322 return StatusCode::SUCCESS;
323}
#define ATH_MSG_ERROR(x)
#define y
#define x
const InDetDD::PixelDetectorManager * m_pixelManager
Gaudi::Property< bool > m_broadErrors
ToolHandle< ISiLorentzAngleTool > m_lorentzAngleToolPixel
Gaudi::Property< bool > m_doShift
virtual SiCellId cellIdFromIdentifier(const Identifier &identifier) const override final
SiCellId from Identifier.
virtual const SiDetectorDesign & design() const override final
access to the local description (inline):
HepGeom::Point3D< double > globalPosition(const HepGeom::Point3D< double > &localPos) const
transform a reconstruction local position into a global position (inline):
Amg::Vector2D rawLocalPositionOfCell(const SiCellId &cellId) const
Returns position (center) of cell.
std::vector< std::string > split(const std::string &s, const std::string &t=":")
Definition hcg.cxx:177
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Eigen::Matrix< double, 2, 1 > Vector2D
Eigen::Matrix< double, 3, 1 > Vector3D
@ locY
local cartesian
Definition ParamDefs.h:38
@ locX
Definition ParamDefs.h:37
unsigned int phiIndex(float phi, float binsize)
calculate phi index for a given phi
Definition EtaPhiLUT.cxx:23

◆ createPixelCluster() [4/4]

StatusCode FPGAClusterConverter::createPixelCluster ( const FPGATrackSimHit & h,
const std::vector< Identifier > & rdoList,
xAOD::PixelCluster & cl ) const
finaloverridevirtual

Definition at line 325 of file FPGAClusterConverter.cxx.

325 {
326 ATH_MSG_DEBUG("\tCreate xAOD::PixelCluster from FPGATrackSimHit");
327
328 IdentifierHash hash = h.getIdentifierHash();
329
330 const InDetDD::SiDetectorElement* pDE = m_pixelManager->getDetectorElement(hash);
331
332 if( !pDE ) {
333 ATH_MSG_ERROR("Detector Element doesn't exist " << hash);
334 return StatusCode::FAILURE;
335 }
336
337 // *** Get cell from id
338 Identifier wafer_id = m_pixelId->wafer_id(hash);
339 Identifier hit_id = m_pixelId->pixel_id(wafer_id, h.getPhiIndex(), h.getEtaIndex());
340 InDetDD::SiCellId cell = pDE->cellIdFromIdentifier(hit_id);
341 if(!cell.isValid()) {
342 ATH_MSG_DEBUG("\t\tcell not valid");
343 return StatusCode::FAILURE;
344 }
345 const InDetDD::PixelModuleDesign* design (dynamic_cast<const InDetDD::PixelModuleDesign*>(&pDE->design()));
346
347 // **** Get InDet::SiWidth
348 int rowmin = h.getMinPhiIndex();
349 int rowmax = h.getMaxPhiIndex();
350 int colmin = h.getMinEtaIndex();
351 int colmax = h.getMaxEtaIndex();
352
353 // Quick test to check that none of these 4 hit some number limits
354 // Check for uninitialized values (still at int min/max)
355 if (colmin == std::numeric_limits<int>::max() || colmax == std::numeric_limits<int>::min() ||
356 rowmin == std::numeric_limits<int>::max() || rowmax == std::numeric_limits<int>::min()) {
357 ATH_MSG_ERROR("Pixel cluster indices appear uninitialized: colmin=" << colmin << ", colmax=" << colmax
358 << ", rowmin=" << rowmin << ", rowmax=" << rowmax);
359 return StatusCode::FAILURE;
360 }
361 // Check for negative indices
362 if (colmin < 0 || colmax < 0 || rowmin < 0 || rowmax < 0) {
363 ATH_MSG_ERROR("Pixel cluster indices out of range: colmin=" << colmin << ", colmax=" << colmax
364 << ", rowmin=" << rowmin << ", rowmax=" << rowmax);
365 return StatusCode::FAILURE;
366 }
367 // Check for max < min
368 if (colmax < colmin || rowmax < rowmin) {
369 ATH_MSG_ERROR("Pixel cluster index max < min: colmin=" << colmin << ", colmax=" << colmax
370 << ", rowmin=" << rowmin << ", rowmax=" << rowmax);
371 return StatusCode::FAILURE;
372 }
373
374 double zWidth = design->widthFromColumnRange(colmin, colmax);
375 double phiRWidth = design->widthFromRowRange(rowmin, rowmax);
376
377 InDet::SiWidth siWidth(Amg::Vector2D(h.getPhiWidth(),h.getEtaWidth()), Amg::Vector2D(phiRWidth,zWidth));
378
379
380 // **** Get SiLocalPosition from cell id and define Amg::Vector2D position
381 InDetDD::SiLocalPosition silPos(pDE->rawLocalPositionOfCell(cell));
382 Amg::Vector2D localPos(silPos);
383
385 // replace localPos with the one stored in the FPGATrackSimHit
386 localPos(0,0) = h.getPhiCoord();
387 localPos(1,0) = h.getEtaCoord();
388 }
389 //TODO: understand if shift is needed
390 if (m_doShift) {
391 double shift = m_lorentzAngleToolPixel->getLorentzShift(hash,Gaudi::Hive::currentContext());
392 Amg::Vector2D localPosShift(localPos[Trk::locX]+shift,localPos[Trk::locY]);
393 localPos = localPosShift;
394 }
395
396 ATH_MSG_DEBUG("\t\tLocal position: x=" << localPos.x() << " y=" << localPos.y() );
397
398 Amg::MatrixX cov(2,2);
399 cov.setZero();
400
401 if (m_broadErrors) {
402 cov(0,0) = siWidth.phiR()*siWidth.phiR()/12;
403 cov(1,1) = siWidth.z()*siWidth.z()/12;
404 }
405 else {
406 cov(0,0) = siWidth.phiR()*siWidth.phiR()/(12*siWidth.colRow().x()*siWidth.colRow().x());
407 cov(1,1) = siWidth.z()*siWidth.z()/(12*siWidth.colRow().y()*siWidth.colRow().y());
408 }
409
410 bool split = false;
411 float splitProb1 = 0;
412 float splitProb2 = 0;
413
414 Eigen::Matrix<float,2,1> localPosition(localPos.x(), localPos.y());
415 Eigen::Matrix<float,2,2> localCovariance;
416 localCovariance.setZero();
417 localCovariance(0, 0) = cov(0, 0);
418 localCovariance(1, 1) = cov(1, 1);
419
420 Eigen::Matrix<float,3,1> globalPosition(h.getX(),h.getY(),h.getZ());
421 ATH_MSG_DEBUG("\t\tGlobal position: x=" << globalPosition.x() << " y=" << globalPosition.y() << " z=" << globalPosition.z() );
422
423 cl.setMeasurement<2>(hash, localPosition, localCovariance);
424 ATH_MSG_INFO("rdoIdentifier: " << h.getRdoIdentifier());
425 cl.setIdentifier( h.getRdoIdentifier() );
426 cl.setRDOlist(rdoList);
427 cl.globalPosition() = globalPosition;
428 cl.setChannelsInPhiEta(siWidth.colRow()[0], siWidth.colRow()[1]);
429 cl.setWidthInEta(static_cast<float>(siWidth.widthPhiRZ()[1]));
430 cl.setIsSplit(split);
431 cl.setSplitProbabilities(splitProb1, splitProb2);
432 ATH_MSG_DEBUG("\t\txaod width in eta " << cl.widthInEta());
433
434 return StatusCode::SUCCESS;
435}
Gaudi::Property< bool > m_useInherentLocalCoordinates

◆ createPixelSPs()

StatusCode FPGAClusterConverter::createPixelSPs ( xAOD::SpacePointContainer & pixelSPs,
xAOD::PixelClusterContainer & clustersCont ) const
finaloverridevirtual

Definition at line 686 of file FPGAClusterConverter.cxx.

686 {
687
688 for (const xAOD::PixelCluster* p_cl : clustersCont)
689 {
690 pixelSPs.emplace_back(new xAOD::SpacePoint);
691
692 // Global position
693 Eigen::Matrix<float, 3, 1> globalPos(p_cl->globalPosition().x(), p_cl->globalPosition().y(), p_cl->globalPosition().z());
694
695 // Covariance
696 // TODO: check if we need to scale covariance based on rotation matrix like in PixelSpacePointFormationTool.cxx
697 const float cov_r = p_cl->localCovariance<2>()(0,0);
698 const float cov_z = p_cl->localCovariance<2>()(1,0);
699
700 pixelSPs.back()->setSpacePoint(
701 p_cl->identifierHash(),
702 globalPos,
703 cov_r,
704 cov_z,
705 std::vector< const xAOD::UncalibratedMeasurement* >({ p_cl }) // measurement list
706 );
707 }
708
709 return StatusCode::SUCCESS;
710}
const T * back() const
Access the last element in the collection as an rvalue.
value_type emplace_back(value_type pElem)
Add an element to the end of the collection.
void setSpacePoint(DetectorIDHashType idHash, const Eigen::Matrix< float, 3, 1 > &globPos, float cov_r, float cov_z, std::vector< const xAOD::UncalibratedMeasurement * > &&measurementIndexes)

◆ createSCTCluster() [1/4]

StatusCode FPGAClusterConverter::createSCTCluster ( const FPGATrackSimCluster & cluster,
std::unique_ptr< InDet::SCT_Cluster > & cl ) const
finaloverridevirtual

Definition at line 667 of file FPGAClusterConverter.cxx.

667 {
668 ATH_MSG_DEBUG("\t Create InDet::SCT_Cluster from FPGATrackSimCluster");
669 FPGATrackSimHit clEq = cluster.getClusterEquiv();
670 std::vector<Identifier> rdoList;
671 ATH_CHECK(getRdoList(rdoList, cluster));
672 ATH_CHECK(createSCTCluster(clEq, rdoList,cl));
673 return StatusCode::SUCCESS;
674}

◆ createSCTCluster() [2/4]

StatusCode FPGAClusterConverter::createSCTCluster ( const FPGATrackSimCluster & cluster,
xAOD::StripCluster & cl ) const
finaloverridevirtual

Definition at line 676 of file FPGAClusterConverter.cxx.

676 {
677 ATH_MSG_DEBUG("\t Create xAOD::StripCluster from FPGATrackSimCluster");
678 FPGATrackSimHit clEq = cluster.getClusterEquiv();
679 std::vector<Identifier> rdoList;
680 ATH_CHECK(getRdoList(rdoList, cluster));
681 ATH_CHECK(createSCTCluster(clEq, rdoList, cl));
682 return StatusCode::SUCCESS;
683}

◆ createSCTCluster() [3/4]

StatusCode FPGAClusterConverter::createSCTCluster ( const FPGATrackSimHit & h,
const std::vector< Identifier > & rdoList,
std::unique_ptr< InDet::SCT_Cluster > & cl ) const
finaloverridevirtual

Definition at line 437 of file FPGAClusterConverter.cxx.

437 {
438 ATH_MSG_DEBUG("\t Create InDet::SCTCluster from FPGATrackSimHit ");
439
440
441 IdentifierHash hash = h.getIdentifierHash();
442
443 float phiWidth = h.getPhiWidth();
444 int strip = static_cast<int>(h.getPhiIndex());
445 ATH_CHECK(strip >= 0);
446 const InDetDD::SiDetectorElement* pDE = m_SCTManager->getDetectorElement(hash);
447 ATH_CHECK(pDE != nullptr);
448
449
450 Identifier wafer_id = m_SCTId->wafer_id(hash);
451 Identifier strip_id = m_SCTId->strip_id(wafer_id, strip);
452 InDetDD::SiCellId cell = pDE->cellIdFromIdentifier(strip_id);
453 ATH_MSG_DEBUG("\t\tcell: " << cell);
454 ATH_MSG_DEBUG("\t\tstrip_id " << strip_id);
455 ATH_MSG_DEBUG("\t\tstrip: " << cell);
456 ATH_MSG_DEBUG("\t\tStrip from idHelper: " << m_SCTId->strip(strip_id) );
457
458 const InDetDD::SCT_ModuleSideDesign* design;
459 if (pDE->isBarrel()){
460 design = (static_cast<const InDetDD::SCT_ModuleSideDesign*>(&pDE->design()));
461 } else{
462 design = (static_cast<const InDetDD::StripStereoAnnulusDesign*>(&pDE->design()));
463 }
464
465 const int firstStrip = m_SCTId->strip(rdoList.front());
466 const int lastStrip = m_SCTId->strip(rdoList.back());
467 const int row = m_SCTId->row(rdoList.front());
468 const int firstStrip1D = design->strip1Dim (firstStrip, row );
469 const int lastStrip1D = design->strip1Dim( lastStrip, row );
470 const InDetDD::SiCellId cell1(firstStrip1D);
471 const InDetDD::SiCellId cell2(lastStrip1D);
472 const InDetDD::SiLocalPosition firstStripPos( pDE->rawLocalPositionOfCell(cell1 ));
473 const InDetDD::SiLocalPosition lastStripPos( pDE->rawLocalPositionOfCell(cell2) );
474 const InDetDD::SiLocalPosition centre( (firstStripPos+lastStripPos) * 0.5 );
475 const double width = design->stripPitch() * ( lastStrip - firstStrip + 1 );
476
477 const std::pair<InDetDD::SiLocalPosition, InDetDD::SiLocalPosition> ends( design->endsOfStrip(centre) );
478 const double stripLength( std::abs(ends.first.xEta() - ends.second.xEta()) );
479
480 InDet::SiWidth siWidth(Amg::Vector2D(phiWidth,1), Amg::Vector2D(width,stripLength) ); //TODO: ok??
481 Amg::Vector2D localPos(centre.xPhi(), centre.xEta());
482
483 ATH_MSG_DEBUG("\t\tcentre eta: " << centre.xEta() << " phi: " << centre.xPhi());
484 ATH_MSG_DEBUG("\t\tStrip length: " << stripLength );
485 ATH_MSG_DEBUG("\t\tlocal position before shift: " << localPos.x() << " phi: " << localPos.y());
486 if (m_doShift) {
487 double shift = m_lorentzAngleToolStrip->getLorentzShift(hash,Gaudi::Hive::currentContext());
488 Amg::Vector2D localPosShift(localPos[Trk::locX]+shift,localPos[Trk::locY]);
489 localPos = localPosShift;
490 }
491
492 Amg::Vector3D globalPos = pDE->globalPosition(localPos);
493 ATH_MSG_DEBUG("\t\tLocal position: x=" << localPos.x() << " y=" << localPos.y() );
494 ATH_MSG_DEBUG("\t\tGlobal position: x=" << globalPos.x() << " y=" << globalPos.y() << " z=" << globalPos.z() );
495
496 // Fill cov matrix. TODO: compare with https://gitlab.cern.ch/atlas/athena/-/blob/main/InnerDetector/InDetRecTools/SiClusterizationTool/src/ClusterMakerTool.cxx and xAOD function
497 const double col_x = siWidth.colRow().x();
498 const double col_y = siWidth.colRow().y();
499
500 double scale_factor = 1.;
501 if ( std::abs(col_x-1) < std::numeric_limits<double>::epsilon() )
502 scale_factor = 1.05;
503 else if ( std::abs(col_x-2) < std::numeric_limits<double>::epsilon() )
504 scale_factor = 0.27;
505
506 auto cov = Amg::MatrixX(2,2);
507 cov.setIdentity();
508 cov.fillSymmetric(0, 0, scale_factor * scale_factor * siWidth.phiR() * siWidth.phiR() * (1./12.));
509 cov.fillSymmetric(1, 1, siWidth.z() * siWidth.z() / col_y / col_y * (1./12.));
510
511 // rotation for endcap SCT
512 if(pDE->design().shape() == InDetDD::Trapezoid || pDE->design().shape() == InDetDD::Annulus) {
513 double sn = pDE->sinStereoLocal(localPos);
514 double sn2 = sn*sn;
515 double cs2 = 1.-sn2;
516 double w = pDE->phiPitch(localPos)/pDE->phiPitch();
517 double v0 = (cov)(0,0)*w*w;
518 double v1 = (cov)(1,1);
519 cov.fillSymmetric( 0, 0, cs2 * v0 + sn2 * v1 );
520 cov.fillSymmetric( 0, 1, sn * std::sqrt(cs2) * (v0 - v1) );
521 cov.fillSymmetric( 1, 1, sn2 * v0 + cs2 * v1 );
522 }
523
524 cl = std::make_unique<InDet::SCT_Cluster>(strip_id, localPos, std::vector<Identifier>(rdoList), siWidth, pDE, Amg::MatrixX(cov));
525
526 return StatusCode::SUCCESS;
527}
const double width
ToolHandle< ISiLorentzAngleTool > m_lorentzAngleToolStrip
const InDetDD::SCT_DetectorManager * m_SCTManager
virtual DetectorShape shape() const
Shape of element.
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 std::pair< SiLocalPosition, SiLocalPosition > endsOfStrip(const SiLocalPosition &position) const override=0
give the ends of strips
double phiPitch() const
Pitch (inline methods)
double sinStereoLocal(const Amg::Vector2D &localPos) const
Angle of strip in local frame with respect to the etaAxis.
row
Appending html table to final .html summary file.

◆ createSCTCluster() [4/4]

StatusCode FPGAClusterConverter::createSCTCluster ( const FPGATrackSimHit & h,
const std::vector< Identifier > & rdoList,
xAOD::StripCluster & cl ) const
finaloverridevirtual

Definition at line 529 of file FPGAClusterConverter.cxx.

529 {
530 ATH_MSG_DEBUG("\t Create xAOD::StripCluster from FPGATrackSimHit ");
531 //https://gitlab.cern.ch/atlas/athena/-/blob/main/InnerDetector/InDetRecTools/SiClusterizationTool/src/SCT_ClusteringTool.cxx
532
533 IdentifierHash hash = h.getIdentifierHash();
534
535 float phiWidth = h.getPhiWidth();
536 int strip = static_cast<int>(h.getPhiIndex());
537 ATH_CHECK(strip >= 0);
538 const InDetDD::SiDetectorElement* sDE = m_SCTManager->getDetectorElement(hash);
539 ATH_CHECK(sDE != nullptr);
540
541 Identifier wafer_id = m_SCTId->wafer_id(hash);
542 Identifier strip_id = m_SCTId->strip_id(wafer_id, strip);
543 InDetDD::SiCellId cell = sDE->cellIdFromIdentifier(strip_id);
544 ATH_MSG_DEBUG("\t\tcell: " << cell);
545 ATH_MSG_DEBUG("\t\tstrip_id " << strip_id);
546 ATH_MSG_DEBUG("\t\tstrip: " << cell);
547 ATH_MSG_DEBUG("\t\tStrip from idHelper: " << m_SCTId->strip(strip_id) );
548
549 const InDetDD::SCT_ModuleSideDesign* design;
550 if (sDE->isBarrel()){
551 design = (static_cast<const InDetDD::SCT_ModuleSideDesign*>(&sDE->design()));
552 } else{
553 design = (static_cast<const InDetDD::StripStereoAnnulusDesign*>(&sDE->design()));
554 }
555
556 const int firstStrip = m_SCTId->strip(rdoList.front());
557 const int lastStrip = m_SCTId->strip(rdoList.back());
558 const int row = m_SCTId->row(rdoList.front());
559 const int firstStrip1D = design->strip1Dim (firstStrip, row);
560 const int lastStrip1D = design->strip1Dim(lastStrip, row);
561 const InDetDD::SiCellId cell1(firstStrip1D);
562 const InDetDD::SiCellId cell2(lastStrip1D);
563 if (cell2 != design->cellIdInRange(cell2) || cell1 != design->cellIdInRange(cell1)) { // this seems to solve EFTRACK-743
564 ATH_MSG_WARNING("Cell ID out of range. Skip making this Strip cluster");
565 return StatusCode::SUCCESS;
566 }
567 const InDetDD::SiLocalPosition firstStripPos( sDE->rawLocalPositionOfCell(cell1 ));
568 const InDetDD::SiLocalPosition lastStripPos( sDE->rawLocalPositionOfCell(cell2) );
569 const InDetDD::SiLocalPosition centre( (firstStripPos+lastStripPos) * 0.5 );
570 const double width = design->stripPitch() * ( lastStrip - firstStrip + 1 );
571
572 const std::pair<InDetDD::SiLocalPosition, InDetDD::SiLocalPosition> ends( design->endsOfStrip(centre) );
573 const double stripLength( std::abs(ends.first.xEta() - ends.second.xEta()) );
574
575 InDet::SiWidth siWidth(Amg::Vector2D(phiWidth,1), Amg::Vector2D(width,stripLength) ); //TODO: ok??
576 Amg::Vector2D localPos(centre.xPhi(), centre.xEta());
578 // replace localPos with the one stored in the FPGATrackSimHit
579 localPos(0,0) = h.getPhiCoord();
580 }
581 ATH_MSG_DEBUG("\t\tcentre eta: " << centre.xEta() << " phi: " << centre.xPhi());
582 ATH_MSG_DEBUG("\t\tStrip length: " << stripLength );
583 ATH_MSG_DEBUG("\t\tlocal position before shift: " << localPos.x() << " phi: " << localPos.y());
584
585 if (m_doShift) {
586 double shift = m_lorentzAngleToolStrip->getLorentzShift(hash,Gaudi::Hive::currentContext());
587 Amg::Vector2D localPosShift(localPos[Trk::locX]+shift,localPos[Trk::locY]);
588 localPos = localPosShift;
589 }
590
591 ATH_MSG_DEBUG("\t\tLocal position: x=" << localPos.x() << " y=" << localPos.y() );
592
593 /* TODO */
594 Eigen::Matrix<float,1,1> localPosition;
595 Eigen::Matrix<float,1,1> localCovariance;
596 localCovariance.setZero();
597
598 if (sDE->isBarrel()) {
599 localPosition(0, 0) = localPos.x();
600 localCovariance(0, 0) = sDE->phiPitch() * sDE->phiPitch() * (1. / 12.);
601 }
602 else {
603 InDetDD::SiCellId cellId = sDE->cellIdOfPosition(localPos);
604 const InDetDD::StripStereoAnnulusDesign* designNew = dynamic_cast<const InDetDD::StripStereoAnnulusDesign*>(&sDE->design());
605
606 if (!cellId.isValid() || cellId != designNew->cellIdInRange(cellId)) {
607 std::ostringstream msg;
608 msg << "Original cellId: " << cellId << " (strip=" << cellId.strip() << ")\n";
609 msg << "Cell ID invalid or out of range. Resetting to the closest cell of the active area.\n";
610 const InDetDD::SiCellId minCell = InDetDD::SiCellId(0); // get the first cell of the module
611 const Amg::Vector2D localPosMin = sDE->rawLocalPositionOfCell(minCell); // get raw local coordinates in Vector2D of the first cell
612 const InDetDD::SiCellId maxCell = InDetDD::SiCellId(designNew->cells() - 1); // get the last cell of the module
613 const Amg::Vector2D localPosMax = sDE->rawLocalPositionOfCell(maxCell); // get raw local coordinates in Vector2D of the last cell
614 msg << "Active area boundaries [eta,phi]: min [" << localPosMin.x() << ", " << localPosMin.y() << "] , " <<
615 "max [" << localPosMax.x() << ", " << localPosMax.y() << "]\n";
616 msg << "Compared to localPos of invalid cell: [" << localPos.x() << ", " << localPos.y() << "]\n";
617
618 // find the closest cell of the active area and assign it to cellId
619 // this ignores the Lorentz corrections but re-positions the cluster within the active area
620 if (std::abs(localPos[Trk::locR] - localPosMin[Trk::locR]) < std::abs(localPos[Trk::locR] - localPosMax[Trk::locR])) {
621 // this check should suffice instead of something like the following:
622 // (std::sqrt(std::pow(localPos.x() - localPosMin.x(), 2) + std::pow(localPos.y() - localPosMin.y(), 2)) <
623 // std::sqrt(std::pow(localPos.x() - localPosMax.x(), 2) + std::pow(localPos.y() - localPosMax.y(), 2)))
624 msg << " \\___ resetting to minCell [" << localPosMin.x() << ", " << localPosMin.y() << "]";
625 cellId = minCell;
626 } else {
627 msg << " \\___ resetting to maxCell [" << localPosMax.x() << ", " << localPosMax.y() << "]";
628 cellId = maxCell;
629 }
630 ATH_MSG_WARNING(msg.str());
631 }
632 InDetDD::SiLocalPosition localInPolar = designNew->localPositionOfCellPC(cellId);
633 localPosition(0, 0) = localInPolar.xPhi();
634 localCovariance(0, 0) = designNew->phiPitchPhi() * designNew->phiPitchPhi() * (1./12.);
635 }
636
637 Eigen::Matrix<float,3,1> globalPosition(h.getX(),h.getY(),h.getZ());
638 ATH_MSG_DEBUG("\t\tGlobal position: x=" << globalPosition.x() << " y=" << globalPosition.y() << " z=" << globalPosition.z() );
639
640 cl.setMeasurement<1>(hash, localPosition, localCovariance);
641 cl.setIdentifier( h.getRdoIdentifier() );
642 cl.setRDOlist(rdoList);
643 cl.globalPosition() = globalPosition;
644 cl.setChannelsInPhi(siWidth.colRow()[0]);
645
646 return StatusCode::SUCCESS;
647}
#define ATH_MSG_WARNING(x)
#define maxCell
virtual SiCellId cellIdInRange(const SiCellId &cellId) const override
Check if cell is in range.
int cells() const
number of readout stips within module side:
int strip() const
Get strip number. Equivalent to phiIndex().
Definition SiCellId.h:131
bool isValid() const
Test if its in a valid state.
Definition SiCellId.h:136
double xPhi() const
position along phi direction:
SiCellId cellIdOfPosition(const Amg::Vector2D &localPos) const
As in previous method but returns SiCellId.
virtual SiCellId cellIdInRange(const SiCellId &) const override
DEPRECATED: only used in a stupid example (2014) Check if cell is in range.
double phiPitchPhi(const SiLocalPosition &localPosition) const
SiLocalPosition localPositionOfCellPC(const SiCellId &cellId) const
This is for debugging only.
@ locR
Definition ParamDefs.h:44
MsgStream & msg
Definition testRead.cxx:32

◆ createSP()

StatusCode FPGAClusterConverter::createSP ( const FPGATrackSimCluster & cl,
xAOD::SpacePoint & sp,
xAOD::StripClusterContainer & clustersCont ) const
finaloverridevirtual

Definition at line 713 of file FPGAClusterConverter.cxx.

713 {
714
715 SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey };
716 const InDet::BeamSpotData* beamSpot = *beamSpotHandle;
717 Amg::Vector3D vertex = beamSpot->beamVtx().position();
718
719 const FPGATrackSimHit& clEq = cl.getClusterEquiv();
720
721 const IdentifierHash& hash = clEq.getIdentifierHash();
722
723 // Global position and covariance
724
725 Eigen::Matrix<float,3,1> globalPos(clEq.getX(),clEq.getY(),clEq.getZ());
726
727 // Covariance
728 // TODO: update to ITk? Can it be done as for pixel? (L728-729)?
729 // Lines taken from SCT_SpacePoint::setupLocalCovarianceSCT()
730 float deltaY = 0.0004; // roughly pitch of SCT (80 mu) / sqrt(12)
731 float covTerm = 1600.*deltaY;
732 Eigen::Matrix<float, 2, 1> variance(0.1, 8.*covTerm);
733 const InDetDD::SiDetectorElement* element = m_SCTManager->getDetectorElement(hash);
734 // Swap r/z covariance terms for endcap clusters
735 if ( element->isEndcap() )
736 std::swap( variance(0, 0), variance(1, 0) );
737 float cov_r = variance(0,0);
738 float cov_z = variance(1,0);
739
740 // ***** Get Strips related infos *****
741
742 // idHashes and measurements
743 std::vector<unsigned int> idHashList;
744 std::vector<const xAOD::UncalibratedMeasurement_v1*> measurements;
745
746 //Get measurements
747
748 float topHalfStripLength, bottomHalfStripLength;
749 Amg::Vector3D topStripDirection;
750 Amg::Vector3D bottomStripDirection;
751 Amg::Vector3D stripCenter1;
752 Amg::Vector3D stripCenter2;
753 int index = 0;
754 for (const FPGATrackSimHit& h : cl.getHitList()) {
755 idHashList.push_back(h.getIdentifierHash());
756 for (auto orig_cl : clustersCont) {
757 if (h.getIdentifierHash()==orig_cl->identifierHash()) {
758 if (index == 0) {ATH_CHECK(getStripsInfo(*orig_cl, topHalfStripLength, topStripDirection, stripCenter1));}
759 if (index == 1) {ATH_CHECK(getStripsInfo(*orig_cl, bottomHalfStripLength, bottomStripDirection, stripCenter2));}
760 measurements.push_back(orig_cl);
761 index++;
762 }
763 }
764 }
765
766 Amg::Vector3D topTrajDir = 2. * ( stripCenter1 - vertex);
767 Amg::Vector3D topStripCenter = 0.5 * topTrajDir;
768 Amg::Vector3D stripCenterDistance = stripCenter1 - stripCenter2;
769
770 ATH_MSG_DEBUG("topHalfStripLength = " << topHalfStripLength << " bottomHalfStripLength = " << bottomHalfStripLength);
771 ATH_MSG_DEBUG("topStripDirection = (" << topStripDirection.x() <<", " << topStripDirection.y() <<", " << topStripDirection.z() <<") " << "bottomStripDirection = (" << bottomStripDirection.x() <<", " << bottomStripDirection.y() <<", " << bottomStripDirection.z() <<") " );
772 ATH_MSG_DEBUG("stripCenterDistance = (" << stripCenterDistance.x() <<", " << stripCenterDistance.y() <<", " << stripCenterDistance.z() << ")" );
773 ATH_MSG_DEBUG("topStripCenter = (" << topStripCenter.x() <<", " << topStripCenter.y() <<", " << topStripCenter.z() << ")" );
774
775 // Fill xAOD::SpacePoint
776 sp.setSpacePoint(
777 std::move(idHashList),
778 globalPos,
779 cov_r,
780 cov_z,
781 std::move(measurements),
782 topHalfStripLength,
783 bottomHalfStripLength,
784 topStripDirection.cast<float>(),
785 bottomStripDirection.cast<float>(),
786 stripCenterDistance.cast<float>(),
787 topStripCenter.cast<float>()
788 );
789
790 return StatusCode::SUCCESS;
791}
SG::ReadCondHandleKey< InDet::BeamSpotData > m_beamSpotKey
virtual StatusCode getStripsInfo(const xAOD::StripCluster &cl, float &halfStripLength, Amg::Vector3D &stripDirection, Amg::Vector3D &stripCenter) const override final
float getY() const
float getX() const
float getZ() const
str index
Definition DeMoScan.py:362
AthConfigFlags beamSpot(AthConfigFlags flags, str instanceName, str recoMode)
void swap(ElementLinkVector< DOBJ > &lhs, ElementLinkVector< DOBJ > &rhs)

◆ getRdoList()

StatusCode FPGAClusterConverter::getRdoList ( std::vector< Identifier > & rdoList,
const FPGATrackSimCluster & cluster ) const
finaloverridevirtual

Definition at line 793 of file FPGAClusterConverter.cxx.

793 {
794
795 std::vector<FPGATrackSimHit> hits = cluster.getHitList();
796
797 for (const FPGATrackSimHit& h : hits) {
798 rdoList.emplace_back(h.getRdoIdentifier());
799 }
800
801 return StatusCode::SUCCESS;
802
803}
hitVector const & getHitList() const

◆ getStripsInfo()

StatusCode FPGAClusterConverter::getStripsInfo ( const xAOD::StripCluster & cl,
float & halfStripLength,
Amg::Vector3D & stripDirection,
Amg::Vector3D & stripCenter ) const
finaloverridevirtual

Definition at line 806 of file FPGAClusterConverter.cxx.

806 {
807
808 const int &strip = m_SCTId->strip(cl.rdoList().front());
809 const IdentifierHash &hash = cl.identifierHash();
810
811 const InDetDD::SiDetectorElement* sDE = m_SCTManager->getDetectorElement(hash);
812
813 const Identifier &wafer_id = m_SCTId->wafer_id(hash);
814 const Identifier &strip_id = m_SCTId->strip_id(wafer_id, strip);
815 const InDetDD::SiCellId & cell = sDE->cellIdFromIdentifier(strip_id);
816
817 const InDetDD::SiLocalPosition localPos( sDE->rawLocalPositionOfCell(cell ));
818 std::pair<Amg::Vector3D, Amg::Vector3D> end = (sDE->endsOfStrip(localPos));
819 stripCenter = 0.5 * (end.first + end.second);
820 Amg::Vector3D stripDir = end.first - end.second;
821
822 halfStripLength = 0.5 * stripDir.norm();
823 stripDirection = stripDir / (2. * (halfStripLength));
824
825 return StatusCode::SUCCESS;
826}
std::pair< Amg::Vector3D, Amg::Vector3D > endsOfStrip(const Amg::Vector2D &position) const
Special method for SCT to retrieve the two ends of a "strip" Returned coordinates are in global frame...

◆ initialize()

StatusCode FPGAClusterConverter::initialize ( )
finaloverridevirtual

Definition at line 22 of file FPGAClusterConverter.cxx.

22 {
23
24 ATH_MSG_DEBUG("Initializing FPGAClusterConverter...");
25
26 // Get SCT & pixel Identifier helpers
27 ATH_CHECK(detStore()->retrieve(m_pixelId, "PixelID"));
28 ATH_CHECK(detStore()->retrieve(m_SCTId, "SCT_ID"));
33
34 ATH_CHECK( m_FPGAClusterKey.initialize() );
35 ATH_CHECK(m_beamSpotKey.initialize());
36
37 return StatusCode::SUCCESS;
38
39}
retrieve(aClass, aKey=None)
Definition PyKernel.py:110

Member Data Documentation

◆ m_beamSpotKey

SG::ReadCondHandleKey< InDet::BeamSpotData > FPGAClusterConverter::m_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" }

Definition at line 84 of file FPGAClusterConverter.h.

84{ this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" };

◆ m_broadErrors

Gaudi::Property<bool> FPGAClusterConverter::m_broadErrors {this, "broadErrors", false, "If true use cluster width to set errors, otherwise use avg pixel width"}
private

Definition at line 100 of file FPGAClusterConverter.h.

100{this, "broadErrors", false, "If true use cluster width to set errors, otherwise use avg pixel width"};

◆ m_doShift

Gaudi::Property<bool> FPGAClusterConverter::m_doShift {this, "doLorentzShift", false, "Apply Lorentz angle shift to the clusters"}
private

Definition at line 98 of file FPGAClusterConverter.h.

98{this, "doLorentzShift", false, "Apply Lorentz angle shift to the clusters"};

◆ m_FPGAClusterKey

SG::ReadHandleKey<FPGATrackSimClusterCollection> FPGAClusterConverter::m_FPGAClusterKey {this, "FPGATrackSimClusterKey","FPGAClusters","FPGATrackSim Clusters key"}

Definition at line 83 of file FPGAClusterConverter.h.

83{this, "FPGATrackSimClusterKey","FPGAClusters","FPGATrackSim Clusters key"};

◆ m_lorentzAngleToolPixel

ToolHandle<ISiLorentzAngleTool> FPGAClusterConverter::m_lorentzAngleToolPixel {this, "LorentzAngleToolPixel", "SiLorentzAngleTool/PixelLorentzAngleTool", "Tool to retrieve Lorentz angle of Pixel"}
private

Definition at line 94 of file FPGAClusterConverter.h.

94{this, "LorentzAngleToolPixel", "SiLorentzAngleTool/PixelLorentzAngleTool", "Tool to retrieve Lorentz angle of Pixel"};

◆ m_lorentzAngleToolStrip

ToolHandle<ISiLorentzAngleTool> FPGAClusterConverter::m_lorentzAngleToolStrip {this, "LorentzAngleToolStrip", "SiLorentzAngleTool/SCTLorentzAngleTool", "Tool to retrieve Lorentz angle of SCT"}
private

Definition at line 95 of file FPGAClusterConverter.h.

95{this, "LorentzAngleToolStrip", "SiLorentzAngleTool/SCTLorentzAngleTool", "Tool to retrieve Lorentz angle of SCT"};

◆ m_pixelId

const PixelID* FPGAClusterConverter::m_pixelId {nullptr}
private

Definition at line 89 of file FPGAClusterConverter.h.

89{nullptr};

◆ m_pixelManager

const InDetDD::PixelDetectorManager* FPGAClusterConverter::m_pixelManager {nullptr}
private

Definition at line 91 of file FPGAClusterConverter.h.

91{nullptr};

◆ m_SCTId

const SCT_ID* FPGAClusterConverter::m_SCTId {nullptr}
private

Definition at line 90 of file FPGAClusterConverter.h.

90{nullptr};

◆ m_SCTManager

const InDetDD::SCT_DetectorManager* FPGAClusterConverter::m_SCTManager {nullptr}
private

Definition at line 92 of file FPGAClusterConverter.h.

92{nullptr};

◆ m_skipStripSpacePointFormation

Gaudi::Property<bool> FPGAClusterConverter::m_skipStripSpacePointFormation {this, "skipStripSpFormation", true, "Should be enabled in case we want to test strip seeding"}
private

Definition at line 97 of file FPGAClusterConverter.h.

97{this, "skipStripSpFormation", true, "Should be enabled in case we want to test strip seeding"};

◆ m_useInherentLocalCoordinates

Gaudi::Property<bool> FPGAClusterConverter::m_useInherentLocalCoordinates {this, "useFPGALocalCoordinates", true, "instead of getting indirectly the local coordinates from the cell position, use the values stored in FPGATrackSimHit objects"}
private

Definition at line 99 of file FPGAClusterConverter.h.

99{this, "useFPGALocalCoordinates", true, "instead of getting indirectly the local coordinates from the cell position, use the values stored in FPGATrackSimHit objects"};

The documentation for this class was generated from the following files: