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