35 declareInterface<MuPatCandidateTool>(
this);
44 "The current layout does not have any CSC chamber but you gave a CscRotCreator, ignoring it, but double-check "
55 return StatusCode::SUCCESS;
64 std::unique_ptr<MuPatSegment>
info = std::make_unique<MuPatSegment>();
71 info->addChamber(chIdx);
73 if (!
info->name.empty())
info->name +=
"+";
75 std::ostringstream oss;
77 info->name += oss.str();
102 std::unique_ptr<MuPatTrack>
can = std::make_unique<MuPatTrack>(*canIn);
108 std::unique_ptr<MuPatTrack> candidate = std::make_unique< MuPatTrack>(&segInfo,
track);
119 std::unique_ptr<Trk::Track>&
track)
const {
121 std::unique_ptr<MuPatTrack> candidate = std::make_unique<MuPatTrack>(&segInfo1, &segInfo2,
track);
128 std::vector<MuPatSegment*> segments;
131 std::unique_ptr<MuPatTrack> candidate = std::make_unique<MuPatTrack>(segments,
track);
137 bool recreateMDT,
bool recreateCSC,
bool createComp)
const {
138 MeasVec etaHits{}, phiHits{}, fakePhiHits{}, allHits{};
140 unsigned int nmdtHitsMl1{0}, nmdtHitsMl2{0}, ncscHitsEta{0}, ncscHitsPhi{0}, nrpcHitsEta{0}, nrpcHitsPhi{0}, ntgcHitsEta{0},
143 entry.clearChambers();
145 bool hasEndcap{
false}, hasSmall{
false}, hasLarge{
false}, hassloverlap{
false}, previssmall{
false};
151 std::vector<const MuonClusterOnTrack*> triggerHitsPhi;
152 std::vector<const MuonClusterOnTrack*> triggerHitsEta;
155 bool is_first_meas =
true;
158 if (!
id.is_valid()) {
159 fakePhiHits.push_back(meas);
171 bool measuresPhi =
false;
177 if (isMdt || isCsc || isNSW) {
178 entry.addChamber(chIndex);
179 entry.chamberIds().insert(chId);
186 " recreation of MDTs requiered although not configured via jobO, ignoring request. Please check jobO ");
194 std::unique_ptr<const MdtDriftCircleOnTrack> newMdt{
197 entry.addToTrash(std::move(newMdt));
203 hasLarge |= !isSmall;
205 if (isSmall != previssmall && !is_first_meas && stIndex == prevstIndex) hassloverlap =
true;
207 is_first_meas =
false;
208 previssmall = isSmall;
209 prevstIndex = stIndex;
211 unsigned int ml =
m_idHelperSvc->mdtIdHelper().multilayer(
id);
212 nmdtHitsMl1 += (ml ==1);
213 nmdtHitsMl2 += (ml ==2);
219 nrpcHitsPhi += (measuresPhi && isRpc);
220 nrpcHitsEta += (!measuresPhi && isRpc);
222 ntgcHitsPhi += (measuresPhi && isTgc);
223 ntgcHitsEta += (!measuresPhi && isTgc);
225 ncscHitsPhi+= (measuresPhi && isCsc);
226 ncscHitsEta+= (!measuresPhi && isCsc);
227 if (isCsc && recreateCSC) {
236 entry.addToTrash(std::move(newCsc));
241 if (createComp && (isRpc || isTgc)) {
252 allHits.push_back(meas);
255 phiHits.push_back(meas);
257 etaHits.push_back(meas);
266 entry.nmdtHitsMl1 = nmdtHitsMl1;
267 entry.nmdtHitsMl2 = nmdtHitsMl2;
268 entry.ncscHitsEta = ncscHitsEta;
269 entry.ncscHitsPhi = ncscHitsPhi;
270 entry.nrpcHitsEta = nrpcHitsEta;
271 entry.nrpcHitsPhi = nrpcHitsPhi;
272 entry.ntgcHitsEta = ntgcHitsEta;
273 entry.ntgcHitsPhi = ntgcHitsPhi;
274 if (!triggerHitsEta.empty() && etaHits.empty())
ATH_MSG_WARNING(
"did not find any eta hits");
275 entry.setEtaHits(etaHits);
276 if (!triggerHitsPhi.empty() && phiHits.empty())
ATH_MSG_WARNING(
"did not find any phi hits");
277 entry.setPhiHits(phiHits);
278 entry.setFakePhiHits(fakePhiHits);
279 entry.setAllHits(allHits);
280 entry.hasEndcap(hasEndcap);
281 entry.hasSmallChamber(hasSmall);
282 entry.hasLargeChamber(hasLarge);
283 entry.hasSLOverlap(hassloverlap);
289 rots.push_back(clus);
296 ATH_MSG_WARNING(
" Trigger Measurement is not a MuonClusterOnTrack or CompetingMuonClustersOnTrack!! "
305 typedef std::map<Identifier, std::vector<const MuonClusterOnTrack*> > IdClusMap;
307 IdClusMap idClusters;
313 idClusters[detId].push_back(clus);
316 ATH_MSG_DEBUG(
" creating CompetingMuonClustersOnTrack for " << idClusters.size() <<
" chambers ");
318 IdClusIt chit = idClusters.begin();
319 IdClusIt chit_end = idClusters.end();
320 for (; chit != chit_end; ++chit) {
322 msg(
MSG::VERBOSE )<<__FILE__<<
":"<<__LINE__ <<
" in " <<
m_idHelperSvc->toStringDetEl(chit->first) <<
" clusters: " << chit->second.size()
328 if (cl_it == chit->second.back())
335 if (chit->second.empty()) {
336 ATH_MSG_WARNING(
" empty list, could not create CompetingMuonClustersOnTrack in chamber "
342 if (chit->second.size() == 1) {
343 hits.push_back(chit->second.front());
344 allHits.push_back(chit->second.front());
349 std::list<const Trk::PrepRawData*> prds;
352 for (; cl_it != cl_it_end; ++cl_it) {
361 std::unique_ptr<const CompetingMuonClustersOnTrack> comprot =
m_compClusterCreator->createBroadCluster(prds, 0);
366 hits.push_back(comprot.get());
367 allHits.push_back(comprot.get());
377 if (!
states)
return false;
379 std::set<MuonStationIndex::ChIndex> chambers;
402 ATH_MSG_VERBOSE(
" recalculateCandidateSegmentContent, old chambers " << candidate.
chambers().size() <<
" new chambers "
420 return bRemovedSegments;
424 std::set<const MuonGM::MuonReadoutElement*> roEls;
428 for (;
it != it_end; ++
it) {
429 if (!(*it)->info().id.is_valid())
continue;
438 const std::vector<const MuonClusterOnTrack*>& rots = crot->
containedROTs();
439 if (!rots.empty()) rot = rots.front();
444 if (roEl) roEls.insert(roEl);
451 std::ostringstream oss;
453 if (
level == 0)
return oss.str();
455 if (
segment.hitList().size() >= 2) {
457 oss <<
" length " << distCal(
segment.hitList().front(),
segment.hitList().back());
464 std::vector<MuPatSegment*>::const_iterator
it = segments.begin();
465 std::vector<MuPatSegment*>::const_iterator it_end = segments.end();
466 std::ostringstream oss;
467 oss <<
" Segment candidate vector: " << segments.size();
474 std::ostringstream oss;
477 if (
level == 0)
return oss.str();
479 const std::vector<MuPatSegment*>& segs =
track.segments();
480 oss << std::endl <<
print(segs, 0);
486 std::ostringstream oss;
487 oss <<
"MuPatTracks " << tracks.size() << std::endl;
488 std::vector<std::unique_ptr<MuPatTrack> >::const_iterator
tit = tracks.begin();
489 std::vector<std::unique_ptr<MuPatTrack> >::const_iterator tit_end = tracks.end();
502 return "Unknown candidate type";