Changeset 701 for trunk/MagicSoft


Ignore:
Timestamp:
03/22/01 16:28:06 (24 years ago)
Author:
tbretz
Message:
fixed some minor errors in Hillas calculation
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/manalysis/MHillas.cc

    r698 r701  
    5555
    5656    fEllipse = new TEllipse(cos(fTheta)*fDist, sin(fTheta)*fDist,
    57                             fWidth, fLength,
    58                             0, 360, fAlpha);
     57                            fLength, fWidth,
     58                            0, 360, fTheta*kRad2Deg+fAlpha-180);
    5959
    6060    fEllipse->SetLineWidth(2);
     
    137137    float s = sin(theta); // [1]
    138138
    139     const float direction = c*xmean + s*ymean;
    140 
    141     if (direction<0)
    142     {
    143         c = -c;
    144         s = -s;
    145     }
    146 
     139    //
     140    // resolve four-fold ambiguity of solution
     141    //
    147142    float axis1 =  2.0*c*s*sigmaxy + c*c*sigmaxx + s*s*sigmayy; // [mm^2]
    148143    float axis2 = -2.0*c*s*sigmaxy + s*s*sigmaxx + c*c*sigmayy; // [mm^2]
     
    158153
    159154    //
    160     // check the rotation of the axis
     155    // check the rotation of the axis (maybe turn by 90ø)
    161156    //
    162     const int rotation = axis1<axis2;
     157    const int   rotation = axis1<axis2;
    163158
    164     fLength = rotation ? sqrt(axis2) : sqrt(axis1);      // [mm]
    165     fWidth  = rotation ? sqrt(axis1) : sqrt(axis2);      // [mm]
     159    fLength = rotation ? sqrt(axis2) : sqrt(axis1);     // [mm]
     160    fWidth  = rotation ? sqrt(axis1) : sqrt(axis2);     // [mm]
    166161
    167     fAlpha = 180/kPI*atan((-xmean*s+ymean*c)/direction); // [deg]
     162    fAlpha  = rotation ?
     163        fabs(atan((-xmean*c - ymean*s)/(c*ymean - s*xmean))) :
     164        fabs(atan(( ymean*c - xmean*s)/(c*xmean + s*ymean))) ;
    168165
    169     fDist  = sqrt(xmean*xmean + ymean*ymean);            // [mm]
     166        // [deg]
    170167
    171     fTheta = atan(ymean/xmean);                          // [rad]
    172     if (xmean<0) fTheta += kPI;                          // [deg]
     168    fAlpha *= kRad2Deg;                                  // [deg]
     169
     170    fDist   = sqrt(xmean*xmean + ymean*ymean);           // [mm]
     171
     172    fTheta  = atan(ymean/xmean);                         // [rad]
     173    if (xmean<0) fTheta += kPI;                          // [rad]
    173174}
Note: See TracChangeset for help on using the changeset viewer.