/****************************************************************************** * $Id: CbmRichRingFitterTAU.cxx,v 1.4 2006/09/13 14:55:18 hoehne Exp $ * * Class : CbmRichRingFitterTAU * Description: This is the implementation of a particular fittng class. * Here the ring is fitted with the TAU algorithm and different weight functions * from A. Ayriyan/ G. Ososkov * * Algorithm: Alexander Ayriyan 10.08.2005, Gennadi Ososkov * Adoption to new Fitter Class : Claudia Hoehne * E-mail : C.Hoehne@gsi.de * ******************************************************************************* * $Log: CbmRichRingFitterTAU.cxx,v $ * Revision 1.4 2006/09/13 14:55:18 hoehne * new optimal weight function added for improved fitting * * Revision 1.3 2006/08/03 13:23:58 hoehne * new ring radius correction parameters (for rich_standard.geo, JUN06) * (Petr Stolpovsky) * * Revision 1.2 2006/07/17 14:06:25 hoehne * ring radius correction added, see P. Stolpovsky, CBM simulation meeting 14.7.2006 * * Revision 1.1 2006/01/25 13:33:19 hoehne * initial version: ring fitting routines so far implemented in CbmRichLightSpot * * * *******************************************************************************/ #include "CbmRichRingFitterTAU.h" #include "CbmRichRing.h" #include "CbmRootManager.h" #include "CbmRichHit.h" #include ClassImp(CbmRichRingFitterTAU) // ----- Default constructor ------------------------------------------- CbmRichRingFitterTAU::CbmRichRingFitterTAU() { fRobust = 0; fVerbose = 1; fCorrection = 1; } // ------------------------------------------------------------------------- // ----- Standard constructor ------------------------------------------- CbmRichRingFitterTAU::CbmRichRingFitterTAU(Int_t verbose,Double_t correction,Int_t robust) { fRobust = robust; fVerbose = verbose; fCorrection = correction; } // ------------------------------------------------------------------------- // ----- Destructor ---------------------------------------------------- CbmRichRingFitterTAU::~CbmRichRingFitterTAU() { } // ------------------------------------------------------------------------- // ----- Public method DoFit ------------------------------------------ void CbmRichRingFitterTAU::DoFit(CbmRichRing *pRing) { Int_t fNhits=pRing->GetNoOfHits(); if (fVerbose > 1) { cout<<" RingFitTAU: Number of Hits in this ring : "< 1) cout<<" - ERROR - correction value not valid: has to be either 0 (no cor.) or 1 (cor.) "<SetRadius(fRadius); pRing->SetCenterX(fCentreX); pRing->SetCenterY(fCentreY); return; } CbmRichHit *hit = NULL; Int_t i, iter, iterMax=20; Int_t riter, RiterMax = 4; Double_t Xi,Yi,Zi; Double_t M0,Mx,My,Mz,Mxy,Mxx,Myy,Mxz,Myz,Mzz,Mxz2,Myz2,Cov_xy; Double_t A0,A1,A2,A22,A3,A33,epsilon=0.000000000001; Double_t Dy,xnew,xold,ynew,yold=100000000000.; Double_t GAM,DET; Double_t Xcenter,Ycenter,Radius; Double_t sigma; Double_t ctsigma; Double_t dist,weight; const Double_t ct = 3.; const Double_t copt = 0.2; const Double_t zero = 0.0001; const Double_t SigmaMin = 0.18; Double_t amax = -100000; Double_t amin = 100000; Double_t sig1 = 0.; Double_t sig2 = 0.; vector x; // x coordinats of hits; vector y; // y coordinats of hits; vector a; // amplitudes of hits; vector w; // weights of points; vector d; // distance between points and circle; if(fRobust < 1 || fRobust > 2){ if(fVerbose > 1) cout<<"TAU (Taubin) algorithm for fit points by circle"<1) cout <<"TAU (Taubin) algorithm for robust fit points by circle with Tukey's weight function"<1) cout <<"TAU (Taubin) algorithm for robust fit points by circle with optimal weight function"<GetHit(i); x.push_back(hit->X()); y.push_back(hit->Y()); a.push_back(hit->GetAmplitude()); // cout<<"x = "<SetRadius(fRadius); pRing->SetCenterX(fCentreX); pRing->SetCenterY(fCentreY); CalcChi2(pRing); if (fVerbose > 1 && fCorrection ==1) cout << " Radius before correction: " << fRadius << endl; // Radius correction (Petr Stolpovsky, for the method see CBM simulation meeting, 14.7.06) Double_t xx,yy; xx=fCentreX; yy=TMath::Abs(fCentreY); Double_t Rxy=TMath::Sqrt(xx*xx+(yy-y0)*(yy-y0)); Double_t N=(fCorrection*(A*Rxy+B*Rxy*Rxy+C*Rxy*Rxy*Rxy)/R0)+1.; // if fCorrection = 0: no correction done fRadius=fRadius/N; //end of correction if (TMath::IsNaN(fRadius) == 1) fRadius = 0.; if (TMath::IsNaN(fCentreX) == 1) pRing->SetCenterX(0.); if (TMath::IsNaN(fCentreY) == 1) pRing->SetCenterY(0.); pRing->SetRadius(fRadius); if (fVerbose > 1) cout<<"fRadius , fCentreX, fCentreY :"<