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;
159 if (!
id.is_valid()) {
160 fakePhiHits.push_back(meas);
172 bool measuresPhi =
false;
178 if (isMdt || isCsc || isNSW) {
179 entry.addChamber(chIndex);
180 entry.chamberIds().insert(chId);
187 " recreation of MDTs requiered although not configured via jobO, ignoring request. Please check jobO ");
195 std::unique_ptr<const MdtDriftCircleOnTrack> newMdt{
198 entry.addToTrash(std::move(newMdt));
204 hasLarge |= !isSmall;
206 if (isSmall != previssmall && !is_first_meas && stIndex == prevstIndex) hassloverlap =
true;
208 is_first_meas =
false;
209 previssmall = isSmall;
210 prevstIndex = stIndex;
212 unsigned int ml =
m_idHelperSvc->mdtIdHelper().multilayer(
id);
213 nmdtHitsMl1 += (ml ==1);
214 nmdtHitsMl2 += (ml ==2);
220 nrpcHitsPhi += (measuresPhi && isRpc);
221 nrpcHitsEta += (!measuresPhi && isRpc);
223 ntgcHitsPhi += (measuresPhi && isTgc);
224 ntgcHitsEta += (!measuresPhi && isTgc);
226 ncscHitsPhi+= (measuresPhi && isCsc);
227 ncscHitsEta+= (!measuresPhi && isCsc);
228 if (isCsc && recreateCSC) {
237 entry.addToTrash(std::move(newCsc));
242 if (createComp && (isRpc || isTgc)) {
256 allHits.push_back(meas);
260 phiHits.push_back(meas);
263 etaHits.push_back(meas);
272 entry.nmdtHitsMl1 = nmdtHitsMl1;
273 entry.nmdtHitsMl2 = nmdtHitsMl2;
274 entry.ncscHitsEta = ncscHitsEta;
275 entry.ncscHitsPhi = ncscHitsPhi;
276 entry.nrpcHitsEta = nrpcHitsEta;
277 entry.nrpcHitsPhi = nrpcHitsPhi;
278 entry.ntgcHitsEta = ntgcHitsEta;
279 entry.ntgcHitsPhi = ntgcHitsPhi;
280 if (!triggerHitsEta.empty() && etaHits.empty())
ATH_MSG_WARNING(
"did not find any eta hits");
281 entry.setEtaHits(etaHits);
282 if (!triggerHitsPhi.empty() && phiHits.empty())
ATH_MSG_WARNING(
"did not find any phi hits");
283 entry.setPhiHits(phiHits);
284 entry.setFakePhiHits(fakePhiHits);
285 entry.setAllHits(allHits);
286 entry.hasEndcap(hasEndcap);
287 entry.hasSmallChamber(hasSmall);
288 entry.hasLargeChamber(hasLarge);
289 entry.hasSLOverlap(hassloverlap);
295 rots.push_back(clus);
302 ATH_MSG_WARNING(
" Trigger Measurement is not a MuonClusterOnTrack or CompetingMuonClustersOnTrack!! "
311 typedef std::map<Identifier, std::vector<const MuonClusterOnTrack*> > IdClusMap;
313 IdClusMap idClusters;
319 idClusters[detId].push_back(clus);
322 ATH_MSG_DEBUG(
" creating CompetingMuonClustersOnTrack for " << idClusters.size() <<
" chambers ");
324 IdClusIt chit = idClusters.begin();
325 IdClusIt chit_end = idClusters.end();
326 for (; chit != chit_end; ++chit) {
328 msg(
MSG::VERBOSE )<<__FILE__<<
":"<<__LINE__ <<
" in " <<
m_idHelperSvc->toStringDetEl(chit->first) <<
" clusters: " << chit->second.size()
334 if (cl_it == chit->second.back())
341 if (chit->second.empty()) {
342 ATH_MSG_WARNING(
" empty list, could not create CompetingMuonClustersOnTrack in chamber "
348 if (chit->second.size() == 1) {
349 hits.push_back(chit->second.front());
350 allHits.push_back(chit->second.front());
355 std::list<const Trk::PrepRawData*> prds;
358 for (; cl_it != cl_it_end; ++cl_it) {
367 std::unique_ptr<const CompetingMuonClustersOnTrack> comprot =
m_compClusterCreator->createBroadCluster(prds, 0);
372 hits.push_back(comprot.get());
373 allHits.push_back(comprot.get());
383 if (!
states)
return false;
385 std::set<MuonStationIndex::ChIndex> chambers;
408 ATH_MSG_VERBOSE(
" recalculateCandidateSegmentContent, old chambers " << candidate.
chambers().size() <<
" new chambers "
426 return bRemovedSegments;
430 std::set<const MuonGM::MuonReadoutElement*> roEls;
434 for (;
it != it_end; ++
it) {
435 if (!(*it)->info().id.is_valid())
continue;
444 const std::vector<const MuonClusterOnTrack*>& rots = crot->
containedROTs();
445 if (!rots.empty()) rot = rots.front();
450 if (roEl) roEls.insert(roEl);
457 std::ostringstream oss;
459 if (
level == 0)
return oss.str();
461 if (
segment.hitList().size() >= 2) {
463 oss <<
" length " << distCal(
segment.hitList().front(),
segment.hitList().back());
470 std::vector<MuPatSegment*>::const_iterator
it = segments.begin();
471 std::vector<MuPatSegment*>::const_iterator it_end = segments.end();
472 std::ostringstream oss;
473 oss <<
" Segment candidate vector: " << segments.size();
480 std::ostringstream oss;
483 if (
level == 0)
return oss.str();
485 const std::vector<MuPatSegment*>& segs =
track.segments();
486 oss << std::endl <<
print(segs, 0);
492 std::ostringstream oss;
493 oss <<
"MuPatTracks " << tracks.size() << std::endl;
494 std::vector<std::unique_ptr<MuPatTrack> >::const_iterator
tit = tracks.begin();
495 std::vector<std::unique_ptr<MuPatTrack> >::const_iterator tit_end = tracks.end();
508 return "Unknown candidate type";