76{
77 if (hasPhiMeasurements)
78 ATH_MSG_DEBUG(
"pattern has phi measurements using extrapolation to determine second coordinate");
79 else
81
82
87
88 for (
const MuonPatternChamberIntersect& isect :
pat.chamberData()) {
89
90 if (isect.prepRawDataVec().empty()) continue;
91
93 const Amg::Vector3D patdire = isect.intersectDirection().unit();
94
100 std::map<int, EtaPhiHits> etaPhiHitsPerChamber;
101 std::set<Identifier> clusterIds;
102
103
104 const Trk::PrepRawData* prd = isect.prepRawDataVec().front();
105 const Identifier
id = prd->
identify();
106
107
108
109 double phiStart = patdire.phi();
112 constexpr double phiRange2 = 0.25 *
M_PI;
113 double phiOffset = 0.;
114 if (phiStart > phiRange || phiStart < -phiRange)
115 phiOffset = 2 *
M_PI;
116 else if (phiStart > -phiRange2 && phiStart < phiRange2)
118
119 if (phiOffset > 1.5 *
M_PI) {
120 if (phiStart < 0) phiStart += phiOffset;
121 if (chPhi < 0) chPhi += phiOffset;
122 } else if (phiOffset > 0.) {
123 phiStart += phiOffset;
124 chPhi += phiOffset;
125 }
126 double dphi = std::abs(phiStart - chPhi);
127
129 ATH_MSG_DEBUG(
"Large angular phi difference between pattern and chamber, phi pattern "
131 continue;
132 }
133
134
135 std::map<Identifier, const MdtPrepData*> idMdtMap{};
136
137 for (const Trk::PrepRawData* isect_prd : isect.prepRawDataVec()) {
138
142 const MdtPrepData*& previousMdt = idMdtMap[mdt->identify()];
143 if (!previousMdt || previousMdt->tdc() > mdt->tdc())
144 previousMdt = mdt;
145 else
146 continue;
147 }
148 insertMdt(*mdt, regionMap, patpose, patdire, hasPhiMeasurements);
149 continue;
150 }
152 continue;
153 }
155 if (!clus) continue;
156 const Identifier id = clus->identify();
157 if (!clusterIds.insert(id).second) continue;
158
161 int colHash = clus->collectionHash();
162 EtaPhiHits& hitsPerChamber = etaPhiHitsPerChamber[colHash];
163 if (measuresPhi)
164 ++hitsPerChamber.nphi;
165 else
166 ++hitsPerChamber.neta;
167 }
168 insertCluster(*clus, regionMap, patpose, patdire, hasPhiMeasurements);
169 }
170 for (const auto& [coll_hash, hits] : etaPhiHitsPerChamber) {
171 if ((
hits.neta > 0 &&
hits.nphi == 0) || (
hits.nphi > 0 &&
hits.neta == 0)) {
173
175 if (!prd_coll) {
177 continue;
178 }
179 for (const RpcPrepData* rpc_prd : *prd_coll) {
180 if (!clusterIds.insert(rpc_prd->identify()).second) continue;
181 insertCluster(*rpc_prd, regionMap, patpose, patdire, hasPhiMeasurements);
182 }
185 if (!prd_coll) {
187 continue;
188 }
189
190 for (const TgcPrepData* tgc_prd : *prd_coll) {
191 if (!clusterIds.insert(tgc_prd->identify()).second) continue;
192 insertCluster(*tgc_prd, regionMap, patpose, patdire, hasPhiMeasurements);
193 }
194 }
195 }
196 }
197 }
198 return StatusCode::SUCCESS;
199}
StatusCode loadFromStoreGate(const EventContext &ctx, const SG::ReadHandleKey< ContType > &key, const ContType *&cont_ptr) const
load the container from storegate given a ReadHandleKey.
SG::ReadHandleKey< Muon::TgcPrepDataContainer > m_keyTgc
void insertCluster(const MuonCluster &mdt, RegionMap ®ionMap, const Amg::Vector3D &patpose, const Amg::Vector3D &patdire, bool hasPhiMeasurements) const
SG::ReadHandleKey< Muon::RpcPrepDataContainer > m_keyRpc
Gaudi::Property< double > m_phiAngleCut
Gaudi::Property< bool > m_removeDoubleMdtHits
Gaudi::Property< bool > m_recoverTriggerHits
void insertMdt(const MdtPrepData &clus, RegionMap ®ionMap, const Amg::Vector3D &patpose, const Amg::Vector3D &patdire, bool hasPhiMeasurements) const
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...
Identifier identify() const
return the identifier
virtual const Amg::Vector3D & center() const =0
Return the center of the element.
Eigen::Matrix< double, 3, 1 > Vector3D
phiRange
Filling Phi ranges.
MuonPrepDataCollection< TgcPrepData > TgcPrepDataCollection
MuonPrepDataContainerT< RpcPrepData > RpcPrepDataContainer
MuonPrepDataContainerT< TgcPrepData > TgcPrepDataContainer
MuonPrepDataCollection< RpcPrepData > RpcPrepDataCollection