]>
Commit | Line | Data |
---|---|---|
13918578 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-2003, 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 | ||
bf6adc12 | 16 | /* $Id$ */ |
17 | ||
e8432c6d | 18 | /////////////////////////////////////////////////////////// |
19 | // Stand alone ITS tracker class // | |
20 | // Origin: Elisabetta Crescio - crescio@to.infn.it // | |
21 | // Updated: Francesco Prino - prino@to.infn.it // | |
22 | /////////////////////////////////////////////////////////// | |
13918578 | 23 | |
aa4b78e1 | 24 | #include <stdlib.h> |
bf6adc12 | 25 | |
26 | #include <TArrayI.h> | |
13918578 | 27 | #include <TBranch.h> |
13918578 | 28 | #include <TObjArray.h> |
29 | #include <TTree.h> | |
bf6adc12 | 30 | |
af885e0f | 31 | #include "AliESDEvent.h" |
bf6adc12 | 32 | #include "AliESDVertex.h" |
33 | #include "AliESDtrack.h" | |
bf6adc12 | 34 | #include "AliITSVertexer.h" |
13918578 | 35 | #include "AliITSclusterTable.h" |
00a7cc50 | 36 | #include "AliITSRecPoint.h" |
cc088660 | 37 | #include "AliITSgeomTGeo.h" |
13918578 | 38 | #include "AliITStrackSA.h" |
bf6adc12 | 39 | #include "AliITStrackerSA.h" |
e340bb86 | 40 | #include "AliITSReconstructor.h" |
b881f1fd | 41 | #include "AliLog.h" |
bf6adc12 | 42 | #include "AliRun.h" |
13918578 | 43 | |
44 | ClassImp(AliITStrackerSA) | |
45 | ||
46 | //____________________________________________________________________________ | |
e399f961 | 47 | AliITStrackerSA::AliITStrackerSA():AliITStrackerMI(), |
48 | fPhiEstimate(0), | |
1966f03c | 49 | fITSStandAlone(0), |
e399f961 | 50 | fLambdac(0), |
51 | fPhic(0), | |
52 | fCoef1(0), | |
53 | fCoef2(0), | |
54 | fCoef3(0), | |
55 | fNloop(0), | |
56 | fPhiWin(0), | |
57 | fLambdaWin(0), | |
58 | fVert(0), | |
59 | fVertexer(0), | |
e399f961 | 60 | fListOfTracks(0), |
deae0246 | 61 | fListOfSATracks(0), |
e399f961 | 62 | fITSclusters(0), |
12b1afb7 | 63 | fInwardFlag(0), |
b8ed1a92 | 64 | fOuterStartLayer(0), |
12b1afb7 | 65 | fInnerStartLayer(5), |
66 | fMinNPoints(0), | |
3733ccd2 | 67 | fMinQ(0.), |
e399f961 | 68 | fCluLayer(0), |
69 | fCluCoord(0){ | |
13918578 | 70 | // Default constructor |
71 | Init(); | |
627b6db6 | 72 | |
13918578 | 73 | } |
2257f27e | 74 | //____________________________________________________________________________ |
cc088660 | 75 | AliITStrackerSA::AliITStrackerSA(const Char_t *geom):AliITStrackerMI(0), |
e399f961 | 76 | fPhiEstimate(0), |
1966f03c | 77 | fITSStandAlone(0), |
e399f961 | 78 | fLambdac(0), |
79 | fPhic(0), | |
80 | fCoef1(0), | |
81 | fCoef2(0), | |
82 | fCoef3(0), | |
83 | fNloop(0), | |
84 | fPhiWin(0), | |
85 | fLambdaWin(0), | |
86 | fVert(0), | |
87 | fVertexer(0), | |
e399f961 | 88 | fListOfTracks(0), |
deae0246 | 89 | fListOfSATracks(0), |
e399f961 | 90 | fITSclusters(0), |
12b1afb7 | 91 | fInwardFlag(0), |
b8ed1a92 | 92 | fOuterStartLayer(0), |
12b1afb7 | 93 | fInnerStartLayer(5), |
94 | fMinNPoints(0), | |
3733ccd2 | 95 | fMinQ(0.), |
e399f961 | 96 | fCluLayer(0), |
97 | fCluCoord(0) | |
2257f27e | 98 | { |
99 | // Standard constructor (Vertex is known and passed to this obj.) | |
cc088660 | 100 | if (geom) { |
101 | AliWarning("\"geom\" is actually a dummy argument !"); | |
102 | } | |
103 | ||
2257f27e | 104 | Init(); |
105 | fVert = 0; | |
627b6db6 | 106 | |
2257f27e | 107 | } |
108 | ||
13918578 | 109 | //____________________________________________________________________________ |
cc088660 | 110 | AliITStrackerSA::AliITStrackerSA(const Char_t *geom, AliESDVertex *vert):AliITStrackerMI(0), |
e399f961 | 111 | fPhiEstimate(0), |
1966f03c | 112 | fITSStandAlone(0), |
e399f961 | 113 | fLambdac(0), |
114 | fPhic(0), | |
115 | fCoef1(0), | |
116 | fCoef2(0), | |
117 | fCoef3(0), | |
118 | fNloop(0), | |
119 | fPhiWin(0), | |
120 | fLambdaWin(0), | |
121 | fVert(vert), | |
122 | fVertexer(0), | |
e399f961 | 123 | fListOfTracks(0), |
deae0246 | 124 | fListOfSATracks(0), |
e399f961 | 125 | fITSclusters(0), |
12b1afb7 | 126 | fInwardFlag(0), |
b8ed1a92 | 127 | fOuterStartLayer(0), |
12b1afb7 | 128 | fInnerStartLayer(5), |
129 | fMinNPoints(0), | |
3733ccd2 | 130 | fMinQ(0.), |
e399f961 | 131 | fCluLayer(0), |
1966f03c | 132 | fCluCoord(0) |
13918578 | 133 | { |
134 | // Standard constructor (Vertex is known and passed to this obj.) | |
cc088660 | 135 | if (geom) { |
136 | AliWarning("\"geom\" is actually a dummy argument !"); | |
137 | } | |
13918578 | 138 | Init(); |
627b6db6 | 139 | |
13918578 | 140 | } |
141 | ||
13918578 | 142 | //____________________________________________________________________________ |
cc088660 | 143 | AliITStrackerSA::AliITStrackerSA(const Char_t *geom, AliITSVertexer *vertexer):AliITStrackerMI(0), |
e399f961 | 144 | fPhiEstimate(0), |
1966f03c | 145 | fITSStandAlone(0), |
e399f961 | 146 | fLambdac(0), |
147 | fPhic(0), | |
148 | fCoef1(0), | |
149 | fCoef2(0), | |
150 | fCoef3(0), | |
151 | fNloop(0), | |
152 | fPhiWin(0), | |
153 | fLambdaWin(0), | |
154 | fVert(), | |
155 | fVertexer(vertexer), | |
e399f961 | 156 | fListOfTracks(0), |
deae0246 | 157 | fListOfSATracks(0), |
e399f961 | 158 | fITSclusters(0), |
12b1afb7 | 159 | fInwardFlag(0), |
b8ed1a92 | 160 | fOuterStartLayer(0), |
12b1afb7 | 161 | fInnerStartLayer(5), |
162 | fMinNPoints(0), | |
3733ccd2 | 163 | fMinQ(0.), |
e399f961 | 164 | fCluLayer(0), |
1966f03c | 165 | fCluCoord(0) |
13918578 | 166 | { |
167 | // Standard constructor (Vertex is unknown - vertexer is passed to this obj) | |
cc088660 | 168 | if (geom) { |
169 | AliWarning("\"geom\" is actually a dummy argument !"); | |
170 | } | |
13918578 | 171 | Init(); |
172 | fVertexer = vertexer; | |
627b6db6 | 173 | |
13918578 | 174 | } |
175 | ||
176 | //____________________________________________________________________________ | |
e399f961 | 177 | AliITStrackerSA::AliITStrackerSA(const AliITStrackerSA& tracker):AliITStrackerMI(), |
178 | fPhiEstimate(tracker.fPhiEstimate), | |
1966f03c | 179 | fITSStandAlone(tracker.fITSStandAlone), |
e399f961 | 180 | fLambdac(tracker.fLambdac), |
181 | fPhic(tracker.fPhic), | |
182 | fCoef1(tracker.fCoef1), | |
183 | fCoef2(tracker.fCoef2), | |
184 | fCoef3(tracker.fCoef3), | |
185 | fNloop(tracker.fNloop), | |
186 | fPhiWin(tracker.fPhiWin), | |
187 | fLambdaWin(tracker.fLambdaWin), | |
188 | fVert(tracker.fVert), | |
189 | fVertexer(tracker.fVertexer), | |
e399f961 | 190 | fListOfTracks(tracker.fListOfTracks), |
deae0246 | 191 | fListOfSATracks(tracker.fListOfSATracks), |
e399f961 | 192 | fITSclusters(tracker.fITSclusters), |
12b1afb7 | 193 | fInwardFlag(tracker.fInwardFlag), |
b8ed1a92 | 194 | fOuterStartLayer(tracker.fOuterStartLayer), |
12b1afb7 | 195 | fInnerStartLayer(tracker.fInnerStartLayer), |
196 | fMinNPoints(tracker.fMinNPoints), | |
3733ccd2 | 197 | fMinQ(tracker.fMinQ), |
e399f961 | 198 | fCluLayer(tracker.fCluLayer), |
199 | fCluCoord(tracker.fCluCoord) { | |
13918578 | 200 | // Copy constructor |
13918578 | 201 | for(Int_t i=0;i<2;i++){ |
202 | fPoint1[i]=tracker.fPoint1[i]; | |
203 | fPoint2[i]=tracker.fPoint2[i]; | |
204 | fPoint3[i]=tracker.fPoint3[i]; | |
205 | fPointc[i]=tracker.fPointc[i]; | |
206 | } | |
13918578 | 207 | if(tracker.fVertexer && tracker.fVert){ |
d681bb2d | 208 | fVert = new AliESDVertex(*tracker.fVert); |
13918578 | 209 | } |
210 | else { | |
211 | fVert = tracker.fVert; | |
212 | } | |
cc088660 | 213 | for(Int_t i=0;i<AliITSgeomTGeo::GetNLayers();i++){ |
7e5bf5af | 214 | fCluLayer[i] = tracker.fCluLayer[i]; |
215 | fCluCoord[i] = tracker.fCluCoord[i]; | |
216 | } | |
13918578 | 217 | } |
7d62fb64 | 218 | //______________________________________________________________________ |
e399f961 | 219 | AliITStrackerSA& AliITStrackerSA::operator=(const AliITStrackerSA& source){ |
220 | // Assignment operator. | |
221 | this->~AliITStrackerSA(); | |
222 | new(this) AliITStrackerSA(source); | |
223 | return *this; | |
224 | ||
7d62fb64 | 225 | } |
13918578 | 226 | |
227 | //____________________________________________________________________________ | |
228 | AliITStrackerSA::~AliITStrackerSA(){ | |
229 | // destructor | |
d681bb2d | 230 | // if fVertexer is not null, the AliESDVertex obj. is owned by this class |
13918578 | 231 | // and is deleted here |
232 | if(fVertexer){ | |
233 | if(fVert)delete fVert; | |
234 | } | |
235 | fVert = 0; | |
236 | fVertexer = 0; | |
7e5bf5af | 237 | |
13918578 | 238 | if(fPhiWin)delete []fPhiWin; |
239 | if(fLambdaWin)delete []fLambdaWin; | |
4e05ab9a | 240 | fListOfTracks->Delete(); |
adda6c2b | 241 | delete fListOfTracks; |
deae0246 | 242 | fListOfSATracks->Delete(); |
243 | delete fListOfSATracks; | |
7e5bf5af | 244 | if(fCluLayer){ |
cc088660 | 245 | for(Int_t i=0;i<AliITSgeomTGeo::GetNLayers();i++){ |
7e5bf5af | 246 | if(fCluLayer[i]){ |
247 | fCluLayer[i]->Delete(); | |
248 | delete fCluLayer[i]; | |
249 | } | |
250 | } | |
251 | delete [] fCluLayer; | |
252 | } | |
253 | if(fCluCoord){ | |
cc088660 | 254 | for(Int_t i=0;i<AliITSgeomTGeo::GetNLayers();i++){ |
7e5bf5af | 255 | if(fCluCoord[i]){ |
256 | fCluCoord[i]->Delete(); | |
257 | delete fCluCoord[i]; | |
258 | } | |
259 | } | |
260 | delete [] fCluCoord; | |
627b6db6 | 261 | } |
7e5bf5af | 262 | |
7e5bf5af | 263 | } |
13918578 | 264 | |
1966f03c | 265 | //____________________________________________________________________________ |
af885e0f | 266 | Int_t AliITStrackerSA::Clusters2Tracks(AliESDEvent *event){ |
1966f03c | 267 | // This method is used to find and fit the tracks. By default the corresponding |
268 | // method in the parent class is invoked. In this way a combined tracking | |
269 | // TPC+ITS is performed. If the flag fITSStandAlone is true, the tracking | |
270 | // is done in the ITS only. In the standard reconstruction chain this option | |
271 | // can be set via AliReconstruction::SetOption("ITS","onlyITS") | |
272 | Int_t rc=0; | |
273 | if(!fITSStandAlone){ | |
274 | rc=AliITStrackerMI::Clusters2Tracks(event); | |
275 | } | |
276 | else { | |
277 | AliDebug(1,"Stand Alone flag set: doing tracking in ITS alone\n"); | |
278 | } | |
3bfb5cac | 279 | if(!rc){ |
280 | rc=FindTracks(event,kFALSE); | |
281 | if(AliITSReconstructor::GetRecoParam()->GetSAUseAllClusters()==kTRUE) { | |
282 | rc=FindTracks(event,kTRUE); | |
283 | } | |
284 | } | |
285 | ||
1966f03c | 286 | return rc; |
287 | } | |
288 | ||
13918578 | 289 | //____________________________________________________________________________ |
290 | void AliITStrackerSA::Init(){ | |
291 | // Reset all data members | |
292 | fPhiEstimate=0; | |
293 | for(Int_t i=0;i<3;i++){fPoint1[i]=0;fPoint2[i]=0;fPoint3[i]=0;} | |
294 | fLambdac=0; | |
295 | fPhic=0; | |
296 | fCoef1=0; | |
297 | fCoef2=0; | |
298 | fCoef3=0; | |
299 | fPointc[0]=0; | |
300 | fPointc[1]=0; | |
301 | fVert = 0; | |
302 | fVertexer = 0; | |
5b4dedce | 303 | Int_t nLoops=AliITSReconstructor::GetRecoParam()->GetNLoopsSA(); |
304 | if(nLoops==33){ | |
305 | SetFixedWindowSizes(); | |
306 | }else{ | |
307 | Double_t phimin=AliITSReconstructor::GetRecoParam()->GetMinPhiSA(); | |
308 | Double_t phimax=AliITSReconstructor::GetRecoParam()->GetMaxPhiSA(); | |
309 | Double_t lambmin=AliITSReconstructor::GetRecoParam()->GetMinLambdaSA(); | |
310 | Double_t lambmax=AliITSReconstructor::GetRecoParam()->GetMaxLambdaSA(); | |
311 | SetCalculatedWindowSizes(nLoops,phimin,phimax,lambmin,lambmax); | |
312 | } | |
3733ccd2 | 313 | fMinQ=AliITSReconstructor::GetRecoParam()->GetSAMinClusterCharge(); |
2257f27e | 314 | fITSclusters = 0; |
12b1afb7 | 315 | SetOuterStartLayer(1); |
1966f03c | 316 | SetSAFlag(kFALSE); |
f2150e42 | 317 | fListOfTracks=new TClonesArray("AliITStrackMI",100); |
318 | fListOfSATracks=new TClonesArray("AliITStrackSA",100); | |
7e5bf5af | 319 | fCluLayer = 0; |
320 | fCluCoord = 0; | |
12b1afb7 | 321 | fMinNPoints = 3; |
627b6db6 | 322 | } |
13918578 | 323 | //_______________________________________________________________________ |
324 | void AliITStrackerSA::ResetForFinding(){ | |
325 | // Reset data members used in all loops during track finding | |
326 | fPhiEstimate=0; | |
327 | for(Int_t i=0;i<3;i++){fPoint1[i]=0;fPoint2[i]=0;fPoint3[i]=0;} | |
328 | fLambdac=0; | |
329 | fPhic=0; | |
330 | fCoef1=0; | |
331 | fCoef2=0; | |
332 | fCoef3=0; | |
333 | fPointc[0]=0; | |
334 | fPointc[1]=0; | |
f2150e42 | 335 | fListOfTracks->Clear(); |
336 | fListOfSATracks->Clear(); | |
13918578 | 337 | } |
bef31448 | 338 | |
7e5bf5af | 339 | |
2257f27e | 340 | |
bef31448 | 341 | //______________________________________________________________________ |
3bfb5cac | 342 | Int_t AliITStrackerSA::FindTracks(AliESDEvent* event, Bool_t useAllClusters){ |
bef31448 | 343 | |
7e5bf5af | 344 | // Track finder using the ESD object |
6f178e14 | 345 | |
b881f1fd | 346 | AliDebug(2,Form(" field is %f",event->GetMagneticField())); |
4fa7f7d1 | 347 | AliDebug(2,Form("SKIPPING %d %d %d %d %d %d",ForceSkippingOfLayer(0),ForceSkippingOfLayer(1),ForceSkippingOfLayer(2),ForceSkippingOfLayer(3),ForceSkippingOfLayer(4),ForceSkippingOfLayer(5))); |
348 | ||
2257f27e | 349 | if(!fITSclusters){ |
350 | Fatal("FindTracks","ITS cluster tree is not accessed - Abort!!!\n Please use method SetClusterTree to pass the pointer to the tree\n"); | |
351 | return -1; | |
bef31448 | 352 | } |
7e5bf5af | 353 | //Reads event and mark clusters of traks already found, with flag kITSin |
ebda3140 | 354 | Int_t nentr=event->GetNumberOfTracks(); |
3bfb5cac | 355 | if(!useAllClusters) { |
5a03f353 | 356 | while (nentr--) { |
357 | AliESDtrack *track=event->GetTrack(nentr); | |
5af4a2d0 | 358 | if ((track->GetStatus()&AliESDtrack::kITSin) == AliESDtrack::kITSin){ |
5a03f353 | 359 | Int_t idx[12]; |
360 | Int_t ncl = track->GetITSclusters(idx); | |
361 | for(Int_t k=0;k<ncl;k++){ | |
362 | AliITSRecPoint* cll = (AliITSRecPoint*)GetCluster(idx[k]); | |
363 | cll->SetBit(kSAflag); | |
364 | } | |
ebda3140 | 365 | } |
366 | } | |
a1995c09 | 367 | }else{ |
368 | while (nentr--) { | |
369 | AliESDtrack *track=event->GetTrack(nentr); | |
370 | if ((track->GetStatus()&AliESDtrack::kITSin) == AliESDtrack::kITSin){ | |
371 | Int_t idx[12]; | |
372 | Int_t ncl = track->GetITSclusters(idx); | |
373 | for(Int_t k=0;k<ncl;k++){ | |
374 | AliITSRecPoint* cll = (AliITSRecPoint*)GetCluster(idx[k]); | |
375 | cll->ResetBit(kSAflag); | |
376 | } | |
377 | } | |
378 | } | |
ebda3140 | 379 | } |
380 | //Get primary vertex | |
381 | Double_t primaryVertex[3]; | |
382 | event->GetVertex()->GetXYZ(primaryVertex); | |
383 | //Creates TClonesArray with clusters for each layer. The clusters already used | |
384 | //by AliITStrackerMI are not considered | |
deae0246 | 385 | Int_t nclusters[AliITSgeomTGeo::kNLayers]={0,0,0,0,0,0}; |
386 | Int_t dmar[AliITSgeomTGeo::kNLayers]={0,0,0,0,0,0}; | |
ebda3140 | 387 | if (fCluLayer == 0) { |
deae0246 | 388 | fCluLayer = new TClonesArray*[AliITSgeomTGeo::kNLayers]; |
389 | fCluCoord = new TClonesArray*[AliITSgeomTGeo::kNLayers]; | |
ebda3140 | 390 | for(Int_t i=0;i<AliITSgeomTGeo::GetNLayers();i++) { |
391 | fCluLayer[i]=0; | |
392 | fCluCoord[i]=0; | |
393 | } | |
394 | } | |
ebda3140 | 395 | for(Int_t i=0;i<AliITSgeomTGeo::GetNLayers();i++){ |
ebda3140 | 396 | AliITSlayer &layer=fgLayers[i]; |
4fa7f7d1 | 397 | if (!ForceSkippingOfLayer(i)) { |
25be2b21 | 398 | for(Int_t cli=0;cli<layer.GetNumberOfClusters();cli++){ |
399 | AliITSRecPoint* cls = (AliITSRecPoint*)layer.GetCluster(cli); | |
400 | if(cls->TestBit(kSAflag)==kTRUE) continue; //clusters used by TPC prol. | |
401 | if(cls->GetQ()==0) continue; //fake clusters dead zones | |
3733ccd2 | 402 | if(i>1 && cls->GetQ()<=fMinQ) continue; // cut on SDD and SSD cluster charge |
25be2b21 | 403 | nclusters[i]++; |
404 | } | |
ebda3140 | 405 | } |
406 | dmar[i]=0; | |
855b4730 | 407 | if(!fCluLayer[i]){ |
408 | fCluLayer[i] = new TClonesArray("AliITSRecPoint",nclusters[i]); | |
409 | }else{ | |
410 | fCluLayer[i]->Delete(); | |
411 | fCluLayer[i]->Expand(nclusters[i]); | |
412 | } | |
413 | if(!fCluCoord[i]){ | |
414 | fCluCoord[i] = new TClonesArray("AliITSclusterTable",nclusters[i]); | |
415 | }else{ | |
416 | fCluCoord[i]->Delete(); | |
417 | fCluCoord[i]->Expand(nclusters[i]); | |
418 | } | |
ebda3140 | 419 | } |
420 | ||
421 | for(Int_t ilay=0;ilay<AliITSgeomTGeo::GetNLayers();ilay++){ | |
422 | TClonesArray &clulay = *fCluLayer[ilay]; | |
423 | TClonesArray &clucoo = *fCluCoord[ilay]; | |
424 | AliITSlayer &layer=fgLayers[ilay]; | |
4fa7f7d1 | 425 | if (!ForceSkippingOfLayer(ilay)) { |
25be2b21 | 426 | for(Int_t cli=0;cli<layer.GetNumberOfClusters();cli++){ |
427 | AliITSRecPoint* cls = (AliITSRecPoint*)layer.GetCluster(cli); | |
428 | if(cls->TestBit(kSAflag)==kTRUE) continue; | |
429 | if(cls->GetQ()==0) continue; | |
3733ccd2 | 430 | if(ilay>1 && cls->GetQ()<=fMinQ) continue; |
25be2b21 | 431 | Double_t phi=0;Double_t lambda=0; |
432 | Float_t x=0;Float_t y=0;Float_t z=0; | |
433 | Float_t sx=0;Float_t sy=0;Float_t sz=0; | |
434 | GetCoorAngles(cls,phi,lambda,x,y,z,primaryVertex); | |
435 | GetCoorErrors(cls,sx,sy,sz); | |
436 | new (clulay[dmar[ilay]]) AliITSRecPoint(*cls); | |
437 | new (clucoo[dmar[ilay]]) AliITSclusterTable(x,y,z,sx,sy,sz,phi,lambda,cli); | |
438 | dmar[ilay]++; | |
439 | } | |
ebda3140 | 440 | } |
441 | } | |
7e5bf5af | 442 | |
6f178e14 | 443 | // track counter |
444 | Int_t ntrack=0; | |
445 | ||
deae0246 | 446 | static Int_t nClusLay[AliITSgeomTGeo::kNLayers];//counter for clusters on each layer |
f2150e42 | 447 | Int_t startLayForSeed=0; |
448 | Int_t lastLayForSeed=fOuterStartLayer; | |
449 | Int_t nSeedSteps=lastLayForSeed-startLayForSeed; | |
450 | Int_t seedStep=1; | |
451 | if(fInwardFlag){ | |
452 | startLayForSeed=AliITSgeomTGeo::GetNLayers()-1; | |
453 | lastLayForSeed=fInnerStartLayer; | |
454 | nSeedSteps=startLayForSeed-lastLayForSeed; | |
455 | seedStep=-1; | |
456 | } | |
6f178e14 | 457 | |
12b1afb7 | 458 | // loop on minimum number of points |
459 | for(Int_t iMinNPoints=AliITSgeomTGeo::GetNLayers(); iMinNPoints>=fMinNPoints; iMinNPoints--) { | |
460 | ||
f2150e42 | 461 | // loop on starting layer for track finding |
462 | for(Int_t iSeedLay=0; iSeedLay<=nSeedSteps; iSeedLay++) { | |
463 | Int_t theLay=startLayForSeed+iSeedLay*seedStep; | |
464 | if(ForceSkippingOfLayer(theLay)) continue; | |
465 | Int_t minNPoints=iMinNPoints-theLay; | |
466 | if(fInwardFlag) minNPoints=iMinNPoints-(AliITSgeomTGeo::GetNLayers()-1-theLay); | |
467 | for(Int_t i=theLay+1;i<AliITSgeomTGeo::GetNLayers();i++) | |
468 | if(ForceSkippingOfLayer(i)) | |
469 | minNPoints--; | |
470 | if(minNPoints<fMinNPoints) continue; | |
471 | ||
472 | // loop on phi and lambda window size | |
473 | for(Int_t nloop=0;nloop<fNloop;nloop++){ | |
474 | Int_t nclTheLay=fCluLayer[theLay]->GetEntries(); | |
475 | while(nclTheLay--){ | |
476 | ResetForFinding(); | |
477 | Bool_t useRP=SetFirstPoint(theLay,nclTheLay,primaryVertex); | |
478 | if(!useRP) continue; | |
479 | AliITStrackSA trs; | |
12b1afb7 | 480 | |
f2150e42 | 481 | Int_t pflag=0; |
482 | Int_t kk; | |
483 | for(kk=0;kk<AliITSgeomTGeo::GetNLayers();kk++) nClusLay[kk] = 0; | |
12b1afb7 | 484 | |
f2150e42 | 485 | kk=0; |
486 | nClusLay[kk] = SearchClusters(theLay,fPhiWin[nloop],fLambdaWin[nloop], | |
487 | &trs,primaryVertex[2],pflag); | |
488 | Int_t nextLay=theLay+seedStep; | |
489 | Bool_t goon=kTRUE; | |
490 | while(goon){ | |
491 | kk++; | |
492 | nClusLay[kk] = SearchClusters(nextLay,fPhiWin[nloop],fLambdaWin[nloop], | |
493 | &trs,primaryVertex[2],pflag); | |
494 | if(nClusLay[kk]!=0){ | |
495 | pflag=1; | |
496 | if(kk==1) { | |
497 | fPoint3[0]=fPointc[0]; | |
498 | fPoint3[1]=fPointc[1]; | |
499 | } else { | |
500 | UpdatePoints(); | |
12b1afb7 | 501 | } |
502 | } | |
f2150e42 | 503 | nextLay+=seedStep; |
504 | if(nextLay<0 || nextLay==6) goon=kFALSE; | |
505 | } | |
506 | ||
12b1afb7 | 507 | |
f2150e42 | 508 | Int_t layOK=0; |
509 | if(!fInwardFlag){ | |
510 | for(Int_t nnp=0;nnp<AliITSgeomTGeo::GetNLayers()-theLay;nnp++){ | |
12b1afb7 | 511 | if(nClusLay[nnp]!=0) layOK+=1; |
512 | } | |
f2150e42 | 513 | }else{ |
514 | for(Int_t nnp=theLay; nnp>=0; nnp--){ | |
12b1afb7 | 515 | if(nClusLay[nnp]!=0) layOK+=1; |
516 | } | |
f2150e42 | 517 | } |
518 | if(layOK>=minNPoints){ | |
519 | AliDebug(2,Form("---NPOINTS: %d; MAP: %d %d %d %d %d %d\n",layOK,nClusLay[0],nClusLay[1],nClusLay[2],nClusLay[3],nClusLay[4],nClusLay[5])); | |
520 | AliITStrackV2* tr2 = 0; | |
521 | tr2 = FitTrack(&trs,primaryVertex); | |
522 | if(!tr2){ | |
523 | continue; | |
524 | } | |
525 | AliDebug(2,Form("---NPOINTS fit: %d\n",tr2->GetNumberOfClusters())); | |
12b1afb7 | 526 | |
f2150e42 | 527 | StoreTrack(tr2,event,useAllClusters); |
528 | ntrack++; | |
12b1afb7 | 529 | |
f2150e42 | 530 | } |
531 | ||
532 | }//end loop on clusters of theLay | |
533 | } //end loop on window sizes | |
534 | } //end loop on theLay | |
12b1afb7 | 535 | }//end loop on min points |
5a03f353 | 536 | |
8403ece4 | 537 | // search for 1-point tracks in SPD, only for cosmics |
5a03f353 | 538 | // (A.Dainese 21.03.08) |
539 | if(AliITSReconstructor::GetRecoParam()->GetSAOnePointTracks() && | |
540 | TMath::Abs(event->GetMagneticField())<0.01) { | |
8403ece4 | 541 | Int_t outerLayer=1; // only SPD |
542 | for(Int_t innLay=0; innLay<=TMath::Min(1,fOuterStartLayer); innLay++) { | |
5a03f353 | 543 | // counter for clusters on each layer |
deae0246 | 544 | |
5a03f353 | 545 | for(Int_t nloop=0;nloop<fNloop;nloop++){ |
546 | Int_t nclInnLay=fCluLayer[innLay]->GetEntries(); | |
547 | while(nclInnLay--){ //loop starting from layer innLay | |
548 | ResetForFinding(); | |
12b1afb7 | 549 | Bool_t useRP=SetFirstPoint(innLay,nclInnLay,primaryVertex); |
550 | if(!useRP) continue; | |
f2150e42 | 551 | AliITStrackSA trs; |
12b1afb7 | 552 | |
553 | Int_t pflag=0; | |
5a03f353 | 554 | Int_t kk; |
deae0246 | 555 | for(kk=0;kk<AliITSgeomTGeo::GetNLayers();kk++) nClusLay[kk] = 0; |
5a03f353 | 556 | |
557 | kk=0; | |
deae0246 | 558 | nClusLay[kk] = SearchClusters(innLay,fPhiWin[nloop],fLambdaWin[nloop], |
f2150e42 | 559 | &trs,primaryVertex[2],pflag); |
8403ece4 | 560 | for(Int_t nextLay=innLay+1; nextLay<=outerLayer; nextLay++) { |
5a03f353 | 561 | kk++; |
deae0246 | 562 | nClusLay[kk] = SearchClusters(nextLay,fPhiWin[nloop],fLambdaWin[nloop], |
f2150e42 | 563 | &trs,primaryVertex[2],pflag); |
deae0246 | 564 | if(nClusLay[kk]!=0){ |
5a03f353 | 565 | pflag=1; |
566 | if(kk==1) { | |
567 | fPoint3[0]=fPointc[0]; | |
568 | fPoint3[1]=fPointc[1]; | |
569 | } else { | |
570 | UpdatePoints(); | |
571 | } | |
572 | } | |
573 | } | |
574 | ||
575 | Int_t layOK=0; | |
576 | for(Int_t nnp=0;nnp<AliITSgeomTGeo::GetNLayers()-innLay;nnp++){ | |
deae0246 | 577 | if(nClusLay[nnp]!=0) layOK+=1; |
5a03f353 | 578 | } |
579 | if(layOK==1) { | |
b881f1fd | 580 | AliDebug(2,Form("----NPOINTS: %d; MAP: %d %d %d %d %d %d\n",layOK,nClusLay[0],nClusLay[1],nClusLay[2],nClusLay[3],nClusLay[4],nClusLay[5])); |
5a03f353 | 581 | AliITStrackV2* tr2 = 0; |
582 | Bool_t onePoint = kTRUE; | |
f2150e42 | 583 | tr2 = FitTrack(&trs,primaryVertex,onePoint); |
92bb7af4 | 584 | if(!tr2){ |
92bb7af4 | 585 | continue; |
586 | } | |
b881f1fd | 587 | AliDebug(2,Form("----NPOINTS fit: %d\n",tr2->GetNumberOfClusters())); |
5a03f353 | 588 | |
3bfb5cac | 589 | StoreTrack(tr2,event,useAllClusters); |
5a03f353 | 590 | ntrack++; |
591 | ||
592 | } | |
593 | ||
5a03f353 | 594 | }//end loop on clusters of innLay |
595 | } //end loop on window sizes | |
596 | ||
5a03f353 | 597 | } //end loop on innLay |
598 | } // end search 1-point tracks | |
ebda3140 | 599 | |
3bfb5cac | 600 | if(!useAllClusters) AliInfo(Form("Number of found tracks: %d",event->GetNumberOfTracks())); |
2d03436a | 601 | ResetForFinding(); |
2257f27e | 602 | return 0; |
bef31448 | 603 | |
604 | } | |
7e5bf5af | 605 | |
13918578 | 606 | //________________________________________________________________________ |
607 | ||
5a03f353 | 608 | AliITStrackV2* AliITStrackerSA::FitTrack(AliITStrackSA* tr,Double_t *primaryVertex,Bool_t onePoint) { |
ebda3140 | 609 | //fit of the found track (most general case, also <6 points, layers missing) |
610 | // A.Dainese 16.11.07 | |
13918578 | 611 | |
13918578 | 612 | |
deae0246 | 613 | const Int_t kMaxClu=AliITStrackSA::kMaxNumberOfClusters; |
13918578 | 614 | |
e8432c6d | 615 | static Int_t firstmod[AliITSgeomTGeo::kNLayers]; |
deae0246 | 616 | static Int_t clind[AliITSgeomTGeo::kNLayers][kMaxClu]; |
617 | static Int_t clmark[AliITSgeomTGeo::kNLayers][kMaxClu]; | |
deae0246 | 618 | static Int_t end[AliITSgeomTGeo::kNLayers]; |
e8432c6d | 619 | static Int_t indices[AliITSgeomTGeo::kNLayers]; |
620 | ||
deae0246 | 621 | static AliITSRecPoint *listlayer[AliITSgeomTGeo::kNLayers][kMaxClu]; |
13918578 | 622 | |
ebda3140 | 623 | for(Int_t i=0;i<AliITSgeomTGeo::GetNLayers();i++) { |
b8ed1a92 | 624 | firstmod[i]=AliITSgeomTGeo::GetModuleIndex(i+1,1,1); |
deae0246 | 625 | end[i]=0; |
626 | for(Int_t j=0;j<kMaxClu; j++){ | |
ebda3140 | 627 | clind[i][j]=0; |
628 | clmark[i][j]=0; | |
deae0246 | 629 | listlayer[i][j]=0; |
630 | } | |
b8ed1a92 | 631 | } |
2755f080 | 632 | |
2755f080 | 633 | |
634 | Int_t nclusters = tr->GetNumberOfClustersSA(); | |
2755f080 | 635 | for(Int_t ncl=0;ncl<nclusters;ncl++){ |
636 | Int_t index = tr->GetClusterIndexSA(ncl); | |
637 | AliITSRecPoint* cl = (AliITSRecPoint*)GetCluster(index); | |
2755f080 | 638 | Int_t lay = (index & 0xf0000000) >> 28; |
deae0246 | 639 | Int_t nInLay=end[lay]; |
640 | listlayer[lay][nInLay]=cl; | |
5691e727 | 641 | clind[lay][nInLay]=index; |
deae0246 | 642 | end[lay]++; |
2755f080 | 643 | } |
2755f080 | 644 | |
645 | for(Int_t nlay=0;nlay<AliITSgeomTGeo::GetNLayers();nlay++){ | |
646 | for(Int_t ncl=0;ncl<tr->GetNumberOfMarked(nlay);ncl++){ | |
647 | Int_t mark = tr->GetClusterMark(nlay,ncl); | |
5691e727 | 648 | clmark[nlay][ncl]=mark; |
2755f080 | 649 | } |
650 | } | |
651 | ||
2755f080 | 652 | |
653 | Int_t firstLay=-1,secondLay=-1; | |
2755f080 | 654 | for(Int_t i=0;i<AliITSgeomTGeo::GetNLayers();i++) { |
deae0246 | 655 | if(end[i]==0) { |
2755f080 | 656 | end[i]=1; |
deae0246 | 657 | }else{ |
2755f080 | 658 | if(firstLay==-1) { |
659 | firstLay=i; | |
660 | } else if(secondLay==-1) { | |
661 | secondLay=i; | |
662 | } | |
663 | } | |
664 | } | |
665 | ||
deae0246 | 666 | if(firstLay==-1 || (secondLay==-1 && !onePoint)) return 0; |
f2150e42 | 667 | TClonesArray &arrMI= *fListOfTracks; |
668 | TClonesArray &arrSA= *fListOfSATracks; | |
669 | Int_t nFoundTracks=0; | |
670 | ||
e8432c6d | 671 | |
2755f080 | 672 | for(Int_t l0=0;l0<end[0];l0++){ //loop on layer 1 |
e8432c6d | 673 | indices[0]=l0; |
2755f080 | 674 | for(Int_t l1=0;l1<end[1];l1++){ //loop on layer 2 |
e8432c6d | 675 | indices[1]=l1; |
2755f080 | 676 | for(Int_t l2=0;l2<end[2];l2++){ //loop on layer 3 |
e8432c6d | 677 | indices[2]=l2; |
2755f080 | 678 | for(Int_t l3=0;l3<end[3];l3++){ //loop on layer 4 |
e8432c6d | 679 | indices[3]=l3; |
2755f080 | 680 | for(Int_t l4=0;l4<end[4];l4++){ //loop on layer 5 |
e8432c6d | 681 | indices[4]=l4; |
2755f080 | 682 | for(Int_t l5=0;l5<end[5];l5++){ //loop on layer 6 |
e8432c6d | 683 | indices[5]=l5; |
2755f080 | 684 | |
e8432c6d | 685 | // estimate curvature from 2 innermost points (or innermost point + vertex) |
686 | ||
687 | Int_t iFirstLay=indices[firstLay]; | |
688 | Int_t mrk1=clmark[firstLay][iFirstLay]; | |
2755f080 | 689 | |
e8432c6d | 690 | AliITSRecPoint* p1=(AliITSRecPoint*)listlayer[firstLay][iFirstLay]; |
2755f080 | 691 | Int_t module1 = p1->GetDetectorIndex()+firstmod[firstLay]; |
5a03f353 | 692 | Int_t layer,ladder,detector; |
693 | AliITSgeomTGeo::GetModuleId(module1,layer,ladder,detector); | |
694 | Float_t yclu1 = p1->GetY(); | |
695 | Float_t zclu1 = p1->GetZ(); | |
e8432c6d | 696 | |
697 | Double_t x1,y1,z1; | |
698 | Double_t x2,y2,z2; | |
5a03f353 | 699 | Double_t cv=0,tgl2=0,phi2=0; |
e8432c6d | 700 | AliITSclusterTable* arr1 = (AliITSclusterTable*)GetClusterCoord(firstLay,mrk1); |
2755f080 | 701 | x1 = arr1->GetX(); |
2755f080 | 702 | y1 = arr1->GetY(); |
2755f080 | 703 | z1 = arr1->GetZ(); |
225a692b | 704 | |
5a03f353 | 705 | if(secondLay>0) { |
e8432c6d | 706 | Int_t iSecondLay=indices[secondLay]; |
707 | Int_t mrk2=clmark[secondLay][iSecondLay]; | |
708 | AliITSclusterTable* arr2 = (AliITSclusterTable*)GetClusterCoord(secondLay,mrk2); | |
5a03f353 | 709 | x2 = arr2->GetX(); |
710 | y2 = arr2->GetY(); | |
711 | z2 = arr2->GetZ(); | |
5a03f353 | 712 | cv = Curvature(primaryVertex[0],primaryVertex[1],x1,y1,x2,y2); |
713 | tgl2 = (z2-z1)/TMath::Sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)); | |
714 | phi2 = TMath::ATan2((y2-y1),(x2-x1)); | |
715 | } else { // special case of 1-point tracks, only for cosmics (B=0) | |
716 | x2 = primaryVertex[0]; | |
717 | y2 = primaryVertex[1]; | |
718 | z2 = primaryVertex[2]; | |
719 | cv = 0; | |
720 | tgl2 = (z1-z2)/TMath::Sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)); | |
721 | phi2 = TMath::ATan2((y1-y2),(x1-x2)); | |
722 | } | |
723 | ||
e8432c6d | 724 | // create track and attach it the RecPoints |
f2150e42 | 725 | AliITStrackSA trac(layer,ladder,detector,yclu1,zclu1,phi2,tgl2,cv,1); |
e8432c6d | 726 | for(Int_t iLay=5; iLay>=0; iLay--){ |
727 | Int_t iInLay=indices[iLay]; | |
728 | AliITSRecPoint* cl=(AliITSRecPoint*)listlayer[iLay][iInLay]; | |
729 | if(cl!=0){ | |
730 | trac.AddClusterV2(iLay,(clind[iLay][iInLay] & 0x0fffffff)>>0); | |
731 | trac.AddClusterMark(iLay,clmark[iLay][iInLay]); | |
732 | } | |
b8ed1a92 | 733 | } |
734 | ||
b8ed1a92 | 735 | //fit with Kalman filter using AliITStrackerMI::RefitAt() |
f2150e42 | 736 | AliITStrackSA ot(trac); |
737 | ||
738 | ot.ResetCovariance(10.); | |
739 | ot.ResetClusters(); | |
b8ed1a92 | 740 | |
b881f1fd | 741 | // Propagate inside the innermost layer with a cluster |
f2150e42 | 742 | if(ot.Propagate(ot.GetX()-0.1*ot.GetX())) { |
b881f1fd | 743 | |
f2150e42 | 744 | if(RefitAt(AliITSRecoParam::GetrInsideITSscreen(),&ot,&trac)){ //fit from layer 1 to layer 6 |
745 | AliITStrackMI otrack2(ot); | |
746 | otrack2.ResetCovariance(10.); | |
747 | otrack2.ResetClusters(); | |
b881f1fd | 748 | //fit from layer 6 to layer 1 |
f2150e42 | 749 | if(RefitAt(AliITSRecoParam::GetrInsideSPD1(),&otrack2,&ot)) { |
750 | new(arrMI[nFoundTracks]) AliITStrackMI(otrack2); | |
751 | new(arrSA[nFoundTracks]) AliITStrackSA(trac); | |
752 | ++nFoundTracks; | |
b881f1fd | 753 | } |
b8ed1a92 | 754 | |
b881f1fd | 755 | } |
756 | } | |
b8ed1a92 | 757 | }//end loop layer 6 |
758 | }//end loop layer 5 | |
759 | }//end loop layer 4 | |
760 | }//end loop layer 3 | |
761 | }//end loop layer 2 | |
762 | }//end loop layer 1 | |
763 | ||
b8ed1a92 | 764 | |
225a692b | 765 | |
b8ed1a92 | 766 | |
deae0246 | 767 | if(fListOfTracks->GetEntries()==0) return 0; |
b8ed1a92 | 768 | |
deae0246 | 769 | Int_t lowchi2 = FindTrackLowChiSquare(); |
b8ed1a92 | 770 | AliITStrackV2* otrack =(AliITStrackV2*)fListOfTracks->At(lowchi2); |
deae0246 | 771 | AliITStrackSA* trsa = (AliITStrackSA*)fListOfSATracks->At(lowchi2); |
b8ed1a92 | 772 | |
deae0246 | 773 | if(otrack==0) return 0; |
774 | ||
b8ed1a92 | 775 | CookLabel(otrack,0.); //MI change - to see fake ratio |
ee16fb28 | 776 | Int_t label=FindLabel(otrack); |
b8ed1a92 | 777 | otrack->SetLabel(label); |
5ee2a45c | 778 | Double_t low=0.; |
779 | Double_t up=0.51; | |
780 | otrack->CookdEdx(low,up); | |
b8ed1a92 | 781 | |
782 | //remove clusters of found track | |
783 | for(Int_t nlay=0;nlay<AliITSgeomTGeo::GetNLayers();nlay++){ | |
784 | for(Int_t cln=0;cln<trsa->GetNumberOfMarked(nlay);cln++){ | |
785 | Int_t index = trsa->GetClusterMark(nlay,cln); | |
786 | fCluLayer[nlay]->RemoveAt(index); | |
787 | RemoveClusterCoord(nlay,index); | |
788 | fCluLayer[nlay]->Compress(); | |
7e5bf5af | 789 | } |
790 | } | |
7e5bf5af | 791 | |
13918578 | 792 | return otrack; |
793 | ||
794 | } | |
795 | ||
c421499f | 796 | //_______________________________________________________ |
3bfb5cac | 797 | void AliITStrackerSA::StoreTrack(AliITStrackV2 *t,AliESDEvent *event, Bool_t pureSA) const |
c421499f | 798 | { |
799 | // | |
800 | // Add new track to the ESD | |
801 | // | |
802 | AliESDtrack outtrack; | |
803 | outtrack.UpdateTrackParams(t,AliESDtrack::kITSin); | |
3bfb5cac | 804 | if(pureSA) outtrack.SetStatus(AliESDtrack::kITSpureSA); |
c421499f | 805 | for(Int_t i=0;i<12;i++) { |
806 | outtrack.SetITSModuleIndex(i,t->GetModuleIndex(i)); | |
807 | } | |
09cf9d66 | 808 | Double_t sdedx[4]={0.,0.,0.,0.}; |
809 | for(Int_t i=0; i<4; i++) sdedx[i]=t->GetSampledEdx(i); | |
810 | outtrack.SetITSdEdxSamples(sdedx); | |
c421499f | 811 | event->AddTrack(&outtrack); |
812 | ||
813 | return; | |
814 | } | |
bef31448 | 815 | |
4e05ab9a | 816 | |
bef31448 | 817 | //_______________________________________________________ |
7e5bf5af | 818 | Int_t AliITStrackerSA::SearchClusters(Int_t layer,Double_t phiwindow,Double_t lambdawindow, AliITStrackSA* trs,Double_t /*zvertex*/,Int_t pflag){ |
13918578 | 819 | //function used to to find the clusters associated to the track |
2755f080 | 820 | |
4fa7f7d1 | 821 | if(ForceSkippingOfLayer(layer)) return 0; |
2755f080 | 822 | |
13918578 | 823 | Int_t nc=0; |
824 | AliITSlayer &lay = fgLayers[layer]; | |
7e5bf5af | 825 | Double_t r=lay.GetR(); |
2755f080 | 826 | if(pflag==1){ |
cfe729e0 | 827 | Float_t cx1,cx2,cy1,cy2; |
828 | FindEquation(fPoint1[0],fPoint1[1],fPoint2[0],fPoint2[1],fPoint3[0],fPoint3[1],fCoef1,fCoef2,fCoef3); | |
829 | if (FindIntersection(fCoef1,fCoef2,fCoef3,-r*r,cx1,cy1,cx2,cy2)==0) | |
830 | return 0; | |
1966f03c | 831 | Double_t fi1=TMath::ATan2(cy1-fPoint1[1],cx1-fPoint1[0]); |
832 | Double_t fi2=TMath::ATan2(cy2-fPoint1[1],cx2-fPoint1[0]); | |
cfe729e0 | 833 | fPhiEstimate=ChoosePoint(fi1,fi2,fPhic); |
834 | } | |
13918578 | 835 | |
7e5bf5af | 836 | |
837 | Int_t ncl = fCluLayer[layer]->GetEntries(); | |
838 | for (Int_t index=0; index<ncl; index++) { | |
00a7cc50 | 839 | AliITSRecPoint *c = (AliITSRecPoint*)fCluLayer[layer]->At(index); |
7e5bf5af | 840 | if (!c) continue; |
841 | if (c->GetQ()<=0) continue; | |
3733ccd2 | 842 | if(layer>1 && c->GetQ()<=fMinQ) continue; |
7e5bf5af | 843 | |
844 | AliITSclusterTable* arr = (AliITSclusterTable*)GetClusterCoord(layer,index); | |
845 | Double_t phi = arr->GetPhi(); | |
cfe729e0 | 846 | if (TMath::Abs(phi-fPhiEstimate)>phiwindow) continue; |
494fda7c | 847 | |
7e5bf5af | 848 | Double_t lambda = arr->GetLambda(); |
cfe729e0 | 849 | if (TMath::Abs(lambda-fLambdac)>lambdawindow) continue; |
850 | ||
7e5bf5af | 851 | if(trs->GetNumberOfClustersSA()==trs->GetMaxNumberOfClusters()) return 0; |
852 | if(trs->GetNumberOfMarked(layer)==trs->GetMaxNMarkedPerLayer()) return 0; | |
853 | Int_t orind = arr->GetOrInd(); | |
854 | trs->AddClusterSA(layer,orind); | |
855 | trs->AddClusterMark(layer,index); | |
cfe729e0 | 856 | nc++; |
857 | fLambdac=lambda; | |
858 | fPhiEstimate=phi; | |
cfe729e0 | 859 | |
7e5bf5af | 860 | fPointc[0]=arr->GetX(); |
861 | fPointc[1]=arr->GetY(); | |
862 | ||
cfe729e0 | 863 | } |
864 | return nc; | |
865 | } | |
13918578 | 866 | |
12b1afb7 | 867 | //________________________________________________________________ |
868 | Bool_t AliITStrackerSA::SetFirstPoint(Int_t lay, Int_t clu, Double_t* primaryVertex){ | |
869 | // Sets the first point (seed) for tracking | |
870 | ||
871 | AliITSRecPoint* cl = (AliITSRecPoint*)fCluLayer[lay]->At(clu); | |
872 | if(!cl) return kFALSE; | |
873 | if (cl->GetQ()<=0) return kFALSE; | |
874 | if(lay>1 && cl->GetQ()<=fMinQ) return kFALSE; | |
875 | ||
876 | AliITSclusterTable* arr = (AliITSclusterTable*)GetClusterCoord(lay,clu); | |
877 | fPhic = arr->GetPhi(); | |
878 | fLambdac = arr->GetLambda(); | |
879 | fPhiEstimate = fPhic; | |
880 | fPoint1[0]=primaryVertex[0]; | |
881 | fPoint1[1]=primaryVertex[1]; | |
882 | fPoint2[0]=arr->GetX(); | |
883 | fPoint2[1]=arr->GetY(); | |
884 | return kTRUE; | |
885 | } | |
886 | ||
bef31448 | 887 | //________________________________________________________________ |
888 | void AliITStrackerSA::UpdatePoints(){ | |
889 | //update of points for the estimation of the curvature | |
13918578 | 890 | |
bef31448 | 891 | fPoint2[0]=fPoint3[0]; |
892 | fPoint2[1]=fPoint3[1]; | |
893 | fPoint3[0]=fPointc[0]; | |
894 | fPoint3[1]=fPointc[1]; | |
13918578 | 895 | |
896 | ||
13918578 | 897 | } |
13918578 | 898 | |
13918578 | 899 | //___________________________________________________________________ |
900 | Int_t AliITStrackerSA::FindEquation(Float_t x1, Float_t y1, Float_t x2, Float_t y2, Float_t x3, Float_t y3,Float_t& a, Float_t& b, Float_t& c){ | |
901 | ||
902 | //given (x,y) of three recpoints (in global coordinates) | |
903 | //returns the parameters a,b,c of circonference x*x + y*y +a*x + b*y +c | |
904 | ||
905 | Float_t den = (x3-x1)*(y2-y1)-(x2-x1)*(y3-y1); | |
906 | if(den==0) return 0; | |
907 | a = ((y3-y1)*(x2*x2+y2*y2-x1*x1-y1*y1)-(y2-y1)*(x3*x3+y3*y3-x1*x1-y1*y1))/den; | |
908 | b = -(x2*x2-x1*x1+y2*y2-y1*y1+a*(x2-x1))/(y2-y1); | |
909 | c = -x1*x1-y1*y1-a*x1-b*y1; | |
910 | return 1; | |
911 | } | |
912 | //__________________________________________________________________________ | |
913 | Int_t AliITStrackerSA::FindIntersection(Float_t a1, Float_t b1, Float_t c1, Float_t c2,Float_t& x1,Float_t& y1, Float_t& x2, Float_t& y2){ | |
914 | ||
915 | //Finds the intersection between the circonference of the track and the circonference centered in (0,0) represented by one layer | |
916 | //c2 is -rlayer*rlayer | |
917 | ||
918 | if(a1==0) return 0; | |
3a2f227d | 919 | Double_t m = c2-c1; |
920 | Double_t aA = (b1*b1)/(a1*a1)+1; | |
921 | Double_t bB = (-2*m*b1/(a1*a1)); | |
922 | Double_t cC = c2+(m*m)/(a1*a1); | |
923 | Double_t dD = bB*bB-4*aA*cC; | |
924 | if(dD<0) return 0; | |
13918578 | 925 | |
3a2f227d | 926 | y1 = (-bB+TMath::Sqrt(dD))/(2*aA); |
927 | y2 = (-bB-TMath::Sqrt(dD))/(2*aA); | |
13918578 | 928 | x1 = (c2-c1-b1*y1)/a1; |
929 | x2 = (c2-c1-b1*y2)/a1; | |
930 | ||
931 | return 1; | |
932 | } | |
933 | //____________________________________________________________________ | |
934 | Double_t AliITStrackerSA::Curvature(Double_t x1,Double_t y1,Double_t | |
935 | x2,Double_t y2,Double_t x3,Double_t y3){ | |
936 | ||
937 | //calculates the curvature of track | |
938 | Double_t den = (x3-x1)*(y2-y1)-(x2-x1)*(y3-y1); | |
939 | if(den==0) return 0; | |
940 | Double_t a = ((y3-y1)*(x2*x2+y2*y2-x1*x1-y1*y1)-(y2-y1)*(x3*x3+y3*y3-x1*x1-y1*y1))/den; | |
941 | Double_t b = -(x2*x2-x1*x1+y2*y2-y1*y1+a*(x2-x1))/(y2-y1); | |
942 | Double_t c = -x1*x1-y1*y1-a*x1-b*y1; | |
943 | Double_t xc=-a/2.; | |
944 | ||
945 | if((a*a+b*b-4*c)<0) return 0; | |
946 | Double_t rad = TMath::Sqrt(a*a+b*b-4*c)/2.; | |
947 | if(rad==0) return 0; | |
948 | ||
949 | if((x1>0 && y1>0 && x1<xc)) rad*=-1; | |
950 | if((x1<0 && y1>0 && x1<xc)) rad*=-1; | |
951 | // if((x1<0 && y1<0 && x1<xc)) rad*=-1; | |
952 | // if((x1>0 && y1<0 && x1<xc)) rad*=-1; | |
953 | ||
954 | return 1/rad; | |
955 | ||
956 | } | |
7e5bf5af | 957 | |
958 | ||
13918578 | 959 | //____________________________________________________________________ |
960 | Double_t AliITStrackerSA::ChoosePoint(Double_t p1, Double_t p2, Double_t pp){ | |
961 | ||
962 | //Returns the point closest to pp | |
963 | ||
964 | Double_t diff1 = p1-pp; | |
965 | Double_t diff2 = p2-pp; | |
966 | ||
967 | if(TMath::Abs(diff1)<TMath::Abs(diff2)) fPhiEstimate=p1; | |
968 | else fPhiEstimate=p2; | |
969 | return fPhiEstimate; | |
970 | ||
971 | } | |
972 | ||
973 | ||
974 | //_________________________________________________________________ | |
deae0246 | 975 | Int_t AliITStrackerSA::FindTrackLowChiSquare() const { |
976 | // returns track with lowest chi square | |
977 | Int_t dim=fListOfTracks->GetEntries(); | |
978 | if(dim<=1) return 0; | |
979 | AliITStrackV2* trk = (AliITStrackV2*)fListOfTracks->At(0); | |
980 | Double_t minChi2=trk->GetChi2(); | |
981 | Int_t index=0; | |
982 | for(Int_t i=1;i<dim;i++){ | |
4adcf390 | 983 | trk = (AliITStrackV2*)fListOfTracks->At(i); |
deae0246 | 984 | Double_t chi2=trk->GetChi2(); |
985 | if(chi2<minChi2){ | |
986 | minChi2=chi2; | |
987 | index=i; | |
13918578 | 988 | } |
13918578 | 989 | } |
deae0246 | 990 | return index; |
13918578 | 991 | } |
992 | ||
993 | //__________________________________________________________ | |
ee16fb28 | 994 | Int_t AliITStrackerSA::FindLabel(AliITStrackV2* track){ |
995 | // | |
13918578 | 996 | |
ee16fb28 | 997 | Int_t labl[AliITSgeomTGeo::kNLayers][3]; |
998 | Int_t cnts[AliITSgeomTGeo::kNLayers][3]; | |
999 | for(Int_t j=0;j<AliITSgeomTGeo::GetNLayers();j++){ | |
1000 | for(Int_t k=0;k<3;k++){ | |
1001 | labl[j][k]=-2; | |
1002 | cnts[j][k]=1; | |
13918578 | 1003 | } |
13918578 | 1004 | } |
ee16fb28 | 1005 | Int_t iNotLabel=0; |
1006 | for(Int_t i=0;i<track->GetNumberOfClusters(); i++) { | |
1007 | Int_t indexc = track->GetClusterIndex(i); | |
1008 | AliITSRecPoint* cl = (AliITSRecPoint*)GetCluster(indexc); | |
1009 | Int_t iLayer=cl->GetLayer(); | |
1010 | for(Int_t k=0;k<3;k++){ | |
1011 | labl[iLayer][k]=cl->GetLabel(k); | |
1012 | if(labl[iLayer][k]<0) iNotLabel++; | |
1013 | } | |
1014 | } | |
1015 | if(iNotLabel==3*track->GetNumberOfClusters()) return -2; | |
1016 | ||
1017 | for(Int_t j1=0;j1<AliITSgeomTGeo::kNLayers; j1++) { | |
1018 | for(Int_t j2=0; j2<j1; j2++){ | |
1019 | for(Int_t k1=0; k1<3; k1++){ | |
1020 | for(Int_t k2=0; k2<3; k2++){ | |
1021 | if(labl[j1][k1]>=0 && labl[j1][k1]==labl[j2][k2] && cnts[j2][k2]>0){ | |
1022 | cnts[j2][k2]++; | |
1023 | cnts[j1][k1]=0; | |
1024 | } | |
1025 | } | |
1026 | } | |
13918578 | 1027 | } |
13918578 | 1028 | } |
13918578 | 1029 | |
13918578 | 1030 | |
ee16fb28 | 1031 | Int_t cntMax=0; |
1032 | Int_t label=-1; | |
1033 | for(Int_t j=0;j<AliITSgeomTGeo::kNLayers;j++){ | |
1034 | for(Int_t k=0;k<3;k++){ | |
1035 | if(cnts[j][k]>cntMax && labl[j][k]>=0){ | |
1036 | cntMax=cnts[j][k]; | |
1037 | label=labl[j][k]; | |
1038 | } | |
1039 | } | |
13918578 | 1040 | } |
1041 | ||
ee16fb28 | 1042 | Int_t lflag=0; |
1043 | for(Int_t i=0;i<AliITSgeomTGeo::kNLayers;i++) | |
1044 | if(labl[i][0]==label || labl[i][1]==label || labl[i][2]==label) lflag++; | |
13918578 | 1045 | |
ee16fb28 | 1046 | if(lflag<track->GetNumberOfClusters()) label = -label; |
1047 | return label; | |
13918578 | 1048 | } |
13918578 | 1049 | //_____________________________________________________________________________ |
5b4dedce | 1050 | void AliITStrackerSA::SetCalculatedWindowSizes(Int_t n, Float_t phimin, Float_t phimax, Float_t lambdamin, Float_t lambdamax){ |
1051 | // Set sizes of the phi and lambda windows used for track finding | |
1052 | fNloop = n; | |
1053 | if(fPhiWin) delete [] fPhiWin; | |
1054 | if(fLambdaWin) delete [] fLambdaWin; | |
1055 | fPhiWin = new Double_t[fNloop]; | |
1056 | fLambdaWin = new Double_t[fNloop]; | |
1057 | Float_t stepPhi=(phimax-phimin)/(Float_t)(fNloop-1); | |
1058 | Float_t stepLambda=(lambdamax-lambdamin)/(Float_t)(fNloop-1); | |
1059 | for(Int_t k=0;k<fNloop;k++){ | |
1060 | Float_t phi=phimin+k*stepPhi; | |
1061 | Float_t lam=lambdamin+k*stepLambda; | |
1062 | fPhiWin[k]=phi; | |
1063 | fLambdaWin[k]=lam; | |
1064 | } | |
1065 | } | |
1066 | //_____________________________________________________________________________ | |
1067 | void AliITStrackerSA::SetFixedWindowSizes(Int_t n, Double_t *phi, Double_t *lam){ | |
13918578 | 1068 | // Set sizes of the phi and lambda windows used for track finding |
1069 | fNloop = n; | |
1070 | if(phi){ // user defined values | |
1071 | fPhiWin = new Double_t[fNloop]; | |
1072 | fLambdaWin = new Double_t[fNloop]; | |
1073 | for(Int_t k=0;k<fNloop;k++){ | |
1074 | fPhiWin[k]=phi[k]; | |
1075 | fLambdaWin[k]=lam[k]; | |
1076 | } | |
1077 | } | |
1078 | else { // default values | |
627b6db6 | 1079 | |
1080 | Double_t phid[33] = {0.002,0.003,0.004,0.0045,0.0047, | |
bef31448 | 1081 | 0.005,0.0053,0.0055, |
1082 | 0.006,0.0063,0.0065,0.007,0.0073,0.0075,0.0077, | |
1083 | 0.008,0.0083,0.0085,0.0087,0.009,0.0095,0.0097, | |
627b6db6 | 1084 | 0.01,0.0105,0.011,0.0115,0.012,0.0125,0.013,0.0135,0.0140,0.0145}; |
1085 | Double_t lambdad[33] = {0.003,0.004,0.005,0.005,0.005, | |
1086 | 0.005,0.005,0.006, | |
1087 | 0.006,0.006,0.006,0.007,0.007,0.007,0.007, | |
1088 | 0.007,0.007,0.007,0.007,0.007,0.007,0.007, | |
1089 | 0.008,0.008,0.008,0.008,0.008,0.008,0.008,0.008,0.008,0.008}; | |
bef31448 | 1090 | |
627b6db6 | 1091 | if(fNloop!=33){ |
1092 | fNloop = 33; | |
13918578 | 1093 | } |
627b6db6 | 1094 | |
1095 | ||
13918578 | 1096 | fPhiWin = new Double_t[fNloop]; |
1097 | fLambdaWin = new Double_t[fNloop]; | |
e340bb86 | 1098 | |
e340bb86 | 1099 | Double_t factor=AliITSReconstructor::GetRecoParam()->GetFactorSAWindowSizes(); // possibility to enlarge windows for cosmics reco with large misalignments (A.Dainese) |
2755f080 | 1100 | |
1101 | for(Int_t k=0;k<fNloop;k++){ | |
e340bb86 | 1102 | fPhiWin[k]=phid[k]*factor; |
1103 | fLambdaWin[k]=lambdad[k]*factor; | |
13918578 | 1104 | } |
1105 | ||
1106 | } | |
1107 | ||
1108 | } | |
7e5bf5af | 1109 | //_______________________________________________________________________ |
cc088660 | 1110 | void AliITStrackerSA::GetCoorAngles(AliITSRecPoint* cl,Double_t &phi,Double_t &lambda, Float_t &x, Float_t &y,Float_t &z,Double_t* vertex){ |
7e5bf5af | 1111 | //Returns values of phi (azimuthal) and lambda angles for a given cluster |
cc088660 | 1112 | /* |
7e5bf5af | 1113 | Double_t rot[9]; fGeom->GetRotMatrix(module,rot); |
1114 | Int_t lay,lad,det; fGeom->GetModuleId(module,lay,lad,det); | |
1115 | Float_t tx,ty,tz; fGeom->GetTrans(lay,lad,det,tx,ty,tz); | |
1116 | ||
1117 | Double_t alpha=TMath::ATan2(rot[1],rot[0])+TMath::Pi(); | |
1118 | Double_t phi1=TMath::Pi()/2+alpha; | |
1119 | if (lay==1) phi1+=TMath::Pi(); | |
1120 | ||
1121 | Float_t cp=TMath::Cos(phi1), sp=TMath::Sin(phi1); | |
1122 | Float_t r=tx*cp+ty*sp; | |
1123 | ||
cc088660 | 1124 | xyz= r*cp - cl->GetY()*sp; |
7e5bf5af | 1125 | y= r*sp + cl->GetY()*cp; |
1126 | z=cl->GetZ(); | |
cc088660 | 1127 | */ |
1128 | Float_t xyz[3]; | |
1129 | cl->GetGlobalXYZ(xyz); | |
1130 | x=xyz[0]; | |
1131 | y=xyz[1]; | |
1132 | z=xyz[2]; | |
1133 | ||
1966f03c | 1134 | phi=TMath::ATan2(y-vertex[1],x-vertex[0]); |
7e5bf5af | 1135 | lambda=TMath::ATan2(z-vertex[2],TMath::Sqrt((x-vertex[0])*(x-vertex[0])+(y-vertex[1])*(y-vertex[1]))); |
1136 | } | |
13918578 | 1137 | |
7e5bf5af | 1138 | //________________________________________________________________________ |
cc088660 | 1139 | void AliITStrackerSA::GetCoorErrors(AliITSRecPoint* cl,Float_t &sx,Float_t &sy, Float_t &sz){ |
7e5bf5af | 1140 | |
cc088660 | 1141 | //returns sigmax, y, z of cluster in global coordinates |
1142 | /* | |
7e5bf5af | 1143 | Double_t rot[9]; fGeom->GetRotMatrix(module,rot); |
cc088660 | 1144 | Int_t lay,lad,det; |
1145 | AliITSgeomTGeo::GetModuleId(module,lay,lad,det); | |
7e5bf5af | 1146 | |
1147 | Double_t alpha=TMath::ATan2(rot[1],rot[0])+TMath::Pi(); | |
1148 | Double_t phi=TMath::Pi()/2+alpha; | |
1149 | if (lay==1) phi+=TMath::Pi(); | |
1150 | ||
1151 | Float_t cp=TMath::Cos(phi), sp=TMath::Sin(phi); | |
cc088660 | 1152 | */ |
1153 | Float_t covm[6]; | |
1154 | cl->GetGlobalCov(covm); | |
1155 | sx=TMath::Sqrt(covm[0]); | |
1156 | sy=TMath::Sqrt(covm[3]); | |
1157 | sz=TMath::Sqrt(covm[5]); | |
1158 | /* | |
7e5bf5af | 1159 | sx = TMath::Sqrt(sp*sp*cl->GetSigmaY2()); |
1160 | sy = TMath::Sqrt(cp*cp*cl->GetSigmaY2()); | |
1161 | sz = TMath::Sqrt(cl->GetSigmaZ2()); | |
cc088660 | 1162 | */ |
7e5bf5af | 1163 | } |
f2150e42 | 1164 |