Ignore:
Timestamp:
12/07/03 14:48:11 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Cosy/main
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Cosy/main/MBending.cc

    r2568 r2615  
    6565#include <TMinuit.h>
    6666
    67 #include "timer.h"
     67#include "MTime.h"
    6868
    6969ClassImp(MBending);
     
    262262    }
    263263
    264     Timer t;
     264    MTime t;
    265265    t.Now();
    266266
    267     fout << "MAGIC1 " << t.GetTimeStr() << endl;
     267    fout << "MAGIC1 " << t << endl;
    268268    fout << "S   00   000000   000000  0000000" << endl;
    269269    fout << setprecision(8);
     
    285285}
    286286
     287AltAz MBending::AddOffsets(const AltAz &aa) const
     288{
     289    // Correct [rad]
     290    // zdaz    [rad]
     291    AltAz p = aa;
     292
     293    const AltAz I(fIe, fIa);
     294    p += I;
     295
     296    return p;
     297}
     298
     299AltAz MBending::SubtractOffsets(const AltAz &aa) const
     300{
     301    // Correct [rad]
     302    // zdaz    [rad]
     303    AltAz p = aa;
     304
     305    const AltAz I(fIe, fIa);
     306    p -= I;
     307
     308    return p;
     309}
     310
     311AltAz MBending::CalcAnAw(const AltAz &p, Int_t sign) const
     312{
     313    // Corrections for AN and AW without approximations
     314    // as done by Patrick Wallace. The approximation cannot
     315    // be used for MAGIC because the correctioon angle
     316    // AW (~1.5deg) is not small enough.
     317
     318    // Vector in cartesian coordinates
     319    TVector3 v(1., 1., 1.);
     320
     321    // Set Azimuth and Elevation
     322    v.SetPhi(p.Az());
     323    v.SetTheta(TMath::Pi()/2-p.Alt());
     324
     325    // Rotate around the x- and y-axis
     326    v.RotateY(sign*fAn);
     327    v.RotateX(sign*fAw);
     328
     329    // Calculate Delta Azimuth and Delta Elevation
     330    AltAz d(TMath::Pi()/2-v.Theta(), v.Phi());
     331    d -= p;
     332    d *= sign;
     333
     334    // Fix 'direction' of output depending on input vector
     335    if (sign*p.Alt()>TMath::Pi()/2)
     336        d.Alt(d.Alt()-TMath::Pi());
     337
     338    // Align correction into [-180,180]
     339    while (d.Az()>TMath::Pi())
     340        d.Az(d.Az()-TMath::Pi()*2);
     341    while (d.Az()<-TMath::Pi())
     342        d.Az(d.Az()+TMath::Pi()*2);
     343
     344    return d;
     345}
     346
     347
    287348AltAz MBending::Correct(const AltAz &aa) const
    288349{
     
    350411    DEBUG(cout << "Bend2: " << 90-p.Alt()*180/TMath::Pi() << " " << p.Az()*180/TMath::Pi() << endl);
    351412
    352     // New Corrections for AW and AN:
    353     TVector3 v2(1.,1.,1.); // Vector in cartesian coordinates
    354     // Set Azimuth and Elevation
    355     v2.SetPhi(p.Az());
    356     v2.SetTheta(TMath::Pi()/2-p.Alt());
    357     // Rotate around the x- and y-axis
    358     v2.RotateX(fAw);
    359     v2.RotateY(fAn);
    360     // Get Azimuth and Elevation
    361     p.Az(v2.Phi());
    362     p.Alt(TMath::Pi()/2-v2.Theta());
    363 
    364     /*
    365     // Old correction terms for An and Aw:
    366     cout << fAw << " " << cos(p.Az()) << " " << tan(p.Alt()) << endl;
    367     cout << fAw* cos(p.Az())*tan(p.Alt())*180/3.1415 << endl;
    368 
    369     const AltAz AW( fAw*sin(p.Az()), -fAw*cos(p.Az())*tan(p.Alt()));
    370     const AltAz AN(-fAn*cos(p.Az()), -fAn*sin(p.Az())*tan(p.Alt()));
    371     p += AW;
    372     p += AN;
     413    const AltAz ANAW(CalcAnAw(p, -1));
     414    p += ANAW;
     415
     416    /* Old correction terms for An and Aw:
     417     const AltAz AW( fAw*sin(p.Az()), -fAw*cos(p.Az())*tan(p.Alt()));
     418     const AltAz AN(-fAn*cos(p.Az()), -fAn*sin(p.Az())*tan(p.Alt()));
     419     p += AW;
     420     p += AN;
    373421    */
    374 
    375 
    376 
    377422
    378423    DEBUG(cout << "Bend1: " << 90-p.Alt()*180/TMath::Pi() << " " << p.Az()*180/TMath::Pi() << endl);
     
    389434}
    390435
    391 AltAz MBending::AddOffsets(const AltAz &aa) const
     436AltAz MBending::CorrectBack(const AltAz &aa) const
    392437{
    393438    // Correct [rad]
     
    395440    AltAz p = aa;
    396441
    397     const AltAz I(fIe, fIa);
    398     p += I;
    399 
    400     return p;
    401 }
    402 
    403 AltAz MBending::CorrectBack(const AltAz &aa) const
    404 {
    405     // Correct [rad]
    406     // zdaz    [rad]
    407     AltAz p = aa;
    408 
    409442    DEBUG(cout << setprecision(16));
    410443    DEBUG(cout << "Back0: " << 90-p.Alt()*180/TMath::Pi() << " " << p.Az()*180/TMath::Pi() << endl);
     
    418451    DEBUG(cout << "Back1: " << 90-p.Alt()*180/TMath::Pi() << " " << p.Az()*180/TMath::Pi() << endl);
    419452
    420     /*
    421      //Old correction terms for An and Aw:
     453    /* Old correction terms for An and Aw:
    422454     const AltAz AN(-fAn*cos(p.Az()), -fAn*sin(p.Az())*tan(p.Alt()));
    423455     const AltAz AW( fAw*sin(p.Az()), -fAw*cos(p.Az())*tan(p.Alt()));
     
    426458     */
    427459
    428     // New Corrections for AN and AW:
    429     TVector3 v(1.,1.,1.); // Vector in cartesian coordinates
    430     // Set Azimuth and Elevation
    431     v.SetPhi(p.Az());
    432     v.SetTheta(TMath::Pi()/2-p.Alt());
    433     // Rotate around the x- and y-axis
    434     v.RotateY(-fAn);
    435     v.RotateX(-fAw);
    436     // Get Azimuth and Elevation
    437     p.Az(v.Phi());
    438     p.Alt(TMath::Pi()/2-v.Theta());
    439 
     460    const AltAz ANAW(CalcAnAw(p, -1));
     461    p -= ANAW;
    440462
    441463    DEBUG(cout << "Back2: " << 90-p.Alt()*180/TMath::Pi() << " " << p.Az()*180/TMath::Pi() << endl);
     
    498520}
    499521
    500 AltAz MBending::SubtractOffsets(const AltAz &aa) const
    501 {
    502     // Correct [rad]
    503     // zdaz    [rad]
    504     AltAz p = aa;
    505 
    506     const AltAz I(fIe, fIa);
    507     p -= I;
    508 
    509     return p;
    510 }
    511 
    512 
    513522ZdAz MBending::Correct(const ZdAz &zdaz) const
    514523{
  • trunk/MagicSoft/Cosy/main/MBending.h

    r2518 r2615  
    5353
    5454    static Double_t Sign(Double_t val, Double_t alt);
     55    AltAz CalcAnAw(const AltAz &p, Int_t sign) const;
    5556
    5657public:
  • trunk/MagicSoft/Cosy/main/MCaos.cc

    r2280 r2615  
    1212#include <TCanvas.h>
    1313
     14#include "MTime.h"
     15
    1416#include "Led.h"
    1517#include "Ring.h"
     
    1820
    1921#include "coord.h"
    20 #include "base/timer.h"
    2122
    2223void MCaos::ReadResources(const char *name="leds.txt")
     
    306307}
    307308
    308 void MCaos::Run(byte *img, bool printl, bool printr, const ZdAz &pos, const Timer &t)
     309void MCaos::Run(byte *img, bool printl, bool printr, const ZdAz &pos, const MTime &t)
    309310{
    310311    Leds &leds = *fLeds;
     
    354355
    355356    // FIXME!
    356     static const Timer t0(t);
    357     fEvtTime = (double)t-(double)t0;
     357    static const MTime t0(t);
     358    fEvtTime = t-t0;
    358359
    359360    if (fHistpr)
  • trunk/MagicSoft/Cosy/main/MCaos.h

    r2278 r2615  
    1515class TGraph;
    1616
    17 class Timer;
     17class MTime;
    1818class ZdAz;
    1919
     
    6868    void ResetHistograms();
    6969
    70     void Run(byte *img, bool printl, bool printr, const ZdAz &pos, const Timer &t);
     70    void Run(byte *img, bool printl, bool printr, const ZdAz &pos, const MTime &t);
    7171};
    7272
  • trunk/MagicSoft/Cosy/main/MCosy.cc

    r2613 r2615  
    1818
    1919#include "MGCosy.h"
     20#include "MTime.h"
    2021#include "MDriveCom.h"
    2122#include "MStarguider.h"
     
    2526
    2627#include "macs.h"
    27 #include "base/timer.h"
    2828#include "shaftencoder.h"
    2929
     
    341341        return;
    342342
    343     Timer t;
     343    MTime t;
    344344    t.Now();
    345345    lout << t << " - MCosy::WaitForEndMovement aborted...";
     
    449449    const ZdAz d = dst*kRad2Deg;
    450450
    451     Timer t;
     451    MTime t;
    452452    t.Now();
    453453    lout << t << " - Target Position: " << d.Zd() << "deg, " << d.Az() << "deg (Zd/Az)" << endl;
     
    958958
    959959    sla.Now();
    960     lout << sla << " - Start tracking:";
     960    lout << sla.GetTime() << " - Start tracking:";
    961961    lout << " Ra: " << xy.X() << "h  " << "Dec: " << xy.Y() << "\xb0" << endl;
    962962/*#ifdef EXPERT
     
    11051105    StopMovement();
    11061106
    1107     lout << sla << " - Tracking stopped." << endl;
     1107    lout << sla.GetTime() << " - Tracking stopped." << endl;
    11081108}
    11091109
     
    21842184    fWin=new MGCosy(fObservatory, this, gClient->GetRoot(), 1, 1);
    21852185}
    2186 
     2186/*
    21872187void MCosy::ConstructorSE(Int_t id4, Int_t id5, Int_t id6)
    21882188{
     
    22312231    fWin=new MGCosy(fObservatory, this, gClient->GetRoot(), 1, 1);
    22322232}
    2233 
    2234 MCosy::MCosy(int mode, const char *dev, const int baud, MLog &out)
     2233*/
     2234MCosy::MCosy(/*int mode,*/ const char *dev, const int baud, MLog &out)
    22352235: Network(dev, baud, out), fObservatory(MObservatory::kMagic1), fStarguider(NULL), fZd1(0), fZd2(0), fAz(0), fMac1(0), fMac2(0), fMac3(0), fBackground(kBgdNone), fStatus(MDriveCom::kStopped)
    22362236{
     
    22422242    const Int_t id5 = env.GetValue("Zd_Id-SE2",  5); //5
    22432243    const Int_t id6 = env.GetValue("Az_Id-SE",   6); //6
    2244 
     2244/*
    22452245    lout << "- Program in ";
    22462246    switch (mode)
    22472247    {
    22482248    case 0:
    2249         lout << "<<Standard mode>>" << endl;
     2249        lout << "<<Standard mode>>" << endl;*/
    22502250        fBending.Load("bending.txt");
    2251         Constructor(id1, id2, id3, id4, id5, id6);
     2251        Constructor(id1, id2, id3, id4, id5, id6);/*
    22522252        break;
    22532253    case 1:
     
    22602260        ConstructorDemo();
    22612261    }
    2262 
     2262*/
    22632263    lout.SetOutputGui(fWin->GetLog(), kTRUE);
    22642264
     
    22672267    fAz->SetDisplay(fWin->GetLabel1());
    22682268
    2269     int i=0;
    2270     char name[100];
     2269    //
     2270    // open tpoint file
     2271    //
     2272    MTime time;
     2273    TString name;
    22712274    while (1)
    22722275    {
    2273         sprintf(name, "tpoint/tpoint%03d.txt", i++);
     2276        time.Now();
     2277        name = Form("tpoint/tpoint_%s.txt", (const char*)time.GetFileName());
    22742278        if (gSystem->AccessPathName(name, kFileExists))
    22752279            break;
    22762280    }
    2277 
    2278     Timer time;
    2279     time.Now();
    22802281
    22812282    cout << "TPoint File ********* " << name << " ********** " << endl;
  • trunk/MagicSoft/Cosy/main/MCosy.h

    r2518 r2615  
    168168
    169169    void Constructor(Int_t id1, Int_t id2, Int_t id3, Int_t id4, Int_t id5, Int_t id6);
    170     void ConstructorSE(Int_t id1, Int_t id2, Int_t id3);
    171     void ConstructorDemo();
     170    //void ConstructorSE(Int_t id1, Int_t id2, Int_t id3);
     171    //void ConstructorDemo();
    172172
    173173    void ReadConfig();
     
    176176
    177177public:
    178     MCosy(int mode, const char *dev, const int baud, MLog &out=gLog);
     178    MCosy(/*int mode,*/ const char *dev, const int baud, MLog &out=gLog);
    179179    ~MCosy();
    180180
  • trunk/MagicSoft/Cosy/main/MStarguider.cc

    r2613 r2615  
    839839    static unsigned long n0 = n;
    840840
    841     Timer t(tm);
     841    MTime t(*tm);
    842842
    843843    const Double_t d = t-fTime;
     
    894894    if (fDisplay->IsEntryChecked(IDM_kCatalog))
    895895    {
    896         Timer time(tm);
     896        MTime time(*tm);
    897897
    898898        XY xy = fCRaDec->GetCoordinates();
     
    934934    if (fDisplay->IsEntryChecked(IDM_kCatalog))
    935935    {
     936        // FIXME: Necessary?
    936937        fSao->Now();
    937938        AltAz aa = fSao->CalcAltAzFromPix(fDx, fDy)*kRad2Deg;
  • trunk/MagicSoft/Cosy/main/MStarguider.h

    r2278 r2615  
    55#include <TGFrame.h>
    66#endif
     7
    78#include "PixClient.h"
     9
    810#ifndef MARS_MObservatory
    911#include "MObservatory.h"
     12#endif
     13
     14#ifndef MARS_MTime
     15#include "MTime.h"
    1016#endif
    1117
     
    1420
    1521#include "coord.h"
    16 #include "timer.h"
    1722
    1823class TArrayF;
     
    7681
    7782    TTimer *fTimer;
    78     Timer   fTime;
     83    MTime   fTime;
    7984
    8085    Int_t fDx;
Note: See TracChangeset for help on using the changeset viewer.