Several pointers were set to zero in the default constructors to avoid memory managem...
[u/mrichter/AliRoot.git] / ITS / AliITSTrackerV1.cxx
CommitLineData
b48af428 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16/*
17$Log$
18*/
19// The purpose of this class is to permorm the ITS tracking. The
20// constructor has the task to inizialize some private members. The method
21// DoTracking is written to be called by a macro. It gets the event number,
22// the minimum and maximum order number of TPC tracks that are to be tracked
23// trough the ITS, and the file where the recpoints are registered. The
24// method Recursivetracking is a recursive function that performs the
25// tracking trough the ITS The method Intersection found the layer, ladder
26// and detector whre the intersection take place and caluclate the
27// cohordinates of this intersection. It returns an integer that is 0 if the
28// intersection has been found successfully. The two mwthods Kalmanfilter
29// and kalmanfiltervert operate the kalmanfilter without and with the vertex
30// imposition respectively. The authors thank Mariana Bondila to have help
31// them to resolve some problems. July-2000
04b80329 32
33#include <fstream.h>
13888096 34#include <TMath.h>
13888096 35#include <TBranch.h>
36#include <TVector.h>
13888096 37#include <TFile.h>
38#include <TTree.h>
cbcfa38d 39#include <TStopwatch.h>
40
13888096 41#include "TParticle.h"
42#include "AliRun.h"
43#include "AliITS.h"
04b80329 44#include "AliITSsegmentationSSD.h"
13888096 45#include "AliITSgeomSPD.h"
46#include "AliITSgeomSDD.h"
47#include "AliITSgeomSSD.h"
48#include "AliITSgeom.h"
13888096 49#include "AliITSRecPoint.h"
04b80329 50#include "stdlib.h"
13888096 51#include "AliKalmanTrack.h"
52#include "AliMagF.h"
04b80329 53#include "AliITSTrackV1.h"
54#include "AliITSIOTrack.h"
55#include "AliITSRad.h"
13888096 56#include "../TPC/AliTPCtracker.h"
13888096 57#include "AliITSTrackerV1.h"
0983ac5b 58#include "AliITSVertex.h"
13888096 59
13888096 60ClassImp(AliITSTrackerV1)
b48af428 61//______________________________________________________________________
04b80329 62AliITSTrackerV1::AliITSTrackerV1(AliITS* IITTSS, Bool_t flag) {
b48af428 63 //Origin A. Badala' and G.S. Pappalardo:
64 // e-mail Angela.Badala@ct.infn.it, Giuseppe.S.Pappalardo@ct.infn.it
65 // Class constructor. It does some initializations.
66
67 fITS = IITTSS;
68 fPtref = 0.;
69 fChi2max =0.;
70 fflagvert =flag;
71 Int_t imax = 200,jmax = 450;
72 frl = new AliITSRad(imax,jmax);
73
74 ////////// gets information on geometry /////////////////////////////
75 AliITSgeom *g1 = ((AliITS*)gAlice->GetDetector("ITS"))->GetITSgeom();
76 // Why not AliITS *g1 = fITS->GetITSgeom(); // ?? BSN
77 Int_t ll=1, dd=1;
78 TVector det(9);
79
80 //cout<<" nlad ed ndet \n";
81 Int_t ia;
82 for(ia=0; ia<6; ia++) {
83 fNlad[ia]=g1->GetNladders(ia+1);
84 fNdet[ia]=g1->GetNdetectors(ia+1);
85 //cout<<fNlad[i]<<" "<<fNdet[i]<<"\n";
86 } // end for ia
87 //getchar();
88
89 //cout<<" raggio medio = ";
90 Int_t ib;
91 for(ib=0; ib<6; ib++) {
92 g1->GetCenterThetaPhi(ib+1,ll,dd,det);
93 Double_t r1=TMath::Sqrt(det(0)*det(0)+det(1)*det(1));
94 g1->GetCenterThetaPhi(ib+1,ll,dd+1,det);
95 Double_t r2=TMath::Sqrt(det(0)*det(0)+det(1)*det(1));
96 fAvrad[ib]=(r1+r2)/2.;
97 //cout<<fAvrad[ib]<<" ";
98 } // end for ib
99 //cout<<"\n"; getchar();
100
101 fDetx[0] = ((AliITSgeomSPD*)(g1->GetShape(1, ll, dd)))->GetDx();
102 fDetz[0] = ((AliITSgeomSPD*)(g1->GetShape(1, ll, dd)))->GetDz();
103
104 fDetx[1] = ((AliITSgeomSPD*)(g1->GetShape(2, ll, dd)))->GetDx();
105 fDetz[1] = ((AliITSgeomSPD*)(g1->GetShape(2, ll, dd)))->GetDz();
106
107 fDetx[2] = ((AliITSgeomSDD*)(g1->GetShape(3, ll, dd)))->GetDx();
108 fDetz[2] = ((AliITSgeomSDD*)(g1->GetShape(3, ll, dd)))->GetDz();
109
110 fDetx[3] = ((AliITSgeomSDD*)(g1->GetShape(4, ll, dd)))->GetDx();
111 fDetz[3] = ((AliITSgeomSDD*)(g1->GetShape(4, ll, dd)))->GetDz();
112
113 fDetx[4] = ((AliITSgeomSSD*)(g1->GetShape(5, ll, dd)))->GetDx();
114 fDetz[4] = ((AliITSgeomSSD*)(g1->GetShape(5, ll, dd)))->GetDz();
115
116 fDetx[5] = ((AliITSgeomSSD*)(g1->GetShape(6, ll, dd)))->GetDx();
117 fDetz[5] = ((AliITSgeomSSD*)(g1->GetShape(6, ll, dd)))->GetDz();
118 //cout<<" Detx Detz\n";
119 //for(Int_t la=0; la<6; la++) cout<<" "<<fDetx[la]<<" "<<
120 // fDetz[la]<<endl;
121 //getchar();
122 // allocate memory and define matrices fzmin, fzmax, fphimin and fphimax //
123 Double_t epsz=1.2;
124 Double_t epszdrift=0.05;
125
126 fzmin = new Double_t*[6]; fzmax = new Double_t*[6];
127 Int_t im1, im2, im2max;
128 for(im1=0; im1<6; im1++) {
129 im2max=fNdet[im1];
130 fzmin[im1] = new Double_t[im2max]; fzmax[im1] = new Double_t[im2max];
131 } // end for im1
132
133 for(im1=0; im1<6; im1++) {
134 im2max=fNdet[im1];
135 for(im2=0; im2<im2max; im2++) {
136 g1->GetCenterThetaPhi(im1+1,1,im2+1,det);
137 if(im2!=0) fzmin[im1][im2]=det(2)-fDetz[im1];
138 else
139 fzmin[im1][im2]=det(2)-(fDetz[im1])*epsz;
140 if(im2!=(im2max-1)) fzmax[im1][im2]=det(2)+fDetz[im1];
141 else
cbcfa38d 142 fzmax[im1][im2]=det(2)+fDetz[im1]*epsz;
b48af428 143 if(im1==2 || im1==3) {
144 fzmin[im1][im2]-=epszdrift;
145 fzmax[im1][im2]+=epszdrift;
146 } // end if im1==2 || im1==3
147 } // end for im2
148 } // end for im1
13888096 149
b48af428 150 fphimin = new Double_t*[6]; fphimax = new Double_t*[6];
151 for(im1=0;im1<6;im1++) {
152 im2max=fNlad[im1];
153 fphimin[im1] = new Double_t[im2max];
154 fphimax[im1] = new Double_t[im2max];
155 } // end for im1
156
157 fphidet = new Double_t*[6];
158 for(im1=0; im1<6; im1++) {
159 im2max=fNlad[im1];
160 fphidet[im1] = new Double_t[im2max];
161 } // end for im1
162
163 Float_t global[3],local[3];
164 Double_t pigre=TMath::Pi();
165 Double_t xmin,ymin,xmax,ymax;
166
167 for(im1=0; im1<6; im1++) {
168 im2max=fNlad[im1];
169 for(im2=0; im2<im2max; im2++) {
170 Int_t idet=2;
171 g1->GetCenterThetaPhi(im1+1,im2+1,idet,det);
172 fphidet[im1][im2] = TMath::ATan2(Double_t(det(1)),
173 Double_t(det(0)));
174 if(fphidet[im1][im2]<0.) fphidet[im1][im2]+=2.*pigre;
175 local[1]=local[2]=0.;
176 local[0]= -(fDetx[im1]);
177 if(im1==0) local[0]= (fDetx[im1]); //to take into account
178 // different reference system
179 g1->LtoG(im1+1,im2+1,idet,local,global);
180 xmax=global[0]; ymax=global[1];
181 local[0]= (fDetx[im1]);
182 if(im1==0) local[0]= -(fDetx[im1]);//take into account different
183 // reference system
184 g1->LtoG(im1+1,im2+1,idet,local,global);
185 xmin=global[0]; ymin=global[1];
186 fphimin[im1][im2]= TMath::ATan2(ymin,xmin);
187 if(fphimin[im1][im2]<0.) fphimin[im1][im2]+=2.*pigre;
188 fphimax[im1][im2]= TMath::ATan2(ymax,xmax);
189 if(fphimax[im1][im2]<0.) fphimax[im1][im2]+=2.*pigre;
190 } // end for im2
191 } // end for im1
192
193 ////////// gets magnetic field factor //////////////////////////////
194
195 AliMagF * fieldPointer = gAlice->Field();
196 fFieldFactor = (Double_t)fieldPointer->Factor();
197 //cout<< " field factor = "<<fFieldFactor<<"\n"; getchar();
198}
199//______________________________________________________________________
04b80329 200AliITSTrackerV1::AliITSTrackerV1(const AliITSTrackerV1 &cobj) {
b48af428 201 // Origin A. Badala' and G.S. Pappalardo:
202 // e-mail Angela.Badala@ct.infn.it, Giuseppe.S.Pappalardo@ct.infn.it
203 // copy constructor
204
205 *fITS = *cobj.fITS;
206 *fresult = *cobj.fresult;
207 fPtref = cobj.fPtref;
208 fChi2max = cobj.fChi2max;
209 **fvettid = **cobj.fvettid;
210 fflagvert = cobj.fflagvert;
211 Int_t imax=200,jmax=450;
212 frl = new AliITSRad(imax,jmax);
213 *frl = *cobj.frl;
214 fFieldFactor = cobj.fFieldFactor;
215 Int_t i,im1,im2,im2max;
216 for(i=0; i<6; i++) {
217 fNlad[i] = cobj.fNlad[i];
218 fNdet[i] = cobj.fNdet[i];
219 fAvrad[i] = cobj.fAvrad[i];
220 fDetx[i] = cobj.fDetx[i];
221 fDetz[i] = cobj.fDetz[i];
222 } // end or i
223 fzmin = new Double_t*[6]; fzmax = new Double_t*[6];
224 for(im1=0; im1<6; im1++) {
225 im2max=fNdet[im1];
226 fzmin[im1] = new Double_t[im2max];
227 fzmax[im1] = new Double_t[im2max];
228 } // end for im1
cbcfa38d 229 fphimin = new Double_t*[6]; fphimax = new Double_t*[6];
b48af428 230 for(im1=0;im1<6;im1++) {
231 im2max=fNlad[im1];
232 fphimin[im1] = new Double_t[im2max];
233 fphimax[im1] = new Double_t[im2max];
234 } // end for im1
235
236 fphidet = new Double_t*[6];
237 for(im1=0; im1<6; im1++) {
238 im2max=fNlad[im1];
239 fphidet[im1] = new Double_t[im2max];
240 } // end for im1
241 for(im1=0; im1<6; im1++) {
242 im2max=fNdet[im1];
243 for(im2=0; im2<im2max; im2++) {
244 fzmin[im1][im2]=cobj.fzmin[im1][im2];
245 fzmax[im1][im2]=cobj.fzmax[im1][im2];
246 } // end for im2
247 } // end for im1
248 for(im1=0; im1<6; im1++) {
249 im2max=fNlad[im1];
250 for(im2=0; im2<im2max; im2++) {
251 fphimin[im1][im2]=cobj.fphimin[im1][im2];
252 fphimax[im1][im2]=cobj.fphimax[im1][im2];
253 fphidet[im1][im2]=cobj.fphidet[im1][im2];
254 } // end for im2
255 } // end for im2
cbcfa38d 256}
b48af428 257//______________________________________________________________________
cbcfa38d 258AliITSTrackerV1::~AliITSTrackerV1(){
b48af428 259 // Origin A. Badala' and G.S. Pappalardo:
260 // e-mail Angela.Badala@ct.infn.it, Giuseppe.S.Pappalardo@ct.infn.it
261 // class destructor
13888096 262
b48af428 263 //delete fTimerKalman;
264 //delete fTimerIntersection;
13888096 265}
b48af428 266//______________________________________________________________________
04b80329 267AliITSTrackerV1 &AliITSTrackerV1::operator=(AliITSTrackerV1 obj) {
b48af428 268 // Origin A. Badala' and G.S. Pappalardo:
269 // e-mail Angela.Badala@ct.infn.it, Giuseppe.S.Pappalardo@ct.infn.it
270 // assignement operator
271
272 *fITS = *obj.fITS;
273 *fresult = *obj.fresult;
274 fPtref = obj.fPtref;
275 fChi2max = obj.fChi2max;
276 **fvettid = **obj.fvettid;
277 fflagvert = obj.fflagvert;
278 Int_t imax=200,jmax=450;
279 frl = new AliITSRad(imax,jmax);
280 *frl = *obj.frl;
281 fFieldFactor = obj.fFieldFactor;
282 Int_t i;
283 for(i=0; i<6; i++) {
284 fNlad[i] = obj.fNlad[i];
285 fNdet[i] = obj.fNdet[i];
286 fAvrad[i] = obj.fAvrad[i];
287 fDetx[i] = obj.fDetx[i];
288 fDetz[i] = obj.fDetz[i];
289 } // end for i
290 fzmin = new Double_t*[6];
291 fzmax = new Double_t*[6];
292 Int_t im1, im2, im2max;
293 for(im1=0; im1<6; im1++) {
294 im2max=fNdet[im1];
295 fzmin[im1] = new Double_t[im2max]; fzmax[im1] = new Double_t[im2max];
296 } // end for im1
cbcfa38d 297 fphimin = new Double_t*[6]; fphimax = new Double_t*[6];
b48af428 298 for(im1=0;im1<6;im1++) {
299 im2max=fNlad[im1];
300 fphimin[im1] = new Double_t[im2max];
301 fphimax[im1] = new Double_t[im2max];
302 } // end for im1
303
304 fphidet = new Double_t*[6];
305 for(im1=0; im1<6; im1++) {
306 im2max=fNlad[im1];
307 fphidet[im1] = new Double_t[im2max];
308 } // end for im1
309 for(im1=0; im1<6; im1++) {
310 im2max=fNdet[im1];
311 for(im2=0; im2<im2max; im2++) {
312 fzmin[im1][im2]=obj.fzmin[im1][im2];
313 fzmax[im1][im2]=obj.fzmax[im1][im2];
314 } // end for im2
315 } // end for im1
316 for(im1=0; im1<6; im1++) {
317 im2max=fNlad[im1];
318 for(im2=0; im2<im2max; im2++) {
319 fphimin[im1][im2]=obj.fphimin[im1][im2];
320 fphimax[im1][im2]=obj.fphimax[im1][im2];
321 fphidet[im1][im2]=obj.fphidet[im1][im2];
322 } // end for im2
323 } // end for im1
324
325 return *this;
04b80329 326}
b48af428 327//______________________________________________________________________
328void AliITSTrackerV1::DoTracking(Int_t evNumber,Int_t minTr,Int_t maxTr,
329 TFile *file) {
330 // Origin A. Badala' and G.S. Pappalardo:
331 // e-mail Angela.Badala@ct.infn.it, Giuseppe.S.Pappalardo@ct.infn.it
332 // The method needs the event number, the minimum and maximum order
333 // number of TPC tracks that
334 // are to be tracked trough the ITS, and the file where the recpoints
335 // are registered.
336 // The method can be called by a macro. It preforms the tracking for
337 // all good TPC tracks
338
339 printf("begin DoTracking - file %p\n",file);
340
341 gAlice->GetEvent(evNumber); //modificato per gestire hbt
13888096 342
b48af428 343 AliKalmanTrack *kkprov;
344 kkprov->SetConvConst(100/0.299792458/0.2/fFieldFactor);
345
346 TFile *cf=TFile::Open("AliTPCclusters.root");
347 AliTPCParam *digp= (AliTPCParam*)cf->Get("75x40_100x60");
348 if (!digp) { cerr<<"TPC parameters have not been found !\n"; getchar();}
349
350 cf->cd();
351 AliTPCtracker *tracker = new AliTPCtracker(digp,evNumber);
352
353 // Load clusters
354 tracker->LoadInnerSectors();
355 tracker->LoadOuterSectors();
356
357 // Load tracks
358 TFile *tf=TFile::Open("AliTPCtracksSorted.root"); //modificato per hbt
359 if (!tf->IsOpen()) {
360 cerr<<"Can't open AliTPCtracksSorted.root !\n";
361 return ;
362 } // end if
363 TObjArray tracks(200000);
364 char tname[100];
365 sprintf(tname,"TreeT_TPC_%d",evNumber);
366
367 TTree *tracktree=(TTree*)tf->Get(tname);
368 if (!tracktree) {cerr<<"Can't get a tree with TPC tracks !\n";}
369 TBranch *tbranch=tracktree->GetBranch("tracks");
370 Int_t nentr=(Int_t)tracktree->GetEntries();
371 Int_t kk;
372
373 AliTPCtrack *ioTrackTPC=0;
374 for (kk=0; kk<nentr; kk++) {
375 ioTrackTPC=new AliTPCtrack;
376 tbranch->SetAddress(&ioTrackTPC);
377 tracktree->GetEvent(kk);
378 tracker->CookLabel(ioTrackTPC,0.1);
379 tracks.AddLast(ioTrackTPC);
380 } // end for kk
381 delete tracker;
382 tf->Close();
383
384 Int_t nt = tracks.GetEntriesFast();
385 cerr<<"Number of found tracks "<<nt<<endl;
386
387 TVector vec(5);
388 TTree *tr=gAlice->TreeR();
389 Int_t nent=(Int_t)tr->GetEntries();
390 frecPoints = fITS->RecPoints();
391
392 Int_t numbpoints;
393 Int_t totalpoints=0;
394 Int_t *np = new Int_t[nent];
395 fvettid = new Int_t* [nent];
396 Int_t mod;
397
398 for (mod=0; mod<nent; mod++) {
399 fvettid[mod]=0;
400 fITS->ResetRecPoints();
401 gAlice->TreeR()->GetEvent(mod);
402 numbpoints = frecPoints->GetEntries();
403 totalpoints+=numbpoints;
404 np[mod] = numbpoints;
405 //cout<<" mod = "<<mod<<" numbpoints = "<<numbpoints<<"\n";getchar();
406 fvettid[mod] = new Int_t[numbpoints];
407 Int_t ii;
408 for (ii=0;ii<numbpoints; ii++) *(fvettid[mod]+ii)=0;
409 } // end for mod
410
411 AliTPCtrack *track=0;
412
413 if(minTr < 0) {minTr = 0; maxTr = nt-1;}
414
415 TVector vgeant(3);
416
417 TTree tracktree1("TreeT","Tree with ITS tracks");
418 AliITSIOTrack *ioTrack=0;
419 tracktree1.Branch("ITStracks","AliITSIOTrack",&ioTrack,32000,0);
420
421 Int_t j;
422 for (j=minTr; j<=maxTr; j++) {
423 track=(AliTPCtrack*)tracks.UncheckedAt(j);
424 if (!track) continue;
425
426 ////// propagation to the end of TPC //////////////
427 Double_t xk=77.415;
428 track->PropagateTo(xk, 28.94, 1.204e-3); //Ne
429 xk -=0.01;
430 track->PropagateTo(xk, 44.77, 1.71); //Tedlar
431 xk -=0.04;
432 track->PropagateTo(xk, 44.86, 1.45); //kevlar
433 xk -=2.0;
434 track->PropagateTo(xk, 41.28, 0.029); //Nomex
435 xk-=16;
436 track->PropagateTo(xk,36.2,1.98e-3); //C02
437 xk -=0.01;
438 track->PropagateTo(xk, 24.01, 2.7); //Al
439 xk -=0.01;
440 track->PropagateTo(xk, 44.77, 1.71); //Tedlar
441 xk -=0.04;
442 track->PropagateTo(xk, 44.86, 1.45); //kevlar
443 xk -=0.5;
444 track->PropagateTo(xk, 41.28, 0.029); //Nomex
445 ////////////////////////////////////////////////////////////////////
446
447 AliITSTrackV1 trackITS(*track);
448 if(fresult){ delete fresult; fresult=0;}
449 fresult = new AliITSTrackV1(trackITS);
450
451 AliITSTrackV1 primaryTrack(trackITS);
452 vgeant=(*fresult).GetVertex();
453
454 // Definition of dv and zv for vertex constraint
455 Double_t sigmaDv=0.0050; Double_t sigmaZv=0.010;
456 //Double_t sigmaDv=0.0015; Double_t sigmaZv=0.0015;
13888096 457 Double_t uniform= gRandom->Uniform();
458 Double_t signdv;
459 if(uniform<=0.5) signdv=-1.;
b48af428 460 else
461 signdv=1.;
462
04b80329 463 Double_t vr=TMath::Sqrt(vgeant(0)*vgeant(0)+ vgeant(1)*vgeant(1));
b48af428 464 Double_t dv=gRandom->Gaus(signdv*vr,(Float_t)sigmaDv);
465 Double_t zv=gRandom->Gaus(vgeant(2),(Float_t)sigmaZv);
466 //cout<<" Dv e Zv = "<<dv<<" "<<zv<<"\n";
467 trackITS.SetDv(dv);
468 trackITS.SetZv(zv);
469 trackITS.SetsigmaDv(sigmaDv);
470 trackITS.SetsigmaZv(sigmaZv);
471 (*fresult).SetDv(dv);
472 (*fresult).SetZv(zv);
473 (*fresult).SetsigmaDv(sigmaDv);
474 (*fresult).SetsigmaZv(sigmaZv);
475 primaryTrack.SetDv(dv);
476 primaryTrack.SetZv(zv);
477 primaryTrack.SetsigmaDv(sigmaDv);
478 primaryTrack.SetsigmaZv(sigmaZv);
479 primaryTrack.PrimaryTrack(frl);
480 TVector d2=primaryTrack.Getd2();
481 TVector tgl2=primaryTrack.Gettgl2();
482 TVector dtgl=primaryTrack.Getdtgl();
483 trackITS.Setd2(d2); trackITS.Settgl2(tgl2);
484 trackITS.Setdtgl(dtgl);
485 (*fresult).Setd2(d2); (*fresult).Settgl2(tgl2);
486 (*fresult).Setdtgl(dtgl);
487 /*
488 trackITS.SetVertex(vertex); trackITS.SetErrorVertex(ervertex);
489 (*result).SetVertex(vertex); (*result).SetErrorVertex(ervertex);
490 */
491 TList *list= new TList();
492
493 list->AddLast(&trackITS);
494
495 fPtref=TMath::Abs( (trackITS).GetPt() );
496 if(fPtref>1.0) fChi2max=40.;
497 if(fPtref<=1.0) fChi2max=20.;
498 if(fPtref<0.4 ) fChi2max=100.;
499 if(fPtref<0.2 ) fChi2max=40.;
500 // if(fPtref<0.4 ) fChi2max=30.;
501 // if(fPtref<0.2 ) fChi2max=20.;
502 //if(fPtref<0.2 ) fChi2max=10.;
503 //if(fPtref<0.1 ) fChi2max=5.;
504 cout << "\n Pt = " << fPtref <<"\n"; //stampa
505 RecursiveTracking(list);
506 list->Delete();
507 delete list;
508
509 Int_t itot=-1;
510 TVector vecTotLabRef(18);
511 Int_t lay, k;
512 for(lay=5; lay>=0; lay--) {
513 TVector vecLabRef(3);
514 vecLabRef=(*fresult).GetLabTrack(lay);
515 Float_t clustZ=(*fresult).GetZclusterTrack( lay);
516 for(k=0; k<3; k++){
04b80329 517 Int_t lpp=(Int_t)vecLabRef(k);
518 if(lpp>=0) {
b48af428 519 TParticle *p=(TParticle*) gAlice->Particle(lpp);
520 Int_t pcode=p->GetPdgCode();
521 if(pcode==11) vecLabRef(k)=p->GetFirstMother();
522 } // end if
523 itot++; vecTotLabRef(itot)=vecLabRef(k);
524 if(vecLabRef(k)==0. && clustZ == 0.) vecTotLabRef(itot) =-3.;
525 } // end for k
526 } // end for lay
527 Long_t labref;
528 Int_t freq;
529 (*fresult).Search(vecTotLabRef, labref, freq);
530
531 //if(freq < 6) labref=-labref; // cinque - sei
532 if(freq < 5) labref=-labref; // cinque - sei
533 (*fresult).SetLabel(labref);
534
535 // cout<<" progressive track number = "<<j<<"\r";
536 // cout<<j<<"\r";
537 Int_t numOfCluster=(*fresult).GetNumClust();
538 cout<<" progressive track number = "<<j<<"\n"; // stampa
539 Long_t labITS=(*fresult).GetLabel();
540 cout << " ITS track label = " << labITS << "\n"; // stampa
541 Int_t lab=track->GetLabel();
542 cout << " TPC track label = " << lab <<"\n"; // stampa
543 //propagation to vertex
544
545 Double_t rbeam=3.;
546 (*fresult).Propagation(rbeam);
547 Double_t c00,c10,c11,c20,c21,c22,c30,c31,c32,c33,c40,c41,c42,c43,c44;
548 (*fresult).GetCElements(c00,
549 c10,c11,
550 c20,c21,c22,
551 c30,c31,c32,c33,
552 c40,c41,c42,c43,c44);
13888096 553
b48af428 554 Double_t pt=TMath::Abs((*fresult).GetPt());
555 Double_t dr=(*fresult).GetD();
556 Double_t z=(*fresult).GetZ();
557 Double_t tgl=(*fresult).GetTgl();
558 Double_t c=(*fresult).GetC();
559 Double_t cy=c/2.;
560 Double_t dz=z-(tgl/cy)*TMath::ASin((*fresult).Arga(rbeam));
561 dz-=vgeant(2);
562 // cout<<" dr e dz alla fine = "<<dr<<" "<<dz<<"\n"; getchar();
563 Double_t phi=(*fresult).Getphi();
564 Double_t phivertex = phi - TMath::ASin((*fresult).ArgA(rbeam));
565 Double_t duepi=2.*TMath::Pi();
566 if(phivertex>duepi) phivertex-=duepi;
567 if(phivertex<0.) phivertex+=duepi;
568 /////////////////////////////////////////////////////////////
569 Int_t idmodule,idpoint;
570 if(numOfCluster >=5) { // cinque - sei
571 //if(numOfCluster ==6) { // cinque - sei
572 AliITSIOTrack outTrack;
573 ioTrack=&outTrack;
574 ioTrack->SetStatePhi(phi);
575 ioTrack->SetStateZ(z);
576 ioTrack->SetStateD(dr);
577 ioTrack->SetStateTgl(tgl);
578 ioTrack->SetStateC(c);
579 Double_t radius=(*fresult).Getrtrack();
580 ioTrack->SetRadius(radius);
581 Int_t charge;
582 if(c>0.) charge=-1; else charge=1;
583 ioTrack->SetCharge(charge);
584 ioTrack->SetCovMatrix(c00,
585 c10,c11,
586 c20,c21,c22,
587 c30,c31,c32,c33,
588 c40,c41,c42,c43,c44);
589 Double_t px=pt*TMath::Cos(phivertex);
590 Double_t py=pt*TMath::Sin(phivertex);
591 Double_t pz=pt*tgl;
592 Double_t xtrack=dr*TMath::Sin(phivertex);
593 Double_t ytrack=dr*TMath::Cos(phivertex);
594 Double_t ztrack=dz+vgeant(2);
595 ioTrack->SetPx(px);
596 ioTrack->SetPy(py);
597 ioTrack->SetPz(pz);
598 ioTrack->SetX(xtrack);
599 ioTrack->SetY(ytrack);
600 ioTrack->SetZ(ztrack);
601 ioTrack->SetLabel(labITS);
602 ioTrack->SetTPCLabel(lab);
603 Int_t il;
604 for(il=0;il<6; il++){
605 ioTrack->SetIdPoint(il,(*fresult).GetIdPoint(il));
606 ioTrack->SetIdModule(il,(*fresult).GetIdModule(il));
607 } // end for il
608 tracktree1.Fill();
609 for (il=0;il<6;il++) {
610 idpoint=(*fresult).GetIdPoint(il);
611 idmodule=(*fresult).GetIdModule(il);
612 //*(fvettid[idmodule]+idpoint)=1;
613 if(idmodule>0.) *(fvettid[idmodule]+idpoint)=1;//modificata
614 // angela
615 ioTrack->SetIdPoint(il,idpoint);
616 ioTrack->SetIdModule(il,idmodule);
617 } // end for il
618 } // end if on numOfCluster
619 //gObjectTable->Print(); // stampa memoria
620 } // end for (int j=minTr; j<=maxTr; j++)
621 static Bool_t first=kTRUE;
622 static TFile *tfile;
623 if(first) {
624 tfile=new TFile("itstracks.root","RECREATE");
625 //cout<<"I have opened itstracks.root file "<<endl;
626 } // end if
627 first=kFALSE;
628 tfile->cd();
629 tfile->ls();
630 char hname[30];
631 sprintf(hname,"TreeT%d",evNumber);
632 tracktree1.Write(hname);
633
634 TTree *fAli=gAlice->TreeK();
635 TFile *fileAli=0;
636 if (fAli) fileAli =fAli->GetCurrentFile();
637 fileAli->cd();
638 ////////////////////////////////////////////////////////////////////
639
640 printf("delete vectors\n");
641 if(np) delete [] np;
642 if(fvettid) delete [] fvettid;
643 if(fresult) {delete fresult; fresult=0;}
04b80329 644}
b48af428 645//______________________________________________________________________
04b80329 646void AliITSTrackerV1::RecursiveTracking(TList *trackITSlist) {
b48af428 647 // This function perform the recursive tracking in ITS detectors
648 // reference is a pointer to the final best track
649 // Origin A. Badala' and G.S. Pappalardo:
650 // e-mail Angela.Badala@ct.infn.it, Giuseppe.S.Pappalardo@ct.infn.it
651 // The authors thank Mariana Bondila to have help them to resolve some
652 // problems. July-2000
653
654 //Rlayer[0]=4.; Rlayer[1]=7.; Rlayer[2]=14.9;
655 // Rlayer[3]=23.8; Rlayer[4]=39.1; Rlayer[5]=43.6; //vecchio
656
657 //////////////////////
658 Float_t sigmaphil[6], sigmazl[6];
659 sigmaphil[0]=1.44e-6/(fAvrad[0]*fAvrad[0]);
660 sigmaphil[1]=1.44e-6/(fAvrad[1]*fAvrad[1]);
661 sigmaphil[2]=1.444e-5/(fAvrad[2]*fAvrad[2]);
662 sigmaphil[3]=1.444e-5/(fAvrad[3]*fAvrad[3]);
663 sigmaphil[4]=4e-6/(fAvrad[4]*fAvrad[4]);
664 sigmaphil[5]=4e-6/(fAvrad[5]*fAvrad[5]);
665 sigmazl[0]=1e-2;
666 sigmazl[1]=1e-2;
667 sigmazl[2]=7.84e-4;
668 sigmazl[3]=7.84e-4;
669 sigmazl[4]=0.6889;
670 sigmazl[5]=0.6889;
671 ///////////////////////////////////////////////////////////
672 Int_t index;
673 AliITSgeom *g1 = fITS->GetITSgeom();
674 AliITSRecPoint *recp;
675 for(index =0; index<trackITSlist->GetSize(); index++) {
676 AliITSTrackV1 *trackITS = (AliITSTrackV1 *) trackITSlist->At(index);
677 if((*trackITS).GetLayer()==7) fresult->SetChi2(10.223e140);
678 // cout <<" Layer inizio = "<<(*trackITS).GetLayer()<<"\n";
679 // cout<<"fvtrack =" <<"\n";
680 // cout << (*trackITS)(0) << " "<<(*trackITS)(1)<<" "
681 // <<(*trackITS)(2)<<" "<<(*trackITS)(3)<<" "
682 // <<(*trackITS)(4)<<"\n";
683 // cout<< " rtrack = "<<(*trackITS).Getrtrack()<<"\n";
684 // cout<< " Pt = "<<(*trackITS).GetPt()<<"\n";
685 // getchar();
686 Double_t chi2Now, chi2Ref;
687 Float_t numClustRef = fresult->GetNumClust();
688 if((*trackITS).GetLayer()==1 ) {
689 chi2Now = trackITS->GetChi2();
690 Float_t numClustNow = trackITS->GetNumClust();
691 if(trackITS->GetNumClust())
692 chi2Now /= (Double_t)trackITS->GetNumClust();
693 chi2Ref = fresult->GetChi2();
694 if(fresult->GetNumClust())
695 chi2Ref /= (Double_t)fresult->GetNumClust();
696 //cout<<" chi2Now and chi2Ref = "<<chi2Now<<" "<<chi2Ref<<"\n";
697 if( numClustNow > numClustRef ) {*fresult = *trackITS;}
698 if((numClustNow == numClustRef )&&
699 (chi2Now < chi2Ref)) {
700 *fresult = *trackITS;
701 } // end if
702 continue;
703 } // end if
704
705 if(trackITS->Getfnoclust()>=2) continue;
706 Float_t numClustNow = trackITS->GetNumClust();
707 if(numClustNow) {
708 chi2Now = trackITS->GetChi2();
709
710 if(numClustNow<numClustRef && chi2Now>fresult->GetChi2()) continue;
711 //cout<<" chi2Now = "<<chi2Now<<"\n";
712 // commentato il 30-7-2001
713 chi2Now/=numClustNow;
714 if(fPtref > 1.0 && chi2Now > 30.) continue;
715 if((fPtref >= 0.6 && fPtref<=1.0) && chi2Now > 40.) continue;
716 // if((fPtref <= 0.6 && fPtref>0.2)&& chi2Now > 40.) continue;
717 // if(fPtref <= 0.2 && chi2Now > 8.) continue;
718 if((fPtref <= 0.6 && fPtref>0.2)&& chi2Now > 30.) continue;
719 if(fPtref <= 0.2 && chi2Now > 7.) continue;
720 /////////////////////////////
721 } // end if
722
723 Int_t layerInit = (*trackITS).GetLayer();
724 Int_t layernew = layerInit - 2;// -1 for new layer, -1 for matrix index
725 TList listoftrack;
726 Int_t ladp, ladm, detp,detm,ladinters,detinters;
727 Int_t layerfin=layerInit-1;
728 // cout<<"Prima di intersection \n";
729 //if(!fTimerIntersection) fTimerIntersection = new TStopwatch();
730 // timer
731 //fTimerIntersection->Continue();
732 // timer
733 Int_t outinters=Intersection(*trackITS,layerfin,ladinters,detinters);
734 //fTimerIntersection->Stop();
735 // timer
736 // cout<<" outinters = "<<outinters<<"\n";
737 // cout<<" Layer ladder detector intersection ="
738 // <<layerfin<<" "<<ladinters<<" "<<detinters<<"\n";
739 // cout << " phiinters zinters = "<<(*trackITS)(0)
740 // << " "<<(*trackITS)(1)<<"\n"; getchar();
741 if(outinters==-1) continue;
742 Int_t flaghit=0;
743 if(outinters==0){
744 TVector toucLad(9), toucDet(9);
745 Int_t lycur=layerfin;
746 ladp=ladinters+1;
747 ladm=ladinters-1;
748 if(ladm <= 0) ladm=fNlad[layerfin-1];
749 if(ladp > fNlad[layerfin-1]) ladp=1;
750 detp=detinters+1;
751 detm=detinters-1;
752 Int_t idetot=1;
753 /*
754 toucLad(0)=ladinters; toucLad(1)=ladm; toucLad(2)=ladp;
755 toucLad(3)=ladinters; toucLad(4)=ladm; toucLad(5)=ladp;
756 toucLad(6)=ladinters; toucLad(7)=ladm; toucLad(8)=ladp;
757 toucDet(0)=detinters; toucDet(1)=detinters; toucDet(2)=detinters;
758 if(detm > 0 && detp <= fNdet[layerfin-1]) {
759 idetot=9;
760 toucDet(3)=detm; toucDet(4)=detm; toucDet(5)=detm;
761 toucDet(6)=detp; toucDet(7)=detp; toucDet(8)=detp;
762 } // end if
763 if(detm > 0 && detp > fNdet[layerfin-1]) {
764 idetot=6;
765 toucDet(3)=detm; toucDet(4)=detm; toucDet(5)=detm;
766 } // end if
767 if(detm <= 0 && detp <= fNdet[layerfin-1]) {
768 idetot=6;
769 toucDet(3)=detp; toucDet(4)=detp; toucDet(5)=detp;
770 } // end if
771 */
f66ae545 772 Float_t epsphi=5.0, epsz=5.0;
b48af428 773 if(fPtref<0.2) {epsphi=3.; epsz=3.;}
774 // nuova definizione idetot e toucLad e toucDet to be
775 // transformed in a method
776 // these values could be modified
777 Float_t pigre=TMath::Pi();
778 Float_t rangephi=5., rangez=5.;
779 if(layerfin==1 || layerfin ==2){
780 rangephi=40.*epsphi*TMath::Sqrt(sigmaphil[layerfin-1]+
781 (*trackITS).GetSigmaphi());
782 rangez = 40.*epsz*TMath::Sqrt(sigmazl[layerfin-1]+
783 (*trackITS).GetSigmaZ());
784 } // end if
785 if(layerfin==3 || layerfin ==4){
786 //rangephi=30.*fepsphi*TMath::Sqrt(sigmaphil[layerfin-1]+
787 // (*trackITS).GetSigmaphi());
788 //rangez = 40.*fepsz*TMath::Sqrt(sigmazl[layerfin-1]+
789 // (*trackITS).GetSigmaZ());
790 rangephi=40.*epsphi*TMath::Sqrt(sigmaphil[layerfin-1]+
791 (*trackITS).GetSigmaphi());
792 rangez = 50.*epsz*TMath::Sqrt(sigmazl[layerfin-1]+
793 (*trackITS).GetSigmaZ());
794 } // end if
795 if(layerfin==5 || layerfin ==6){
796 rangephi=20.*epsphi*TMath::Sqrt(sigmaphil[layerfin-1]+
797 (*trackITS).GetSigmaphi());
798 rangez =5.*epsz*TMath::Sqrt(sigmazl[layerfin-1]+
799 (*trackITS).GetSigmaZ());
800 } // end if
801 Float_t phinters, zinters;
802 phinters=(*trackITS).Getphi();
803 zinters=(*trackITS).GetZ();
804 Float_t distz = 0.0;
805 Float_t phicm, phicp, distphim, distphip;
806 phicm=phinters;
807 if(phinters>fphimax[layerfin-1][ladm]) phicm=phinters-2*pigre;
808 distphim=TMath::Abs(phicm-fphimax[layerfin-1][ladm]);
809 phicp=phinters;
810 if(phinters>fphimin[layerfin-1][ladp]) phicp=phinters-2.*pigre;
811 distphip=TMath::Abs(phicp-fphimin[layerfin-1][ladp]);
812 Int_t flagzmin=0;
813 Int_t flagzmax=0;
814 idetot=1;
815 toucLad(0)=ladinters; toucDet(0)=detinters;
816 if(detm>0) distz=TMath::Abs(zinters-fzmax[layerfin-1][detm-1]);
817 if(detm>0 && rangez>=distz){
818 flagzmin=1;
819 idetot++; toucLad(idetot-1)=ladinters; toucDet(idetot-1)=detm;
820 if(rangephi>=distphim){
821 idetot++;
822 toucLad(idetot-1)=ladm;
823 toucDet(idetot-1)=detinters;
824 idetot++;
825 toucLad(idetot-1)=ladm;
826 toucDet(idetot-1)=detm;
827 } // end if
828 if(rangephi>=distphip){
829 idetot++;
830 toucLad(idetot-1)=ladp;
831 toucDet(idetot-1)=detinters;
832 idetot++;
833 toucLad(idetot-1)=ladp;
834 toucDet(idetot-1)=detm;
835 } // end if
836 } //end detm>0....
837 if(detp<=fNdet[layerfin-1])
838 distz=TMath::Abs(zinters-fzmin[layerfin-1][detp-1]);
839 if(detp<=fNdet[layerfin-1] && rangez>=distz){
840 flagzmax=1;
841 idetot++; toucLad(idetot-1)=ladinters; toucDet(idetot-1)=detp;
842 if(rangephi>=distphim){
843 idetot++; toucLad(idetot-1)=ladm; toucDet(idetot-1)=detp;
844 if(flagzmin == 0) {
845 idetot++;
846 toucLad(idetot-1)=ladm;
847 toucDet(idetot-1)=detinters;
848 } // end if
849 } // end if
850 if(rangephi>=distphip){
851 idetot++;
852 toucLad(idetot-1)=ladp;
853 toucDet(idetot-1)=detp;
854 if(flagzmin == 0) {
855 idetot++;
856 toucLad(idetot-1)=ladp;
857 toucDet(idetot-1)=detinters;
858 } // end if
859 } // end if
860 } //end detm<fNdet[.......
861
862 if(flagzmin == 0 && flagzmax==0){
863 if(rangephi>=distphim){
864 idetot++;
865 toucLad(idetot-1)=ladm;
866 toucDet(idetot-1)=detinters;
867 } // end if
868 if(rangephi>=distphip){
869 idetot++;
870 toucLad(idetot-1)=ladp;
871 toucDet(idetot-1)=detinters;
872 } // end if
873 } // end if
874 ////////////////////////////////////////////////////////////
875 Int_t iriv;
876 for (iriv=0; iriv<idetot; iriv++) { //for on detectors
877 ///////////////////////////////////////////////////////
878 /*** Rec points sorted by module *****/
879 /**************************************/
880 Int_t indexmod; //mod ott
881 // AliITSRecPoint *recp;
882 indexmod = g1->GetModuleIndex(lycur,(Int_t)toucLad(iriv),
883 (Int_t)toucDet(iriv));
884 //mod ott
885 fITS->ResetRecPoints();
886 gAlice->TreeR()->GetEvent(indexmod);
887 Int_t npoints=frecPoints->GetEntries();
888 /* mod ott
889 Int_t *indlist=new Int_t[npoints+1];
890 Int_t counter=0;
891 Int_t ind;
892 for (ind=0; ind<=npoints; ind++) {
893 indlist[ind]=-1;
894 if (*(fvettid[index]+ind)==0) {
895 indlist[counter]=ind;
896 counter++;
897 } // end if
898 } // end for ind
899 ind=-1;
900 for(;;) {
901 ind++;
902 if(indlist[ind] < 0) recp=0;
903 else
904 recp = (AliITSRecPoint*)frecPoints->
905 UncheckedAt(indlist[ind]);
906 if((!recp) ) break;
907 } // end for ;;
908 */
909 ///////////////////////// new //////////////////////////
910 Int_t indnew;
911 for(indnew=0; indnew<npoints; indnew++){
912 if (*(fvettid[indexmod]+indnew)==0)
913 recp =(AliITSRecPoint*)frecPoints->UncheckedAt(indnew);
914 else
f66ae545 915 continue;
b48af428 916 ////////////////////////////////////////////////////
917 TVector cluster(3),vecclust(9);
918 vecclust(6)=vecclust(7)=vecclust(8)=-1.;
919 Double_t sigma[2];
920 // set veclust in global
921 Float_t global[3], local[3];
922 local[0]=recp->GetX();
923 local[1]=0.;
924 local[2]= recp->GetZ();
925 Int_t play = lycur;
926 Int_t plad = TMath::Nint(toucLad(iriv));
927 Int_t pdet = TMath::Nint(toucDet(iriv));
928 g1->LtoG(play,plad,pdet,local,global);
929 vecclust(0)=global[0];
930 vecclust(1)=global[1];
931 vecclust(2)=global[2];
932
933 vecclust(3) = (Float_t)recp->fTracks[0];
934 //vecclust(4) = (Float_t)indlist[ind];
935 vecclust(4) = (Float_t)indnew;
936 vecclust(5) = (Float_t)indexmod; //mod ott
937 vecclust(6) = (Float_t)recp->fTracks[0];
938 vecclust(7) = (Float_t)recp->fTracks[1];
939 vecclust(8) = (Float_t)recp->fTracks[2];
940 sigma[0] = (Double_t) recp->GetSigmaX2();
941 sigma[1] = (Double_t) recp->GetSigmaZ2();
942 //now we are in r,phi,z in global
943 cluster(0) = TMath::Sqrt(vecclust(0)*vecclust(0)+
944 vecclust(1)*vecclust(1));//r hit
945 cluster(1) = TMath::ATan2(vecclust(1),vecclust(0));
946 if(cluster(1)<0.) cluster(1)+=2.*TMath::Pi();
947 cluster(2) = vecclust(2); // z hit
948 // cout<<" layer = "<<play<<"\n";
949 // cout<<" cluster prima = "<<vecclust(0)<<" "
950 // <<vecclust(1)<<" "
951 // <<vecclust(2)<<"\n"; getchar();
952
953 Float_t sigmatotphi, sigmatotz;
954 // Float_t epsphi=5.0, epsz=5.0;
955 //if(fPtref<0.2) {epsphi=3.; epsz=3.;}
956 Double_t rTrack=(*trackITS).Getrtrack();
957 Double_t sigmaphi=sigma[0]/(rTrack*rTrack);
958 sigmatotphi=epsphi*TMath::Sqrt(sigmaphi +
959 (*trackITS).GetSigmaphi());
960 sigmatotz=epsz*TMath::Sqrt(sigma[1] +
961 (*trackITS).GetSigmaZ());
962 //cout<<"cluster e sigmatotphi e track = "<<cluster(0)
963 // <<" "<<cluster(1)<<" "<<sigmatotphi<<" "
964 // <<vecclust(3)<<"\n";
965 //if(vecclust(3)==481) getchar();
966 if(cluster(1)<6. && (*trackITS).Getphi()>6.)
967 cluster(1)=cluster(1)+(2.*TMath::Pi());
968 if(cluster(1)>6. && (*trackITS).Getphi()<6.)
969 cluster(1)=cluster(1)-(2.*TMath::Pi());
970 if(TMath::Abs(cluster(1)-(*trackITS).Getphi())>sigmatotphi)
971 continue;
972 // cout<<" supero sigmaphi \n";
973 AliITSTrackV1 *newTrack = new AliITSTrackV1((*trackITS));
974 (*newTrack).SetLayer((*trackITS).GetLayer()-1);
975 if (TMath::Abs(rTrack-cluster(0))/rTrack>1e-6)
976 (*newTrack).Correct(Double_t(cluster(0)));
977 //cout<<" cluster(2) e(*newTrack).GetZ()="<<cluster(2)<<" "
978 // << (*newTrack).GetZ()<<"\n";
979 if(TMath::Abs(cluster(2)-(*newTrack).GetZ()) > sigmatotz){
980 delete newTrack;
981 continue;
982 } // end if
983 Double_t sigmanew[2];
984 sigmanew[0]= sigmaphi;
985 sigmanew[1]=sigma[1];
986 Double_t m[2];
987 m[0]=cluster(1);
988 m[1]=cluster(2);
989 // Double_t chi2pred=newTrack->GetPredChi2(m,sigmanew);
990 // cout<<" chi2pred = "<<chi2pred<<"\n";
991 // if(chi2pred>fChi2max) continue; //aggiunto il 30-7-2001
992 if(iriv == 0) flaghit=1;
993 (*newTrack).AddMS(frl); // add the multiple scattering
994 //matrix to the covariance matrix
995 (*newTrack).AddEL(frl,1.,0);
996
997 //if(!fTimerKalman) fTimerKalman = new TStopwatch();//timer
998 //fTimerKalman->Continue(); // timer
999 if(fflagvert){
1000 KalmanFilterVert(newTrack,cluster,sigmanew);
1001 //KalmanFilterVert(newTrack,cluster,sigmanew,chi2pred);
1002 }else{
1003 KalmanFilter(newTrack,cluster,sigmanew);
1004 } // end if
1005 //fTimerKalman->Stop(); // timer
1006 (*newTrack).PutCluster(layernew, vecclust);
1007 newTrack->AddClustInTrack();
1008 listoftrack.AddLast(newTrack);
1009 } // end for indnew
1010 // delete [] indlist; //mod ott
1011 } // end of for on detectors (iriv)
1012 }//end if(outinters==0)
1013
1014 if(flaghit==0 || outinters==-2) {
1015 AliITSTrackV1 *newTrack = new AliITSTrackV1(*trackITS);
1016 (*newTrack).Setfnoclust();
1017 (*newTrack).SetLayer((*trackITS).GetLayer()-1);
1018 (*newTrack).AddMS(frl); // add the multiple scattering matrix
1019 // to the covariance matrix
1020 (*newTrack).AddEL(frl,1.,0);
1021 listoftrack.AddLast(newTrack);
1022 } // end if
1023
1024 //gObjectTable->Print(); // stampa memoria
04b80329 1025
b48af428 1026 RecursiveTracking(&listoftrack);
1027 listoftrack.Delete();
1028 } // end of for on tracks (index)
04b80329 1029
b48af428 1030 //gObjectTable->Print(); // stampa memoria
13888096 1031}
b48af428 1032//______________________________________________________________________
1033Int_t AliITSTrackerV1::Intersection(AliITSTrackV1 &track,Int_t layer,
1034 Int_t &ladder,Int_t &detector) {
1035 // Origin A. Badala' and G.S. Pappalardo
1036 // e-mail Angela.Badala@ct.infn.it, Giuseppe.S.Pappalardo@ct.infn.it
1037 // Found the intersection and the detector
1038
1039 Double_t rk=fAvrad[layer-1];
1040 if(track.DoNotCross(rk)){ /*cout<< " Do not cross \n";*/ return -1;}
1041 track.Propagation(rk);
1042 Double_t zinters=track.GetZ();
1043 Double_t phinters=track.Getphi();
1044 //cout<<"zinters = "<<zinters<<" phinters = "<<phinters<<"\n";
1045
1046 TVector det(9);
1047 TVector listDet(2);
1048 TVector distZCenter(2);
1049
1050 Int_t iz=0;
1051 Int_t iD;
1052 for(iD = 1; iD<= fNdet[layer-1]; iD++) {
1053 if(zinters > fzmin[layer-1][iD-1] && zinters <= fzmax[layer-1][iD-1]) {
1054 if(iz>1) {
1055 cout<< " Errore su iz in Intersection \n";
1056 getchar();
1057 }else {
1058 listDet(iz)= iD; distZCenter(iz)=TMath::Abs(zinters-det(2));
1059 iz++;
1060 } // end if
1061 } // end if
1062 } // end for iD
1063
1064 if(iz==0) {/* cout<< " No detector along Z \n";*/ return -2;}
1065 detector=Int_t (listDet(0));
1066 if(iz>1 && (distZCenter(0)>distZCenter(1))) detector=Int_t (listDet(1));
1067
1068 TVector listLad(2);
1069 TVector distPhiCenter(2);
1070 Int_t ip=0;
1071 Double_t pigre=TMath::Pi();
1072 Int_t iLd;
1073 for(iLd = 1; iLd<= fNlad[layer-1]; iLd++) {
1074 Double_t phimin=fphimin[layer-1][iLd-1];
1075 Double_t phimax=fphimax[layer-1][iLd-1];
1076 Double_t phidet=fphidet[layer-1][iLd-1];
1077 Double_t phiconfr=phinters;
1078 if(phimin>phimax) {
1079 //if(phimin <5.5) {cout<<" Error in Intersection for phi \n";
1080 // getchar();}
1081 phimin-=(2.*pigre);
1082 if(phinters>(1.5*pigre)) phiconfr=phinters-(2.*pigre);
1083 if(phidet>(1.5*pigre)) phidet-=(2.*pigre);
1084 } // end if
1085 if(phiconfr>phimin && phiconfr<= phimax) {
1086 if(ip>1) {
1087 cout<< " Errore su ip in Intersection \n"; getchar();
1088 }else {
1089 listLad(ip)= iLd;
1090 distPhiCenter(ip)=TMath::Abs(phiconfr-phidet); ip++;
1091 } // end if
1092 } // end if
1093 } // end for iLd
1094 if(ip==0) { cout<< " No detector along phi \n"; getchar();}
1095 ladder=Int_t (listLad(0));
1096 if(ip>1 && (distPhiCenter(0)>distPhiCenter(1))) ladder=Int_t (listLad(1));
1097 return 0;
1098}
1099//______________________________________________________________________
1100void AliITSTrackerV1::KalmanFilter(AliITSTrackV1 *newTrack,TVector &cluster,
1101 Double_t sigma[2]){
1102 //Origin A. Badala' and G.S. Pappalardo:
1103 // e-mail Angela.Badala@ct.infn.it, Giuseppe.S.Pappalardo@ct.infn.it
1104 // Kalman filter without vertex constraint
1105 ////// Evaluation of the measurement vector ////////////////////////
1106 Double_t m[2];
1107 Double_t rk,phik,zk;
1108 rk=cluster(0); phik=cluster(1); zk=cluster(2);
1109 m[0]=phik; m[1]=zk;
1110 //////////////////////// Evaluation of the error matrix V /////////
1111 Double_t v00=sigma[0];
1112 Double_t v11=sigma[1];
1113 ////////////////////////////////////////////////////////////////////
1114 Double_t cin00,cin10,cin20,cin30,cin40,cin11,cin21,cin31,cin41,cin22,
1115 cin32,cin42,cin33,cin43,cin44;
1116
1117 newTrack->GetCElements(cin00,
1118 cin10,cin11,
1119 cin20,cin21,cin22,
1120 cin30,cin31,cin32,cin33,
1121 cin40,cin41,cin42,cin43,cin44); //get C matrix
1122 Double_t rold00=cin00+v00;
1123 Double_t rold10=cin10;
1124 Double_t rold11=cin11+v11;
1125 ////////////////////// R matrix inversion /////////////////////////
1126 Double_t det=rold00*rold11-rold10*rold10;
1127 Double_t r00=rold11/det;
1128 Double_t r10=-rold10/det;
1129 Double_t r11=rold00/det;
1130 ////////////////////////////////////////////////////////////////////
1131 Double_t k00=cin00*r00+cin10*r10;
1132 Double_t k01=cin00*r10+cin10*r11;
1133 Double_t k10=cin10*r00+cin11*r10;
1134 Double_t k11=cin10*r10+cin11*r11;
1135 Double_t k20=cin20*r00+cin21*r10;
1136 Double_t k21=cin20*r10+cin21*r11;
1137 Double_t k30=cin30*r00+cin31*r10;
1138 Double_t k31=cin30*r10+cin31*r11;
1139 Double_t k40=cin40*r00+cin41*r10;
1140 Double_t k41=cin40*r10+cin41*r11;
1141 Double_t x0,x1,x2,x3,x4;
1142 newTrack->GetXElements(x0,x1,x2,x3,x4); // get the state vector
1143 Double_t savex0=x0, savex1=x1;
1144 x0+=k00*(m[0]-savex0)+k01*(m[1]-savex1);
1145 x1+=k10*(m[0]-savex0)+k11*(m[1]-savex1);
1146 x2+=k20*(m[0]-savex0)+k21*(m[1]-savex1);
1147 x3+=k30*(m[0]-savex0)+k31*(m[1]-savex1);
1148 x4+=k40*(m[0]-savex0)+k41*(m[1]-savex1);
1149 Double_t c00,c10,c20,c30,c40,c11,c21,c31,c41,c22,c32,c42,c33,c43,c44;
1150 c00=cin00-k00*cin00-k01*cin10;
1151 c10=cin10-k00*cin10-k01*cin11;
1152 c20=cin20-k00*cin20-k01*cin21;
1153 c30=cin30-k00*cin30-k01*cin31;
1154 c40=cin40-k00*cin40-k01*cin41;
1155 c11=cin11-k10*cin10-k11*cin11;
1156 c21=cin21-k10*cin20-k11*cin21;
1157 c31=cin31-k10*cin30-k11*cin31;
1158 c41=cin41-k10*cin40-k11*cin41;
1159 c22=cin22-k20*cin20-k21*cin21;
1160 c32=cin32-k20*cin30-k21*cin31;
1161 c42=cin42-k20*cin40-k21*cin41;
1162 c33=cin33-k30*cin30-k31*cin31;
1163 c43=cin43-k30*cin40-k31*cin41;
1164 c44=cin44-k40*cin40-k41*cin41;
1165 newTrack->PutXElements(x0,x1,x2,x3,x4); // put the new state vector
1166 newTrack->PutCElements(c00,
1167 c10,c11,
1168 c20,c21,c22,
1169 c30,c31,c32,c33,
1170 c40,c41,c42,c43,c44); // put in track the
1171 // new cov matrix
1172 Double_t vmcold00=v00-c00;
1173 Double_t vmcold10=-c10;
1174 Double_t vmcold11=v11-c11;
1175 ////////////////////// Matrix vmc inversion ///////////////////////
1176 det=vmcold00*vmcold11-vmcold10*vmcold10;
1177 Double_t vmc00=vmcold11/det;
1178 Double_t vmc10=-vmcold10/det;
1179 Double_t vmc11=vmcold00/det;
1180 ////////////////////////////////////////////////////////////////////
1181 Double_t chi2=(m[0]-x0)*( vmc00*(m[0]-x0) + 2.*vmc10*(m[1]-x1) ) +
1182 (m[1]-x1)*vmc11*(m[1]-x1);
04b80329 1183 newTrack->SetChi2(newTrack->GetChi2()+chi2);
b48af428 1184}
1185//----------------------------------------------------------------------
1186//void AliITSTrackerV1::KalmanFilterVert(AliITSTrackV1 *newTrack,
1187// TVector &cluster,Double_t sigma[2]){
1188void AliITSTrackerV1::KalmanFilterVert(AliITSTrackV1 *newTrack,
1189 TVector &cluster,Double_t sigma[2]
1190 /*, Double_t chi2pred*/){
1191 //Origin A. Badala' and G.S. Pappalardo:
1192 // e-mail Angela.Badala@ct.infn.it, Giuseppe.S.Pappalardo@ct.infn.it
1193 // Kalman filter with vertex constraint
1194 ///////////////////// Evaluation of the measurement vector m ////////
1195 Double_t m[4];
1196 Double_t rk,phik,zk;
1197 rk=cluster(0); phik=cluster(1); zk=cluster(2);
1198 m[0]=phik; m[1]=zk;
1199 Double_t cc=(*newTrack).GetC();
1200 Double_t zv=(*newTrack).GetZv();
1201 Double_t dv=(*newTrack).GetDv();
1202 Double_t cy=cc/2.;
1203 Double_t tgl= (zk-zv)*cy/TMath::ASin(cy*rk);
1204 m[2]=dv; m[3]=tgl;
1205 /////////////////////// Evaluation of the error matrix V //////////
1206 Int_t layer=newTrack->GetLayer();
1207 Double_t v00=sigma[0];
1208 Double_t v11=sigma[1];
1209 Double_t v31=sigma[1]/rk;
1210 Double_t sigmaDv=newTrack->GetsigmaDv();
1211 Double_t v22=sigmaDv*sigmaDv + newTrack->Getd2(layer-1);
1212 Double_t v32=newTrack->Getdtgl(layer-1);
1213 Double_t sigmaZv=newTrack->GetsigmaZv();
1214 Double_t v33=(sigma[1]+sigmaZv*sigmaZv)/(rk*rk)+newTrack->Gettgl2(layer-1);
1215 //////////////////////////////////////////////////////////////////
1216 Double_t cin00,cin10,cin11,cin20,cin21,cin22,
1217 cin30,cin31,cin32,cin33,cin40,cin41,cin42,cin43,cin44;
1218 newTrack->GetCElements(cin00,
1219 cin10,cin11,
1220 cin20,cin21,cin22,
1221 cin30,cin31,cin32,cin33,
1222 cin40,cin41,cin42,cin43,cin44); //get C matrix
1223 Double_t r[4][4];
1224 r[0][0]=cin00+v00;
1225 r[1][0]=cin10;
1226 r[2][0]=cin20;
1227 r[3][0]=cin30;
1228 r[1][1]=cin11+v11;
1229 r[2][1]=cin21;
1230 r[3][1]=cin31+sigma[1]/rk;
1231 r[2][2]=cin22+sigmaDv*sigmaDv+newTrack->Getd2(layer-1);
1232 r[3][2]=cin32+newTrack->Getdtgl(layer-1);
1233 r[3][3]=cin33+(sigma[1]+sigmaZv*sigmaZv)/(rk*rk)+
1234 newTrack->Gettgl2(layer-1);
1235 r[0][1]=r[1][0]; r[0][2]=r[2][0]; r[0][3]=r[3][0];
1236 r[1][2]=r[2][1]; r[1][3]=r[3][1]; r[2][3]=r[3][2];
1237 ///////////////////// Matrix R inversion //////////////////////////
1238 const Int_t kn=4;
1239 Double_t big, hold;
1240 Double_t d=1.;
1241 Int_t ll[kn],mm[kn];
1242 Int_t i,j,k;
1243
1244 for(k=0; k<kn; k++) {
1245 ll[k]=k;
1246 mm[k]=k;
1247 big=r[k][k];
1248 for(j=k; j<kn ; j++) {
1249 for (i=j; i<kn; i++) {
1250 if(TMath::Abs(big) < TMath::Abs(r[i][j]) ) {
1251 big=r[i][j];
1252 ll[k]=i;
1253 mm[k]=j;
1254 } // end if
1255 } // end for i
1256 } // end for j
1257 //
1258 j= ll[k];
1259 if(j > k) {
1260 for(i=0; i<kn; i++) {
1261 hold=-r[k][i];
1262 r[k][i]=r[j][i];
1263 r[j][i]=hold;
1264 } // end for i
1265 }// end if
1266 //
1267 i=mm[k];
1268 if(i > k ) {
1269 for(j=0; j<kn; j++) {
1270 hold=-r[j][k];
1271 r[j][k]=r[j][i];
1272 r[j][i]=hold;
1273 } // end for j
1274 } // end if
1275 //
1276 if(!big) {
1277 d=0.;
1278 cout << "Singular matrix\n";
1279 } // end if
1280 for(i=0; i<kn; i++) {
1281 if(i == k) { continue; }
1282 r[i][k]=r[i][k]/(-big);
1283 } // end for i
1284 //
1285 for(i=0; i<kn; i++) {
1286 hold=r[i][k];
1287 for(j=0; j<kn; j++) {
1288 if(i == k || j == k) continue;
1289 r[i][j]=hold*r[k][j]+r[i][j];
1290 } // end for j
1291 } // end of ri
1292 //
1293 for(j=0; j<kn; j++) {
1294 if(j == k) continue;
1295 r[k][j]=r[k][j]/big;
1296 } // end for j
1297 //
1298 d=d*big;
1299 //
1300 r[k][k]=1./big;
1301 } // end for k
1302 //
1303 for(k=kn-1; k>=0; k--) {
1304 i=ll[k];
1305 if(i > k) {
1306 for (j=0; j<kn; j++) {
1307 hold=r[j][k];
1308 r[j][k]=-r[j][i];
1309 r[j][i]=hold;
1310 } // end for j
1311 } // end if i
1312 j=mm[k];
1313 if(j > k) {
1314 for (i=0; i<kn; i++) {
1315 hold=r[k][i];
1316 r[k][i]=-r[j][i];
1317 r[j][i]=hold;
1318 } // end for i
1319 } // end if
1320 } // end for k
1321 ////////////////////////////////////////////////////////////////////
1322 Double_t k00=cin00*r[0][0]+cin10*r[1][0]+cin20*r[2][0]+cin30*r[3][0];
1323 Double_t k01=cin00*r[1][0]+cin10*r[1][1]+cin20*r[2][1]+cin30*r[3][1];
1324 Double_t k02=cin00*r[2][0]+cin10*r[2][1]+cin20*r[2][2]+cin30*r[3][2];
1325 Double_t k03=cin00*r[3][0]+cin10*r[3][1]+cin20*r[3][2]+cin30*r[3][3];
1326 Double_t k10=cin10*r[0][0]+cin11*r[1][0]+cin21*r[2][0]+cin31*r[3][0];
1327 Double_t k11=cin10*r[1][0]+cin11*r[1][1]+cin21*r[2][1]+cin31*r[3][1];
1328 Double_t k12=cin10*r[2][0]+cin11*r[2][1]+cin21*r[2][2]+cin31*r[3][2];
1329 Double_t k13=cin10*r[3][0]+cin11*r[3][1]+cin21*r[3][2]+cin31*r[3][3];
1330 Double_t k20=cin20*r[0][0]+cin21*r[1][0]+cin22*r[2][0]+cin32*r[3][0];
1331 Double_t k21=cin20*r[1][0]+cin21*r[1][1]+cin22*r[2][1]+cin32*r[3][1];
1332 Double_t k22=cin20*r[2][0]+cin21*r[2][1]+cin22*r[2][2]+cin32*r[3][2];
1333 Double_t k23=cin20*r[3][0]+cin21*r[3][1]+cin22*r[3][2]+cin32*r[3][3];
1334 Double_t k30=cin30*r[0][0]+cin31*r[1][0]+cin32*r[2][0]+cin33*r[3][0];
1335 Double_t k31=cin30*r[1][0]+cin31*r[1][1]+cin32*r[2][1]+cin33*r[3][1];
1336 Double_t k32=cin30*r[2][0]+cin31*r[2][1]+cin32*r[2][2]+cin33*r[3][2];
1337 Double_t k33=cin30*r[3][0]+cin31*r[3][1]+cin32*r[3][2]+cin33*r[3][3];
1338 Double_t k40=cin40*r[0][0]+cin41*r[1][0]+cin42*r[2][0]+cin43*r[3][0];
1339 Double_t k41=cin40*r[1][0]+cin41*r[1][1]+cin42*r[2][1]+cin43*r[3][1];
1340 Double_t k42=cin40*r[2][0]+cin41*r[2][1]+cin42*r[2][2]+cin43*r[3][2];
1341 Double_t k43=cin40*r[3][0]+cin41*r[3][1]+cin42*r[3][2]+cin43*r[3][3];
1342
1343 Double_t x0,x1,x2,x3,x4;
1344 newTrack->GetXElements(x0,x1,x2,x3,x4); // get the state vector
1345 Double_t savex0=x0, savex1=x1, savex2=x2, savex3=x3;
1346 x0+=k00*(m[0]-savex0)+k01*(m[1]-savex1)+k02*(m[2]-savex2)+
1347 k03*(m[3]-savex3);
1348 x1+=k10*(m[0]-savex0)+k11*(m[1]-savex1)+k12*(m[2]-savex2)+
1349 k13*(m[3]-savex3);
1350 x2+=k20*(m[0]-savex0)+k21*(m[1]-savex1)+k22*(m[2]-savex2)+
1351 k23*(m[3]-savex3);
1352 x3+=k30*(m[0]-savex0)+k31*(m[1]-savex1)+k32*(m[2]-savex2)+
1353 k33*(m[3]-savex3);
1354 x4+=k40*(m[0]-savex0)+k41*(m[1]-savex1)+k42*(m[2]-savex2)+
1355 k43*(m[3]-savex3);
1356 Double_t c00,c10,c20,c30,c40,c11,c21,c31,c41,c22,c32,c42,c33,c43,c44;
1357 c00=cin00-k00*cin00-k01*cin10-k02*cin20-k03*cin30;
1358 c10=cin10-k00*cin10-k01*cin11-k02*cin21-k03*cin31;
1359 c20=cin20-k00*cin20-k01*cin21-k02*cin22-k03*cin32;
1360 c30=cin30-k00*cin30-k01*cin31-k02*cin32-k03*cin33;
1361 c40=cin40-k00*cin40-k01*cin41-k02*cin42-k03*cin43;
1362 c11=cin11-k10*cin10-k11*cin11-k12*cin21-k13*cin31;
1363 c21=cin21-k10*cin20-k11*cin21-k12*cin22-k13*cin32;
1364 c31=cin31-k10*cin30-k11*cin31-k12*cin32-k13*cin33;
1365 c41=cin41-k10*cin40-k11*cin41-k12*cin42-k13*cin43;
1366 c22=cin22-k20*cin20-k21*cin21-k22*cin22-k23*cin32;
1367 c32=cin32-k20*cin30-k21*cin31-k22*cin32-k23*cin33;
1368 c42=cin42-k20*cin40-k21*cin41-k22*cin42-k23*cin43;
1369 c33=cin33-k30*cin30-k31*cin31-k32*cin32-k33*cin33;
1370 c43=cin43-k30*cin40-k31*cin41-k32*cin42-k33*cin43;
1371 c44=cin44-k40*cin40-k41*cin41-k42*cin42-k43*cin43;
1372
1373 newTrack->PutXElements(x0,x1,x2,x3,x4); // put the new state vector
1374 newTrack->PutCElements(c00,
1375 c10,c11,
1376 c20,c21,c22,
1377 c30,c31,c32,c33,
1378 c40,c41,c42,c43,c44); // put in track the
1379 // new cov matrix
1380 Double_t vmc[4][4];
1381 vmc[0][0]=v00-c00; vmc[1][0]=-c10; vmc[2][0]=-c20; vmc[3][0]=-c30;
1382 vmc[1][1]=v11-c11; vmc[2][1]=-c21; vmc[3][1]=v31-c31;
1383 vmc[2][2]=v22-c22; vmc[3][2]=v32-c32;
1384 vmc[3][3]=v33-c33;
1385 vmc[0][1]=vmc[1][0]; vmc[0][2]=vmc[2][0]; vmc[0][3]=vmc[3][0];
1386 vmc[1][2]=vmc[2][1]; vmc[1][3]=vmc[3][1];
1387 vmc[2][3]=vmc[3][2];
1388 /////////////////////// vmc matrix inversion ///////////////////////
1389 d=1.;
1390 for(k=0; k<kn; k++) {
1391 ll[k]=k;
1392 mm[k]=k;
1393 big=vmc[k][k];
1394 for(j=k; j<kn ; j++) {
1395 for (i=j; i<kn; i++) {
1396 if(TMath::Abs(big) < TMath::Abs(vmc[i][j]) ) {
1397 big=vmc[i][j];
1398 ll[k]=i;
1399 mm[k]=j;
1400 } // end if
1401 } // end for i
1402 } // end for j
1403 //
1404 j= ll[k];
1405 if(j > k) {
1406 for(i=0; i<kn; i++) {
1407 hold=-vmc[k][i];
1408 vmc[k][i]=vmc[j][i];
1409 vmc[j][i]=hold;
1410 } // end for i
1411 } // end if
1412 //
1413 i=mm[k];
1414 if(i > k ) {
1415 for(j=0; j<kn; j++) {
1416 hold=-vmc[j][k];
1417 vmc[j][k]=vmc[j][i];
1418 vmc[j][i]=hold;
1419 } // end for j
1420 } // end if
1421 //
1422 if(!big) {
1423 d=0.;
1424 cout << "Singular matrix\n";
1425 } // end if
1426 for(i=0; i<kn; i++) {
1427 if(i == k) continue;
1428 vmc[i][k]=vmc[i][k]/(-big);
1429 } // end for i
1430 //
1431 for(i=0; i<kn; i++) {
1432 hold=vmc[i][k];
1433 for(j=0; j<kn; j++) {
1434 if(i == k || j == k) continue;
1435 vmc[i][j]=hold*vmc[k][j]+vmc[i][j];
1436 } // end for j
1437 } // end for i
1438 //
1439 for(j=0; j<kn; j++) {
1440 if(j == k) continue;
1441 vmc[k][j]=vmc[k][j]/big;
1442 } // end for j
1443 //
1444 d=d*big;
1445 //
1446 vmc[k][k]=1./big;
1447 } // end for k
1448 //
1449 for(k=kn-1; k>=0; k--) {
1450 i=ll[k];
1451 if(i > k) {
1452 for (j=0; j<kn; j++) {
1453 hold=vmc[j][k];
1454 vmc[j][k]=-vmc[j][i];
1455 vmc[j][i]=hold;
1456 } // end for j
1457 } // end if i>k
1458 j=mm[k];
1459 if(j > k) {
1460 for (i=0; i<kn; i++) {
1461 hold=vmc[k][i];
1462 vmc[k][i]=-vmc[j][i];
1463 vmc[j][i]=hold;
1464 } // end for i
1465 } // end if j>k
1466 } // end for k
1467 ////////////////////////////////////////////////////////////////////
1468 Double_t chi2=(m[0]-x0)*( vmc[0][0]*(m[0]-x0) + 2.*vmc[1][0]*(m[1]-x1) +
1469 2.*vmc[2][0]*(m[2]-x2)+ 2.*vmc[3][0]*(m[3]-x3) )+
1470 (m[1]-x1)* ( vmc[1][1]*(m[1]-x1) + 2.*vmc[2][1]*(m[2]-x2)+
1471 2.*vmc[3][1]*(m[3]-x3) ) +
1472 (m[2]-x2)* ( vmc[2][2]*(m[2]-x2)+ 2.*vmc[3][2]*(m[3]-x3) ) +
1473 (m[3]-x3)*vmc[3][3]*(m[3]-x3);
1474 //cout<<" chi2 kalman = "<<chi2<<"\n"; getchar();
1475 newTrack->SetChi2(newTrack->GetChi2()+chi2);
1476 // newTrack->SetChi2(newTrack->GetChi2()+chi2pred);
1477}