Ignore:
Timestamp:
06/24/07 17:31:59 (18 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Mars/mpointing
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Mars/mpointing/MPointingDevCalc.cc

    r8307 r8601  
    6565
    6666#include "MAstro.h"
     67#include "MPointing.h"
    6768#include "MPointingDev.h"
    6869#include "MRawRunHeader.h"
     
    7374using namespace std;
    7475
    75 // --------------------------------------------------------------------------
     76const TString MPointingDevCalc::fgFileName="resources/starguider.txt";
     77
     78// --------------------------------------------------------------------------
     79//
     80// Delete fPointing and set pointing to NULL
     81//
     82void MPointingDevCalc::Clear(Option_t *o)
     83{
     84    if (fPointing)
     85        delete fPointing;
     86
     87    fPointing = NULL;
     88}
     89
     90// --------------------------------------------------------------------------
     91//
     92// Clear the pointing model. If run-number >= 87751 read the new
     93// pointing model with fFileName
     94//
     95Bool_t MPointingDevCalc::ReadPointingModel(const MRawRunHeader &run)
     96{
     97    if (run.GetRunNumber()<87751)
     98    {
     99        Clear();
     100        return kTRUE;
     101    }
     102
     103    if (!fPointing)
     104        fPointing = new MPointing;
     105
     106    if (fFileName==fPointing->GetName())
     107    {
     108        *fLog << inf << fFileName << " already loaded." << endl;
     109        return kTRUE;
     110    }
     111
     112    return fPointing->Load(fFileName);
     113}
     114
     115// --------------------------------------------------------------------------
     116//
     117// Check the file/run type from the run-header and if it is a data file
     118// load starguider calibration.
    76119//
    77120Bool_t MPointingDevCalc::ReInit(MParList *plist)
     
    95138        if (!fReport)
    96139            *fLog << warn << "MReportStarguider not found... skipped." << endl;
    97         return kTRUE;
     140        return ReadPointingModel(*run);
    98141
    99142    case MRawRunHeader::kRTMonteCarlo:
     
    153196}
    154197
     198// --------------------------------------------------------------------------
     199//
     200// Do a full starguider calibration using a pointing model for the starguider.
     201//
     202void MPointingDevCalc::DoCalibration(Double_t devzd, Double_t devaz) const
     203{
     204    if (!fPointing)
     205    {
     206        // Do a simple starguider calibration using a simple offset in x and y
     207        fDeviation->SetDevZdAz(devzd, devaz);
     208
     209        // Linear starguider calibration taken from April/May data
     210        // For calibration add MDriveReport::GetErrorZd/Az !
     211        fDeviation->SetDevXY(fDx, fDy); // 1arcmin ~ 5mm
     212        //devzd -= 2.686/60;   
     213        //devaz -= 2.840/60;
     214
     215        return;
     216    }
     217
     218    // def?: 20.105, 773
     219    // 0/0 : 20.119, 763
     220    // -/- : 19.417  726
     221    // +mis: 19.80,  756
     222
     223    // Get the nominal position the star is at the sky
     224    // Unit: deg
     225    ZdAz nom(fReport->GetNominalZd(), fReport->GetNominalAz());
     226    nom *= TMath::DegToRad();
     227
     228    // Get the mispointing measured by the telescope. It is
     229    // calculate as follows:
     230    //
     231    // Position at which the starguider camera is pointing in real:
     232    //       pointing position = nominal position - mis
     233    ZdAz mis(devzd, devaz);
     234    mis *= TMath::DegToRad();
     235
     236    // The pointing mode is the conversion from the real pointing
     237    // position of the telescope into the pointing position measured
     238    // by the starguider.
     239    //
     240    //  --> To get the real poiting position of the telescope we have
     241    //      to convert the measured position back;
     242    //
     243
     244    // Position at which the starguider camera is pointing in real:
     245    //       pointing position = nominal position - dev
     246    //
     247    // The position measured as the starguider's pointing position
     248    ZdAz pos(nom);        // cpos = sao - dev
     249    pos -= mis;
     250
     251    // Now we convert the starguider's pointing position into the
     252    // telescope pointing position (the pointing model converts
     253    // the telescope pointing position into the starguider pointing
     254    // position)
     255    ZdAz point = fPointing->CorrectBack(pos);
     256
     257    // MSrcPosCalc uses the following condition to calculate the
     258    // source position in the camera:
     259    //    real pointing pos = nominal pointing pos - dev
     260    //
     261    // Therefor we calculate dev as follows:
     262    ZdAz dev(nom);
     263    dev -= point;
     264    dev *= TMath::RadToDeg();
     265
     266    // Set Measured mispointing and additional offset
     267    fDeviation->SetDevZdAz(dev.Zd(), dev.Az());
     268    fDeviation->SetDevXY(0, 0);
     269}
     270
    155271Int_t MPointingDevCalc::ProcessStarguiderReport()
    156272{
    157273    /************* CHECK STATUS!!! ******************/
    158274
    159     Double_t devzd = fReport->GetDevZd(); // [deg]
    160     Double_t devaz = fReport->GetDevAz(); // [deg]
     275    Double_t devzd = fReport->GetDevZd(); // [arcmin]
     276    Double_t devaz = fReport->GetDevAz(); // [arcmin]
    161277    if (devzd==0 && devaz==0)
    162278    {
     
    205321    }
    206322
     323    // >= 87751 (31.3.06 12:00)
     324
    207325    // Calculate absolute deviation
    208326    const Double_t dev = MAstro::GetDevAbs(fReport->GetNominalZd(), devzd, devaz);
     
    215333    }
    216334
    217     fDeviation->SetDevZdAz(devzd, devaz);
    218 
    219     // Linear starguider calibration taken from April/May data
    220     // For calibration add MDriveReport::GetErrorZd/Az !
    221     fDeviation->SetDevXY(fDx, fDy);
    222     //devzd -= 2.686/60;   // 1arcmin ~ 5mm
    223     //devaz -= 2.840/60;
     335    DoCalibration(devzd, devaz);
    224336
    225337    fSkip[0]++;
  • trunk/MagicSoft/Mars/mpointing/MPointingDevCalc.h

    r8373 r8601  
    1010#endif
    1111
     12class MPointing;
    1213class MPointingDev;
     14class MRawRunHeader;
    1315class MReportStarguider;
    1416
     
    1618{
    1719private:
     20    static const TString fgFileName; //! default file name of pointing model
     21
    1822    MReportStarguider *fReport;    //! MReportStarguider to get mispointing
    1923    MPointingDev      *fDeviation; //! Output container to store pointing deviation
     24    MPointing         *fPointing;  //! MPointing, pointing model for the calibration
    2025
    2126    UShort_t fRunType;             //! Run Type to decide where to get pointing position from
     
    2732    TArrayI  fSkip;                //! Counter for execution statistics
    2833    Double_t fLastMjd;             //! Time of last processed report
     34
     35    TString fFileName;             // File name of pointing model
    2936
    3037    UInt_t  fNumMinStars;          // Minimum number of identified stars
     
    3946
    4047    // MPointingDevCalc
     48    void DoCalibration(Double_t devzd, Double_t devaz) const;
     49
     50    Bool_t ReadPointingModel(const MRawRunHeader &run);
     51
    4152    Int_t ProcessStarguiderReport();
    4253    void  Skip(Int_t i);
     
    5263
    5364public:
    54     MPointingDevCalc() : fReport(0), fDeviation(0), fSkip(7), fNumMinStars(8),
    55         fNsbLevel(3), fNsbMin(30), fNsbMax(60), fMaxAbsDev(15), fMaxAge(1), fDx(-7), fDy(16)
     65    MPointingDevCalc() : fReport(0), fDeviation(0), fPointing(0),
     66        fSkip(7), fFileName(fgFileName), fNumMinStars(8),
     67        fNsbLevel(3), fNsbMin(30), fNsbMax(60), fMaxAbsDev(15),
     68        fMaxAge(1), fDx(-7), fDy(16)
    5669    {
    5770        fName  = "MPointingDevCalc";
     
    6073        AddToBranchList("MReportStarguider.*");
    6174    }
     75    ~MPointingDevCalc()
     76    {
     77        Clear();
     78    }
     79
     80    void Clear(Option_t *o="");
    6281
    6382    void SetNumMinStars(UInt_t n)  { fNumMinStars=n; }
  • trunk/MagicSoft/Mars/mpointing/MSrcPosCalc.cc

    r7287 r8601  
    375375    pos0 *= conv;
    376376
    377     TVector2 vx;
     377    //TVector2 vx;
    378378    if (fDeviation)
    379379    {
     380        // Position at which the starguider camera is pointing in real:
     381        //       pointing position = nominal position - dev
     382        //
    380383        //vx = CalcXYinCamera(pos0, pos)*fGeom->GetCameraDist()*1000;
    381384        pos0.SetZdAz(pos0.Theta()-fDeviation->GetDevZdRad(),
Note: See TracChangeset for help on using the changeset viewer.