]>
Commit | Line | Data |
---|---|---|
a6c02c85 | 1 | // @(#) $Id$ |
4aa41877 | 2 | // Original: AliHLTConfMapTrack.cxx,v 1.16 2005/06/14 10:55:21 cvetan |
a6c02c85 | 3 | |
2a083ac4 | 4 | /************************************************************************** |
9be2600f | 5 | * This file is property of and copyright by the ALICE HLT Project * |
6 | * ALICE Experiment at CERN, All rights reserved. * | |
2a083ac4 | 7 | * * |
9be2600f | 8 | * Primary Authors: Anders Vestbo, maintained by * |
9 | * Matthias Richter <Matthias.Richter@ift.uib.no> * | |
10 | * for The ALICE HLT Project. * | |
2a083ac4 | 11 | * * |
12 | * Permission to use, copy, modify and distribute this software and its * | |
13 | * documentation strictly for non-commercial purposes is hereby granted * | |
14 | * without fee, provided that the above copyright notice appears in all * | |
15 | * copies and that both the copyright notice and this permission notice * | |
16 | * appear in the supporting documentation. The authors make no claims * | |
17 | * about the suitability of this software for any purpose. It is * | |
18 | * provided "as is" without express or implied warranty. * | |
19 | **************************************************************************/ | |
20 | ||
21 | /** @file AliHLTTPCConfMapTrack.cxx | |
22 | @author Anders Vestbo, maintained by Matthias Richter | |
23 | @date | |
24 | @brief Track class for conformal mapper | |
25 | */ | |
a6c02c85 | 26 | |
a6c02c85 | 27 | #include "AliHLTTPCRootTypes.h" |
28 | #include "AliHLTTPCLogging.h" | |
29 | #include "AliHLTTPCVertex.h" | |
30 | #include "AliHLTTPCConfMapPoint.h" | |
31 | #include "AliHLTTPCConfMapFit.h" | |
32 | #include "AliHLTTPCConfMapTrack.h" | |
33 | #include "AliHLTTPCTransform.h" | |
a7c32962 | 34 | //#include "AliHLTTPC.h" |
a6c02c85 | 35 | |
a6c02c85 | 36 | #if __GNUC__ >= 3 |
37 | using namespace std; | |
38 | #endif | |
39 | ||
40 | ClassImp(AliHLTTPCConfMapTrack) | |
41 | ||
42 | ||
43 | AliHLTTPCConfMapTrack::AliHLTTPCConfMapTrack() | |
44 | { | |
45 | //Constructor | |
46 | fChiSq[0] = 0.; | |
47 | fChiSq[1] = 0.; | |
48 | } | |
49 | ||
2a083ac4 | 50 | AliHLTTPCConfMapTrack::AliHLTTPCConfMapTrack(const AliHLTTPCConfMapTrack&) |
51 | { | |
52 | // dummy copy constructor | |
53 | //HLTFatal("copy constructor untested"); | |
54 | } | |
55 | ||
56 | AliHLTTPCConfMapTrack& AliHLTTPCConfMapTrack::operator=(const AliHLTTPCConfMapTrack&) | |
57 | { | |
58 | // dummy assignment operator | |
59 | //HLTFatal("assignment operator untested"); | |
60 | return *this; | |
61 | } | |
62 | ||
a6c02c85 | 63 | AliHLTTPCConfMapTrack::~AliHLTTPCConfMapTrack() |
64 | { | |
65 | //deconstructor | |
66 | } | |
67 | ||
68 | void AliHLTTPCConfMapTrack::DeleteCandidate() | |
69 | { | |
70 | //Deletes this track by resetting all its parameters. Does not delete | |
71 | //the object itself. | |
72 | ||
73 | AliHLTTPCConfMapPoint *curHit = (AliHLTTPCConfMapPoint*)fFirstHit; | |
74 | AliHLTTPCConfMapPoint *nextHit; | |
75 | ||
76 | while(curHit != 0) | |
77 | { | |
78 | nextHit = (AliHLTTPCConfMapPoint*)curHit->GetNextTrackHit(); | |
79 | curHit->SetNextTrackHit(0); | |
80 | curHit = nextHit; | |
81 | } | |
82 | ||
83 | UInt_t *hit_numbers = GetHitNumbers(); | |
84 | for(Int_t i=0; i<GetNHits(); i++) | |
85 | { | |
86 | //fHitNumbers[i] = 0; | |
87 | hit_numbers[i]=0; | |
88 | } | |
89 | ||
90 | SetRadius(0.); | |
91 | SetCenterX(0.); | |
92 | SetCenterY(0.); | |
93 | ||
94 | ComesFromMainVertex(false); | |
95 | ||
96 | SetNHits(0); | |
97 | SetCharge(0); | |
98 | fChiSq[0] = 0.; | |
99 | fChiSq[1] = 0.; | |
100 | } | |
101 | ||
102 | ||
103 | void AliHLTTPCConfMapTrack::SetProperties(Bool_t usage) | |
104 | { | |
105 | //Set the hits to this track to 'usage' | |
106 | for(StartLoop(); LoopDone(); GetNextHit()) | |
107 | { | |
108 | AliHLTTPCConfMapPoint *p = (AliHLTTPCConfMapPoint*)fCurrentHit; | |
109 | p->SetUsage(usage); | |
110 | } | |
111 | return; | |
112 | } | |
113 | ||
114 | void AliHLTTPCConfMapTrack::Reset() | |
115 | { | |
116 | //Resets the fit parameters of this track. | |
117 | ||
118 | //xy-plane | |
119 | fs11Xy = 0; | |
120 | fs12Xy = 0; | |
121 | fs22Xy = 0; | |
122 | fg1Xy = 0; | |
123 | fg2Xy = 0; | |
124 | fChiSq[0] = 0.; | |
125 | ||
126 | //sz-plane | |
127 | fs11Sz = 0; | |
128 | fs12Sz = 0; | |
129 | fs22Sz = 0; | |
130 | fg1Sz = 0; | |
131 | fg2Sz = 0; | |
132 | fChiSq[1] = 0; | |
133 | SetLength(0); | |
134 | SetNHits(0); | |
135 | } | |
136 | ||
137 | void AliHLTTPCConfMapTrack::UpdateParam(AliHLTTPCConfMapPoint *thisHit) | |
138 | { | |
139 | //Function to update fit parameters of track | |
140 | //Also, it updates the hit pointers. | |
141 | ||
142 | ||
143 | //Increment the number of hits assigned to this track: | |
144 | ||
145 | //fNHits++; | |
146 | Int_t nhits = GetNHits(); | |
147 | nhits++; | |
148 | SetNHits(nhits); //SetNHits(nhits++); | |
149 | ||
150 | //Set the hit pointers: | |
151 | //if(fNHits == 1) | |
152 | if(GetNHits()==1) | |
153 | fFirstHit = thisHit; | |
154 | else | |
155 | ((AliHLTTPCConfMapPoint*)fLastHit)->SetNextTrackHit(thisHit); | |
156 | fLastHit = thisHit; | |
157 | ||
158 | ||
159 | fs11Xy = fs11Xy + thisHit->GetXYWeight() ; | |
160 | fs12Xy = fs12Xy + thisHit->GetXYWeight() * thisHit->GetXprime() ; | |
161 | fs22Xy = fs22Xy + thisHit->GetXYWeight() * pow((thisHit->GetXprime()),2) ; | |
162 | fg1Xy = fg1Xy + thisHit->GetXYWeight() * thisHit->GetYprime() ; | |
163 | fg2Xy = fg2Xy + thisHit->GetXYWeight() * thisHit->GetXprime() * thisHit->GetYprime() ; | |
164 | ||
165 | fddXy = fs11Xy * fs22Xy - pow((fs12Xy),2) ; | |
166 | if ( fddXy != 0 ) | |
167 | { | |
168 | fa1Xy = ( fg1Xy * fs22Xy - fg2Xy * fs12Xy ) / fddXy ; | |
169 | fa2Xy = ( fg2Xy * fs11Xy - fg1Xy * fs12Xy ) / fddXy ; | |
170 | } | |
171 | ||
172 | // Now in the sz plane | |
173 | fs11Sz = fs11Sz + thisHit->GetZWeight() ; | |
174 | fs12Sz = fs12Sz + thisHit->GetZWeight() * thisHit->GetS() ; | |
175 | fs22Sz = fs22Sz + thisHit->GetZWeight() * thisHit->GetS() * thisHit->GetS() ; | |
176 | fg1Sz = fg1Sz + thisHit->GetZWeight() * thisHit->GetZ() ; | |
177 | fg2Sz = fg2Sz + thisHit->GetZWeight() * thisHit->GetS() * thisHit->GetZ() ; | |
178 | ||
179 | ||
180 | fddSz = fs11Sz * fs22Sz - fs12Sz * fs12Sz ; | |
181 | if ( fddSz != 0 ) { | |
182 | fa1Sz = ( fg1Sz * fs22Sz - fg2Sz * fs12Sz ) / fddSz ; | |
183 | fa2Sz = ( fg2Sz * fs11Sz - fg1Sz * fs12Sz ) / fddSz ; | |
184 | } | |
185 | } | |
186 | ||
187 | ||
188 | void AliHLTTPCConfMapTrack::Fill(AliHLTTPCVertex *vertex,Double_t max_Dca) | |
189 | { | |
db16520a | 190 | //Fill track variables with or without fit. |
191 | ||
192 | // #### -B0-CHANGE-START == JMT | |
193 | // for straight line fit | |
194 | if (AliHLTTPCTransform::GetBFieldValue() == 0.0 ){ | |
195 | ||
196 | SetRadius(0.); | |
197 | SetPt(0.); | |
198 | ||
199 | //go for fit of straight line in real space | |
200 | AliHLTTPCConfMapFit *fit = new AliHLTTPCConfMapFit(this,vertex); | |
a7c32962 | 201 | /* Matthias 13.12.2006 |
202 | * the global variable AliHLTTPCS::fgDoVertexFit has never been used so far | |
203 | * and has always been kTRUE. | |
204 | * In order to remove the AliHLTTPC class (which is the old steering class for | |
205 | * HLT (TPC) tracking) from the compilation, this function can not be activated | |
206 | * again. We have to think about a more elegant way to specify the parameters | |
207 | * anyway. | |
db16520a | 208 | ComesFromMainVertex(AliHLTTPC::DoVertexFit()); |
a7c32962 | 209 | */ |
210 | ComesFromMainVertex(kTRUE); | |
db16520a | 211 | fit->FitStraightLine(); |
212 | ||
213 | AliHLTTPCConfMapPoint *fHit = (AliHLTTPCConfMapPoint*)fFirstHit; | |
214 | SetLastPoint(fHit->GetX(),fHit->GetY(),fHit->GetZ()); | |
215 | ||
216 | UpdateToFirstPoint(); | |
217 | ||
218 | delete fit; | |
219 | ||
a6c02c85 | 220 | } |
db16520a | 221 | // for helix fit |
222 | else { | |
223 | // #### -B0-UNCHANGED-START == JMT | |
224 | //fRadius = sqrt(fa2Xy*fa2Xy+1)/(2*fabs(fa1Xy)); | |
225 | Double_t radius = sqrt(fa2Xy*fa2Xy+1)/(2*fabs(fa1Xy)); | |
226 | SetRadius(radius); | |
227 | ||
228 | //fPt = (Double_t)(AliHLTTPCTransform::GetBFieldValue() * fRadius); | |
229 | Double_t pt = (Double_t)(AliHLTTPCTransform::GetBFieldValue() * GetRadius()); | |
230 | SetPt(pt); | |
231 | ||
232 | if(GetPt() > max_Dca) //go for fit of helix in real space | |
233 | { | |
234 | AliHLTTPCConfMapFit *fit = new AliHLTTPCConfMapFit(this,vertex); | |
a7c32962 | 235 | /* Matthias 13.12.2006 |
236 | * the global variable AliHLTTPCS::fgDoVertexFit has never been used so far | |
237 | * and has always been kTRUE. | |
238 | * In order to remove the AliHLTTPC class (which is the old steering class for | |
239 | * HLT (TPC) tracking) from the compilation, this function can not be activated | |
240 | * again. We have to think about a more elegant way to specify the parameters | |
241 | * anyway. | |
db16520a | 242 | ComesFromMainVertex(AliHLTTPC::DoVertexFit()); |
a7c32962 | 243 | */ |
244 | ComesFromMainVertex(kTRUE); | |
db16520a | 245 | fit->FitHelix(); |
246 | ||
247 | //AliHLTTPCConfMapPoint *lHit = (AliHLTTPCConfMapPoint*)fLastHit; | |
248 | AliHLTTPCConfMapPoint *fHit = (AliHLTTPCConfMapPoint*)fFirstHit; | |
249 | SetLastPoint(fHit->GetX(),fHit->GetY(),fHit->GetZ()); | |
250 | ||
251 | UpdateToFirstPoint(); | |
252 | ||
253 | delete fit; | |
254 | } | |
fc455fba | 255 | else if(GetPt() == 0) |
256 | { | |
db16520a | 257 | LOG(AliHLTTPCLog::kError,"AliHLTTPCConfMapTrack::Fill","Tracks")<<AliHLTTPCLog::kDec<< |
258 | "Found track with Pt=0!!!"<<ENDLOG; | |
fc455fba | 259 | } |
db16520a | 260 | else |
261 | { | |
262 | LOG(AliHLTTPCLog::kError,"AliHLTTPCConfMapTrack::Fill","Tracks")<<AliHLTTPCLog::kDec<< | |
263 | "Track with pt<max_Dca :"<<GetPt()<<ENDLOG; | |
264 | } | |
265 | // #### -B0-UNCHANGED-END == JMT | |
a6c02c85 | 266 | } |
db16520a | 267 | // #### -B0-CHANGE-END == JMT |
a6c02c85 | 268 | } |
269 | ||
270 | Int_t AliHLTTPCConfMapTrack::GetMCLabel() | |
271 | { | |
272 | //For evaluation study. | |
273 | //Returns the MCtrackID of the belonging clusters. | |
274 | //If MCLabel < 0, means that track is fake. | |
275 | ||
276 | return 0; | |
277 | /* | |
278 | Int_t num_of_clusters = GetNumberOfPoints(); | |
279 | S *s=new S[num_of_clusters]; | |
280 | Int_t i; | |
281 | for (i=0; i<num_of_clusters; i++) s[i].lab=s[i].max=0; | |
282 | ||
283 | Int_t lab=123456789; | |
284 | for (i=0; i<num_of_clusters; i++) { | |
285 | AliHLTTPCConfMapPoint *c=(AliHLTTPCConfMapPoint*)fPoints->UncheckedAt(i); | |
286 | lab=fabs(c->fMCTrackID[0]); | |
287 | Int_t j; | |
288 | for (j=0; j<num_of_clusters; j++) | |
289 | if (s[j].lab==lab || s[j].max==0) break; | |
290 | s[j].lab=lab; | |
291 | s[j].max++; | |
292 | } | |
293 | ||
294 | Int_t max=0; | |
295 | for (i=0; i<num_of_clusters; i++) | |
296 | if (s[i].max>max) {max=s[i].max; lab=s[i].lab;} | |
297 | ||
298 | delete[] s; | |
299 | ||
300 | for (i=0; i<num_of_clusters; i++) { | |
301 | AliHLTTPCConfMapPoint *c=(AliHLTTPCConfMapPoint*)fPoints->UncheckedAt(i); | |
302 | if (fabs(c->fMCTrackID[1]) == lab || | |
303 | fabs(c->fMCTrackID[2]) == lab ) max++; | |
304 | } | |
305 | ||
306 | //check if more than 10% of the clusters are incorrectly assigned (fake track): | |
307 | ||
308 | if (1.-Float_t(max)/num_of_clusters > 0.10) | |
309 | { | |
310 | return -lab; | |
311 | } | |
312 | Int_t tail=Int_t(0.08*174); | |
313 | if (num_of_clusters < tail) return lab; | |
314 | ||
315 | max=0; | |
316 | for (i=1; i<=tail; i++) { | |
317 | AliHLTTPCConfMapPoint *c = (AliHLTTPCConfMapPoint*)fPoints->UncheckedAt(num_of_clusters-i); | |
318 | if (lab == fabs(c->fMCTrackID[0]) || | |
319 | lab == fabs(c->fMCTrackID[1]) || | |
320 | lab == fabs(c->fMCTrackID[2])) max++; | |
321 | } | |
322 | if (max < Int_t(0.5*tail)) | |
323 | { | |
324 | //printf("Wrong innermost clusters\n"); | |
325 | return -lab; | |
326 | } | |
327 | return lab; | |
328 | */ | |
329 | } | |
330 |