Ignore:
Timestamp:
09/05/04 18:56:47 (21 years ago)
Author:
rwagner
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Cosy/main
Files:
2 added
7 edited

Legend:

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

    r4105 r4865  
    116116
    117117    Rings r;
     118    r.SetMinNumberLeds(fMinNumberLeds);
    118119    r.CalcRings(fPositions);
    119120
     
    159160        fHistw[i] = new TH1F;
    160161        fHistw[i]->SetNameTitle(name, title);
    161         fHistw[i]->SetBins(721, -180.5, 180.5);
    162         fHistw[i]->SetXTitle("\\Phi [deg]");
     162        fHistw[i]->SetBins(101, -50.5, 50.5);
     163        fHistw[i]->SetXTitle("\\Phi [arcmin]");
    163164        fHistw[i]->SetYTitle("counts");
    164165    }
     
    259260    c2->Update();
    260261
     262    /*
    261263    c = new TCanvas("ctime", "Timedevelopement of Center", 800, 800);
    262264    c->Divide(1,3);
     
    266268    h->SetYTitle("x [pix]");
    267269    h->DrawCopy();
    268     ((TPad*)gPad)->SetSelected(NULL);
     270    c->SetSelectedPad(NULL);
    269271    fGraphprx->DrawClone("ALP*")->SetBit(kCanDelete);
     272    gPad->Modified();
     273    gPad->Update();
    270274    c->cd(2);
    271275    h = fGraphpry->GetHistogram();
     
    273277    h->SetYTitle("y [pix]");
    274278    h->DrawCopy();
    275     ((TPad*)gPad)->SetSelected(NULL);
    276     fGraphpry->DrawClone("ALP*")->SetBit(kCanDelete);
     279    //((TPad*)gPad)->SetSelectedPad(NULL);
     280    //fGraphpry->DrawClone("ALP*")->SetBit(kCanDelete);
    277281    c->cd(3);
    278282    h = fGraphr->GetHistogram();
     
    280284    h->SetYTitle("r [pix]");
    281285    h->DrawCopy();
    282     ((TPad*)gPad)->SetSelected(NULL);
    283     fGraphr->DrawClone("ALP*")->SetBit(kCanDelete);
     286    //((TPad*)gPad)->SetSelectedPad(NULL);
     287    //fGraphr->DrawClone("ALP*")->SetBit(kCanDelete);
    284288    c->Modified();
    285289    c->Update();
     290    */
    286291
    287292    c = new TCanvas("crot", "rotation angle", 800, 600);
     
    291296    fHistallw->SetYTitle("counts");
    292297    fHistallw->DrawCopy();
     298    /*
    293299    c->cd(2);
    294300    h = fGraphw->GetHistogram();
     
    298304    ((TPad*)gPad)->SetSelected(NULL);
    299305    fGraphw->DrawClone("ALP*")->SetBit(kCanDelete);
    300 
     306    */
    301307
    302308    /* --------------------------------------------------------
     
    325331}
    326332
    327 Ring MCaos::Run(byte *img, bool printl, bool printr, const ZdAz &pos, const MTime &t)
     333Ring MCaos::Run(byte *img, bool printl, bool printr, const ZdAz &pos, const MTime &t, Double_t box, Double_t cut)
    328334{
    329335    Leds &leds = *fLeds;
     
    331337
    332338    //          img  width height radius sigma
    333     FilterLed f(img, 768, 576, 50, 3.0);
     339    FilterLed f(img, 768, 576, box, cut);
    334340
    335341    Int_t first=0;
     
    365371
    366372    Rings rings;
    367     rings.CalcRings(leds, 265, 268);
     373    rings.SetMinNumberLeds(fMinNumberLeds);
     374//    rings.CalcRings(leds, 265, 268);
     375// rwagner
     376//    rings.CalcRings(leds, 158, 164);
     377    rings.CalcRings(leds, fMinRadius, fMaxRadius);
    368378
    369379    const Ring &center = rings.GetCenter();
     380   
     381    center.Print();
    370382
    371383    // FIXME!
     
    393405            {
    394406                0,
    395                 0,
    396                 0,
    397                 0,
    398                 0,
    399                 0
     407                0,
     408                0,
     409                0,
     410                0,
     411                0
    400412            };
    401413
  • trunk/MagicSoft/Cosy/main/MCaos.h

    r4105 r4865  
    4545    TGraph        *fGraphr;
    4646
     47    Short_t       fMinNumberLeds;
     48    Double_t      fMinRadius;
     49    Double_t      fMaxRadius;
     50
    4751public:
    48     MCaos() : fFile(NULL), fHistpr(NULL)
     52    MCaos() : fFile(NULL), fHistpr(NULL), fMinNumberLeds(5), fMinRadius(265), fMaxRadius(268)
    4953    {
    5054        fLeds = new Leds;
    5155    }
     56   
    5257    ~MCaos()
    5358    {
     
    6671    void OpenFile();
    6772    void CloseFile();
     73   
     74    void SetMinNumberRings(Short_t n)
     75    {
     76        fMinNumberLeds = n;
     77    }
     78
     79    void SetRadii(Double_t min, Double_t max)
     80    { 
     81        fMinRadius=min;
     82        fMaxRadius=max;
     83    }
    6884
    6985    void InitHistograms();
     
    7288    void ResetHistograms();
    7389
    74     Ring Run(byte *img, bool printl, bool printr, const ZdAz &pos, const MTime &t);
     90    Ring Run(byte *img, bool printl, bool printr, const ZdAz &pos,
     91             const MTime &t, Double_t box, Double_t cut);
    7592};
    7693
  • trunk/MagicSoft/Cosy/main/MCosy.h

    r4255 r4865  
    203203    MLog *GetOutRep() { return fOutRep; }
    204204
     205    //rwagner
     206    MDriveCom *GetDriveCom() { return fCom; }
     207
    205208    // static ZdAz CorrectTarget(const ZdAz &src, const ZdAz &dst);
    206209    //    static ZdAz RaDec2ZdAz(const double mjd, const RaDec &pos, const RaDec &pm=RaDec(0,0));
  • trunk/MagicSoft/Cosy/main/MStarguider.cc

    r4549 r4865  
     1#define EXPERT
     2
    13#include "MStarguider.h"
    24
     
    911#include <TTimer.h>
    1012#include <TSystem.h>
     13#include <TFile.h> // temp writeout of histos
     14#include "MAstro.h"
     15#include "MString.h"
    1116
    1217#include <TGMenu.h>
     
    1520#include <TGSplitter.h>    // TGHorizontal3DLine
    1621#include <TGTextEntry.h>
    17 
     22#include <TGLayout.h>
    1823#include "MString.h"
    1924
    2025#include "MCosy.h"
    2126#include "MCaos.h"
     27// #include "MStargLeds.h"
     28#include "MStargHistograms.h"
     29#include "MDriveCom.h"
     30
     31#include "MGStarg.h"
     32#include "TGFrame.h"
    2233
    2334#include "MGImage.h"
     
    91102    IDM_kCaosWriteStart,
    92103    IDM_kCaosWriteStop,
    93     IDM_kResetHistograms
     104    IDM_kResetHistograms,
     105    IDM_kStargHistograms,
     106    IDM_kStargAnalysis,
     107    IDM_kStargCaosFilter,
     108    IDM_kStargLEDFilter,
     109    IDM_kStargFindStar
     110
    94111};
    95112
     
    105122        fCosy->GetWin()->GetImage()->DoRedraw();
    106123
     124    fGStarg->Update(fPos, fD);   
     125 
    107126    return kTRUE;
    108127}
     
    122141
    123142    fChannel = new MGPopupMenu(p);
    124     fChannel->AddEntry("Channel #1", IDM_kChannel1);
    125     fChannel->AddEntry("Channel #2", IDM_kChannel2);
     143    fChannel->AddEntry("Starfield Camera", IDM_kChannel1);
     144    fChannel->AddEntry("TPoint Camera", IDM_kChannel2);
    126145    fChannel->CheckEntry(channel==0?IDM_kChannel1:IDM_kChannel2);
    127146    fChannel->Associate(this);
     
    134153    fDisplay->AddEntry("&Filter",      IDM_kFilter);
    135154    fDisplay->AddEntry("Find &Star",   IDM_kFindStar);
    136     fDisplay->AddEntry("C&aosFilter",  IDM_kCaosFilter);
    137     fDisplay->AddEntry("Sao &Catalog", IDM_kCatalog);
     155    fDisplay->AddEntry("C&aos Filter",  IDM_kCaosFilter);
     156    fDisplay->AddEntry("SAO &Catalog", IDM_kCatalog);
     157    fDisplay->AddEntry("Stretch",      IDM_kStretch);
     158    fDisplay->AddSeparator();
    138159    fDisplay->AddEntry("Starguider",   IDM_kStarguider);
    139     fDisplay->AddEntry("Stretch",      IDM_kStretch);
     160    fDisplay->AddEntry("Starguider LED Filter",  IDM_kStargCaosFilter);
     161    fDisplay->AddEntry("Starguider Find Star",   IDM_kStargFindStar);
     162    fDisplay->AddEntry("Starguider Analysis",   IDM_kStargAnalysis);
     163    fDisplay->AddSeparator();   
    140164    if (channel>=0)
    141165        fDisplay->AddPopup("&Input",   fChannel);
    142     fDisplay->DisableEntry(IDM_kStarguider);
     166    fDisplay->DisableEntry(IDM_kStargAnalysis);
     167    fDisplay->DisableEntry(IDM_kStargFindStar);
    143168    fDisplay->CheckEntry(IDM_kStretch);
    144169    fDisplay->Associate(this);
     
    218243    {
    219244        fInterpol->CheckEntry(IDM_kInterpol5);
    220         fIntRate = 5;
     245        fIntRate = 50;
    221246    }
    222247    else
     
    247272
    248273    fCaosAnalyse = new MGPopupMenu(p);
    249     fCaosAnalyse->AddEntry("S&tart Analyse", IDM_kCaosAnalStart);
    250     fCaosAnalyse->AddEntry("St&opp Analyse", IDM_kCaosAnalStop);
     274    fCaosAnalyse->AddEntry("S&tart Analysis", IDM_kCaosAnalStart);
     275    fCaosAnalyse->AddEntry("St&op Analysis", IDM_kCaosAnalStop);
    251276    fCaosAnalyse->DisableEntry(IDM_kCaosAnalStop);
    252277    //    fCaosAnalyse->AddEntry("&Reset Histograms", IDM_kResetHistograms);
     
    272297    fList->Add(fCaOs);
    273298
     299    TGLayoutHints *hints2a =
     300        new TGLayoutHints(kLHintsCenterX|kLHintsCenterY|
     301                          kLHintsExpandX|kLHintsExpandY,1,1);
     302    fList->Add(hints2a);
     303
     304    fGStarg = new MGStarg(this, 235);
     305    fGStarg->Move(530,596+5);
     306    fList->Add(fGStarg);
     307
    274308    fCRaDec = new MGCoordinates(this, kETypeRaDec);
    275309    fCRaDec->Move(4, fMenu->GetDefaultHeight()+584);
     
    278312
    279313    fCZdAz = new MGCoordinates(this, kETypeZdAz, kFALSE);
    280     fCZdAz->Move(240+12+10, fMenu->GetDefaultHeight()+584);
     314    fCZdAz->Move(240+12+28, fMenu->GetDefaultHeight()+581+12);
    281315    AddFrame(fCZdAz);
    282316    fList->Add(fCZdAz);
    283317
    284318    fPZdAz = new MGCoordinates(this, kETypeZdAz, kFALSE);
    285     fPZdAz->Move(240+12+10, fMenu->GetDefaultHeight()+630);
     319    fPZdAz->Move(240+12+28, fMenu->GetDefaultHeight()+627+2*12);
    286320    AddFrame(fPZdAz);
    287321    fList->Add(fPZdAz);
    288322
     323    fDZdAz = new MGCoordinates(this, kETypeZdAz, kFALSE);
     324    fDZdAz->Move(240+12+28, fMenu->GetDefaultHeight()+673+3*12);
     325    AddFrame(fDZdAz);
     326    fList->Add(fDZdAz);
     327
     328    fSZdAz = new MGCoordinates(this, kETypeZdAz, kFALSE);
     329    fSZdAz->Move(240+12+28, fMenu->GetDefaultHeight()+719+4*12);
     330    AddFrame(fSZdAz);
     331    fList->Add(fSZdAz);
     332
    289333    fTPoint = new TGTextButton(this, "TPoint");
    290     fTPoint->Move(4, fMenu->GetDefaultHeight()+665);
     334    fTPoint->Move(4, fMenu->GetDefaultHeight()+722+3*12+25);
    291335    fTPoint->AllowStayDown(kTRUE);
    292336    AddFrame(fTPoint);
     
    295339    fFps = new TGLabel(this, "---fps");
    296340    fFps->SetTextJustify(kTextRight);
    297     fFps->Move(633, fMenu->GetDefaultHeight()+578);
     341    fFps->Move(650-440, fMenu->GetDefaultHeight()+619+13+60+20);
    298342    AddFrame(fFps);
    299343    fList->Add(fFps);
     
    301345    fPosZoom = new TGLabel(this, "----.--d/----.--d (----, ----)");
    302346    fPosZoom->SetTextJustify(kTextRight);
    303     fPosZoom->Move(620, fMenu->GetDefaultHeight()+678);
     347    fPosZoom->Move(4, fMenu->GetDefaultHeight()+765);
    304348    AddFrame(fPosZoom);
    305349    fList->Add(fPosZoom);
    306350
    307     TGLabel *l = new TGLabel(this, "Arb.-Sky Pos");
     351    fSkyBright = new TGLabel(this, "Sky Brightness: ---         ");
     352    fSkyBright->SetTextJustify(kTextLeft);
     353    fSkyBright->Move(4, fMenu->GetDefaultHeight()+785);
     354    AddFrame(fSkyBright);
     355    fList->Add(fSkyBright);
     356
     357    TGLabel *l = new TGLabel(this, "arcsec/pix");
    308358    l->SetTextJustify(kTextLeft);
    309     l->Move(480+32, fMenu->GetDefaultHeight()+590);
     359    l->Move(605-400, fMenu->GetDefaultHeight()+619+13+60);
    310360    AddFrame(l);
    311361    fList->Add(l);
    312362
    313     l = new TGLabel(this, "arcsec/pix");
     363    l = new TGLabel(this, "deg");
    314364    l->SetTextJustify(kTextLeft);
    315     l->Move(605, fMenu->GetDefaultHeight()+619+13);
     365    l->Move(605-410, fMenu->GetDefaultHeight()+619-10+60);
    316366    AddFrame(l);
    317367    fList->Add(l);
    318368
    319     l = new TGLabel(this, "deg");
     369    l = new TGLabel(this, "Telescope pointing at");
    320370    l->SetTextJustify(kTextLeft);
    321     l->Move(605, fMenu->GetDefaultHeight()+619-10);
     371    l->Move(240+12+20, fMenu->GetDefaultHeight()+584-5);
    322372    AddFrame(l);
    323373    fList->Add(l);
    324374
    325     l = new TGLabel(this, "Pointing Pos");
     375    l = new TGLabel(this, "Starguider position");
    326376    l->SetTextJustify(kTextLeft);
    327     l->Move(480+32, fMenu->GetDefaultHeight()+655);
     377    l->Move(240+12+20, fMenu->GetDefaultHeight()+630+12-5);
    328378    AddFrame(l);
    329379    fList->Add(l);
    330380
    331     const Double_t pixsize = 23.4;
     381    l = new TGLabel(this, "Misspointing");
     382    l->SetTextJustify(kTextLeft);
     383    l->Move(240+12+20, fMenu->GetDefaultHeight()+676+2*12-5);
     384    AddFrame(l);
     385    fList->Add(l);
     386
     387#ifdef EXPERT
     388    l = new TGLabel(this, "Misspointing/FindStar (Experts Only!)");
     389    l->SetTextJustify(kTextLeft);
     390    l->Move(240+12+20, fMenu->GetDefaultHeight()+722+3*12-5);
     391    AddFrame(l);
     392    fList->Add(l);
     393#endif
     394   
     395    const Double_t pixsize = 48.8; // used to be 23.4
    332396
    333397    fSao->SetPixSize(pixsize);
     
    339403    fPixSize = new TGTextEntry(this, txt, IDM_kPixSize);
    340404    fPixSize->SetAlignment(kTextCenterX);
    341     fPixSize->Move(547, fMenu->GetDefaultHeight()+617+13);
     405    fPixSize->Move(547-410, fMenu->GetDefaultHeight()+617+13+60);
    342406    AddFrame(fPixSize);
    343407    fList->Add(fPixSize);
     
    345409    fAngle = new TGTextEntry(this, "         0", IDM_kAngle);
    346410    fAngle->SetAlignment(kTextCenterX);
    347     fAngle->Move(547, fMenu->GetDefaultHeight()+617-10);
     411    fAngle->Move(547-410, fMenu->GetDefaultHeight()+617-10+60);
    348412    AddFrame(fAngle);
    349413    fList->Add(fAngle);
     
    357421    //
    358422    fZoomImage = new MGImage(this, kZOOM, kZOOM);
    359     fZoomImage->Move(768-kZOOM-2, 700-kZOOM-2);
     423    // fZoomImage->Move(768-kZOOM-2, 700-kZOOM-2);
     424    fZoomImage->Move(4, 700-kZOOM-2+85);
    360425    AddFrame(fZoomImage);
    361426    fList->Add(fZoomImage);
     
    374439    MapSubwindows();
    375440    fTPoint->UnmapWindow();
     441    fGStarg->UnmapWindow();
     442    fPZdAz->UnmapWindow();
     443    fDZdAz->UnmapWindow();
     444    fSZdAz->UnmapWindow();
     445    fSkyBright->UnmapWindow();
    376446    MapWindow();
    377447
    378     IconifyWindow();
     448
     449    //IconifyWindow();
    379450
    380451    //------------------------------------------------------------
     
    386457
    387458MStarguider::MStarguider(MObservatory::LocationName_t obs, Int_t channel)
    388 : TGMainFrame(gClient->GetRoot(), 768, 740), fCosy(NULL), fOutTp(0), fDx((768-kZOOM)/2), fDy((512-kZOOM)/2)
    389 {
     459    : TGMainFrame(gClient->GetRoot(), 768, 840), fCosy(NULL), fOutTp(0), fDx((768-kZOOM)/2), fDy((512-kZOOM)/2), fStatus(MDriveCom::kStandby)
     460{
     461   
    390462    cout << " #### FIXME: Make MCaos Thread safe!" << endl;
    391463
     
    393465    fRaDec = new RaDec(180, 40);
    394466
     467    //    fStargLeds = new MStargLeds;
     468    //    fStargLeds->ReadResources();
     469
    395470    fCaos = new MCaos;
    396471    fCaos->ReadResources();
     472
     473    fStargCaos = new MCaos;
     474    fStargCaos->ReadResources("stargleds.txt");
     475    fStargCaos->SetMinNumberRings(2);
     476    fStargCaos->SetRadii(158,164);
     477
     478    fStargHistograms = new MStargHistograms();
    397479
    398480    InitGui(channel);
     
    427509
    428510    delete fCaos;
     511    delete fStargCaos;
     512    //    delete fStargLeds;
     513    delete fStargHistograms;
    429514    delete fSao;
    430     delete fRaDec;
     515    delete fRaDec;   
    431516
    432517    if (fOutTp)
     
    491576            case IDM_kCatalog:
    492577                Toggle(fDisplay, IDM_kCatalog);
    493                 if (fDisplay->IsEntryChecked(IDM_kCatalog))
    494                     fDisplay->EnableEntry(IDM_kStarguider);
    495                 else
    496                 {
    497                     fDisplay->UnCheckEntry(IDM_kStarguider);
    498                     fDisplay->DisableEntry(IDM_kStarguider);
    499                 }
     578//              if (!fDisplay->IsEntryChecked(IDM_kCatalog))
     579//                 {
     580//                     fDisplay->UnCheckEntry(IDM_kStarguider);
     581//                     fDisplay->DisableEntry(IDM_kStarguider);
     582//                 } else {
     583//                  fDisplay->EnableEntry(IDM_kStarguider);
     584//              }
     585                return kTRUE;
     586
     587           case IDM_kStargFindStar:
     588                Toggle(fDisplay, IDM_kStargFindStar);         
     589                if (fDisplay->IsEntryChecked(IDM_kStargFindStar)) {
     590                    fSZdAz->MapWindow();
     591                } else {
     592                    fSZdAz->UnmapWindow();
     593                }
    500594                return kTRUE;
    501595
    502596            case IDM_kStarguider:
    503597                Toggle(fDisplay, IDM_kStarguider);
     598
     599                if (fDisplay->IsEntryChecked(IDM_kStarguider)) {       
     600
     601                    fLastBright = 0xff;
     602
     603                    fDisplay->DisableEntry(IDM_kFindStar);
     604                    fDisplay->EnableEntry(IDM_kStargAnalysis);           
     605                   
     606                    fPZdAz->MapWindow();
     607                    fDZdAz->MapWindow();
     608                    fSkyBright->MapWindow();
     609
     610                    fSao->SetLimitMag(8.3);
     611                    fIntRate = 125;
     612
     613                    fDisplay->CheckEntry(IDM_kCatalog);
     614                    fGStarg->MapWindow();
     615
     616                    const Int_t ch0 =
     617                        fChannel->IsEntryChecked(IDM_kChannel1) ? 0 : 1;
     618                    const Int_t ch1 = 0;
     619
     620                    if (ch0!=ch1)
     621                    {
     622
     623                        delete fGetter;
     624                        usleep(150000); // FIX: Device or resource busy.
     625                        fGetter = new Camera(*this, ch1);
     626                        ((Camera*)fGetter)->Loop(0);
     627                    }
     628
     629                    fChannel->CheckEntry(IDM_kChannel1);
     630                    fChannel->UnCheckEntry(IDM_kChannel2);
     631                    fChannel->DisableEntry(IDM_kChannel2);
     632
     633                } else {
     634
     635                    fStatus = MDriveCom::kStandby;
     636               
     637                    fPZdAz->UnmapWindow();
     638                    fDZdAz->UnmapWindow();
     639                    fSkyBright->UnmapWindow();
     640                    fGStarg->UnmapWindow();             
     641                    fChannel->EnableEntry(IDM_kChannel2);
     642                    fDisplay->EnableEntry(IDM_kFindStar);
     643                    fDisplay->DisableEntry(IDM_kStargAnalysis);             
     644                }
     645
    504646                gSystem->Unlink("tracking_error.txt");
     647
     648                return kTRUE;
     649
     650            case IDM_kStargAnalysis:
     651                Toggle(fDisplay, IDM_kStargAnalysis);
     652                if (fDisplay->IsEntryChecked(IDM_kStargAnalysis)) {
     653                    fStargHistograms->OpenFile();
     654                } else {
     655                    fStargHistograms->CloseFile();
     656                }
     657
     658                return kTRUE;
     659
     660
     661            case IDM_kStargHistograms:
     662                Toggle(fDisplay, IDM_kStargHistograms);
     663                return kTRUE;
     664
     665            case IDM_kStargLEDFilter:
     666                Toggle(fDisplay, IDM_kStargLEDFilter);
    505667                return kTRUE;
    506668
    507669            case IDM_kFilter:
    508                 Toggle(fDisplay, IDM_kFilter);
    509                 if (fDisplay->IsEntryChecked(IDM_kFilter))
    510                     fDisplay->EnableEntry(IDM_kStarguider);
    511                 else
    512                 {
    513                     fDisplay->UnCheckEntry(IDM_kStarguider);
    514                     fDisplay->DisableEntry(IDM_kStarguider);
    515                 }
    516                 return kTRUE;
     670                Toggle(fDisplay, IDM_kFilter);           
     671                return kTRUE;
     672
     673//              case IDM_kFilterStarg:
     674//                  Toggle(fDisplay, IDM_kFilterStarg);
     675//                  if (fDisplay->IsEntryChecked(IDM_kFilterStarg))
     676//                      fDisplay->EnableEntry(IDM_kStarguider);
     677//                  else
     678//                  {
     679//                      fDisplay->UnCheckEntry(IDM_kStarguider);
     680//                      fDisplay->DisableEntry(IDM_kStarguider);
     681//                  }
     682//                  return kTRUE;
    517683
    518684            case IDM_kFindStar:
     
    535701                //    fCaos->OpenFile();
    536702                Toggle(fDisplay, IDM_kCaosFilter);
    537                 if (fDisplay->IsEntryChecked(IDM_kCaosFilter))
     703                if (fDisplay->IsEntryChecked(IDM_kCaosFilter)) {
    538704                    fMenu->AddPopup("&CaOs", fCaOs, NULL);
     705                }
    539706                else
    540707                {
     
    558725                }
    559726                fMenu->Resize(fMenu->GetDefaultSize());
    560                 MapSubwindows();
     727                MapSubwindows(); // maps everything, but we don't want that
     728                fTPoint->UnmapWindow();
     729                fGStarg->UnmapWindow();
     730                fPZdAz->UnmapWindow();
     731                fDZdAz->UnmapWindow();
     732                fSZdAz->UnmapWindow();
     733                fSkyBright->UnmapWindow();
    561734                MapWindow();
    562735                return kTRUE;
     736
     737            case IDM_kStargCaosFilter:             
     738                Toggle(fDisplay, IDM_kStargCaosFilter);               
     739                if (fDisplay->IsEntryEnabled(IDM_kStargCaosFilter)) {
     740                    fDisplay->EnableEntry(IDM_kStargFindStar);
     741                } else {
     742                    fDisplay->DisableEntry(IDM_kStargFindStar);
     743                }
     744                return kTRUE;
    563745
    564746            case IDM_kCaosPrintLeds:
     
    665847                    const Int_t ch0 = fChannel->IsEntryChecked(IDM_kChannel1) ? 0 : 1;
    666848                    const Int_t ch1 = mp1==IDM_kChannel1                      ? 0 : 1;
    667                     if (ch0==ch1)
     849
     850                    if (ch0==ch1)
    668851                        return kTRUE;
    669852
     
    754937    // Viewable area (FIXME: AZ)
    755938    //
    756     TH2F h("Hist", "dX/dY", 77, -768/2-.5, 768/2+.5, 58, -576/2-.5, 576/2+.5); // 3
    757 
    758     /*
     939    // TH2F h("Hist", "dX/dY", 77, -768/2-.5, 768/2+.5, 58, -576/2-.5, 576/2+.5); // 3
     940    // chose a bit coarser binning to enhance excess
     941    // important: chose binning symmetrical around (0|0)!
     942    TH2F h("Hist", "dX/dY", 49, -768/2-8, 768/2+8, 37, -576/2-8, 576/2+8); // 3
     943
    759944    TH1F hmag("HistMag", "Mag", 19, 0, 100);
    760945    for (int i=0; i<mag.GetSize(); i++)
    761946        hmag.Fill(mag[i]);
    762         */
    763 
     947   
    764948    //
    765949    // Search for matching Magnitudes
     
    772956
    773957    //
    774     // Serach for an excess in the histogram
     958    // Search for an excess in the histogram
    775959    //
    776960    Int_t mx, my, dummy;
     
    783967    const double dy   = h.GetYaxis()->GetBinWidth(my);
    784968
     969#ifdef EXPERT
    785970    cout << setprecision(3);
    786971    cout << "Cut-XY:       " << xmax << " +- " << dx << " / " << ymax << " +- " << dy << endl;
     972#endif
    787973
    788974    TGraph g;
     
    790976    {
    791977        if (!(x[i]>xmax-dx && x[i]<xmax+dx &&
    792               y[i]>ymax-dy && y[i]<ymax+dy &&
    793               mag[i]>48-15 && mag[i]<48+15))
     978              y[i]>ymax-dy && y[i]<ymax+dy /*&&
     979                                             mag[i]>48-15 && mag[i]<48+15*/))
    794980            continue;
    795981
    796         g.SetPoint(g.GetN(), x[i], y[i]);
    797     }
    798 
     982        g.SetPoint(g.GetN(), x[i], y[i]);       
     983    }
     984 
     985#ifdef EXPERT
    799986    cout << "Offset-XY:    " << g.GetMean(1) << " +- " << g.GetRMS(1) << " / ";
    800987    cout << g.GetMean(2) << " +- " << g.GetRMS(2) << endl;
     988#endif
    801989
    802990    AltAz pos0 = fSao->CalcAltAzFromPix(768/2,              576/2)*kRad2Deg;
     
    8171005    fout2 << -pos1.Alt() << " " << pos1.Az() << endl;
    8181006
     1007//    if (g.GetMean(1)>9 || g.GetMean(2)>9) {
     1008//      TFile f1("sguider-highoffset.root","UPDATE");
     1009//      h.Write();
     1010//      hmag.Write();
     1011//      g.Write();
     1012//      f1.Close();
     1013//    } else {
     1014//      TFile f1("sguider-niceoffset.root","UPDATE");
     1015//     h.Write();
     1016//      hmag.Write();
     1017//      g.Write();
     1018 //     f1.Close();
     1019       
     1020
     1021//      }
     1022
    8191023    return ZdAz(-pos1.Alt(), pos1.Az());
    8201024}
    8211025
    822 void MStarguider::CalcTrackingError(Leds &leds, MStarList &stars)
     1026bool MStarguider::CalcTrackingError(Leds &leds, MStarList &stars, ZdAz &d, MTime &t)
    8231027{
    8241028    const Int_t max = leds.GetEntries();
    825 
    826     if (stars.GetRealEntries() < 3)
    827     {
    828         cout << "Sorry, less than 3 stars in FOV!" << endl;
    829         return;
    830     }
    831 
    832     if (max < 1)
    833     {
    834         cout << "Sorry, less than 1 detected spot in FOV!" << endl;
    835         return;
    836     }
     1029      if (stars.GetRealEntries() < 3)
     1030      {
     1031          cout << "Sorry, less than 3 stars in FOV!" << endl;
     1032          return kFALSE;
     1033      }
     1034      if (max < 3) //was 1
     1035      {
     1036          cout << "Sorry, less than 3 detected spot in FOV!" << endl;   
     1037          return kFALSE;         
     1038      }
    8371039
    8381040    stars.Sort(); // Sort by magnitude
    8391041
    8401042    TString str = "data/tracking_";
    841     str += fSao->GetMjd()-52000;
     1043    str += fSao->GetMjd();
    8421044    str += ".txt";
    8431045
     
    8481050    Int_t num = 0;
    8491051
    850     // FIXME: Is predifined value 3 a good idea?
     1052    // FIXME: Is predefined value 3 a good idea?
    8511053
    8521054    MStar *star;
    8531055    MStarListIter NextStar(&stars);
    854     while ((star=NextStar()) && num++<max+3)
     1056    while ((star=NextStar()) && num++<max+3) 
    8551057    {
    8561058        TIter NextSp(&leds);
    8571059        Led *spot=NULL;
    858         while ((spot=(Led*)NextSp()))
    859         {
    860             const XY dpos(spot->GetX()-star->GetX(), spot->GetY()-star->GetY());
    861 
     1060        while ((spot=(Led*)NextSp())) 
     1061        {
     1062            const XY dpos(spot->GetX()-(768-star->GetX()), spot->GetY()-star->GetY());
     1063           
    8621064            const Int_t idx = x.GetSize();
    863 
     1065           
    8641066            x.Set(idx+1);
    8651067            y.Set(idx+1);
    8661068            mag.Set(idx+1);
    867 
     1069           
    8681070            x.AddAt(dpos.X(), idx);
    8691071            y.AddAt(dpos.Y(), idx);
    8701072            mag.AddAt(spot->GetMag()/star->GetMag(), idx);
    8711073
    872             if (fout)
     1074            if (fout) {
     1075                fout << spot->GetX() << " "
     1076                     << spot->GetY()  << " "
     1077                     << spot->GetMag()  << " "
     1078                     << star->GetX() << " "
     1079                     << star->GetY()  << " "
     1080                     << star->GetMag()  << " ";
    8731081                fout << x[idx] << " " << y[idx] << " " << mag[idx] << endl;
     1082            }
    8741083        }
    875     }
    876 
    877     ZdAz d = TrackingError(x, y, mag);
    878 
     1084    } 
     1085
     1086    d = TrackingError(x, y, mag);
     1087    fDZdAz->SetCoordinates(d);
     1088   
    8791089    //
    8801090    // Calculated offsets
    8811091    //
    8821092
     1093#ifdef EXPERT
    8831094    // round= floor(x+.5)
    8841095    cout << "Offset-ZdAz: " << d.Zd()*60 << "' / " << d.Az()*60 << "'" << endl;
    8851096    cout << "Offset-ZdAz: " << d.Zd()/360*16384 << " / " << d.Az()/360*16384 << " (SE) " << endl;
     1097#endif
    8861098
    8871099    //
     
    8901102    ZdAz cpos = fSao->GetZdAz()-d;
    8911103    fPZdAz->SetCoordinates(cpos);
    892 }
    893 
    894 void MStarguider::FindStar(FilterLed &f, FilterLed &f2, Ring &center, MTime &t)
     1104
     1105    return kTRUE;
     1106
     1107}
     1108
     1109ZdAz MStarguider::FindStar(FilterLed &f, FilterLed &f2, Ring &center, MTime &t, Double_t cut, Double_t box, Double_t scalefactor = 1.0)
    8951110{
    8961111    // Set search Paremeters (FIXME: Get them from user input!)
    897     f.SetCut(3.5);
    898     f.SetBox(70);
     1112    f.SetCut(cut);  // 3.5
     1113    f.SetBox(box);  // 70
    8991114
    9001115    // Try to find Led in this area
     
    9021117    f.FindStar(leds, (Int_t)center.GetX(), (Int_t)center.GetY());
    9031118
    904     // Check wheter star found
     1119    // Check whether star found
    9051120    Led *star = (Led*)leds.At(0);
    9061121    if (!star || leds.GetEntries()<1)
    907         return;
     1122        return ZdAz(.0,.0);
    9081123
    9091124    cout << "Found star @ " << flush;
     
    9321147
    9331148    // Convert from Pixel to millimeter (1pix=2.9mm)
    934     x *= 2.58427;
    935     y *= 2.58427;
     1149    x *= (2.58427 * scalefactor);
     1150    y *= (2.58427 * scalefactor);
    9361151
    9371152    // Correct for abberation.
     
    9451160    cout << "STAR-Offset: " << MTime(-1) << " dZd=" << dzd << "d  dAz=" << daz << "d" << endl;
    9461161
     1162    ZdAz zdaz(dzd,daz);
     1163
    9471164    // Check TPoint data set request
    9481165    if (!fTPoint->IsDown())
    949         return;
     1166        return zdaz;
    9501167    fTPoint->SetDown(kFALSE);
    9511168
     
    10111228        outrep.UnLock("MStarguider::FindStar");
    10121229    }
     1230   
     1231    return zdaz;
    10131232}
    10141233
     
    10421261}
    10431262
    1044 void MStarguider::ProcessFrame(const unsigned long n, byte *img, struct timeval *tm)
     1263void MStarguider::ProcessFrame(const unsigned long n, byte *img,
     1264                               struct timeval *tm)
    10451265{
    10461266    static unsigned long n0 = n;
     
    10661286    FilterLed f(img,   768, 576, 2.5); // 2.5
    10671287    FilterLed f2(cimg, 768, 576); // former color 0xb0
    1068 
     1288   
    10691289    if (fDisplay->IsEntryChecked(IDM_kStretch))
    10701290        f.Stretch();
    1071 
     1291   
    10721292    if (!fWritePictures->IsEntryEnabled(IDM_kStart) &&
    10731293        (!(n%fWrtRate) || fWriteType->IsEntryChecked(IDM_kOnce)))
     
    10751295        if (fFileType->IsEntryChecked(IDM_kPNG))
    10761296            Writer::Png("pix/file", img, tm);
    1077 
     1297       
    10781298        if (fFileType->IsEntryChecked(IDM_kPPM))
    10791299            Writer::Ppm("pix/file", img, tm);
    1080 
     1300       
    10811301        if (fWriteType->IsEntryChecked(IDM_kOnce))
    10821302            ProcessMessage(MK_MSG(kC_COMMAND, kCM_MENU), IDM_kStop, 0);
    10831303    }
    1084 
    1085     MStarList spots;
     1304   
     1305    // Visual Filter, whole FOV
    10861306    if (fDisplay->IsEntryChecked(IDM_kFilter))
    10871307        f.Execute();
    1088 
     1308   
     1309    /* ----------------------------------
     1310    // Visual StarFilter for Starguider
     1311    if (fDisplay->IsEntryChecked(IDM_kFilterStarg) && !fDisplay->IsEntryChecked(IDM_kStarguider)) {
     1312      f.SetBox(230);
     1313      f.AddIgnoreRegion(295,112,384,204);
     1314      f.Execute(530, 292);
     1315    }
     1316    ------------------------------------- */
     1317
     1318    // Find Center of Camera for Caos and Tpoints
    10891319    Ring center(768/2, 576/2);
    10901320    if (fDisplay->IsEntryChecked(IDM_kCaosFilter))
     
    10951325        if (fCosy)
    10961326            pos = fCosy->GetPointingPos();
    1097 
    1098         center = fCaos->Run(img, printl, printr, pos, t);
    1099     }
    1100 
     1327        center = fCaos->Run(img, printl, printr, pos, t, 50, 3.0);
     1328    }
     1329
     1330    // Find Star at Center---for Tpoint Procedure
    11011331    if (fDisplay->IsEntryChecked(IDM_kFindStar))
    1102         FindStar(f, f2, center, t);
     1332        ZdAz zdaz = FindStar(f, f2, center, t, 3.5, 70);
    11031333
    11041334    byte zimg[kZOOM*kZOOM];
     
    11111341    if (fCosy)
    11121342    {
    1113         byte simg[(768/2-1)*(576/2-1)];
    1114         for (int y=0; y<576/2-1; y++)
    1115             for (int x=0; x<768/2-1; x++)
    1116                 simg[x+y*(768/2-1)] = ((unsigned int)img[2*x+2*y*768]+img[2*x+2*y*768+1]+img[2*x+2*(y+1)*768]+img[2*x+2*(y+1)*768+1])/4;
    1117 
    1118         fCosy->GetWin()->GetImage()->DrawImg(simg);
    1119     }
    1120 
     1343        byte simg[(768/2-1)*(576/2-1)];
     1344        for (int y=0; y<576/2-1; y++)
     1345            for (int x=0; x<768/2-1; x++)
     1346                simg[x+y*(768/2-1)] = ((unsigned int)img[2*x+2*y*768]+img[2*x+2*y*768+1]+img[2*x+2*(y+1)*768]+img[2*x+2*(y+1)*768+1])/4;       
     1347       
     1348        fCosy->GetWin()->GetImage()->DrawImg(simg);
     1349    }
     1350
     1351    // Find Center of Camera in Starfield Camera picture
     1352
     1353    Ring sgcenter(53.2, 293.6); // Center of camera in SG picture [px]
     1354    ZdAz sgcenterzdaz(0, 0);    // Center of camera in SG picture [deg]
     1355                                // (0,0)_deg is at (53.2, 293.6)_px
     1356    ZdAz star(0, 0);            // Star on curtain in [deg]
     1357
     1358    if (fDisplay->IsEntryChecked(IDM_kStargCaosFilter))
     1359    {   
     1360        ZdAz pos;
     1361        if (fCosy)
     1362            pos = fCosy->GetPointingPos();
     1363        sgcenter =
     1364            fStargCaos->Run(img, kFALSE, kFALSE, pos, t, 30, 3.0); // [px]
     1365        const Float_t pixsize = atof(fPixSize->GetText()); // [arcsec/px]
     1366        sgcenterzdaz.Zd((sgcenter.GetY()-293.6) * pixsize /3600 );
     1367        sgcenterzdaz.Az((sgcenter.GetX()-53.2) * pixsize /3600 );
     1368#ifdef EXPERT
     1369        cout << "- LEDs imply offset of Zd="
     1370             << sgcenter.GetX()-53.2 << "pix Az="
     1371             << sgcenter.GetY()-293.6<< "pix" << endl; 
     1372#endif
     1373        if (fDisplay->IsEntryChecked(IDM_kStargFindStar)) {
     1374            star = FindStar(f, f2, sgcenter, t, 4.5, 30, 267/161.9); // [deg]
     1375#ifdef EXPERT
     1376            cout << "- Star is found to be off Zd=" << star.Zd()*60 << "' Az="
     1377                 << star.Az()*60 << "'" << endl;           
     1378#endif
     1379            fSZdAz->SetCoordinates(star); // Misspointing found from Camera
     1380        }
     1381    }
     1382
     1383    // we calculate the offset given by the three ETH Leds visible to
     1384    // the guide camera
     1385    // This is an (inferior, obsolete) alternative to the StarCaosFilter
     1386    // Led offset;
     1387    // if (fDisplay->IsEntryChecked(IDM_kStargLEDFilter))       
     1388    //  fStargLeds->Run(img,offset);
     1389
     1390    // Position corresponding to the camera center (53.2, 293.6)
     1391    Ring skycenter(392, 318);
     1392    // MStarList spots;
     1393
     1394    // we obtain a list of stars in the FOV from the SAO catalog
    11211395    if (fDisplay->IsEntryChecked(IDM_kCatalog))
    11221396    {
    1123         MTime time(*tm);
    1124 
    1125         XY xy = fCRaDec->GetCoordinates();
    1126         fRaDec->Set(xy.X()*360/24, xy.Y());
    1127 
    1128         UpdatePosZoom();
    1129 
    1130         /*
    1131         if (fDisplay->IsEntryChecked(IDM_kStarguider))
    1132         {
    1133             Leds leds;
    1134             f.Execute(leds);
    1135 
    1136             cout << "Found: " << leds.GetEntries() << " stars." << endl;
    1137 
    1138             CalcTrackingError(leds, stars);
    1139         }
    1140         */
    1141 
    1142         // Always call SetMjd first!
    1143         fSao->SetPointing(time.GetMjd(), *fRaDec);
    1144         fCZdAz->SetCoordinates(fSao->GetZdAz());
    1145 
    1146         MStarList stars;
    1147         fSao->CalcStars(stars);
    1148         fSao->DrawStars(stars, cimg);
    1149     }
    1150 
     1397        MTime time(*tm);
     1398         
     1399        XY xy = fCRaDec->GetCoordinates();
     1400        fRaDec->Set(xy.X()*360/24, xy.Y());
     1401
     1402        UpdatePosZoom();
     1403
     1404        // Always call SetMjd first!
     1405        fSao->SetPointing(time.GetMjd(), *fRaDec);
     1406        fCZdAz->SetCoordinates(fSao->GetZdAz());
     1407
     1408        MStarList stars;
     1409        fSao->SetBox(230); // Region of interest around center
     1410
     1411        // very careful: If center of camera cannot be determined
     1412        // sgcenter jumps to (0,0) 
     1413        double sgcenteroffsetX = 0.0;
     1414        double sgcenteroffsetY = 0.0;
     1415        if ((double)sgcenter.GetX() > 0.0 && (double)sgcenter.GetY() > 0.0) {
     1416            sgcenteroffsetX = sgcenter.GetX()-53.2;
     1417            sgcenteroffsetY = sgcenter.GetY()-293.6;
     1418        }
     1419
     1420        // we obtain stars in the effective star FOV and draw them.
     1421        // coordinates are video frame coords.
     1422        // We determine the ideal starfield using camera sagging info
     1423        // from the LEDs
     1424
     1425        //cout << sgcenteroffsetX << " " << sgcenteroffsetY << endl;
     1426
     1427        fSao->CalcStars(stars, 530, 292,
     1428                        -8+2-3+sgcenteroffsetX,  //x: star<spot =>subs
     1429                        31.5-3+sgcenteroffsetY);   //y: star<spot =>subs?
     1430
     1431        fSao->DrawStars(stars, cimg);
     1432
     1433        // There are two corrections to the misspointing
     1434        // - Sagging of the camera as measured with the LEDs
     1435        // - Star not ideally centered on MAGIC Camera
     1436
     1437        // Next we evaluate the offset given by the LEDs. This we obtain
     1438        // in Zd/Az and add it to the tracking error.
     1439       
     1440        if (fDisplay->IsEntryChecked(IDM_kStarguider))
     1441        {
     1442            Leds spots;
     1443            f.SetBox(230);
     1444            double bright;
     1445            f.ExecuteAndMark(spots, 530, 292, bright);
     1446            MString txt;
     1447            txt.Print("Sky Brightness: %.1f", bright);
     1448            fSkyBright->SetText(txt);
     1449
     1450            ULong_t color;
     1451            gClient->GetColorByName("Green", color);   
     1452            if (bright> 60) gClient->GetColorByName("Yellow", color);   
     1453            if (bright> 85) gClient->GetColorByName("Orange", color);   
     1454            if (bright> 95) gClient->GetColorByName("Red", color);   
     1455            fSkyBright->SetBackgroundColor(color);
     1456           
     1457            bool rc = CalcTrackingError(spots, stars, fD, t);
     1458
     1459            if (rc && (bright <= 1.75* fLastBright) && (bright < 110)) {
     1460              fStatus = MDriveCom::kMonitoring;
     1461            } else {
     1462              fStatus = MDriveCom::kError;
     1463            }
     1464           
     1465            if (fCosy)
     1466                fPos = fCosy->GetPointingPos();   
     1467         
     1468            if (fDisplay->IsEntryChecked(IDM_kStargAnalysis))
     1469                fStargHistograms->Fill(spots, stars, fD,
     1470                   fSao->GetZdAz(), sgcenter, sgcenterzdaz,
     1471                   star, bright, fPos, t);
     1472
     1473            fLastBright = bright;
     1474
     1475        } //kStarguider
     1476
     1477        f2.DrawCircle(skycenter, 2.0, 0x0a);
     1478       
     1479        f2.DrawCircle(skycenter, 7.4, 0x0a); //0.1deg
     1480
     1481        f2.DrawCircle(skycenter, 2.06*.5*74.0, 0x0a);
     1482        f2.DrawCircle(skycenter, 2.32*.5*74.0, 0x0a);
     1483        f2.DrawCircle(skycenter, 3.50*.5*74.0, 0x0a);
     1484        f2.DrawCircle(skycenter, 3.84*.5*74.0, 0x0a);
     1485
     1486    } //CalcStars
     1487
     1488    if (fCosy) {
     1489        MDriveCom &com = *fCosy->GetDriveCom();
     1490        com.SendStargReport(fStatus, fD);    // Report
     1491    }
     1492
     1493    // Draw Circles around center of Camera
    11511494    if (fDisplay->IsEntryChecked(IDM_kCaosFilter))
    11521495    {
    11531496        f2.DrawCircle(center, 0x0a);
    1154         f2.DrawCircle(center,   5.0, fDisplay->IsEntryChecked(IDM_kFindStar)?3:0xb0);
     1497        f2.DrawCircle(center,   5.0,
     1498                      fDisplay->IsEntryChecked(IDM_kFindStar)?3:0xb0);
    11551499        f2.DrawCircle(center, 115.0, 0x0a);
    11561500        f2.DrawCircle(center, 230.0, 0x0a);
     
    11581502    }
    11591503
    1160     if (fDisplay->IsEntryChecked(IDM_kCatalog))
    1161     {
    1162         fSao->PaintImg(cimg, 768, 576);
    1163 
    1164         const float r = 60*60/fSao->GetPixSize();
    1165 
    1166         f2.DrawCircle(0.5*r, 0x0a);
    1167         f2.DrawCircle(1.0*r, 0x0a);
    1168         f2.DrawCircle(1.5*r, 0x0a);
    1169     }
     1504    if (fDisplay->IsEntryChecked(IDM_kStargCaosFilter))
     1505    {
     1506        f2.DrawCircle(sgcenter, 0x0a);
     1507        f2.DrawCircle(sgcenter,   5.0,
     1508                      fDisplay->IsEntryChecked(IDM_kFindStar)?3:0xb0);
     1509    }
     1510
     1511//      if (fDisplay->IsEntryChecked(IDM_kCatalog))
     1512//      {
     1513//          fSao->PaintImg(cimg, 768, 576);
     1514//          const float r = 60*60/fSao->GetPixSize();
     1515//      f2.DrawCircle(0.5*r, 0x0a);
     1516//      f2.DrawCircle(1.0*r, 0x0a);
     1517//      f2.DrawCircle(1.5*r, 0x0a);
     1518//      }
    11701519
    11711520    if (fDisplay->IsEntryChecked(IDM_kCaosFilter) ||
     
    11831532    {
    11841533        // FIXME: Necessary?
    1185         fSao->Now();
     1534        fSao->Now();
    11861535        AltAz aa = fSao->CalcAltAzFromPix(fDx, fDy)*kRad2Deg;
    1187 
    11881536        if (aa.Az()<0)
    11891537            aa.Az(aa.Az()+360);
    1190 
    11911538        txt.Print("%.1fd/%.1fd (%d, %d)", -aa.Alt(), aa.Az()-180, fDx, fDy);
    11921539    }
    11931540    else
    11941541        txt.Print("(%d, %d)", fDx, fDy);
    1195 
    11961542    fPosZoom->SetText(txt);
    11971543}
     
    12211567    return kTRUE;
    12221568}
     1569
     1570void MStarguider::Print(TString &str, Double_t deg) const
     1571{
     1572    Char_t sgn;
     1573    UShort_t d, m, s;
     1574
     1575    MAstro::Deg2Dms(deg, sgn, d, m, s);
     1576
     1577    MString txt;
     1578    str += txt.Print("%c %03d %02d %03d ", sgn, d, m, s);
     1579}
  • trunk/MagicSoft/Cosy/main/MStarguider.h

    r4105 r4865  
    11#ifndef COSY_MStarguider
    22#define COSY_MStarguider
    3 
    4 #ifndef ROOT_TGFrame
    5 #include <TGFrame.h>
    6 #endif
    73
    84#include "PixClient.h"
     
    2319class TGLabel;
    2420class TGButton;
     21class TString;
    2522
    2623class TTimer;
     
    3936class MCosy;
    4037class MCaos;
     38// class MStargLeds;
     39class MStargHistograms;
     40class MGStarg;
    4141class FilterLed;
    4242class Ring;
     
    5454    MGImage       *fImage;
    5555    MGImage       *fZoomImage;
     56
     57    MGStarg       *fGStarg;
    5658
    5759    MGPopupMenu   *fDisplay;
     
    7476
    7577    MGCoordinates *fPZdAz;
     78    MGCoordinates *fDZdAz;
     79    MGCoordinates *fSZdAz;
    7680
    7781    TGTextEntry   *fPixSize;
     
    8084    TGLabel       *fFps;
    8185    TGLabel       *fPosZoom;
     86    TGLabel       *fSkyBright;
    8287
    8388    TGButton      *fTPoint;
    8489
     90    ZdAz          fPos;
     91    ZdAz          fD;
     92   
    8593    StarCatalog   *fSao;
    8694    MCosy         *fCosy;
    8795    MCaos         *fCaos;
    88 
     96    MCaos         *fStargCaos;
     97    //    MStargLeds    *fStargLeds;
     98    MStargHistograms *fStargHistograms;
     99   
    89100    RaDec *fRaDec;
    90101
     
    100111    int  fWrtRate;
    101112
     113    UInt_t fStatus;
     114    Double_t fLastBright;
     115
    102116    void SetPixSize(const double pixsize);
    103117    void Toggle(MGPopupMenu *p, UInt_t id);
    104118    //void GetCoordinates();
    105     void CalcTrackingError(Leds &, MStarList &);
     119    bool CalcTrackingError(Leds &, MStarList &, ZdAz &, MTime &);
     120    //void CalcTrackingError(Leds &, MStarList &);
    106121    ZdAz TrackingError(TArrayF &alt, TArrayF &az, TArrayF &mag) const;
    107122    bool Interpolate(const unsigned long n, byte *img) const;
    108     void FindStar(FilterLed &f, FilterLed &f2, Ring &center, MTime &t);
     123    ZdAz FindStar(FilterLed &f, FilterLed &f2, Ring &center, MTime &t,
     124                  Double_t cut, Double_t box, Double_t scalefactor);
    109125
    110126    //void InitHists();
     
    145161    void ProcessFrame(const unsigned long n, byte *img, struct timeval *tm);
    146162
     163    void Print(TString &str, Double_t deg) const;
     164
    147165    ClassDef(MStarguider, 0)
    148166};
    149167
    150168#endif
     169
     170
  • trunk/MagicSoft/Cosy/main/MainLinkDef.h

    r4105 r4865  
    77#pragma link C++ class MCosy;
    88#pragma link C++ class MStarguider+;
     9#pragma link C++ class MStargHistograms+;
    910
    1011#pragma link C++ class MBending;
  • trunk/MagicSoft/Cosy/main/Makefile

    r4105 r4865  
    3434SRCFILES = MBending.cc \
    3535           MStarguider.cc \
     36           MStargHistograms.cc \
    3637           MPointing.cc \
    3738           MTracking.cc \
Note: See TracChangeset for help on using the changeset viewer.