CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SequentialGhostTrackFitter.cc
Go to the documentation of this file.
1 #include <vector>
2 
5 
7 
8 using namespace reco;
9 
10 namespace {
11  static inline double sqr(double arg) { return arg * arg; }
12 }
13 
15  maxIteration(15),
16  minDeltaR(0.0015),
17  minDistance(0.002),
18  weightThreshold(0.001)
19 {
20 }
21 
23  const GhostTrackPrediction &before,
24  const GhostTrackPrediction &after) const
25 {
26  return (sqr(after.sz() - before.sz()) +
27  sqr(after.ip() - before.ip()) < sqr(minDistance) &&
28  sqr(after.eta() - before.eta()) +
29  sqr(after.phi() - before.phi()) < sqr(minDeltaR));
30 }
31 
35  std::vector<GhostTrackState> &states,
36  double &ndof, double &chi2)
37 {
38  GhostTrackPrediction pred, lastPred = prior;
39 
40  reset();
41 
42  ndof = 0.;
43  chi2 = 0.;
44 
45  unsigned int iteration = 0;
46  for(;;) {
47  pred = prior;
48 
49  if (states.begin() == states.end())
50  break;
51 
52  if (iteration > 0) {
53  for(unsigned int i = 0; i < states.size(); i++) {
54  GhostTrackState &state = states[i];
55  state.linearize(lastPred);
56  }
57  }
58 
59  ndof = 0.; // prior gives us an initial ndof
60  chi2 = 0.;
61 
62  for(std::vector<GhostTrackState>::const_iterator state =
63  states.begin(); state != states.end(); ++state) {
64 
65  if (state->isValid() &&
66  state->weight() > weightThreshold)
67  pred = updater.update(pred, *state,
68  ndof, chi2);
69  }
70 
71  if (++iteration >= maxIteration || stable(lastPred, pred))
72  break;
73 
74  postFit(updater, pred, states);
75 
76  lastPred = pred;
77  }
78 
79  return pred;
80 }
int i
Definition: DBlmapReader.cc:9
virtual bool stable(const GhostTrackPrediction &before, const GhostTrackPrediction &after) const
A arg
Definition: Factorize.h:36
tuple iteration
Definition: align_cfg.py:5
virtual void postFit(const GhostTrackFitter::PredictionUpdater &updater, const GhostTrackPrediction &pred, std::vector< GhostTrackState > &states)
virtual GhostTrackPrediction update(const GhostTrackPrediction &pred, const GhostTrackState &state, double &ndof, double &chi2) const =0
bool linearize(const GhostTrackPrediction &pred, bool initial=false, double lambda=0.)
char state
Definition: procUtils.cc:75
dictionary prior
GhostTrackPrediction fit(const GhostTrackFitter::PredictionUpdater &updater, const GhostTrackPrediction &prior, std::vector< GhostTrackState > &states, double &ndof, double &chi2)
Square< F >::type sqr(const F &f)
Definition: Square.h:13