6 TMatrixT<double> smoothed_state;
7 TMatrixT<double> smoothed_cov;
13 TMatrixT<double> pos_tmp(H * smoothed_state);
14 pos.ResizeTo(pos_tmp);
24 TMatrixT<double> smoothed_state;
25 TMatrixT<double> smoothed_cov;
31 H.Print();smoothed_state.Print();
32 TMatrixT<double> pos_tmp(H * smoothed_state);
33 pos.ResizeTo(pos_tmp);
43 TMatrixT<double> smoothed_state;
44 TMatrixT<double> smoothed_cov;
50 TMatrixT<double> cov_tmp(smoothed_cov,TMatrixT<double>::kMultTranspose,H);
51 TMatrixT<double> cov(H,TMatrixT<double>::kMult,cov_tmp);
59 TMatrixT<double> smoothed_state;
60 TMatrixT<double> smoothed_cov;
66 TMatrixT<double> cov_tmp(smoothed_cov,TMatrixT<double>::kMultTranspose,H);
67 TMatrixT<double> cov(H,TMatrixT<double>::kMult,cov_tmp);
76 TMatrixT<double> auxInfo;
84 TMatrixT<double> auxInfo;
91 TMatrixT<double> auxInfo;
98 TMatrixT<double> auxInfo;
106 std::cout <<
"Trying to get smoothed hit coordinates from a track without smoothing! Aborting..." << std::endl;
107 TMatrixT<double> failed(1,1);
112 std::cout <<
"Hit number out of bounds while trying to get smoothed hit coordinates! Aborting..." <<std::endl;
113 TMatrixT<double> failed(1,1);
118 TMatrixT<double> fUpSt;
119 TMatrixT<double> fUpCov;
120 TMatrixT<double> fAuxInfo;
121 TMatrixT<double>* fAuxInfoP;
122 TMatrixT<double> bUpSt;
123 TMatrixT<double> bUpCov;
124 TMatrixT<double> bAuxInfo;
125 TMatrixT<double>* bAuxInfoP;
143 bAuxInfoP = &bAuxInfo;
147 if(bUpSt.GetNrows() == 0)
return false;
148 rep->
setData(bUpSt,bPl,&bUpCov,bAuxInfoP);
149 rep->
extrapolate(smoothing_plane,smoothed_state,smoothed_cov);
160 fAuxInfoP = &fAuxInfo;
164 if(fUpSt.GetNrows() == 0)
return false;
165 rep->
setData(fUpSt,fPl,&fUpCov,fAuxInfoP);
166 rep->
extrapolate(smoothing_plane,smoothed_state,smoothed_cov);
177 fAuxInfoP = &fAuxInfo;
178 bAuxInfoP = &bAuxInfo;
180 fAuxInfoP = bAuxInfoP = NULL;
187 TMatrixT<double> fSt;
188 TMatrixT<double> fCov;
189 TMatrixT<double> bSt;
190 TMatrixT<double> bCov;
192 if(fUpSt.GetNrows() == 0 || bUpSt.GetNrows() == 0)
return false;
194 rep->
setData(fUpSt,fPl,&fUpCov,fAuxInfoP);
196 rep->
setData(bUpSt,bPl,&bUpCov,bAuxInfoP);
201 TMatrixT<double> fCovInvert;
202 TMatrixT<double> bCovInvert;
209 smoothed_state.ResizeTo(smoothed_cov * (fCovInvert*fSt + bCovInvert*bSt));
210 smoothed_state = smoothed_cov * (fCovInvert*fSt + bCovInvert*bSt);
219 std::cout <<
"Trying to get smoothed hit coordinates from a track without smoothing! Aborting..." << std::endl;
220 TMatrixT<double> failed(1,1);
225 std::cout <<
"Hit number out of bounds while trying to get smoothed hit coordinates! Aborting..." <<std::endl;
226 TMatrixT<double> failed(1,1);
231 TMatrixT<double> bUpSt;
232 TMatrixT<double> bUpCov;
233 TMatrixT<double> bAuxInfo;
234 TMatrixT<double>* bAuxInfoP;
257 TMatrixT<double> fSt;
258 TMatrixT<double> fCov;
266 bAuxInfoP = &bAuxInfo;
274 TMatrixT<double> bSt;
275 TMatrixT<double> bCov;
277 if(bUpSt.GetNrows() == 0)
return false;
279 rep->
setData(bUpSt,bPl,&bUpCov,bAuxInfoP);
284 TMatrixT<double> fCovInvert;
285 TMatrixT<double> bCovInvert;
292 smoothed_state.ResizeTo(smoothed_cov * (fCovInvert*fSt + bCovInvert*bSt));
293 smoothed_state = smoothed_cov * (fCovInvert*fSt + bCovInvert*bSt);
337 TDecompSVD invertAlgo(mat);
340 if (!(mat<1.E100) || !(mat>-1.E100)){
341 GFException e(
"cannot invert matrix GFTools::invertMatrix(), entries too big (>1E100)",
347 invertAlgo.SetTol(1E-50);
349 inv = invertAlgo.Invert(status);
351 GFException e(
"cannot invert matrix GFTools::invertMatrix(), status = 0",
359 TMatrixT<double> smoothed_state;
360 TMatrixT<double> smoothed_cov;
363 TMatrixT<double> HT(TMatrixT<double>::kTransposed, H);
364 TMatrixT<double>
pos = H * smoothed_state;
367 TMatrixT<double>
res = m -
pos;
368 TMatrixT<double> resT(TMatrixT<double>::kTransposed, res);
369 TMatrixT<double>
R = V - H*smoothed_cov*HT;
370 TMatrixT<double> invR;
372 TMatrixT<double> smoothedChiSqu = resT*invR*
res;
373 return smoothedChiSqu[0][0];
Base Class for genfit track representations. Defines interface for track parameterizations.
GFBookkeeping * getBK(int index=-1)
get GFBookKeeping object for particular track rep (default is cardinal rep)
unsigned int getNumHits() const
Detector plane genfit geometry class.
Track object for genfit. genfit algorithms work on these objects.
bool getSmoothing()
Read back if smoothing is/was turned on or off for this track.
bool getDetPlane(std::string key, unsigned int index, GFDetPlane &pl)
virtual bool hasAuxInfo()
See if the track representation has auxillary information stored.
virtual TMatrixT< double > getHMatrix(const GFAbsTrackRep *stateVector)=0
Get transformation matrix. Transformation between hit coordinates and track representation coordinate...
TMatrixT< double > getRawHitCoord() const
Get raw hit coordinates.
virtual double extrapolate(const GFDetPlane &plane, TMatrixT< double > &statePred)
returns the tracklength spanned in this extrapolation
GFAbsTrackRep * getTrackRep(int id) const
Accessor for track representations.
bool getMatrix(std::string key, unsigned int index, TMatrixT< double > &mat)
Exception class for error handling in GENFIT (provides storage for diagnostic information) ...
GFAbsRecoHit * getHit(int id) const
void setFatal(bool b=true)
set fatal flag. if this is true, the fit stops for this current track repr.
virtual void setData(const TMatrixT< double > &st, const GFDetPlane &pl, const TMatrixT< double > *cov=NULL, const TMatrixT< double > *aux=NULL)
Puts the track representation in a given state.
TMatrixT< double > getRawHitCov() const
Get raw hit covariances.
virtual GFAbsTrackRep * clone() const =0