Changeset 18622 for trunk/FACT++/drive


Ignore:
Timestamp:
09/18/16 14:47:40 (8 years ago)
Author:
tbretz
Message:
Removed references to root and obsolete code
Location:
trunk/FACT++/drive
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/drive/MCaos.cc

    r18618 r18622  
    22
    33#include <fstream>
    4 
    5 #include <TSystem.h>
    6 #include <TFile.h>
    7 #include <TTree.h>
    8 #include <TH1.h>
    9 #include <TH2.h>
    10 #include <TGraph.h>
    11 #include <TCanvas.h>
    12 
    13 #include "MLog.h"
    14 #include "MLogManip.h"
    15 
    16 #include "MTime.h"
    17 #include "MPointing.h"
     4#include <iostream>
     5#include <iomanip>
     6#include <math.h>
    187
    198#include "Led.h"
    20 #include "Ring.h"
    21 #include "Rings.h"
    229#include "FilterLed.h"
    2310
     
    2916    if (!fin)
    3017    {
    31         gLog << err << "ERROR - Cannot open " << name << endl;
     18        cout << "ERROR - Cannot open " << name << endl;
    3219        return;
    3320    }
    3421
    35     fPositions.Clear();
     22    fPositions.clear();
    3623
    37     gLog << all << " Reading " << name << ":" << endl;
    38     gLog << inf << "------------------------------" << endl;
     24    cout << " Reading " << name << ":" << endl;
     25    cout << "------------------------------" << endl;
    3926    while (1)
    4027    {
    41         Double_t px, py, ox, oy;
    42         fin >> px >> py >> ox >> oy;
     28        double px, py, phi;
     29        fin >> px >> py >> phi;
    4330        if (!fin)
    4431            break;
    4532
    46         gLog << " Led #" << fPositions.GetEntriesFast() << ":  ";
    47         gLog << setw(3) << px << " ";
    48         gLog << setw(3) << py << "  (";
    49         gLog << setw(3) << ox << ", ";
    50         gLog << setw(3) << oy << ")" << endl;
    51         AddPosition(px, py, ox, oy);
     33        cout << " Led #" << fPositions.size() << ":  ";
     34        cout << setw(3) << px << " ";
     35        cout << setw(3) << py << "  (";
     36        cout << setw(3) << phi << ")\n";
     37        AddPosition(px, py, phi);
    5238    }
    53     gLog << all << "Found " << fPositions.GetEntriesFast() << " leds." << endl;
     39    cout << "Found " << fPositions.size() << " leds." << endl;
    5440}
    5541
    56 void MCaos::OpenFile()
     42void MCaos::CalcCenters(const vector<Led> &leds, float min, float max)
    5743{
    58     int i=0;
    59     char name[100];
    60     while (1)
    61     {
    62         sprintf(name, "data/data%03d.root", i++);
    63         if (gSystem->AccessPathName(name, kFileExists))
    64             break;
    65     }
     44    fRings.clear();
    6645
    67     if (fFile)
    68         delete fFile;
     46    const int nPoints = leds.size();
    6947
    70     fFile = new TFile(name, "RECREATE");
     48    // A minimum of at least 3 points is mandatory!
     49    if (nPoints<fMinNumberLeds || nPoints<3)
     50        return;
    7151
    72     if (!fFile->IsOpen())
    73     {
    74         delete fFile;
    75         fFile = NULL;
     52//    ofstream fout("rings.txt", ios::app);
    7653
    77         gLog << err << "ERROR - Cannot open file '" << name << "'" << endl;
    78     }
     54    for (int i=0; i<nPoints-2; i++)
     55        for (int j=i+1; j<nPoints-1; j++)
     56            for (int k=j+1; k<nPoints; k++)
     57            {
     58                Ring ring;
     59                if (!ring.CalcCenter(leds[i], leds[j], leds[k]))
     60                    continue;
    7961
    80     TTree *tree = new TTree("Data", "Real CaOs Data");
     62//                fout << i+j*10+k*100 << " " << ring.GetR() << " " << ring.GetX() << " " << ring.GetY() << endl;
    8163
    82     fLeds = new Leds;
    83     fEvtTime = 0;
     64                //
     65                //filter and remove rings with too big or too small radius
     66                //
     67                if ((min>=0&&ring.GetR()<min) || (max>=0&&ring.GetR()>max))
     68                    continue;
    8469
    85     tree->Branch("Leds", "TClonesArray", &fLeds);
    86     tree->Branch("ZenithDist.", &fZenithDist, "fZenithDist/D");
    87     tree->Branch("Azimuth.",    &fAzimuth,    "fAzimuth/D");
    88     tree->Branch("EvtTime.",    &fEvtTime,    "fEvtTime/D");
    89 
    90     gLog << inf << "Root file '" << name << "' open." << endl;
     70                fRings.push_back(ring);
     71            }
    9172}
    9273
    93 void MCaos::CloseFile()
     74int32_t MCaos::CalcRings(std::vector<Led> &leds, float min, float max)
    9475{
    95     if (!fFile)
    96         return;
     76    CalcCenters(leds, min, max);
    9777
    98     const TString  name = fFile->GetName();
    99     const Double_t n    = ((TTree*)fFile->Get("Data"))->GetEntries();
     78    fCenter.InterpolCenters(fRings);
    10079
    101     fFile->Write();
    102     delete fFile;
    103     fFile = NULL;
     80    for (auto it=leds.begin(); it!=leds.end(); it++)
     81        it->CalcPhi(fCenter);
    10482
    105     gLog << inf << "Root file closed (n=" << n << ")" << endl;
    106 
    107     if (n<1)
    108     {
    109         gSystem->Unlink(name);
    110         gLog << warn << "Root file deleted - no entries." << endl;
    111     }
     83    return fRings.size();
    11284}
    11385
    114 void MCaos::InitHistograms()
     86Ring MCaos::Run(uint8_t *img)
    11587{
    116     if (fHistpr)
    117         return;
    118 
    119     Rings r;
    120     r.SetMinNumberLeds(fMinNumberLeds);
    121     r.CalcRings(fPositions);
    122 
    123     const Ring &c = r.GetCenter();
    124 
    125     Double_t xmin = c.GetX()-50;
    126     Double_t xmax = c.GetX()+50;
    127 
    128     Double_t ymin = c.GetY()-50;
    129     Double_t ymax = c.GetY()+50;
    130 
    131     Double_t rmin = c.GetR()-50;
    132     Double_t rmax = c.GetR()+50;
    133 
    134     Int_t xbin = 1001;
    135     Int_t ybin = 1001;
    136     Int_t rbin = 1001;
    137 
    138     const Int_t sz = 50;
    139     fHistled = new TH2F*[fPositions.GetEntriesFast()];
    140     fHistw   = new TH1F*[fPositions.GetEntriesFast()];
    141     for (int i=0; i<fPositions.GetEntriesFast(); i++)
    142     {
    143         TString name  = "LED";
    144         TString title = "LED #";
    145 
    146         name += i;
    147         title += i;
    148 
    149         const Led &p = fPositions(i);
    150         fHistled[i] = new TH2F(name, title,
    151                                20*sz+1, p.GetX()-sz, p.GetX()+sz,
    152                                20*sz+1, p.GetY()-sz, p.GetY()+sz);
    153         fHistled[i]->SetXTitle("x [pix]");
    154         fHistled[i]->SetYTitle("counts");
    155 
    156         name = "Angle";
    157         title = "Angle of the Led #";
    158 
    159         name += i;
    160         title += i;
    161 
    162         fHistw[i] = new TH1F;
    163         fHistw[i]->SetNameTitle(name, title);
    164         fHistw[i]->SetBins(101, -50.5, 50.5);
    165         fHistw[i]->SetXTitle("\\Phi [arcmin]");
    166         fHistw[i]->SetYTitle("counts");
    167     }
    168 
    169     fHistallw = new TH1F;
    170     fHistallw->SetNameTitle("allw","Rotation angel");
    171     fHistallw->SetBins(26, -25, 25);
    172     fHistallw->SetXTitle("\\phi [arcmin]");
    173     fHistallw->SetYTitle("counts");
    174 
    175     fHistprxpry = new TH2F;
    176     fHistprxpry->SetNameTitle("prx und pry","x- and y-coordinate of the ring-center");
    177     fHistprxpry->SetBins(xbin, xmin, xmax, ybin, ymin, ymax);
    178     fHistprxpry->SetXTitle("x [pix]");
    179     fHistprxpry->SetYTitle("y [pix]");
    180     fHistprxpry->SetZTitle("counts");
    181 
    182     fGraphprx = new TGraph;
    183     fGraphprx->SetTitle("time-developement of the x-coordinate of the ring-center");
    184 
    185     fGraphpry = new TGraph;
    186     fGraphpry->SetTitle("time-developement of the y-coordinate of the ring-center");
    187 
    188     fGraphw = new TGraph;
    189     fGraphw->SetTitle("Time-developement of rotation angle");
    190 
    191     fHistpr = new TH1F("pr","Radius of the ring", rbin, rmin, rmax);
    192     fHistpr->SetXTitle("r [pix]");
    193     fHistpr->SetYTitle("counts");
    194 }
    195 
    196 void MCaos::DeleteHistograms()
    197 {
    198     TH1F *dummy = fHistpr;
    199     fHistpr=NULL;
    200 
    201     if (!dummy)
    202         return;
    203 
    204     delete dummy;
    205     delete fHistprxpry;
    206     delete fHistallw;
    207     delete fGraphprx;
    208     delete fGraphpry;
    209     delete fGraphr;
    210 
    211     for (int i=0; i<6; i++)
    212     {
    213         delete fHistled[i];
    214         delete fHistw[i];
    215         delete fGraphw;
    216     }
    217     delete fHistled;
    218     delete fHistw;
    219 }
    220 
    221 void MCaos::ShowHistograms()
    222 {
    223     if (!fHistpr || fHistpr->GetEntries()<1)
    224         return;
    225 
    226     TH1 *h;
    227 
    228     TCanvas *c = new TCanvas("cring", "Center of the ring", 800, 800);
    229     c->Divide(2,2);
    230     c->cd(1);
    231     h = (TH1*)fHistprxpry->ProfileX();
    232     h->Fit("gaus");
    233     h->Draw();
    234     h->SetBit(kCanDelete);
    235     c->cd(2);
    236     h = (TH1*)fHistprxpry->ProfileY();
    237     h->Fit("gaus");
    238     h->Draw();
    239     h->SetBit(kCanDelete);
    240     c->cd(3);
    241     fHistpr->Fit("gaus");
    242     fHistpr->DrawCopy();
    243     c->cd(4);
    244     fHistprxpry->DrawCopy(/*"surf2"*/);
    245     c->Update();
    246 
    247     const Int_t n1 = (Int_t)(TMath::Sqrt(fPositions.GetEntriesFast())+1.0);
    248     const Int_t n2 = (Int_t)(TMath::Sqrt(fPositions.GetEntriesFast())+0.5);
    249 
    250     TCanvas *c1 = new TCanvas("cpos", "Led Positions", 800, 600);
    251     TCanvas *c2 = new TCanvas("cangle", "Angles of the Leds", 800, 600);
    252     c1->Divide(n1, n2);
    253     c2->Divide(n1, n2);
    254     for (int i=0; i<fPositions.GetEntriesFast(); i++)
    255     {
    256         c1->cd(i+1);
    257         fHistled[i]->DrawCopy();
    258         c2->cd(i+1);
    259         fHistw[i]->DrawCopy();
    260     }
    261     c1->Update();
    262     c2->Update();
    263 
    264     /*
    265     c = new TCanvas("ctime", "Timedevelopement of Center", 800, 800);
    266     c->Divide(1,3);
    267     c->cd(1);
    268     h = fGraphprx->GetHistogram();
    269     h->SetXTitle("time [s]");
    270     h->SetYTitle("x [pix]");
    271     h->DrawCopy();
    272     c->SetSelectedPad(NULL);
    273     fGraphprx->DrawClone("ALP*")->SetBit(kCanDelete);
    274     gPad->Modified();
    275     gPad->Update();
    276     c->cd(2);
    277     h = fGraphpry->GetHistogram();
    278     h->SetXTitle("time [s]");
    279     h->SetYTitle("y [pix]");
    280     h->DrawCopy();
    281     //((TPad*)gPad)->SetSelectedPad(NULL);
    282     //fGraphpry->DrawClone("ALP*")->SetBit(kCanDelete);
    283     c->cd(3);
    284     h = fGraphr->GetHistogram();
    285     h->SetXTitle("time [s]");
    286     h->SetYTitle("r [pix]");
    287     h->DrawCopy();
    288     //((TPad*)gPad)->SetSelectedPad(NULL);
    289     //fGraphr->DrawClone("ALP*")->SetBit(kCanDelete);
    290     c->Modified();
    291     c->Update();
    292     */
    293 
    294     c = new TCanvas("crot", "rotation angle", 800, 600);
    295     c->Divide(2,1);
    296     c->cd(1);
    297     fHistallw->SetXTitle("\\phi [arcmin]");
    298     fHistallw->SetYTitle("counts");
    299     fHistallw->DrawCopy();
    300     /*
    301     c->cd(2);
    302     h = fGraphw->GetHistogram();
    303     h->SetXTitle("time [s]");
    304     h->SetYTitle("\\phi [arcmin]");
    305     h->DrawCopy();
    306     ((TPad*)gPad)->SetSelected(NULL);
    307     fGraphw->DrawClone("ALP*")->SetBit(kCanDelete);
    308     */
    309 
    310     /* --------------------------------------------------------
    311      *  CALCULATE OFFSETS!
    312      * --------------------------------------------------------
    313      Rings r;
    314      r.CalcRings(fPositions);
    315 
    316      const Ring &c = r.GetCenter();
    317      */
    318 }
    319 
    320 void MCaos::ResetHistograms()
    321 {
    322     if (!fHistpr)
    323         return;
    324 
    325     fHistpr->Reset();
    326     fHistprxpry->Reset();
    327     fHistallw->Reset();
    328     for (int i=0; i<6; i++)
    329     {
    330         fHistled[i]->Reset();
    331         fHistw[i]->Reset();
    332     }
    333 }
    334 
    335 Ring MCaos::Run(byte *img, bool printl, bool printr, const ZdAz &pos, const MTime &t)
    336 {
    337     Leds &leds = *fLeds;
    338     leds.Clear();
    339 
    340     fNumDetectedLEDs  = 0;
    341     fNumDetectedRings = 0;
    342 
    343     /*
    344     //the following lines are just to test the new setup
    345     static int i=0;
    346     i++;
    347     i%=2;
    348     if (i==0)
    349         ReadResources("leds0.txt");
    350     else
    351         ReadResources("leds1.txt");
    352     cout << "LEDs " << i << " " << flush;
    353      */
     88    fLeds.clear();
    35489
    35590    //          img  width height radius sigma
    35691    FilterLed f(img, 768, 576, fSizeBox, fSizeBox, fCut);
    35792
    358     Int_t first=0;
    359     for (int i=0; i<fPositions.GetEntriesFast(); i++)
     93    for (auto it=fPositions.begin(); it!=fPositions.end(); it++)
    36094    {
     95        std::vector<Led> arr;
     96
    36197        // Try to find Led in this area
    362         const Led &l0 = fPositions(i);
    363         f.Execute(leds, TMath::FloorNint(l0.GetX()), TMath::FloorNint(l0.GetY()));
    364 
    365         fNumDetectedLEDs = leds.GetEntries();
     98        f.Execute(arr, floor(it->GetX()), floor(it->GetY()));
    36699
    367100        // Loop over newly found Leds
    368         for (int j=first; j<leds.GetEntries(); j++)
     101        for (auto jt=arr.begin(); jt!=arr.end(); jt++)
    369102        {
    370             Led &l1 = leds(j);
     103            // Add Offset to Led
     104            //jt->AddOffset(it->GetDx(), it->GetDy());
    371105
    372             // Add Offset to Led
    373             l1.AddOffset(l0.GetDx(), l0.GetDy());
     106            // Remember the expected phi for each detected led
     107            jt->SetPhi(it->GetPhi());
    374108
    375109            // Mark Led in image (FIXME: Move to MStarguider)
    376             f.MarkPoint(l1.GetX(), l1.GetY(), l1.GetMag());
     110            f.MarkPoint(jt->GetX(), jt->GetY(), jt->GetMag());
     111        }
    377112
    378             //old
    379             /*
    380             // Fill values into Histogram
    381             if (!fHistpr)
    382                 continue;
    383 
    384             fHistled[i]->Fill(l1.GetX(), l1.GetY());
    385             fHistw[i]->Fill(l1.GetPhi());
    386             */
    387         }
    388         first = leds.GetEntries();
     113        fLeds.insert(fLeds.end(), arr.begin(), arr.end());
    389114    }
    390115
    391     Rings rings;
    392     rings.SetMinNumberLeds(fMinNumberLeds);
    393 //    rings.CalcRings(leds, 265, 268);
    394 // rwagner
    395 //    rings.CalcRings(leds, 158, 164);
    396     fNumDetectedRings = rings.CalcRings(leds, fMinRadius, fMaxRadius);
     116    fNumDetectedRings = CalcRings(fLeds, fMinRadius, fMaxRadius);
    397117
    398     const Ring &center = rings.GetCenter();
     118    double sumphi = 0;
     119    for (auto it=fLeds.begin(); it!=fLeds.end(); it++)
     120    {
     121        //cout << it->CalcPhi(fCenter) << "|" << it->GetPhi() << " ";
     122        double dphi = it->CalcPhi(fCenter) - it->GetPhi();
     123        if (dphi>M_PI)
     124            dphi -= 2*M_PI;
     125        if (dphi<-M_PI)
     126            dphi += 2*M_PI;
    399127
    400 //uncommented for testing
    401 //    center.Print();
     128        sumphi += dphi;
     129    }
     130    //cout << endl;
    402131
    403     // FIXME!
    404     static const MTime t0(t);
    405     fEvtTime = t-t0;
     132    fCenter.SetPhi(sumphi/fLeds.size());
    406133
    407     if (fHistpr)
    408     {
    409         fHistpr->Fill(center.GetR());
    410         fHistprxpry->Fill(center.GetX(), center.GetY());
    411         fGraphprx->SetPoint(fGraphprx->GetN(), fEvtTime, center.GetX());
    412         fGraphpry->SetPoint(fGraphpry->GetN(), fEvtTime, center.GetY());
    413 
    414         //new
    415         //-----
    416         Double_t sum = 0;
    417         for (int j=0; j<leds.GetEntries(); j++)
    418         {
    419             Led &l1 = leds(j);
    420 
    421             fHistled[j]->Fill(l1.GetX(), l1.GetY());
    422             //fHistw[j]->Fill(l1.GetPhi());
    423 
    424             Double_t phi[6] =
    425             {
    426                 0,
    427                 0,
    428                 0,
    429                 0,
    430                 0,
    431                 0
    432             };
    433 
    434             const Double_t w = (leds(j).GetPhi()-phi[j])*60;
    435             sum += w;
    436 
    437             fHistw[j]->Fill(w);
    438             sum /= leds.GetEntries();
    439         }
    440         fGraphw->SetPoint(fGraphw->GetN(), fEvtTime, sum);
    441         fHistallw->Fill(sum/leds.GetEntries());
    442         //-----
    443     }
    444 
    445     /*
    446     //test - give number of rings
    447     cout << rings.GetEntries() << " " << flush;
    448     */
    449 
    450     if (printl)
    451         leds.Print();
    452     if (printr)
    453         rings.Print();
    454 
    455     if (fFile && leds.GetEntries()>0)
    456     {
    457         fZenithDist = pos.Zd(); //fCosy ? fCosy->GetPointingPos().Zd() : 0
    458         fAzimuth    = pos.Az(); //fCosy ? fCosy->GetPointingPos().Az() : 0;
    459 
    460         TTree *t = (TTree*)fFile->Get("Data");
    461         t->Fill();
    462     }
    463 
    464     return center;
    465     /*
    466         if (fCaosAnalyse->IsEntryEnabled(IDM_kStopAnalyse))
    467         {
    468             const Ring &center = rings.GetCenter();
    469 
    470             Double_t phi[6] =
    471             {
    472                 -124.727,
    473                  -61.0495,
    474                  -16.7907,
    475                   49.3119,
    476                  139.086
    477             };
    478 
    479             Double_t sum = 0;
    480             for (int i=0; i<6 && leds.At(i); i++)
    481             {
    482                 const Double_t w = (leds(i).GetPhi()-phi[i])*60;
    483 
    484                 sum += w;
    485 
    486                 fHistw[i]->Fill(w);
    487                 fHistv[i]->Fill(leds(i).GetPhi());
    488                 fGraphw[i]->SetPoint(fGraphw[i]->GetN(), fEvtTime, w);
    489             }
    490             fHistallw->Fill(sum/5);
    491             }
    492             */
     134    return fCenter;
    493135}
    494 
    495 
    496 Int_t MCaos::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
    497 {
    498     if (IsEnvDefined(env, prefix, "File", print))
    499         ReadResources(GetEnvValue(env, prefix, "File", "ledsxxx.txt"));
    500 
    501     if (IsEnvDefined(env, prefix, "RadiusMin", print))
    502         fMinRadius = GetEnvValue(env, prefix, "RadiusMin", fMinRadius);
    503 
    504     if (IsEnvDefined(env, prefix, "RadiusMax", print))
    505         fMaxRadius = GetEnvValue(env, prefix, "RadiusMax", fMaxRadius);
    506 
    507     if (IsEnvDefined(env, prefix, "MinNumberLeds", print))
    508         fMinNumberLeds = GetEnvValue(env, prefix, "MinNumberLeds", fMinNumberLeds);
    509 
    510     if (IsEnvDefined(env, prefix, "SizeBox", print))
    511         fSizeBox = GetEnvValue(env, prefix, "SizeBox", fSizeBox);
    512 
    513     if (IsEnvDefined(env, prefix, "CleaningLevel", print))
    514         fCut = GetEnvValue(env, prefix, "CleaningLevel", fCut);
    515 
    516     if (IsEnvDefined(env, prefix, "ArcsecPerPixel", print))
    517         fArcsecPerPixel = GetEnvValue(env, prefix, "ArcsecPerPixel", fArcsecPerPixel);
    518 
    519     return kTRUE;
    520 }
  • trunk/FACT++/drive/MCaos.h

    r18618 r18622  
    22#define CAOS_MCaos
    33
    4 #ifndef MARS_MParContainer
    5 #include "MParContainer.h"
    6 #endif
    7 #ifndef CAOS_Leds
    8 #include "Leds.h"
    9 #endif
    104#ifndef CAOS_Ring
    115#include "Ring.h"
    126#endif
    137
    14 #ifndef COSY_PixClient
    15 #include "PixClient.h" // byte
    16 #endif
    17 
    18 class TFile;
    19 class TH1F;
    20 class TH2F;
    21 class TGraph;
    22 
    23 class MTime;
    24 class ZdAz;
    25 
    26 class MCaos : public MParContainer
     8class MCaos
    279{
    2810private:
    29     TFile         *fFile;       // File we may write data to
     11    std::vector<Led> fPositions;
     12    std::vector<Led> fLeds;
    3013
    31     Leds           fPositions;
     14    int16_t  fMinNumberLeds; // minimum number of detected leds required
     15    double   fMinRadius;     // minimum radius for cut in ring radius
     16    double   fMaxRadius;     // maximum radius for cut in ring radius
     17    uint16_t fSizeBox;       // Size of the search box (side length in units of pixels)
     18    double   fCut;           // Cleaning level (sigma above noise)
    3219
    33     Leds          *fLeds;
    34     Double_t       fEvtTime;
    35     Double_t       fZenithDist;
    36     Double_t       fAzimuth;
     20    int32_t fNumDetectedRings;
    3721
    38     TH1F          *fHistpr;
    39     TH2F         **fHistled;
    40     TH1F          *fHistallw;
    41     TH1F         **fHistw;
     22    Ring fCenter;
     23    std::vector<Ring> fRings;
    4224
    43     TH2F          *fHistprxpry;
    44 
    45     TGraph        *fGraphprx;
    46     TGraph        *fGraphpry;
    47     TGraph        *fGraphw;
    48     TGraph        *fGraphr;
    49 
    50     Short_t       fMinNumberLeds;      // minimum number of detected leds required
    51     Double_t      fMinRadius;          // minimum radius for cut in ring radius
    52     Double_t      fMaxRadius;          // maximum radius for cut in ring radius
    53     UShort_t      fSizeBox;            // Size of the search box (side length in units of pixels)
    54     Double_t      fCut;                // Cleaning level (sigma above noise)
    55     Double_t      fArcsecPerPixel;     // Conversion from arcseconds to pixel
    56 
    57     Int_t fNumDetectedLEDs;
    58     Int_t fNumDetectedRings;
     25    void CalcCenters(const std::vector<Led> &leds, float min, float max);
     26    int32_t CalcRings(std::vector<Led> &leds, float min=-1, float max=-1);
     27    const Ring &GetCenter() const { return fCenter; }
    5928
    6029public:
    61     MCaos(const char *name=0, const char *title=0)
    62         : fFile(NULL), fHistpr(NULL), fMinNumberLeds(5),
    63         fMinRadius(265), fMaxRadius(268), fSizeBox(19), fCut(3.0)
     30    MCaos() : fMinRadius(236.7), fMaxRadius(238.6), fSizeBox(19), fCut(3.5)
    6431    {
    65         fLeds = new Leds;
    6632    }
    6733
    6834    ~MCaos()
    6935    {
    70         CloseFile();
    71         DeleteHistograms();
    72         delete fLeds;
    7336    }
    7437
    75     void AddPosition(Float_t x, Float_t y, Float_t dx, Float_t dy)
     38    void AddPosition(float x, float y, float phi)
    7639    {
    77         fPositions.Add(x, y, dx, dy);
     40        fPositions.push_back(Led(x, y, phi));
    7841    }
    7942
    8043    void ReadResources(const char *name="leds.txt");
    8144
    82     void OpenFile();
    83     void CloseFile();
    84    
    85     void SetMinNumberLeds(Short_t n)
     45    void SetMinNumberLeds(int16_t n)
    8646    {
    8747        fMinNumberLeds = n;
    8848    }
    8949
    90     void SetMinRadius(Double_t min) { fMinRadius=min; }
    91     void SetMaxRadius(Double_t max) { fMaxRadius=max; }
     50    void SetMinRadius(double min) { fMinRadius=min; }
     51    void SetMaxRadius(double max) { fMaxRadius=max; }
    9252
    93     void InitHistograms();
    94     void DeleteHistograms();
    95     void ShowHistograms();
    96     void ResetHistograms();
     53    int32_t GetNumDetectedLEDs() const  { return fLeds.size(); }
     54    int32_t GetNumDetectedRings() const { return fNumDetectedRings; }
    9755
    98     Int_t GetNumDetectedLEDs() const  { return fNumDetectedLEDs; }
    99     Int_t GetNumDetectedRings() const { return fNumDetectedRings; }
    100 
    101     Double_t GetArcsecPerPixel() const { return fArcsecPerPixel; }
    102 
    103     Ring Run(byte *img, bool printl, bool printr, const ZdAz &pos,
    104              const MTime &t);
    105 
    106     Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print=kFALSE);
     56    Ring Run(uint8_t *img);
    10757};
    10858
Note: See TracChangeset for help on using the changeset viewer.