50 return StatusCode::SUCCESS;
54 const EventContext& ctx)
const {
62 std::unique_ptr<Trk::Track> cleanedTrack =
cleanTrack(ctx, &track, state);
67 std::unique_ptr<Trk::Track> cleanedTrack =
cleanTrack(ctx, &track, state);
75 init(ctx, *track, state);
80 unsigned int nstationsInitial = state.
stations.size();
83 std::unique_ptr<Trk::Track> chamberTrack =
chamberCleaning(ctx, std::make_unique<Trk::Track>(*track), state);
91 unsigned int nstationsChamberCleaning = state.
stations.size();
92 if (nstationsInitial != nstationsChamberCleaning) {
105 std::unique_ptr<Trk::Track> cleanCompTrack =
cleanCompROTs(ctx, std::move(chamberTrack), state);
106 if (!cleanCompTrack) {
113 std::unique_ptr<Trk::Track> flippedTrack =
recoverFlippedMdt(ctx, std::move(cleanCompTrack), state);
120 std::unique_ptr<Trk::Track> hitTrack =
hitCleaning(ctx, std::move(flippedTrack), state);
128 std::unique_ptr<Trk::Track> hitTrackClone = std::make_unique<Trk::Track>(*hitTrack);
131 unsigned int nstationsHitCleaning = state.
stations.size();
132 if (nstationsInitial != nstationsHitCleaning) {
144 std::unique_ptr<Trk::Track> cleanedTrack =
outlierRecovery(ctx, std::move(hitTrack), state);
148 init(ctx, *hitTrackClone, state);
150 ATH_MSG_DEBUG(
"Outlier recovery failure unrecoverable, reject track");
153 ATH_MSG_DEBUG(
"Outlier recovery failed but initial track is recoverable");
154 cleanedTrack = std::move(hitTrackClone);
163 unsigned int nstationsFinal = state.
stations.size();
164 if (nstationsInitial != nstationsFinal) {
178 const Trk::Perigee* perigee = track->perigeeParameters();
186 auto tsos = std::make_unique<Trk::TrackStates>();
187 tsos->reserve(state.
measInfo.size());
189 unsigned int nmeas = 0;
193 for (; hit != hit_end; ++hit) {
195 if (!hit->useInFit) {
203 if (hit->meas) ++nmeas;
205 if (hit->cleanedCompROT) {
210 tsos->push_back(hit->originalState->clone());
221 std::unique_ptr<Trk::Track> cleanedTrack =
222 std::make_unique<Trk::Track>(track->info(), std::move(tsos), track->fitQuality() ? track->fitQuality()->uniqueClone() :
nullptr);
226 std::unique_ptr<Trk::Track> newTrack =
fitTrack(ctx, *cleanedTrack, track->info().particleHypothesis(), state.
slFit);
229 init(ctx, *newTrack, state);
239 const Trk::Perigee* perigee = track->perigeeParameters();
247 auto tsos = std::make_unique<Trk::TrackStates>();
248 tsos->reserve(state.
measInfo.size());
250 unsigned int nmeas = 0;
254 for (; hit != hit_end; ++hit) {
256 if (!hit->useInFit) {
264 if (hit->meas) ++nmeas;
266 if (hit->flippedMdt) {
271 tsos->push_back(hit->originalState->clone());
282 std::unique_ptr<Trk::Track> cleanedTrack =
283 std::make_unique<Trk::Track>(track->info(), std::move(tsos), track->fitQuality() ? track->fitQuality()->uniqueClone() :
nullptr);
287 std::unique_ptr<Trk::Track> newTrack =
fitTrack(ctx, *cleanedTrack, track->info().particleHypothesis(), state.
slFit);
290 init(ctx, *newTrack, state);
301 const Trk::Perigee* perigee = track->perigeeParameters();
307 std::unique_ptr<Trk::Track> newTrack;
309 for (
unsigned int n = 0; n <
m_ncycles; ++n) {
312 ATH_MSG_DEBUG(
" Too many outliers, cannot perform cleaning ");
318 auto tsos = std::make_unique<Trk::TrackStates>();
319 tsos->reserve(state.
measInfo.size());
322 unsigned int nmeas = 0;
323 unsigned int nremovedPhi = 0;
324 bool hasSmall =
false;
325 bool hasLarge =
false;
328 std::map<StIndex, std::pair<bool, bool> > slCountsPerStationLayer;
332 for (; hit != hit_end; ++hit) {
335 if (!hit->useInFit || remove) {
339 if (!hit->id.is_valid() ||
m_idHelperSvc->measuresPhi(hit->id)) ++nremovedPhi;
342 std::string inb = hit->inBounds ?
" inBounds" :
" outBounds";
347 if (hit->cleanedCompROT) {
362 if (!hit->id.is_valid() ||
m_idHelperSvc->measuresPhi(hit->id)) {
374 std::map<StIndex, std::pair<bool, bool> >
::iterator pos =
375 slCountsPerStationLayer.find(stIndex);
378 if (pos == slCountsPerStationLayer.end())
379 slCountsPerStationLayer[stIndex] = std::make_pair(
isSmall, isLarge);
382 if (
isSmall) slCountsPerStationLayer[stIndex].first =
true;
383 if (isLarge) slCountsPerStationLayer[stIndex].second =
true;
387 if (!hit->originalState)
ATH_MSG_DEBUG(
"no original state!");
388 tsos->push_back(hit->originalState->clone());
392 unsigned int noverlaps = 0;
393 for (
auto [
index, slCounts] : slCountsPerStationLayer) {
394 if (!hasSmall && slCounts.first) hasSmall =
true;
395 if (!hasLarge && slCounts.second) hasLarge =
true;
396 if (slCounts.first && slCounts.second) ++noverlaps;
399 if (noverlaps == 0 && hasSmall && hasLarge) ++noverlaps;
406 ATH_MSG_DEBUG(
" nremovedPhi " << nremovedPhi <<
" noverlaps " << noverlaps <<
" nid " << state.
nIdHits);
411 if (nremovedPhi > 0) {
412 bool hasPhiConstraint =
false;
415 hasPhiConstraint =
true;
416 else if (firstPhi && noverlaps > 0)
417 hasPhiConstraint =
true;
418 else if (noverlaps > 1)
419 hasPhiConstraint =
true;
420 else if (firstPhi && lastPhi && firstPhi->
pars && lastPhi->
pars) {
424 if (distPhi > 450.) hasPhiConstraint =
true;
426 if (!hasPhiConstraint) {
427 ATH_MSG_DEBUG(
"Lost phi constraint during track cleaning, reject track");
433 std::unique_ptr<Trk::Track> cleanedTrack =
434 std::make_unique<Trk::Track>(track->info(), std::move(tsos), track->fitQuality() ? track->fitQuality()->uniqueClone() :
nullptr);
439 newTrack =
fitTrack(ctx, *cleanedTrack, track->info().particleHypothesis(), state.
slFit);
444 const Trk::Perigee* perigee = newTrack->perigeeParameters();
450 init(ctx, *newTrack, state);
454 ATH_MSG_DEBUG(
" cleaning ended successfully after cycle " << n);
473 for (; chit != chit_end; ++chit) {
476 ATH_MSG_DEBUG(
" only two precision chambers, cannot remove chamber. ");
483 unsigned int foundChambers = 0;
487 for (; chit != chit_end; ++chit) {
495 if (foundChambers > excludedChambers) {
496 ATH_MSG_WARNING(
" Found more excluded chambers than in list, this should not happen ");
498 }
else if (foundChambers == excludedChambers) {
499 ATH_MSG_DEBUG(
" all excluded chambers in removal list, failing cleaning ");
504 std::vector<ChamberRemovalOutput> cleaningResults;
516 for (; chit != chit_end; ++chit) {
528 cleaningResults.push_back(std::move(
result));
536 for (; chit != chit_end; ++chit) {
548 cleaningResults.push_back(std::move(
result));
552 if (cleaningResults.empty())
return nullptr;
554 ATH_MSG_DEBUG(
" chamberCleaning Results nr " << cleaningResults.size());
560 for (
auto* hit : finalResult.
removedHits) hit->useInFit = 0;
567 std::unique_ptr<Trk::Track> finalResultTrackClone = std::make_unique<Trk::Track>(*finalResult.
track);
569 init(ctx, *finalResultTrackClone, state);
573 std::unique_ptr<Trk::Track> recoveredTrack =
outlierRecovery(ctx, std::move(finalResult.
track), state, &removedChamberIndex);
574 if (!recoveredTrack)
return finalResultTrackClone;
575 init(ctx, *recoveredTrack, state);
576 return recoveredTrack;
580 const std::unique_ptr<Trk::Track>& track,
Identifier chId,
581 bool removePhi,
bool removeEta,
CleaningState& state)
const {
587 const Trk::Perigee* perigee = track->perigeeParameters();
593 auto tsos = std::make_unique<Trk::TrackStates>();
594 tsos->reserve(state.
measInfo.size());
596 unsigned int nmeas = 0;
598 std::set<Identifier> stations{};
602 bool remove = hit.
chId == chId && ((removePhi && measuresPhi) || (removeEta && !measuresPhi));
632 if (nmeas < 6 || stations.size() < 2) {
633 ATH_MSG_DEBUG(
" too few hits, cannot perform chamberCleaning ");
638 std::unique_ptr<Trk::Track> cleanedTrack =
639 std::make_unique<Trk::Track>(track->info(), std::move(tsos), track->fitQuality() ? track->fitQuality()->uniqueClone() :
nullptr);
644 if (!cleanedTrack->perigeeParameters()) {
ATH_MSG_DEBUG(
" track without perigee "); }
646 std::unique_ptr<Trk::Track> newTrack =
fitTrack(ctx, *cleanedTrack, track->info().particleHypothesis(), state.
slFit);
648 if (newTrack && !newTrack->perigeeParameters()) {
649 ATH_MSG_DEBUG(
" fitted track without perigee " << *newTrack <<
" " << newTrack->perigeeParameters());
652 result.track = std::move(newTrack);
659 const Trk::Perigee* perigee = track->perigeeParameters();
669 std::set<ChIndex> recoverableLayers;
671 if (stationIndex == ChIndex::ChUnknown)
continue;
675 if (currentIndex && *currentIndex != stationIndex)
continue;
678 unsigned int nhits = statistics.
nhits;
679 unsigned int noutliers = statistics.
noutliers;
682 unsigned int noutBounds = statistics.
noutBounds;
684 if (nrecoverableOutliers > 0) {
685 if (nhits + nrecoverableOutliers > 2 &&
686 ((noutBounds == 0 && noutliers == 0) || (nrecoverableOutliers != 0 && noutliers < 2))) {
687 recoverableLayers.insert(stationIndex);
695 bool addedHits =
false;
696 unsigned int removedOutOfBoundsHits(0);
698 auto tsos = std::make_unique<Trk::TrackStates>();
699 tsos->reserve(state.
measInfo.size());
705 if (recoverableLayers.count(hit.chIndex)) {
709 std::optional<const Trk::ResidualPull> resPull{
712 ATH_MSG_DEBUG(
" calculation of residual/pull failed !!!!! ");
715 recover = !
isOutsideOnTrackCut(hit.id, resPull->residual().front(), std::abs(resPull->pull().front()),
722 if (hit.flippedMdt) {
723 double rDrift = hit.meas->localParameters()[
Trk::locR];
724 double rDriftFlip = hit.flippedMdt->localParameters()[
Trk::locR];
725 double rTrack = hit.pars->parameters()[
Trk::locR];
726 ATH_MSG_DEBUG(
" flipped MDT: r_orig " << rDrift <<
" flip " << rDriftFlip <<
" rTrack " << rTrack);
734 tsos->push_back(hit.originalState->clone());
742 ++removedOutOfBoundsHits;
750 tsos->push_back(hit.originalState->clone());
754 if (!addedHits && removedOutOfBoundsHits == 0) {
759 if (tsos->size() < 6) {
760 ATH_MSG_WARNING(
" too few hits, cannot add hits. This should not happen ");
765 std::unique_ptr<Trk::Track> cleanedTrack =
766 std::make_unique<Trk::Track>(track->info(), std::move(tsos), track->fitQuality() ? track->fitQuality()->uniqueClone() :
nullptr);
769 ATH_MSG_DEBUG(
" only removed out of bound hits, returning track without new fit ");
776 std::unique_ptr<Trk::Track> newTrack =
fitTrack(ctx, *cleanedTrack, track->info().particleHypothesis(), state.
slFit);
780 init(ctx, *newTrack, state);
829 readHandle->getInitializedCache(fieldCache);
843 state.
measInfo.reserve(states->size());
845 std::set<int> rpcLayers;
846 std::set<int> tgcLayers;
848 double largestmdtpull = -999;
853 ATH_MSG_DEBUG(tsit->dumpType() <<
", parameters " << *tsit->trackParameters());
863 ATH_MSG_VERBOSE(
" Scatterer: r " << pars->position().perp() <<
" z " << pars->position().z());
887 bool pseudo = !
id.is_valid();
891 ATH_MSG_VERBOSE(
" TSOS is not a muon hit, position: r " << pars->position().perp() <<
" z " << pars->position().z());
905 bool measuresPhi = pseudo ? true :
m_idHelperSvc->measuresPhi(
id);
913 bool inBounds =
true;
915 double tol2 = 2 * tol1;
926 }
else if (mmClusterOnTrack) {
939 ATH_MSG_DEBUG(
" calculation of residual/pull failed !!!!! ");
942 int pullSize = resPull->pull().size();
943 double residual = resPull->residual().front();
944 double pull = std::abs(resPull->pull().front());
947 if (!pseudo && pullSize != 1) {
953 double error = pull > 0.001 ? std::abs(residual / pull) : 1000.;
955 double rTrack = isMDT ? pars->parameters()[
Trk::locR] : 0.;
956 double rTrackAbs = std::abs(rTrack);
957 double flippedResidual = isMDT ? rDrift + rTrack : 1e10;
958 double flippedPull = isMDT ? std::abs(flippedResidual /
error) : 1e10;
960 bool isNoise =
false;
963 bool flippedIsRecoverable =
965 double innerRadius = 14.6;
971 bool isDelta = isOutlier && isMDT && rTrackAbs < innerRadius && rTrackAbs > std::abs(rDrift);
976 if (rTrackAbs > innerRadius) inBounds =
false;
977 }
else if (pull > 10.) {
982 std::unique_ptr<MdtDriftCircleOnTrack> mdtRotFlipped;
983 std::unique_ptr<const CompetingMuonClustersOnTrack> updatedCompRot;
984 bool flipSign =
false;
990 isRecoverable =
false;
991 flippedIsRecoverable =
false;
994 if (flippedIsRecoverable) {
995 residual = flippedResidual;
999 if (!isNoise && flipSign) {
1001 mdtRotFlipped = std::make_unique<MdtDriftCircleOnTrack>(*mdtRot);
1004 double rDriftFlip = mdtRotFlipped->localParameters()[
Trk::locR];
1005 int signRot = rDrift < 0 ? -1 : 1;
1006 int signRotFlip = rDriftFlip < 0 ? -1 : 1;
1007 if (rDrift != 0. && signRot == signRotFlip) {
1008 ATH_MSG_WARNING(
" failed to flip sign of MDT " << rDrift <<
" flip " << rDriftFlip);
1011 ATH_MSG_WARNING(
" failed to dynamic_cast measurement with MDT Identifier to a MdtDriftCircleOnTrack");
1016 largestmdtpull = pull;
1026 if (stIndex == StIndex::BM &&
m_idHelperSvc->rpcIdHelper().doubletR(
id) == 1)
1028 else if (stIndex == StIndex::BO)
1030 rpcLayers.insert(layer);
1037 if (stIndex == StIndex::EM) {
1041 else if (
stName[1] ==
'2')
1043 else if (
stName[1] ==
'3')
1050 if (layer != -1) tgcLayers.insert(layer);
1054 if (
m_idHelperSvc->stgcIdHelper().multilayer(
id) == 2) layer = 5;
1055 tgcLayers.insert(layer);
1056 ATH_MSG_VERBOSE(
"adding STGC phi hit " << layer <<
" size " << tgcLayers.size());
1069 double absminres = 0.;
1070 double absmaxres = 0.;
1073 if (!cluster)
continue;
1075 double absres = residual < 0. ? -1. * residual : residual;
1082 }
else if (absres < absminres) {
1086 }
else if (absres > absmaxres) {
1092 <<
" residual " << residual);
1094 ATH_MSG_DEBUG(
" residuals: min " << minres <<
" max " << maxres <<
" diff " << maxres - minres);
1095 bool splitCompRot =
false;
1096 if (std::abs(maxres - minres) > 100 && absmaxres - absminres > 20 && crot->
numberOfContainedROTs() < 20) {
1098 splitCompRot =
true;
1101 std::list<const Trk::PrepRawData*> prdList;
1105 if (!cluster)
continue;
1107 double absres = residual < 0. ? -1. * residual : residual;
1111 << pars->parameters()[
Trk::locX] <<
" residual " << residual);
1115 if (prdList.empty()) {
1116 ATH_MSG_WARNING(
"No clusters selected during comprot cleaning, keeping old cluster");
1126 state.
measInfo.emplace_back(
id, chId,
chIndex, inBounds, residual, pull, tsit, meas, pars, std::move(resPull),
nullptr);
1128 if (flipSign) { info.flippedMdt = std::move(mdtRotFlipped); }
1129 info.isNoise = isNoise;
1130 if (updatedCompRot) {
1132 info.cleanedCompROT = std::move(updatedCompRot);
1134 std::unique_ptr<Trk::TrackParameters> exPars =
m_extrapolator->extrapolate(ctx,
1135 *pars, info.cleanedCompROT->associatedSurface(),
1138 ATH_MSG_WARNING(
"Update of comp rot parameters failed, keeping old ones");
1139 info.cleanedCompROT.reset();
1141 info.pars = exPars.get();
1153 ATH_MSG_DEBUG(
" r_drift " << rDrift <<
" r_trk " << rTrack <<
" dr " << std::setw(7)
1160 if (flippedIsRecoverable)
1162 else if (isRecoverable)
1171 }
else if (flippedIsRecoverable || isRecoverable)
1184 ++chamberStatistics.
nhits;
1185 if (!pseudo) ++state.
nhits;
1189 std::string idString = pseudo ?
" Pseudomeasurement " :
m_idHelperSvc->toString(
id);
1190 std::string boundCheck = inBounds ?
"inBounds" :
"outBounds";
1197 ATH_MSG_VERBOSE(
" r_drift " << std::setw(8) << rDrift <<
" r_trk " << std::setw(7) << rTrack <<
" dr " << std::setw(7)
1241 ++pullInfoHits.
nhits;
1252 ++pullInfoTrig.
nhits;
1262 unsigned int nphiLayers = rpcLayers.size() + tgcLayers.size();
1264 if (state.
nIdHits > 0) { nphiLayers += 2; }
1267 ATH_MSG_DEBUG(
" Sufficient constraints to clean competing ROTs: trigger layers " << nphiLayers);
1275 state.
slFit =
false;
1295 std::set<Identifier> chambersToBeRemoved, chambersToBeRemovedPhi, goodEtaLayers, goodPhiLayers;
1307 for (; chit != chit_end; ++chit) {
1308 if (!chit->first.is_valid())
continue;
1320 << noutBounds.
neta <<
" phi hits " << nhits.
nphi <<
" outBounds " << noutBounds.
nphi);
1321 if (nhits.
neta != 0 && nhits.
neta == noutBounds.
neta) {
1324 double fakePull = 1000. * nhits.
neta;
1325 if (!chambersToBeRemoved.count(chit->first)) {
1328 chambersToBeRemoved.insert(chit->first);
1333 for (; pIt != pIt_end; ++pIt) {
1334 if (pIt->second == chit->first && pIt->first < fakePull) {
1335 pIt->first = fakePull;
1343 if (isPrec && nhits.
neta > 0) {
1350 if (nhits.
nphi != 0 && nhits.
nphi == noutBounds.
nphi) {
1353 double fakePull = 1000. * nhits.
nphi;
1354 if (!chambersToBeRemovedPhi.count(chit->first)) {
1357 chambersToBeRemovedPhi.insert(chit->first);
1362 for (; pIt != pIt_end; ++pIt) {
1363 if (pIt->second == chit->first) {
1364 pIt->first = std::max(pIt->first, fakePull);
1371 if (nhits.
nphi > 0) {
1381 double pull_precisionhits = -1.;
1383 double pull_triggerhits = -1.;
1385 double pull_phihits = -1.;
1388 << pull_precisionhits <<
" trigger eta " << pull_triggerhits <<
" phi " << pull_phihits <<
" measurements "
1389 << state.
measInfo.size() << std::endl
1390 <<
" precision chambers " << state.
pullSumPerChamber.size() <<
" hits with large pull "
1397 if (state.
stations.size() == 1 && phiPull > 5.) {
ATH_MSG_DEBUG(
" Single station track with large phi pulls!! "); }
1403 bool usePhi)
const {
1404 bool doCleaning =
false;
1410 if (msgLvl(MSG::DEBUG)) {
1411 if (!pullSumPerChamber.empty())
msg() << MSG::DEBUG <<
"Chamber pulls " << pullSumPerChamber.size() <<
":";
1414 double pulltot = 0.;
1415 for (; cit != cit_end; ++cit) {
1416 double avePull = cit->second.pullSum / cit->second.nhits;
1417 pulltot += cit->second.pullSum;
1418 ndof += cit->second.nhits;
1419 double avePullReduced = cit->second.nhits > 1 ? (cit->second.pullSum - cit->second.maxPull) / (cit->second.nhits - 1) : avePull;
1420 if (msgLvl(MSG::DEBUG))
1421 msg() << MSG::DEBUG << std::endl
1422 <<
" chamber " <<
m_idHelperSvc->toStringChamber(cit->first) <<
" pull sum " << cit->second.pullSum <<
" max pull "
1423 << cit->second.maxPull <<
" nhits " << cit->second.nhits <<
" ave pull " << avePull <<
" reduced ave pull "
1428 if (msgLvl(MSG::DEBUG))
msg() << MSG::DEBUG <<
" large pull sum ignored ";
1431 if (msgLvl(MSG::DEBUG))
msg() << MSG::DEBUG <<
" large pull sum => removing";
1432 if (!chambersToBeRemovedSet.count(cit->first)) {
1433 chambersToBeRemoved.emplace_back(avePull, cit->first);
1434 chambersToBeRemovedSet.insert(cit->first);
1439 if (msgLvl(MSG::DEBUG))
msg() <<
endmsg;
1440 bool dropMore =
false;
1441 if (dropMore && pulltot * pulltot > 2. * ndof * ndof) {
1443 if (msgLvl(MSG::DEBUG))
msg() << MSG::DEBUG <<
" large pull per dof " << pulltot <<
" ndof " << ndof <<
endmsg;
1447 cit = pullSumPerChamber.begin();
1448 for (; cit != cit_end; ++cit) {
1449 double avePull = cit->second.pullSum / cit->second.nhits;
1450 if (!chambersToBeRemovedSet.count(cit->first)) {
1451 chambersToBeRemoved.emplace_back(avePull, cit->first);
1452 chambersToBeRemovedSet.insert(cit->first);
1457 if (dropMore && doCleaning &&
m_iterate) {
1461 for (; cit != cit_end; ++cit) {
1462 double avePull = cit->second.pullSum / cit->second.nhits;
1463 if (!chambersToBeRemovedSet.count(cit->first)) {
1464 chambersToBeRemoved.emplace_back(avePull, cit->first);
1465 chambersToBeRemovedSet.insert(cit->first);
1474 bool isMdt =
id.is_valid() ?
m_idHelperSvc->isMdt(
id) :
false;
1475 bool measuresPhi =
id.is_valid() ?
m_idHelperSvc->measuresPhi(
id) :
false;
1485 return std::abs(pull) > cutScaleFactor * pullCut;
1488 return std::abs(pull) > cutScaleFactor * pullCut;
1493 std::ostringstream sout;
1495 unsigned int nhits = statistics.
nhits;
1496 unsigned int noutliers = statistics.
noutliers;
1497 unsigned int ndeltas = statistics.
ndeltas;
1499 unsigned int noutBounds = statistics.
noutBounds;
1501 sout <<
chName(statistics.
chIndex) <<
" hits " << std::setw(6) << nhits <<
" outliers " << std::setw(6)
1502 << noutliers <<
" deltas " << std::setw(6) << ndeltas <<
" recoverableOutliers " << std::setw(6) << nrecoverableOutliers
1503 <<
" outBounds " << std::setw(6) << noutBounds;
1509 unsigned int nstationsChamberCleaning = state.
stations.size();
1510 ATH_MSG_DEBUG(
" Cleaner removed full station from track: remaining layers " << nstationsChamberCleaning);
1512 if (nstationsChamberCleaning < 2) {
1513 ATH_MSG_DEBUG(
" Cleaner removed all but one station from track!!! ");
1520 unsigned int nstations = state.
stations.size();
1521 if (nstations == 1 ||
1522 (nstations == 2 && (state.
stations.count(StIndex::EM) && state.
stations.count(StIndex::EO)))) {
1523 ATH_MSG_DEBUG(
" Momentum measurement lost, cleaning given up ");
1539 for (
auto* hit :
result.removedHits) hit->useInFit = 1;
1545 if (states) nStates = states->size();
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
std::pair< std::vector< unsigned int >, bool > res
bool is_valid() const
Check if id is in a valid state.
Local cache for magnetic field (based on MagFieldServices/AtlasFieldSvcTLS.h)
bool solenoidOn() const
status of the magnets
bool insideActiveBounds(const Identifier &id, const Amg::Vector2D &locpos, double tol1=0., double tol2=0.) const
boundary check Wrapper Trk::PlaneSurface::insideBounds() taking into account the passivated width
double innerTubeRadius() const
Returns the inner tube radius excluding the aluminium walls.
Class for competing MuonClusters, it extends the Trk::CompetingRIOsOnTrack base class.
const std::vector< const MuonClusterOnTrack * > & containedROTs() const
returns the vector of SCT_ClusterOnTrack objects .
unsigned int numberOfContainedROTs() const
Number of RIO_OnTracks to be contained by this CompetingRIOsOnTrack.
const MuonClusterOnTrack & rioOnTrack(unsigned int) const
returns the RIO_OnTrack (also known as ROT) objects depending on the integer
Class to represent calibrated clusters formed from TGC strips.
virtual const MuonGM::MMReadoutElement * detectorElement() const
Returns the detector element, assoicated with the PRD of this class.
This class represents the corrected MDT measurements, where the corrections include the effects of wi...
virtual const MuonGM::MdtReadoutElement * detectorElement() const override final
Returns the detector element, assoicated with the PRD of this class.
virtual const MdtPrepData * prepRawData() const override final
Returns the PrepRawData used to create this corrected measurement.
int adc() const
Returns the ADC (typically range is 0 to 250)
Base class for Muon cluster RIO_OnTracks.
virtual const MuonCluster * prepRawData() const override=0
Returns the Trk::PrepRawData - is a MuonCluster in this scope.
virtual const Amg::Vector3D & globalPosition() const override
Returns global position.
static std::unique_ptr< Trk::TrackStateOnSurface > createHoleTSOS(std::unique_ptr< Trk::TrackParameters > pars)
create a hole TSOS, takes ownership of the pointers
static std::unique_ptr< Trk::TrackStateOnSurface > cloneTSOSWithUpdate(const Trk::TrackStateOnSurface &tsos, const Trk::MeasurementBase &meas, const Trk::TrackParameters &pars, Trk::TrackStateOnSurface::TrackStateOnSurfaceType type)
clone input, replacing the track parameteres and the measurement base and updating the type
ToolHandle< Trk::IExtrapolator > m_extrapolator
ServiceHandle< Muon::IMuonEDMHelperSvc > m_edmHelperSvc
PullChamberMap::const_iterator PullChamberCit
bool checkPhiConstraint(CleaningState &state) const
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
void init(const EventContext &ctx, const Trk::Track &track, CleaningState &state) const
init cleaner
bool extractChambersToBeRemoved(CleaningState &state, std::set< Identifier > &chambersToBeRemovedSet, bool usePhi=false) const
helper function to extract chambers that are to be removed
bool checkStations(CleaningState &state) const
std::unique_ptr< Trk::Track > outlierRecovery(const EventContext &ctx, std::unique_ptr< Trk::Track > track, CleaningState &state, const MuonStationIndex::ChIndex *currentIndex=nullptr) const
recover outliers that are within the cuts.
ToolHandle< IMuonCompetingClustersOnTrackCreator > m_compRotCreator
Gaudi::Property< double > m_avePullSumPerChamberCut
ToolHandle< Muon::IMdtDriftCircleOnTrackCreator > m_mdtRotCreator
bool checkInnerConstraint(CleaningState &state) const
std::unique_ptr< Trk::Track > cleanCompROTs(const EventContext &ctx, std::unique_ptr< Trk::Track > track, CleaningState &state) const
clean up competing ROTs that consist out of two clusters
ToolHandle< Trk::IResidualPullCalculator > m_pullCalculator
std::unique_ptr< Trk::Track > clean(const Trk::Track &track, const EventContext &ctx) const override
clean a track, returns a pointer to a new track if successfull.
std::map< Identifier, ChamberPullInfo > PullChamberMap
std::unique_ptr< Trk::Track > fitTrack(const EventContext &ctx, Trk::Track &track, Trk::ParticleHypothesis pHyp, bool slFit) const
Gaudi::Property< bool > m_cleanCompROTs
Gaudi::Property< double > m_associationScaleFactor
EtaPhiPerChamberMap::iterator EtaPhiPerChamberIt
static void unremoveHits(ChamberRemovalOutput &result)
StatusCode initialize() override
AlgTool initialize.
Gaudi::Property< bool > m_onlyUseHitErrorInRecovery
std::unique_ptr< Trk::Track > chamberCleaning(const EventContext &ctx, std::unique_ptr< Trk::Track > track, CleaningState &state) const
remove bad chamber from track.
std::vector< std::pair< double, Identifier > > PullChVec
std::unique_ptr< Trk::Track > cleanTrack(const EventContext &ctx, const Trk::Track *track, CleaningState &state) const
clean a track, actual implementation
SG::ReadCondHandleKey< AtlasFieldCacheCondObj > m_fieldCacheCondObjInputKey
ToolHandle< Trk::ITrackFitter > m_trackFitter
Gaudi::Property< double > m_pullCutPhi
PublicToolHandle< Muon::MuonEDMPrinterTool > m_printer
bool isOutsideOnTrackCut(const Identifier &id, double res, double pull, double cutScaleFactor) const
check whether hit is an outlier
std::unique_ptr< Trk::Track > hitCleaning(const EventContext &ctx, std::unique_ptr< Trk::Track > track, CleaningState &state) const
remove bad hits from track.
Gaudi::Property< bool > m_iterate
Gaudi::Property< bool > m_flipMdtDriftRadii
ToolHandle< Trk::ITrackFitter > m_slTrackFitter
Gaudi::Property< double > m_adcCut
void printStates(Trk::Track *track) const
ToolHandle< Trk::IUpdator > m_measurementUpdator
Gaudi::Property< double > m_mdtResiCut
static std::string print(ChamberLayerStatistics &statistics)
Gaudi::Property< bool > m_recoverOutliers
ChamberRemovalOutput removeChamber(const EventContext &ctx, const std::unique_ptr< Trk::Track > &track, Identifier chId, bool removePhi, bool removeEta, CleaningState &state) const
remove chamber from track
Gaudi::Property< unsigned int > m_ncycles
PullChVec::iterator PullChIt
Gaudi::Property< double > m_pullCut
std::unique_ptr< Trk::Track > recoverFlippedMdt(const EventContext &ctx, std::unique_ptr< Trk::Track > track, CleaningState &state) const
flip signs of MDT hits with large pull if pull if the oppositely signed radius is small
Gaudi::Property< bool > m_useMdtResiCut
Gaudi::Property< bool > m_use_slFit
Class to represent calibrated clusters formed from RPC strips.
virtual const RpcPrepData * prepRawData() const override final
Returns the RpcPrepData - is a TRT_DriftCircle in this scope.
float time() const
Returns the time.
This class describes energy loss material effects in the ATLAS tracking EDM.
double deltaE() const
returns the
base class to integrate material effects on Trk::Track in a flexible way.
double thicknessInX0() const
returns the actually traversed material .
represents the full description of deflection and e-loss of a track in material.
const EnergyLoss * energyLoss() const
returns the energy loss object.
const ScatteringAngles * scatteringAngles() const
returns the MCS-angles object.
This class is the pure abstract base class for all fittable tracking measurements.
const LocalParameters & localParameters() const
Interface method to get the LocalParameters.
virtual const Surface & associatedSurface() const =0
Interface method to get the associated Surface.
const Amg::MatrixX & localCovariance() const
Interface method to get the localError.
const Amg::Vector3D & momentum() const
Access method for the momentum.
const Amg::Vector3D & position() const
Access method for the position.
Class to handle pseudo-measurements in fitters and on track objects.
Identifier identify() const
return the identifier -extends MeasurementBase
@ Biased
RP with track state including the hit.
@ HitOnly
RP with biased track state, but pull from hit only.
@ Unbiased
RP with track state that has measurement not included.
represents a deflection of the track caused through multiple scattering in material.
double sigmaDeltaPhi() const
returns the
double deltaPhi() const
returns the
double sigmaDeltaTheta() const
returns the
double deltaTheta() const
returns the
Class for a StraightLineSurface in the ATLAS detector to describe dirft tube and straw like detectors...
virtual const SurfaceBounds & bounds() const override final
This method returns the bounds of the Surface by reference.
virtual bool insideLoc2(const Amg::Vector2D &locpo, double tol2=0.) const =0
Extend the interface to for single inside Loc 1 / Loc2 tests.
virtual bool globalToLocal(const Amg::Vector3D &glob, const Amg::Vector3D &mom, Amg::Vector2D &loc) const =0
Specified by each surface type: GlobalToLocal method without dynamic memory allocation - boolean chec...
virtual bool insideBounds(const Amg::Vector2D &locpos, double tol1=0., double tol2=0.) const =0
virtual methods to be overwritten by the inherited surfaces
represents the track state (measurement, material, fit parameters and quality) at a surface.
virtual TrackStateOnSurface * clone() const
Pseudo-constructor: needed to avoid excessive RTTI.
@ Measurement
This is a measurement, and will at least contain a Trk::MeasurementBase.
@ Perigee
This represents a perigee, and so will contain a Perigee object only.
@ Outlier
This TSoS contains an outlier, that is, it contains a MeasurementBase/RIO_OnTrack which was not used ...
@ Scatterer
This represents a scattering point on the track, and so will contain TrackParameters and MaterialEffe...
double error(const Amg::MatrixX &mat, int index)
return diagonal error of the matrix caller should ensure the matrix is symmetric and the index is in ...
Eigen::Matrix< double, 2, 1 > Vector2D
StIndex
enum to classify the different station layers in the muon spectrometer
ChIndex chIndex(const std::string &index)
convert ChIndex name string to enum
StIndex toStationIndex(ChIndex index)
convert ChIndex into StIndex
bool isSmall(const ChIndex index)
Returns true if the chamber index is in a small sector.
const std::string & stName(StIndex index)
convert StIndex into a string
const std::string & chName(ChIndex index)
convert ChIndex into a string
ChIndex
enum to classify the different chamber layers in the muon spectrometer
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
DriftCircleSide
Enumerates the 'side' of the wire on which the tracks passed (i.e.
@ RIGHT
the drift radius is positive (see Trk::AtaStraightLine)
@ LEFT
the drift radius is negative (see Trk::AtaStraightLine)
DataVector< const Trk::TrackStateOnSurface > TrackStates
ParametersT< TrackParametersDim, Charged, PerigeeSurface > Perigee
ParticleHypothesis
Enumeration for Particle hypothesis respecting the interaction with material.
ParametersBase< TrackParametersDim, Charged > TrackParameters
void stable_sort(DataModel_detail::iterator< DVL > beg, DataModel_detail::iterator< DVL > end)
Specialization of stable_sort for DataVector/List.
MuonStationIndex::ChIndex chIndex
unsigned int nrecoverableOutliers
struct to store return values of chamber removal, contains the new track plus a list the removed hits
std::unique_ptr< Trk::Track > track
std::vector< MCTBCleaningInfo * > removedHits
PullChamberMap pullSumPerChamberPhi
PullChVec chambersToBeRemoved
ChamberPullInfo pullSumTrigEta
std::set< MuonStationIndex::PhiIndex > phiLayers
PullChamberMap pullSumPerChamberEta
EtaPhiPerChamberMap hitsPerChamber
ChamberPullInfo pullSumPhi
std::map< MuonStationIndex::ChIndex, ChamberLayerStatistics > chamberLayerStatistics
unsigned int nPseudoMeasurements
MeasSet largePullPseudoMeasurements
EtaPhiPerChamberMap outBoundsPerChamber
std::set< MuonStationIndex::StIndex > stations
unsigned int numberOfCleanedCompROTs
unsigned int numberOfFlippedMdts
unsigned int nPhiConstraints
PullChVec chambersToBeRemovedPhi
std::set< Identifier > chamberRemovalExclusionList
MeasSet largePullMeasurements
PullChamberMap pullSumPerChamber
std::vector< std::unique_ptr< Trk::TrackParameters > > parsToBeDeleted
std::optional< Trk::ResidualPull > resPull
const Trk::TrackParameters * pars
const Trk::TrackStateOnSurface * originalState
const Trk::MeasurementBase * meas
Tell the compiler to optimize assuming that FP may trap.
#define CXXUTILS_TRAPPING_FP