source: trunk/Cosy/caos/Rings.cc@ 17556

Last change on this file since 17556 was 9435, checked in by tbretz, 16 years ago
*** empty log message ***
File size: 1.5 KB
Line 
1#include "Rings.h"
2
3#include <iostream>
4
5#include "Led.h"
6#include "Leds.h"
7
8ClassImp(Rings);
9
10using namespace std;
11
12void Rings::CalcCenters(const Leds &leds, Float_t min, Float_t max)
13{
14 Clear();
15
16 int nPoints = leds.GetEntries();
17
18 // A minimum of at least 3 points is mandatory!
19 if (nPoints<fMinNumberLeds || nPoints<3)
20 return;
21
22 int n=0;
23 for (int i=0; i<nPoints-2; i++)
24 for (int j=i+1; j<nPoints-1; j++)
25 for (int k=j+1; k<nPoints; k++)
26 {
27 Ring &ring = *new ((*this)[n]) Ring;
28
29 if (!ring.CalcCenter(leds, i, j, k))
30 {
31 RemoveAt(n);
32 continue;
33 }
34
35 //
36 //filter and remove rings with too big or too small radius
37 //
38 if ((min>=0&&ring.GetR()<min) || (max>=0&&ring.GetR()>max))
39 {
40 RemoveAt(n);
41 continue;
42 }
43
44 n++;
45 }
46}
47
48Int_t Rings::CalcRings(Leds &leds, Float_t min, Float_t max)
49{
50 CalcCenters(leds, min, max);
51
52 fCenter.InterpolCenters(*this);
53
54 int n = leds.GetEntries();
55 for (int j=0; j<n; j++)
56 leds(j).CalcPhi(fCenter);
57
58 return GetEntries();
59}
60
61void Rings::Print(Option_t *o) const
62{
63 cout << "Number of Rings: " << GetEntries() << endl;
64 if (GetEntriesFast()>0)
65 {
66 TClonesArray::Print();
67 cout << "Center: " << endl;
68 fCenter.Print();
69 }
70}
Note: See TracBrowser for help on using the repository browser.