CMS 3D CMS Logo

PositiveSideGhostTrackFitter.cc
Go to the documentation of this file.
1 #include <cmath>
2 #include <vector>
3 
7 
10 
12 
13 using namespace reco;
14 
17  std::vector<GhostTrackState> &states,
18  double &ndof,
19  double &chi2) {
20  double rho = prior.rho();
21  for (unsigned int i = 0; i < states.size(); i++) {
22  GhostTrackState &state = states[i];
23  state.linearize(prior, true, .5 / rho);
24  }
25 
26  GhostTrackPrediction pred = actualFitter_->fit(updater, prior, states, ndof, chi2);
27 
28  double origin = pred.lambda(origin_);
29  bool done = true;
30  for (unsigned int i = 0; i < states.size(); i++) {
31  GhostTrackState &state = states[i];
32  double lambda = state.lambda();
33  if (lambda < origin && (origin - lambda) < 3.5) {
34  GhostTrackState testState = state;
35  testState.linearize(pred, 2. * origin - lambda);
36  double ndof, chi2;
37 
38  if (testState.isValid()) {
39  updater.contribution(prior, testState, ndof, chi2, true);
40  if (ndof > 0. && chi2 < 10.) {
41  state = testState;
42  if (state.weight() != 1.)
43  state.setWeight(3.);
44  done = false;
45  }
46  } else {
47  edm::LogError("InvalidGhostTrackState") << "Invalid GhostTrackState encountered!";
48  }
49  }
50  }
51 
52  if (!done) {
53  for (unsigned int i = 0; i < states.size(); i++) {
54  GhostTrackState &state = states[i];
55  double lambda = state.lambda();
56  if (state.weight() != 1. && lambda < origin) {
57  double weight = std::exp(10. * (origin - lambda) - .1);
58  state.setWeight(std::min(state.weight(), weight));
59  }
60  }
61 
62  pred = actualFitter_->fit(updater, prior, states, ndof, chi2);
63  }
64 
65  return pred;
66 }
std::unique_ptr< GhostTrackFitter::FitterImpl > actualFitter_
Definition: weight.py:1
Log< level::Error, false > LogError
virtual void contribution(const GhostTrackPrediction &pred, const GhostTrackState &state, double &ndof, double &chi2, bool withPredError=false) const =0
GhostTrackPrediction fit(const GhostTrackFitter::PredictionUpdater &updater, const GhostTrackPrediction &prior, std::vector< GhostTrackState > &states, double &ndof, double &chi2) override
bool linearize(const GhostTrackPrediction &pred, bool initial=false, double lambda=0.)
double lambda(const GlobalPoint &point) const
fixed size matrix