Introduction of ITS clustrerer for HLT. Improved version of the fast ITS vertexer...
[u/mrichter/AliRoot.git] / HLT / ITS / AliL3ITStracker.cxx
CommitLineData
9582ea1a 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16//-------------------------------------------------------------------------
17// Implementation of the HLT ITS tracker class
18// It reads AliITSclusterV2 clusters and HLT ESD tracks and creates
19// AliITStrackV2 tracks. For details, see also RunHLTITS.C macro.
20// Origin: Cvetan Cheshkov, CERN, Cvetan.Cheshkov@cern.ch
21//-------------------------------------------------------------------------
22
23#include "AliESD.h"
24#include "AliL3ITStrack.h"
25#include "AliL3ITStracker.h"
26
27ClassImp(AliL3ITStracker)
28
29static Int_t CorrectForDeadZoneMaterial(AliITStrackV2 *t) {
30 //--------------------------------------------------------------------
31 // Correction for the material between the TPC and the ITS
32 // (should it belong to the TPC code ?)
33 //--------------------------------------------------------------------
34 Double_t riw=80., diw=0.0053, x0iw=30; // TPC inner wall ?
35 Double_t rcd=61., dcd=0.0053, x0cd=30; // TPC "central drum" ?
36 Double_t yr=12.8, dr=0.03; // rods ?
37 Double_t zm=0.2, dm=0.40; // membrane
38 //Double_t rr=52., dr=0.19, x0r=24., yyr=7.77; //rails
39 Double_t rs=50., ds=0.001; // something belonging to the ITS (screen ?)
40
41 if (t->GetX() > riw) {
42 if (!t->PropagateTo(riw,diw,x0iw)) return 1;
43 if (TMath::Abs(t->GetY())>yr) t->CorrectForMaterial(dr);
44 if (TMath::Abs(t->GetZ())<zm) t->CorrectForMaterial(dm);
45 if (!t->PropagateTo(rcd,dcd,x0cd)) return 1;
46 //Double_t x,y,z; t->GetGlobalXYZat(rr,x,y,z);
47 //if (TMath::Abs(y)<yyr) t->PropagateTo(rr,dr,x0r);
48 if (!t->PropagateTo(rs,ds)) return 1;
49 } else if (t->GetX() < rs) {
50 if (!t->PropagateTo(rs,-ds)) return 1;
51 //Double_t x,y,z; t->GetGlobalXYZat(rr,x,y,z);
52 //if (TMath::Abs(y)<yyr) t->PropagateTo(rr,-dr,x0r);
53 if (!t->PropagateTo(rcd,-dcd,x0cd)) return 1;
54 if (!t->PropagateTo(riw+0.001,-diw,x0iw)) return 1;
55 } else {
56 // ::Error("CorrectForDeadZoneMaterial","track is already in the dead zone !");
57 return 1;
58 }
59
60 return 0;
61}
62
63Int_t AliL3ITStracker::Clusters2Tracks(AliESD *event) {
64 //--------------------------------------------------------------------
65 // This functions reconstructs HLT ITS tracks
66 //--------------------------------------------------------------------
67 TObjArray itsTracks(15000);
68
69 {/* Read HLT ESD tracks */
70 Int_t nentr;
71 nentr=event->GetNumberOfHLTHoughTracks();
72 Info("Clusters2Tracks", "Number of ESD HLT tracks: %d\n", nentr);
73 while (nentr--) {
74
75 AliESDHLTtrack *esd=event->GetHLTHoughTrack(nentr);
76 if (esd->GetWeight() > 500) continue;
77
78 AliL3ITStrack *t=0;
79 try {
80 t=new AliL3ITStrack(*esd,GetZ());
81 } catch (const Char_t *msg) {
82 Warning("Clusters2Tracks",msg);
83 delete t;
84 continue;
85 }
86 if (TMath::Abs(t->GetD())>5) {
87 delete t;
88 continue;
89 }
90
91 if (CorrectForDeadZoneMaterial(t)!=0) {
92 Warning("Clusters2Tracks",
93 "failed to correct for the material in the dead zone !\n");
94 delete t;
95 continue;
96 }
97 itsTracks.AddLast(t);
98 }
99 } /* End Read HLT ESD tracks */
100
101 itsTracks.Sort();
102 Int_t nentr=itsTracks.GetEntriesFast();
103 Info("Clusters2Tracks", "Number of Selected for tracking HLT ESD tracks: %d\n", nentr);
104
105 Int_t ntrk=0;
106 for (fPass=0; fPass<2; fPass++) {
107 Int_t &constraint=fConstraint[fPass]; if (constraint<0) continue;
108 for (Int_t i=0; i<nentr; i++) {
3136129d 109 // Info("Clusters2Tracks"," %d ",i);
9582ea1a 110 AliL3ITStrack *t=(AliL3ITStrack*)itsTracks.UncheckedAt(i);
111 if (t==0) continue; //this track has been already tracked
112 Int_t tpcLabel=t->GetLabel(); //save the TPC track label
3136129d 113 // Info("Clusters2Tracks","Pt:%f",1/t->Get1Pt());
9582ea1a 114 ResetTrackToFollow(*t);
115 ResetBestTrack();
116
117 for (FollowProlongation(); fI<kMaxLayer; fI++) {
118 while (TakeNextProlongation()) FollowProlongation();
119 }
120
121 if (fBestTrack.GetNumberOfClusters() == 0) continue;
122
123 if (fConstraint[fPass]) {
124 ResetTrackToFollow(*t);
125 if (!RefitAt(3.7, &fTrackToFollow, &fBestTrack)) continue;
126 ResetBestTrack();
3136129d 127 }
9582ea1a 128
3136129d 129 if (!fBestTrack.PropagateTo(3.,0.0028,65.19)) continue;
130 if (!fBestTrack.PropagateToVertex()) continue;
9582ea1a 131 fBestTrack.SetLabel(tpcLabel);
132 fBestTrack.CookdEdx();
133 CookLabel(&fBestTrack,0.); //For comparison only
134 // Specific to the AliL3ITStracker
135 // fBestTrack.UpdateESDtrack(AliESDtrack::kITSin);
136 t->GetESDHLTtrack()->UpdateTrackParams(&fBestTrack);
137 //
138 UseClusters(&fBestTrack);
139 delete itsTracks.RemoveAt(i);
140 ntrk++;
141 }
142 }
143
144 itsTracks.Delete();
145
146 Info("Clusters2Tracks","Number of prolonged tracks: %d\n",ntrk);
147
148 return 0;
149}
150
151Int_t AliL3ITStracker::PropagateBack(AliESD *event) {
152 //--------------------------------------------------------------------
153 // This functions propagates reconstructed ITS tracks back
154 //--------------------------------------------------------------------
155 Int_t nentr=event->GetNumberOfHLTHoughTracks();
156 Info("PropagateBack", "Number of HLT ESD tracks: %d\n", nentr);
157
158 Int_t ntrk=0;
159 for (Int_t i=0; i<nentr; i++) {
160 AliESDHLTtrack *esd=event->GetHLTHoughTrack(i);
161 if (esd->GetWeight() > 500) continue;
162
163 AliL3ITStrack *t=0;
164 try {
165 t=new AliL3ITStrack(*esd,GetZ());
166 } catch (const Char_t *msg) {
167 Warning("PropagateBack",msg);
168 delete t;
169 continue;
170 }
171
172 ResetTrackToFollow(*t);
173
174 // propagete to vertex [SR, GSI 17.02.2003]
175 // Start Time measurement [SR, GSI 17.02.2003], corrected by I.Belikov
176 if (fTrackToFollow.PropagateTo(3.,0.0028,65.19)) {
177 if (fTrackToFollow.PropagateToVertex()) {
178 fTrackToFollow.StartTimeIntegral();
179 }
180 fTrackToFollow.PropagateTo(3.,-0.0028,65.19);
181 }
182
183 fTrackToFollow.ResetCovariance(); fTrackToFollow.ResetClusters();
184 if (RefitAt(49.,&fTrackToFollow,t)) {
185 if (CorrectForDeadZoneMaterial(&fTrackToFollow)!=0) {
186 Warning("PropagateBack",
187 "failed to correct for the material in the dead zone !\n");
188 delete t;
189 continue;
190 }
191 fTrackToFollow.SetLabel(t->GetLabel());
192 //fTrackToFollow.CookdEdx();
193 CookLabel(&fTrackToFollow,0.); //For comparison only
194 // cout<<" Backtrack "<<fTrackToFollow.GetLabel()<<" "<<fTrackToFollow.GetNumberOfClusters()<<" "<<fTrackToFollow.fFakeRatio<<endl;
195 fTrackToFollow.UpdateESDtrack(AliESDtrack::kITSout);
196 //UseClusters(&fTrackToFollow);
197 ntrk++;
198 }
199 delete t;
200 }
201
202 Info("PropagateBack","Number of back propagated HLT ITS tracks: %d\n",ntrk);
203
204 return 0;
205}
206
207Int_t AliL3ITStracker::RefitInward(AliESD *event) {
208 //--------------------------------------------------------------------
209 // This functions refits ITS tracks using the
210 // "inward propagated" TPC tracks
211 //--------------------------------------------------------------------
212
213 Int_t nentr=event->GetNumberOfHLTHoughTracks();
214 Info("RefitInward", "The method is not yet implemented! %d",nentr);
215 return 0;
216}