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