9#include "GaudiKernel/ConcurrencyFlags.h"
29 constexpr int nSelect =
toInt(ChIndex::ChIndexMax);
65 return StatusCode::SUCCESS;
69 const std::vector<const MdtPrepDataCollection*>& mdtCols,
const std::vector<const CscPrepDataCollection*>& cscCols,
70 const std::vector<const TgcPrepDataCollection*>& tgcCols,
const std::vector<const RpcPrepDataCollection*>& rpcCols,
83 auto getHashes = [
this](
const Identifier& id) {
94 auto hashes = getHashes(
id);
102 auto hashes = getHashes(
id);
110 auto hashes = getHashes(
id);
115 constexpr int tgcTech =
toInt(TechnologyIndex::TGC);
116 const std::vector<IdentifierHash>& hashes = m_collectionsPerSector[sector - 1].technologyRegionHashVecs[tgcTech][
sectorLayerHash];
117 return std::binary_search(hashes.begin(), hashes.end(), hash);
124 auto hashes = getHashes(
id);
131 int neighbourSectorDown = sector == 1 ? 16 : sector - 1;
132 if (hashInSector(col->identifyHash(), neighbourSectorDown, hashes.second))
137 int neighbourSectorUp = sector == 16 ? 1 : sector + 1;
138 if (hashInSector(col->identifyHash(), neighbourSectorUp, hashes.second))
150 const EventContext& ctx)
const {
159 ATH_MSG_DEBUG(
"analyse: Filling hits sector " << sit.sector);
162 houghData.
sector = sit.sector;
165 fillHitsPerSector(ctx, state, sit.sector, sit, mdtCont, cscCont, tgcCont, rpcCont, stgcCont, mmCont);
171 State& state)
const {
172 auto patternCombis = std::make_unique<MuonPatternCombinationCollection>();
176 ATH_MSG_DEBUG(
"analyse: Filling Hough sector " << houghData.sector);
183 HitVec& hits = houghData.hitVec.at(layerHash);
184 if (hits.empty())
continue;
195 <<
layerName(layer)<<
" -> hash: "<<layerHash <<
" -> stIndex: "
200 houghData.maxVec.at(layerHash).empty())
203 ++houghData.nlayersWithMaxima[
toInt(region)];
204 houghData.nmaxHitsInRegion[
toInt(region)] += houghData.maxVec[layerHash].front()->max;
207 << houghData.sector <<
" " <<
regionName(region) <<
" "
209 <<
" hash: " << layerHash <<
" nMaxima: " << houghData.maxVec[layerHash].size());
214 std::vector<Road> roads;
219 ATH_MSG_DEBUG(
"analyse: Building pattern combinations using roads " << roads.size());
220 for (
auto& road : roads) {
221 std::map<MuonHough::MuonPhiLayerHough::Maximum*, MuonLayerHoughTool::MaximumVec> phiEtaAssMap;
224 int sector = road.seed->hough->m_descriptor.sector;
230 << road.maxima.size() <<
" phi " << road.phiMaxima.size() <<
" seed : sector " << sector <<
" "
232 <<
" maximum " << road.seed->max <<
" position " << road.seed->pos <<
" angle " << road.seed->theta);
234 if (road.phiMaxima.empty())
235 unassociatedEtaMaxima.push_back(road.maxima);
237 for (
auto&
max : road.mergedPhiMaxima) { phiEtaAssMap[&
max] = road.maxima; }
249 std::vector<HoughDataPerSector*>::iterator spit = sectorData.begin();
250 std::vector<HoughDataPerSector*>::iterator spit_end = sectorData.end();
251 for (; spit != spit_end; ++spit) {
257 for (
int reg = 0; reg <
toInt(DetectorRegionIndex::DetectorRegionIndexMax); ++reg) {
263 << (*spit)->sector <<
" " <<
regionName(region) <<
" nmax " << (*spit)->maxEtaHits()
272 constexpr int nlayers =
toInt(LayerIndex::LayerIndexMax);
276 std::map<MuonHough::MuonPhiLayerHough::Maximum*, MaximumVec> phiEtaAssociations;
288 ATH_MSG_DEBUG(
"Found " << patternCombis->size() <<
" pattern combinations " << std::endl <<
m_printer->print(*patternCombis));
290 if (msgLvl(MSG::DEBUG)) {
301 std::unique_ptr<HoughDataPerSectorVec>& houghDataPerSectorVec,
302 std::vector<MuonLayerHoughTool::Road>& roads)
const {
305 [](
const std::shared_ptr<MuonHough::MuonLayerHough::Maximum>& m1,
306 const std::shared_ptr<MuonHough::MuonLayerHough::Maximum>& m2) { return m1->max > m2->max; });
308 std::set<std::shared_ptr<MuonHough::MuonLayerHough::Maximum>> associatedMaxima;
309 for (
const auto& seed : seedMaxima) {
311 if (associatedMaxima.count(seed))
continue;
316 int sector = seed->hough->m_descriptor.sector;
320 DetRegIdx region = seed->hough->m_descriptor.region;
326 <<
" position " << seed->pos <<
" angle " << seed->theta <<
" ptr " << seed.get());
331 MuonHough::HitVec::const_iterator ref_itr = std::find_if(
332 seed->hits.begin(), seed->hits.end(), [](
const std::shared_ptr<MuonHough::Hit>& hit) ->
bool { return hit->prd; });
334 const bool isNSW = ref_itr != seed->hits.end() &&
339 extendSeed(detectorHoughTransforms, road, houghDataPerSectorVec->vec[sector - 1]);
342 int sectorN = sector - 1;
343 if (sectorN < 1) sectorN = 16;
344 int sectorP = sector + 1;
345 if (sectorP > 16) sectorP = 1;
351 extendSeed(detectorHoughTransforms, road, houghDataPerSectorVec->vec[sectorN - 1]);
353 extendSeed(detectorHoughTransforms, road, houghDataPerSectorVec->vec[sectorP - 1]);
377 associatedMaxima.insert(road.
maxima.begin(), road.
maxima.end());
379 if (msgLevel(MSG::DEBUG)) {
387 <<
max->pos <<
" angle " <<
max->theta <<
" ptr " <<
max);
391 for (
auto& oldRoad : roads) {
392 std::vector<std::shared_ptr<MuonHough::MuonLayerHough::Maximum>>
intersection;
393 std::set_intersection(oldRoad.maximumSet.begin(), oldRoad.maximumSet.end(), road.
maximumSet.begin(), road.
maximumSet.end(),
396 unsigned int oldRoadSize = oldRoad.maximumSet.size();
397 unsigned int roadSize = road.
maximumSet.size();
398 ATH_MSG_VERBOSE(
" Overlap check " << intersectionSize <<
" old " << oldRoadSize <<
" new " << roadSize <<
" old ptr "
400 if (intersectionSize == 0)
continue;
401 if (intersectionSize == roadSize) {
404 }
else if (intersectionSize == oldRoadSize) {
412 if (insert) roads.push_back(road);
420 auto maximaSortingLambda = [road](
const std::shared_ptr<MuonHough::MuonPhiLayerHough::Maximum>& m1,
421 const std::shared_ptr<MuonHough::MuonPhiLayerHough::Maximum>& m2) {
422 if (m1->max != m2->max)
return m1->max > m2->max;
426 if (m1->hits.size() != m2->hits.size())
return m1->hits.size() < m2->hits.size();
428 if (m1->pos != m2->pos)
return m1->pos < m2->pos;
430 if (std::abs(m1->binposmax - m1->binposmin) == std::abs(m2->binposmax - m2->binposmin)) {
431 return (m1->binposmin) < (m2->binposmin);
433 return std::abs(m1->binposmax - m1->binposmin) < std::abs(m2->binposmax - m2->binposmin);
439 std::set<MuonHough::MuonPhiLayerHough::Maximum*> associatedPhiMaxima;
441 if (associatedPhiMaxima.count((*pit).get()))
continue;
442 associatedPhiMaxima.insert((*pit).get());
446 bool wasExtended =
false;
447 for (
auto pit1 = pit + 1; pit1 != road.
phiMaxima.end(); ++pit1) {
448 if ((*pit1)->binposmax >= phiMaximum.
binposmin && (*pit1)->binposmin <= phiMaximum.
binposmax) {
449 ATH_MSG_VERBOSE(
" merging maxima " << phiMaximum.
pos <<
" val " << phiMaximum.
max <<
" " << (*pit1)->pos <<
" val "
451 phiMaximum.
hits.insert(phiMaximum.
hits.end(), (*pit1)->hits.begin(), (*pit1)->hits.end());
452 associatedPhiMaxima.insert((*pit1).get());
460 60, -
M_PI,
M_PI, ((*pit)->hough ? (*pit)->hough->m_region : DetRegIdx::DetectorRegionUnknown));
468 [](
const std::shared_ptr<MuonHough::PhiHit>& h1,
const std::shared_ptr<MuonHough::PhiHit>& h2) {
469 if (h1->layer != h2->layer) return h1->layer < h2->layer;
470 if (h1->w != h2->w) return h1->w > h2->w;
471 if (h1->r != h2->r) return h1->r < h2->r;
473 const double dPhi1 = std::abs(h1->phimax - h1->phimin);
474 const double dPhi2 = std::abs(h2->phimax - h2->phimin);
475 if (dPhi1 != dPhi2) return dPhi1 < dPhi2;
476 if (h1->phimin == h2->phimin) return h1->phimax < h2->phimax;
477 return h1->phimin < h2->phimin;
481 <<
" number of hits " << hits.size());
482 if (msgLvl(MSG::VERBOSE)) localHough.
setDebug(
true);
487 <<
" number of hits " << phiMaximum.
hits.size());
488 phiMaximum.
hough = (*pit)->hough;
503 if (!road.
seed)
return;
510 DetRegIdx region = seed.hough->m_descriptor.region;
513 for (
int lay = 0; lay <
toInt(LayerIndex::LayerIndexMax); ++lay) {
515 if (layer == seedLayer && seed.hough->m_descriptor.sector == sectorData.
sector)
continue;
525 if (maxima.empty())
continue;
528 <<
" size " << maxima.size());
530 for (
const auto& candMaximum : maxima) {
535 ATH_MSG_VERBOSE(
" Adding maximum position " << candMaximum->pos <<
" intersect diff" << yloc_diff);
536 road.
add(candMaximum);
539 << candMaximum->pos <<
" x " << candMaximum->hough->m_descriptor.referencePosition <<
" seed y "
540 << seed.hough->m_descriptor.referencePosition <<
" x " << seed.pos <<
" intersect diff " << yloc_diff);
546 if (seedLayer == LayerIndex::BarrelExtended)
return;
548 ATH_MSG_DEBUG(
"Checking Barrel/Endcap overlaps: min dist edge "
549 << seed.pos - seed.hough->m_descriptor.yMinRange <<
" max dist edge " << seed.pos - seed.hough->m_descriptor.yMaxRange
550 <<
" pos " << seed.pos <<
" range " << seed.hough->m_descriptor.yMinRange <<
" "
551 << seed.hough->m_descriptor.yMaxRange);
553 if (std::abs(seed.pos - seed.hough->m_descriptor.yMinRange) < 4000. ||
554 std::abs(seed.pos - seed.hough->m_descriptor.yMaxRange) < 4000.) {
556 DetRegIdx neighbourRegion = DetRegIdx::Barrel;
557 if (region == DetRegIdx::Barrel) {
559 neighbourRegion = DetRegIdx::EndcapC;
561 neighbourRegion = DetRegIdx::EndcapA;
565 for (
int lay = 0; lay <
toInt(LayerIndex::LayerIndexMax); ++lay) {
569 if (region == DetRegIdx::Barrel && layer == LayerIndex::BarrelExtended)
continue;
571 double distanceCut = 1000.;
576 if (maxima.empty())
continue;
579 <<
" size " << maxima.size());
582 for (
const auto& candMaximum : maxima) {
586 << candMaximum->pos <<
" x " << candMaximum->hough->m_descriptor.referencePosition <<
" seed y "
587 << seed.hough->m_descriptor.referencePosition <<
" x " << seed.pos <<
" intersect diff " << yloc_diff);
589 if (std::abs(yloc_diff) < distanceCut) {
590 road.
add(candMaximum);
598 std::set<const TgcClusterObj3D*> tgcClusters;
599 std::set<Identifier> triggerLayers;
601 for (
const auto& maximum : maxima) {
602 if (maximum->hough->m_descriptor.sector != sectorData.
sector)
606 for (
auto ehit = maximum->hits.begin(); ehit != maximum->hits.end(); ++ehit) {
610 }
else if (etaHit.
prd) {
617 detectorHoughTransforms.
phiHough(region);
622 for (
const auto& phiHit : phiHits) {
624 if (tgcClusters.find(phiHit->tgc) != tgcClusters.end()) phiHitsInMaximum.push_back(phiHit);
625 }
else if (phiHit->prd) {
626 if (triggerLayers.find(
m_idHelperSvc->gasGapId(phiHit->prd->identify())) != triggerLayers.end())
627 phiHitsInMaximum.push_back(phiHit);
633 << phiHitsInMaximum.size() <<
" phi hits: " << phiHits.size());
646 <<
" -> nPhiMaxima: " << sectorData.
phiMaxVec[
toInt(region)].size()
653 ATH_MSG_DEBUG(
"associateMaximaToPhiMaxima: phi maxima " << phiMaxima.size());
654 if (!road.
seed)
return;
657 for (
const auto& pmaximum : phiMaxima) {
660 ATH_MSG_DEBUG(
" new phi maximum " << pmaximum->max <<
" hits " << pmaximum->hits.size());
663 std::map<Identifier, std::pair<float, float>> triggerLayersPhiMinMax;
664 std::map<MuonStationIndex::StIndex, std::set<const TgcClusterObj3D*>> tgcClusters;
667 for (
const auto& phiHit : pmaximum->hits) {
672 if (phiHit->tgc->phiCluster.empty())
675 tgcClusters[
m_idHelperSvc->stationIndex(phiHit->tgc->phiCluster.front()->identify())].insert(phiHit->tgc);
676 }
else if (phiHit->prd) {
678 auto mit = triggerLayersPhiMinMax.find(gpId);
679 if (mit == triggerLayersPhiMinMax.end())
680 triggerLayersPhiMinMax[gpId] = std::make_pair(phiHit->phimin, phiHit->phimax);
682 mit->second.first = std::min(phiHit->phimin, mit->second.first);
683 mit->second.second = std::max(phiHit->phimax, mit->second.second);
688 if (msgLevel(MSG::VERBOSE)) {
689 ATH_MSG_DEBUG(
"Trigger layers " << triggerLayersPhiMinMax.size() <<
" tgc layers " << tgcClusters.size());
690 for (
auto tgcit = triggerLayersPhiMinMax.begin(); tgcit != triggerLayersPhiMinMax.end(); ++tgcit) {
695 std::map<MuonStationIndex::StIndex, std::set<const TgcClusterObj3D*>>
::const_iterator stit = tgcClusters.begin();
696 std::map<MuonStationIndex::StIndex, std::set<const TgcClusterObj3D*>>
::const_iterator stit_end = tgcClusters.end();
697 for (; stit != stit_end; ++stit) {
698 std::set<const TgcClusterObj3D*>::const_iterator ttit = stit->second.begin();
699 std::set<const TgcClusterObj3D*>::const_iterator ttit_end = stit->second.end();
700 for (; ttit != ttit_end; ++ttit) {
702 << (*ttit)->phiCluster.size());
711 float phimin{10}, phimax{-10};
714 for (
const auto& road_max : road.
maxima) {
719 for (
const auto& etaHit : road_max->hits) {
721 if (etaHit->tgc->etaCluster.empty())
724 if (tgcClusters[stIndex].
count(etaHit->tgc)) {
726 for (
const auto& phiHit : pmaximum->hits) {
727 if (phiHit->tgc == etaHit->tgc) {
728 phimin = std::min(phiHit->phimin, phimin);
729 phimax = std::max(phiHit->phimax, phimax);
738 }
else if (etaHit->prd) {
741 auto mit = triggerLayersPhiMinMax.find(gpId);
742 if (mit == triggerLayersPhiMinMax.end())
745 phimin = std::min(mit->second.first, phimin);
746 phimax = std::max(mit->second.second, phimax);
757 std::vector<int> sectors;
759 if (sectors.size() > 1) {
760 for (
const int& sec : sectors) {
764 std::vector<int> sectors;
766 if (sectors.size() > 1) {
767 for (
const int& sec : sectors) {
773 ATH_MSG_DEBUG(
" Overlap with Phi maximum: overlap " << noverlaps <<
" no overlap " << nNoOverlaps <<
" phimin " << phimin
774 <<
" phimax " << phimax <<
" neighbouring sector "
782 std::vector<MuonLayerHoughTool::HoughDataPerSector>& houghDataPerSectorVec)
const {
786 for (
unsigned int regLay = 0; regLay < houghData.
maxVec.size(); ++regLay) {
788 int sector = houghData.
sector;
791 for (
int i = 0; i < 2; ++i) {
793 int sectorN = (i == 0) ? sector - 1 : sector + 1;
794 if (i == 0 && sector == 1) sectorN = 16;
795 if (i == 1 && sector == 16) sectorN = 1;
802 for (
const auto& maximum : maxima) {
805 if (!maximum->hough) {
811 for (
const auto& maximumN : maximaN) {
813 if (!maximumN->hough) {
819 double rcor = maximumN->hough->m_descriptor.referencePosition *
820 m_sectorMapping.transformRToNeighboringSector(maximum->pos, sector, sectorN) /
821 maximum->hough->m_descriptor.referencePosition;
822 double dist = rcor - maximumN->pos;
823 ATH_MSG_DEBUG(
" maximumN->hough " << maximumN->hough->m_descriptor.referencePosition <<
" maximum->hough "
824 << maximum->hough->m_descriptor.referencePosition <<
" maximumN->pos "
825 << maximumN->pos <<
" maximum->pos " << maximum->pos << rcor <<
" distance "
827 if (std::abs(dist) > 100)
continue;
831 ATH_MSG_DEBUG(
" Found maximum in neighbouring sector: max " << maximum->max <<
" pos " << rcor <<
" maxN "
832 << maximumN->max <<
" pos " << maximumN->pos
833 <<
" distance " << dist);
836 for (
int nn = 0; nn < 2; ++nn) {
838 const auto& maxi = nn == 0 ? maximum : maximumN;
839 const auto& maxi2 = nn == 0 ? maximumN : maximum;
841 for (
auto& hit : maxi->hits) {
842 if (hit->debugInfo()) {
843 hit->debugInfo()->phn = maxi2->max;
844 Identifier id = hit->tgc ? hit->tgc->etaCluster.front()->identify() : hit->prd->identify();
857 std::map<MuonHough::MuonPhiLayerHough::Maximum*, MuonLayerHoughTool::MaximumVec>& phiEtaAssociations,
859 std::set<std::shared_ptr<MuonHough::MuonLayerHough::Maximum>> associatedMaxima;
863 ATH_MSG_DEBUG(
"associateMaximaToPhiMaxima in sector " << houghData.
sector <<
": phi maxima " << phiMaxima.size());
865 for (
const auto& phiMaximum : phiMaxima) {
868 ATH_MSG_DEBUG(
" Considering phi maximum " << phiMaximum->max <<
" hits " << phiMaximum->hits.size());
875 std::set<Identifier> triggerLayers;
876 std::map<MuonStationIndex::StIndex, std::set<const TgcClusterObj3D*>> tgcClusters;
879 for (
const auto& phiHit : phiMaximum->hits) {
881 if (phiHit->tgc->phiCluster.empty())
884 tgcClusters[
m_idHelperSvc->stationIndex(phiHit->tgc->phiCluster.front()->identify())].insert(phiHit->tgc);
885 }
else if (phiHit->prd) {
888 triggerLayers.insert(layId);
891 if (msgLvl(MSG::DEBUG)) {
892 ATH_MSG_DEBUG(
"Trigger layers " << triggerLayers.size() <<
" tgc layers " << tgcClusters.size());
895 std::map<MuonStationIndex::StIndex, std::set<const TgcClusterObj3D*>>
::const_iterator stit = tgcClusters.begin();
896 std::map<MuonStationIndex::StIndex, std::set<const TgcClusterObj3D*>>
::const_iterator stit_end = tgcClusters.end();
897 for (; stit != stit_end; ++stit) {
898 std::set<const TgcClusterObj3D*>::const_iterator ttit = stit->second.begin();
899 std::set<const TgcClusterObj3D*>::const_iterator ttit_end = stit->second.end();
900 for (; ttit != ttit_end; ++ttit) {
902 << (*ttit)->phiCluster.size());
910 for (
unsigned int lay = 0; lay <
toInt(LayerIndex::LayerIndexMax); ++lay) {
914 if (maxima.empty())
continue;
918 for (
const auto& maximum : maxima) {
924 int ntrigconfirm = 0;
925 MaximumAssociationMap::iterator pos = houghData.
maxAssociationMap.find(maximum.get());
927 for (
const auto& max_itr : pos->second) {
928 totmax = std::max(max_itr->max, totmax);
929 ntrigconfirm += max_itr->triggerConfirmed;
932 totmax += maximum->max;
933 ntrigconfirm += maximum->triggerConfirmed;
936 <<
" neightbour confirmed value " << totmax <<
" trigger confirmations "
940 int nmmHits{0}, ntgcOverlaps{0}, nrpcOverlaps{0}, nstgcOverlaps{0}, nstgcNoOverlaps{0};
943 for (
const auto& etaHit : maximum->hits) {
945 if (tgcClusters[stIndex].
count(etaHit->tgc))
948 }
else if (etaHit->prd) {
952 if (triggerLayers.count(layId)) {
965 if (nmmHits + nstgcNoOverlaps + nstgcOverlaps > 0) {
967 if (maximum->pos < 1200.) {
969 ATH_MSG_DEBUG(
" maximum failed cut " << totmax <<
" cut 8, position " << maximum->pos);
972 }
else if (maximum->pos > 4300.) {
974 ATH_MSG_DEBUG(
" maximum failed cut " << totmax <<
" cut 8, position " << maximum->pos);
979 ATH_MSG_DEBUG(
" maximum failed cut " << totmax <<
" cut 12, position " << maximum->pos);
985 ATH_MSG_DEBUG(
" Overlap with Phi maximum: tgc " << ntgcOverlaps <<
" stgc " << nstgcOverlaps <<
" rpc " << nrpcOverlaps
986 <<
" nphiTgc " << tgcClusters[stIndex].size() <<
" trigLay "
987 << triggerLayers.size());
988 if (stIndex == StIndex::EM && !tgcClusters[stIndex].
empty() && ntgcOverlaps == 0) {
990 << ntgcOverlaps <<
" on phi maximum "
991 << tgcClusters[stIndex].size());
994 if (stIndex == StIndex::EI && !tgcClusters[stIndex].
empty() && ntgcOverlaps == 0) {
996 << ntgcOverlaps <<
" on phi maximum "
997 << tgcClusters[stIndex].size());
1000 if (stIndex == StIndex::EI && nstgcOverlaps == 0 && nstgcNoOverlaps != 0) {
1002 <<
" stgcs without overlaps " << nstgcNoOverlaps);
1008 associatedMaxima.insert(maximum);
1009 associatedMaximaVec.push_back(maximum);
1013 associatedMaxima.insert(pos->second.begin(), pos->second.end());
1014 associatedMaximaVec.insert(associatedMaximaVec.end(), pos->second.begin(), pos->second.end());
1019 if (associatedMaximaVec.empty())
continue;
1020 ATH_MSG_DEBUG(
" processed phi maximum, associated eta maxima " << associatedMaximaVec.size());
1021 phiEtaAssociations[phiMaximum.get()] = std::move(associatedMaximaVec);
1026 for (
unsigned int lay = 0; lay <
toInt(LayerIndex::LayerIndexMax); ++lay) {
1030 if (lay >= unassEtaMaxima.size()) {
1031 ATH_MSG_WARNING(
" size of unassEtaMaxima too small for region " << unassEtaMaxima.size() <<
" region "
1038 for (
const auto& mit : maxima) {
1039 if (associatedMaxima.count(mit))
continue;
1040 unassEtaMaxima[lay].push_back(mit);
1048 ATH_MSG_DEBUG(
"Creating pattern combinations for eta patterns ");
1050 std::vector<MuonPatternChamberIntersect> chamberData;
1055 for (
const auto& max_sec : maxima) {
1057 std::map<Identifier, std::set<const Trk::PrepRawData*>> prdsPerChamber;
1060 for (
const auto&
max : max_sec) {
1064 if (
max->hits.empty()) {
1071 for (
const auto& hit :
max->hits) {
1074 prdsPerChamber[chId].insert(hit->tgc->etaCluster.begin(), hit->tgc->etaCluster.end());
1075 }
else if (hit->prd) {
1076 const Identifier chId =
m_idHelperSvc->chamberId(hit->prd->identify());
1077 prdsPerChamber[chId].insert(hit->prd);
1082 auto sortPrdIds = [](
const Trk::PrepRawData* prd1,
const Trk::PrepRawData* prd2) {
1083 return prd1->
identify() < prd2->identify();
1085 std::map<Identifier, std::set<const Trk::PrepRawData*>>::iterator chit = prdsPerChamber.begin();
1086 std::map<Identifier, std::set<const Trk::PrepRawData*>>::iterator chit_end = prdsPerChamber.end();
1087 for (; chit != chit_end; ++chit) {
1089 std::vector<const Trk::PrepRawData*> prds;
1090 prds.insert(prds.end(), chit->second.begin(), chit->second.end());
1092 const Trk::PrepRawData& prd = **prds.begin();
1095 ATH_MSG_DEBUG(
"Adding chamber with intersect phi direction " << gpos.phi() <<
" theta " << gpos.theta());
1096 MuonPatternChamberIntersect
intersect(gpos, gpos.unit(), prds);
1097 chamberData.push_back(intersect);
1100 if (chamberData.empty())
return;
1102 MuonPatternCombination* combi =
new MuonPatternCombination(
nullptr, chamberData);
1109 std::map<MuonHough::MuonPhiLayerHough::Maximum*, MuonLayerHoughTool::MaximumVec>& phiEtaAssociations,
1111 ATH_MSG_DEBUG(
"Creating pattern combinations from eta/phi combinations " << phiEtaAssociations.size());
1114 std::map<MuonHough::MuonPhiLayerHough::Maximum*, MaximumVec>::const_iterator pit = phiEtaAssociations.begin();
1115 std::map<MuonHough::MuonPhiLayerHough::Maximum*, MaximumVec>::const_iterator pit_end = phiEtaAssociations.end();
1116 for (; pit != pit_end; ++pit) {
1117 if (pit->second.empty())
continue;
1120 std::map<Identifier, std::set<const Trk::PrepRawData*>> phiHitsPerChamber;
1123 for (
const auto& hit : pit->first->hits) {
1126 phiHitsPerChamber[chId].insert(hit->tgc->phiCluster.begin(), hit->tgc->phiCluster.end());
1127 }
else if (hit->prd) {
1129 phiHitsPerChamber[chId].insert(hit->prd);
1134 std::vector<MuonPatternChamberIntersect> chamberData;
1135 std::set<Identifier> addedPhiHits;
1138 std::map<Identifier, std::set<const Trk::PrepRawData*>> prdsPerChamber;
1141 std::map<MuonStationIndex::ChIndex, std::pair<Amg::Vector3D, Amg::Vector3D>> directionsPerChamberLayer;
1144 for (
const auto&
max : pit->second) {
1150 if (
max->hits.empty()) {
1157 for (
const auto& hit :
max->hits) {
1160 chId =
m_idHelperSvc->chamberId(hit->tgc->etaCluster.front()->identify());
1161 prdsPerChamber[chId].insert(hit->tgc->etaCluster.begin(), hit->tgc->etaCluster.end());
1162 }
else if (hit->prd) {
1164 prdsPerChamber[chId].insert(hit->prd);
1171 if (!directionsPerChamberLayer.count(
chIndex)) {
1173 double maxpos =
max->pos;
1174 double refPlane = 0.;
1177 refPlane =
max->hough->m_descriptor.referencePosition;
1179 refPlane = hit->tgc->getEdge(TgcEdge::LowEtaLowPhi).z();
1181 refPlane = hit->prd->detectorElement()->surface(hit->prd->identify()).center().perp();
1183 refPlane = hit->prd->detectorElement()->surface(hit->prd->identify()).center().z();
1185 double r =
isBarrel ? refPlane : maxpos;
1186 double z =
isBarrel ? maxpos : refPlane;
1197 double phi = pit->first->pos;
1200 double sinphi = scphi.
sn;
1201 double cosphi = scphi.
cs;
1204 double sintheta = sctheta.
sn;
1205 double costheta = sctheta.
cs;
1207 std::pair<Amg::Vector3D, Amg::Vector3D>& posDir = directionsPerChamberLayer[
chIndex];
1211 <<
" setting position: perp " << posDir.first.perp() <<
" z " << posDir.first.z() <<
" phi pos "
1212 << posDir.first.phi() <<
" direction phi " << posDir.second.phi() <<
" theta pos "
1213 << posDir.first.theta() <<
" direction theta " << posDir.second.theta() <<
" ref perp " <<
r <<
" z "
1214 <<
z <<
" phi " <<
phi <<
" theta " <<
theta);
1215 if (posDir.first.dot(posDir.second) < 0.) {
1216 ATH_MSG_WARNING(
" direction not pointing to IP " << posDir.first.unit().dot(posDir.second));
1220 std::map<Identifier, std::set<const Trk::PrepRawData*>>
::iterator pos = phiHitsPerChamber.find(chId);
1221 if (pos != phiHitsPerChamber.end()) {
1222 std::pair<std::set<Identifier>::iterator,
bool> ipos = addedPhiHits.insert(chId);
1223 if (ipos.second) { prdsPerChamber[chId].insert(pos->second.begin(), pos->second.end()); }
1229 return prd1->
identify() < prd2->identify();
1231 std::map<Identifier, std::set<const Trk::PrepRawData*>>
::iterator chit = prdsPerChamber.begin();
1232 std::map<Identifier, std::set<const Trk::PrepRawData*>>
::iterator chit_end = prdsPerChamber.end();
1233 for (; chit != chit_end; ++chit) {
1235 std::vector<const Trk::PrepRawData*> prds;
1236 prds.insert(prds.end(), chit->second.begin(), chit->second.end());
1241 std::map<MuonStationIndex::ChIndex, std::pair<Amg::Vector3D, Amg::Vector3D>>
::const_iterator pos =
1242 directionsPerChamberLayer.find(
chIndex);
1245 if (pos != directionsPerChamberLayer.end()) {
1246 gpos = pos->second.first;
1247 gdir = pos->second.second;
1249 ATH_MSG_WARNING(
"No global position and direction found, calculating from surface");
1251 gdir = -1 * gpos.unit();
1255 <<
" z " << gpos.z() <<
" phi pos " << gpos.phi() <<
" direction phi " << gdir.phi()
1256 <<
" theta pos " << gpos.theta() <<
" theta " << gdir.theta() <<
" hits "
1261 chamberData.push_back(intersect);
1264 if (chamberData.empty())
continue;
1265 if (addedPhiHits.empty()) {
1270 ATH_MSG_DEBUG(
"adding pattern combination with chambers " << chamberData.size() <<
" phi layers " << addedPhiHits.size()
1280 if (hits.empty())
return false;
1283 if (hough.m_descriptor.chIndex == ChIndex::ChUnknown || hough.m_descriptor.chIndex == ChIndex::ChIndexMax) {
1284 Identifier id = hits.front()->tgc ? hits.front()->tgc->etaCluster.front()->identify() : hits.front()->prd->identify();
1292 hough.fillLayer2(hits);
1294 Identifier id_hit = hits.front()->tgc ? hits.front()->tgc->etaCluster.front()->identify() : hits.front()->prd->identify();
1307 unsigned int nmaxima = 0;
1308 while (nmaxima < 5) {
1310 if (hough.findMaximum(maximum, selectorLoose)) {
1311 hough.associateHitsToMaximum(maximum, hits);
1313 << nmaxima <<
" " << maximum.
max <<
" trigConfirmed " << maximum.
triggerConfirmed <<
" pos " << maximum.
pos
1314 <<
" theta " << maximum.
theta <<
" binPos " << maximum.
binpos <<
" binRange " << maximum.
binposmin <<
" -- "
1321 const unsigned int nHitsInMaximum = maximum.
hits.size();
1322 for (
unsigned int i = 0; i < nHitsInMaximum; ++i) {
1335 if (nmdt > 0 || (nmm + nstgc) > 0) {
1336 maxima.emplace_back(std::make_unique<MuonHough::MuonLayerHough::Maximum>(maximum));
1338 if (maximum.
max > selector.getCutValue(maximum.
pos)) seedMaxima.push_back(maxima.back());
1341 hough.fillLayer2(maximum.
hits,
true);
1343 if (nmaxima > 0) {
ATH_MSG_VERBOSE(
"findMaxima: No more maxima found " << nmaxima); }
1353 if (hits.empty())
return false;
1357 hough.fillLayer2(hits);
1359 unsigned int nmaxima = 0;
1360 while (nmaxima < 5) {
1362 if (hough.findMaximum(maximum, 1.9)) {
1363 hough.associateHitsToMaximum(maximum, hits);
1365 ATH_MSG_DEBUG(
"findMaxima(Phi): Found Phi maximum " << nmaxima <<
" height " << maximum.
max <<
" pos " << maximum.
pos
1367 <<
" -- " << maximum.
binposmax <<
" nHits " << maximum.
hits.size());
1369 const unsigned int nHitsInMaximum = maximum.
hits.size();
1370 for (
unsigned int i = 0; i < nHitsInMaximum; ++i) {
1381 bool maximum_matched =
false;
1382 for (
auto pit = maxima.begin(); pit != maxima.end(); ++pit) {
1388 ATH_MSG_DEBUG(
"extendSeed: sector has already been added! Skip. ");
1389 bool maximum_hitmatched =
true;
1390 for (
unsigned int k = 0; k < maximum.
hits.size(); ++k) {
1391 if (maximum.
hits[k] != pmaximum.
hits[k]) {
1392 maximum_hitmatched =
false;
1396 if (maximum_hitmatched) {
1397 maximum_matched =
true;
1403 hough.fillLayer2(maximum.
hits,
true);
1404 if (maximum_matched) {
1408 maxima.push_back(std::make_shared<MuonHough::MuonPhiLayerHough::Maximum>(maximum));
1412 if (nmaxima > 0) {
ATH_MSG_VERBOSE(
"findMaxima(Phi): No more maxima found " << nmaxima); }
1427 houghData.
sector = sector;
1432 if (hashes.empty())
continue;
1437 if (mdtCont && !mdtCont->
empty() && tech ==
toInt(TechnologyIndex::MDT)) {
1440 }
else if (rpcCont && !rpcCont->
empty() && tech ==
toInt(TechnologyIndex::RPC)) {
1443 }
else if (tgcCont && !tgcCont->
empty() && tech ==
toInt(TechnologyIndex::TGC)) {
1448 }
else if (stgcCont && !stgcCont->
empty() && tech ==
toInt(TechnologyIndex::STGC)) {
1452 collectionsPerSector.
sector);
1453 }
else if (mmCont && !mmCont->
empty() && tech ==
toInt(TechnologyIndex::MM)) {
1464 typedef PRD_MultiTruthCollection::const_iterator iprdt;
1465 std::pair<iprdt, iprdt> range = truthCol.equal_range(
id);
1467 for (iprdt i = range.first; i != range.second; ++i) {
1468 if (!i->second.isValid()) {
1469 ATH_MSG_WARNING(
"Unexpected invalid HepMcParticleLink in PRD_MultiTruthCollection");
1472 if (link.
cptr() && abs(link.
cptr()->pdg_id()) == 13) {
1475 truthHits.insert(
id);
1483 if (mdts.
empty())
return;
1490 bool barrelLike = (region == DetRegIdx::Barrel || layer == LayerIndex::BarrelExtended);
1491 unsigned int nmdts(mdts.
size()), nmdtsBad{0};
1498 float r =
rCor(*prd);
1499 float x = barrelLike ?
r : prd->globalPosition().z();
1500 float y = barrelLike ? prd->globalPosition().z() :
r;
1501 int sublayer =
sublay(
id);
1506 debug->time = prd->tdc();
1509 std::map<unsigned int, unsigned int>::const_iterator pos =
m_techToTruthNameIdx.find(technology);
1512 hits.emplace_back(hit);
1517 <<
" -> hits: " << nmdts <<
" bad " << nmdtsBad <<
" isSmallChamber "
1531 unsigned int neta{0}, nphi{0};
1539 <<
" -> eta hits " << neta <<
" phi hits " << nphi);
1542 int sublayer =
sublay(
id);
1544 debug->isEtaPhi = (neta && nphi);
1545 debug->trigConfirm = 1;
1546 debug->time = prd->time();
1547 std::map<unsigned int, unsigned int>::const_iterator pos =
m_techToTruthNameIdx.find(technology);
1549 float weight = (neta && nphi) ? 2 : 1;
1551 const float r =
rCor(*prd);
1552 const float phi = prd->globalPosition().phi();
1553 const double phi1 =
phi;
1556 phiHits.emplace_back(hit);
1558 const float x =
rCor(*prd);
1559 const float y = prd->globalPosition().z();
1560 const float stripCor = 0.5 * prd->
detectorElement()->StripWidth(
false);
1561 const float ymin =
y - stripCor;
1562 const float ymax =
y + stripCor;
1563 debug->r = stripCor;
1565 hits.emplace_back(hit);
1571 if (rpcs.
empty())
return;
1579 unsigned int neta{0}, nphi{0};
1587 <<
" -> eta hits " << neta <<
" phi hits " << nphi);
1591 int sublayer =
sublay(
id);
1593 debug->isEtaPhi = (neta && nphi);
1594 debug->trigConfirm = 1;
1595 debug->time = prd->time();
1596 std::map<unsigned int, unsigned int>::const_iterator pos =
m_techToTruthNameIdx.find(technology);
1598 float weight = (neta && nphi) ? 2 : 1;
1600 const float r =
rCor(*prd);
1601 const float phi = prd->globalPosition().phi();
1602 const double phi1 =
phi;
1605 phiHits.emplace_back(hit);
1607 const float x =
rCor(*prd);
1608 const float y = prd->globalPosition().z();
1609 const float stripCor = 0.5 * prd->
detectorElement()->StripWidth(
false);
1610 const float ymin =
y - stripCor;
1611 const float ymax =
y + stripCor;
1612 debug->r = stripCor;
1614 hits.emplace_back(hit);
1621 if (mms.
empty())
return;
1632 std::array<double,8> multiplicity{};
1635 int sublayer =
sublay(
id) % 10;
1636 multiplicity[sublayer]++;
1639 if( msgLvl(MSG::DEBUG) ){
1640 for (
int i = 0; i<8 ; i++)
if(multiplicity[i]>0)
ATH_MSG_DEBUG(
" sublayer " << i <<
" hits " << multiplicity[i]);
1645 float x = prd->globalPosition().z();
1646 float y =
rCor(*prd);
1647 int sublayer =
sublay(
id) % 10;
1649 float ymin =
y - stripCor;
1650 float ymax =
y + stripCor;
1653 const double weight = 1. / std::max(1., multiplicity[sublayer]);
1656 debug->r = stripCor;
1657 std::map<unsigned int, unsigned int>::const_iterator pos =
m_techToTruthNameIdx.find(technology);
1659 std::unique_ptr<MuonHough::Hit> hit = std::make_unique<MuonHough::Hit>(sublayer,
x,
ymin,
ymax, weight,
debug, prd);
1660 hits.emplace_back(std::move(hit));
1666 if (stgcs.
empty())
return;
1672 bool isNeighbouringSector = sector != selectedSector;
1676 <<
" -> hits: " << stgcs.
size());
1680 int channelType =
m_idHelperSvc->stgcIdHelper().channelType(
id);
1683 if (isNeighbouringSector && channelType == 1)
continue;
1684 int sublayer =
sublay(
id);
1686 std::unique_ptr<MuonHough::HitDebugInfo>
debug =
1687 std::make_unique<MuonHough::HitDebugInfo>(technology, sector, region, layer, sublayer);
1688 debug->isEtaPhi = 1;
1689 debug->trigConfirm =
true;
1691 std::map<unsigned int, unsigned int>::const_iterator pos =
m_techToTruthNameIdx.find(technology);
1695 float x = prd->globalPosition().z();
1696 float y =
rCor(*prd);
1697 float stripCor = 1.5;
1703 stripCor = 0.5 * stripWidth;
1705 debug->r = stripCor;
1706 float ymin =
y - stripCor;
1707 float ymax =
y + stripCor;
1709 hits.emplace_back(hit);
1721 ATH_MSG_DEBUG(
" Pad chWidth " << chWidth <<
" phi global " << prd->globalPosition().phi());
1722 }
else if (
m_idHelperSvc->stgcIdHelper().channelType(
id) == 2) {
1729 ATH_MSG_DEBUG(
" Wire Gang chWidth " << chWidth <<
" phi global " << prd->globalPosition().phi());
1740 double phi1 = gp1.phi();
1741 double phi2 = gp2.phi();
1742 double phi1c = phi1;
1743 double phi2c = phi2;
1745 if (phi_check > 0.3) {
1746 ATH_MSG_WARNING(
"bad local phi: in " << phi1 <<
", " << phi2 <<
" sector phi "
1747 <<
m_sectorMapping.sectorPhi(selectedSector) <<
" phicor " << phi1c <<
", "
1750 if (isNeighbouringSector &&
1753 << std::min(phi1c, phi2c) <<
" max " << std::max(phi1c, phi2c)
1754 <<
" global phi: in " << phi1 <<
", " << phi2 <<
" sector phi "
1758 float r =
rCor(*prd);
1759 float phiMin = std::min(phi1c, phi2c);
1760 float phiMax = std::max(phi1c, phi2c);
1762 << phiMax <<
" bc " <<
debug->uniqueID <<
" chw " << chWidth <<
" trigC "
1763 <<
debug->trigConfirm <<
" g phi " << phi1 <<
" " << phi2);
1766 phiHits.emplace_back(phiHit);
1772 std::vector<std::unique_ptr<TgcHitClusteringObj>>& tgcClusteringObjs,
const TgcPrepDataCollection& tgcs,
1774 if (tgcs.
empty())
return;
1775 tgcClusteringObjs.push_back(std::make_unique<TgcHitClusteringObj>(&
m_idHelperSvc->tgcIdHelper()));
1777 std::vector<const TgcPrepData*> prds;
1778 prds.insert(prds.begin(), tgcs.
begin(), tgcs.
end());
1788 if (msgLvl(MSG::DEBUG)) {
1794 ATH_MSG_DEBUG(
"TgcHitClusteringObj, no eta cluster selected! ");
1795 if (msgLvl(MSG::DEBUG)) {
1801 std::vector<int> sectors;
1804 for (
unsigned int si = 0; si < sectors.size(); ++si) {
1805 if (sectors[si] != sector)
continue;
1808 const Identifier id = cl.etaCluster.front()->identify();
1810 double x = cl.getEdge(TgcEdge::LowEtaLowPhi).z();
1811 double y11 =
rCor(cl, TgcEdge::LowEtaLowPhi, sector);
1812 double y12 =
rCor(cl, TgcEdge::LowEtaHighPhi, sector);
1813 double y21 =
rCor(cl, TgcEdge::LowEtaLowPhi, sector);
1814 double y22 =
rCor(cl, TgcEdge::HighEtaHighPhi, sector);
1815 double phi11 = cl.getEdge(TgcEdge::LowEtaLowPhi).phi();
1816 double phi12 = cl.getEdge(TgcEdge::LowEtaHighPhi).phi();
1817 double phi21 = cl.getEdge(TgcEdge::LowEtaLowPhi).phi();
1818 double phi22 = cl.getEdge(TgcEdge::HighEtaHighPhi).phi();
1819 double ymin = std::min(std::min(y11, y12), std::min(y21, y22));
1820 double ymax = std::max(std::max(y11, y12), std::max(y21, y22));
1821 double phimin = std::min(std::min(phi11, phi12), std::min(phi21, phi22));
1822 double phimax = std::max(std::max(phi11, phi12), std::max(phi21, phi22));
1823 double phi1 = phimin;
1824 double phi2 = phimax;
1827 <<
", y12: "<<y12<<
", y21: "<<y21<<
", y22: "<<y22<<
", phi11: "<<phi11<<
", "
1828 <<
"phi12: "<<phi12<<
", phi21: "<<phi21<<
", phi22: "<<phi22<<
" ymin: "<<
ymin<<
", ymax: "<<
ymax
1829 <<
", phimin: "<<phimin<<
", phimax: "<<phimax);
1832 debug->clusterSize = cl.etaCluster.size();
1833 debug->clusterLayers = 2;
1834 debug->isEtaPhi =
true;
1835 debug->time = cl.etaCluster.front()->getBcBitMap();
1836 std::map<unsigned int, unsigned int>::const_iterator pos =
m_techToTruthNameIdx.find(technology);
1844 std::unique_ptr<MuonHough::Hit> hit = std::make_unique<MuonHough::Hit>(sublayer,
x,
ymin,
ymax, 2,
debug,
nullptr, &cl);
1845 std::unique_ptr<MuonHough::PhiHit> phiHit =
1846 std::make_unique<MuonHough::PhiHit>(sublayer, y11, phi1, phi2, 2, phiDebug,
nullptr, &cl);
1847 hits.emplace_back(std::move(hit));
1848 phiHits.emplace_back(std::move(phiHit));
1853 <<
" -> etaHits: " << hits.size() <<
" phiHits: " << phiHits.size()
1854 <<
" sectors: " << sectors.size());
1864 m_collectionsPerSector[sector - 1].technologyRegionHashVecs[
toInt(techIndex)][
sectorLayerHash].push_back(hash);
1869 if (m_sectorSetup)
return;
1870 std::lock_guard kuchen(m_mutex);
1872 if (m_sectorSetup)
return;
1877 for (
unsigned int i = 0; i < m_collectionsPerSector.size(); ++i) {
1878 m_collectionsPerSector[i].sector = i + 1;
1879 m_collectionsPerSector[i].technologyRegionHashVecs.resize(
m_ntechnologies);
1880 for (
auto it = m_collectionsPerSector[i].technologyRegionHashVecs.begin();
1881 it != m_collectionsPerSector[i].technologyRegionHashVecs.end(); ++it) {
1882 it->resize(nsectorHashMax);
1890 auto loadHashes = [
this] (
const MuonIdHelper& idHelper){
1891 auto it = idHelper.module_begin();
1892 const auto it_end = idHelper.module_end();
1893 for (; it != it_end; ++it) {
1895 idHelper.get_module_hash(*it, hash);
1911 auto it =
m_idHelperSvc->mmIdHelper().detectorElement_begin();
1912 const auto it_end =
m_idHelperSvc->mmIdHelper().detectorElement_end();
1913 for (; it != it_end; ++it) {
1921 auto it =
m_idHelperSvc->stgcIdHelper().detectorElement_begin();
1922 const auto it_end =
m_idHelperSvc->stgcIdHelper().detectorElement_end();
1923 for (; it != it_end; ++it) {
1928 int sectorU = sector != 1 ? sector - 1 : 16;
1929 int sectorD = sector != 16 ? sector + 1 : 1;
1938 const auto it_end =
m_idHelperSvc->tgcIdHelper().module_end();
1939 for (; it != it_end; ++it) {
1943 int nstrips = detEl->
nStrips(1);
1946 std::vector<int> sectors1{}, sectors2{};
1949 std::unordered_set<int> added{};
1950 for (
const int sector : sectors1) {
1952 added.insert(sector);
1954 for (
const int sector: sectors2) {
1955 if (added.insert(sector).second){
1964 for (
int sector = 1; sector <= 16; ++sector) {
1965 DetRegIdx currentRegion = DetRegIdx::DetectorRegionUnknown;
1968 for (
unsigned int hash = 0; hash < nsectorHashMax; ++hash) {
1969 std::pair<DetRegIdx, MuonStationIndex::LayerIndex> regionLayer =
1974 currentRegion = regionLayer.first;
1978 if (msgLvl(MSG::DEBUG)) {
1985 <<
" " << std::setw(4) <<
vec[tech][hash].size());
1991 m_sectorSetup =
true;
1995 if (truth.size() == found.size()) {
1996 ATH_MSG_DEBUG(
" All hits found: truth " << truth.size() <<
" found " << found.size());
1998 ATH_MSG_DEBUG(
" Some truth hits not found: truth " << truth.size() <<
" found " << found.size());
1999 std::vector<Identifier>
result(truth.size() - found.size());
2000 std::vector<Identifier>::iterator pos =
2001 std::set_difference(truth.begin(), truth.end(), found.begin(), found.end(),
result.begin());
2003 for (std::vector<Identifier>::iterator it =
result.begin(); it !=
result.end(); ++it) {
Scalar phi() const
phi method
Scalar theta() const
theta method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
std::vector< size_t > vec
DataVector< Muon::MuonPatternCombination > MuonPatternCombinationCollection
This typedef represents a collection of MuonPatternCombination objects.
DataVector< Muon::MuonSegmentCombination > MuonSegmentCombinationCollection
This typedef represents a collection of MuonSegmentCombination objects.
static const Attributes_t empty
value_type push_back(value_type pElem)
Add an element to the end of the collection.
const_iterator end() const noexcept
const_iterator begin() const noexcept
size_type size() const noexcept
bool empty() const noexcept
a link optimized in size for a GenParticle in a McEventCollection
HepMC::ConstGenParticlePtr cptr() const
Dereference.
bool empty() const
return true if container is empty
virtual const T * indexFindPtr(IdentifierHash hashId) const override final
return pointer on the found entry or null if out of range using hashed index - fast version,...
This is a "hash" representation of an Identifier.
A TgcReadoutElement corresponds to a single TGC chamber; therefore typically a TGC station contains s...
Amg::Vector3D channelPos(const Identifier &id) const
Returns the position of the active channel (wireGang or strip)
int nStrips(int gasGap) const
Returns the number of strips in a given gas gap.
struct containing additional debug information on the hits that is not needed for the actual alg but ...
int clusterLayers
cluster size
bool isEtaPhi
number of layers in the cluster
int clusterSize
index of reconstructed muon
struct containing all hit information needed for the Hough transform
const Trk::PrepRawData * prd
access to assiciated hit, either the prd or the tgc pointer is set in athena
const Muon::TgcClusterObj3D * tgc
class managing all Hough transforms in the detector
MuonPhiLayerHough & phiHough(DetRegIdx region)
access phi transform
Class representing clusters from the CSC.
Class to represent MM measurements.
Class to represent measurements from the Monitored Drift Tubes.
This class holds information needed for the Moore and MoMu pattern recognition for a muon chamber.
The MuonPatternCombination class provides the means to store the output of the initial global pattern...
virtual Identifier identify() const override final
Class to represent RPC measurements.
Class to represent TGC measurements.
Class to represent sTgc measurements.
A PRD is mapped onto all contributing particles.
virtual const TrkDetElementBase * detectorElement() const =0
return the detector element corresponding to this PRD The pointer will be zero if the det el is not d...
const Amg::Vector2D & localPosition() const
return the local position reference
Identifier identify() const
return the identifier
const Amg::Vector3D & center() const
Returns the center position of the Surface.
virtual void localToGlobal(const Amg::Vector2D &locp, const Amg::Vector3D &mom, Amg::Vector3D &glob) const =0
Specified by each surface type: LocalToGlobal method without dynamic memory allocation.
virtual const Surface & surface() const =0
Return surface associated with this detector element.
std::vector< std::string > intersection(std::vector< std::string > &v1, std::vector< std::string > &v2)
int count(std::string s, const std::string ®x)
count how many occurances of a regx are in a string
std::optional< double > intersect(const AmgVector(N)&posA, const AmgVector(N)&dirA, const AmgVector(N)&posB, const AmgVector(N)&dirB)
Calculates the point B' along the line B that's closest to a second line A.
Eigen::Matrix< double, 2, 1 > Vector2D
Eigen::Matrix< double, 3, 1 > Vector3D
std::vector< std::shared_ptr< MuonHough::PhiHit > > PhiHitVec
float extrapolate(const MuonLayerHough::Maximum &ref, const MuonLayerHough::Maximum &ex, bool doparabolic=false)
StIndex
enum to classify the different station layers in the muon spectrometer
const std::string & layerName(LayerIndex index)
convert LayerIndex into a string
ChIndex chIndex(const std::string &index)
convert ChIndex name string to enum
TechnologyIndex
enum to classify the different layers in the muon spectrometer
DetectorRegionIndex
enum to classify the different layers in the muon spectrometer
StIndex toStationIndex(ChIndex index)
convert ChIndex into StIndex
constexpr unsigned numberOfSectors()
return total number of sectors
std::pair< DetectorRegionIndex, LayerIndex > decomposeSectorLayerHash(unsigned int hash)
decompose the hash into Region and Layer
constexpr int toInt(const EnumType enumVal)
constexpr unsigned int sectorLayerHashMax()
maximum create a hash out of region and layer
bool isBarrel(const ChIndex index)
Returns true if the chamber index points to a barrel chamber.
unsigned int sectorLayerHash(DetectorRegionIndex detectorRegionIndex, LayerIndex layerIndex)
create a hash out of region and layer
const std::string & stName(StIndex index)
convert StIndex into a string
const std::string & technologyName(TechnologyIndex index)
convert LayerIndex into a string
const std::string & chName(ChIndex index)
convert ChIndex into a string
const std::string & regionName(DetectorRegionIndex index)
convert DetectorRegionIndex into a string
LayerIndex toLayerIndex(ChIndex index)
convert ChIndex into LayerIndex
LayerIndex
enum to classify the different layers in the muon spectrometer
ChIndex
enum to classify the different chamber layers in the muon spectrometer
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
MuonPrepDataCollection< CscPrepData > CscPrepDataCollection
MuonPrepDataCollection< TgcPrepData > TgcPrepDataCollection
MuonPrepDataContainerT< RpcPrepData > RpcPrepDataContainer
MuonPrepDataCollection< MMPrepData > MMPrepDataCollection
MuonPrepDataContainerT< TgcPrepData > TgcPrepDataContainer
MuonPrepDataContainerT< MdtPrepData > MdtPrepDataContainer
MuonPrepDataContainerT< sTgcPrepData > sTgcPrepDataContainer
@ MdtStatusDriftTime
The tube produced a vaild measurement.
MuonPrepDataContainerT< MMPrepData > MMPrepDataContainer
MuonPrepDataCollection< MdtPrepData > MdtPrepDataCollection
MuonPrepDataContainerT< CscPrepData > CscPrepDataContainer
MuonPrepDataCollection< RpcPrepData > RpcPrepDataCollection
MuonPrepDataCollection< sTgcPrepData > sTgcPrepDataCollection
void stable_sort(DataModel_detail::iterator< DVL > beg, DataModel_detail::iterator< DVL > end)
Specialization of stable_sort for DataVector/List.
double deltaPhi(double phiA, double phiB)
delta Phi in range [-pi,pi[
Helper to simultaneously calculate sin and cos of the same angle.
Helper to simultaneously calculate sin and cos of the same angle.
double channelWidth() const
calculate local channel width
double channelLength(int channel) const
STRIPS ONLY: calculate channel length for a given strip number.
Parameters defining the design of the readout sTGC pads.
double channelWidth(const Amg::Vector2D &pos, bool measPhi, bool preciseMeas=false) const
calculate local channel width
struct representing the maximum in the hough space
const MuonLayerHough * hough
RegionDescriptor m_descriptor
const MuonPhiLayerHough * hough
void fillLayer2(const PhiHitVec &hits, bool substract=false) const
bool findMaximum(Maximum &maximum, float maxval) const
void associateHitsToMaximum(Maximum &maximum, const PhiHitVec &hits) const
struct containing all hit information needed for the Hough transform
const Muon::TgcClusterObj3D * tgc
const Trk::PrepRawData * prd
access to assiciated hit, either the prd or the tgc pointer is set in athena
std::array< int, detRegMax > nlayersWithMaxima
std::array< int, detRegMax > nphimaxHitsInRegion
RegionPhiMaximumVec phiMaxVec
MaximumAssociationMap maxAssociationMap
RegionPhiHitVec phiHitVec
std::array< int, detRegMax > nmaxHitsInRegion
std::set< MuonHough::MuonLayerHough::Maximum * > associatedToOtherSector
std::array< int, detRegMax > nphilayersWithMaxima
std::vector< TgcClusterObj3D > clusters3D
const HitList & bestEtaCluster() const
bool cluster(const HitList &col)