Changeset 4545


Ignore:
Timestamp:
08/09/04 15:48:03 (20 years ago)
Author:
wittek
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
7 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r4542 r4545  
    1919
    2020                                                 -*-*- END OF LINE -*-*-
     21
     22
     23   2004/08/09 :   Wolfgang Wittek
     24
     25   * mtemp/MStarLocalCam.[h,cc]
     26           MStarLocalPos.[h,cc]
     27     - new variables added for the fit of a 2dim Gaussian with
     28       correlations
     29     - the corresponding Set and Get functions were added
     30     - the Paint function was extended correspondingly
     31
     32   * mtemp/MTelAxisFromStars.[h,cc]
     33     - new class (task) which determines the source position from star
     34       positions in the camera
     35   
     36   * mtemp/MHTelAxisFromStars.[h,cc]
     37     - new class (container); produce plots for MTelAxisFromStars
     38
     39   * mtemp/MSkyCamTrans.[h,cc]
     40     - new class (task) ; container holding the parameters for the
     41       transformation from sky coordinates (projected onto the camera)
     42       to camera coordinates
     43
     44   * mtemp/Makefile
     45           TempLinkDef.h
     46     - MTelAxisFRomStars  added
     47     - MHTelAxisFromStars added
     48     - MSkyCamTrans       added
     49
     50   * mtemp/findTelAxisFromStars.C
     51     - new macro : extended version of findstars.C
     52       (in mtemp/mifae/macros/)
     53     - call to MTelAxcisFromStars
     54           and MHTelAxisFromStars
     55       was added
    2156
    2257
  • 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
  • trunk/MagicSoft/Mars/mtemp/MStarLocalPos.h

    r4433 r4545  
    1111
    1212    //Expected position on camera
    13    
    1413    Float_t fMagExp;
    1514    Float_t fXExp;    //[mm]
     
    1716
    1817    //Info from calculation
    19 
    2018    Float_t fMagCalc;
    2119    Float_t fMaxCalc;            //[uA]
     
    2523    Float_t fSigmaMajorAxisCalc; //[mm]
    2624
    27     //Info from fit
    28 
     25    //Info from uncorrelated Gauss fit
    2926    Float_t fMagFit;
    3027    Float_t fMaxFit;             //[uA]
     
    3330    Float_t fSigmaMinorAxisFit;  //[mm]
    3431    Float_t fSigmaMajorAxisFit;  //[mm]
    35     Float_t fChiSquare;
    36     Float_t fXXErr;              //minuit error matrix elements
     32    Float_t fXXErr;         
    3733    Float_t fXYErr;
    3834    Float_t fYYErr;
     35
     36    Float_t fChiSquare;
    3937    Int_t   fNdof;
     38
     39    //Info from correlated Gauss fit
     40    Float_t fMagCGFit;
     41    Float_t fMaxCGFit;             //[uA]
     42    Float_t fMeanXCGFit;           //[mm]
     43    Float_t fMeanYCGFit;           //[mm]
     44    Float_t fSigmaXCGFit;          //[mm]
     45    Float_t fSigmaYCGFit;          //[mm]
     46    Float_t fCorrXYCGFit;          // correlation coefficient
     47    Float_t fXXErrCGFit;           // error matrix of (fMeanXCGFit,fMeanYCGFit)
     48    Float_t fXYErrCGFit;
     49    Float_t fYYErrCGFit;
     50
     51    Float_t fChiSquareCGFit;
     52    Int_t   fNdofCGFit;
     53
    4054
    4155public:
     
    7084    Float_t GetSigmaMajorAxis() {return fSigmaMajorAxisFit!=0?fSigmaMajorAxisFit:fSigmaMajorAxisCalc;}
    7185   
    72     Float_t GetXXErr() {return fXXErr;}
    73     Float_t GetXYErr() {return fXYErr;}
    74     Float_t GetYYErr() {return fYYErr;}
     86    // getters for the correlated Gauss fit
     87    Float_t GetMagCGFit()           {return fMagCGFit;}
     88    Float_t GetMaxCGFit()           {return fMaxCGFit;}
     89    Float_t GetMeanXCGFit()         {return fMeanXCGFit;}
     90    Float_t GetMeanYCGFit()         {return fMeanYCGFit;}
     91    Float_t GetSigmaXCGFit()        {return fSigmaXCGFit;}
     92    Float_t GetSigmaYCGFit()        {return fSigmaYCGFit;}
     93    Float_t GetCorrXYCGFit()        {return fCorrXYCGFit;}
     94    Float_t GetXXErrCGFit()         {return fXXErrCGFit;}
     95    Float_t GetXYErrCGFit()         {return fXYErrCGFit;}
     96    Float_t GetYYErrCGFit()         {return fYYErrCGFit;}
     97    Float_t GetChiSquareCGFit()     {return fChiSquareCGFit;}
     98    UInt_t GetNdofCGFit()           {return fNdofCGFit;}
     99    Float_t GetChiSquareNdofCGFit() {return fChiSquareCGFit/fNdofCGFit;}
     100
    75101
    76102    void Reset();
    77103
    78104    void SetExpValues(Float_t mag, Float_t x, Float_t y);
    79     void SetCalcValues(Float_t mag, Float_t max, Float_t x, Float_t y, Float_t sigmaMinorAxis, Float_t sigmaMajorAxis);
    80     void SetFitValues(Float_t mag, Float_t max, Float_t x, Float_t y, Float_t sigmaMinorAxis, Float_t sigmaMajorAxis, Float_t chi, Int_t ndof);
    81     void SetFitValues(Float_t mag, Float_t max, Float_t x, Float_t y, Float_t sigmaMinorAxis, Float_t sigmaMajorAxis, Float_t chi, Int_t ndof, Float_t xx, Float_t xy, Float_t yy);
     105
     106    void SetCalcValues(Float_t mag, Float_t max, Float_t x, Float_t y,
     107                       Float_t sigmaMinorAxis, Float_t sigmaMajorAxis);
     108
     109    void SetFitValues(Float_t mag, Float_t max, Float_t x, Float_t y,
     110                      Float_t sigmaMinorAxis, Float_t sigmaMajorAxis,
     111                      Float_t chi, Int_t ndof);
     112
     113    void SetFitValues(Float_t mag, Float_t max, Float_t x, Float_t y,
     114                      Float_t sigmaX, Float_t sigmaY,
     115                      Float_t chi, Int_t ndof,
     116                      Float_t xx, Float_t xy, Float_t yy);
     117
     118    void SetCGFitValues(Float_t mag, Float_t max, Float_t x, Float_t y,
     119                        Float_t sigmaX, Float_t sigmaY, Float_t correlation,
     120                        Float_t xx, Float_t xy, Float_t yy,
     121                        Float_t chi, Int_t ndof);
    82122
    83123    void Paint(Option_t *opt=NULL);
     
    88128
    89129#endif
     130
     131
  • trunk/MagicSoft/Mars/mtemp/Makefile

    r4002 r4545  
    4040        MStarLocalPos.cc \
    4141        MStarLocalCam.cc \
    42         MFindStars.cc
     42        MFindStars.cc \
     43        MTelAxisFromStars.cc \
     44        MHTelAxisFromStars.cc \
     45        MSkyCamTrans.cc \
     46        MSourceDirections.cc
    4347
    4448############################################################
  • trunk/MagicSoft/Mars/mtemp/TempLinkDef.h

    r4002 r4545  
    88#pragma link C++ class MStarLocalCam+;
    99#pragma link C++ class MFindStars+;
     10#pragma link C++ class MTelAxisFromStars+;
     11#pragma link C++ class MHTelAxisFromStars+;
     12#pragma link C++ class MSkyCamTrans+;
     13#pragma link C++ class MSourceDirections+;
    1014
    1115#endif
Note: See TracChangeset for help on using the changeset viewer.