 |
ATLAS Offline Software
|
#include <MuonLayerHoughTool.h>
|
virtual | ~MuonLayerHoughTool ()=default |
| Destructor. More...
|
|
virtual StatusCode | initialize () override |
|
virtual std::pair< std::unique_ptr< MuonPatternCombinationCollection >, std::unique_ptr< HoughDataPerSectorVec > > | find (const MdtPrepDataContainer *mdtCont, const CscPrepDataContainer *cscCols, const TgcPrepDataContainer *tgcCont, const RpcPrepDataContainer *rpcCont, const sTgcPrepDataContainer *stgcCont, const MMPrepDataContainer *mmCont, const EventContext &ctx) const override |
|
virtual std::pair< std::unique_ptr< MuonPatternCombinationCollection >, std::unique_ptr< HoughDataPerSectorVec > > | find (const std::vector< const MdtPrepDataCollection * > &mdtCols, const std::vector< const CscPrepDataCollection * > &cscCols, const std::vector< const TgcPrepDataCollection * > &tgcCols, const std::vector< const RpcPrepDataCollection * > &rpcCols, const MuonSegmentCombinationCollection *, const EventContext &ctx) const override |
| find patterns for a give set of MuonPrepData collections + optionally CSC segment combinations More...
|
|
|
void | getSectors (const Amg::Vector3D &pos, std::vector< int > §ors) const |
|
void | getSectors (const TgcClusterObj3D &tgc, std::vector< int > §ors) const |
|
double | rCor (const Amg::Vector3D &pos, const Identifier &id) const |
|
double | rCor (const MuonCluster &rpc) const |
|
double | rCor (const MdtPrepData &mdt) const |
|
double | rCor (const TgcClusterObj3D &tgc, const TgcEdge val, int sector) const |
|
int | sublay (const Identifier &id, float z=0) const |
|
std::pair< std::unique_ptr< MuonPatternCombinationCollection >, std::unique_ptr< HoughDataPerSectorVec > > | analyse (State &state) const |
|
void | fillHitsPerSector (const EventContext &ctx, State &state, const int sector, const CollectionsPerSector &hashes, const MdtPrepDataContainer *mdtCont, const CscPrepDataContainer *cscCont, const TgcPrepDataContainer *tgcCont, const RpcPrepDataContainer *rpcCont, const sTgcPrepDataContainer *stgcCont, const MMPrepDataContainer *mmCont) const |
|
void | fill (const EventContext &ctx, std::set< Identifier > &truthHits, const MdtPrepDataCollection &mdts, HitVec &hits) const |
|
void | fill (const EventContext &ctx, std::set< Identifier > &truthHits, std::vector< std::unique_ptr< TgcHitClusteringObj >> &tgcClusteringObjs, const TgcPrepDataCollection &tgcs, HitVec &hits, PhiHitVec &phiHits, int sector) const |
|
void | fill (const EventContext &ctx, std::set< Identifier > &truthHits, const RpcPrepDataCollection &rpcs, HitVec &hits, PhiHitVec &phiHits) const |
|
void | fill (const EventContext &ctx, std::set< Identifier > &truthHits, const MMPrepDataCollection &mdts, HitVec &hits) const |
|
void | fill (const EventContext &ctx, std::set< Identifier > &truthHits, const sTgcPrepDataCollection &stgcs, HitVec &hits, PhiHitVec &phiHits, int sector) const |
|
void | fill (const EventContext &ctx, std::set< Identifier > &truthHits, const CscPrepDataCollection &cscs, HitVec &hits, PhiHitVec &phiHits) const |
|
bool | findMaxima (MaximumVec &seedMaxima, MuonHough::MuonLayerHough &hough, HitVec &hits, MaximumVec &maxima) const |
|
bool | findMaxima (MuonHough::MuonPhiLayerHough &hough, PhiHitVec &hits, PhiMaximumVec &maxima, int sector) const |
|
void | associateMaximaToPhiMaxima (MuonStationIndex::DetectorRegionIndex region, HoughDataPerSector &houghData, std::map< MuonHough::MuonPhiLayerHough::Maximum *, MaximumVec > &phiEtaAssociations, std::vector< MaximumVec > &unassEtaMaxima) const |
|
void | associateMaximaInNeighbouringSectors (HoughDataPerSector &houghData, std::vector< HoughDataPerSector > &houghDataPerSectorVec) const |
|
void | extendSeed (MuonHough::MuonDetectorHough &detectorHoughTransforms, Road &road, HoughDataPerSector §orData) const |
|
void | associatePhiMaxima (Road &road, PhiMaximumVec &phiMaxima) const |
|
double | combinedPeakheight (double ph, double ph1, double ph2, double phn, double rot, int layer, int) const |
|
void | createPatternCombinations (std::vector< MaximumVec > &maxima, MuonPatternCombinationCollection &patternCombis) const |
|
void | createPatternCombinations (std::map< MuonHough::MuonPhiLayerHough::Maximum *, MaximumVec > &phiEtaAssociations, MuonPatternCombinationCollection &patternCombis) const |
|
void | insertHash (const IdentifierHash &hash, const Identifier &id) const |
|
void | insertHash (int sector, const IdentifierHash &hash, const Identifier &id) const |
|
void | matchTruth (std::set< Identifier > &truthHits, const PRD_MultiTruthCollection &truthCol, const Identifier &id, MuonHough::HitDebugInfo &debug) const |
|
void | initializeSectorMapping (const EventContext &ctx) const |
|
void | printTruthSummary (std::set< Identifier > &truth, std::set< Identifier > &found) const |
|
void | buildRoads (MaximumVec &seedMaxima, MuonHough::MuonDetectorHough &detectorHoughTransforms, std::unique_ptr< HoughDataPerSectorVec > &houghDataPerSectorVec, std::vector< Road > &roads) const |
|
void | mergePhiMaxima (Road &road) const |
|
|
Gaudi::Property< bool > | m_useSeeds {this, "UseSeeds", true} |
|
SG::ReadCondHandleKey< MuonGM::MuonDetectorManager > | m_muonManagerKey {this, "MuonManagerKey", "MuonDetectorManager", "MuonManager ReadKey for IOV Range intersection"} |
|
ServiceHandle< IMuonIdHelperSvc > | m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"} |
|
PublicToolHandle< MuonEDMPrinterTool > | m_printer {this, "printerTool", "Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"} |
|
std::vector< MuonHough::MuonLayerHoughSelector > | m_selectors |
|
std::vector< MuonHough::MuonLayerHoughSelector > | m_selectorsLoose |
|
SG::ReadHandleKeyArray< PRD_MultiTruthCollection > | m_truthNames {this, "TruthNames", {}} |
|
Gaudi::Property< bool > | m_useRpcTimeVeto {this, "RpcTimeVeto", false} |
|
Gaudi::Property< bool > | m_requireTriggerConfirmationNSW {this, "TriggerConfirmationNSW", false} |
|
Gaudi::Property< bool > | m_onlyUseCurrentBunch {this, "OnlyUseCurrentBunch", false} |
|
Gaudi::Property< bool > | m_debugHough {this, "DebugHough", false} |
|
Gaudi::Property< bool > | m_doParabolicExtrapolation |
|
Gaudi::Property< float > | m_extrapolationDistance {this, "ExtrapolationDistance", 1500.} |
|
Gaudi::Property< bool > | m_addSectors {this, "AddSectors", false} |
|
unsigned int | m_ntechnologies {UINT_MAX} |
|
std::map< unsigned int, unsigned int > | m_techToTruthNameIdx {} |
|
MuonSectorMapping | m_sectorMapping |
|
std::mutex m_mutex | ATLAS_THREAD_SAFE |
|
CollectionsPerSectorVec m_collectionsPerSector | ATLAS_THREAD_SAFE |
|
bool m_sectorSetup | ATLAS_THREAD_SAFE {false} |
|
Definition at line 46 of file MuonLayerHoughTool.h.
◆ CollectionsPerSectorVec
◆ DetRegIdx
◆ HashVec
◆ HitVec
◆ HoughDataPerSector
◆ MaximumAssociationMap
◆ MaximumVec
◆ PhiHitVec
◆ PhiMaximumVec
◆ RegionHashVec
◆ RegionHitVec
◆ RegionMaximumVec
◆ RegionPhiHitVec
◆ RegionPhiMaximumVec
◆ TechnologyRegionHashVec
◆ TgcEdge
◆ ~MuonLayerHoughTool()
virtual Muon::MuonLayerHoughTool::~MuonLayerHoughTool |
( |
| ) |
|
|
virtualdefault |
◆ analyse()
Definition at line 170 of file MuonLayerHoughTool.cxx.
172 auto patternCombis = std::make_unique<MuonPatternCombinationCollection>();
175 for (
auto& houghData : state.houghDataPerSectorVec->vec) {
176 ATH_MSG_DEBUG(
"analyse: Filling Hough sector " << houghData.sector);
181 using namespace MuonStationIndex;
183 HitVec&
hits = houghData.hitVec.at(layerHash);
184 if (
hits.empty())
continue;
192 state.houghDataPerSectorVec->detectorHoughTransforms.hough(houghData.sector, region,
layer);
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;
215 buildRoads(state.seedMaxima, state.houghDataPerSectorVec->detectorHoughTransforms,
216 state.houghDataPerSectorVec, 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;
225 using namespace MuonStationIndex;
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; }
245 std::vector<HoughDataPerSector*> sectorData(state.houghDataPerSectorVec->vec.size());
246 for (
unsigned int i = 0;
i < state.houghDataPerSectorVec->vec.size(); ++
i) sectorData[
i] = &state.houghDataPerSectorVec->vec[
i];
247 std::stable_sort(sectorData.begin(), sectorData.end(), SortHoughDataPerSector());
251 for (; spit != spit_end; ++spit) {
254 using namespace MuonStationIndex;
257 for (
int reg = 0; reg <
toInt(DetectorRegionIndex::DetectorRegionIndexMax); ++reg) {
261 if (houghData.nlayersWithMaxima[reg] == 0)
continue;
263 << (*spit)->sector <<
" " <<
regionName(region) <<
" nmax " << (*spit)->maxEtaHits()
264 <<
" layers with eta maxima " << houghData.nlayersWithMaxima[
toInt(region)] <<
" hits "
265 << houghData.nmaxHitsInRegion[
toInt(region)] <<
" layers with phi maxima "
266 << houghData.nphilayersWithMaxima[
toInt(region)] <<
" hits " << houghData.nphimaxHitsInRegion[
toInt(region)]);
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));
297 return {std::move(patternCombis), std::move(state.houghDataPerSectorVec)};
◆ associateMaximaInNeighbouringSectors()
Definition at line 780 of file MuonLayerHoughTool.cxx.
786 for (
unsigned int regLay = 0; regLay < houghData.maxVec.size(); ++regLay) {
787 MaximumVec& maxima = houghData.maxVec[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;
799 MaximumVec& maximaN = houghDataN.maxVec[regLay];
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 *
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;
828 houghData.maxAssociationMap[maximum.get()].push_back(maximumN);
829 houghDataN.associatedToOtherSector.insert(maximumN.get());
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();
◆ associateMaximaToPhiMaxima()
Definition at line 855 of file MuonLayerHoughTool.cxx.
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);
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) {
913 MaximumVec& maxima = houghData.maxVec[layerHash];
914 if (maxima.empty())
continue;
918 for (
const auto& maximum : maxima) {
920 if (houghData.associatedToOtherSector.count(maximum.get()))
continue;
924 int ntrigconfirm = 0;
926 if (
pos != houghData.maxAssociationMap.end()) {
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);
1012 if (
pos != houghData.maxAssociationMap.end()) {
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 "
1035 MaximumVec& maxima = houghData.maxVec[layerHash];
1038 for (
const auto& mit : maxima) {
1039 if (associatedMaxima.count(mit))
continue;
1040 unassEtaMaxima[lay].push_back(mit);
◆ associatePhiMaxima()
Definition at line 652 of file MuonLayerHoughTool.cxx.
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);
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) {
761 if (sec != road.seed->hough->m_descriptor.sector) road.neighbouringSector = sec;
764 std::vector<int> sectors;
766 if (sectors.size() > 1) {
767 for (
const int& sec : sectors) {
768 if (sec != road.seed->hough->m_descriptor.sector) road.neighbouringSector = sec;
773 ATH_MSG_DEBUG(
" Overlap with Phi maximum: overlap " << noverlaps <<
" no overlap " << nNoOverlaps <<
" phimin " << phimin
774 <<
" phimax " << phimax <<
" neighbouring sector "
775 << road.neighbouringSector);
◆ buildRoads()
In the NSW setup it can happen that the hits in the collection are only made up of TGCHits which are clustered beforehand and hence have no associated prd. In order to prevent later a crash in bool isNSW = ... let's first find a hit with associated PRD
Definition at line 300 of file MuonLayerHoughTool.cxx.
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;
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]);
357 if (road.neighbouringRegion != DetRegIdx::DetectorRegionUnknown) {
361 if (road.neighbouringSector != -1) {
362 ATH_MSG_DEBUG(
" Adding neighbouring sector " << road.neighbouringSector);
364 houghDataPerSectorVec->vec[road.neighbouringSector - 1]);
369 if (road.neighbouringRegion != DetRegIdx::DetectorRegionUnknown && road.neighbouringSector != -1) {
370 associatePhiMaxima(road, houghDataPerSectorVec->vec[road.neighbouringSector - 1].phiMaxVec[
toInt(road.neighbouringRegion)]);
377 associatedMaxima.insert(road.maxima.begin(), road.maxima.end());
381 for (
const auto&
max : road.maxima) {
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);
◆ combinedPeakheight()
double Muon::MuonLayerHoughTool::combinedPeakheight |
( |
double |
ph, |
|
|
double |
ph1, |
|
|
double |
ph2, |
|
|
double |
phn, |
|
|
double |
rot, |
|
|
int |
layer, |
|
|
int |
|
|
) |
| const |
|
inlineprivate |
Definition at line 294 of file MuonLayerHoughTool.h.
296 if (
layer == 0 && ph < 3.)
return ph;
297 if (
layer == 1 && ph < 4.)
return ph;
298 if (
layer == 2 && ph < 3.)
return ph;
300 if (phn > 7) ph += phn;
303 if (ph1 > 6.9) ph += 2;
304 if (ph1 > 8.9) ph += 2;
305 if (ph2 > 5.9) ph += 2;
306 if (ph2 > 7.9) ph += 2;
309 if (ph1 > 6.9) ph += 2;
310 if (ph2 > 5.9) ph += 2;
311 if (ph2 > 7.9) ph += 2;
312 if (ph2 > 11.9) ph += 2;
315 if (ph1 > 6.9) ph += 2;
316 if (ph2 > 6.9) ph += 2;
317 if (ph2 > 8.9) ph += 2;
◆ createPatternCombinations() [1/2]
Definition at line 1108 of file MuonLayerHoughTool.cxx.
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;
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()) {
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 "
1260 MuonPatternChamberIntersect
intersect(gpos, gdir, prds);
1264 if (chamberData.empty())
continue;
1265 if (addedPhiHits.empty()) {
1269 MuonPatternCombination* combi =
new MuonPatternCombination(
nullptr, chamberData);
1270 ATH_MSG_DEBUG(
"adding pattern combination with chambers " << chamberData.size() <<
" phi layers " << addedPhiHits.size()
◆ createPatternCombinations() [2/2]
◆ extendSeed()
Definition at line 500 of file MuonLayerHoughTool.cxx.
503 if (!road.seed)
return;
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.) {
559 neighbourRegion = DetRegIdx::EndcapC;
561 neighbourRegion = DetRegIdx::EndcapA;
565 for (
int lay = 0; lay <
toInt(LayerIndex::LayerIndexMax); ++lay) {
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);
591 road.neighbouringRegion = neighbourRegion;
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());
635 if (!
findMaxima(phiHough, phiHitsInMaximum, sectorData.phiMaxVec[
toInt(region)], sectorData.sector) ||
636 sectorData.phiMaxVec[
toInt(region)].
empty()) {
641 ++sectorData.nphilayersWithMaxima[
toInt(region)];
642 sectorData.nphimaxHitsInRegion[
toInt(region)] += sectorData.phiMaxVec[
toInt(region)].front()->max;
645 << sectorData.nphilayersWithMaxima[
toInt(region)]
646 <<
" -> nPhiMaxima: " << sectorData.phiMaxVec[
toInt(region)].
size()
647 <<
" max sum: " << sectorData.nphimaxHitsInRegion[
toInt(region)]);
◆ fill() [1/6]
CSCs were not part of the pattern finding yet..
Definition at line 1521 of file MuonLayerHoughTool.cxx.
1531 unsigned int neta{0}, nphi{0};
1532 for (
const CscPrepData* prd : cscs) {
1533 const bool meas_phi =
m_idHelperSvc->rpcIdHelper().measuresPhi(prd->identify());
1539 <<
" -> eta hits " << neta <<
" phi hits " << nphi);
1540 for (
const CscPrepData* prd : cscs) {
1542 int sublayer =
sublay(
id);
1544 debug->isEtaPhi = (neta && nphi);
1545 debug->trigConfirm = 1;
1546 debug->time = prd->time();
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);
◆ fill() [2/6]
Definition at line 1481 of file MuonLayerHoughTool.cxx.
1483 if (mdts.empty())
return;
1491 unsigned int nmdts(mdts.size()), nmdtsBad{0};
1492 for (
const MdtPrepData* prd : mdts) {
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();
1512 hits.emplace_back(hit);
1517 <<
" -> hits: " << nmdts <<
" bad " << nmdtsBad <<
" isSmallChamber "
◆ fill() [3/6]
Definition at line 1619 of file MuonLayerHoughTool.cxx.
1621 if (mms.empty())
return;
1632 std::array<double,8> multiplicity{};
1633 for (
const MMPrepData* prd : mms) {
1635 int sublayer =
sublay(
id) % 10;
1636 multiplicity[sublayer]++;
1640 for (
int i = 0;
i<8 ;
i++)
if(multiplicity[
i]>0)
ATH_MSG_DEBUG(
" sublayer " <<
i <<
" hits " << multiplicity[
i]);
1643 for (
const MMPrepData* prd : mms) {
1645 float x = prd->globalPosition().z();
1646 float y =
rCor(*prd);
1647 int sublayer =
sublay(
id) % 10;
1648 float stripCor = prd->detectorElement()->getDesign(
id)->inputPitch;
1649 float ymin =
y - stripCor;
1650 float ymax =
y + stripCor;
1656 debug->r = stripCor;
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));
◆ fill() [4/6]
Definition at line 1569 of file MuonLayerHoughTool.cxx.
1571 if (rpcs.empty())
return;
1579 unsigned int neta{0}, nphi{0};
1580 for (
const RpcPrepData* prd : rpcs) {
1581 const bool meas_phi =
m_idHelperSvc->rpcIdHelper().measuresPhi(prd->identify());
1587 <<
" -> eta hits " << neta <<
" phi hits " << nphi);
1589 for (
const RpcPrepData* prd : rpcs) {
1591 int sublayer =
sublay(
id);
1593 debug->isEtaPhi = (neta && nphi);
1594 debug->trigConfirm = 1;
1595 debug->time = prd->time();
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);
◆ fill() [5/6]
Pad channels – We should think about enums!
Definition at line 1664 of file MuonLayerHoughTool.cxx.
1666 if (stgcs.empty())
return;
1672 bool isNeighbouringSector = sector != selectedSector;
1676 <<
" -> hits: " << stgcs.size());
1678 for (
const sTgcPrepData* prd : stgcs) {
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;
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);
1720 chWidth = 0.5 * design->
channelWidth(prd->localPosition(),
true);
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());
1732 Amg::Vector2D lp1(prd->localPosition().x() + chWidth, prd->localPosition().y());
1734 prd->detectorElement()->surface(
id).localToGlobal(lp1, gp1, gp1);
1736 lp1[0] = prd->localPosition().x() - chWidth;
1738 prd->detectorElement()->surface(
id).localToGlobal(lp1, gp2, gp2);
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 "
1750 if (isNeighbouringSector &&
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);
◆ fill() [6/6]
Definition at line 1771 of file MuonLayerHoughTool.cxx.
1774 if (tgcs.empty())
return;
1775 tgcClusteringObjs.push_back(std::make_unique<TgcHitClusteringObj>(&
m_idHelperSvc->tgcIdHelper()));
1776 TgcHitClusteringObj& clustering = *tgcClusteringObjs.back();
1777 std::vector<const TgcPrepData*> prds;
1778 prds.insert(prds.begin(), tgcs.begin(), tgcs.end());
1779 clustering.cluster(prds);
1780 clustering.buildClusters3D();
1786 if (clustering.clusters3D.empty()) {
1793 if (clustering.bestEtaCluster().empty()) {
1794 ATH_MSG_DEBUG(
"TgcHitClusteringObj, no eta cluster selected! ");
1801 std::vector<int> sectors;
1802 getSectors(clustering.clusters3D.front(), sectors);
1804 for (
unsigned int si = 0; si < sectors.size(); ++si) {
1805 if (sectors[si] != sector)
continue;
1807 for (
const TgcClusterObj3D&
cl : clustering.clusters3D) {
1808 const Identifier id =
cl.etaCluster.front()->identify();
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();
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());
◆ fillHitsPerSector()
Definition at line 1421 of file MuonLayerHoughTool.cxx.
1427 houghData.
sector = sector;
1431 const HashVec&
hashes = collectionsPerSector.technologyRegionHashVecs[tech][layerHash];
1432 if (
hashes.empty())
continue;
1439 if (
pos)
fill(ctx, state.truthHits, *
pos, houghData.hitVec[layerHash]);
1442 if (
pos)
fill(ctx, state.truthHits, *
pos, houghData.hitVec[layerHash], houghData.phiHitVec[
toInt(regionLayer.first)]);
1446 fill(ctx, state.truthHits, state.houghDataPerSectorVec->tgcClusteringObjs, *
pos, houghData.hitVec[layerHash],
1447 houghData.phiHitVec[
toInt(regionLayer.first)], collectionsPerSector.sector);
1451 fill(ctx, state.truthHits, *
pos, houghData.hitVec[layerHash], houghData.phiHitVec[
toInt(regionLayer.first)],
1452 collectionsPerSector.sector);
1455 if (
pos)
fill(ctx, state.truthHits, *
pos, houghData.hitVec[layerHash]);
◆ find() [1/2]
Definition at line 147 of file MuonLayerHoughTool.cxx.
155 state.houghDataPerSectorVec->vec.resize(16);
158 for (
const CollectionsPerSector& sit : m_collectionsPerSector) {
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);
◆ find() [2/2]
find patterns for a give set of MuonPrepData collections + optionally CSC segment combinations
Definition at line 68 of file MuonLayerHoughTool.cxx.
73 using namespace MuonStationIndex;
79 state.houghDataPerSectorVec->vec.resize(16);
80 for (
unsigned int i = 0;
i < state.houghDataPerSectorVec->vec.size(); ++
i) state.houghDataPerSectorVec->vec[
i].sector =
i + 1;
83 auto getHashes = [
this](
const Identifier&
id) {
94 auto hashes = getHashes(
id);
95 fill(ctx, state.truthHits, *col, state.houghDataPerSectorVec->vec[sector - 1].hitVec[
hashes.second]);
102 auto hashes = getHashes(
id);
103 fill(ctx, state.truthHits, *col, state.houghDataPerSectorVec->vec[sector - 1].hitVec[
hashes.second],
104 state.houghDataPerSectorVec->vec[sector - 1].phiHitVec[
toInt(
hashes.first)]);
110 auto hashes = getHashes(
id);
111 fill(ctx, state.truthHits, *col, state.houghDataPerSectorVec->vec[sector - 1].hitVec[
hashes.second],
112 state.houghDataPerSectorVec->vec[sector - 1].phiHitVec[
toInt(
hashes.first)]);
116 const std::vector<IdentifierHash>&
hashes = m_collectionsPerSector[sector - 1].technologyRegionHashVecs[tgcTech][
sectorLayerHash];
124 auto hashes = getHashes(
id);
126 fill(ctx, state.truthHits, state.houghDataPerSectorVec->tgcClusteringObjs, *col,
127 state.houghDataPerSectorVec->vec[sector - 1].hitVec[
hashes.second],
128 state.houghDataPerSectorVec->vec[sector - 1].phiHitVec[
toInt(
hashes.first)], sector);
131 int neighbourSectorDown = sector == 1 ? 16 : sector - 1;
132 if (hashInSector(col->identifyHash(), neighbourSectorDown,
hashes.second))
133 fill(ctx, state.truthHits, state.houghDataPerSectorVec->tgcClusteringObjs, *col,
134 state.houghDataPerSectorVec->vec[neighbourSectorDown - 1].hitVec[
hashes.second],
135 state.houghDataPerSectorVec->vec[neighbourSectorDown - 1].phiHitVec[
toInt(
hashes.first)], neighbourSectorDown);
137 int neighbourSectorUp = sector == 16 ? 1 : sector + 1;
138 if (hashInSector(col->identifyHash(), neighbourSectorUp,
hashes.second))
139 fill(ctx, state.truthHits, state.houghDataPerSectorVec->tgcClusteringObjs, *col,
140 state.houghDataPerSectorVec->vec[neighbourSectorUp - 1].hitVec[
hashes.second],
141 state.houghDataPerSectorVec->vec[neighbourSectorUp - 1].phiHitVec[
toInt(
hashes.first)], neighbourSectorUp);
◆ findMaxima() [1/2]
Definition at line 1277 of file MuonLayerHoughTool.cxx.
1280 if (
hits.empty())
return false;
1282 using namespace MuonStationIndex;
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();
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());
1343 if (nmaxima > 0) {
ATH_MSG_VERBOSE(
"findMaxima: No more maxima found " << nmaxima); }
◆ findMaxima() [2/2]
Definition at line 1351 of file MuonLayerHoughTool.cxx.
1353 if (
hits.empty())
return false;
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) {
1392 maximum_hitmatched =
false;
1396 if (maximum_hitmatched) {
1397 maximum_matched =
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); }
◆ getSectors() [1/2]
void Muon::MuonLayerHoughTool::getSectors |
( |
const Amg::Vector3D & |
pos, |
|
|
std::vector< int > & |
sectors |
|
) |
| const |
|
inlineprivate |
◆ getSectors() [2/2]
void Muon::MuonLayerHoughTool::getSectors |
( |
const TgcClusterObj3D & |
tgc, |
|
|
std::vector< int > & |
sectors |
|
) |
| const |
|
inlineprivate |
◆ initialize()
StatusCode Muon::MuonLayerHoughTool::initialize |
( |
| ) |
|
|
overridevirtual |
◆ initializeSectorMapping()
void Muon::MuonLayerHoughTool::initializeSectorMapping |
( |
const EventContext & |
ctx | ) |
const |
|
private |
Definition at line 1868 of file MuonLayerHoughTool.cxx.
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);
1912 const auto it_end =
m_idHelperSvc->mmIdHelper().detectorElement_end();
1913 for (;
it != it_end; ++
it) {
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;
1985 <<
" " << std::setw(4) <<
vec[tech][
hash].
size());
1991 m_sectorSetup =
true;
◆ insertHash() [1/2]
◆ insertHash() [2/2]
◆ matchTruth()
Definition at line 1462 of file MuonLayerHoughTool.cxx.
1464 typedef PRD_MultiTruthCollection::const_iterator iprdt;
1465 std::pair<iprdt, iprdt>
range = truthCol.equal_range(
id);
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);
◆ mergePhiMaxima()
Definition at line 416 of file MuonLayerHoughTool.cxx.
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;
424 if (
m1->sector !=
m2->sector)
return m1->sector == road.seed->hough->m_descriptor.sector;
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);
436 std::stable_sort(road.phiMaxima.begin(), road.phiMaxima.end(), maximaSortingLambda);
439 std::set<MuonHough::MuonPhiLayerHough::Maximum*> associatedPhiMaxima;
440 for (
auto pit = road.phiMaxima.begin(); pit != road.phiMaxima.end(); ++pit) {
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());
483 localHough.fillLayer2(
hits);
484 localHough.findMaximum(phiMaximum, 0.9);
485 localHough.associateHitsToMaximum(phiMaximum,
hits);
487 <<
" number of hits " << phiMaximum.
hits.size());
488 phiMaximum.
hough = (*pit)->hough;
490 road.mergedPhiMaxima.push_back(phiMaximum);
◆ printTruthSummary()
void Muon::MuonLayerHoughTool::printTruthSummary |
( |
std::set< Identifier > & |
truth, |
|
|
std::set< Identifier > & |
found |
|
) |
| const |
|
private |
◆ rCor() [1/4]
◆ rCor() [2/4]
◆ rCor() [3/4]
◆ rCor() [4/4]
◆ sublay()
int Muon::MuonLayerHoughTool::sublay |
( |
const Identifier & |
id, |
|
|
float |
z = 0 |
|
) |
| const |
|
inlineprivate |
Definition at line 245 of file MuonLayerHoughTool.h.
249 if (
m_idHelperSvc->mdtIdHelper().multilayer(
id) == 2) sublayer += 4;
252 if (
m_idHelperSvc->mmIdHelper().multilayer(
id) == 2) sublayer += 4;
256 if (
m_idHelperSvc->stgcIdHelper().multilayer(
id) == 2) sublayer += 4;
260 if (
m_idHelperSvc->rpcIdHelper().doubletR(
id) == 2) sublayer += 2;
264 using namespace MuonStationIndex;
◆ ATLAS_THREAD_SAFE [1/3]
std::mutex m_mutex Muon::MuonLayerHoughTool::ATLAS_THREAD_SAFE |
|
mutableprivate |
◆ ATLAS_THREAD_SAFE [2/3]
◆ ATLAS_THREAD_SAFE [3/3]
bool m_sectorSetup Muon::MuonLayerHoughTool::ATLAS_THREAD_SAFE {false} |
|
mutableprivate |
◆ m_addSectors
Gaudi::Property<bool> Muon::MuonLayerHoughTool::m_addSectors {this, "AddSectors", false} |
|
private |
◆ m_debugHough
Gaudi::Property<bool> Muon::MuonLayerHoughTool::m_debugHough {this, "DebugHough", false} |
|
private |
◆ m_doParabolicExtrapolation
Gaudi::Property<bool> Muon::MuonLayerHoughTool::m_doParabolicExtrapolation |
|
private |
◆ m_extrapolationDistance
Gaudi::Property<float> Muon::MuonLayerHoughTool::m_extrapolationDistance {this, "ExtrapolationDistance", 1500.} |
|
private |
◆ m_idHelperSvc
◆ m_muonManagerKey
◆ m_ntechnologies
unsigned int Muon::MuonLayerHoughTool::m_ntechnologies {UINT_MAX} |
|
private |
◆ m_onlyUseCurrentBunch
Gaudi::Property<bool> Muon::MuonLayerHoughTool::m_onlyUseCurrentBunch {this, "OnlyUseCurrentBunch", false} |
|
private |
◆ m_printer
◆ m_requireTriggerConfirmationNSW
Gaudi::Property<bool> Muon::MuonLayerHoughTool::m_requireTriggerConfirmationNSW {this, "TriggerConfirmationNSW", false} |
|
private |
◆ m_sectorMapping
◆ m_selectors
◆ m_selectorsLoose
◆ m_techToTruthNameIdx
std::map<unsigned int, unsigned int> Muon::MuonLayerHoughTool::m_techToTruthNameIdx {} |
|
private |
◆ m_truthNames
◆ m_useRpcTimeVeto
Gaudi::Property<bool> Muon::MuonLayerHoughTool::m_useRpcTimeVeto {this, "RpcTimeVeto", false} |
|
private |
◆ m_useSeeds
Gaudi::Property<bool> Muon::MuonLayerHoughTool::m_useSeeds {this, "UseSeeds", true} |
|
private |
The documentation for this class was generated from the following files:
JetConstituentVector::iterator iterator
LayerIndex
enum to classify the different layers in the muon spectrometer
Parameters defining the design of the readout sTGC pads.
std::vector< std::shared_ptr< MuonHough::PhiHit > > PhiHitVec
double transformRToSector(double r, double phi, int sector, bool toSector=true) const
expresses a radial position from and to the sector coordinate frame, the phi position should always b...
constexpr unsigned int sectorLayerHashMax()
maximum create a hash out of region and layer
Eigen::Matrix< double, 2, 1 > Vector2D
void getSectors(double phi, std::vector< int > §ors) const
returns the main sector plus neighboring if the phi position is in an overlap region
MuonPrepDataCollection< RpcPrepData > RpcPrepDataCollection
const MuonPhiLayerHough * hough
unsigned int sectorLayerHash(DetectorRegionIndex detectorRegionIndex, LayerIndex layerIndex)
create a hash out of region and layer
struct containing additional debug information on the hits that is not needed for the actual alg but ...
const std::string & stName(StIndex index)
convert StIndex into a string
TechnologyIndex
enum to classify the different layers in the muon spectrometer
MuonPrepDataCollection< MdtPrepData > MdtPrepDataCollection
int clusterLayers
cluster size
double deltaPhi(double phiA, double phiB)
delta Phi in range [-pi,pi[
std::vector< size_t > vec
int clusterSize
index of reconstructed muon
#define ATH_MSG_VERBOSE(x)
const Amg::Vector3D & center() const
Returns the center position of the Surface.
struct containing all hit information needed for the Hough transform
std::vector< std::string > intersection(std::vector< std::string > &v1, std::vector< std::string > &v2)
@ MdtStatusDriftTime
The tube produced a vaild measurement.
constexpr unsigned numberOfSectors()
return total number of sectors
void stable_sort(std::reverse_iterator< DataModel_detail::iterator< DVL > > beg, std::reverse_iterator< DataModel_detail::iterator< DVL > > end, Compare comp)
Specialization of stable_sort for DataVector/List.
Amg::Vector3D channelPos(const Identifier &id) const
Returns the position of the active channel (wireGang or strip)
bool insideSector(int sector, double phi) const
checks whether the phi position is consistent with sector
HepMC::ConstGenParticlePtr cptr() const
Dereference.
StIndex toStationIndex(ChIndex index)
convert ChIndex into StIndex
a link optimized in size for a GenParticle in a McEventCollection
struct representing the maximum in the hough space
const Muon::TgcClusterObj3D * tgc
ChIndex chIndex(const std::string &index)
convert ChIndex name string to enum
const std::string & chName(ChIndex index)
convert ChIndex into a string
CalibratedSpacePoint::State State
A TgcReadoutElement corresponds to a single TGC chamber; therefore typically a TGC station contains s...
virtual const Surface & surface() const =0
Return surface associated with this detector element.
double sectorPhi(int sector) const
returns the centeral phi position of a sector in radians
bool isEtaPhi
number of layers in the cluster
MuonPhiLayerHough & phiHough(DetRegIdx region)
access phi transform
const std::string & technologyName(TechnologyIndex index)
convert LayerIndex into a string
int nStrips(int gasGap) const
Returns the number of strips in a given gas gap.
double channelWidth(const Amg::Vector2D &pos, bool measPhi, bool preciseMeas=false) const
calculate local channel width
StIndex
enum to classify the different station layers in the muon spectrometer
Identifier identify() const
return the identifier
MuonPrepDataCollection< CscPrepData > CscPrepDataCollection
const Trk::PrepRawData * prd
access to assiciated hit, either the prd or the tgc pointer is set in athena
const std::string & layerName(LayerIndex index)
convert LayerIndex into a string
constexpr int toInt(const ParamDefs p)
value_type push_back(value_type pElem)
Add an element to the end of the collection.
StatusCode initialize(bool used=true)
Eigen::Matrix< double, 3, 1 > Vector3D
PhiIndex
enum to classify the different phi layers in the muon spectrometer
const std::string & regionName(DetectorRegionIndex index)
convert DetectorRegionIndex into a string
double channelLength(int channel) const
STRIPS ONLY: calculate channel length for a given strip number.
MuonPrepDataCollection< MMPrepData > MMPrepDataCollection
unsigned int phiIndex(float phi, float binsize)
calculate phi index for a given phi
const Muon::TgcClusterObj3D * tgc
bool empty() const noexcept
DetectorRegionIndex
enum to classify the different layers in the muon spectrometer
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.
#define ATH_MSG_WARNING(x)
MuonPrepDataCollection< sTgcPrepData > sTgcPrepDataCollection
MuonStationIndex::StIndex StIndex
Helper to simultaneously calculate sin and cos of the same angle.
const Trk::PrepRawData * prd
access to assiciated hit, either the prd or the tgc pointer is set in athena
float extrapolate(const MuonLayerHough::Maximum &ref, const MuonLayerHough::Maximum &ex, bool doparabolic=false)
LayerIndex toLayerIndex(ChIndex index)
convert ChIndex into LayerIndex
double transformRToNeighboringSector(double r, int sectorHit, int sectorTarget) const
transform a radial position from one sector frame into another
ChIndex
enum to classify the different chamber layers in the muon spectrometer
MuonPrepDataCollection< TgcPrepData > TgcPrepDataCollection
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
Set * set_intersection(Set *set1, Set *set2)
Perform an intersection of two sets.
double channelWidth() const
calculate local channel width
std::pair< DetectorRegionIndex, LayerIndex > decomposeSectorLayerHash(unsigned int hash)
decompose the hash into Region and Layer
cl
print [x.__class__ for x in toList(dqregion.getSubRegions()) ]
struct containing all hit information needed for the Hough transform
constexpr int toInt(const EnumType enumVal)
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...