]>
Commit | Line | Data |
---|---|---|
70c95f95 | 1 | /************************************************************************** |
2 | * Copyright(c) 2006-2008, 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 | #include <AliESDVertex.h> | |
16 | #include <AliITSVertexer3D.h> | |
17 | #include <AliStrLine.h> | |
18 | #include <AliVertexerTracks.h> | |
19 | #include <Riostream.h> | |
20 | #include <TH3F.h> | |
21 | #include <TTree.h> | |
22 | #include<TClonesArray.h> | |
cd706e57 | 23 | #include "AliLog.h" |
70c95f95 | 24 | #include "AliRunLoader.h" |
25 | #include "AliITSLoader.h" | |
26 | #include "AliITSgeom.h" | |
27 | #include "AliITSDetTypeRec.h" | |
28 | #include "AliITSRecPoint.h" | |
29 | ///////////////////////////////////////////////////////////////// | |
30 | // this class implements a method to determine | |
31 | // the 3 coordinates of the primary vertex | |
32 | // for p-p collisions | |
33 | // It can be used successfully with Pb-Pb collisions | |
34 | //////////////////////////////////////////////////////////////// | |
35 | ||
36 | ClassImp(AliITSVertexer3D) | |
37 | ||
38 | //______________________________________________________________________ | |
39 | AliITSVertexer3D::AliITSVertexer3D():AliITSVertexer(), | |
40 | fLines(), | |
41 | fVert3D(), | |
42 | fCoarseDiffPhiCut(0.), | |
05d1294c | 43 | fCoarseMaxRCut(0.), |
70c95f95 | 44 | fMaxRCut(0.), |
45 | fZCutDiamond(0.), | |
05d1294c | 46 | fMaxZCut(0.), |
70c95f95 | 47 | fDCAcut(0.), |
48 | fDiffPhiMax(0.) { | |
49 | // Default constructor | |
50 | SetCoarseDiffPhiCut(); | |
05d1294c | 51 | SetCoarseMaxRCut(); |
70c95f95 | 52 | SetMaxRCut(); |
53 | SetZCutDiamond(); | |
05d1294c | 54 | SetMaxZCut(); |
70c95f95 | 55 | SetDCAcut(); |
56 | SetDiffPhiMax(); | |
57 | ||
58 | } | |
59 | ||
60 | //______________________________________________________________________ | |
61 | AliITSVertexer3D::AliITSVertexer3D(TString fn): AliITSVertexer(fn), | |
62 | fLines(), | |
63 | fVert3D(), | |
05d1294c | 64 | fCoarseDiffPhiCut(0.), |
65 | fCoarseMaxRCut(0.), | |
70c95f95 | 66 | fMaxRCut(0.), |
67 | fZCutDiamond(0.), | |
05d1294c | 68 | fMaxZCut(0.), |
70c95f95 | 69 | fDCAcut(0.), |
70 | fDiffPhiMax(0.) { | |
71 | // Standard constructor | |
72 | fLines = new TClonesArray("AliStrLine",1000); | |
73 | SetCoarseDiffPhiCut(); | |
05d1294c | 74 | SetCoarseMaxRCut(); |
70c95f95 | 75 | SetMaxRCut(); |
76 | SetZCutDiamond(); | |
05d1294c | 77 | SetMaxZCut(); |
70c95f95 | 78 | SetDCAcut(); |
79 | SetDiffPhiMax(); | |
80 | } | |
81 | ||
82 | //______________________________________________________________________ | |
83 | AliITSVertexer3D::~AliITSVertexer3D() { | |
84 | // Destructor | |
85 | fVert3D = 0; // this object is not owned by this class | |
86 | if(fLines){ | |
87 | fLines->Delete(); | |
88 | delete fLines; | |
89 | } | |
90 | } | |
91 | ||
92 | //______________________________________________________________________ | |
93 | AliESDVertex* AliITSVertexer3D::FindVertexForCurrentEvent(Int_t evnumber){ | |
94 | // Defines the AliESDVertex for the current event | |
cd706e57 | 95 | AliDebug(1,Form("FindVertexForCurrentEvent - 3D - PROCESSING EVENT %d",evnumber)); |
70c95f95 | 96 | fVert3D = 0; |
97 | if(fLines)fLines->Clear(); | |
98 | ||
99 | Int_t nolines = FindTracklets(evnumber,0); | |
100 | fCurrentVertex = 0; | |
101 | if(nolines<2)return fCurrentVertex; | |
05d1294c | 102 | Int_t rc=Prepare3DVertex(0); |
70c95f95 | 103 | if(rc==0)Find3DVertex(); |
104 | if(fVert3D){ | |
105 | if(fLines) fLines->Delete(); | |
106 | nolines = FindTracklets(evnumber,1); | |
d35ad08f | 107 | if(nolines>=2){ |
05d1294c | 108 | rc=Prepare3DVertex(1); |
d35ad08f | 109 | if(rc==0)Find3DVertex(); |
110 | } | |
70c95f95 | 111 | } |
112 | ||
113 | if(fVert3D){ | |
114 | fCurrentVertex = new AliESDVertex(); | |
115 | fCurrentVertex->SetTitle("vertexer: 3D"); | |
116 | fCurrentVertex->SetName("Vertex"); | |
117 | fCurrentVertex->SetXv(fVert3D->GetXv()); | |
118 | fCurrentVertex->SetYv(fVert3D->GetYv()); | |
119 | fCurrentVertex->SetZv(fVert3D->GetZv()); | |
120 | fCurrentVertex->SetDispersion(fVert3D->GetDispersion()); | |
121 | fCurrentVertex->SetNContributors(fVert3D->GetNContributors()); | |
122 | } | |
123 | FindMultiplicity(evnumber); | |
124 | return fCurrentVertex; | |
125 | } | |
126 | ||
127 | //______________________________________________________________________ | |
128 | Int_t AliITSVertexer3D::FindTracklets(Int_t evnumber, Int_t optCuts){ | |
129 | // All the possible combinations between recpoints on layer 1and 2 are | |
130 | // considered. Straight lines (=tracklets)are formed. | |
131 | // The tracklets are processed in Prepare3DVertex | |
132 | AliRunLoader *rl =AliRunLoader::GetRunLoader(); | |
133 | AliITSLoader* itsLoader = (AliITSLoader*)rl->GetLoader("ITSLoader"); | |
134 | AliITSgeom* geom = itsLoader->GetITSgeom(); | |
135 | itsLoader->LoadRecPoints(); | |
136 | rl->GetEvent(evnumber); | |
137 | ||
138 | AliITSDetTypeRec detTypeRec; | |
139 | ||
140 | TTree *tR = itsLoader->TreeR(); | |
141 | detTypeRec.SetTreeAddressR(tR); | |
142 | TClonesArray *itsRec = 0; | |
143 | // lc and gc are local and global coordinates for layer 1 | |
144 | Float_t lc[3]; for(Int_t ii=0; ii<3; ii++) lc[ii]=0.; | |
145 | Float_t gc[3]; for(Int_t ii=0; ii<3; ii++) gc[ii]=0.; | |
146 | // lc2 and gc2 are local and global coordinates for layer 2 | |
147 | Float_t lc2[3]; for(Int_t ii=0; ii<3; ii++) lc2[ii]=0.; | |
148 | Float_t gc2[3]; for(Int_t ii=0; ii<3; ii++) gc2[ii]=0.; | |
149 | ||
150 | itsRec = detTypeRec.RecPoints(); | |
151 | TBranch *branch; | |
152 | branch = tR->GetBranch("ITSRecPoints"); | |
153 | ||
154 | // Set values for cuts | |
155 | Float_t xbeam=0., ybeam=0.; | |
05d1294c | 156 | Float_t zvert=0.; |
70c95f95 | 157 | Float_t deltaPhi=fCoarseDiffPhiCut; |
05d1294c | 158 | Float_t deltaR=fCoarseMaxRCut; |
159 | Float_t dZmax=fZCutDiamond; | |
70c95f95 | 160 | if(optCuts){ |
161 | xbeam=fVert3D->GetXv(); | |
162 | ybeam=fVert3D->GetYv(); | |
05d1294c | 163 | zvert=fVert3D->GetZv(); |
70c95f95 | 164 | deltaPhi = fDiffPhiMax; |
05d1294c | 165 | deltaR=fMaxRCut; |
166 | dZmax=fMaxZCut; | |
70c95f95 | 167 | } |
70c95f95 | 168 | Int_t nrpL1 = 0; // number of rec points on layer 1 |
169 | Int_t nrpL2 = 0; // number of rec points on layer 2 | |
170 | ||
171 | // By default irstL1=0 and lastL1=79 | |
172 | Int_t irstL1 = geom->GetStartDet(0); | |
173 | Int_t lastL1 = geom->GetModuleIndex(2,1,1)-1; | |
174 | for(Int_t module= irstL1; module<=lastL1;module++){ // count number of recopints on layer 1 | |
175 | branch->GetEvent(module); | |
176 | nrpL1+= itsRec->GetEntries(); | |
177 | detTypeRec.ResetRecPoints(); | |
178 | } | |
179 | //By default irstL2=80 and lastL2=239 | |
180 | Int_t irstL2 = geom->GetModuleIndex(2,1,1); | |
181 | Int_t lastL2 = geom->GetLastDet(0); | |
182 | for(Int_t module= irstL2; module<=lastL2;module++){ // count number of recopints on layer 2 | |
183 | branch->GetEvent(module); | |
184 | nrpL2+= itsRec->GetEntries(); | |
185 | detTypeRec.ResetRecPoints(); | |
186 | } | |
187 | if(nrpL1 == 0 || nrpL2 == 0){ | |
188 | itsLoader->UnloadRecPoints(); | |
189 | return -1; | |
190 | } | |
cd706e57 | 191 | AliDebug(1,Form("RecPoints on Layer 1,2 = %d, %d\n",nrpL1,nrpL2)); |
70c95f95 | 192 | |
193 | Double_t a[3]={xbeam,ybeam,0.}; | |
194 | Double_t b[3]={xbeam,ybeam,10.}; | |
195 | AliStrLine zeta(a,b,kTRUE); | |
196 | ||
197 | Int_t nolines = 0; | |
198 | // Loop on modules of layer 1 | |
199 | for(Int_t modul1= irstL1; modul1<=lastL1;modul1++){ // Loop on modules of layer 1 | |
200 | branch->GetEvent(modul1); | |
201 | Int_t nrecp1 = itsRec->GetEntries(); | |
202 | TClonesArray *prpl1 = new TClonesArray("AliITSRecPoint",nrecp1); | |
203 | prpl1->SetOwner(); | |
204 | TClonesArray &rpl1 = *prpl1; | |
205 | for(Int_t j=0;j<nrecp1;j++){ | |
206 | AliITSRecPoint *recp = (AliITSRecPoint*)itsRec->At(j); | |
207 | new(rpl1[j])AliITSRecPoint(*recp); | |
208 | } | |
209 | detTypeRec.ResetRecPoints(); | |
210 | for(Int_t j=0;j<nrecp1;j++){ | |
211 | AliITSRecPoint *recp = (AliITSRecPoint*)prpl1->At(j); | |
212 | // Local coordinates of this recpoint | |
213 | lc[0]=recp->GetDetLocalX(); | |
214 | lc[2]=recp->GetDetLocalZ(); | |
215 | geom->LtoG(modul1,lc,gc); // global coordinates | |
216 | Double_t phi1 = TMath::ATan2(gc[1]-ybeam,gc[0]-xbeam); | |
217 | if(phi1<0)phi1=2*TMath::Pi()+phi1; | |
218 | for(Int_t modul2= irstL2; modul2<=lastL2;modul2++){ | |
219 | branch->GetEvent(modul2); | |
220 | Int_t nrecp2 = itsRec->GetEntries(); | |
221 | for(Int_t j2=0;j2<nrecp2;j2++){ | |
222 | recp = (AliITSRecPoint*)itsRec->At(j2); | |
223 | lc2[0]=recp->GetDetLocalX(); | |
224 | lc2[2]=recp->GetDetLocalZ(); | |
225 | geom->LtoG(modul2,lc2,gc2); | |
226 | Double_t phi2 = TMath::ATan2(gc2[1]-ybeam,gc2[0]-xbeam); | |
227 | if(phi2<0)phi2=2*TMath::Pi()+phi2; | |
228 | Double_t diff = TMath::Abs(phi2-phi1); | |
229 | if(diff>TMath::Pi())diff=2.*TMath::Pi()-diff; | |
230 | if(diff>deltaPhi)continue; | |
231 | AliStrLine line(gc,gc2,kTRUE); | |
232 | Double_t cp[3]; | |
233 | Int_t retcode = line.Cross(&zeta,cp); | |
234 | if(retcode<0)continue; | |
235 | Double_t dca = line.GetDCA(&zeta); | |
236 | if(dca<0.) continue; | |
05d1294c | 237 | if(dca>deltaR)continue; |
238 | Double_t deltaZ=cp[2]-zvert; | |
239 | if(TMath::Abs(deltaZ)>dZmax)continue; | |
70c95f95 | 240 | MakeTracklet(gc,gc2,nolines); |
241 | } | |
242 | detTypeRec.ResetRecPoints(); | |
243 | } | |
244 | } | |
245 | delete prpl1; | |
246 | } | |
247 | if(nolines == 0)return -2; | |
248 | return nolines; | |
249 | } | |
250 | ||
251 | //______________________________________________________________________ | |
252 | void AliITSVertexer3D::FindVertices(){ | |
253 | // computes the vertices of the events in the range FirstEvent - LastEvent | |
254 | AliRunLoader *rl = AliRunLoader::GetRunLoader(); | |
255 | AliITSLoader* itsLoader = (AliITSLoader*) rl->GetLoader("ITSLoader"); | |
256 | itsLoader->ReloadRecPoints(); | |
257 | for(Int_t i=fFirstEvent;i<=fLastEvent;i++){ | |
258 | rl->GetEvent(i); | |
259 | FindVertexForCurrentEvent(i); | |
260 | if(fCurrentVertex){ | |
261 | WriteCurrentVertex(); | |
262 | } | |
263 | } | |
264 | } | |
265 | ||
266 | ||
267 | //______________________________________________________________________ | |
268 | void AliITSVertexer3D::Find3DVertex(){ | |
269 | // Determines the vertex position | |
270 | // same algorithm as in AliVertexerTracks::StrLinVertexFinderMinDist(0) | |
271 | // adapted to pure AliStrLine objects | |
272 | ||
273 | Int_t knacc = fLines->GetEntriesFast(); | |
274 | Double_t (*vectP0)[3]=new Double_t [knacc][3]; | |
275 | Double_t (*vectP1)[3]=new Double_t [knacc][3]; | |
276 | ||
277 | Double_t sum[3][3]; | |
278 | Double_t dsum[3]={0,0,0}; | |
279 | for(Int_t i=0;i<3;i++) | |
280 | for(Int_t j=0;j<3;j++)sum[i][j]=0; | |
281 | for(Int_t i=0; i<knacc; i++){ | |
282 | AliStrLine *line1 = (AliStrLine*)fLines->At(i); | |
283 | ||
284 | Double_t p0[3],cd[3]; | |
285 | line1->GetP0(p0); | |
286 | line1->GetCd(cd); | |
287 | Double_t p1[3]={p0[0]+cd[0],p0[1]+cd[1],p0[2]+cd[2]}; | |
288 | vectP0[i][0]=p0[0]; | |
289 | vectP0[i][1]=p0[1]; | |
290 | vectP0[i][2]=p0[2]; | |
291 | vectP1[i][0]=p1[0]; | |
292 | vectP1[i][1]=p1[1]; | |
293 | vectP1[i][2]=p1[2]; | |
294 | ||
295 | Double_t matr[3][3]; | |
296 | Double_t dknow[3]; | |
297 | AliVertexerTracks::GetStrLinDerivMatrix(p0,p1,matr,dknow); | |
298 | ||
299 | for(Int_t iii=0;iii<3;iii++){ | |
300 | dsum[iii]+=dknow[iii]; | |
301 | for(Int_t lj=0;lj<3;lj++) sum[iii][lj]+=matr[iii][lj]; | |
302 | } | |
303 | } | |
304 | ||
305 | Double_t vett[3][3]; | |
306 | Double_t det=AliVertexerTracks::GetDeterminant3X3(sum); | |
307 | Double_t initPos[3]; | |
308 | Double_t sigma = 0.; | |
309 | for(Int_t i=0;i<3;i++)initPos[i]=0.; | |
310 | ||
311 | Int_t goodvert=0; | |
312 | ||
313 | if(det!=0){ | |
314 | for(Int_t zz=0;zz<3;zz++){ | |
315 | for(Int_t ww=0;ww<3;ww++){ | |
316 | for(Int_t kk=0;kk<3;kk++) vett[ww][kk]=sum[ww][kk]; | |
317 | } | |
318 | for(Int_t kk=0;kk<3;kk++) vett[kk][zz]=dsum[kk]; | |
319 | initPos[zz]=AliVertexerTracks::GetDeterminant3X3(vett)/det; | |
320 | } | |
321 | ||
322 | Double_t rvert=TMath::Sqrt(initPos[0]*initPos[0]+initPos[1]*initPos[1]); | |
323 | Double_t zvert=initPos[2]; | |
05d1294c | 324 | if(rvert<fCoarseMaxRCut && TMath::Abs(zvert)<fZCutDiamond){ |
70c95f95 | 325 | for(Int_t i=0; i<knacc; i++){ |
326 | Double_t p0[3]={0,0,0},p1[3]={0,0,0}; | |
327 | for(Int_t ii=0;ii<3;ii++){ | |
328 | p0[ii]=vectP0[i][ii]; | |
329 | p1[ii]=vectP1[i][ii]; | |
330 | } | |
331 | sigma+=AliVertexerTracks::GetStrLinMinDist(p0,p1,initPos); | |
332 | } | |
333 | sigma=TMath::Sqrt(sigma); | |
334 | goodvert=1; | |
335 | } | |
336 | } | |
337 | delete vectP0; | |
338 | delete vectP1; | |
339 | if(!goodvert){ | |
340 | Warning("Find3DVertex","Finder did not succed"); | |
341 | for(Int_t i=0;i<3;i++)initPos[i]=0.; | |
342 | sigma=999; | |
343 | knacc=-1; | |
344 | } | |
345 | if(fVert3D){ | |
346 | fVert3D-> SetXYZ(initPos); | |
347 | fVert3D->SetDispersion(sigma); | |
348 | fVert3D->SetNContributors(knacc); | |
349 | }else{ | |
350 | fVert3D = new AliVertex(initPos,sigma,knacc); | |
351 | } | |
cd706e57 | 352 | // fVert3D->Print(); |
70c95f95 | 353 | } |
354 | ||
355 | ||
356 | ||
357 | //______________________________________________________________________ | |
05d1294c | 358 | Int_t AliITSVertexer3D::Prepare3DVertex(Int_t optCuts){ |
70c95f95 | 359 | // Finds the 3D vertex information using tracklets |
360 | Int_t retcode = -1; | |
361 | ||
05d1294c | 362 | Float_t xbeam=0.; |
363 | Float_t ybeam=0.; | |
364 | Float_t zvert=0.; | |
365 | Float_t deltaR=fCoarseMaxRCut; | |
366 | Float_t dZmax=fZCutDiamond; | |
367 | if(optCuts){ | |
368 | xbeam=fVert3D->GetXv(); | |
369 | ybeam=fVert3D->GetYv(); | |
370 | zvert=fVert3D->GetZv(); | |
371 | deltaR=fMaxRCut; | |
372 | dZmax=fMaxZCut; | |
373 | } | |
374 | ||
70c95f95 | 375 | Int_t nbr=50; |
05d1294c | 376 | Float_t rl=-fCoarseMaxRCut; |
377 | Float_t rh=fCoarseMaxRCut; | |
70c95f95 | 378 | Int_t nbz=100; |
379 | Float_t zl=-fZCutDiamond; | |
380 | Float_t zh=fZCutDiamond; | |
381 | Float_t binsizer=(rh-rl)/nbr; | |
382 | Float_t binsizez=(zh-zl)/nbz; | |
383 | TH3F *h3d = new TH3F("h3d","xyz distribution",nbr,rl,rh,nbr,rl,rh,nbz,zl,zh); | |
384 | ||
385 | ||
386 | // cleanup of the TCLonesArray of tracklets (i.e. fakes are removed) | |
387 | Int_t *validate = new Int_t [fLines->GetEntriesFast()]; | |
388 | for(Int_t i=0; i<fLines->GetEntriesFast();i++)validate[i]=0; | |
70c95f95 | 389 | for(Int_t i=0; i<fLines->GetEntriesFast()-1;i++){ |
05d1294c | 390 | if(validate[i]==1)continue; |
70c95f95 | 391 | AliStrLine *l1 = (AliStrLine*)fLines->At(i); |
392 | for(Int_t j=i+1;j<fLines->GetEntriesFast();j++){ | |
393 | AliStrLine *l2 = (AliStrLine*)fLines->At(j); | |
05d1294c | 394 | Float_t dca=l1->GetDCA(l2); |
395 | if(dca > fDCAcut || dca<0.00001) continue; | |
70c95f95 | 396 | Double_t point[3]; |
397 | Int_t retc = l1->Cross(l2,point); | |
398 | if(retc<0)continue; | |
399 | Double_t rad=TMath::Sqrt(point[0]*point[0]+point[1]*point[1]); | |
05d1294c | 400 | if(rad>fCoarseMaxRCut)continue; |
401 | Double_t deltaX=point[0]-xbeam; | |
402 | Double_t deltaY=point[1]-ybeam; | |
403 | Double_t deltaZ=point[2]-zvert; | |
404 | Double_t raddist=TMath::Sqrt(deltaX*deltaX+deltaY*deltaY); | |
405 | if(TMath::Abs(deltaZ)>dZmax)continue; | |
406 | if(raddist>deltaR)continue; | |
70c95f95 | 407 | validate[i]++; |
408 | validate[j]++; | |
409 | h3d->Fill(point[0],point[1],point[2]); | |
410 | } | |
411 | } | |
412 | ||
413 | ||
414 | ||
70c95f95 | 415 | Int_t numbtracklets=0; |
416 | for(Int_t i=0; i<fLines->GetEntriesFast();i++)if(validate[i]>=1)numbtracklets++; | |
417 | if(numbtracklets<2){delete [] validate; delete h3d; return retcode; } | |
418 | ||
419 | for(Int_t i=0; i<fLines->GetEntriesFast();i++){ | |
420 | if(validate[i]<1)fLines->RemoveAt(i); | |
421 | } | |
422 | fLines->Compress(); | |
cd706e57 | 423 | AliDebug(1,Form("Number of tracklets (after compress)%d ",fLines->GetEntriesFast())); |
70c95f95 | 424 | delete [] validate; |
425 | ||
05d1294c | 426 | |
427 | // finds peak in histo | |
70c95f95 | 428 | TAxis *xax = h3d->GetXaxis(); |
429 | TAxis *yax = h3d->GetYaxis(); | |
430 | TAxis *zax = h3d->GetZaxis(); | |
70c95f95 | 431 | Double_t peak[3]={0.,0.,0.}; |
432 | Float_t contref = 0.; | |
433 | for(Int_t i=xax->GetFirst();i<=xax->GetLast();i++){ | |
434 | Float_t xval = xax->GetBinCenter(i); | |
435 | for(Int_t j=yax->GetFirst();j<=yax->GetLast();j++){ | |
436 | Float_t yval = yax->GetBinCenter(j); | |
437 | for(Int_t k=zax->GetFirst();k<=zax->GetLast();k++){ | |
438 | Float_t bc = h3d->GetBinContent(i,j,k); | |
439 | Float_t zval = zax->GetBinCenter(k); | |
440 | if(bc>contref){ | |
441 | contref = bc; | |
442 | peak[2] = zval; | |
443 | peak[1] = yval; | |
444 | peak[0] = xval; | |
445 | } | |
446 | } | |
447 | } | |
448 | } | |
449 | delete h3d; | |
450 | ||
451 | // Second selection loop | |
452 | Float_t bs=(binsizer+binsizez)/2.; | |
05d1294c | 453 | for(Int_t i=0; i<fLines->GetEntriesFast();i++){ |
70c95f95 | 454 | AliStrLine *l1 = (AliStrLine*)fLines->At(i); |
455 | if(l1->GetDistFromPoint(peak)>2.5*bs)fLines->RemoveAt(i); | |
456 | } | |
457 | fLines->Compress(); | |
cd706e57 | 458 | AliDebug(1,Form("Number of tracklets (after 2nd compression) %d",fLines->GetEntriesFast())); |
70c95f95 | 459 | |
460 | ||
461 | if(fLines->GetEntriesFast()>1){ | |
462 | Find3DVertex(); // find a first candidate for the primary vertex | |
463 | // make a further selection on tracklets based on this first candidate | |
464 | fVert3D->GetXYZ(peak); | |
cd706e57 | 465 | AliDebug(1,Form("FIRSTgv Ma V candidate: %f ; %f ; %f",peak[0],peak[1],peak[2])); |
05d1294c | 466 | for(Int_t i=0; i<fLines->GetEntriesFast();i++){ |
70c95f95 | 467 | AliStrLine *l1 = (AliStrLine*)fLines->At(i); |
468 | if(l1->GetDistFromPoint(peak)> fDCAcut)fLines->RemoveAt(i); | |
469 | } | |
470 | fLines->Compress(); | |
cd706e57 | 471 | AliDebug(1,Form("Number of tracklets (after 3rd compression) %d",fLines->GetEntriesFast())); |
70c95f95 | 472 | if(fLines->GetEntriesFast()>1){ |
473 | retcode = 0; // this last tracklet selection will be used | |
474 | delete fVert3D; | |
475 | fVert3D = 0; | |
476 | } | |
477 | else { | |
478 | retcode =1; // the previous tracklet selection will be used | |
479 | } | |
480 | } | |
481 | else { | |
482 | retcode = 0; | |
483 | } | |
484 | return retcode; | |
485 | } | |
486 | ||
487 | //______________________________________________________________________ | |
488 | void AliITSVertexer3D::MakeTracklet(Double_t *pA, Double_t *pB, Int_t &nolines) { | |
489 | // makes a tracklet | |
490 | TClonesArray &lines = *fLines; | |
491 | if(nolines == 0){ | |
492 | if(fLines->GetEntriesFast()>0)fLines->Clear(); | |
493 | } | |
494 | if(fLines->GetEntriesFast()==fLines->GetSize()){ | |
495 | Int_t newsize=(Int_t) 1.5*fLines->GetEntriesFast(); | |
496 | fLines->Expand(newsize); | |
497 | } | |
498 | ||
499 | new(lines[nolines++])AliStrLine(pA,pB,kTRUE); | |
500 | } | |
501 | ||
502 | //______________________________________________________________________ | |
503 | void AliITSVertexer3D::MakeTracklet(Float_t *pA, Float_t *pB, Int_t &nolines) {// Makes a tracklet | |
504 | // | |
505 | Double_t a[3],b[3]; | |
506 | for(Int_t i=0;i<3;i++){ | |
507 | a[i] = pA[i]; | |
508 | b[i] = pB[i]; | |
509 | } | |
510 | MakeTracklet(a,b,nolines); | |
511 | } | |
512 | ||
513 | //________________________________________________________ | |
514 | void AliITSVertexer3D::PrintStatus() const { | |
515 | // Print current status | |
516 | cout <<"=======================================================\n"; | |
517 | cout << "Loose cut on Delta Phi "<<fCoarseDiffPhiCut<<endl; | |
05d1294c | 518 | cout << "Cut on tracklet DCA to Z axis "<<fCoarseMaxRCut<<endl; |
519 | cout << "Cut on tracklet DCA to beam axis "<<fMaxRCut<<endl; | |
70c95f95 | 520 | cout << "Cut on diamond (Z) "<<fZCutDiamond<<endl; |
521 | cout << "Cut on DCA - tracklet to tracklet and to vertex "<<fDCAcut<<endl; | |
522 | cout <<" Max Phi difference: "<<fDiffPhiMax<<endl; | |
523 | ||
524 | ||
525 | cout <<"=======================================================\n"; | |
526 | } |