Ignore:
Timestamp:
05/14/04 12:24:31 (21 years ago)
Author:
jlopez
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mtemp/MFindStars.cc

    r4060 r4071  
    588588  Float_t expY = star->GetYExp();
    589589 
     590  Float_t max=0;
     591  Float_t meanX=0;
     592  Float_t meanY=0;
     593  Float_t meanSqX=0;
     594  Float_t meanSqY=0;
     595  Float_t sumCharge=0;
     596  UInt_t usedPx=0;     
     597
     598  const Float_t meanPresition = 3.; //[mm]
     599  const UInt_t maxNumIterations = 10;
     600  UInt_t numIterations = 0;
     601
     602  do
     603    {
    590604  // First define a area of interest around the expected position of the star
    591605  for (UInt_t pix=1; pix<numPixels; pix++)
     
    606620   
    607621// determine mean x and mean y
    608     Float_t max=0;
    609     Float_t meanX=0;
    610     Float_t meanY=0;
    611     Float_t meanSqX=0;
    612     Float_t meanSqY=0;
    613     Float_t sumCharge=0;
    614     UInt_t usedPx=0;   
     622    usedPx=0;   
    615623    for(UInt_t pix=0; pix<numPixels; pix++)
    616624    {
     
    619627            usedPx++;
    620628
    621             Float_t charge  = fDisplay.GetBinContent(pix+1)-fPedestalDC;
     629            Float_t charge  = fDisplay.GetBinContent(pix+1);
    622630            Float_t pixXpos = (*fGeomCam)[pix].GetX();
    623631            Float_t pixYpos = (*fGeomCam)[pix].GetY();
     
    639647    meanSqY /= sumCharge;
    640648
    641     Float_t rmsX = (meanSqX - meanX*meanX);
    642     Float_t rmsY = (meanSqY - meanY*meanY);
     649    expX = meanX;
     650    expY = meanY;
     651
     652    if (++numIterations >  maxNumIterations)
     653      {
     654        *fLog << warn << GetName() << "Mean calculation not converge after " << maxNumIterations << " iterations" << endl;
     655        break;
     656      }
     657       
     658    }while(TMath::Abs(meanX-expX) > meanPresition || TMath::Abs(meanY-expY) > meanPresition);
     659 
     660    Float_t rmsX = (meanSqX - meanX*meanX) - fRingInterest*fRingInterest/12;
     661    Float_t rmsY = (meanSqY - meanY*meanY) - fRingInterest*fRingInterest/12;
    643662
    644663    if ( rmsX > 0)
     
    647666      {
    648667        *fLog << warn << " MFindStars::FindStar negative rmsX² " << rmsX << endl;
    649         *fLog << warn << " meanSqX " << meanSqX << " meanX " << meanX << " sumCharge " << sumCharge << endl;
     668        *fLog << warn << " meanSqX " << meanSqX << " meanX " << meanX << " fRingInterest " << fRingInterest << " sumCharge " << sumCharge << endl;
    650669        rmsX = 0.;
    651670      }
     
    656675      {
    657676        *fLog << warn << " MFindStars::FindStar negative rmsY² " << rmsY << endl;
    658         *fLog << warn << " meanSqY " << meanSqY << " meanY " << meanY << endl;
     677        *fLog << warn << " meanSqY " << meanSqY << " meanY " << meanY << " fRingInterest " << fRingInterest << " sumCharge " << sumCharge<< endl;
    659678        rmsY = 0.;
    660679      }
    661680   
     681    // Substrack pedestal DC
     682    sumCharge-=fPedestalDC*usedPx;
     683    max-=fPedestalDC;
     684   
     685
    662686    star->SetCalcValues(sumCharge,max,meanX,meanY,rmsX,rmsY);
    663687
    664688    if (rmsX <= 0. || rmsY <= 0.)
    665689      return kFALSE;
     690   
    666691   
    667692// fit the star spot using TMinuit
Note: See TracChangeset for help on using the changeset viewer.