40 ATH_MSG_VERBOSE(
"enter createBroadCluster: number of prds " << prds.size() );
47 if (!(*prds.begin())) {
52 Identifier channelId = (**prds.begin()).identify();
61 bool measuresPhi = isRpc &&
m_idHelperSvc->rpcIdHelper().measuresPhi(channelId);
62 if (!isRpc) measuresPhi =
m_idHelperSvc->tgcIdHelper().isStrip(channelId);
63 for (std::list<const Trk::PrepRawData*>::const_iterator p = prds.begin(); p != prds.end(); ++p) {
68 channelId = (**p).identify();
69 if ((isRpc &&
m_idHelperSvc->rpcIdHelper().measuresPhi(channelId) != measuresPhi) || (!isRpc &&
m_idHelperSvc->tgcIdHelper().isStrip(channelId) != measuresPhi)) {
73 if ((**p).detectorElement() != detectorElement) {
80 std::vector<const Muon::MuonClusterOnTrack*> rots =
createPrdRots(prds);
81 auto assocProbs = std::vector<double>(rots.size(), 0.);
85 std::list<int> limitingChannels;
86 std::list<const Muon::MuonClusterOnTrack*> limitingRots;
99 limitingChannels.clear();
103 return std::make_unique<CompetingMuonClustersOnTrack>(
104 std::move(parameters), std::move(errorMatrix), surface, std::move(rots), std::move(assocProbs));
109 std::list<int>& limitingChannels,
110 std::list<const Muon::MuonClusterOnTrack*>& limitingRots)
const
113 int numClusters = limitingChannels.size()/2;
116 for (std::list<int>::iterator l = limitingChannels.begin();
117 l != limitingChannels.end() && l != std::prev(limitingChannels.end());
122 int size = abs(end - beg);
123 if (size > sizeMax) sizeMax = size;
124 if (size < sizeMin) sizeMin = size;
127 std::list<int>::iterator discard = limitingChannels.end();
128 for (std::list<int>::iterator l = limitingChannels.begin();
129 l != limitingChannels.end() && l != std::prev(limitingChannels.end());
132 std::list<int>::iterator first = l;
135 int size = abs(end - beg);
139 if (discard == limitingChannels.begin())
142 limitingRots.pop_front();
143 limitingRots.pop_front();
144 limitingChannels.pop_front();
145 limitingChannels.pop_front();
147 else if (discard != limitingChannels.end())
150 limitingRots.pop_back();
151 limitingRots.pop_back();
152 limitingChannels.pop_back();
153 limitingChannels.pop_back();
188 if (!(*prds.begin())) {
189 ATH_MSG_WARNING(
"makeClustersBySurface - first element of RPD list is nullptr");
192 std::vector<const Trk::PrepRawData*> usedPrd;
193 std::vector<const Muon::MuonClusterOnTrack*>::const_iterator
r = rots.begin();
194 for (std::list<const Trk::PrepRawData*>::const_iterator p = prds.begin(); p != prds.end(); ++p, ++
r) {
196 ATH_MSG_WARNING(
"makeClustersBySurface - current PrepRawData is nullptr, continuing");
199 if (std::find(usedPrd.begin(),usedPrd.end(),*p) != usedPrd.end())
continue;
200 usedPrd.push_back(*p);
215 int channelMax = channel;
216 int channelMin = channel;
220 std::list<const Trk::PrepRawData*>::const_iterator q = p;
221 std::vector<const Muon::MuonClusterOnTrack*>::const_iterator s =
r;
222 for (++q, ++s; q != prds.end(); ++q, ++s) {
224 ATH_MSG_WARNING(
"makeClustersBySurface - current PrepRawData is nullptr, continuing");
227 channelId = (**q).identify();
228 if (( isRpc &&
m_idHelperSvc->rpcIdHelper().gasGap(channelId) != gasGap)
229 || (! isRpc &&
m_idHelperSvc->tgcIdHelper().gasGap(channelId) != gasGap))
continue;
230 usedPrd.push_back(*q);
239 if (channel > channelMax)
241 channelMax = channel;
244 if (channel < channelMin)
246 channelMin = channel;
251 limitingChannels.push_back(channelMin);
252 limitingChannels.push_back(channelMax);
253 limitingRots.push_back(rotMin);
254 limitingRots.push_back(rotMax);
258 if (
msgLvl(MSG::VERBOSE) )
260 std::list<int>::const_iterator l = limitingChannels.begin();
261 std::list<int>::const_iterator m = limitingChannels.begin();
263 int size = abs(*l - *(++m));
264 for (std::vector<const Trk::PrepRawData*>::const_iterator q = usedPrd.begin();
272 int stationIndex =
m_idHelperSvc->rpcIdHelper().stationName(channelId);
274 << std::setiosflags(std::ios::fixed)
276 << std::setw(8) << std::setprecision(1) << (**q).localPosition()[
Trk::locX]
277 << std::setw(8) << std::setprecision(1) << (**q).localPosition()[
Trk::locY]
279 << std::setw(2) <<
m_idHelperSvc->rpcIdHelper().doubletZ(channelId)
280 << std::setw(2) <<
m_idHelperSvc->rpcIdHelper().doubletPhi(channelId)
281 <<
" gasGap" << std::setw(2) <<
m_idHelperSvc->rpcIdHelper().gasGap(channelId)
282 <<
" strip" << std::setw(3) <<
m_idHelperSvc->rpcIdHelper().strip(channelId)
283 <<
" station " <<
m_idHelperSvc->rpcIdHelper().stationNameString(stationIndex)
284 <<
" " <<
m_idHelperSvc->rpcIdHelper().show_to_string(channelId) );
288 int stationIndex =
m_idHelperSvc->tgcIdHelper().stationName(channelId);
290 << std::setiosflags(std::ios::fixed)
292 << std::setw(8) << std::setprecision(1) << (**q).localPosition()[
Trk::locX]
293 << std::setw(8) << std::setprecision(1) << (**q).localPosition()[
Trk::locY]
294 <<
" gasGap" << std::setw(2) <<
m_idHelperSvc->tgcIdHelper().gasGap(channelId)
295 <<
" channel" << std::setw(3) <<
m_idHelperSvc->tgcIdHelper().channel(channelId)
296 <<
" station " <<
m_idHelperSvc->tgcIdHelper().stationNameString(stationIndex)
297 <<
" " <<
m_idHelperSvc->tgcIdHelper().show_to_string(channelId) );
302 <<
" between channels " << *l <<
" and " << *m );
303 if (++m != limitingChannels.end())
306 size = 1 + abs(*(++l) - *(++m));
318 std::list<int>& limitingChannels,
319 std::list<const Muon::MuonClusterOnTrack*>& limitingRots)
const
323 std::list<const Muon::MuonClusterOnTrack*>::const_iterator
r = limitingRots.begin();
332 r != limitingRots.end();
335 centre += (**r).associatedSurface().center();
336 covariance += (**r).localCovariance();
337 parameters += (**r).localParameters();
340 norm /=
static_cast<double>(limitingRots.size());
341 std::list<int>::iterator l = limitingChannels.begin();
342 int firstChannel = *l;
343 double width =
static_cast<double>(1 + abs(*(++l) - firstChannel));
344 if (limitingRots.size() > 2)
346 int offset = abs(*(++l) - firstChannel);
347 if (!isRpc && offset < 2) {
350 width +=
static_cast<double>(offset);
362 const Trk::Surface& surf = (**limitingRots.begin()).associatedSurface();
364 std::string shape =
"";
372 shape =
" RPC rectangle ";
374 std::shared_ptr<Trk::RectangleBounds>(rectbds->
clone()));
378 shape =
" TGC trapezoid ";
381 std::shared_ptr<Trk::TrapezoidBounds>(trapbds->
clone()));
385 shape =
" TGC rotatedTrapezoid ";
388 std::shared_ptr<Trk::RotatedTrapezoidBounds>(rottrapbds->
clone()));
400 for (std::list<int>::iterator i = limitingChannels.begin();
401 i != limitingChannels.end();