Ignore:
Timestamp:
08/09/04 15:48:03 (20 years ago)
Author:
wittek
Message:
*** empty log message ***
File:
1 edited

Legend:

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

    r4433 r4545  
    1616!
    1717!
    18 !   Author(s): Javier López , 4/2004 <mailto:jlopez@ifae.es>
    19 !   Author(s): Robert Wagner, 7/2004 <mailto:rwagner@mppmu.mpg.de>
     18!   Author(s): Javier López ,   4/2004 <mailto:jlopez@ifae.es>
     19!              Robert Wagner,   7/2004 <mailto:rwagner@mppmu.mpg.de>
     20!              Wolfgang Wittek, 8/2004 <mailto:wittek@mppmu.mpg.de>
    2021!
    2122!   Copyright: MAGIC Software Development, 2000-2004
     
    5354
    5455    //Info from calculation
    55 
    5656     fMagCalc = 0.;
    5757     fMaxCalc = 0.;
     
    6161     fSigmaMajorAxisCalc = 0.;
    6262
    63     //Info from fit
    64 
     63    //Info from uncorrelated Gauss fit
    6564     fMagFit = 0.;
    6665     fMaxFit = 0.;
     
    6968     fSigmaMinorAxisFit = 0.;
    7069     fSigmaMajorAxisFit = 0.;
     70
    7171     fChiSquare = 0.;
    7272     fNdof = 1;
     73
     74    //Info from correlated Gauss fit
     75     fMagCGFit    = 0.;
     76     fMaxCGFit    = 0.;
     77     fMeanXCGFit  = 0.;
     78     fMeanYCGFit  = 0.;
     79     fSigmaXCGFit = 0.;
     80     fSigmaYCGFit = 0.;
     81     fCorrXYCGFit = 0.;
     82     fXXErrCGFit  = 0.;
     83     fXYErrCGFit  = 0.;
     84     fYYErrCGFit  = 0.;
     85
     86     fChiSquareCGFit = 0.;
     87     fNdofCGFit      = 1;
    7388
    7489}
     
    8196}
    8297
    83 void MStarLocalPos::SetCalcValues(Float_t mag, Float_t max, Float_t x, Float_t y, Float_t sigmaMinorAxis, Float_t sigmaMajorAxis)
     98void MStarLocalPos::SetCalcValues(Float_t mag, Float_t max,
     99        Float_t x, Float_t y, Float_t sigmaMinorAxis, Float_t sigmaMajorAxis)
    84100{
    85101     fMagCalc = mag;
     
    91107}
    92108
    93 void MStarLocalPos::SetFitValues(Float_t mag, Float_t max, Float_t x, Float_t y, Float_t sigmaMinorAxis, Float_t sigmaMajorAxis, Float_t chiSquare, Int_t ndof)
     109void MStarLocalPos::SetFitValues(Float_t mag, Float_t max,
     110        Float_t x, Float_t y, Float_t sigmaMinorAxis, Float_t sigmaMajorAxis,
     111        Float_t chiSquare, Int_t ndof)
    94112{
    95113     fMagFit = mag;
     
    103121}
    104122
    105 void MStarLocalPos::SetFitValues(Float_t mag, Float_t max, Float_t x, Float_t y, Float_t sigmaMinorAxis, Float_t sigmaMajorAxis, Float_t chiSquare, Int_t ndof, Float_t xx, Float_t xy, Float_t yy)
     123void MStarLocalPos::SetFitValues(Float_t mag, Float_t max,
     124        Float_t x, Float_t y, Float_t sigmaMinorAxis, Float_t sigmaMajorAxis,
     125        Float_t chiSquare, Int_t ndof,
     126        Float_t xx, Float_t xy, Float_t yy)
    106127{
    107128  SetFitValues(mag, max, x, y, sigmaMinorAxis, sigmaMajorAxis, chiSquare, ndof);
     
    109130  fYYErr = yy;
    110131  fXYErr = xy;
     132}
     133
     134void MStarLocalPos::SetCGFitValues(
     135               Float_t mag,       Float_t max,    Float_t x,    Float_t y,
     136               Float_t sigmaX,    Float_t sigmaY, Float_t correlation,
     137               Float_t xx,        Float_t xy,     Float_t yy,
     138               Float_t chiSquare, Int_t ndof)
     139{
     140     fMagCGFit    = mag;
     141     fMaxCGFit    = max;
     142     fMeanXCGFit  = x;
     143     fMeanYCGFit  = y;
     144     fSigmaXCGFit = sigmaX;
     145     fSigmaYCGFit = sigmaY;
     146     fCorrXYCGFit = correlation;
     147     fXXErrCGFit  = xx;
     148     fXYErrCGFit  = xy;
     149     fYYErrCGFit  = yy;
     150
     151     fChiSquareCGFit = chiSquare;
     152     fNdofCGFit      = ndof;
    111153}
    112154
     
    119161{
    120162  //Print a cross in the expected position
    121  
    122163  TMarker mexp(fXExp, fYExp, 29);
    123164  mexp.SetMarkerSize(3);
     
    129170      TEllipse ecalc(fMeanXCalc, fMeanYCalc, fSigmaMinorAxisCalc, fSigmaMajorAxisCalc, 0, 360, 0);
    130171      ecalc.SetLineWidth(3);
    131       ecalc.SetLineColor(kRed);
     172      ecalc.SetLineColor(kBlue);
    132173      ecalc.Paint();
    133174    }
    134175
    135   if (fSigmaMinorAxisFit>0. || fSigmaMajorAxisFit>0.)
     176  if (fSigmaMinorAxisFit>0. && fSigmaMajorAxisFit>0.)
    136177    {
    137178      TEllipse efit(fMeanXFit, fMeanYFit, fSigmaMinorAxisFit, fSigmaMajorAxisFit, 0, 360, 0);
     
    140181      efit.Paint();
    141182    }
     183
     184  if (fSigmaXCGFit>0. && fSigmaYCGFit>0.)
     185    {
     186      //Print a cross in the fitted position
     187      //TMarker mCGFit(fMeanXCGFit, fMeanYCGFit, 3);
     188      //mCGFit.SetMarkerSize(3);
     189      //mCGFit.SetMarkerColor(1);
     190      //mCGFit.Paint();
     191
     192      Double_t cxx = fSigmaXCGFit*fSigmaXCGFit;
     193      Double_t cyy = fSigmaYCGFit*fSigmaYCGFit;
     194      Double_t d   = cyy - cxx;
     195      Double_t cxy = fCorrXYCGFit * fSigmaXCGFit * fSigmaYCGFit;
     196      Double_t tandel;
     197      if (cxy != 0.0)
     198        tandel = ( d + sqrt(d*d + 4.0*cxy*cxy) ) / (2.0*cxy);
     199      else
     200        tandel = 0.0;
     201
     202      Double_t sindel = tandel / sqrt(1.0 + tandel*tandel);
     203      Double_t delta = TMath::ASin(sindel);
     204
     205      Double_t major =   (cxx + 2.0*tandel*cxy + tandel*tandel*cyy)
     206                        / (1.0 + tandel*tandel); 
     207
     208      Double_t minor =   (tandel*tandel*cxx - 2.0*tandel*cxy + cyy)
     209                        / (1.0 + tandel*tandel); 
     210
     211      TEllipse efit(fMeanXCGFit, fMeanYCGFit, sqrt(major), sqrt(minor),
     212                    0, 360,      delta*kRad2Deg);
     213      efit.SetLineWidth(3);
     214      efit.SetLineColor(kMagenta);
     215      efit.Paint();
     216    }
    142217}
    143218 
     
    159234      *fLog << inf << " Calcultated \t " << setw(4) << fMagCalc << endl;
    160235      *fLog << inf << " Fitted \t " << setw(4) << fMagFit << endl;
     236      *fLog << inf << " CGFitted \t " << setw(4) << fMagCGFit << endl;
    161237    }
    162238 
     
    164240    {
    165241      *fLog << inf << "Star Maximum:" << endl;
    166       *fLog << inf << " Calcultated \t " << setw(4) << fMaxCalc << " uA" << endl;
     242      *fLog << inf << " Calcultated \t " << setw(4) << fMaxCalc << " uA"
     243            << endl;
    167244      *fLog << inf << " Fitted \t " << setw(4) << fMaxFit << " uA" << endl;
     245      *fLog << inf << " CGFitted \t " << setw(4) << fMaxCGFit << " uA" << endl;
    168246    }
    169247 
     
    171249    {
    172250      *fLog << inf << "Star position:" << endl;
    173       *fLog << inf << " Expected \t X " << setw(4) << fXExp << " mm \tY " << setw(4) << fYExp << " mm" << endl;
    174       *fLog << inf << " Calcultated \t X " << setw(4) << fMeanXCalc << " mm \tY " << setw(4) << fMeanYCalc << " mm" << endl;
    175       *fLog << inf << " Fitted \t X " << setw(4) << fMeanXFit << " mm \tY " << setw(4) << fMeanYFit << " mm" << endl;
     251      *fLog << inf << " Expected \t X " << setw(4) << fXExp
     252            << " mm \tY " << setw(4) << fYExp << " mm" << endl;
     253      *fLog << inf << " Calcultated \t X " << setw(4) << fMeanXCalc
     254            << " mm \tY " << setw(4) << fMeanYCalc << " mm" << endl;
     255      *fLog << inf << " Fitted \t X " << setw(4) << fMeanXFit
     256            << " mm \tY " << setw(4) << fMeanYFit << " mm" << endl;
     257      *fLog << inf << " CGFitted \t X " << setw(4) << fMeanXCGFit
     258            << " mm \tY " << setw(4) << fMeanYCGFit << " mm" << endl;
    176259    }
    177260
     
    179262    {
    180263      *fLog << inf << "Star size:" << endl;
    181       *fLog << inf << " Calcultated \t X " << setw(4) << fSigmaMinorAxisCalc << " mm \tY " << setw(4) << fSigmaMajorAxisCalc << " mm" << endl;
    182       *fLog << inf << " Fitted \t X " << setw(4) << fSigmaMinorAxisFit << " mm \tY " << setw(4) << fSigmaMajorAxisFit << " mm" << endl;
     264      *fLog << inf << " Calcultated \t X " << setw(4) << fSigmaMinorAxisCalc
     265            << " mm \tY " << setw(4) << fSigmaMajorAxisCalc << " mm" << endl;
     266      *fLog << inf << " Fitted \t X " << setw(4) << fSigmaMinorAxisFit
     267            << " mm \tY " << setw(4) << fSigmaMajorAxisFit << " mm" << endl;
     268      *fLog << inf << " CGFitted \t X " << setw(4) << fSigmaXCGFit
     269            << " mm \tY " << setw(4) << fSigmaYCGFit << " mm \t correlation"
     270            << setw(4) << fCorrXYCGFit << endl;
    183271    }
    184272
     
    186274    {
    187275      *fLog << inf << "Star Fit Quality:" << endl;
    188       *fLog << inf << " ChiSquare/Ndof \t " << setw(3) << fChiSquare << "/" << fNdof << endl;
     276      *fLog << inf << " ChiSquare/Ndof \t " << setw(3) << fChiSquare
     277            << "/" << fNdof << endl;
     278
     279      *fLog << inf << "Star CGFit Quality:" << endl;
     280      *fLog << inf << " ChiSquareCGFit/NdofCGFit \t " << setw(3)
     281            << fChiSquareCGFit << "/" << fNdofCGFit << endl;
    189282    }
    190283
    191284  if (o.Contains("err", TString::kIgnoreCase) || opt == NULL)
    192285    {
    193       *fLog << inf << "Minuit Error Matrix:" << endl;
    194       *fLog << inf << " xx,xy,yy \t " << setw(3) << fXXErr << ", " << fXYErr << ", " << fYYErr << endl;
    195     }
    196 
    197 
    198 }
     286      *fLog << inf << "CGFit Error Matrix of (fMeanXCGFit,fMeanYCGFit) :"
     287            << endl;
     288      *fLog << inf << " xx,xy,yy \t " << setw(3) << fXXErrCGFit << ", "
     289            << fXYErrCGFit << ", " << fYYErrCGFit << endl;
     290    }
     291
     292
     293}
     294//--------------------------------------------------------------------------
     295
     296
     297
     298
     299
     300
     301
     302
     303
Note: See TracChangeset for help on using the changeset viewer.