10 #include "AliITSglobalRecPoint.h"
11 #include "AliITSneuralTracker.h"
13 #include "AliITSneuralTrack.h"
17 ClassImp(AliITSneuralTrack)
21 AliITSneuralTrack::AliITSneuralTrack()
24 for (i = 0; i < 6; i++) fPoint[i] = 0;
29 AliITSneuralTrack::~AliITSneuralTrack()
32 for (i = 0; i < 6; i++) delete fPoint[i];
37 Int_t AliITSneuralTrack::CheckMe(Bool_t verbose)
40 TString empty("Not filled slots: ");
41 for (l = 0; l < 6; l++) {
50 if (stored < 6 && verbose) Warning("", empty);
56 Int_t AliITSneuralTrack::EvaluateTrack(Bool_t verbose, Int_t min, Int_t* &good)
58 Int_t i, j, k = 0, count[18], id[18];
59 for (i = 0; i < 6; i++) {
60 for (j = 0; j < 3; j++) {
62 id[k] = fPoint[i]->fLabel[j];
69 for (i = 0; i < 18; i++) {
70 for (j = i+1; j < 18; j++) {
71 if (id[i] == id[j] || id[j] < 0) id[j] = -1;
74 for (i = 0; i < 18; i++) {
75 if (id[i] < 0) continue;
76 for (j = 0; j < 6; j++) {
77 if (fPoint[j] && fPoint[j]->HasID(id[i])) count[i]++;
80 Int_t index[18], best;
81 TMath::Sort(18, count, index);
84 if (count[index[0]]<min) cout << "\t";
85 cout << best << " " << count[index[0]] << endl;
88 if (good) delete [] good;
90 for (i = 0; i < 6; i++) {
94 else if (fPoint[i] && fPoint[i]->HasID(best))
96 else if (fPoint[i]->fLabel[0] < 0 && fPoint[i]->fLabel[1] < 0 && fPoint[i]->fLabel[2] < 0)
100 if (count[index[0]] < min) best = -best;
107 if (good) delete [] good;
109 Int_t count = CheckMe(verbose);
111 if (count < min) return -9999999;
113 Int_t i, l, max = 0, best = 0;
114 for (l = 0; l < 6; l++) {
115 for (i = 0; i < 3; i++) {
116 if (fPoint[l].fLabel[i] > max) max = fPoint[l].fLabel[i];
121 Int_t *counter = new Int_t[count];
122 for (i = 0; i < count; i++) counter[i] = 0;
124 for (l = 0; l < 6; l++) {
125 for (i = 0; i < 3; i++) {
126 if (fPoint[l].fLabel[i] >= 0)
127 counter[fPoint[l].fLabel[i]]++;
131 for (i = 0; i < count; i++) {
132 if (counter[i] > counter[best]) best = i;
135 for (l = 0; l < 6; l++) {
137 if (fPoint[l].fLabel[0] == best || fPoint[l].fLabel[1] == best || fPoint[l].fLabel[2] == best)
139 else if (fPoint[l].fLabel[0] < 0 && fPoint[l].fLabel[1] < 0 && fPoint[l].fLabel[2] < 0)
143 if (counter[best] < min) best = -best;
151 void AliITSneuralTrack::GetCoords(Double_t* &x, Double_t* &y, Double_t* &z)
153 if (x) delete [] x; x = new Double_t[6];
154 if (y) delete [] y; y = new Double_t[6];
155 if (z) delete [] z; z = new Double_t[6];
159 for (i = 0; i < 6; i++) {
160 x[i] = y[i] = z[i] = 0.0;
161 if (!fPoint[i]) continue;
162 x[i] = fPoint[i]->fGX;
163 y[i] = fPoint[i]->fGY;
164 z[i] = fPoint[i]->fGZ;
170 void AliITSneuralTrack::CopyPoint(AliITSglobalRecPoint *p)
172 Int_t layer = p->fLayer;
173 if (layer < 0 || layer > 6) {
174 Error("", Form("Wrong layer [%d]", layer));
178 fPoint[layer] = new AliITSglobalRecPoint;
179 fPoint[layer]->fGX = p->fGX;
180 fPoint[layer]->fGY = p->fGY;
181 fPoint[layer]->fGZ = p->fGZ;
182 fPoint[layer]->fGSX = p->fGSX;
183 fPoint[layer]->fGSY = p->fGSY;
184 fPoint[layer]->fGSZ = p->fGSZ;
185 fPoint[layer]->fLayer = layer;
186 fPoint[layer]->fLabel[0] = p->fLabel[0];
187 fPoint[layer]->fLabel[1] = p->fLabel[1];
188 fPoint[layer]->fLabel[2] = p->fLabel[2];
193 void AliITSneuralTrack::Print(Option_t *option, Int_t min)
198 Int_t id = EvaluateTrack(0, min, vuoto);
199 if (opt.Contains("A")) {
200 cout << "\nEvaluated ID for this track: ";
211 cout << endl << endl;
216 void AliITSneuralTrack::Kinks(Int_t &pos, Int_t &neg, Int_t &incr, Int_t &decr)
219 Double_t dphi, dphi_old = 0.0;
220 pos = neg = incr = decr = 0;
221 for (i = 1; i < 6; i++) {
222 dphi = fPoint[i]->fPhi - fPoint[i-1]->fPhi;
223 if (dphi > 0.0) pos++; else neg++;
224 if (TMath::Abs(dphi) > dphi_old) incr++; else decr++;
225 dphi_old = TMath::Abs(dphi);
231 Double_t AliITSneuralTrack::FitXY(Double_t VX, Double_t VY)
235 Double_t rx(0.0), ry(0.0), x2(0.0), y2(0.0), xy(0.0);
236 for (i = 0; i < 6; i++) {
237 X = fPoint[i]->fGX - VX;
238 Y = fPoint[i]->fGY - VY;
247 D = 2 * (x2 * y2 - xy * xy);
251 X = (rx * y2 - ry * xy) / D;
252 Y = (ry * x2 - rx * xy) / D;
253 fFitRadius = TMath::Sqrt(X * X + Y * Y);
259 for (i = 0; i < 6; i++) {
260 X = fPoint[i]->fGX - fFitXC;
261 Y = fPoint[i]->fGY - fFitYC;
262 fSqChi += ((X * X + Y * Y) / (fFitRadius * fFitRadius)) * ((X * X + Y * Y) / (fFitRadius * fFitRadius));
265 fSqChi = TMath::Sqrt(fSqChi);