36 declareInterface<MuPatCandidateTool>(
this);
50 return StatusCode::SUCCESS;
59 std::unique_ptr<MuPatSegment>
info = std::make_unique<MuPatSegment>();
66 info->addChamber(chIdx);
68 if (!
info->name.empty())
info->name +=
"+";
70 std::ostringstream oss;
72 info->name += oss.str();
97 std::unique_ptr<MuPatTrack>
can = std::make_unique<MuPatTrack>(*canIn);
103 std::unique_ptr<MuPatTrack> candidate = std::make_unique< MuPatTrack>(&segInfo,
track);
114 std::unique_ptr<Trk::Track>&
track)
const {
116 std::unique_ptr<MuPatTrack> candidate = std::make_unique<MuPatTrack>(&segInfo1, &segInfo2,
track);
123 std::vector<MuPatSegment*> segments;
126 std::unique_ptr<MuPatTrack> candidate = std::make_unique<MuPatTrack>(segments,
track);
132 bool recreateMDT,
bool recreateCSC,
bool createComp)
const {
133 MeasVec etaHits{}, phiHits{}, fakePhiHits{}, allHits{};
135 unsigned int nmdtHitsMl1{0}, nmdtHitsMl2{0}, ncscHitsEta{0}, ncscHitsPhi{0}, nrpcHitsEta{0}, nrpcHitsPhi{0}, ntgcHitsEta{0},
138 entry.clearChambers();
140 bool hasEndcap{
false}, hasSmall{
false}, hasLarge{
false}, hassloverlap{
false}, previssmall{
false};
146 std::vector<const MuonClusterOnTrack*> triggerHitsPhi{}, triggerHitsEta{};
149 bool is_first_meas =
true;
152 if (!
id.is_valid()) {
153 fakePhiHits.push_back(meas);
165 bool measuresPhi =
false;
171 if (isMdt || isCsc || isNSW) {
173 entry.chamberIds().insert(chId);
180 " recreation of MDTs requiered although not configured via jobO, ignoring request. Please check jobO ");
188 meas =
entry.addToTrash
189 (std::unique_ptr<const MdtDriftCircleOnTrack>
190 (
m_mdtRotCreator->createRIO_OnTrack(*mdt->prepRawData(), mdt->globalPosition())));
198 if (
isSmall != previssmall && !is_first_meas && stIndex == prevstIndex) hassloverlap =
true;
200 is_first_meas =
false;
202 prevstIndex = stIndex;
204 unsigned int ml =
m_idHelperSvc->mdtIdHelper().multilayer(
id);
205 nmdtHitsMl1 += (ml ==1);
206 nmdtHitsMl2 += (ml ==2);
212 nrpcHitsPhi += (measuresPhi && isRpc);
213 nrpcHitsEta += (!measuresPhi && isRpc);
215 ntgcHitsPhi += (measuresPhi && isTgc);
216 ntgcHitsEta += (!measuresPhi && isTgc);
218 ncscHitsPhi+= (measuresPhi && isCsc);
219 ncscHitsEta+= (!measuresPhi && isCsc);
220 if (isCsc && recreateCSC) {
227 meas =
entry.addToTrash
228 (std::unique_ptr<const MuonClusterOnTrack>
229 (
m_cscRotCreator->createRIO_OnTrack(*csc->prepRawData(), csc->globalPosition())));
234 if (createComp && (isRpc || isTgc)) {
245 allHits.push_back(meas);
248 phiHits.push_back(meas);
250 etaHits.push_back(meas);
259 entry.nmdtHitsMl1 = nmdtHitsMl1;
260 entry.nmdtHitsMl2 = nmdtHitsMl2;
261 entry.ncscHitsEta = ncscHitsEta;
262 entry.ncscHitsPhi = ncscHitsPhi;
263 entry.nrpcHitsEta = nrpcHitsEta;
264 entry.nrpcHitsPhi = nrpcHitsPhi;
265 entry.ntgcHitsEta = ntgcHitsEta;
266 entry.ntgcHitsPhi = ntgcHitsPhi;
267 if (!triggerHitsEta.empty() && etaHits.empty()) {
270 entry.setEtaHits(etaHits);
271 if (!triggerHitsPhi.empty() && phiHits.empty()) {
274 entry.setPhiHits(phiHits);
275 entry.setFakePhiHits(fakePhiHits);
276 entry.setAllHits(allHits);
277 entry.hasEndcap(hasEndcap);
278 entry.hasSmallChamber(hasSmall);
279 entry.hasLargeChamber(hasLarge);
280 entry.hasSLOverlap(hassloverlap);
286 rots.push_back(clus);
293 ATH_MSG_WARNING(
" Trigger Measurement is not a MuonClusterOnTrack or CompetingMuonClustersOnTrack!! "
302 typedef std::map<Identifier, std::vector<const MuonClusterOnTrack*> > IdClusMap;
304 IdClusMap idClusters;
310 idClusters[detId].push_back(clus);
313 ATH_MSG_DEBUG(
" creating CompetingMuonClustersOnTrack for " << idClusters.size() <<
" chambers ");
315 IdClusIt chit = idClusters.begin();
316 IdClusIt chit_end = idClusters.end();
317 for (; chit != chit_end; ++chit) {
319 msg(
MSG::VERBOSE )<<__FILE__<<
":"<<__LINE__ <<
" in " <<
m_idHelperSvc->toStringDetEl(chit->first) <<
" clusters: " << chit->second.size()
325 if (cl_it == chit->second.back())
332 if (chit->second.empty()) {
333 ATH_MSG_WARNING(
" empty list, could not create CompetingMuonClustersOnTrack in chamber "
339 if (chit->second.size() == 1) {
340 hits.push_back(chit->second.front());
341 allHits.push_back(chit->second.front());
346 std::list<const Trk::PrepRawData*> prds;
349 for (; cl_it != cl_it_end; ++cl_it) {
358 std::unique_ptr<const CompetingMuonClustersOnTrack> comprot =
m_compClusterCreator->createBroadCluster(prds, 0);
363 hits.push_back(comprot.get());
364 allHits.push_back(comprot.get());
374 if (!
states)
return false;
376 std::set<MuonStationIndex::ChIndex> chambers;
399 ATH_MSG_VERBOSE(
" recalculateCandidateSegmentContent, old chambers " << candidate.
chambers().size() <<
" new chambers "
417 return bRemovedSegments;
421 std::set<const MuonGM::MuonReadoutElement*> roEls;
425 for (;
it != it_end; ++
it) {
426 if (!(*it)->info().id.is_valid())
continue;
435 const std::vector<const MuonClusterOnTrack*>& rots = crot->
containedROTs();
436 if (!rots.empty()) rot = rots.front();
441 if (roEl) roEls.insert(roEl);
448 std::ostringstream oss;
450 if (
level == 0)
return oss.str();
452 if (
segment.hitList().size() >= 2) {
454 oss <<
" length " << distCal(
segment.hitList().front(),
segment.hitList().back());
461 std::vector<MuPatSegment*>::const_iterator
it = segments.begin();
462 std::vector<MuPatSegment*>::const_iterator it_end = segments.end();
463 std::ostringstream oss;
464 oss <<
" Segment candidate vector: " << segments.size();
471 std::ostringstream oss;
474 if (
level == 0)
return oss.str();
476 const std::vector<MuPatSegment*>& segs =
track.segments();
477 oss << std::endl <<
print(segs, 0);
483 std::ostringstream oss;
484 oss <<
"MuPatTracks " << tracks.size() << std::endl;
485 std::vector<std::unique_ptr<MuPatTrack> >::const_iterator
tit = tracks.begin();
486 std::vector<std::unique_ptr<MuPatTrack> >::const_iterator tit_end = tracks.end();
499 return "Unknown candidate type";