Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce a Long-track bonus in CkfTrackBuilder #45023

Merged
merged 9 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
trajectoryFilter = dict(refToPSet_ = 'TrajectoryFilterForConversions'),
maxCand = 5,
lostHitPenalty = 30.,
foundHitBonus = 0.,
minHitForDoubleBonus = 8888,
intermediateCleaning = True,
alwaysUseInvalidHits = True,
seedAs5DHit = False
Expand Down
2 changes: 2 additions & 0 deletions RecoMuon/L3TrackFinder/python/MuonCkfTrajectoryBuilder_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
rescaleErrorIfFail = cms.double(1.0),
propagatorOpposite = cms.string('PropagatorWithMaterialOpposite'),
lostHitPenalty = cms.double(30.0),
foundHitBonus = cms.double(0.0),
minHitForDoubleBonus = cms.int32(9999),
#this is present in HLT config, appears to be dummy
# appendToDataLabel = cms.string( "" ),
#safety cone size
Expand Down
2 changes: 2 additions & 0 deletions RecoTracker/CkfPattern/interface/CkfTrajectoryBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ class CkfTrajectoryBuilder : public BaseCkfTrajectoryBuilder {
int theMaxCand; /**< Maximum number of trajectory candidates
to propagate to the next layer. */
float theLostHitPenalty; /**< Chi**2 Penalty for each lost hit. */
float theFoundHitBonus; /**< Chi**2 Bonus for each found hit. */
int theMinHitForDoubleBonus; /**< minimun number of hits to double the bonus above */
bool theIntermediateCleaning; /**< Tells whether an intermediary cleaning stage
should take place during TB. */
bool theAlwaysUseInvalidHits;
Expand Down
14 changes: 0 additions & 14 deletions RecoTracker/CkfPattern/plugins/TrajectoryLessByFoundHits.h

This file was deleted.

4 changes: 2 additions & 2 deletions RecoTracker/CkfPattern/plugins/TrajectorySegmentBuilder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include "TrackingTools/MeasurementDet/interface/TrajectoryMeasurementGroup.h"
#include "TrackingTools/DetLayers/interface/DetGroup.h"
#include "TrackingTools/DetLayers/interface/DetLayer.h"
#include "TrajectoryLessByFoundHits.h"
#include "TrackingTools/PatternTools/interface/TrajectoryStateUpdator.h"
#include "TrackingTools/DetLayers/interface/GeomDetCompatibilityChecker.h"
#include "TrackingTools/MeasurementDet/interface/MeasurementDet.h"
Expand Down Expand Up @@ -482,7 +481,8 @@ void TrajectorySegmentBuilder::cleanCandidates(vector<TempTrajectory>& candidate
int index[NC];
for (int i = 0; i != NC; ++i)
index[i] = i;
std::sort(index, index + NC, [&candidates](int i, int j) { return lessByFoundHits(candidates[i], candidates[j]); });
std::sort(
index, index + NC, [&candidates](int i, int j) { return candidates[i].foundHits() < candidates[j].foundHits(); });
// cout << "SortedCandidates.foundHits";
// for (auto i1 : index)
// cout << " " << candidates[i1].foundHits();
Expand Down
2 changes: 2 additions & 0 deletions RecoTracker/CkfPattern/python/CkfTrajectoryBuilder_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
propagatorOpposite = cms.string('PropagatorWithMaterialOpposite'),
# propagatorOpposite = cms.string('PropagatorWithMaterialParabolicMfOpposite'),
lostHitPenalty = cms.double(30.0),
foundHitBonus = cms.double(0.0),
minHitForDoubleBonus = cms.int32(8888),
#SharedSeedCheck = cms.bool(False),
seedAs5DHit = cms.bool(False)
)
Expand Down
12 changes: 10 additions & 2 deletions RecoTracker/CkfPattern/src/CkfTrajectoryBuilder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ CkfTrajectoryBuilder::CkfTrajectoryBuilder(const edm::ParameterSet& conf,
: BaseCkfTrajectoryBuilder(conf, iC, std::move(filter)) {
theMaxCand = conf.getParameter<int>("maxCand");
theLostHitPenalty = conf.getParameter<double>("lostHitPenalty");
theFoundHitBonus = conf.getParameter<double>("foundHitBonus");
theMinHitForDoubleBonus = conf.getParameter<int>("minHitForDoubleBonus");
theIntermediateCleaning = conf.getParameter<bool>("intermediateCleaning");
theAlwaysUseInvalidHits = conf.getParameter<bool>("alwaysUseInvalidHits");
}
Expand All @@ -48,6 +50,8 @@ void CkfTrajectoryBuilder::fillPSetDescription(edm::ParameterSetDescription& iDe
BaseCkfTrajectoryBuilder::fillPSetDescription(iDesc);
iDesc.add<int>("maxCand", 5);
iDesc.add<double>("lostHitPenalty", 30.);
iDesc.add<double>("foundHitBonus", 0.);
iDesc.add<int>("minHitForDoubleBonus", 8888);
iDesc.add<bool>("intermediateCleaning", true);
iDesc.add<bool>("alwaysUseInvalidHits", true);

Expand Down Expand Up @@ -104,10 +108,14 @@ unsigned int CkfTrajectoryBuilder::limitedCandidates(const std::shared_ptr<const
TempTrajectoryContainer newCand; // = TrajectoryContainer();
newCand.reserve(theMaxCand);

auto trajCandLess = [&](TempTrajectory const& a, TempTrajectory const& b) {
return (a.chiSquared() + a.lostHits() * theLostHitPenalty) < (b.chiSquared() + b.lostHits() * theLostHitPenalty);
auto score = [&](TempTrajectory const& a) {
auto bonus = theFoundHitBonus;
bonus += a.foundHits() > theMinHitForDoubleBonus ? bonus : 0;
return a.chiSquared() + a.lostHits() * theLostHitPenalty - bonus * a.foundHits();
};

auto trajCandLess = [&](TempTrajectory const& a, TempTrajectory const& b) { return score(a) < score(b); };

while (!candidates.empty()) {
newCand.clear();
bool full = 0;
Expand Down