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)) {
255 allHits.push_back(meas);
259 phiHits.push_back(meas);
262 etaHits.push_back(meas);
271 entry.nmdtHitsMl1 = nmdtHitsMl1;
272 entry.nmdtHitsMl2 = nmdtHitsMl2;
273 entry.ncscHitsEta = ncscHitsEta;
274 entry.ncscHitsPhi = ncscHitsPhi;
275 entry.nrpcHitsEta = nrpcHitsEta;
276 entry.nrpcHitsPhi = nrpcHitsPhi;
277 entry.ntgcHitsEta = ntgcHitsEta;
278 entry.ntgcHitsPhi = ntgcHitsPhi;
279 if (!triggerHitsEta.empty() && etaHits.empty())
ATH_MSG_WARNING(
"did not find any eta hits");
280 entry.setEtaHits(etaHits);
281 if (!triggerHitsPhi.empty() && phiHits.empty())
ATH_MSG_WARNING(
"did not find any phi hits");
282 entry.setPhiHits(phiHits);
283 entry.setFakePhiHits(fakePhiHits);
284 entry.setAllHits(allHits);
285 entry.hasEndcap(hasEndcap);
286 entry.hasSmallChamber(hasSmall);
287 entry.hasLargeChamber(hasLarge);
288 entry.hasSLOverlap(hassloverlap);
294 rots.push_back(clus);
301 ATH_MSG_WARNING(
" Trigger Measurement is not a MuonClusterOnTrack or CompetingMuonClustersOnTrack!! "
310 typedef std::map<Identifier, std::vector<const MuonClusterOnTrack*> > IdClusMap;
312 IdClusMap idClusters;
318 idClusters[detId].push_back(clus);
321 ATH_MSG_DEBUG(
" creating CompetingMuonClustersOnTrack for " << idClusters.size() <<
" chambers ");
323 IdClusIt chit = idClusters.begin();
324 IdClusIt chit_end = idClusters.end();
325 for (; chit != chit_end; ++chit) {
327 msg(
MSG::VERBOSE )<<__FILE__<<
":"<<__LINE__ <<
" in " <<
m_idHelperSvc->toStringDetEl(chit->first) <<
" clusters: " << chit->second.size()
333 if (cl_it == chit->second.back())
340 if (chit->second.empty()) {
341 ATH_MSG_WARNING(
" empty list, could not create CompetingMuonClustersOnTrack in chamber "
347 if (chit->second.size() == 1) {
348 hits.push_back(chit->second.front());
349 allHits.push_back(chit->second.front());
354 std::list<const Trk::PrepRawData*> prds;
357 for (; cl_it != cl_it_end; ++cl_it) {
366 std::unique_ptr<const CompetingMuonClustersOnTrack> comprot =
m_compClusterCreator->createBroadCluster(prds, 0);
371 hits.push_back(comprot.get());
372 allHits.push_back(comprot.get());
382 if (!
states)
return false;
384 std::set<MuonStationIndex::ChIndex> chambers;
407 ATH_MSG_VERBOSE(
" recalculateCandidateSegmentContent, old chambers " << candidate.
chambers().size() <<
" new chambers "
425 return bRemovedSegments;
429 std::set<const MuonGM::MuonReadoutElement*> roEls;
433 for (;
it != it_end; ++
it) {
434 if (!(*it)->info().id.is_valid())
continue;
443 const std::vector<const MuonClusterOnTrack*>& rots = crot->
containedROTs();
444 if (!rots.empty()) rot = rots.front();
449 if (roEl) roEls.insert(roEl);
456 std::ostringstream oss;
458 if (
level == 0)
return oss.str();
460 if (
segment.hitList().size() >= 2) {
462 oss <<
" length " << distCal(
segment.hitList().front(),
segment.hitList().back());
469 std::vector<MuPatSegment*>::const_iterator
it = segments.begin();
470 std::vector<MuPatSegment*>::const_iterator it_end = segments.end();
471 std::ostringstream oss;
472 oss <<
" Segment candidate vector: " << segments.size();
479 std::ostringstream oss;
482 if (
level == 0)
return oss.str();
484 const std::vector<MuPatSegment*>& segs =
track.segments();
485 oss << std::endl <<
print(segs, 0);
491 std::ostringstream oss;
492 oss <<
"MuPatTracks " << tracks.size() << std::endl;
493 std::vector<std::unique_ptr<MuPatTrack> >::const_iterator
tit = tracks.begin();
494 std::vector<std::unique_ptr<MuPatTrack> >::const_iterator tit_end = tracks.end();
507 return "Unknown candidate type";