#include <LinearFit.h>
Static Public Member Functions | |
| static Int_t | Unweighted (const Int_t, const Double_t *, const Double_t *, Double_t *) |
| static Int_t | Weighted (const Int_t, const Double_t *, const Double_t *, const Double_t *, Double_t *) |
| static Int_t | Weighted (const Int_t, const Double_t *, const Double_t *, const Double_t *, Double_t *, Double_t *) |
Private Member Functions | |
| LinearFit () | |
Definition at line 22 of file LinearFit.h.
| LinearFit::LinearFit | ( | ) | [private] |
| Int_t LinearFit::Unweighted | ( | const | Int_t, | |
| const Double_t * | , | |||
| const Double_t * | , | |||
| Double_t * | ||||
| ) | [static] |
Definition at line 20 of file LinearFit.cxx.
Referenced by AlgTrackSRList::CheckForBadClusters(), and AlgTrackSRList::IdentifyBadTracks().
00021 { 00022 Double_t *w = new Double_t[n]; 00023 for (Int_t i=0; i<n; i++) w[i] = 1.; 00024 Int_t fitflag = Weighted(n,x,y,w,parm); 00025 delete [] w; 00026 return fitflag; 00027 00028 }
| Int_t LinearFit::Weighted | ( | const | Int_t, | |
| const Double_t * | , | |||
| const Double_t * | , | |||
| const Double_t * | , | |||
| Double_t * | , | |||
| Double_t * | ||||
| ) | [static] |
Definition at line 40 of file LinearFit.cxx.
00042 { 00043 Double_t sumx=0.; 00044 Double_t sumx2=0.; 00045 Double_t sumy=0.; 00046 Double_t sumy2=0.; 00047 Double_t sumxy=0.; 00048 Double_t sumw=0.; 00049 00050 parm[0] = 0.; 00051 parm[1] = 0.; 00052 eparm[0] = 0.; 00053 eparm[1] = 0.; 00054 00055 for (Int_t i=0; i<n; i++) { 00056 sumx += x[i]*w[i]; 00057 sumx2 += x[i]*x[i]*w[i]; 00058 sumy += y[i]*w[i]; 00059 sumy2 += y[i]*y[i]*w[i]; 00060 sumxy += x[i]*y[i]*w[i]; 00061 sumw += w[i]; 00062 } 00063 00064 if (sumx2*sumw-sumx*sumx==0.) return 1; 00065 if (sumx2-sumx*sumx/sumw==0.) return 1; 00066 00067 parm[0] = (sumy*sumx2-sumx*sumxy)/(sumx2*sumw-sumx*sumx); 00068 parm[1] = (sumxy-sumx*sumy/sumw)/(sumx2-sumx*sumx/sumw); 00069 00070 eparm[0] = sumx2*(sumx2*sumw-sumx*sumx); 00071 eparm[1] = (sumx2-sumx*sumx/sumw); 00072 00073 if (eparm[0]<0. || eparm[1]<0.) return 1; 00074 00075 eparm[0] = sqrt(eparm[0])/(sumx2*sumw-sumx*sumx); 00076 eparm[1] = sqrt(eparm[1])/(sumx2-sumx*sumx/sumw); 00077 00078 return 0; 00079 00080 }
| Int_t LinearFit::Weighted | ( | const | Int_t, | |
| const Double_t * | , | |||
| const Double_t * | , | |||
| const Double_t * | , | |||
| Double_t * | ||||
| ) | [static] |
Definition at line 31 of file LinearFit.cxx.
Referenced by FitTrackMSListModule::Ana(), HoughTrackSR::FillHough(), UberModuleLite::FillNtpTrackLinearFit(), UberModule::FillNtpTrackLinearFit(), NtpSRModule::FillNtpTrackLinearFit(), AlgTrackSRList::FindTimingDirection(), AlgTrackSR::FindTimingDirection(), AlgShowerSR::FindTimingDirection(), AlgFitTrackSR::FindTimingDirection(), CandTrackSRHandle::GetDirCos(), CandTrackCamHandle::GetDirCos(), AlgTrackSRList::IsBestClusterInPlane(), AlgTrackSRList::RunAlg(), and AlgShowerSR::RunAlg().
00033 { 00034 Double_t eparm[2]; 00035 Int_t fitflag = Weighted(n,x,y,w,parm,eparm); 00036 return fitflag; 00037 }
1.4.7