File indexing completed on 2024-04-06 12:29:08
0001 #include <memory>
0002
0003 #include <vector>
0004
0005 #include "RecoVertex/VertexTools/interface/GeometricAnnealing.h"
0006
0007 #include "RecoVertex/GhostTrackFitter/interface/GhostTrackState.h"
0008 #include "RecoVertex/GhostTrackFitter/interface/GhostTrackPrediction.h"
0009
0010 #include "RecoVertex/GhostTrackFitter/interface/AnnealingGhostTrackFitter.h"
0011
0012 using namespace reco;
0013
0014 AnnealingGhostTrackFitter::AnnealingGhostTrackFitter() : firstStep(true) {
0015 annealing = std::make_unique<GeometricAnnealing>(3.0, 64.0, 0.25);
0016 }
0017
0018 void AnnealingGhostTrackFitter::postFit(const GhostTrackFitter::PredictionUpdater &updater,
0019 const GhostTrackPrediction &pred,
0020 std::vector<GhostTrackState> &states) {
0021 for (std::vector<GhostTrackState>::iterator state = states.begin(); state != states.end(); ++state) {
0022 if (!state->isValid())
0023 continue;
0024
0025 double ndof, chi2;
0026 updater.contribution(pred, *state, ndof, chi2);
0027 if (ndof == 0. || firstStep)
0028 continue;
0029
0030 state->setWeight(annealing->weight(chi2));
0031 }
0032
0033 if (firstStep)
0034 firstStep = false;
0035 else
0036 annealing->anneal();
0037 }