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