-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14299 from VinInn/TkFastClean
Tracking Fast cleaner during pattern recognition
- Loading branch information
Showing
6 changed files
with
139 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
TrackingTools/TrajectoryCleaning/interface/FastTrajectoryCleaner.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#ifndef TrajectoryCleaning_FastTrajectoryCleaner_h | ||
#define TrajectoryCleaning_FastTrajectoryCleaner_h | ||
|
||
#include "TrackingTools/TrajectoryCleaning/interface/TrajectoryCleaner.h" | ||
|
||
/** A concrete TrajectoryCleaner that assumes all trajectories | ||
* coming from the same seed and therefore incompatible | ||
* The "best" trajectory of is kept, the others are invalidated. | ||
* The goodness of a track is defined in terms of Chi^2, number of | ||
* reconstructed hits, and number of lost hits. | ||
* As it can be used during PatternReco there is the option to not consider hits from the common seed | ||
*/ | ||
|
||
|
||
class FastTrajectoryCleaner final : public TrajectoryCleaner { | ||
public: | ||
|
||
using TrajectoryPointerContainer = TrajectoryCleaner::TrajectoryPointerContainer; | ||
using TempTrajectoryContainer = TrajectoryCleaner::TempTrajectoryContainer; | ||
|
||
FastTrajectoryCleaner() : | ||
validHitBonus_(0.5f*5.0f), | ||
missingHitPenalty_(20.0f), | ||
dismissSeed_(true){} | ||
|
||
|
||
FastTrajectoryCleaner(float bonus, float penalty, bool noSeed=true) : | ||
validHitBonus_(0.5f*bonus), | ||
missingHitPenalty_(penalty), | ||
dismissSeed_(noSeed){} | ||
|
||
|
||
|
||
FastTrajectoryCleaner(const edm::ParameterSet & iConfig) : | ||
validHitBonus_(0.5*iConfig.getParameter<double>("ValidHitBonus")), | ||
missingHitPenalty_(iConfig.getParameter<double>("MissingHitPenalty")), | ||
dismissSeed_(iConfig.getParameter<bool>("dismissSeed")){} | ||
|
||
~FastTrajectoryCleaner(){} | ||
|
||
void clean(TempTrajectoryContainer&) const override; | ||
void clean(TrajectoryPointerContainer&) const override; | ||
|
||
private: | ||
float validHitBonus_; // here per dof | ||
float missingHitPenalty_; | ||
bool dismissSeed_; | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
TrackingTools/TrajectoryCleaning/src/FastTrajectoryCleaner.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#include "TrackingTools/TrajectoryCleaning/interface/FastTrajectoryCleaner.h" | ||
void FastTrajectoryCleaner::clean( TrajectoryPointerContainer & tc) const | ||
{ | ||
edm::LogError("FastTrajectoryCleaner") << "not implemented for Trajectory"; | ||
assert(false); | ||
} | ||
|
||
void FastTrajectoryCleaner::clean( TempTrajectoryContainer & tc) const | ||
{ | ||
|
||
if (tc.size() <= 1) return; // nothing to clean | ||
float maxScore= -std::numeric_limits<float>::max(); | ||
TempTrajectory * bestTr = nullptr; | ||
for (auto & it : tc) { | ||
if (!it.isValid()) continue; | ||
auto const & pd = it.measurements(); | ||
// count active degree of freedom | ||
int dof=0; | ||
for (auto const & im : pd) { | ||
if(dismissSeed_ & (im.estimate()==0)) continue; | ||
auto const & h = im.recHitR(); | ||
if (!h.isValid()) continue; | ||
dof+=h.dimension(); | ||
} | ||
float score = validHitBonus_*dof - missingHitPenalty_*it.lostHits() - it.chiSquared(); | ||
if (score>=maxScore) { | ||
bestTr = ⁢ | ||
maxScore = score; | ||
} | ||
} | ||
|
||
for (auto & it : tc) { | ||
if ((&it)!=bestTr) it.invalidate(); | ||
} | ||
|
||
|
||
} | ||
|
||
/* | ||
auto score = [&](Trajectory const&t)->float { | ||
// possible variant under study | ||
// auto ns = t.foundHits()-t.trailingFoundHits(); | ||
//auto penalty = 0.8f*missingHitPenalty_; | ||
// return validHitBonus_*(t.foundHits()-0.2f*t.cccBadHits()) - penalty*t.lostHits() - t.chiSquared(); | ||
// classical score | ||
return validHitBonus_*t.foundHits() - missingHitPenalty_*t.lostHits() - t.chiSquared(); | ||
}; | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters