]>
Commit | Line | Data |
---|---|---|
cd90f0a2 | 1 | /**************************************************************************\r |
2 | * Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. *\r | |
3 | * *\r | |
4 | * Author: The ALICE Off-line Project. *\r | |
5 | * Contributors are mentioned in the code where appropriate. *\r | |
6 | * *\r | |
7 | * Permission to use, copy, modify and distribute this software and its *\r | |
8 | * documentation strictly for non-commercial purposes is hereby granted *\r | |
9 | * without fee, provided that the above copyright notice appears in all *\r | |
10 | * copies and that both the copyright notice and this permission notice *\r | |
11 | * appear in the supporting documentation. The authors make no claims *\r | |
12 | * about the suitability of this software for any purpose. It is *\r | |
13 | * provided "as is" without express or implied warranty. *\r | |
14 | **************************************************************************/\r | |
15 | /* $Id$ */\r | |
16 | \r | |
17 | //-------------------------------------------------------------------------\r | |
18 | // Implementation of the on-the-fly v0 finder for ITS tracker MI\r | |
19 | // Origin: Marian Ivanov, CERN, Marian.Ivanov@cern.ch \r | |
20 | // Extraction from AliITStrackerMI: Andrea Dainese\r | |
21 | // Current support and development: \r | |
22 | //-------------------------------------------------------------------------\r | |
23 | \r | |
24 | #include <TMatrixD.h>\r | |
25 | #include <TTree.h>\r | |
26 | #include <TString.h>\r | |
27 | #include <TRandom.h>\r | |
28 | #include <TTreeStream.h>\r | |
29 | \r | |
30 | \r | |
31 | #include "AliLog.h"\r | |
32 | #include "AliESDVertex.h"\r | |
33 | #include "AliESDEvent.h"\r | |
34 | #include "AliESDtrack.h"\r | |
35 | #include "AliV0.h"\r | |
36 | #include "AliHelix.h"\r | |
37 | #include "AliITSRecPoint.h"\r | |
38 | #include "AliITSReconstructor.h"\r | |
39 | #include "AliITStrackerMI.h"\r | |
40 | #include "AliITSV0Finder.h"\r | |
767aaecb | 41 | #include "AliKFParticle.h"\r |
61673d36 | 42 | #include "AliKFVertex.h"\r |
cd90f0a2 | 43 | \r |
44 | ClassImp(AliITSV0Finder)\r | |
45 | \r | |
767aaecb | 46 | \r |
47 | AliITSV0Finder::AliITSV0Finder():\r | |
48 | fDebugStreamer(0)\r | |
49 | {\r | |
cd90f0a2 | 50 | //Default constructor\r |
767aaecb | 51 | \r |
c0b60eb0 | 52 | if (AliITSReconstructor::GetRecoParam()->GetESDV0Params()->StreamLevel()>0)\r |
53 | fDebugStreamer = new TTreeSRedirector("ITSdebug.root");\r | |
767aaecb | 54 | } \r |
55 | \r | |
cd90f0a2 | 56 | //------------------------------------------------------------------------\r |
57 | void AliITSV0Finder::UpdateTPCV0(const AliESDEvent *event,\r | |
58 | AliITStrackerMI *tracker)\r | |
59 | {\r | |
60 | //\r | |
61 | //try to update, or reject TPC V0s\r | |
62 | //\r | |
767aaecb | 63 | const Float_t kMinTgl2= AliITSReconstructor::GetRecoParam()->GetESDV0Params()->GetMinTgl2();\r |
64 | \r | |
cd90f0a2 | 65 | TObjArray *trackHypothesys = tracker->GetTrackHypothesys();\r |
66 | \r | |
67 | Int_t nv0s = event->GetNumberOfV0s();\r | |
68 | Int_t nitstracks = trackHypothesys->GetEntriesFast();\r | |
69 | \r | |
70 | for (Int_t i=0;i<nv0s;i++){\r | |
71 | AliESDv0 * vertex = event->GetV0(i);\r | |
72 | Int_t ip = vertex->GetIndex(0);\r | |
73 | Int_t im = vertex->GetIndex(1);\r | |
74 | //\r | |
75 | TObjArray * arrayp = (ip<nitstracks) ? (TObjArray*)trackHypothesys->At(ip):0;\r | |
76 | TObjArray * arraym = (im<nitstracks) ? (TObjArray*)trackHypothesys->At(im):0;\r | |
77 | AliITStrackMI * trackp = (arrayp!=0) ? (AliITStrackMI*)arrayp->At(0):0;\r | |
78 | AliITStrackMI * trackm = (arraym!=0) ? (AliITStrackMI*)arraym->At(0):0;\r | |
79 | //\r | |
80 | //\r | |
81 | if (trackp){\r | |
82 | if (trackp->GetNumberOfClusters()+trackp->GetNDeadZone()>5.5){\r | |
83 | if (trackp->GetConstrain()&&trackp->GetChi2MIP(0)<3) vertex->SetStatus(-100);\r | |
84 | if (!trackp->GetConstrain()&&trackp->GetChi2MIP(0)<2) vertex->SetStatus(-100); \r | |
85 | }\r | |
86 | }\r | |
87 | \r | |
88 | if (trackm){\r | |
89 | if (trackm->GetNumberOfClusters()+trackm->GetNDeadZone()>5.5){\r | |
90 | if (trackm->GetConstrain()&&trackm->GetChi2MIP(0)<3) vertex->SetStatus(-100);\r | |
91 | if (!trackm->GetConstrain()&&trackm->GetChi2MIP(0)<2) vertex->SetStatus(-100); \r | |
92 | }\r | |
93 | }\r | |
94 | if (vertex->GetStatus()==-100) continue;\r | |
95 | //\r | |
96 | Double_t xrp[3]; vertex->GetXYZ(xrp[0],xrp[1],xrp[2]); //I.B.\r | |
97 | Int_t clayer = tracker->GetNearestLayer(xrp); //I.B.\r | |
98 | vertex->SetNBefore(clayer); //\r | |
99 | vertex->SetChi2Before(9*clayer); //\r | |
100 | vertex->SetNAfter(6-clayer); //\r | |
101 | vertex->SetChi2After(0); //\r | |
102 | //\r | |
103 | if (clayer >1 ){ // calculate chi2 before vertex\r | |
104 | Float_t chi2p = 0, chi2m=0; \r | |
105 | //\r | |
106 | if (trackp){\r | |
107 | for (Int_t ilayer=0;ilayer<clayer;ilayer++){\r | |
108 | if (trackp->GetClIndex(ilayer)>=0){\r | |
109 | chi2p+=trackp->GetDy(ilayer)*trackp->GetDy(ilayer)/(trackp->GetSigmaY(ilayer)*trackp->GetSigmaY(ilayer))+\r | |
110 | trackp->GetDz(ilayer)*trackp->GetDz(ilayer)/(trackp->GetSigmaZ(ilayer)*trackp->GetSigmaZ(ilayer));\r | |
111 | }\r | |
112 | else{\r | |
113 | chi2p+=9;\r | |
114 | }\r | |
115 | }\r | |
116 | }else{\r | |
117 | chi2p = 9*clayer;\r | |
118 | }\r | |
119 | //\r | |
120 | if (trackm){\r | |
121 | for (Int_t ilayer=0;ilayer<clayer;ilayer++){\r | |
122 | if (trackm->GetClIndex(ilayer)>=0){\r | |
123 | chi2m+=trackm->GetDy(ilayer)*trackm->GetDy(ilayer)/(trackm->GetSigmaY(ilayer)*trackm->GetSigmaY(ilayer))+\r | |
124 | trackm->GetDz(ilayer)*trackm->GetDz(ilayer)/(trackm->GetSigmaZ(ilayer)*trackm->GetSigmaZ(ilayer));\r | |
125 | }\r | |
126 | else{\r | |
127 | chi2m+=9;\r | |
128 | }\r | |
129 | }\r | |
130 | }else{\r | |
131 | chi2m = 9*clayer;\r | |
132 | }\r | |
133 | vertex->SetChi2Before(TMath::Min(chi2p,chi2m));\r | |
134 | if (TMath::Min(chi2p,chi2m)/Float_t(clayer)<4) vertex->SetStatus(-10); // track exist before vertex\r | |
135 | }\r | |
136 | \r | |
137 | if (clayer < 5 ){ // calculate chi2 after vertex\r | |
138 | Float_t chi2p = 0, chi2m=0; \r | |
139 | //\r | |
767aaecb | 140 | if (trackp&&TMath::Abs(trackp->GetTgl())<kMinTgl2){\r |
cd90f0a2 | 141 | for (Int_t ilayer=clayer;ilayer<6;ilayer++){\r |
142 | if (trackp->GetClIndex(ilayer)>=0){\r | |
143 | chi2p+=trackp->GetDy(ilayer)*trackp->GetDy(ilayer)/(trackp->GetSigmaY(ilayer)*trackp->GetSigmaY(ilayer))+\r | |
144 | trackp->GetDz(ilayer)*trackp->GetDz(ilayer)/(trackp->GetSigmaZ(ilayer)*trackp->GetSigmaZ(ilayer));\r | |
145 | }\r | |
146 | else{\r | |
147 | chi2p+=9;\r | |
148 | }\r | |
149 | }\r | |
150 | }else{\r | |
151 | chi2p = 0;\r | |
152 | }\r | |
153 | //\r | |
767aaecb | 154 | if (trackm&&TMath::Abs(trackm->GetTgl())<kMinTgl2){\r |
cd90f0a2 | 155 | for (Int_t ilayer=clayer;ilayer<6;ilayer++){\r |
156 | if (trackm->GetClIndex(ilayer)>=0){\r | |
157 | chi2m+=trackm->GetDy(ilayer)*trackm->GetDy(ilayer)/(trackm->GetSigmaY(ilayer)*trackm->GetSigmaY(ilayer))+\r | |
158 | trackm->GetDz(ilayer)*trackm->GetDz(ilayer)/(trackm->GetSigmaZ(ilayer)*trackm->GetSigmaZ(ilayer));\r | |
159 | }\r | |
160 | else{\r | |
161 | chi2m+=9;\r | |
162 | }\r | |
163 | }\r | |
164 | }else{\r | |
165 | chi2m = 0;\r | |
166 | }\r | |
167 | vertex->SetChi2After(TMath::Max(chi2p,chi2m));\r | |
168 | if (TMath::Max(chi2m,chi2p)/Float_t(6-clayer)>9) vertex->SetStatus(-20); // track not found in ITS\r | |
169 | }\r | |
170 | }\r | |
171 | //\r | |
172 | }\r | |
173 | //------------------------------------------------------------------------\r | |
174 | void AliITSV0Finder::FindV02(AliESDEvent *event,\r | |
175 | AliITStrackerMI *tracker) \r | |
176 | {\r | |
177 | //\r | |
178 | // V0 finder\r | |
179 | //\r | |
180 | // Cuts on DCA - R dependent\r | |
181 | // max distance DCA between 2 tracks cut \r | |
182 | // maxDist = TMath::Min(kMaxDist,kMaxDist0+pvertex->GetRr()*kMaxDist);\r | |
183 | //\r | |
767aaecb | 184 | const Float_t kMaxDist0 = AliITSReconstructor::GetRecoParam()->GetESDV0Params()->GetMaxDist0();\r |
185 | const Float_t kMaxDist1 = AliITSReconstructor::GetRecoParam()->GetESDV0Params()->GetMaxDist1();\r | |
186 | const Float_t kMaxDist = AliITSReconstructor::GetRecoParam()->GetESDV0Params()->GetMaxDist();\r | |
187 | const Float_t kMinPointAngle = AliITSReconstructor::GetRecoParam()->GetESDV0Params()->GetMinPointAngle();\r | |
188 | const Float_t kMinPointAngle2 = AliITSReconstructor::GetRecoParam()->GetESDV0Params()->GetMinPointAngle2();\r | |
189 | const Float_t kMinR = AliITSReconstructor::GetRecoParam()->GetESDV0Params()->GetMinR();\r | |
190 | const Float_t kMaxR = AliITSReconstructor::GetRecoParam()->GetESDV0Params()->GetMaxR();\r | |
61673d36 | 191 | const Float_t kMinPABestConst = AliITSReconstructor::GetRecoParam()->GetESDV0Params()->GetMinPABestConst();\r |
192 | const Float_t kMaxRBestConst = AliITSReconstructor::GetRecoParam()->GetESDV0Params()->GetMaxRBestConst();\r | |
767aaecb | 193 | const Float_t kCausality0Cut = AliITSReconstructor::GetRecoParam()->GetESDV0Params()->GetCausality0Cut();\r |
194 | const Float_t kLikelihood01Cut = AliITSReconstructor::GetRecoParam()->GetESDV0Params()->GetLikelihood01Cut();\r | |
195 | const Float_t kLikelihood1Cut = AliITSReconstructor::GetRecoParam()->GetESDV0Params()->GetLikelihood1Cut();\r | |
196 | const Float_t kCombinedCut = AliITSReconstructor::GetRecoParam()->GetESDV0Params()->GetCombinedCut();\r | |
b47f2a3f | 197 | const Float_t kMinClFullTrk= AliITSReconstructor::GetRecoParam()->GetESDV0Params()->GetMinClFullTrk();\r |
767aaecb | 198 | const Float_t kMinTgl0= AliITSReconstructor::GetRecoParam()->GetESDV0Params()->GetMinTgl0();\r |
61673d36 | 199 | const Float_t kMinRTgl0= AliITSReconstructor::GetRecoParam()->GetESDV0Params()->GetMinRTgl0();\r |
200 | \r | |
201 | const Float_t kMinNormDistForbTgl0= AliITSReconstructor::GetRecoParam()->GetESDV0Params()->GetMinNormDistForbTgl0();\r | |
202 | const Float_t kMinClForb0= AliITSReconstructor::GetRecoParam()->GetESDV0Params()->GetMinClForb0();\r | |
203 | const Float_t kMinNormDistForb1= AliITSReconstructor::GetRecoParam()->GetESDV0Params()->GetMinNormDistForb1();\r | |
204 | const Float_t kMinNormDistForb2= AliITSReconstructor::GetRecoParam()->GetESDV0Params()->GetMinNormDistForb2();\r | |
205 | const Float_t kMinNormDistForb3= AliITSReconstructor::GetRecoParam()->GetESDV0Params()->GetMinNormDistForb3();\r | |
206 | const Float_t kMinNormDistForb4= AliITSReconstructor::GetRecoParam()->GetESDV0Params()->GetMinNormDistForb4();\r | |
207 | const Float_t kMinNormDistForb5= AliITSReconstructor::GetRecoParam()->GetESDV0Params()->GetMinNormDistForb5();\r | |
83052b75 | 208 | const Float_t kMinNormDistForbProt= AliITSReconstructor::GetRecoParam()->GetESDV0Params()->GetMinNormDistForbProt();\r |
209 | const Float_t kMaxPidProbPionForb= AliITSReconstructor::GetRecoParam()->GetESDV0Params()->GetMaxPidProbPionForb();\r | |
61673d36 | 210 | \r |
211 | const Float_t kMinRTPCdensity= AliITSReconstructor::GetRecoParam()->GetESDV0Params()->GetMinRTPCdensity();\r | |
212 | const Float_t kMaxRTPCdensity0= AliITSReconstructor::GetRecoParam()->GetESDV0Params()->GetMaxRTPCdensity0();\r | |
213 | const Float_t kMaxRTPCdensity10= AliITSReconstructor::GetRecoParam()->GetESDV0Params()->GetMaxRTPCdensity10();\r | |
214 | const Float_t kMaxRTPCdensity20= AliITSReconstructor::GetRecoParam()->GetESDV0Params()->GetMaxRTPCdensity20();\r | |
215 | const Float_t kMaxRTPCdensity30= AliITSReconstructor::GetRecoParam()->GetESDV0Params()->GetMaxRTPCdensity30();\r | |
216 | \r | |
217 | \r | |
767aaecb | 218 | const Float_t kMinTPCdensity= AliITSReconstructor::GetRecoParam()->GetESDV0Params()->GetMinTPCdensity();\r |
219 | const Float_t kMinTgl1= AliITSReconstructor::GetRecoParam()->GetESDV0Params()->GetMinTgl1();\r | |
220 | \r | |
221 | const Float_t kMinchi2before0= AliITSReconstructor::GetRecoParam()->GetESDV0Params()->GetMinchi2before0();\r | |
222 | const Float_t kMinchi2before1= AliITSReconstructor::GetRecoParam()->GetESDV0Params()->GetMinchi2before1();\r | |
223 | const Float_t kMinchi2after0= AliITSReconstructor::GetRecoParam()->GetESDV0Params()->GetMinchi2after0();\r | |
224 | const Float_t kMinchi2after1= AliITSReconstructor::GetRecoParam()->GetESDV0Params()->GetMinchi2after1();\r | |
225 | const Float_t kAddchi2SharedCl= AliITSReconstructor::GetRecoParam()->GetESDV0Params()->GetAddchi2SharedCl();\r | |
226 | const Float_t kAddchi2NegCl0= AliITSReconstructor::GetRecoParam()->GetESDV0Params()->GetAddchi2NegCl0();\r | |
227 | const Float_t kAddchi2NegCl1= AliITSReconstructor::GetRecoParam()->GetESDV0Params()->GetAddchi2NegCl1();\r | |
228 | \r | |
229 | const Float_t kSigp0Par0= AliITSReconstructor::GetRecoParam()->GetESDV0Params()->GetSigp0Par0();\r | |
230 | const Float_t kSigp0Par1= AliITSReconstructor::GetRecoParam()->GetESDV0Params()->GetSigp0Par1();\r | |
231 | const Float_t kSigp0Par2= AliITSReconstructor::GetRecoParam()->GetESDV0Params()->GetSigp0Par2();\r | |
232 | \r | |
233 | const Float_t kSigpPar0= AliITSReconstructor::GetRecoParam()->GetESDV0Params()->GetSigpPar0();\r | |
234 | const Float_t kSigpPar1= AliITSReconstructor::GetRecoParam()->GetESDV0Params()->GetSigpPar1();\r | |
235 | const Float_t kSigpPar2= AliITSReconstructor::GetRecoParam()->GetESDV0Params()->GetSigpPar2();\r | |
61673d36 | 236 | const Float_t kMaxDcaLh0= AliITSReconstructor::GetRecoParam()->GetESDV0Params()->GetMaxDcaLh0();\r |
237 | \r | |
cd90f0a2 | 238 | \r |
239 | TObjArray *trackHypothesys = tracker->GetTrackHypothesys();\r | |
240 | TObjArray *bestHypothesys = tracker->GetBestHypothesys();\r | |
241 | TObjArray *originalTracks = tracker->GetOriginal();\r | |
242 | //\r | |
243 | //\r | |
244 | TTreeSRedirector &cstream = *(tracker->GetDebugStreamer());\r | |
245 | Int_t ntracks = event->GetNumberOfTracks(); \r | |
246 | Int_t nitstracks = trackHypothesys->GetEntriesFast();\r | |
247 | originalTracks->Expand(ntracks);\r | |
248 | trackHypothesys->Expand(ntracks);\r | |
249 | bestHypothesys->Expand(ntracks);\r | |
250 | //\r | |
251 | AliHelix * helixes = new AliHelix[ntracks+2];\r | |
252 | TObjArray trackarray(ntracks+2); //array with tracks - with vertex constrain\r | |
253 | TObjArray trackarrayc(ntracks+2); //array of "best tracks" - without vertex constrain\r | |
254 | TObjArray trackarrayl(ntracks+2); //array of "longest tracks" - without vertex constrain\r | |
61673d36 | 255 | //Change from Bool_t to Int_t for optimization\r |
256 | // Int_t forbN=0;\r | |
257 | // Int_t * forbidden = new Int_t [ntracks+2];\r | |
cd90f0a2 | 258 | Bool_t * forbidden = new Bool_t [ntracks+2];\r |
259 | Int_t *itsmap = new Int_t [ntracks+2];\r | |
260 | Float_t *dist = new Float_t[ntracks+2];\r | |
261 | Float_t *normdist0 = new Float_t[ntracks+2];\r | |
262 | Float_t *normdist1 = new Float_t[ntracks+2];\r | |
263 | Float_t *normdist = new Float_t[ntracks+2];\r | |
264 | Float_t *norm = new Float_t[ntracks+2];\r | |
265 | Float_t *maxr = new Float_t[ntracks+2];\r | |
266 | Float_t *minr = new Float_t[ntracks+2];\r | |
267 | Float_t *minPointAngle= new Float_t[ntracks+2];\r | |
268 | //\r | |
269 | AliV0 *pvertex = new AliV0;\r | |
270 | AliITStrackMI * dummy= new AliITStrackMI;\r | |
271 | dummy->SetLabel(0);\r | |
272 | AliITStrackMI trackat0; //temporary track for DCA calculation\r | |
273 | //\r | |
274 | Float_t primvertex[3]={tracker->GetX(),tracker->GetY(),tracker->GetZ()};\r | |
275 | //\r | |
276 | // make ITS - ESD map\r | |
277 | //\r | |
278 | for (Int_t itrack=0;itrack<ntracks+2;itrack++) {\r | |
279 | itsmap[itrack] = -1;\r | |
61673d36 | 280 | // forbidden[itrack] = 0;\r |
cd90f0a2 | 281 | forbidden[itrack] = kFALSE;\r |
282 | maxr[itrack] = kMaxR;\r | |
283 | minr[itrack] = kMinR;\r | |
284 | minPointAngle[itrack] = kMinPointAngle;\r | |
285 | }\r | |
286 | for (Int_t itrack=0;itrack<nitstracks;itrack++){\r | |
287 | AliITStrackMI * original = (AliITStrackMI*)(originalTracks->At(itrack));\r | |
288 | Int_t esdindex = original->GetESDtrack()->GetID();\r | |
289 | itsmap[esdindex] = itrack;\r | |
290 | }\r | |
291 | //\r | |
292 | // create ITS tracks from ESD tracks if not done before\r | |
293 | //\r | |
294 | for (Int_t itrack=0;itrack<ntracks;itrack++){\r | |
295 | if (itsmap[itrack]>=0) continue;\r | |
296 | AliITStrackMI * tpctrack = new AliITStrackMI(*(event->GetTrack(itrack)));\r | |
297 | //tpctrack->fD[0] = tpctrack->GetD(GetX(),GetY());\r | |
298 | //tpctrack->fD[1] = tpctrack->GetZat(GetX())-GetZ(); \r | |
299 | tpctrack->GetDZ(tracker->GetX(),tracker->GetY(),tracker->GetZ(),tpctrack->GetDP()); //I.B.\r | |
300 | if (tpctrack->GetD(0)<20 && tpctrack->GetD(1)<20){\r | |
301 | // tracks which can reach inner part of ITS\r | |
302 | // propagate track to outer its volume - with correction for material\r | |
303 | AliITStrackerMI::CorrectForTPCtoITSDeadZoneMaterial(tpctrack); \r | |
304 | }\r | |
305 | itsmap[itrack] = nitstracks;\r | |
306 | originalTracks->AddAt(tpctrack,nitstracks);\r | |
307 | nitstracks++;\r | |
308 | }\r | |
309 | //\r | |
310 | // fill temporary arrays\r | |
311 | //\r | |
312 | for (Int_t itrack=0;itrack<ntracks;itrack++){\r | |
313 | AliESDtrack * esdtrack = event->GetTrack(itrack);\r | |
314 | Int_t itsindex = itsmap[itrack];\r | |
315 | AliITStrackMI *original = (AliITStrackMI*)originalTracks->At(itsmap[itrack]);\r | |
316 | if (!original) continue;\r | |
317 | AliITStrackMI *bestConst = 0;\r | |
318 | AliITStrackMI *bestLong = 0;\r | |
319 | AliITStrackMI *best = 0; \r | |
320 | //\r | |
321 | //\r | |
322 | TObjArray * array = (TObjArray*) trackHypothesys->At(itsindex);\r | |
323 | Int_t hentries = (array==0) ? 0 : array->GetEntriesFast();\r | |
324 | // Get best track with vertex constrain\r | |
325 | for (Int_t ih=0;ih<hentries;ih++){\r | |
326 | AliITStrackMI * trackh = (AliITStrackMI*)array->At(ih);\r | |
327 | if (!trackh->GetConstrain()) continue;\r | |
328 | if (!bestConst) bestConst = trackh;\r | |
61673d36 | 329 | if (trackh->GetNumberOfClusters()>kMinClFullTrk ){\r |
cd90f0a2 | 330 | bestConst = trackh; // full track - with minimal chi2\r |
331 | break;\r | |
332 | }\r | |
333 | if (trackh->GetNumberOfClusters()+trackh->GetNDeadZone()<=bestConst->GetNumberOfClusters()+bestConst->GetNDeadZone()) continue; \r | |
334 | bestConst = trackh;\r | |
335 | break;\r | |
336 | }\r | |
337 | // Get best long track without vertex constrain and best track without vertex constrain\r | |
338 | for (Int_t ih=0;ih<hentries;ih++){\r | |
339 | AliITStrackMI * trackh = (AliITStrackMI*)array->At(ih);\r | |
340 | if (trackh->GetConstrain()) continue;\r | |
341 | if (!best) best = trackh;\r | |
342 | if (!bestLong) bestLong = trackh;\r | |
b47f2a3f | 343 | if (trackh->GetNumberOfClusters()>kMinClFullTrk){\r |
cd90f0a2 | 344 | bestLong = trackh; // full track - with minimal chi2\r |
345 | break;\r | |
346 | }\r | |
347 | if (trackh->GetNumberOfClusters()+trackh->GetNDeadZone()<=bestLong->GetNumberOfClusters()+bestLong->GetNDeadZone()) continue; \r | |
348 | bestLong = trackh; \r | |
349 | }\r | |
350 | if (!best) {\r | |
351 | best = original;\r | |
352 | bestLong = original;\r | |
353 | }\r | |
354 | //I.B. trackat0 = *bestLong;\r | |
355 | new (&trackat0) AliITStrackMI(*bestLong);\r | |
356 | Double_t xx,yy,zz,alpha; \r | |
357 | if (!bestLong->GetGlobalXYZat(bestLong->GetX(),xx,yy,zz)) continue;\r | |
61673d36 | 358 | \r |
359 | \r | |
cd90f0a2 | 360 | alpha = TMath::ATan2(yy,xx); \r |
361 | // if (!trackat0.Propagate(alpha,0)) continue; \r | |
362 | trackat0.Propagate(alpha,0); //PH The check on the return value is temporarily disabled (bug 45751) \r | |
363 | // calculate normalized distances to the vertex \r | |
364 | //\r | |
365 | Float_t ptfac = (1.+100.*TMath::Abs(trackat0.GetC()));\r | |
366 | if ( bestLong->GetNumberOfClusters()>3 ){ \r | |
367 | dist[itsindex] = trackat0.GetY();\r | |
368 | norm[itsindex] = ptfac*TMath::Sqrt(trackat0.GetSigmaY2());\r | |
369 | normdist0[itsindex] = TMath::Abs(trackat0.GetY()/norm[itsindex]);\r | |
370 | normdist1[itsindex] = TMath::Abs((trackat0.GetZ()-primvertex[2])/(ptfac*TMath::Sqrt(trackat0.GetSigmaZ2())));\r | |
371 | normdist[itsindex] = TMath::Sqrt(normdist0[itsindex]*normdist0[itsindex]+normdist1[itsindex]*normdist1[itsindex]);\r | |
372 | if (!bestConst){\r | |
373 | if (bestLong->GetNumberOfClusters()+bestLong->GetNDeadZone()<6) normdist[itsindex]*=2.;\r | |
374 | if (bestLong->GetNumberOfClusters()+bestLong->GetNDeadZone()<5) normdist[itsindex]*=2.;\r | |
375 | if (bestLong->GetNumberOfClusters()+bestLong->GetNDeadZone()<4) normdist[itsindex]*=2.;\r | |
376 | }else{\r | |
377 | if (bestConst->GetNumberOfClusters()+bestConst->GetNDeadZone()<6) normdist[itsindex]*=1.5;\r | |
378 | if (bestConst->GetNumberOfClusters()+bestConst->GetNDeadZone()<5) normdist[itsindex]*=1.5;\r | |
379 | }\r | |
380 | }\r | |
381 | else{ \r | |
382 | if (bestConst&&bestConst->GetNumberOfClusters()+bestConst->GetNDeadZone()>4.5){\r | |
383 | dist[itsindex] = bestConst->GetD(0);\r | |
384 | norm[itsindex] = bestConst->GetDnorm(0);\r | |
385 | normdist0[itsindex] = TMath::Abs(bestConst->GetD(0)/norm[itsindex]);\r | |
386 | normdist1[itsindex] = TMath::Abs(bestConst->GetD(0)/norm[itsindex]);\r | |
387 | normdist[itsindex] = TMath::Sqrt(normdist0[itsindex]*normdist0[itsindex]+normdist1[itsindex]*normdist1[itsindex]);\r | |
388 | }else{\r | |
389 | dist[itsindex] = trackat0.GetY();\r | |
390 | norm[itsindex] = ptfac*TMath::Sqrt(trackat0.GetSigmaY2());\r | |
391 | normdist0[itsindex] = TMath::Abs(trackat0.GetY()/norm[itsindex]);\r | |
392 | normdist1[itsindex] = TMath::Abs((trackat0.GetZ()-primvertex[2])/(ptfac*TMath::Sqrt(trackat0.GetSigmaZ2())));\r | |
393 | normdist[itsindex] = TMath::Sqrt(normdist0[itsindex]*normdist0[itsindex]+normdist1[itsindex]*normdist1[itsindex]);\r | |
767aaecb | 394 | if (TMath::Abs(trackat0.GetTgl())>kMinTgl0){\r |
61673d36 | 395 | if (normdist[itsindex]<kMinNormDistForbTgl0){\r |
396 | // forbN=1;\r | |
397 | // forbidden[itsindex]+=1<<forbN;\r | |
398 | forbidden[itsindex]=kTRUE;\r | |
399 | }\r | |
400 | if (normdist[itsindex]>kMinNormDistForbTgl0) {\r | |
401 | minr[itsindex] = TMath::Max(kMinRTgl0,minr[itsindex]);\r | |
cd90f0a2 | 402 | }\r |
403 | }\r | |
404 | }\r | |
405 | }\r | |
61673d36 | 406 | \r |
407 | \r | |
cd90f0a2 | 408 | //\r |
409 | //-----------------------------------------------------------\r | |
410 | //Forbid primary track candidates - \r | |
411 | //\r | |
412 | //treetr->SetAlias("forbidden0","Tr0.fN<4&&Tr1.fN+Tr1.fNDeadZone>4.5");\r | |
413 | //treetr->SetAlias("forbidden1","ND<3&&Tr1.fN+Tr1.fNDeadZone>5.5");\r | |
414 | //treetr->SetAlias("forbidden2","ND<2&&Tr1.fClIndex[0]>0&&Tr1.fClIndex[0]>0");\r | |
415 | //treetr->SetAlias("forbidden3","ND<1&&Tr1.fClIndex[0]>0");\r | |
416 | //treetr->SetAlias("forbidden4","ND<4&&Tr1.fNormChi2[0]<2");\r | |
417 | //treetr->SetAlias("forbidden5","ND<5&&Tr1.fNormChi2[0]<1");\r | |
418 | //-----------------------------------------------------------\r | |
419 | if (bestConst){\r | |
61673d36 | 420 | if (bestLong->GetNumberOfClusters()<4 && bestConst->GetNumberOfClusters()+bestConst->GetNDeadZone()>kMinClForb0){\r |
421 | // forbN=2;\r | |
422 | // forbidden[itsindex]+=1<<forbN;\r | |
423 | forbidden[itsindex]=kTRUE;\r | |
424 | }\r | |
425 | if (normdist[itsindex]<kMinNormDistForb1 && bestConst->GetNumberOfClusters()+bestConst->GetNDeadZone()>5.5){\r | |
426 | // forbN=3;\r | |
427 | // forbidden[itsindex]+=1<<forbN;\r | |
428 | forbidden[itsindex]=kTRUE;\r | |
429 | }\r | |
430 | if (normdist[itsindex]<kMinNormDistForb2 && bestConst->GetClIndex(0)>=0 && bestConst->GetClIndex(1)>=0 ){\r | |
431 | // forbN=4;\r | |
432 | // forbidden[itsindex]+=1<<forbN;\r | |
433 | forbidden[itsindex]=kTRUE;\r | |
434 | }\r | |
435 | if (normdist[itsindex]<kMinNormDistForb3 && bestConst->GetClIndex(0)>=0){\r | |
436 | // forbN=5;\r | |
437 | // forbidden[itsindex]+=1<<forbN;\r | |
438 | forbidden[itsindex]=kTRUE;\r | |
439 | }\r | |
440 | if (normdist[itsindex]<kMinNormDistForb4 && bestConst->GetNormChi2(0)<2){\r | |
441 | // forbN=6;\r | |
442 | // forbidden[itsindex]+=1<<forbN;\r | |
443 | forbidden[itsindex]=kTRUE;\r | |
444 | }\r | |
445 | if (normdist[itsindex]<kMinNormDistForb5 && bestConst->GetNormChi2(0)<1){\r | |
446 | // forbN=7;\r | |
447 | // forbidden[itsindex]+=1<<forbN;\r | |
448 | forbidden[itsindex]=kTRUE;\r | |
449 | }\r | |
cd90f0a2 | 450 | if (bestConst->GetNormChi2(0)<2.5) {\r |
61673d36 | 451 | minPointAngle[itsindex]= kMinPABestConst;\r |
452 | maxr[itsindex] = kMaxRBestConst;\r | |
cd90f0a2 | 453 | }\r |
454 | }\r | |
455 | //\r | |
456 | //forbid daughter kink candidates\r | |
457 | //\r | |
458 | if (esdtrack->GetKinkIndex(0)>0) forbidden[itsindex] = kTRUE;\r | |
459 | Bool_t isElectron = kTRUE;\r | |
460 | Bool_t isProton = kTRUE;\r | |
461 | Double_t pid[5];\r | |
462 | esdtrack->GetESDpid(pid);\r | |
463 | for (Int_t i=1;i<5;i++){\r | |
464 | if (pid[0]<pid[i]) isElectron= kFALSE;\r | |
465 | if (pid[4]<pid[i]) isProton= kFALSE;\r | |
466 | }\r | |
467 | if (isElectron){\r | |
468 | forbidden[itsindex]=kFALSE; \r | |
469 | normdist[itsindex]*=-1;\r | |
470 | }\r | |
471 | if (isProton){\r | |
83052b75 | 472 | if (normdist[itsindex]>kMinNormDistForbProt) forbidden[itsindex]=kFALSE; \r |
cd90f0a2 | 473 | normdist[itsindex]*=-1;\r |
474 | }\r | |
475 | \r | |
83052b75 | 476 | // We allow all tracks that are not pions\r |
477 | if( (pid[1]+pid[2])< kMaxPidProbPionForb ){\r | |
478 | forbidden[itsindex]=kFALSE;\r | |
479 | }\r | |
480 | \r | |
cd90f0a2 | 481 | //\r |
482 | // Causality cuts in TPC volume\r | |
483 | //\r | |
61673d36 | 484 | if (esdtrack->GetTPCdensity(0,10) >kMinTPCdensity) maxr[itsindex] = TMath::Min(Float_t(kMaxRTPCdensity0),maxr[itsindex]);\r |
485 | if (esdtrack->GetTPCdensity(10,30)>kMinTPCdensity) maxr[itsindex] = TMath::Min(Float_t(kMaxRTPCdensity10),maxr[itsindex]);\r | |
486 | if (esdtrack->GetTPCdensity(20,40)>kMinTPCdensity) maxr[itsindex] = TMath::Min(Float_t(kMaxRTPCdensity20),maxr[itsindex]);\r | |
487 | if (esdtrack->GetTPCdensity(30,50)>kMinTPCdensity) maxr[itsindex] = TMath::Min(Float_t(kMaxRTPCdensity30),maxr[itsindex]);\r | |
cd90f0a2 | 488 | //\r |
61673d36 | 489 | if (esdtrack->GetTPCdensity(0,60)<0.4&&bestLong->GetNumberOfClusters()<3) minr[itsindex]=kMinRTPCdensity; \r |
cd90f0a2 | 490 | //\r |
491 | //\r | |
61673d36 | 492 | \r |
767aaecb | 493 | if (AliITSReconstructor::GetRecoParam()->GetESDV0Params()->StreamLevel()>0){\r |
cd90f0a2 | 494 | cstream<<"Track"<<\r |
495 | "Tr0.="<<best<<\r | |
496 | "Tr1.="<<((bestConst)? bestConst:dummy)<<\r | |
497 | "Tr2.="<<bestLong<<\r | |
498 | "Tr3.="<<&trackat0<<\r | |
499 | "Esd.="<<esdtrack<<\r | |
500 | "Dist="<<dist[itsindex]<<\r | |
501 | "ND0="<<normdist0[itsindex]<<\r | |
502 | "ND1="<<normdist1[itsindex]<<\r | |
503 | "ND="<<normdist[itsindex]<<\r | |
504 | "Pz="<<primvertex[2]<<\r | |
505 | "Forbid="<<forbidden[itsindex]<<\r | |
506 | "\n";\r | |
507 | //\r | |
508 | }\r | |
509 | trackarray.AddAt(best,itsindex);\r | |
510 | trackarrayc.AddAt(bestConst,itsindex);\r | |
511 | trackarrayl.AddAt(bestLong,itsindex);\r | |
512 | new (&helixes[itsindex]) AliHelix(*best);\r | |
513 | }\r | |
514 | //\r | |
515 | //\r | |
516 | //\r | |
517 | // first iterration of V0 finder\r | |
518 | //\r | |
61673d36 | 519 | // AM Comment out for optimization\r |
520 | // Int_t rejectBase=0;\r | |
521 | // Int_t cutN=0;\r | |
767aaecb | 522 | \r |
cd90f0a2 | 523 | for (Int_t iesd0=0;iesd0<ntracks;iesd0++){\r |
524 | Int_t itrack0 = itsmap[iesd0];\r | |
61673d36 | 525 | //-AM comment for optimization and store the forbidden value in the debug streamer\r |
cd90f0a2 | 526 | if (forbidden[itrack0]) continue;\r |
527 | AliITStrackMI * btrack0 = (AliITStrackMI*)trackarray.At(itrack0);\r | |
528 | if (!btrack0) continue; \r | |
cd90f0a2 | 529 | AliITStrackMI *trackc0 = (AliITStrackMI*)trackarrayc.At(itrack0);\r |
530 | //\r | |
531 | for (Int_t iesd1=iesd0+1;iesd1<ntracks;iesd1++){\r | |
532 | Int_t itrack1 = itsmap[iesd1];\r | |
61673d36 | 533 | //-AM comment for optimization and store the forbidden value in the debug streamer\r |
cd90f0a2 | 534 | if (forbidden[itrack1]) continue;\r |
535 | \r | |
536 | AliITStrackMI * btrack1 = (AliITStrackMI*)trackarray.At(itrack1); \r | |
537 | if (!btrack1) continue;\r | |
61673d36 | 538 | \r |
539 | if ( (btrack0->GetSign()==btrack1->GetSign()) && !AliITSReconstructor::GetRecoParam()->GetStoreLikeSignV0s()) continue;\r | |
540 | \r | |
cd90f0a2 | 541 | Bool_t isGold = kFALSE;\r |
542 | if (TMath::Abs(TMath::Abs(btrack0->GetLabel())-TMath::Abs(btrack1->GetLabel()))==1){\r | |
543 | isGold = kTRUE;\r | |
544 | }\r | |
61673d36 | 545 | // rejectBase=0;\r |
cd90f0a2 | 546 | AliITStrackMI *trackc1 = (AliITStrackMI*)trackarrayc.At(itrack1);\r |
547 | AliHelix &h1 = helixes[itrack0];\r | |
548 | AliHelix &h2 = helixes[itrack1];\r | |
549 | //\r | |
550 | // find linear distance\r | |
551 | Double_t rmin =0;\r | |
552 | //\r | |
553 | //\r | |
554 | //\r | |
555 | Double_t phase[2][2],radius[2];\r | |
556 | Int_t points = h1.GetRPHIintersections(h2, phase, radius);\r | |
61673d36 | 557 | if (points==0) {\r |
558 | // cutN=1;\r | |
559 | // rejectBase+=1<<cutN;\r | |
560 | continue;\r | |
561 | }\r | |
cd90f0a2 | 562 | Double_t delta[2]={1000000,1000000}; \r |
563 | rmin = radius[0];\r | |
564 | h1.ParabolicDCA(h2,phase[0][0],phase[0][1],radius[0],delta[0]);\r | |
565 | if (points==2){ \r | |
566 | if (radius[1]<rmin) rmin = radius[1];\r | |
567 | h1.ParabolicDCA(h2,phase[1][0],phase[1][1],radius[1],delta[1]);\r | |
568 | }\r | |
569 | rmin = TMath::Sqrt(rmin);\r | |
570 | Double_t distance = 0;\r | |
571 | Double_t radiusC = 0;\r | |
572 | Int_t iphase = 0;\r | |
573 | if (points==1 || delta[0]<delta[1]){\r | |
574 | distance = TMath::Sqrt(delta[0]);\r | |
575 | radiusC = TMath::Sqrt(radius[0]);\r | |
576 | }else{\r | |
577 | distance = TMath::Sqrt(delta[1]);\r | |
578 | radiusC = TMath::Sqrt(radius[1]);\r | |
579 | iphase=1;\r | |
580 | }\r | |
61673d36 | 581 | if (radiusC<TMath::Max(minr[itrack0],minr[itrack1])){\r |
582 | // cutN=2;\r | |
583 | //rejectBase+=1<<cutN;\r | |
584 | continue;\r | |
585 | }\r | |
586 | if (radiusC>TMath::Min(maxr[itrack0],maxr[itrack1])){\r | |
587 | // cutN=3;\r | |
588 | // rejectBase+=1<<cutN;\r | |
589 | continue;\r | |
590 | } \r | |
cd90f0a2 | 591 | Float_t maxDist = TMath::Min(kMaxDist,Float_t(kMaxDist0+radiusC*kMaxDist1)); \r |
61673d36 | 592 | if (distance>maxDist){\r |
593 | // cutN=4;\r | |
594 | // rejectBase+=1<<cutN;\r | |
595 | continue;\r | |
596 | }\r | |
cd90f0a2 | 597 | Float_t pointAngle = h1.GetPointAngle(h2,phase[iphase],primvertex);\r |
61673d36 | 598 | if (pointAngle<TMath::Max(minPointAngle[itrack0],minPointAngle[itrack1])) {\r |
599 | // cutN=5;\r | |
600 | // rejectBase+=1<<cutN;\r | |
601 | continue;\r | |
602 | }\r | |
cd90f0a2 | 603 | //\r |
604 | //\r | |
605 | // Double_t distance = TestV0(h1,h2,pvertex,rmin);\r | |
606 | //\r | |
607 | // if (distance>maxDist) continue;\r | |
608 | // if (pvertex->GetRr()<kMinR) continue;\r | |
609 | // if (pvertex->GetRr()>kMaxR) continue;\r | |
610 | AliITStrackMI * track0=btrack0;\r | |
611 | AliITStrackMI * track1=btrack1;\r | |
612 | // if (pvertex->GetRr()<3.5){ \r | |
613 | if (radiusC<3.5){ \r | |
614 | //use longest tracks inside the pipe\r | |
615 | track0 = (AliITStrackMI*)trackarrayl.At(itrack0);\r | |
616 | track1 = (AliITStrackMI*)trackarrayl.At(itrack1);\r | |
617 | } \r | |
618 | //\r | |
619 | //\r | |
767aaecb | 620 | \r |
621 | \r | |
622 | \r | |
cd90f0a2 | 623 | pvertex->SetParamN(*track0);\r |
624 | pvertex->SetParamP(*track1);\r | |
625 | pvertex->Update(primvertex);\r | |
626 | pvertex->SetClusters(track0->ClIndex(),track1->ClIndex()); // register clusters\r | |
627 | \r | |
61673d36 | 628 | // Define gamma, K0, lambda and lambda_bar from the decay particles and calculate the chi2 \r |
629 | AliKFVertex vertexKF;\r | |
630 | \r | |
631 | vertexKF.X() = tracker->GetX();\r | |
632 | vertexKF.Y() = tracker->GetY();\r | |
633 | vertexKF.Z() = tracker->GetZ();\r | |
634 | vertexKF.Covariance(0,0) = tracker->GetSigmaX()*tracker->GetSigmaX();\r | |
635 | vertexKF.Covariance(1,2) = tracker->GetSigmaY()*tracker->GetSigmaY();\r | |
636 | vertexKF.Covariance(2,2) = tracker->GetSigmaZ()*tracker->GetSigmaZ();\r | |
637 | \r | |
638 | AliKFParticle elecKF( *(pvertex->GetParamN()) ,11);\r | |
639 | AliKFParticle posiKF( *(pvertex->GetParamP()) ,-11);\r | |
640 | AliKFParticle pipKF( *(pvertex->GetParamN()) , 211);\r | |
641 | AliKFParticle pinKF( *(pvertex->GetParamP()) ,-211);\r | |
642 | AliKFParticle protKF( *(pvertex->GetParamP()) ,2212);\r | |
643 | AliKFParticle aproKF ( *(pvertex->GetParamN()) ,-2212);\r | |
644 | \r | |
645 | \r | |
646 | // Gamma\r | |
647 | AliKFParticle gamKF(elecKF,posiKF);\r | |
648 | gamKF.SetProductionVertex(vertexKF);\r | |
649 | \r | |
650 | Float_t gamKFchi2 = 1000;\r | |
651 | if ( gamKF.GetNDF()!=0 ){\r | |
652 | gamKFchi2 = gamKF.GetChi2()/gamKF.GetNDF();\r | |
653 | }\r | |
654 | \r | |
655 | Float_t massG=0.;\r | |
656 | Float_t sigmaMG=0.001;\r | |
657 | gamKF.SetMassConstraint(massG,sigmaMG);\r | |
658 | \r | |
659 | Float_t gamKFchi2C = 1000;\r | |
660 | if ( gamKF.GetNDF()!=0 ){\r | |
661 | gamKFchi2C = gamKF.GetChi2()/gamKF.GetNDF();\r | |
662 | }\r | |
663 | \r | |
664 | //K0 short\r | |
665 | AliKFParticle k0KF(pipKF,pinKF);\r | |
666 | k0KF.SetProductionVertex(vertexKF);\r | |
667 | \r | |
668 | Float_t k0KFchi2 = 1000;\r | |
669 | if ( k0KF.GetNDF()!=0 ){\r | |
670 | k0KFchi2 = k0KF.GetChi2()/k0KF.GetNDF();\r | |
671 | }\r | |
672 | \r | |
673 | //Lambda\r | |
674 | AliKFParticle lambdaKF(protKF,pinKF);\r | |
675 | lambdaKF.SetProductionVertex(vertexKF);\r | |
676 | \r | |
677 | Float_t lambdaKFchi2 = 1000;\r | |
678 | if ( lambdaKF.GetNDF()!=0 ){\r | |
679 | lambdaKFchi2 = lambdaKF.GetChi2()/lambdaKF.GetNDF();\r | |
680 | }\r | |
681 | \r | |
682 | //Lambda_bar\r | |
683 | AliKFParticle alambKF(aproKF,pipKF);\r | |
684 | alambKF.SetProductionVertex(vertexKF);\r | |
685 | \r | |
686 | Float_t alambKFchi2 = 1000;\r | |
687 | if ( alambKF.GetNDF()!=0 ){\r | |
688 | alambKFchi2 = alambKF.GetChi2()/alambKF.GetNDF();\r | |
689 | }\r | |
767aaecb | 690 | \r |
767aaecb | 691 | \r |
692 | \r | |
61673d36 | 693 | \r |
694 | \r | |
695 | if (pvertex->GetRr()<kMinR){\r | |
696 | // cutN=6;\r | |
697 | // rejectBase+=1<<cutN;\r | |
698 | continue;\r | |
699 | }\r | |
700 | if (pvertex->GetRr()>kMaxR){\r | |
701 | // cutN=7;\r | |
702 | // rejectBase+=1<<cutN;\r | |
703 | continue;\r | |
704 | }\r | |
705 | if (pvertex->GetV0CosineOfPointingAngle()<kMinPointAngle){\r | |
706 | // cutN=8;\r | |
707 | // rejectBase+=1<<cutN;\r | |
708 | continue;\r | |
709 | }\r | |
cd90f0a2 | 710 | //Bo: if (pvertex->GetDist2()>maxDist) continue;\r |
61673d36 | 711 | \r |
712 | if (pvertex->GetDcaV0Daughters()>maxDist){\r | |
713 | // cutN=9;\r | |
714 | // rejectBase+=1<<cutN;\r | |
715 | continue;\r | |
716 | }\r | |
cd90f0a2 | 717 | //Bo: pvertex->SetLab(0,track0->GetLabel());\r |
718 | //Bo: pvertex->SetLab(1,track1->GetLabel());\r | |
719 | pvertex->SetIndex(0,track0->GetESDtrack()->GetID());\r | |
720 | pvertex->SetIndex(1,track1->GetESDtrack()->GetID());\r | |
721 | // \r | |
722 | AliITStrackMI * htrackc0 = trackc0 ? trackc0:dummy; \r | |
723 | AliITStrackMI * htrackc1 = trackc1 ? trackc1:dummy;\r | |
724 | \r | |
725 | //\r | |
726 | //\r | |
727 | TObjArray * array0b = (TObjArray*)bestHypothesys->At(itrack0);\r | |
767aaecb | 728 | if (!array0b&&pvertex->GetRr()<40 && TMath::Abs(track0->GetTgl())<kMinTgl1) {\r |
cd90f0a2 | 729 | tracker->SetCurrentEsdTrack(itrack0);\r |
730 | tracker->FollowProlongationTree((AliITStrackMI*)originalTracks->At(itrack0),itrack0, kFALSE);\r | |
731 | }\r | |
732 | TObjArray * array1b = (TObjArray*)bestHypothesys->At(itrack1);\r | |
767aaecb | 733 | if (!array1b&&pvertex->GetRr()<40 && TMath::Abs(track1->GetTgl())<kMinTgl1) { \r |
cd90f0a2 | 734 | tracker->SetCurrentEsdTrack(itrack1);\r |
735 | tracker->FollowProlongationTree((AliITStrackMI*)originalTracks->At(itrack1),itrack1, kFALSE);\r | |
736 | }\r | |
737 | //\r | |
738 | AliITStrackMI * track0b = (AliITStrackMI*)originalTracks->At(itrack0);\r | |
739 | AliITStrackMI * track1b = (AliITStrackMI*)originalTracks->At(itrack1);\r | |
740 | AliITStrackMI * track0l = (AliITStrackMI*)originalTracks->At(itrack0);\r | |
741 | AliITStrackMI * track1l = (AliITStrackMI*)originalTracks->At(itrack1);\r | |
742 | \r | |
767aaecb | 743 | Float_t minchi2before0=kMinchi2before0;\r |
744 | Float_t minchi2before1=kMinchi2before1;\r | |
745 | Float_t minchi2after0 =kMinchi2after0;\r | |
746 | Float_t minchi2after1 =kMinchi2after1;\r | |
cd90f0a2 | 747 | Double_t xrp[3]; pvertex->GetXYZ(xrp[0],xrp[1],xrp[2]); //I.B.\r |
748 | Int_t maxLayer = tracker->GetNearestLayer(xrp); //I.B.\r | |
749 | \r | |
750 | if (array0b) for (Int_t i=0;i<5;i++){\r | |
751 | // best track after vertex\r | |
752 | AliITStrackMI * btrack = (AliITStrackMI*)array0b->At(i);\r | |
753 | if (!btrack) continue;\r | |
754 | if (btrack->GetNumberOfClusters()>track0l->GetNumberOfClusters()) track0l = btrack; \r | |
755 | // if (btrack->fX<pvertex->GetRr()-2.-0.5/(0.1+pvertex->GetAnglep()[2])) {\r | |
756 | if (btrack->GetX()<pvertex->GetRr()-2.) {\r | |
757 | if ( (maxLayer>i+2|| (i==0)) && btrack->GetNumberOfClusters()==(6-i)&&i<3){\r | |
758 | Float_t sumchi2= 0;\r | |
759 | Float_t sumn = 0;\r | |
760 | if (maxLayer<3){ // take prim vertex as additional measurement\r | |
761 | if (normdist[itrack0]>0 && htrackc0){\r | |
762 | sumchi2 += TMath::Min((3.-maxLayer)*normdist[itrack0]*normdist[itrack0],16.);\r | |
763 | }else{\r | |
764 | sumchi2 += TMath::Min((3.-maxLayer)*(3*normdist[itrack0]*normdist[itrack0]+3.),16.);\r | |
765 | }\r | |
766 | sumn += 3-maxLayer;\r | |
767 | }\r | |
768 | for (Int_t ilayer=i;ilayer<maxLayer;ilayer++){\r | |
769 | sumn+=1.; \r | |
770 | if (btrack->GetClIndex(ilayer)<0){\r | |
767aaecb | 771 | sumchi2+=kAddchi2NegCl0;\r |
cd90f0a2 | 772 | continue;\r |
773 | }else{\r | |
774 | Int_t c=( btrack->GetClIndex(ilayer) & 0x0fffffff);\r | |
775 | for (Int_t itrack=0;itrack<4;itrack++){\r | |
776 | AliITStrackerMI::AliITSlayer &layer=tracker->GetLayer(ilayer);\r | |
777 | if (layer.GetClusterTracks(itrack,c)>=0 && layer.GetClusterTracks(itrack,c)!=itrack0){\r | |
767aaecb | 778 | sumchi2+=kAddchi2SharedCl; //shared cluster\r |
cd90f0a2 | 779 | break;\r |
780 | }\r | |
781 | }\r | |
782 | sumchi2+=btrack->GetDy(ilayer)*btrack->GetDy(ilayer)/(btrack->GetSigmaY(ilayer)*btrack->GetSigmaY(ilayer));\r | |
783 | sumchi2+=btrack->GetDz(ilayer)*btrack->GetDz(ilayer)/(btrack->GetSigmaZ(ilayer)*btrack->GetSigmaZ(ilayer)); \r | |
784 | }\r | |
785 | }\r | |
786 | sumchi2/=sumn;\r | |
787 | if (sumchi2<minchi2before0) minchi2before0=sumchi2; \r | |
788 | }\r | |
789 | continue; //safety space - Geo manager will give exact layer\r | |
790 | }\r | |
791 | track0b = btrack;\r | |
792 | minchi2after0 = btrack->GetNormChi2(i);\r | |
793 | break;\r | |
794 | }\r | |
795 | if (array1b) for (Int_t i=0;i<5;i++){\r | |
796 | // best track after vertex\r | |
797 | AliITStrackMI * btrack = (AliITStrackMI*)array1b->At(i);\r | |
798 | if (!btrack) continue;\r | |
799 | if (btrack->GetNumberOfClusters()>track1l->GetNumberOfClusters()) track1l = btrack; \r | |
800 | // if (btrack->fX<pvertex->GetRr()-2-0.5/(0.1+pvertex->GetAnglep()[2])){\r | |
801 | if (btrack->GetX()<pvertex->GetRr()-2){\r | |
802 | if ((maxLayer>i+2 || (i==0))&&btrack->GetNumberOfClusters()==(6-i)&&(i<3)){\r | |
803 | Float_t sumchi2= 0;\r | |
804 | Float_t sumn = 0;\r | |
805 | if (maxLayer<3){ // take prim vertex as additional measurement\r | |
806 | if (normdist[itrack1]>0 && htrackc1){\r | |
807 | sumchi2 += TMath::Min((3.-maxLayer)*normdist[itrack1]*normdist[itrack1],16.);\r | |
808 | }else{\r | |
809 | sumchi2 += TMath::Min((3.-maxLayer)*(3*normdist[itrack1]*normdist[itrack1]+3.),16.);\r | |
810 | }\r | |
811 | sumn += 3-maxLayer;\r | |
812 | }\r | |
813 | for (Int_t ilayer=i;ilayer<maxLayer;ilayer++){\r | |
814 | sumn+=1.;\r | |
815 | if (btrack->GetClIndex(ilayer)<0){\r | |
767aaecb | 816 | sumchi2+=kAddchi2NegCl1;\r |
cd90f0a2 | 817 | continue;\r |
818 | }else{\r | |
819 | Int_t c=( btrack->GetClIndex(ilayer) & 0x0fffffff);\r | |
820 | for (Int_t itrack=0;itrack<4;itrack++){\r | |
821 | AliITStrackerMI::AliITSlayer &layer=tracker->GetLayer(ilayer);\r | |
822 | if (layer.GetClusterTracks(itrack,c)>=0 && layer.GetClusterTracks(itrack,c)!=itrack1){\r | |
767aaecb | 823 | sumchi2+=kAddchi2SharedCl; //shared cluster\r |
cd90f0a2 | 824 | break;\r |
825 | }\r | |
826 | }\r | |
827 | sumchi2+=btrack->GetDy(ilayer)*btrack->GetDy(ilayer)/(btrack->GetSigmaY(ilayer)*btrack->GetSigmaY(ilayer));\r | |
828 | sumchi2+=btrack->GetDz(ilayer)*btrack->GetDz(ilayer)/(btrack->GetSigmaZ(ilayer)*btrack->GetSigmaZ(ilayer)); \r | |
829 | }\r | |
830 | }\r | |
831 | sumchi2/=sumn;\r | |
832 | if (sumchi2<minchi2before1) minchi2before1=sumchi2; \r | |
833 | }\r | |
834 | continue; //safety space - Geo manager will give exact layer \r | |
835 | }\r | |
836 | track1b = btrack;\r | |
837 | minchi2after1 = btrack->GetNormChi2(i);\r | |
838 | break;\r | |
839 | }\r | |
840 | //\r | |
841 | // position resolution - used for DCA cut\r | |
842 | Float_t sigmad = track0b->GetSigmaY2()+track0b->GetSigmaZ2()+track1b->GetSigmaY2()+track1b->GetSigmaZ2()+\r | |
843 | (track0b->GetX()-pvertex->GetRr())*(track0b->GetX()-pvertex->GetRr())*(track0b->GetSigmaSnp2()+track0b->GetSigmaTgl2())+\r | |
844 | (track1b->GetX()-pvertex->GetRr())*(track1b->GetX()-pvertex->GetRr())*(track1b->GetSigmaSnp2()+track1b->GetSigmaTgl2());\r | |
845 | sigmad =TMath::Sqrt(sigmad)+0.04;\r | |
846 | if (pvertex->GetRr()>50){\r | |
847 | Double_t cov0[15],cov1[15];\r | |
848 | track0b->GetESDtrack()->GetInnerExternalCovariance(cov0);\r | |
849 | track1b->GetESDtrack()->GetInnerExternalCovariance(cov1);\r | |
850 | sigmad = cov0[0]+cov0[2]+cov1[0]+cov1[2]+\r | |
851 | (80.-pvertex->GetRr())*(80.-pvertex->GetRr())*(cov0[5]+cov0[9])+\r | |
852 | (80.-pvertex->GetRr())*(80.-pvertex->GetRr())*(cov1[5]+cov1[9]);\r | |
853 | sigmad =TMath::Sqrt(sigmad)+0.05;\r | |
854 | }\r | |
855 | // \r | |
856 | AliV0 vertex2;\r | |
857 | vertex2.SetParamN(*track0b);\r | |
858 | vertex2.SetParamP(*track1b);\r | |
859 | vertex2.Update(primvertex);\r | |
860 | //Bo: if (vertex2.GetDist2()<=pvertex->GetDist2()&&(vertex2.GetV0CosineOfPointingAngle()>=pvertex->GetV0CosineOfPointingAngle())){\r | |
861 | if (vertex2.GetDcaV0Daughters()<=pvertex->GetDcaV0Daughters()&&(vertex2.GetV0CosineOfPointingAngle()>=pvertex->GetV0CosineOfPointingAngle())){\r | |
862 | pvertex->SetParamN(*track0b);\r | |
863 | pvertex->SetParamP(*track1b);\r | |
864 | pvertex->Update(primvertex);\r | |
865 | pvertex->SetClusters(track0b->ClIndex(),track1b->ClIndex()); // register clusters\r | |
866 | pvertex->SetIndex(0,track0->GetESDtrack()->GetID());\r | |
867 | pvertex->SetIndex(1,track1->GetESDtrack()->GetID());\r | |
868 | }\r | |
869 | pvertex->SetDistSigma(sigmad);\r | |
870 | //Bo: pvertex->SetDistNorm(pvertex->GetDist2()/sigmad); \r | |
871 | pvertex->SetNormDCAPrim(normdist[itrack0],normdist[itrack1]);\r | |
872 | //\r | |
873 | // define likelihhod and causalities\r | |
874 | //\r | |
875 | Float_t pa0=1, pa1=1, pb0=0.26, pb1=0.26; \r | |
876 | if (maxLayer<1){\r | |
877 | Float_t fnorm0 = normdist[itrack0];\r | |
878 | if (fnorm0<0) fnorm0*=-3;\r | |
879 | Float_t fnorm1 = normdist[itrack1];\r | |
880 | if (fnorm1<0) fnorm1*=-3;\r | |
881 | if ((pvertex->GetAnglep()[2]>0.1) || ( (pvertex->GetRr()<10.5)&& pvertex->GetAnglep()[2]>0.05 ) || (pvertex->GetRr()<3)){\r | |
882 | pb0 = TMath::Exp(-TMath::Min(fnorm0,Float_t(16.))/12.);\r | |
883 | pb1 = TMath::Exp(-TMath::Min(fnorm1,Float_t(16.))/12.);\r | |
884 | }\r | |
885 | pvertex->SetChi2Before(normdist[itrack0]);\r | |
886 | pvertex->SetChi2After(normdist[itrack1]); \r | |
887 | pvertex->SetNAfter(0);\r | |
888 | pvertex->SetNBefore(0);\r | |
889 | }else{\r | |
890 | pvertex->SetChi2Before(minchi2before0);\r | |
891 | pvertex->SetChi2After(minchi2before1);\r | |
892 | if (pvertex->GetAnglep()[2]>0.1 || ( pvertex->GetRr()<10.5 && pvertex->GetAnglep()[2]>0.05) || pvertex->GetRr()<3){\r | |
893 | pb0 = TMath::Exp(-TMath::Min(minchi2before0,Float_t(16))/12.);\r | |
894 | pb1 = TMath::Exp(-TMath::Min(minchi2before1,Float_t(16))/12.);\r | |
895 | }\r | |
896 | pvertex->SetNAfter(maxLayer);\r | |
897 | pvertex->SetNBefore(maxLayer); \r | |
898 | }\r | |
899 | if (pvertex->GetRr()<90){\r | |
900 | pa0 *= TMath::Min(track0->GetESDtrack()->GetTPCdensity(0,60),Double_t(1.));\r | |
901 | pa1 *= TMath::Min(track1->GetESDtrack()->GetTPCdensity(0,60),Double_t(1.));\r | |
902 | }\r | |
903 | if (pvertex->GetRr()<20){\r | |
904 | pa0 *= (0.2+TMath::Exp(-TMath::Min(minchi2after0,Float_t(16))/8.))/1.2;\r | |
905 | pa1 *= (0.2+TMath::Exp(-TMath::Min(minchi2after1,Float_t(16))/8.))/1.2;\r | |
906 | }\r | |
907 | //\r | |
908 | pvertex->SetCausality(pb0,pb1,pa0,pa1);\r | |
909 | //\r | |
910 | // Likelihood calculations - apply cuts\r | |
911 | // \r | |
61673d36 | 912 | \r |
913 | // AM - Comment out for optimization and store the v0OK value\r | |
914 | // Int_t v0OK = 0;\r | |
915 | // Int_t cutOKN=0;\r | |
cd90f0a2 | 916 | Bool_t v0OK = kTRUE;\r |
61673d36 | 917 | \r |
918 | \r | |
cd90f0a2 | 919 | Float_t p12 = pvertex->GetParamP()->GetParameter()[4]*pvertex->GetParamP()->GetParameter()[4];\r |
920 | p12 += pvertex->GetParamN()->GetParameter()[4]*pvertex->GetParamN()->GetParameter()[4];\r | |
921 | p12 = TMath::Sqrt(p12); // "mean" momenta\r | |
767aaecb | 922 | \r |
923 | Float_t sigmap0 = kSigp0Par0+kSigp0Par1/(kSigp0Par2+pvertex->GetRr()); \r | |
924 | Float_t sigmap = kSigpPar0*sigmap0*(kSigpPar1+kSigpPar2*p12); // "resolution: of point angle - as a function of radius and momenta\r | |
925 | \r | |
cd90f0a2 | 926 | \r |
927 | Float_t causalityA = (1.0-pvertex->GetCausalityP()[0])*(1.0-pvertex->GetCausalityP()[1]);\r | |
928 | Float_t causalityB = TMath::Sqrt(TMath::Min(pvertex->GetCausalityP()[2],Double_t(0.7))*\r | |
929 | TMath::Min(pvertex->GetCausalityP()[3],Double_t(0.7)));\r | |
930 | //\r | |
931 | //Bo: Float_t likelihood0 = (TMath::Exp(-pvertex->GetDistNorm())+0.1) *(pvertex->GetDist2()<0.5)*(pvertex->GetDistNorm()<5);\r | |
932 | Float_t lDistNorm = pvertex->GetDcaV0Daughters()/pvertex->GetDistSigma();\r | |
61673d36 | 933 | Float_t likelihood0 = (TMath::Exp(-lDistNorm)+0.1) *(pvertex->GetDcaV0Daughters()<kMaxDcaLh0)*(lDistNorm<5);\r |
cd90f0a2 | 934 | \r |
935 | Float_t likelihood1 = TMath::Exp(-(1.0001-pvertex->GetV0CosineOfPointingAngle())/sigmap)+\r | |
936 | 0.4*TMath::Exp(-(1.0001-pvertex->GetV0CosineOfPointingAngle())/(4.*sigmap))+\r | |
937 | 0.4*TMath::Exp(-(1.0001-pvertex->GetV0CosineOfPointingAngle())/(8.*sigmap))+\r | |
938 | 0.1*TMath::Exp(-(1.0001-pvertex->GetV0CosineOfPointingAngle())/0.01);\r | |
939 | //\r | |
61673d36 | 940 | if (causalityA<kCausality0Cut){\r |
941 | // cutOKN=1;\r | |
942 | // v0OK += 1<<cutOKN;\r | |
943 | v0OK = kFALSE;\r | |
944 | }\r | |
945 | if (TMath::Sqrt(likelihood0*likelihood1)<kLikelihood01Cut){\r | |
946 | // cutOKN=2;\r | |
947 | // v0OK += 1<<cutOKN;\r | |
948 | v0OK = kFALSE;\r | |
949 | }\r | |
950 | if (likelihood1<kLikelihood1Cut){\r | |
951 | // cutOKN=3;\r | |
952 | // v0OK += 1<<cutOKN;\r | |
953 | v0OK = kFALSE;\r | |
954 | }\r | |
955 | if (TMath::Power(likelihood0*likelihood1*causalityB,0.33)<kCombinedCut){\r | |
956 | // cutOKN=4;\r | |
957 | // v0OK += 1<<cutOKN;\r | |
958 | v0OK = kFALSE;\r | |
959 | }\r | |
cd90f0a2 | 960 | //\r |
961 | //\r | |
767aaecb | 962 | if (AliITSReconstructor::GetRecoParam()->GetESDV0Params()->StreamLevel()>0){ \r |
cd90f0a2 | 963 | Bool_t gold = TMath::Abs(TMath::Abs(track0->GetLabel())-TMath::Abs(track1->GetLabel()))==1;\r |
964 | cstream<<"It0"<<\r | |
965 | "Tr0.="<<track0<< //best without constrain\r | |
966 | "Tr1.="<<track1<< //best without constrain \r | |
61673d36 | 967 | "posiKF.="<<&posiKF<< //KF from track0\r |
968 | "elecKF.="<<&elecKF<< //KF from track1\r | |
cd90f0a2 | 969 | "Tr0B.="<<track0b<< //best without constrain after vertex\r |
970 | "Tr1B.="<<track1b<< //best without constrain after vertex \r | |
971 | "Tr0C.="<<htrackc0<< //best with constrain if exist\r | |
972 | "Tr1C.="<<htrackc1<< //best with constrain if exist\r | |
973 | "Tr0L.="<<track0l<< //longest best \r | |
974 | "Tr1L.="<<track1l<< //longest best\r | |
975 | "Esd0.="<<track0->GetESDtrack()<< // esd track0 params\r | |
976 | "Esd1.="<<track1->GetESDtrack()<< // esd track1 params\r | |
977 | "V0.="<<pvertex<< //vertex properties\r | |
978 | "V0b.="<<&vertex2<< //vertex properties at "best" track\r | |
61673d36 | 979 | "gamKF.="<<&gamKF<< //KF from pvertex\r |
980 | "k0KF.="<<&k0KF<< //KF from pvertex\r | |
981 | "lambdaKF.="<<&lambdaKF<< //KF from pvertex\r | |
982 | "alambKF.="<<&lambdaKF<< //KF from pvertex\r | |
983 | "gamKFchi2="<<gamKFchi2<< //Normalized chi2 from KF assuming gamma momther\r | |
984 | "gamKFchi2C="<<gamKFchi2C<< //Normalized chi2 from KF assuming gamma mother+mass constraint\r | |
985 | "k0KFchi2="<<k0KFchi2<< //Normalized chi2 from KF assuming K0 mother\r | |
986 | "lambdaKFchi2="<<lambdaKFchi2<< //Normalized chi2 from KF assuming Lambda mother\r | |
987 | "alambKFchi2="<<alambKFchi2<< //Normalized chi2 from KF assuming lambda_bar mother\r | |
cd90f0a2 | 988 | "ND0="<<normdist[itrack0]<< //normalize distance for track0\r |
989 | "ND1="<<normdist[itrack1]<< //normalize distance for track1\r | |
990 | "Gold="<<gold<< //\r | |
61673d36 | 991 | // "RejectBase="<<rejectBase<< //rejection in First itteration\r |
cd90f0a2 | 992 | "OK="<<v0OK<<\r |
993 | "rmin="<<rmin<<\r | |
994 | "sigmad="<<sigmad<<\r | |
61673d36 | 995 | "Forbid0="<<forbidden[itrack0]<<\r |
996 | "Forbid1="<<forbidden[itrack1]<<\r | |
cd90f0a2 | 997 | "\n";\r |
998 | } \r | |
61673d36 | 999 | // if (rejectBase>0) continue;\r |
1000 | //if (forbidden[itrack0]>0 ||forbidden[itrack1]>0) continue; \r | |
cd90f0a2 | 1001 | //\r |
1002 | pvertex->SetStatus(0);\r | |
1003 | // if (rejectBase) {\r | |
1004 | // pvertex->SetStatus(-100);\r | |
1005 | //}\r | |
1006 | if (pvertex->GetV0CosineOfPointingAngle()>kMinPointAngle2) {\r | |
1007 | //Bo: pvertex->SetESDindexes(track0->GetESDtrack()->GetID(),track1->GetESDtrack()->GetID());\r | |
1008 | pvertex->SetIndex(0,track0->GetESDtrack()->GetID());//Bo: consistency 0 for neg\r | |
1009 | pvertex->SetIndex(1,track1->GetESDtrack()->GetID());//Bo: consistency 1 for pos\r | |
61673d36 | 1010 | // if (v0OK==0){\r |
cd90f0a2 | 1011 | if (v0OK){\r |
1012 | // AliV0vertex vertexjuri(*track0,*track1);\r | |
1013 | // vertexjuri.SetESDindexes(track0->fESDtrack->GetID(),track1->fESDtrack->GetID());\r | |
1014 | // event->AddV0(&vertexjuri);\r | |
1015 | pvertex->SetStatus(100);\r | |
1016 | }\r | |
1017 | pvertex->SetOnFlyStatus(kTRUE);\r | |
1018 | pvertex->ChangeMassHypothesis(kK0Short);\r | |
1019 | event->AddV0(pvertex);\r | |
1020 | }\r | |
1021 | }\r | |
1022 | }\r | |
1023 | //\r | |
1024 | //\r | |
1025 | // delete temporary arrays\r | |
1026 | // \r | |
1027 | delete[] forbidden;\r | |
1028 | delete[] minPointAngle;\r | |
1029 | delete[] maxr;\r | |
1030 | delete[] minr;\r | |
1031 | delete[] norm;\r | |
1032 | delete[] normdist;\r | |
1033 | delete[] normdist1;\r | |
1034 | delete[] normdist0;\r | |
1035 | delete[] dist;\r | |
1036 | delete[] itsmap;\r | |
1037 | delete[] helixes;\r | |
1038 | delete pvertex;\r | |
1039 | }\r | |
1040 | //------------------------------------------------------------------------\r | |
1041 | void AliITSV0Finder::RefitV02(const AliESDEvent *event,\r | |
1042 | AliITStrackerMI *tracker) \r | |
1043 | {\r | |
1044 | //\r | |
1045 | //try to refit V0s in the third path of the reconstruction\r | |
1046 | //\r | |
1047 | TTreeSRedirector &cstream = *(tracker->GetDebugStreamer());\r | |
1048 | //\r | |
1049 | Int_t nv0s = event->GetNumberOfV0s();\r | |
1050 | Float_t primvertex[3]={tracker->GetX(),tracker->GetY(),tracker->GetZ()};\r | |
1051 | AliV0 v0temp;\r | |
1052 | for (Int_t iv0 = 0; iv0<nv0s;iv0++){\r | |
1053 | AliV0 * v0mi = (AliV0*)event->GetV0(iv0);\r | |
1054 | if (!v0mi) continue;\r | |
1055 | Int_t itrack0 = v0mi->GetIndex(0);\r | |
1056 | Int_t itrack1 = v0mi->GetIndex(1);\r | |
1057 | AliESDtrack *esd0 = event->GetTrack(itrack0);\r | |
1058 | AliESDtrack *esd1 = event->GetTrack(itrack1);\r | |
1059 | if (!esd0||!esd1) continue;\r | |
1060 | AliITStrackMI tpc0(*esd0); \r | |
1061 | AliITStrackMI tpc1(*esd1);\r | |
1062 | Double_t x,y,z; v0mi->GetXYZ(x,y,z); //I.B. \r | |
1063 | Double_t alpha =TMath::ATan2(y,x); //I.B.\r | |
1064 | if (v0mi->GetRr()>85){\r | |
1065 | if (tpc0.Propagate(alpha,v0mi->GetRr())&&tpc1.Propagate(alpha,v0mi->GetRr())){\r | |
1066 | v0temp.SetParamN(tpc0);\r | |
1067 | v0temp.SetParamP(tpc1);\r | |
1068 | v0temp.Update(primvertex);\r | |
767aaecb | 1069 | if (AliITSReconstructor::GetRecoParam()->GetESDV0Params()->StreamLevel()>0) cstream<<"Refit"<<\r |
cd90f0a2 | 1070 | "V0.="<<v0mi<<\r |
1071 | "V0refit.="<<&v0temp<<\r | |
1072 | "Tr0.="<<&tpc0<<\r | |
1073 | "Tr1.="<<&tpc1<<\r | |
1074 | "\n";\r | |
1075 | //Bo: if (v0temp.GetDist2()<v0mi->GetDist2() || v0temp.GetV0CosineOfPointingAngle()>v0mi->GetV0CosineOfPointingAngle()){\r | |
1076 | if (v0temp.GetDcaV0Daughters()<v0mi->GetDcaV0Daughters() || v0temp.GetV0CosineOfPointingAngle()>v0mi->GetV0CosineOfPointingAngle()){\r | |
1077 | v0mi->SetParamN(tpc0);\r | |
1078 | v0mi->SetParamP(tpc1);\r | |
1079 | v0mi->Update(primvertex);\r | |
1080 | }\r | |
1081 | }\r | |
1082 | continue;\r | |
1083 | }\r | |
1084 | if (v0mi->GetRr()>35){\r | |
1085 | AliITStrackerMI::CorrectForTPCtoITSDeadZoneMaterial(&tpc0);\r | |
1086 | AliITStrackerMI::CorrectForTPCtoITSDeadZoneMaterial(&tpc1);\r | |
1087 | if (tpc0.Propagate(alpha,v0mi->GetRr())&&tpc1.Propagate(alpha,v0mi->GetRr())){\r | |
1088 | v0temp.SetParamN(tpc0);\r | |
1089 | v0temp.SetParamP(tpc1);\r | |
1090 | v0temp.Update(primvertex);\r | |
767aaecb | 1091 | if (AliITSReconstructor::GetRecoParam()->GetESDV0Params()->StreamLevel()>0) cstream<<"Refit"<<\r |
cd90f0a2 | 1092 | "V0.="<<v0mi<<\r |
1093 | "V0refit.="<<&v0temp<<\r | |
1094 | "Tr0.="<<&tpc0<<\r | |
1095 | "Tr1.="<<&tpc1<<\r | |
1096 | "\n";\r | |
1097 | //Bo: if (v0temp.GetDist2()<v0mi->GetDist2() || v0temp.GetV0CosineOfPointingAngle()>v0mi->GetV0CosineOfPointingAngle()){\r | |
1098 | if (v0temp.GetDcaV0Daughters()<v0mi->GetDcaV0Daughters() || v0temp.GetV0CosineOfPointingAngle()>v0mi->GetV0CosineOfPointingAngle()){\r | |
1099 | v0mi->SetParamN(tpc0);\r | |
1100 | v0mi->SetParamP(tpc1);\r | |
1101 | v0mi->Update(primvertex);\r | |
1102 | } \r | |
1103 | }\r | |
1104 | continue;\r | |
1105 | }\r | |
1106 | AliITStrackerMI::CorrectForTPCtoITSDeadZoneMaterial(&tpc0);\r | |
1107 | AliITStrackerMI::CorrectForTPCtoITSDeadZoneMaterial(&tpc1); \r | |
1108 | // if (tpc0.Propagate(alpha,v0mi->GetRr())&&tpc1.Propagate(alpha,v0mi->GetRr())){\r | |
1109 | if (tracker->RefitAt(v0mi->GetRr(),&tpc0, v0mi->GetClusters(0)) && \r | |
1110 | tracker->RefitAt(v0mi->GetRr(),&tpc1, v0mi->GetClusters(1))){\r | |
1111 | v0temp.SetParamN(tpc0);\r | |
1112 | v0temp.SetParamP(tpc1);\r | |
1113 | v0temp.Update(primvertex);\r | |
767aaecb | 1114 | if (AliITSReconstructor::GetRecoParam()->GetESDV0Params()->StreamLevel()>0) cstream<<"Refit"<<\r |
cd90f0a2 | 1115 | "V0.="<<v0mi<<\r |
1116 | "V0refit.="<<&v0temp<<\r | |
1117 | "Tr0.="<<&tpc0<<\r | |
1118 | "Tr1.="<<&tpc1<<\r | |
1119 | "\n";\r | |
1120 | //Bo: if (v0temp.GetDist2()<v0mi->GetDist2() || v0temp.GetV0CosineOfPointingAngle()>v0mi->GetV0CosineOfPointingAngle()){\r | |
1121 | if (v0temp.GetDcaV0Daughters()<v0mi->GetDcaV0Daughters() || v0temp.GetV0CosineOfPointingAngle()>v0mi->GetV0CosineOfPointingAngle()){\r | |
1122 | v0mi->SetParamN(tpc0);\r | |
1123 | v0mi->SetParamP(tpc1);\r | |
1124 | v0mi->Update(primvertex);\r | |
1125 | } \r | |
1126 | } \r | |
1127 | }\r | |
1128 | }\r | |
1129 | //------------------------------------------------------------------------\r | |
767aaecb | 1130 | \r |
1131 | \r | |
1132 | AliITSV0Finder::~AliITSV0Finder()\r | |
1133 | {\r | |
1134 | //\r | |
1135 | //destructor\r | |
1136 | //\r | |
1137 | if (fDebugStreamer) {\r | |
1138 | //fDebugStreamer->Close();\r | |
1139 | delete fDebugStreamer;\r | |
1140 | }\r | |
1141 | \r | |
1142 | }\r |