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 
18  std::vector<GhostTrackState> &states,
19  double &ndof, double &chi2)
20 {
21  double rho = prior.rho();
22  for(unsigned int i = 0; i < states.size(); i++) {
23  GhostTrackState &state = states[i];
24  state.linearize(prior, true, .5 / rho);
25  }
26 
28  actualFitter_->fit(updater, prior, states, ndof, chi2);
29 
30  double origin = pred.lambda(origin_);
31  bool done = true;
32  for(unsigned int i = 0; i < states.size(); i++) {
33  GhostTrackState &state = states[i];
34  double lambda = state.lambda();
35  if (lambda < origin && (origin - lambda) < 3.5) {
36  GhostTrackState testState = state;
37  testState.linearize(pred, 2. * origin - lambda);
38  double ndof, chi2;
39 
40  if (testState.isValid()) {
41  updater.contribution(prior, testState, ndof, chi2, true);
42  if (ndof > 0. && chi2 < 10.) {
43  state = testState;
44  if (state.weight() != 1.)
45  state.setWeight(3.);
46  done = false;
47  }
48  } else {
49  edm::LogError("InvalidGhostTrackState") << "Invalid GhostTrackState encountered!";
50  }
51  }
52  }
53 
54  if (!done) {
55  for(unsigned int i = 0; i < states.size(); i++) {
56  GhostTrackState &state = states[i];
57  double lambda = state.lambda();
58  if (state.weight() != 1. && lambda < origin) {
59  double weight =
60  std::exp(10. * (origin - lambda) - .1);
61  state.setWeight(
62  std::min(state.weight(), weight));
63  }
64  }
65 
66  pred = actualFitter_->fit(updater, prior, states, ndof, chi2);
67  }
68 
69  return pred;
70 }
double lambda(const GlobalPoint &point) const
double weight() const
std::unique_ptr< GhostTrackFitter::FitterImpl > actualFitter_
Definition: weight.py:1
void setWeight(double weight)
T min(T a, T b)
Definition: MathUtil.h:58
double lambda() const
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.)
fixed size matrix
virtual void contribution(const GhostTrackPrediction &pred, const GhostTrackState &state, double &ndof, double &chi2, bool withPredError=false) const =0