]>
Commit | Line | Data |
---|---|---|
3e87ef69 | 1 | // @(#) $Id$ |
9392f4fd | 2 | |
b661165c | 3 | // Author: Anders Vestbo <mailto:vestbo@fi.uib.no>, Uli Frankenfeld <mailto:franken@fi.uib.no> |
3e87ef69 | 4 | //*-- Copyright © ALICE HLT Group |
108615fc | 5 | |
118c26c3 | 6 | #include "AliL3StandardIncludes.h" |
7 | ||
108615fc | 8 | #include "AliL3RootTypes.h" |
9 | #include "AliL3Logging.h" | |
10 | #include "AliL3Vertex.h" | |
11 | #include "AliL3ConfMapPoint.h" | |
12 | #include "AliL3ConfMapFit.h" | |
13 | #include "AliL3ConfMapTrack.h" | |
ef79795d | 14 | #include "AliL3Transform.h" |
6f388e0d | 15 | #include "AliLevel3.h" |
108615fc | 16 | |
3e87ef69 | 17 | /** \class AliL3ConfMapTrack |
18 | <pre> | |
b661165c | 19 | //_____________________________________________________________ |
20 | // AliL3ConfMapTrack | |
21 | // | |
22 | // Track class for conformal mapper | |
3e87ef69 | 23 | </pre> |
24 | */ | |
b661165c | 25 | |
108615fc | 26 | ClassImp(AliL3ConfMapTrack) |
27 | ||
28 | ||
29 | AliL3ConfMapTrack::AliL3ConfMapTrack() | |
30 | { | |
31 | //Constructor | |
108615fc | 32 | fChiSq[0] = 0.; |
33 | fChiSq[1] = 0.; | |
108615fc | 34 | } |
35 | ||
36 | AliL3ConfMapTrack::~AliL3ConfMapTrack() | |
37 | { | |
b1ed0288 | 38 | //deconstructor |
108615fc | 39 | } |
40 | ||
41 | void AliL3ConfMapTrack::DeleteCandidate() | |
42 | { | |
43 | //Deletes this track by resetting all its parameters. Does not delete | |
44 | //the object itself. | |
45 | ||
b1ed0288 | 46 | AliL3ConfMapPoint *curHit = (AliL3ConfMapPoint*)fFirstHit; |
108615fc | 47 | AliL3ConfMapPoint *nextHit; |
48 | ||
49 | while(curHit != 0) | |
50 | { | |
47e75a3e | 51 | nextHit = (AliL3ConfMapPoint*)curHit->GetNextTrackHit(); |
52 | curHit->SetNextTrackHit(0); | |
108615fc | 53 | curHit = nextHit; |
54 | } | |
55 | ||
56 | UInt_t *hit_numbers = GetHitNumbers(); | |
57 | for(Int_t i=0; i<GetNHits(); i++) | |
58 | { | |
59 | //fHitNumbers[i] = 0; | |
60 | hit_numbers[i]=0; | |
61 | } | |
62 | ||
63 | SetRadius(0.); | |
64 | SetCenterX(0.); | |
65 | SetCenterY(0.); | |
66 | ||
67 | ComesFromMainVertex(false); | |
68 | ||
69 | SetNHits(0); | |
70 | SetCharge(0); | |
71 | fChiSq[0] = 0.; | |
72 | fChiSq[1] = 0.; | |
73 | } | |
74 | ||
75 | ||
76 | void AliL3ConfMapTrack::SetProperties(Bool_t usage) | |
77 | { | |
78 | //Set the hits to this track to 'usage' | |
108615fc | 79 | for(StartLoop(); LoopDone(); GetNextHit()) |
80 | { | |
b1ed0288 | 81 | AliL3ConfMapPoint *p = (AliL3ConfMapPoint*)fCurrentHit; |
108615fc | 82 | p->SetUsage(usage); |
83 | } | |
84 | return; | |
85 | } | |
86 | ||
87 | void AliL3ConfMapTrack::Reset() | |
88 | { | |
89 | //Resets the fit parameters of this track. | |
90 | ||
91 | //xy-plane | |
b1ed0288 | 92 | fs11Xy = 0; |
93 | fs12Xy = 0; | |
94 | fs22Xy = 0; | |
95 | fg1Xy = 0; | |
96 | fg2Xy = 0; | |
108615fc | 97 | fChiSq[0] = 0.; |
98 | ||
99 | //sz-plane | |
b1ed0288 | 100 | fs11Sz = 0; |
101 | fs12Sz = 0; | |
102 | fs22Sz = 0; | |
103 | fg1Sz = 0; | |
104 | fg2Sz = 0; | |
108615fc | 105 | fChiSq[1] = 0; |
106 | SetLength(0); | |
355debe1 | 107 | SetNHits(0); |
108615fc | 108 | } |
109 | ||
110 | void AliL3ConfMapTrack::UpdateParam(AliL3ConfMapPoint *thisHit) | |
111 | { | |
112 | //Function to update fit parameters of track | |
113 | //Also, it updates the hit pointers. | |
114 | ||
115 | ||
116 | //Increment the number of hits assigned to this track: | |
117 | ||
118 | //fNHits++; | |
119 | Int_t nhits = GetNHits(); | |
120 | nhits++; | |
121 | SetNHits(nhits); //SetNHits(nhits++); | |
122 | ||
123 | //Set the hit pointers: | |
124 | //if(fNHits == 1) | |
125 | if(GetNHits()==1) | |
b1ed0288 | 126 | fFirstHit = thisHit; |
108615fc | 127 | else |
47e75a3e | 128 | ((AliL3ConfMapPoint*)fLastHit)->SetNextTrackHit(thisHit); |
b1ed0288 | 129 | fLastHit = thisHit; |
108615fc | 130 | |
131 | ||
b1ed0288 | 132 | fs11Xy = fs11Xy + thisHit->GetXYWeight() ; |
133 | fs12Xy = fs12Xy + thisHit->GetXYWeight() * thisHit->GetXprime() ; | |
134 | fs22Xy = fs22Xy + thisHit->GetXYWeight() * pow((thisHit->GetXprime()),2) ; | |
135 | fg1Xy = fg1Xy + thisHit->GetXYWeight() * thisHit->GetYprime() ; | |
136 | fg2Xy = fg2Xy + thisHit->GetXYWeight() * thisHit->GetXprime() * thisHit->GetYprime() ; | |
108615fc | 137 | |
b1ed0288 | 138 | fddXy = fs11Xy * fs22Xy - pow((fs12Xy),2) ; |
139 | if ( fddXy != 0 ) | |
108615fc | 140 | { |
b1ed0288 | 141 | fa1Xy = ( fg1Xy * fs22Xy - fg2Xy * fs12Xy ) / fddXy ; |
142 | fa2Xy = ( fg2Xy * fs11Xy - fg1Xy * fs12Xy ) / fddXy ; | |
108615fc | 143 | } |
144 | ||
145 | // Now in the sz plane | |
b1ed0288 | 146 | fs11Sz = fs11Sz + thisHit->GetZWeight() ; |
147 | fs12Sz = fs12Sz + thisHit->GetZWeight() * thisHit->GetS() ; | |
148 | fs22Sz = fs22Sz + thisHit->GetZWeight() * thisHit->GetS() * thisHit->GetS() ; | |
149 | fg1Sz = fg1Sz + thisHit->GetZWeight() * thisHit->GetZ() ; | |
150 | fg2Sz = fg2Sz + thisHit->GetZWeight() * thisHit->GetS() * thisHit->GetZ() ; | |
108615fc | 151 | |
152 | ||
b1ed0288 | 153 | fddSz = fs11Sz * fs22Sz - fs12Sz * fs12Sz ; |
154 | if ( fddSz != 0 ) { | |
155 | fa1Sz = ( fg1Sz * fs22Sz - fg2Sz * fs12Sz ) / fddSz ; | |
156 | fa2Sz = ( fg2Sz * fs11Sz - fg1Sz * fs12Sz ) / fddSz ; | |
108615fc | 157 | } |
108615fc | 158 | } |
159 | ||
160 | ||
161 | void AliL3ConfMapTrack::Fill(AliL3Vertex *vertex,Double_t max_Dca) | |
162 | { | |
163 | //Fill track variables with or without fit. | |
164 | ||
b1ed0288 | 165 | //fRadius = sqrt(fa2Xy*fa2Xy+1)/(2*fabs(fa1Xy)); |
166 | Double_t radius = sqrt(fa2Xy*fa2Xy+1)/(2*fabs(fa1Xy)); | |
108615fc | 167 | SetRadius(radius); |
168 | ||
5a31e9df | 169 | //fPt = (Double_t)(AliL3Transform::GetBFieldValue() * fRadius); |
170 | Double_t pt = (Double_t)(AliL3Transform::GetBFieldValue() * GetRadius()); | |
108615fc | 171 | SetPt(pt); |
172 | ||
173 | if(GetPt() > max_Dca) //go for fit of helix in real space | |
174 | { | |
175 | AliL3ConfMapFit *fit = new AliL3ConfMapFit(this,vertex); | |
1f1942b8 | 176 | ComesFromMainVertex(AliLevel3::DoVertexFit()); |
108615fc | 177 | fit->FitHelix(); |
3e87ef69 | 178 | |
b1ed0288 | 179 | //AliL3ConfMapPoint *lHit = (AliL3ConfMapPoint*)fLastHit; |
180 | AliL3ConfMapPoint *fHit = (AliL3ConfMapPoint*)fFirstHit; | |
1f1942b8 | 181 | SetLastPoint(fHit->GetX(),fHit->GetY(),fHit->GetZ()); |
3e87ef69 | 182 | |
0bd0c1ef | 183 | UpdateToFirstPoint(); |
108615fc | 184 | |
185 | delete fit; | |
186 | } | |
187 | else if(GetPt() == 0) | |
188 | LOG(AliL3Log::kError,"AliL3ConfMapTrack::Fill","Tracks")<<AliL3Log::kDec<< | |
189 | "Found track with Pt=0!!!"<<ENDLOG; | |
190 | else | |
191 | { | |
192 | LOG(AliL3Log::kError,"AliL3ConfMapTrack::Fill","Tracks")<<AliL3Log::kDec<< | |
193 | "Track with pt<max_Dca :"<<GetPt()<<ENDLOG; | |
194 | } | |
108615fc | 195 | } |
1f1942b8 | 196 | |
108615fc | 197 | Int_t AliL3ConfMapTrack::GetMCLabel() |
198 | { | |
199 | //For evaluation study. | |
200 | //Returns the MCtrackID of the belonging clusters. | |
201 | //If MCLabel < 0, means that track is fake. | |
202 | ||
203 | return 0; | |
204 | /* | |
205 | Int_t num_of_clusters = GetNumberOfPoints(); | |
206 | S *s=new S[num_of_clusters]; | |
207 | Int_t i; | |
208 | for (i=0; i<num_of_clusters; i++) s[i].lab=s[i].max=0; | |
209 | ||
210 | Int_t lab=123456789; | |
211 | for (i=0; i<num_of_clusters; i++) { | |
212 | AliL3ConfMapPoint *c=(AliL3ConfMapPoint*)fPoints->UncheckedAt(i); | |
213 | lab=fabs(c->fMCTrackID[0]); | |
214 | Int_t j; | |
215 | for (j=0; j<num_of_clusters; j++) | |
216 | if (s[j].lab==lab || s[j].max==0) break; | |
217 | s[j].lab=lab; | |
218 | s[j].max++; | |
219 | } | |
220 | ||
221 | Int_t max=0; | |
222 | for (i=0; i<num_of_clusters; i++) | |
223 | if (s[i].max>max) {max=s[i].max; lab=s[i].lab;} | |
224 | ||
225 | delete[] s; | |
226 | ||
227 | for (i=0; i<num_of_clusters; i++) { | |
228 | AliL3ConfMapPoint *c=(AliL3ConfMapPoint*)fPoints->UncheckedAt(i); | |
229 | if (fabs(c->fMCTrackID[1]) == lab || | |
230 | fabs(c->fMCTrackID[2]) == lab ) max++; | |
231 | } | |
232 | ||
233 | //check if more than 10% of the clusters are incorrectly assigned (fake track): | |
234 | ||
235 | if (1.-Float_t(max)/num_of_clusters > 0.10) | |
236 | { | |
237 | return -lab; | |
238 | } | |
239 | Int_t tail=Int_t(0.08*174); | |
240 | if (num_of_clusters < tail) return lab; | |
241 | ||
242 | max=0; | |
243 | for (i=1; i<=tail; i++) { | |
244 | AliL3ConfMapPoint *c = (AliL3ConfMapPoint*)fPoints->UncheckedAt(num_of_clusters-i); | |
245 | if (lab == fabs(c->fMCTrackID[0]) || | |
246 | lab == fabs(c->fMCTrackID[1]) || | |
247 | lab == fabs(c->fMCTrackID[2])) max++; | |
248 | } | |
249 | if (max < Int_t(0.5*tail)) | |
250 | { | |
251 | //printf("Wrong innermost clusters\n"); | |
252 | return -lab; | |
253 | } | |
254 | return lab; | |
255 | */ | |
256 | } | |
257 |