Ignore:
Timestamp:
07/15/03 15:05:21 (21 years ago)
Author:
tbretz
Message:
*** empty log message ***
Location:
trunk/MagicSoft/Cosy/caos
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/MagicSoft/Cosy/caos/Led.cc

    r1802 r2278  
    22
    33#include <iostream.h>
     4
     5#include <TROOT.h>
    46#include <TMath.h>
    57
     
    1618{
    1719    cout << "Led: ";
    18     cout << "x="   << fX   << "+-" << fDx   << ", ";
    19     cout << "y="   << fY   << "+-" << fDy   << ", ";
    20     cout << "phi=" << fPhi << "+-" << fDphi << ", ";
     20    cout << "x="   << Form("%5.1f", fX)   << "+-" << fDx   << ", ";
     21    cout << "y="   << Form("%5.1f", fY)   << "+-" << fDy   << ", ";
     22    cout << "phi=" << Form("%6.1f", fPhi) << "+-" << fDphi << ", ";
    2123    cout << "mag=" << fMag << endl;
    2224}
  • trunk/MagicSoft/Cosy/caos/Led.h

    r1802 r2278  
    2323public:
    2424    Led(Double_t x=0, Double_t y=0, Double_t dx=0, Double_t dy=0, Double_t mag=0) :
    25         fX(x), fY(y), fDx(dx), fDy(dy), fMag(mag)
     25        fX(x), fY(y), fPhi(0), fDx(dx), fDy(dy), fDphi(-1), fMag(mag)
    2626    {
    2727    }
     
    4848    Double_t GetMag() const  { return fMag; }
    4949
    50         Bool_t IsSortable() const { return kTRUE; }
     50    void AddOffset(Double_t dx, Double_t dy) { fX+=dx; fY+=dy; }
     51
     52    Bool_t IsSortable() const { return kTRUE; }
    5153
    5254    void CalcPhi(const Ring &ring);
  • trunk/MagicSoft/Cosy/caos/Leds.cc

    r1802 r2278  
    1212}
    1313
     14void Leds::Add(Double_t x, Double_t y, Double_t dx, Double_t dy, Double_t mag)
     15{
     16    Set(GetEntriesFast(), x, y, dx, dy, mag);
     17}
     18
    1419void Leds::Print(Option_t *o=NULL) const
    1520{
  • trunk/MagicSoft/Cosy/caos/Leds.h

    r1815 r2278  
    1919    //
    2020
    21     void Set(Int_t i, Double_t x, Double_t y, Double_t dx, Double_t dy, Double_t mag);
     21    void Set(Int_t i, Double_t x, Double_t y, Double_t dx=0, Double_t dy=0, Double_t mag=0);
     22    void Add(Double_t x, Double_t y, Double_t dx=0, Double_t dy=0, Double_t mag=0);
    2223
    2324    //nst Led &GetLed(int i) const { return *(Led*)( (*this)[i] ); }
  • trunk/MagicSoft/Cosy/caos/Ring.cc

    r1882 r2278  
    99
    1010ClassImp(Ring);
     11
     12Ring::Ring() :
     13    fX(0), fY(0), fR(0), fPhi(0), fDx(-1), fDy(-1), fDr(-1), fDphi(-1)
     14{
     15}
     16
    1117
    1218bool Ring::CalcCenter(const Leds &leds, Int_t i, Int_t j, Int_t k)
     
    5359    fY = ((m2*(leds(i).GetY() + leds(j).GetY()) +m1*m2*(leds(k).GetX() - leds(i).GetX())-m1*(leds(j).GetY() + leds(k).GetY()))/(m2-m1)/2);
    5460
    55     fR = sqrt(sqr(fX-leds(i).GetX())+sqr(fY-leds(i).GetY()));
     61    fR = hypot(fX-leds(i).GetX(), fY-leds(i).GetY());
    5662
    5763    return kTRUE;
     
    101107    }
    102108
    103     fDx=sqrt(fDx)/(n-1);
    104     fDy=sqrt(fDy)/(n-1);
    105     fDr=sqrt(fDr)/(n-1);
     109    fDx=sqrt(fDx)/n;
     110    fDy=sqrt(fDy)/n;
     111    fDr=sqrt(fDr)/n;
    106112}
    107113
     
    109115{
    110116    cout << "Ring: ";
    111     cout << "x="   << fX   << "+-" << fDx  << ", ";
    112     cout << "y="   << fY   << "+-" << fDy  << ", ";
    113     cout << "r="   << fR   << "+-" << fDr  << ", ";
    114     cout << "phi=" << fPhi << "+-" << fDphi << endl;
     117    cout << "x="   << Form("%5.1f", fX) << "+-" << Form("%.1f", fDx) << ", ";
     118    cout << "y="   << Form("%5.1f", fY) << "+-" << Form("%.1f", fDy) << ", ";
     119    cout << "r="   << Form("%5.1f", fR) << "+-" << Form("%.1f", fDr) << ", ";
     120    cout << "phi=" << fPhi              << "+-" << fDphi << endl;
    115121}
    116122
  • trunk/MagicSoft/Cosy/caos/Ring.h

    r1802 r2278  
    3232
    3333public:
     34    Ring();
    3435
    3536    Double_t GetX() const   { return fX; }
  • trunk/MagicSoft/Cosy/caos/Rings.cc

    r1815 r2278  
    88ClassImp(Rings);
    99
    10 void Rings::CalcCenters(const Leds &leds)
     10void Rings::CalcCenters(const Leds &leds, Float_t min, Float_t max)
    1111{
    1212    Clear();
    1313
    1414    int nPoints = leds.GetEntries();
     15
     16    if (nPoints<5)
     17        return;
    1518
    1619    int n=0;
     
    2730                }
    2831
     32                //
     33                //filter and remove rings with too big or too small radius
     34                //
     35                if ((min>=0&&ring.GetR()<min) || (max>=0&&ring.GetR()>max))
     36                {
     37                    RemoveAt(n);
     38                    continue;
     39                }
     40
    2941                n++;
    3042            }
     
    3345}
    3446
    35 void Rings::CalcRings(Leds &leds)
     47void Rings::CalcRings(Leds &leds, Float_t min, Float_t max)
    3648{
    37     CalcCenters(leds);
     49    CalcCenters(leds, min, max);
    3850
    3951    fCenter.InterpolCenters(*this);
     
    5163{
    5264    cout << "Number of Rings: " << GetEntries() << endl;
    53     TClonesArray::Print();
    54     cout << "Center: " << endl;
    55     fCenter.Print();
     65    if (GetEntriesFast()>0)
     66    {
     67        TClonesArray::Print();
     68        cout << "Center: " << endl;
     69        fCenter.Print();
     70    }
    5671}
  • trunk/MagicSoft/Cosy/caos/Rings.h

    r1815 r2278  
    1717    Ring fCenter;
    1818
    19     void CalcCenters(const Leds &leds);
     19    void CalcCenters(const Leds &leds, Float_t min, Float_t max);
    2020
    2121public:
    2222    Rings() : TClonesArray("Ring", 1) {}
    2323
    24     void CalcRings(Leds &leds);
     24    void CalcRings(Leds &leds, Float_t min=-1, Float_t max=-1);
    2525
    2626    void Print(Option_t *o=NULL) const;
Note: See TracChangeset for help on using the changeset viewer.