Changeset 2330


Ignore:
Timestamp:
09/12/03 14:13:32 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/Changelog

    r2328 r2330  
    11                                                 -*-*- END OF LINE -*-*-
     2
     3 2003/09/12: Thomas Bretz
     4 
     5   * mimage/MHillasSrc.cc:
     6     - fixed the NaN-problem in the calculation of Alpha. More
     7       information can be found in the comments there.
     8
     9
    210
    311 2003/09/10: Thomas Bretz
  • 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.