File indexing completed on 2024-04-06 12:31:39
0001 #include "TrackingTools/TrajectoryCleaning/interface/FastTrajectoryCleaner.h"
0002 void FastTrajectoryCleaner::clean(TrajectoryPointerContainer& tc) const {
0003 edm::LogError("FastTrajectoryCleaner") << "not implemented for Trajectory";
0004 assert(false);
0005 }
0006
0007 void FastTrajectoryCleaner::clean(TempTrajectoryContainer& tc) const {
0008 if (tc.size() <= 1)
0009 return;
0010 float maxScore = -std::numeric_limits<float>::max();
0011 TempTrajectory* bestTr = nullptr;
0012 for (auto& it : tc) {
0013 if (!it.isValid())
0014 continue;
0015 auto const& pd = it.measurements();
0016
0017 int dof = 0;
0018 for (auto const& im : pd) {
0019 if (dismissSeed_ & (im.estimate() == 0))
0020 continue;
0021 auto const& h = im.recHitR();
0022 if (!h.isValid())
0023 continue;
0024 dof += h.dimension();
0025 }
0026 float score = validHitBonus_ * float(dof) - missingHitPenalty_ * it.lostHits() - it.chiSquared();
0027 if (it.lastMeasurement().updatedState().globalMomentum().perp2() < 0.81f)
0028 score -= 0.5f * validHitBonus_ * float(dof);
0029 else if (it.dPhiCacheForLoopersReconstruction() == 0 && it.foundHits() > 8)
0030 score += validHitBonus_ * float(dof);
0031 if (score >= maxScore) {
0032 bestTr = ⁢
0033 maxScore = score;
0034 }
0035 }
0036
0037 for (auto& it : tc) {
0038 if ((&it) != bestTr)
0039 it.invalidate();
0040 }
0041 }
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052