Ignore:
Timestamp:
09/12/03 14:13:32 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mimage/MHillasSrc.cc

    r2173 r2330  
    125125    // *OLD* const Double_t arg = (sy-tand*sx) / (dist*sqrt(tand*tand+1));
    126126    // *OLD* fAlpha = asin(arg)*kRad2Deg;
    127 
     127    //
    128128    const Double_t arg1 = cd*sy-sd*sx;          // [mm]
    129129    const Double_t arg2 = cd*sx+sd*sy;          // [mm]
    130130
    131     fAlpha         = asin(arg1/dist)*kRad2Deg;  // [deg]
     131    //
     132    // Due to numerical uncertanties in the calculation of the
     133    // square root (dist) and arg1 it can happen (in less than 1e-5 cases)
     134    // that the absolute value of arg exceeds 1. Because this uncertainty
     135    // results in an Delta Alpha which is still less than 1e-3 we don't care
     136    // about this uncertainty in general and simply set values which exceed
     137    // to 1 saving its sign.
     138    //
     139    const Double_t arg = arg1/dist;
     140    fAlpha = TMath::Abs(arg)>1 ? TMath::Sign(90., arg) : asin(arg)*kRad2Deg;  // [deg]
     141
    132142    fCosDeltaAlpha = arg2/dist;                 // [1]
    133143    fDist          = dist;                      // [mm]
Note: See TracChangeset for help on using the changeset viewer.