Changeset 14581 for trunk/Cosy


Ignore:
Timestamp:
11/08/12 11:48:44 (12 years ago)
Author:
tbretz
Message:
Fixed the GetResidual.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Cosy/tpoint/TPointStar.cc

    r10066 r14581  
    6161
    6262Double_t TPointStar::GetResidual(Double_t *err) const
     63{
     64    /*
     65     TVector3 v1, v2;
     66     v1.SetMagThetaPhi(1, TMath::Pi()/2-fRawEl, fRawAz);
     67     v2.SetMagThetaPhi(1, TMath::Pi()/2-fStarEl, fStarAz);
     68
     69     return v1.Angle(v2)*TMath::RadToDeg();
     70     */
     71
     72    const Double_t del = fRawEl-fStarEl;
     73    const Double_t daz = fRawAz-fStarAz;
     74
     75    const double x = sin(fRawEl) * sin(fStarEl) * cos(fStarAz-fRawAz);
     76    const double y = cos(fRawEl) * cos(fStarEl);
     77
     78    const Double_t d = acos(x + y);
     79
     80    if (err)
    6381    {
    64       /*
    65        TVector3 v1, v2;
    66        v1.SetMagThetaPhi(1, TMath::Pi()/2-fRawEl, fRawAz);
    67        v2.SetMagThetaPhi(1, TMath::Pi()/2-fStarEl, fStarAz);
     82        // Error of one pixel in the CCD
     83        const Double_t e1 = 32./3600*TMath::DegToRad()   * 0.5;
    6884
    69        return v1.Angle(v2)*TMath::RadToDeg();
    70        */
     85        // Error of one SE unit
     86        const Double_t e2 = 360./16384*TMath::DegToRad() * 0.5;
    7187
    72         const Double_t del = fRawEl-fStarEl;
    73         const Double_t daz = fRawAz-fStarAz;
     88        const Double_t e11 =  sin(del)+cos(fRawEl)*sin(fStarEl)*(1-cos(daz));
     89        const Double_t e12 =  cos(fRawEl)*cos(fStarEl)*sin(daz);
    7490
    75         /*
    76         const Double_t dphi2 = daz/2.;
    77         const Double_t cos2  = cos(dphi2)*cos(dphi2);
    78         const Double_t sin2  = sin(dphi2)*sin(dphi2);
    79         const Double_t d = cos(del)*cos2 - cos(fRawEl+fStarEl)*sin2;
    80         */
    81         const Double_t d  = cos(del) - cos(fRawEl)*cos(fStarEl)*(1.-cos(daz));
     91        const Double_t e21 = -sin(del)+sin(fRawEl)*cos(fStarEl)*(1-cos(daz));
     92        const Double_t e22 = -cos(fRawEl)*cos(fStarEl)*sin(daz);
    8293
    83         if (err)
    84         {
    85             // Error of one pixel in the CCD
    86             const Double_t e1 = 32./3600*TMath::DegToRad()   * 0.5;
     94        const Double_t err1  = sqrt(1-d*d);
     95        const Double_t err2  = (e11*e11 + e12*e12)*e1*e1;
     96        const Double_t err3  = (e21*e21 + e22*e22)*e2*e2;
    8797
    88             // Error of one SE unit
    89             const Double_t e2 = 360./16384*TMath::DegToRad() * 0.5;
     98        *err = sqrt(err2+err3)/err1 * TMath::RadToDeg();
     99    }
    90100
    91             const Double_t e11 =  sin(del)+cos(fRawEl)*sin(fStarEl)*(1-cos(daz));
    92             const Double_t e12 =  cos(fRawEl)*cos(fStarEl)*sin(daz);
    93 
    94             const Double_t e21 = -sin(del)+sin(fRawEl)*cos(fStarEl)*(1-cos(daz));
    95             const Double_t e22 = -cos(fRawEl)*cos(fStarEl)*sin(daz);
    96 
    97             const Double_t err1  = sqrt(1-d*d);
    98             const Double_t err2  = (e11*e11 + e12*e12)*e1*e1;
    99             const Double_t err3  = (e21*e21 + e22*e22)*e2*e2;
    100 
    101             *err = sqrt(err2+err3)/err1 * TMath::RadToDeg();
    102         }
    103 
    104         const Double_t dist = acos(d);
    105         return dist * TMath::RadToDeg();
    106     }
     101    const Double_t dist = acos(d);
     102    return dist * TMath::RadToDeg();
     103}
    107104
    108105istream &operator>>(istream &fin, TPointStar &set)
Note: See TracChangeset for help on using the changeset viewer.