source: trunk/MagicSoft/Cosy/caos/Rings.cc@ 6724

Last change on this file since 6724 was 4892, checked in by tbretz, 20 years ago
*** empty log message ***
File size: 1.4 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 if (nPoints<fMinNumberLeds)
19 return;
20
21 int n=0;
22 for (int i=0; i<nPoints-2; i++)
23 for (int j=i+1; j<nPoints-1; j++)
24 for (int k=j+1; k<nPoints; k++)
25 {
26 Ring &ring = *new ((*this)[n]) Ring;
27
28 if (!ring.CalcCenter(leds, i, j, k))
29 {
30 RemoveAt(n);
31 continue;
32 }
33
34 //
35 //filter and remove rings with too big or too small radius
36 //
37 if ((min>=0&&ring.GetR()<min) || (max>=0&&ring.GetR()>max))
38 {
39 RemoveAt(n);
40 continue;
41 }
42
43 n++;
44 }
45
46 // Expand(n);
47}
48
49void Rings::CalcRings(Leds &leds, Float_t min, Float_t max)
50{
51 CalcCenters(leds, min, max);
52
53 fCenter.InterpolCenters(*this);
54
55 int n = leds.GetEntries();
56 for (int j=0; j<n; j++)
57 leds(j).CalcPhi(fCenter);
58}
59
60void Rings::Print(Option_t *o) const
61{
62 cout << "Number of Rings: " << GetEntries() << endl;
63 if (GetEntriesFast()>0)
64 {
65 TClonesArray::Print();
66 cout << "Center: " << endl;
67 fCenter.Print();
68 }
69}
Note: See TracBrowser for help on using the repository browser.