LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
genf::GFKalman Class Reference

#include "GFKalman.h"

Public Member Functions

 GFKalman ()
 
 ~GFKalman ()
 
void operator() (GFTrack *track)
 Operator for use with STL. More...
 
void operator() (std::pair< int, GFTrack * > tr)
 Operator for use with STL. More...
 
void setLazy (Int_t)
 Switch lazy error handling. More...
 
void setNumIterations (Int_t i)
 Set number of iterations for Kalman Filter. More...
 
void processTrack (GFTrack *)
 Performs fit on a GFTrack. More...
 
void fittingPass (GFTrack *, int dir)
 Performs fit on a GFTrack beginning with the current hit. More...
 
double getChi2Hit (GFAbsRecoHit *, GFAbsTrackRep *)
 Calculates chi2 of a given hit with respect to a given track representation. More...
 
void setInitialDirection (int d)
 Sets the inital direction of the track fit (1 for inner to outer, or -1 for outer to inner). The standard is 1 and is set in the ctor. More...
 
void setBlowUpFactor (double f)
 Set the blowup factor (see blowUpCovs() ) More...
 
void setMomLow (Double_t f)
 
void setMomHigh (Double_t f)
 
void setMaxUpdate (Double_t f)
 
void setErrorScaleSTh (Double_t f)
 
void setErrorScaleMTh (Double_t f)
 

Private Member Functions

void processHit (GFTrack *, int, int, int)
 One Kalman step. More...
 
void switchDirection (GFTrack *trk)
 Used to switch between forward and backward filtering. More...
 
TMatrixT< Double_t > calcGain (const TMatrixT< Double_t > &cov, const TMatrixT< Double_t > &HitCov, const TMatrixT< Double_t > &H)
 Calculate Kalman Gain. More...
 
TMatrixT< Double_t > calcCov7x7 (const TMatrixT< Double_t > &cov, const genf::GFDetPlane &plane)
 
double chi2Increment (const TMatrixT< Double_t > &r, const TMatrixT< Double_t > &H, const TMatrixT< Double_t > &cov, const TMatrixT< Double_t > &V)
 this returns the reduced chi2 increment for a hit More...
 
void blowUpCovs (GFTrack *trk)
 this is needed to blow up the covariance matrix before a fitting pass drops off-diagonal elements and blows up diagonal by blowUpFactor More...
 
void blowUpCovsDiag (GFTrack *trk)
 

Private Attributes

int fInitialDirection
 
Int_t fNumIt
 
double fBlowUpFactor
 
Double_t fMomLow
 
Double_t fMomHigh
 
Double_t fMaxUpdate
 
Double_t fErrScaleSTh
 
Double_t fErrScaleMTh
 
bool fGENfPRINT
 

Detailed Description

Definition at line 53 of file GFKalman.h.

Constructor & Destructor Documentation

genf::GFKalman::GFKalman ( )

Definition at line 38 of file GFKalman.cxx.

40  , fNumIt(3)
41  , fBlowUpFactor(50.)
42  , fMomLow(-100.0)
43  , fMomHigh(100.0)
44  , fMaxUpdate(1.0)
45  , fErrScaleSTh(1.0)
46  , fErrScaleMTh(1.0)
47  , fGENfPRINT(false)
48 {
50 }
Double_t fErrScaleMTh
Definition: GFKalman.h:167
int fInitialDirection
Definition: GFKalman.h:159
Double_t fMomLow
Definition: GFKalman.h:163
Double_t fMaxUpdate
Definition: GFKalman.h:165
Double_t fErrScaleSTh
Definition: GFKalman.h:166
double fBlowUpFactor
Definition: GFKalman.h:161
bool fGENfPRINT
Definition: GFKalman.h:168
Double_t fMomHigh
Definition: GFKalman.h:164
Int_t fNumIt
Definition: GFKalman.h:160
genf::GFKalman::~GFKalman ( )

Definition at line 52 of file GFKalman.cxx.

53 {
54  ;
55 }

Member Function Documentation

void genf::GFKalman::blowUpCovs ( GFTrack trk)
private

this is needed to blow up the covariance matrix before a fitting pass drops off-diagonal elements and blows up diagonal by blowUpFactor

Definition at line 158 of file GFKalman.cxx.

References fBlowUpFactor, genf::GFAbsTrackRep::getCov(), genf::GFTrack::getNumReps(), genf::GFAbsTrackRep::getStatusFlag(), genf::GFTrack::getTrackRep(), and genf::GFAbsTrackRep::setCov().

Referenced by processTrack(), and setErrorScaleMTh().

159 {
160  int nreps = trk->getNumReps();
161  for (int irep = 0; irep < nreps; ++irep) {
162  GFAbsTrackRep* arep = trk->getTrackRep(irep);
163  //dont do it for already compromsied reps, since they wont be fitted anyway
164  if (arep->getStatusFlag() == 0) {
165  TMatrixT<Double_t> cov = arep->getCov();
166  for (int i = 0; i < cov.GetNrows(); ++i) {
167  for (int j = 0; j < cov.GetNcols(); ++j) {
168  //if(i!=j){//off diagonal
169  // cov[i][j]=0.;
170  //}
171  //else{//diagonal
172  cov[i][j] = cov[i][j] * fBlowUpFactor;
173  //}
174  }
175  }
176  arep->setCov(cov);
177  }
178  }
179 }
double fBlowUpFactor
Definition: GFKalman.h:161
void genf::GFKalman::blowUpCovsDiag ( GFTrack trk)
private

Definition at line 135 of file GFKalman.cxx.

References fBlowUpFactor, genf::GFAbsTrackRep::getCov(), genf::GFTrack::getNumReps(), genf::GFAbsTrackRep::getStatusFlag(), genf::GFTrack::getTrackRep(), and genf::GFAbsTrackRep::setCov().

Referenced by setErrorScaleMTh().

136 {
137  int nreps = trk->getNumReps();
138  for (int irep = 0; irep < nreps; ++irep) {
139  GFAbsTrackRep* arep = trk->getTrackRep(irep);
140  //dont do it for already compromsied reps, since they wont be fitted anyway
141  if (arep->getStatusFlag() == 0) {
142  TMatrixT<Double_t> cov = arep->getCov();
143  for (int i = 0; i < cov.GetNrows(); ++i) {
144  for (int j = 0; j < cov.GetNcols(); ++j) {
145  if (i != j) { //off diagonal
146  cov[i][j] = 0.;
147  }
148  else { //diagonal
149  cov[i][j] = cov[i][j] * fBlowUpFactor;
150  // cov[0][0] = 0.1;
151  }
152  }
153  }
154  arep->setCov(cov);
155  }
156  }
157 }
double fBlowUpFactor
Definition: GFKalman.h:161
TMatrixT< Double_t > genf::GFKalman::calcCov7x7 ( const TMatrixT< Double_t > &  cov,
const genf::GFDetPlane plane 
)
private

Definition at line 668 of file GFKalman.cxx.

References genf::GFDetPlane::getU(), genf::GFDetPlane::getV(), GFException::setFatal(), and w.

Referenced by processHit(), and setErrorScaleMTh().

670 {
671  // This ends up, confusingly, as: 7 columns, 5 rows!
672  TMatrixT<Double_t> jac(7, 5); // X,Y,Z,UX,UY,UZ,Theta in detector coords
673 
674  TVector3 u = plane.getU();
675  TVector3 v = plane.getV();
676  TVector3 w = u.Cross(v);
677 
678  // Below line has been done, with code change in GFKalman that has updated
679  // the plane orientation by now.
680  // TVector3 pTilde = 1.0 * (w + state[1][0] * u + state[2][0] * v);
681  TVector3 pTilde = w;
682  double pTildeMag = pTilde.Mag();
683 
684  jac.Zero();
685  jac[6][0] = 1.; // Should be C as in GFSpacepointHitPolicy. 16-Feb-2013.
686 
687  jac[0][3] = u[0];
688  jac[1][3] = u[1];
689  jac[2][3] = u[2];
690 
691  jac[0][4] = v[0];
692  jac[1][4] = v[1];
693  jac[2][4] = v[2];
694 
695  // cnp'd from RKTrackRep.cxx, line ~496
696  // da{x,y,z}/du'
697  jac[3][1] = 1.0 / pTildeMag * (u.X() - pTilde.X() / (pTildeMag * pTildeMag) * u * pTilde);
698  jac[4][1] = 1.0 / pTildeMag * (u.Y() - pTilde.Y() / (pTildeMag * pTildeMag) * u * pTilde);
699  jac[5][1] = 1.0 / pTildeMag * (u.Z() - pTilde.Z() / (pTildeMag * pTildeMag) * u * pTilde);
700  // da{x,y,z}/dv'
701  jac[3][2] = 1.0 / pTildeMag * (v.X() - pTilde.X() / (pTildeMag * pTildeMag) * v * pTilde);
702  jac[4][2] = 1.0 / pTildeMag * (v.Y() - pTilde.Y() / (pTildeMag * pTildeMag) * v * pTilde);
703  jac[5][2] = 1.0 / pTildeMag * (v.Z() - pTilde.Z() / (pTildeMag * pTildeMag) * v * pTilde);
704 
705  // y = A.x => x = A^T.A.A^T.y
706  // Thus, y's Jacobians Jac become for x (Jac^T.Jac)^(-1) Jac^T
707 
708  TMatrixT<Double_t> jac_t(TMatrixT<Double_t>::kTransposed, jac);
709  TMatrixT<Double_t> jjInv(jac_t * jac);
710  //jInv.Zero();
711 
712  double det(0.0);
713  try {
714  jjInv.Invert(&det); // this is all 1s on the diagonal, perhaps
715  // to no one's surprise.
716  }
717  catch (cet::exception&) {
718  throw GFException(
719  "GFKalman: Jac.T*Jac is not invertible. But keep plowing on ... ", __LINE__, __FILE__)
720  .setFatal();
721  }
722  if (TMath::IsNaN(det)) {
723  throw GFException("GFKalman: det of Jac.T*Jac is nan", __LINE__, __FILE__).setFatal();
724  }
725 
726  TMatrixT<Double_t> j5x7 = jjInv * jac_t;
727  TMatrixT<Double_t> c7x7 = j5x7.T() * (cov * j5x7);
728  return c7x7;
729 }
Exception class for error handling in GENFIT (provides storage for diagnostic information) ...
Definition: GFException.h:47
TVector3 getU() const
Definition: GFDetPlane.h:78
GFException & setFatal(bool b=true)
set fatal flag. if this is true, the fit stops for this current track repr.
Definition: GFException.h:75
TVector3 getV() const
Definition: GFDetPlane.h:79
Float_t w
Definition: plot.C:20
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
TMatrixT< Double_t > genf::GFKalman::calcGain ( const TMatrixT< Double_t > &  cov,
const TMatrixT< Double_t > &  HitCov,
const TMatrixT< Double_t > &  H 
)
private

Calculate Kalman Gain.

Definition at line 731 of file GFKalman.cxx.

References e, GFException::setFatal(), and GFException::setMatrices().

Referenced by processHit(), and setErrorScaleMTh().

734 {
735 
736  // calculate covsum (V + HCH^T)
737 
738  // Comment next 3 out for normal running.
739  //cov.Print();
740  //H.Print();
741  //HitCov.Print();
742  TMatrixT<Double_t> covsum1(cov, TMatrixT<Double_t>::kMultTranspose, H);
743  // covsum1.Print();
744  TMatrixT<Double_t> covsum(H, TMatrixT<Double_t>::kMult, covsum1);
745 
746  //covsum.Print();
747 
748  covsum += HitCov;
749  //covsum = (covsum,TMatrixT<Double_t>::kPlus,HitCov);
750  // covsum.Print();
751 
752  // invert
753  double det = 0;
754  covsum.SetTol(1.0e-23); // to avoid inversion problem, EC, 8-Aug-2011.
755  covsum.Invert(&det);
756  // std::cout << "GFKalman:: calGain(), det is "<< det << std::endl;
757  if (TMath::IsNaN(det)) {
758  throw GFException("Kalman Gain: det of covsum is nan", __LINE__, __FILE__).setFatal();
759  }
760 
761  if (det == 0) {
762  GFException exc("cannot invert covsum in Kalman Gain - det=0", __LINE__, __FILE__);
763  exc.setFatal();
764  std::vector<TMatrixT<Double_t>> matrices;
765  matrices.push_back(cov);
766  matrices.push_back(HitCov);
767  matrices.push_back(covsum1);
768  matrices.push_back(covsum);
769  exc.setMatrices("cov, HitCov, covsum1 and covsum", matrices);
770  throw exc;
771  }
772 
773  // gain is CH^T/(V + HCH^T)
774  // calculate gain
775  TMatrixT<Double_t> gain1(H, TMatrixT<Double_t>::kTransposeMult, covsum);
776  TMatrixT<Double_t> gain(cov, TMatrixT<Double_t>::kMult, gain1);
777 
778  return gain;
779 }
Exception class for error handling in GENFIT (provides storage for diagnostic information) ...
Definition: GFException.h:47
GFException & setFatal(bool b=true)
set fatal flag. if this is true, the fit stops for this current track repr.
Definition: GFException.h:75
Float_t e
Definition: plot.C:35
double genf::GFKalman::chi2Increment ( const TMatrixT< Double_t > &  r,
const TMatrixT< Double_t > &  H,
const TMatrixT< Double_t > &  cov,
const TMatrixT< Double_t > &  V 
)
private

this returns the reduced chi2 increment for a hit

Definition at line 227 of file GFKalman.cxx.

References e, r, GFException::setFatal(), GFException::setMatrices(), and GFException::setNumbers().

Referenced by getChi2Hit(), processHit(), and setErrorScaleMTh().

231 {
232 
233  // residuals covariances:R=(V - HCH^T)
234  TMatrixT<Double_t> R(V);
235  TMatrixT<Double_t> covsum1(cov, TMatrixT<Double_t>::kMultTranspose, H);
236  TMatrixT<Double_t> covsum(H, TMatrixT<Double_t>::kMult, covsum1);
237 
238  R -= covsum;
239 
240  // chisq= r^TR^(-1)r
241  double det = 0.;
242  TMatrixT<Double_t> Rsave(R);
243  R.SetTol(1.0e-30); // to avoid inversion problem, EC, 8-Aug-2011. Was23, 9-Jan-2012.
244 
245  try {
246  R.Invert(&det);
247  }
248  catch (cet::exception&) {
249  GFException e("Kalman Chi2Increment: R is not even invertible. But keep plowing on ... ",
250  __LINE__,
251  __FILE__);
252  //e.setFatal();
253  //throw e;
254  }
255  if (TMath::IsNaN(det)) {
256  throw GFException("Kalman Chi2Increment: det of covsum is nan", __LINE__, __FILE__).setFatal();
257  }
258  TMatrixT<Double_t> residTranspose(r);
259  residTranspose.T();
260  TMatrixT<Double_t> chisq = residTranspose * (R * r);
261  assert(chisq.GetNoElements() == 1);
262 
263  if (TMath::IsNaN(chisq[0][0])) {
264  GFException exc("chi2 is nan", __LINE__, __FILE__);
265  exc.setFatal();
266  std::vector<double> numbers;
267  numbers.push_back(det);
268  exc.setNumbers("det", numbers);
269  std::vector<TMatrixT<Double_t>> matrices;
270  matrices.push_back(r);
271  matrices.push_back(V);
272  matrices.push_back(Rsave);
273  matrices.push_back(R);
274  matrices.push_back(cov);
275  exc.setMatrices("r, V, Rsave, R, cov", matrices);
276  throw exc;
277  }
278 
279  return chisq[0][0];
280 }
TRandom r
Definition: spectrum.C:23
Exception class for error handling in GENFIT (provides storage for diagnostic information) ...
Definition: GFException.h:47
GFException & setFatal(bool b=true)
set fatal flag. if this is true, the fit stops for this current track repr.
Definition: GFException.h:75
Float_t e
Definition: plot.C:35
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
void genf::GFKalman::fittingPass ( GFTrack trk,
int  dir 
)

Performs fit on a GFTrack beginning with the current hit.

Definition at line 181 of file GFKalman.cxx.

References genf::GFTrack::addFailedHit(), genf::GFBookkeeping::clearFailedHits(), e, genf::GFTrack::getBK(), genf::GFTrack::getNextHitToFit(), genf::GFTrack::getNumHits(), genf::GFTrack::getNumReps(), genf::GFAbsTrackRep::getStatusFlag(), genf::GFTrack::getTrackRep(), GFException::info(), GFException::isFatal(), processHit(), genf::GFAbsTrackRep::setChiSqu(), genf::GFAbsTrackRep::setNDF(), genf::GFTrack::setNextHitToFit(), genf::GFAbsTrackRep::setStatusFlag(), and GFException::what().

Referenced by processTrack(), and setNumIterations().

182 {
183  //loop over hits
184 
185  unsigned int nhits = trk->getNumHits();
186  unsigned int starthit = trk->getNextHitToFit();
187 
188  int nreps = trk->getNumReps();
189  int ihit = (int)starthit;
190 
191  //clear chi2 sum and ndf sum in track reps
192  for (int i = 0; i < nreps; ++i) {
193  GFAbsTrackRep* arep = trk->getTrackRep(i);
194  arep->setChiSqu(0.);
195  arep->setNDF(0);
196  }
197 
198  //clear failedHits and outliers
199  trk->getBK()->clearFailedHits();
200 
201  while ((ihit < (int)nhits && direction == 1) || (ihit > -1 && direction == -1)) {
202  // GFAbsRecoHit* ahit=trk->getHit(ihit);
203  // loop over reps
204  for (int irep = 0; irep < nreps; ++irep) {
205  GFAbsTrackRep* arep = trk->getTrackRep(irep);
206  if (arep->getStatusFlag() == 0) {
207  try {
208  processHit(trk, ihit, irep, direction);
209  }
210  catch (GFException& e) {
211  trk->addFailedHit(irep, ihit);
212  std::cerr << e.what();
213  e.info();
214  if (e.isFatal()) {
215  arep->setStatusFlag(1);
216  continue; // go to next rep immediately
217  }
218  }
219  }
220  } // end loop over reps
221  ihit += direction;
222  } // end loop over hits
223  trk->setNextHitToFit(ihit - 2 * direction);
224  //trk->printGFBookkeeping();
225 }
void processHit(GFTrack *, int, int, int)
One Kalman step.
Definition: GFKalman.cxx:307
bool isFatal()
get fatal flag.
Definition: GFException.h:81
void info()
print information in the exception object
Definition: GFException.cxx:61
const char * what() const noexcept override
standard error message handling for exceptions. use like "std::cerr << e.what();" ...
Definition: GFException.cxx:55
Exception class for error handling in GENFIT (provides storage for diagnostic information) ...
Definition: GFException.h:47
Float_t e
Definition: plot.C:35
double genf::GFKalman::getChi2Hit ( GFAbsRecoHit hit,
GFAbsTrackRep rep 
)

Calculates chi2 of a given hit with respect to a given track representation.

Definition at line 282 of file GFKalman.cxx.

References chi2Increment(), genf::GFAbsTrackRep::extrapolate(), fErrScaleMTh, genf::GFAbsRecoHit::getDetPlane(), genf::GFAbsTrackRep::getDim(), genf::GFAbsRecoHit::getHitCov(), genf::GFAbsRecoHit::getHMatrix(), r, and genf::GFAbsRecoHit::residualVector().

Referenced by setNumIterations().

283 {
284  // get prototypes for matrices
285  int repDim = rep->getDim();
286  TMatrixT<Double_t> state(repDim, 1);
287  TMatrixT<Double_t> cov(repDim, repDim);
288  ;
289  GFDetPlane pl = hit->getDetPlane(rep);
290  rep->extrapolate(pl, state, cov);
291 
292  TMatrixT<Double_t> H = hit->getHMatrix(rep);
293 
294  // get hit covariances
295  TMatrixT<Double_t> V = hit->getHitCov(pl);
296  V[0][0] *= fErrScaleMTh;
297  TMatrixT<Double_t> r = hit->residualVector(rep, state, pl);
298  assert(r.GetNrows() > 0);
299 
300  r[0][0] = fabs(r[0][0]);
301  //this is where chi2 is calculated
302  double chi2 = chi2Increment(r, H, cov, V);
303 
304  return chi2 / r.GetNrows();
305 }
TRandom r
Definition: spectrum.C:23
Double_t fErrScaleMTh
Definition: GFKalman.h:167
double chi2Increment(const TMatrixT< Double_t > &r, const TMatrixT< Double_t > &H, const TMatrixT< Double_t > &cov, const TMatrixT< Double_t > &V)
this returns the reduced chi2 increment for a hit
Definition: GFKalman.cxx:227
Detector simulation of raw signals on wires.
void genf::GFKalman::operator() ( GFTrack track)
inline

Operator for use with STL.

This operator allows to use the std::foreach algorithm with an STL container o GFTrack* objects.

Definition at line 67 of file GFKalman.h.

References processTrack().

67 { processTrack(track); }
void processTrack(GFTrack *)
Performs fit on a GFTrack.
Definition: GFKalman.cxx:57
Float_t track
Definition: plot.C:35
void genf::GFKalman::operator() ( std::pair< int, GFTrack * >  tr)
inline

Operator for use with STL.

This operator allows to use the std::foreach algorithm with an STL container o GFTrack* objects.

Definition at line 74 of file GFKalman.h.

References processTrack().

74 { processTrack(tr.second); }
void processTrack(GFTrack *)
Performs fit on a GFTrack.
Definition: GFKalman.cxx:57
void genf::GFKalman::processHit ( GFTrack tr,
int  ihit,
int  irep,
int  direction 
)
private

One Kalman step.

Performs

  • Extrapolation to detector plane of the hit
  • Calculation of residual and Kalman Gain
  • Update of track representation state and chi2

Definition at line 307 of file GFKalman.cxx.

References genf::GFAbsTrackRep::addChiSqu(), genf::GFAbsTrackRep::addNDF(), calcCov7x7(), calcGain(), chi2Increment(), COVEXC, larg4::dist(), E, e, genf::GFAbsTrackRep::extrapolate(), fErrScaleMTh, fGENfPRINT, fMaxUpdate, fMomHigh, fMomLow, genf::GFAbsTrackRep::getCov(), genf::GFAbsRecoHit::getDetPlane(), genf::GFAbsTrackRep::getDim(), genf::GFTrack::getHit(), genf::GFAbsRecoHit::getHitCov(), genf::GFAbsRecoHit::getHMatrix(), genf::GFTrack::getNumHits(), genf::GFDetPlane::getO(), genf::GFTrack::getPDG(), genf::GFAbsRecoHit::getRawHitCoord(), genf::GFAbsTrackRep::getReferencePlane(), genf::GFTrack::getRepAtHit(), genf::GFAbsTrackRep::getState(), genf::GFTrack::getTrackRep(), genf::GFDetPlane::getU(), genf::GFDetPlane::getV(), part, r, genf::GFAbsRecoHit::residualVector(), genf::GFAbsTrackRep::setData(), genf::GFTrack::setHitChi2(), genf::GFTrack::setHitCov(), genf::GFTrack::setHitCov7x7(), genf::GFTrack::setHitMeasuredCov(), genf::GFTrack::setHitPlaneU(), genf::GFTrack::setHitPlaneUxUyUz(), genf::GFTrack::setHitPlaneV(), genf::GFTrack::setHitPlaneXYZ(), genf::GFTrack::setHitState(), genf::GFTrack::setHitUpdate(), genf::GFTrack::setRepAtHit(), and w.

Referenced by fittingPass(), and setErrorScaleMTh().

308 {
309  GFAbsRecoHit* hit = tr->getHit(ihit);
310  GFAbsTrackRep* rep = tr->getTrackRep(irep);
311 
312  // get prototypes for matrices
313  int repDim = rep->getDim();
314  TMatrixT<Double_t> state(repDim, 1);
315  TMatrixT<Double_t> cov(repDim, repDim);
316  static TMatrixT<Double_t> covFilt(cov);
317  const double pi2(10.0);
318  GFDetPlane pl, plPrev;
319  unsigned int nhits = tr->getNumHits();
320  int phit = ihit;
321  static TMatrixT<Double_t> oldState(5, 1);
322  static std::vector<TVector3> pointsPrev;
323 
324  const double eps(1.0e-6);
325  if (direction > 0 && ihit > 0) { phit = ihit - 1; }
326  if (direction < 0 && ihit < ((int)nhits - 1)) { phit = ihit + 1; }
327  GFAbsRecoHit* hitPrev = tr->getHit(phit);
328 
329  /* do an extrapolation, if the trackrep irep is not given
330  * at this ihit position. This will usually be the case, but
331  * not if the fit turns around
332  */
333  // std::cout << "GFKalman::ProcessHit(): ihit is " << ihit << std::endl;
334  // std::cout << "GFKalman::ProcessHit(): direction is " << direction << std::endl;
335  //rep->Print();
336 
337  Double_t thetaPlanes(0.0);
338  if (ihit != tr->getRepAtHit(irep)) {
339  //std::cout << "not same" << std::endl;
340  // get the (virtual) detector plane. This call itself calls
341  // extrapolateToPoint(), which calls Extrap() with just 2 args and
342  // default 3rd arg, which propagates track through
343  // material to find the next plane. But it in fact seems
344  // to just return this pl and plPrev, as desired. Something in Extrap()
345  // kicks it out... even though I can see it walking through material ...
346  // A mystery.
347 
348  pl = hit->getDetPlane(rep);
349  plPrev = hitPrev->getDetPlane(rep);
350 
351  // std::cout << "GFKalman::ProcessHit(): hit is ... " << ihit << std::endl;
352  //hit->Print();
353  //std::cout << "GFKalman::ProcessHit(): plane is ... " << std::endl;
354  //pl.Print();
355 
356  //do the extrapolation. This calls Extrap(), which wraps up RKutta and
357  // GFMaterials calls. state is intialized, pl is unchanged. Latter behavior
358  // I will alter below.
359  try {
360  rep->extrapolate(pl, state, cov);
361  /*
362  if ( std::isnan(cov[0][0]) )
363  {
364  cov = covFilt;
365  }
366  else
367  {
368  covFilt = cov;
369  }
370  */
371  }
372  catch (cet::exception&) {
373  throw cet::exception("GFKalman.cxx: ")
374  << " Line " << __LINE__ << ", " << __FILE__ << " ...Rethrow. \n";
375  }
376  }
377  else {
378  pl = rep->getReferencePlane();
379  plPrev = hitPrev->getDetPlane(rep);
380  state = rep->getState();
381  cov = rep->getCov();
382  }
383 
384  // Update plane. This is a code change from Genfit out of box.
385  // state has accumulated the material/magnetic field changes since last
386  // step. Here, we make the *plane* at this step know about that bend.
387  // We will not, in the end, save this plane, cuz Genfit knows to properly
388  // calculate it later.
389  // Actually, I do *not* change the plane. EC, 11-May-2012.
390  TVector3 u(pl.getU());
391  TVector3 v(pl.getV());
392  TVector3 wold(u.Cross(v));
393  //Double_t sign(1.0);
394  //if ((direction==-1) && ihit==((int)nhits-1)) sign = -1.0;
395 
396  TVector3 pTilde = direction * (wold + state[1][0] * u + state[2][0] * v);
397  TVector3 w(pTilde.Unit());
398  // Find angle/vector through which we rotate. Use it subsequently.
399  TVector3 rot(wold.Cross(w));
400  Double_t ang(TMath::ACos(w * wold));
401  ang = TMath::Min(ang, 0.95 * TMath::Pi() / 2.0);
402  /*
403  {
404  u.Rotate(ang,rot);
405  v.Rotate(ang,rot);
406 
407  pl.setNormal(w);
408  pl.setU(u.Unit());
409  pl.setV(v.Unit());
410  }
411  */
412  if (cov[0][0] < 1.E-50 || TMath::IsNaN(cov[0][0])) {
413  //std::cout<<"GFKalman::processHit() 0. Calling Exception."<<std::endl;
414  GFException exc(COVEXC, __LINE__, __FILE__);
415  if (fGENfPRINT) cov.Print();
416  if (fGENfPRINT)
417  std::cout << "GFKalman::processHit() 1. No longer throw exception. Force cov[0][0] to 0.01."
418  << std::endl;
419  // std::cout<<"GFKalman::processHit() 1. About to throw GFException."<<std::endl;
420  cov = covFilt;
421  // throw exc;
422  // std::cout<<"GFKalman::processHit() 2. Back from GFException."<<std::endl;
423  }
424 
425  /*
426  if(direction==1){
427  tr->getBK(irep)->setMatrix("fPredSt",ihit,state);
428  tr->getBK(irep)->setMatrix("fPredCov",ihit,cov);
429  tr->getBK(irep)->setGFDetPlane("f",ihit,pl);
430  }
431  else{
432  tr->getBK(irep)->setMatrix("bPredSt",ihit,state);
433  tr->getBK(irep)->setMatrix("bPredCov",ihit,cov);
434  tr->getBK(irep)->setGFDetPlane("b",ihit,pl);
435  }
436  */
437 
438  // TMatrixT<Double_t> origcov=rep->getCov();
439 
440  int pdg = tr->getPDG();
441  TParticlePDG* part = TDatabasePDG::Instance()->GetParticle(pdg);
442  Double_t mass = part->Mass();
443 
444  Double_t dist = (pl.getO() - plPrev.getO()).Mag();
445  Double_t mom = fabs(1.0 / state[0][0]);
446  Double_t beta = mom / sqrt(mass * mass + mom * mom);
447  const Double_t lowerLim(0.01);
448  if (std::isnan(dist) || dist <= 0.0) dist = lowerLim; // don't allow 0s here.
449  if (std::isnan(beta) || beta < 0.01) beta = 0.01;
450  TMatrixT<Double_t> H = hit->getHMatrix(rep, beta, dist);
451 
452  // Can force huge error here on p and du,v/dw, and thus insensitivity to p,
453  // by setting V[0][0]->inf.
454  TMatrixT<Double_t> V = hit->getHitCov(pl, plPrev, state, mass);
455  V[0][0] *= fErrScaleMTh;
456  tr->setHitMeasuredCov(V);
457 
458  // calculate kalman gain ------------------------------
459  TMatrixT<Double_t> Gain(calcGain(cov, V, H));
460 
461  //std::cout << "GFKalman:: processHits(), state is " << std::endl;
462  //rep->getState().Print();
463 
464  TMatrixT<Double_t> res = hit->residualVector(rep, state, pl, plPrev, mass);
465  // calculate update -----------------------------------
466 
467  // TVector3 pointer((pl.getO()-plPrev.getO()).Unit());
468 
469  TMatrixT<Double_t> rawcoord = hit->getRawHitCoord();
470  TVector3 point(rawcoord[0][0], rawcoord[1][0], rawcoord[2][0]);
471  TMatrixT<Double_t> prevrawcoord = hitPrev->getRawHitCoord();
472  TVector3 pointPrev(prevrawcoord[0][0], prevrawcoord[1][0], prevrawcoord[2][0]);
473  pointsPrev.push_back(pointPrev);
474  TMatrixT<Double_t> Hnew(H);
475  if ((ihit == ((int)nhits - 1) && direction == -1) || (ihit == 0 && direction == 1))
476  pointsPrev.clear();
477 
478  TVector3 pointer((point - pointPrev).Unit());
479  static TVector3 pointerPrev(pointer);
480  if (ihit == 0 && direction == 1) {
481  pointer[0] = 0.0;
482  pointer[1] = 0.0;
483  pointer[2] = 1.0;
484  }
485  if (ihit == ((int)nhits - 1) && direction == -1) {
486  pointer[0] = 0.0;
487  pointer[1] = 0.0;
488  pointer[2] = -1.0;
489  }
490  double thetaMeas = TMath::Min(fabs(pointer.Angle(pointerPrev)), 0.95 * TMath::Pi() / 2.0);
491  // Below line introduced because it's not true we predict the angle to be
492  // precisely ang. If we'd taken this quantity from our transport result
493  // (with measurement errors in it) we'd expect a smear like this on ang.
494  // EC, 22-Feb-2012.
495  // Error is taken on th^2
496  ang = (Hnew * state)[0][0]; // H->Hnew
497 
498  // fErrScale is extra-fun bonus factor!
499  //thetaPlanes = ang*ang; // + fErrScaleSTh*gRandom->Gaus(0.0,V[0][0]);
500  thetaPlanes = gRandom->Gaus(0.0, ang * ang);
501  thetaPlanes = TMath::Min(sqrt(fabs(thetaPlanes)), 0.95 * TMath::Pi() / 2.0);
502 
503  Double_t dtheta = thetaMeas - thetaPlanes; // was fabs(res[0][0]). EC, 26-Jan-2012
504  if (((ihit == ((int)nhits - 1) || ihit == ((int)nhits - 2)) && direction == -1) ||
505  ((ihit == 0 || ihit == 1) && direction == 1)) {
506  dtheta = 0.0; // at the bare minimum (Jan-2013). Now (Feb-2013), ....
507  // Do not let these 4 points*direction influence the state or chi2.
508  rep->setData(state, pl, &cov); // This is where fState,
509  // fRefPlane and fCov are updated.
510  pointerPrev = pointer;
511  return;
512  }
513 
514  oldState = state;
515 
516  res[0][0] = dtheta / Hnew[0][0];
517  // The particle was propagated through material until its poca
518  // to this current hit was found. At that point its plane is defined,
519  // in which du/dw=dv/dw=0 by construction. But, there's a deviation
520  // in those two quantities measured in the *previous* plane which we want.
521  TVector3 uPrev(plPrev.getU());
522  TVector3 vPrev(plPrev.getV());
523  TVector3 wPrev(u.Cross(v));
524  // We want the newest momentum vector's d{u,v}/dw defined in the prev plane.
525  // That is the predicted du,v/dw. We will subtract from the actual.
526  // But the u's and v's need to come from the State not the Planes, cuz I
527  // haven't updated pl,plPrev per latest State. plFilt, the updated plPrev,
528  // is what we want. w is from updated new plane pl, per latest State.
529  // e.g. plFilt.
530  static GFDetPlane plFilt; //(pl);
531  if (plFilt.getO().Mag() > eps) {
532  uPrev = plFilt.getU();
533  vPrev = plFilt.getV();
534  wPrev = plFilt.getNormal();
535  }
536  //res[1][0] = (pointer*uPrev)/(pointer*wPrev) - (w*uPrev)/(w*wPrev);
537  //res[2][0] = (pointer*vPrev)/(pointer*wPrev) - (w*vPrev)/(w*wPrev);
538  // res[1][0] = 0.0;
539  // res[2][0] = 0.0;
540 
541  TMatrixT<Double_t> update = Gain * res;
542 
543  // Don't let crazy ass spacepoints which pull the fit all over the place
544  // be allowed to update the state. Use __ xRMS for fMaxUpdate.
545  // Use a larger limit (~0.1) when starting with too-high seed momentum.
546  // Smaller, when starting with an underestimate.
547  //
548  // Don't allow fits above 20 GeV, or so. Else, 1/p will likely
549  // migrate across zero. Similarly, don't allow tiny momentum.
550  //
551  tr->setHitUpdate(update);
552  if (fabs(update[0][0]) > fMaxUpdate) { // zero the gain so as to not update cov, state
553  // zero the updates
554  update[0][0] = 0.0; /* */
555  // update[0][0] = fMaxUpdate*update[0][0]/fabs(update[0][0]);
556  // either of below leads to craziness, somehow.
557  // update.Zero();
558  // Gain.Zero();
559  }
560  state += update; // prediction overwritten!
561 
562  // Debugging purposes
563  TMatrixT<Double_t> GH(Gain * Hnew);
564  if (GH[0][0] > 1.) {
565  // std::cout << "GFKalman:: Beginnings of a problem." << std::endl;
566  Hnew[0][0] = Hnew[0][0] - eps / Gain[0][0];
567  }
568  TMatrixT<Double_t> GHc(GH * cov);
569 
570  cov -= Gain * (Hnew * cov);
571 
572  // Below is protection required at end of contained track when
573  // momentum is tiny and cov[0][0] gets huge.
574 
575  // if (cov[0][0]>pi2/Hnew[0][0] || cov[0][0] <= 0.0 || TMath::IsNaN(cov[0][0]))
576  if (cov[0][0] <= 0.0 || TMath::IsNaN(cov[0][0])) {
577  cov[0][0] = pi2 / Hnew[0][0]; // some big value.a
578  //cov = covFilt;
579  }
580  else // store away a good cov matrix
581  {
582  covFilt = cov;
583  }
584 
585  TMatrixT<double> cov7x7(calcCov7x7(cov, pl));
586  tr->setHitCov(cov);
587  tr->setHitCov7x7(cov7x7);
588  tr->setHitState(state);
589 
590  if (fabs(1.0 / state[0][0]) < fMomLow)
591  state[0][0] = 1.0 / fMomLow * fabs(state[0][0]) / state[0][0];
592  if (fabs(1.0 / state[0][0]) > fMomHigh)
593  state[0][0] = 1.0 / fMomHigh * fabs(state[0][0]) / state[0][0];
594 
595  // Let's also calculate the "filtered" plane, and pointer here.
596  // Use those to calculate filtered chisq and pass to setHitPlane()
597  // for plane-by-plane correct "filtered" track pointing that gets
598  // stuffed into the Track().
599  TVector3 uf(pl.getU());
600  TVector3 vf(pl.getV());
601  TVector3 wf(uf.Cross(vf));
602  TVector3 Of(pl.getO());
603  // direction *
604  //Double_t sign2(1.0);
605  //if (direction==-1 && ihit==(int)nhits-1) sign2 = -1.0;
606 
607  TVector3 pf = direction * (wf + state[1][0] * uf + state[2][0] * vf);
608  TVector3 pposf = Of + state[3][0] * uf + state[4][0] * vf;
609  Double_t angf = TMath::Min(fabs(pf.Angle(wf)), 0.95 * TMath::Pi() / 2.0);
610  TVector3 rotf(wf.Cross(pf.Unit()));
611 
612  uf.Rotate(angf, rotf);
613  vf.Rotate(angf, rotf);
614  wf = uf.Cross(vf);
615  plFilt.setU(uf.Unit());
616  plFilt.setV(vf.Unit());
617  plFilt.setO(pposf);
618  plFilt.setNormal(pf.Unit());
619 
620  tr->setHitPlaneXYZ(plFilt.getO());
621  tr->setHitPlaneUxUyUz(plFilt.getNormal());
622  tr->setHitPlaneU(plFilt.getU());
623  tr->setHitPlaneV(plFilt.getV());
624 
625  // calculate filtered chisq from filtered residuals
626  TMatrixT<Double_t> r = hit->residualVector(rep, state, plFilt, plPrev, mass);
627  if (direction == -1) wold.Rotate(TMath::Pi(), wold.Orthogonal());
628  dtheta = thetaMeas - TMath::Min(fabs(wold.Angle(plFilt.getNormal())), 0.95 * TMath::Pi() / 2.);
629  r[0][0] = dtheta / Hnew[0][0];
630  //r[1][0] = (pointer*uPrev)/(pointer*wPrev) - (wf*uPrev)/(wf*wPrev);
631  //r[2][0] = (pointer*vPrev)/(pointer*wPrev) - (wf*vPrev)/(wf*wPrev);
632  //r[1][0] = 0.;
633  //r[2][0] = 0.;
634 
635  double chi2 = chi2Increment(r, Hnew, cov, V);
636  int ndf = r.GetNrows();
637  if (update[0][0] == 0.0) {
638  chi2 = 0.0;
639  ndf = 0;
640  };
641  rep->addChiSqu(chi2);
642  rep->addNDF(ndf);
643  pointerPrev = pointer;
644  tr->setHitChi2(chi2);
645  /*
646  if(direction==1){
647  tr->getBK(irep)->setNumber("fChi2",ihit,chi2/ndf);
648  }
649  else{
650  tr->getBK(irep)->setNumber("bChi2",ihit,chi2/ndf);
651  }
652  */
653 
654  // if we survive until here: update TrackRep
655  //rep->setState(state);
656  //rep->setCov(cov);
657  //rep->setReferencePlane(pl);
658 
659  // Since I've tilted the planes, d(u,v)/dw=0 by construction.
660  // But, I *haven't* tilted the planes! EC, 11-May-2012.
661  //state[1][0] = 0.0;
662  //state[2][0] = 0.0;
663  rep->setData(state, pl, &cov); // This is where fState,
664  // fRefPlane and fCov are updated.
665  tr->setRepAtHit(irep, ihit);
666 }
TRandom r
Definition: spectrum.C:23
Double_t fErrScaleMTh
Definition: GFKalman.h:167
TMatrixT< Double_t > calcGain(const TMatrixT< Double_t > &cov, const TMatrixT< Double_t > &HitCov, const TMatrixT< Double_t > &H)
Calculate Kalman Gain.
Definition: GFKalman.cxx:731
Double_t fMomLow
Definition: GFKalman.h:163
Double_t fMaxUpdate
Definition: GFKalman.h:165
TString part[npart]
Definition: Style.C:32
Float_t E
Definition: plot.C:20
double chi2Increment(const TMatrixT< Double_t > &r, const TMatrixT< Double_t > &H, const TMatrixT< Double_t > &cov, const TMatrixT< Double_t > &V)
this returns the reduced chi2 increment for a hit
Definition: GFKalman.cxx:227
Detector simulation of raw signals on wires.
bool fGENfPRINT
Definition: GFKalman.h:168
Double_t fMomHigh
Definition: GFKalman.h:164
Exception class for error handling in GENFIT (provides storage for diagnostic information) ...
Definition: GFException.h:47
constexpr double dist(const TReal *x, const TReal *y, const unsigned int dimension)
TMatrixT< Double_t > calcCov7x7(const TMatrixT< Double_t > &cov, const genf::GFDetPlane &plane)
Definition: GFKalman.cxx:668
#define COVEXC
Definition: GFKalman.cxx:36
Float_t e
Definition: plot.C:35
Float_t w
Definition: plot.C:20
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
void genf::GFKalman::processTrack ( GFTrack trk)

Performs fit on a GFTrack.

The hits are processed in the order in which they are stored in the GFTrack object. Sorting of hits in space has to be done before!

Definition at line 57 of file GFKalman.cxx.

References blowUpCovs(), genf::GFTrack::clearRepAtHit(), fInitialDirection, fittingPass(), fNumIt, genf::GFAbsTrackRep::getCov(), genf::GFTrack::getNumHits(), genf::GFTrack::getNumReps(), genf::GFAbsTrackRep::getReferencePlane(), genf::GFAbsTrackRep::getState(), genf::GFTrack::getTrackRep(), GFException::setFatal(), genf::GFAbsTrackRep::setFirstCov(), genf::GFAbsTrackRep::setFirstPlane(), genf::GFAbsTrackRep::setFirstState(), genf::GFAbsTrackRep::setLastCov(), genf::GFAbsTrackRep::setLastPlane(), genf::GFAbsTrackRep::setLastState(), genf::GFTrack::setNextHitToFit(), and switchDirection().

Referenced by operator()(), trkf::Track3DKalman::produce(), trkf::Track3DKalmanSPS::produce(), and setNumIterations().

58 {
59  int direction = fInitialDirection;
60  if ((direction != 1) && (direction != -1))
61  throw GFException(std::string(__func__) + ": wrong direction", __LINE__, __FILE__).setFatal();
62  // trk->clearGFBookkeeping();
63  trk->clearRepAtHit();
64  /*
65  int nreps=trk->getNumReps();
66  for(int i=0; i<nreps; ++i){
67  trk->getBK(i)->setNhits(trk->getNumHits());
68  trk->getBK(i)->bookMatrices("fPredSt");
69  trk->getBK(i)->bookMatrices("fPredCov");
70  trk->getBK(i)->bookMatrices("bPredSt");
71  trk->getBK(i)->bookMatrices("bPredCov");
72  trk->getBK(i)->bookGFDetPlanes("f");
73  trk->getBK(i)->bookGFDetPlanes("b");
74  trk->getBK(i)->bookNumbers("fChi2");
75  trk->getBK(i)->bookNumbers("bChi2");
76  }
77  */
78 
79  /*why is there a factor of two here (in the for statement)?
80  Because we consider one full iteration to be one back and
81  one forth fitting pass */
82  for (int ipass = 0; ipass < 2 * fNumIt; ipass++) {
83  // std::cout << "GFKalman:: numreps, numhits, ipass, direction"<< trk->getNumReps()<<", "<< trk->getNumHits()<<", "<< ipass<<", " <<direction << std::endl;
84  // if(floor(ipass/2)==fNumIt && direction==1) blowUpCovsDiag(trk);
85  if (ipass > 0) blowUpCovs(trk); // Back to >0, not >=0 EC, 9-11-Feb-2013
86  if (direction == 1) { trk->setNextHitToFit(0); }
87  else {
88  trk->setNextHitToFit(trk->getNumHits() - 1);
89  }
90 
91  try {
92  fittingPass(trk, direction);
93  }
94  catch (GFException&) {
95  throw cet::exception("GFKalman.cxx: ")
96  << " Line " << __LINE__ << ", " << __FILE__ << " ...Rethrow. \n";
97  }
98 
99  //save first and last plane,state&cov after the fitting pass
100  if (direction == 1) { //forward at last hit
101  int nreps = trk->getNumReps();
102  for (int i = 0; i < nreps; ++i) {
103  trk->getTrackRep(i)->setLastPlane(trk->getTrackRep(i)->getReferencePlane());
104  trk->getTrackRep(i)->setLastState(trk->getTrackRep(i)->getState());
105  trk->getTrackRep(i)->setLastCov(trk->getTrackRep(i)->getCov());
106  }
107  }
108  else { //backward at first hit
109  int nreps = trk->getNumReps();
110  for (int i = 0; i < nreps; ++i) {
111  trk->getTrackRep(i)->setFirstPlane(trk->getTrackRep(i)->getReferencePlane());
112  trk->getTrackRep(i)->setFirstState(trk->getTrackRep(i)->getState());
113  trk->getTrackRep(i)->setFirstCov(trk->getTrackRep(i)->getCov());
114  }
115  }
116 
117  //switch direction of fitting and also inside all the reps
118  if (direction == 1)
119  direction = -1;
120  else
121  direction = 1;
123  }
124  return;
125 }
void fittingPass(GFTrack *, int dir)
Performs fit on a GFTrack beginning with the current hit.
Definition: GFKalman.cxx:181
void blowUpCovs(GFTrack *trk)
this is needed to blow up the covariance matrix before a fitting pass drops off-diagonal elements and...
Definition: GFKalman.cxx:158
int fInitialDirection
Definition: GFKalman.h:159
void switchDirection(GFTrack *trk)
Used to switch between forward and backward filtering.
Definition: GFKalman.cxx:127
Exception class for error handling in GENFIT (provides storage for diagnostic information) ...
Definition: GFException.h:47
GFException & setFatal(bool b=true)
set fatal flag. if this is true, the fit stops for this current track repr.
Definition: GFException.h:75
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
Int_t fNumIt
Definition: GFKalman.h:160
void genf::GFKalman::setBlowUpFactor ( double  f)
inline

Set the blowup factor (see blowUpCovs() )

Definition at line 116 of file GFKalman.h.

References f, and fBlowUpFactor.

Referenced by trkf::Track3DKalmanSPS::produce().

116 { fBlowUpFactor = f; }
TFile f
Definition: plotHisto.C:6
double fBlowUpFactor
Definition: GFKalman.h:161
void genf::GFKalman::setErrorScaleMTh ( Double_t  f)
inline

Definition at line 121 of file GFKalman.h.

References blowUpCovs(), blowUpCovsDiag(), calcCov7x7(), calcGain(), chi2Increment(), f, fErrScaleMTh, processHit(), r, and switchDirection().

Referenced by trkf::Track3DKalmanSPS::produce().

121 { fErrScaleMTh = f; }
Double_t fErrScaleMTh
Definition: GFKalman.h:167
TFile f
Definition: plotHisto.C:6
void genf::GFKalman::setErrorScaleSTh ( Double_t  f)
inline

Definition at line 120 of file GFKalman.h.

References f, and fErrScaleSTh.

Referenced by trkf::Track3DKalmanSPS::produce().

120 { fErrScaleSTh = f; }
TFile f
Definition: plotHisto.C:6
Double_t fErrScaleSTh
Definition: GFKalman.h:166
void genf::GFKalman::setInitialDirection ( int  d)
inline

Sets the inital direction of the track fit (1 for inner to outer, or -1 for outer to inner). The standard is 1 and is set in the ctor.

Definition at line 112 of file GFKalman.h.

References d, and fInitialDirection.

Referenced by trkf::Track3DKalmanSPS::produce().

112 { fInitialDirection = d; }
int fInitialDirection
Definition: GFKalman.h:159
Float_t d
Definition: plot.C:235
void genf::GFKalman::setLazy ( Int_t  )
inline

Switch lazy error handling.

This is a historically left-over method and shall be deleted some time

Definition at line 82 of file GFKalman.h.

83  {
84  std::cerr << "Using outdates setLazy method of class GFKalman:" << std::endl;
85  }
void genf::GFKalman::setMaxUpdate ( Double_t  f)
inline

Definition at line 119 of file GFKalman.h.

References f, and fMaxUpdate.

Referenced by trkf::Track3DKalmanSPS::produce().

119 { fMaxUpdate = f; }
TFile f
Definition: plotHisto.C:6
Double_t fMaxUpdate
Definition: GFKalman.h:165
void genf::GFKalman::setMomHigh ( Double_t  f)
inline

Definition at line 118 of file GFKalman.h.

References f, and fMomHigh.

Referenced by trkf::Track3DKalmanSPS::produce().

118 { fMomHigh = f; }
TFile f
Definition: plotHisto.C:6
Double_t fMomHigh
Definition: GFKalman.h:164
void genf::GFKalman::setMomLow ( Double_t  f)
inline

Definition at line 117 of file GFKalman.h.

References f, and fMomLow.

Referenced by trkf::Track3DKalmanSPS::produce().

117 { fMomLow = f; }
TFile f
Definition: plotHisto.C:6
Double_t fMomLow
Definition: GFKalman.h:163
void genf::GFKalman::setNumIterations ( Int_t  i)
inline

Set number of iterations for Kalman Filter.

One iteration is one forward pass plus one backward pass

Definition at line 91 of file GFKalman.h.

References dir, fittingPass(), fNumIt, getChi2Hit(), and processTrack().

Referenced by trkf::Track3DKalman::produce(), and trkf::Track3DKalmanSPS::produce().

91 { fNumIt = i; }
Int_t fNumIt
Definition: GFKalman.h:160
void genf::GFKalman::switchDirection ( GFTrack trk)
private

Used to switch between forward and backward filtering.

Definition at line 127 of file GFKalman.cxx.

References genf::GFTrack::getNumReps(), genf::GFTrack::getTrackRep(), and genf::GFAbsTrackRep::switchDirection().

Referenced by processTrack(), and setErrorScaleMTh().

128 {
129  int nreps = trk->getNumReps();
130  for (int i = 0; i < nreps; ++i) {
131  trk->getTrackRep(i)->switchDirection();
132  }
133 }

Member Data Documentation

double genf::GFKalman::fBlowUpFactor
private

Definition at line 161 of file GFKalman.h.

Referenced by blowUpCovs(), blowUpCovsDiag(), and setBlowUpFactor().

Double_t genf::GFKalman::fErrScaleMTh
private

Definition at line 167 of file GFKalman.h.

Referenced by getChi2Hit(), processHit(), and setErrorScaleMTh().

Double_t genf::GFKalman::fErrScaleSTh
private

Definition at line 166 of file GFKalman.h.

Referenced by setErrorScaleSTh().

bool genf::GFKalman::fGENfPRINT
private

Definition at line 168 of file GFKalman.h.

Referenced by processHit().

int genf::GFKalman::fInitialDirection
private

Definition at line 159 of file GFKalman.h.

Referenced by processTrack(), and setInitialDirection().

Double_t genf::GFKalman::fMaxUpdate
private

Definition at line 165 of file GFKalman.h.

Referenced by processHit(), and setMaxUpdate().

Double_t genf::GFKalman::fMomHigh
private

Definition at line 164 of file GFKalman.h.

Referenced by processHit(), and setMomHigh().

Double_t genf::GFKalman::fMomLow
private

Definition at line 163 of file GFKalman.h.

Referenced by processHit(), and setMomLow().

Int_t genf::GFKalman::fNumIt
private

Definition at line 160 of file GFKalman.h.

Referenced by processTrack(), and setNumIterations().


The documentation for this class was generated from the following files: