Changeset 2278 for trunk/MagicSoft/Cosy/caos
- Timestamp:
- 07/15/03 15:05:21 (21 years ago)
- Location:
- trunk/MagicSoft/Cosy/caos
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Cosy/caos/Led.cc
r1802 r2278 2 2 3 3 #include <iostream.h> 4 5 #include <TROOT.h> 4 6 #include <TMath.h> 5 7 … … 16 18 { 17 19 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 << ", "; 21 23 cout << "mag=" << fMag << endl; 22 24 } -
trunk/MagicSoft/Cosy/caos/Led.h
r1802 r2278 23 23 public: 24 24 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), f Dx(dx), fDy(dy), fMag(mag)25 fX(x), fY(y), fPhi(0), fDx(dx), fDy(dy), fDphi(-1), fMag(mag) 26 26 { 27 27 } … … 48 48 Double_t GetMag() const { return fMag; } 49 49 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; } 51 53 52 54 void CalcPhi(const Ring &ring); -
trunk/MagicSoft/Cosy/caos/Leds.cc
r1802 r2278 12 12 } 13 13 14 void 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 14 19 void Leds::Print(Option_t *o=NULL) const 15 20 { -
trunk/MagicSoft/Cosy/caos/Leds.h
r1815 r2278 19 19 // 20 20 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); 22 23 23 24 //nst Led &GetLed(int i) const { return *(Led*)( (*this)[i] ); } -
trunk/MagicSoft/Cosy/caos/Ring.cc
r1882 r2278 9 9 10 10 ClassImp(Ring); 11 12 Ring::Ring() : 13 fX(0), fY(0), fR(0), fPhi(0), fDx(-1), fDy(-1), fDr(-1), fDphi(-1) 14 { 15 } 16 11 17 12 18 bool Ring::CalcCenter(const Leds &leds, Int_t i, Int_t j, Int_t k) … … 53 59 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); 54 60 55 fR = sqrt(sqr(fX-leds(i).GetX())+sqr(fY-leds(i).GetY()));61 fR = hypot(fX-leds(i).GetX(), fY-leds(i).GetY()); 56 62 57 63 return kTRUE; … … 101 107 } 102 108 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; 106 112 } 107 113 … … 109 115 { 110 116 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; 115 121 } 116 122 -
trunk/MagicSoft/Cosy/caos/Ring.h
r1802 r2278 32 32 33 33 public: 34 Ring(); 34 35 35 36 Double_t GetX() const { return fX; } -
trunk/MagicSoft/Cosy/caos/Rings.cc
r1815 r2278 8 8 ClassImp(Rings); 9 9 10 void Rings::CalcCenters(const Leds &leds )10 void Rings::CalcCenters(const Leds &leds, Float_t min, Float_t max) 11 11 { 12 12 Clear(); 13 13 14 14 int nPoints = leds.GetEntries(); 15 16 if (nPoints<5) 17 return; 15 18 16 19 int n=0; … … 27 30 } 28 31 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 29 41 n++; 30 42 } … … 33 45 } 34 46 35 void Rings::CalcRings(Leds &leds )47 void Rings::CalcRings(Leds &leds, Float_t min, Float_t max) 36 48 { 37 CalcCenters(leds );49 CalcCenters(leds, min, max); 38 50 39 51 fCenter.InterpolCenters(*this); … … 51 63 { 52 64 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 } 56 71 } -
trunk/MagicSoft/Cosy/caos/Rings.h
r1815 r2278 17 17 Ring fCenter; 18 18 19 void CalcCenters(const Leds &leds );19 void CalcCenters(const Leds &leds, Float_t min, Float_t max); 20 20 21 21 public: 22 22 Rings() : TClonesArray("Ring", 1) {} 23 23 24 void CalcRings(Leds &leds );24 void CalcRings(Leds &leds, Float_t min=-1, Float_t max=-1); 25 25 26 26 void Print(Option_t *o=NULL) const;
Note:
See TracChangeset
for help on using the changeset viewer.