201 {
202
204 unsigned int nprevSegments = segments.size();
208
209
211 if (!houghDataPerSectorVec.
isValid()) {
213 return;
214 }
215
216
217 if (static_cast<int>(houghDataPerSectorVec->vec.size()) <= sector - 1) {
218 ATH_MSG_WARNING(
" MuonLayerHoughTool::HoughDataPerSectorVec smaller than sector "
219 << houghDataPerSectorVec->vec.size() << " sector " << sector);
220 return;
221 }
222
223
229 << houghDataPerSectorVec->vec.size() << " " << houghDataPerSector.maxVec.size());
230
231
233 ATH_MSG_WARNING(
" houghDataPerSector.maxVec.size() smaller than hash " << houghDataPerSector.maxVec.size()
235 return;
236 }
238
239
240 bool barrelLike =
intersection.layerSurface.regionIndex == DetectorRegionIndex::Barrel;
241
243
244
248
251 float x = barrelLike ?
r :
z;
252 float y = barrelLike ?
z :
r;
253 float theta = std::atan2(
x,
y);
254
255 ATH_MSG_DEBUG(
" Got Hough maxima " << maxVec.size() <<
" extrapolated position in Hough space (" <<
x <<
"," <<
y
256 << ") error " << errx << " "
257 <<
" angle " <<
theta);
258
259
260 std::vector<std::unique_ptr<const Trk::MeasurementBase>> garbage;
261 auto handleMdt = [
this,
intersection, &garbage](
const MdtPrepData& prd, std::vector<const MdtDriftCircleOnTrack*>& mdts) {
263 if (!mdt) return;
264 mdts.push_back(mdt);
265 garbage.emplace_back(mdt);
266 };
267
268
269
271 std::vector<const MuonClusterOnTrack*>&
clusters) {
273 if (!cluster) return;
275 garbage.emplace_back(cluster);
276 };
277
278
279
280 MuonLayerHoughTool::MaximumVec::const_iterator mit = maxVec.begin();
281 MuonLayerHoughTool::MaximumVec::const_iterator mit_end = maxVec.end();
282 for (; mit != mit_end; ++mit) {
283 const MuonHough::MuonLayerHough::Maximum& maximum = **mit;
289 float pull =
residual / std::hypot(errx , maxwidth * OneOverSqrt12);
290
291
292 ATH_MSG_DEBUG(
" Hough maximum " << maximum.
max <<
" position (" << refPos <<
"," << maximum.
pos
293 <<
") residual " << residual <<
" pull " << pull <<
" angle " << maximum.
theta
294 << " residual " << residualTheta);
295
296
297 if (std::abs(pull) > 5) continue;
298
299
300 std::vector<const MdtDriftCircleOnTrack*> mdts;
301 std::vector<const MuonClusterOnTrack*>
clusters;
302 for (
const auto& hit : maximum.
hits) {
303
304
305 if (hit->tgc) {
306 for (const auto& prd : hit->tgc->etaCluster) {
307 handleCluster(*prd, clusters);
308 }
309 } else if (hit->prd) {
310 Identifier id = hit->prd->identify();
312 handleMdt(
static_cast<const MdtPrepData&
>(*hit->prd), mdts);
313 else
314 handleCluster(
static_cast<const MuonCluster&
>(*hit->prd), clusters);
315 }
316 }
317
318
321 ATH_MSG_DEBUG(
" Got Phi Hough maxima " << phiMaxVec.size() <<
" phi " <<
phi);
322
323
324 MuonLayerHoughTool::PhiMaximumVec::const_iterator pit = phiMaxVec.begin();
325 MuonLayerHoughTool::PhiMaximumVec::const_iterator pit_end = phiMaxVec.end();
326 for (; pit != pit_end; ++pit) {
327 const MuonHough::MuonPhiLayerHough::Maximum& maximum = **pit;
329
331 << maximum.
pos <<
" residual " << residual);
332
333 for (
const auto& phi_hit : maximum.
hits) {
334
335 if (phi_hit->tgc) {
336 Identifier id = phi_hit->tgc->phiCluster.front()->identify();
338 for (const auto& prd : phi_hit->tgc->phiCluster) handleCluster(*prd, clusters);
339 } else if (phi_hit->prd) {
340 Identifier id = phi_hit->prd->identify();
342 handleCluster(
static_cast<const MuonCluster&
>(*phi_hit->prd), clusters);
343 }
344 }
345 }
346
347
350
351
352 garbage.clear();
353 ATH_MSG_DEBUG(
" Done maximum: new segments " << segments.size() - nprevSegments);
354 }
355 ATH_MSG_DEBUG(
" Done with layer: new segments " << segments.size() - nprevSegments);
356 }
Scalar deltaPhi(const MatrixBase< Derived > &vec) const
Scalar phi() const
phi method
Scalar theta() const
theta method
virtual bool isValid() override final
Can the handle be successfully dereferenced?
double error(const Amg::MatrixX &mat, int index)
return diagonal error of the matrix caller should ensure the matrix is symmetric and the index is in ...
DetectorRegionIndex
enum to classify the different layers in the muon spectrometer
constexpr int toInt(const EnumType enumVal)
unsigned int sectorLayerHash(DetectorRegionIndex detectorRegionIndex, LayerIndex layerIndex)
create a hash out of region and layer
LayerIndex
enum to classify the different layers in the muon spectrometer
const MuonLayerHough * hough
RegionDescriptor m_descriptor