Back to home page

Project CMSSW displayed by LXR

 
 

    


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;  // nothing to clean
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     // count active degree of freedom
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);  // extra bonus for long tracks
0031     if (score >= maxScore) {
0032       bestTr = &it;
0033       maxScore = score;
0034     }
0035   }
0036 
0037   for (auto& it : tc) {
0038     if ((&it) != bestTr)
0039       it.invalidate();
0040   }
0041 }
0042 
0043 /*
0044      auto score = [&](Trajectory const&t)->float {
0045             // possible variant under study
0046             // auto ns = t.foundHits()-t.trailingFoundHits();
0047             //auto penalty =  0.8f*missingHitPenalty_;
0048             // return validHitBonus_*(t.foundHits()-0.2f*t.cccBadHits())  - penalty*t.lostHits() - t.chiSquared();
0049          // classical score
0050          return validHitBonus_*t.foundHits()  - missingHitPenalty_*t.lostHits() - t.chiSquared();
0051      };
0052 */