]>
Commit | Line | Data |
---|---|---|
d810d0de | 1 | // $Id$ |
2 | // Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007 | |
3 | ||
4 | /************************************************************************** | |
5 | * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. * | |
6 | * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for * | |
51346b82 | 7 | * full copyright notice. * |
d810d0de | 8 | **************************************************************************/ |
fd31e9de | 9 | |
a4197d2e | 10 | #include "TVector.h" |
11 | #include "TLinearFitter.h" | |
b3d20a1c | 12 | |
6983e87a | 13 | #include "TEveTrans.h" |
b3d20a1c | 14 | #include "TEveManager.h" |
15 | ||
16 | #include "EveBase/AliEveEventManager.h" | |
6983e87a | 17 | |
d810d0de | 18 | #include "AliEveTRDData.h" |
19 | #include "AliEveTRDModuleImp.h" | |
b3d20a1c | 20 | #include "AliEveTRDLoader.h" |
21 | #include "AliEveTRDLoaderImp.h" | |
a282bf09 | 22 | |
6983e87a | 23 | #include "AliLog.h" |
a4197d2e | 24 | #include "AliPID.h" |
25 | #include "AliTrackPointArray.h" | |
57ce0047 | 26 | #include "AliRieman.h" |
6983e87a | 27 | |
edf0c4a0 | 28 | #include "AliTRDhit.h" |
29 | #include "AliTRDcluster.h" | |
6983e87a | 30 | #include "AliTRDseedV1.h" |
31 | #include "AliTRDtrackV1.h" | |
a4197d2e | 32 | #include "AliTRDtrackerV1.h" |
a282bf09 | 33 | #include "AliTRDpadPlane.h" |
a4197d2e | 34 | #include "AliTRDdigitsManager.h" |
20301585 | 35 | #include "AliTRDarrayADC.h" |
0d9ef37b | 36 | #include "AliTRDSignalIndex.h" |
a282bf09 | 37 | #include "AliTRDgeometry.h" |
6983e87a | 38 | #include "AliTRDtransform.h" |
a4197d2e | 39 | #include "AliTRDReconstructor.h" |
40 | #include "AliTRDrecoParam.h" | |
a282bf09 | 41 | |
d810d0de | 42 | ClassImp(AliEveTRDHits) |
43 | ClassImp(AliEveTRDDigits) | |
44 | ClassImp(AliEveTRDClusters) | |
6983e87a | 45 | ClassImp(AliEveTRDTracklet) |
46 | ClassImp(AliEveTRDTrack) | |
a282bf09 | 47 | |
48 | /////////////////////////////////////////////////////////// | |
fd31e9de | 49 | ///////////// AliEveTRDDigits ///////////////////// |
a282bf09 | 50 | /////////////////////////////////////////////////////////// |
51 | ||
fd31e9de | 52 | //______________________________________________________________________________ |
53 | AliEveTRDDigits::AliEveTRDDigits(AliEveTRDChamber *p) : | |
54 | TEveQuadSet("digits", ""), fParent(p), fBoxes(), fData() | |
a15e6d7d | 55 | { |
56 | // Constructor. | |
57 | } | |
a282bf09 | 58 | |
fd31e9de | 59 | //______________________________________________________________________________ |
6983e87a | 60 | AliEveTRDDigits::~AliEveTRDDigits() |
a282bf09 | 61 | { |
6983e87a | 62 | // AliInfo(GetTitle()); |
a282bf09 | 63 | } |
64 | ||
fd31e9de | 65 | //______________________________________________________________________________ |
d810d0de | 66 | void AliEveTRDDigits::ComputeRepresentation() |
a282bf09 | 67 | { |
84aff7a4 | 68 | // Calculate digits representation according to user settings. The |
69 | // user can set the following parameters: | |
70 | // - digits scale (log/lin) | |
71 | // - digits threshold | |
72 | // - digits apparence (quads/boxes) | |
73 | ||
0d9ef37b | 74 | if(!fData.HasData()){ |
75 | return; | |
76 | } | |
77 | ||
6983e87a | 78 | TEveQuadSet::Reset(TEveQuadSet::kQT_RectangleYZ, kTRUE, 64); |
51346b82 | 79 | |
6983e87a | 80 | Double_t scale, dy, dz; |
81 | Int_t q, color; | |
0d9ef37b | 82 | Int_t nrows = fData.GetNrow(), |
83 | ncols = fData.GetNcol(), | |
84 | ntbs = fData.GetNtime(), | |
6983e87a | 85 | det = fParent->GetID(); |
86 | Float_t threshold = fParent->GetDigitsThreshold(); | |
a282bf09 | 87 | |
6983e87a | 88 | AliTRDtransform transform(det); |
89 | AliTRDgeometry *geo = fParent->fGeo; | |
7bc3159a | 90 | AliTRDpadPlane *pp = geo->GetPadPlane(geo->GetLayer(det), geo->GetStack(det)); |
51346b82 | 91 | |
6983e87a | 92 | // express position in tracking coordinates |
84aff7a4 | 93 | fData.Expand(); |
6983e87a | 94 | for (Int_t ir = 0; ir < nrows; ir++) { |
95 | dz = pp->GetRowSize(ir); | |
96 | for (Int_t ic = 0; ic < ncols; ic++) { | |
97 | dy = pp->GetColSize(ic); | |
98 | for (Int_t it = 0; it < ntbs; it++) { | |
9330a7aa | 99 | q = fData.GetData(ir, ic, it); |
6983e87a | 100 | if (q < threshold) continue; |
101 | ||
102 | Double_t x[6] = {0., 0., Double_t(q), 0., 0., 0.}; | |
103 | Int_t roc[3] = {ir, ic, 0}; | |
104 | Bool_t out = kTRUE; | |
105 | transform.Transform(&x[0], &roc[0], UInt_t(it), out, 0); | |
106 | ||
107 | scale = q < 512 ? q/512. : 1.; | |
108 | color = 50+int(scale*50.); | |
109 | ||
110 | AddQuad(x[1]-.45*dy, x[2]-.5*dz*scale, x[0], .9*dy, dz*scale); | |
111 | QuadValue(q); | |
fbc350a3 | 112 | QuadColor(color); |
6983e87a | 113 | QuadId(new TNamed(Form("Charge%d", q), "dummy title")); |
84aff7a4 | 114 | } // end time loop |
115 | } // end col loop | |
116 | } // end row loop | |
9330a7aa | 117 | fData.Compress(); |
6983e87a | 118 | |
119 | // rotate to global coordinates | |
120 | //RefitPlex(); | |
121 | TEveTrans& t = RefMainTrans(); | |
122 | t.SetRotByAngles((geo->GetSector(det)+.5)*AliTRDgeometry::GetAlpha(), 0.,0.); | |
a282bf09 | 123 | } |
124 | ||
6983e87a | 125 | //______________________________________________________________________________ |
126 | void AliEveTRDDigits::SetData(AliTRDdigitsManager *digits) | |
127 | { | |
128 | // Set data source. | |
129 | ||
0d9ef37b | 130 | Int_t det = fParent->GetID(); |
20301585 | 131 | AliTRDarrayADC *data = digits->GetDigits(det); |
132 | if(!data->GetDim()) return; | |
0d9ef37b | 133 | data->Expand(); |
134 | ||
135 | AliTRDSignalIndex *indexes = digits->GetIndexes(det); | |
136 | if(!indexes->IsAllocated()) digits->BuildIndexes(det); | |
137 | ||
138 | if(!fData.HasData()) fData.Allocate(data->GetNrow(), data->GetNcol(), data->GetNtime()); | |
139 | fData.Expand(); | |
140 | ||
141 | Int_t row, col, time, adc; | |
142 | indexes->ResetCounters(); | |
143 | while (indexes->NextRCIndex(row, col)){ | |
144 | indexes->ResetTbinCounter(); | |
145 | while (indexes->NextTbinIndex(time)){ | |
146 | if(data->IsPadCorrupted(row, col, time)){ | |
147 | // we should mark this position | |
148 | break; | |
6983e87a | 149 | } |
0d9ef37b | 150 | adc = data->GetData(row, col, time); |
151 | if(adc <= 1) continue; | |
9330a7aa | 152 | fData.SetData(row, col, time, adc); |
0d9ef37b | 153 | //fIndex->AddIndexTBin(row,col,time); |
154 | //printf("\tr[%d] c[%d] t[%d] ADC[%d]\n", row, col, time, adc); | |
155 | } | |
156 | } | |
9330a7aa | 157 | fData.Compress(); |
6983e87a | 158 | } |
159 | ||
160 | ||
fd31e9de | 161 | //______________________________________________________________________________ |
d810d0de | 162 | void AliEveTRDDigits::Paint(Option_t *option) |
a282bf09 | 163 | { |
a15e6d7d | 164 | // Paint the object. |
165 | ||
fd31e9de | 166 | if(fParent->GetDigitsBox()) fBoxes.Paint(option); |
167 | else TEveQuadSet::Paint(option); | |
a282bf09 | 168 | } |
169 | ||
fd31e9de | 170 | //______________________________________________________________________________ |
d810d0de | 171 | void AliEveTRDDigits::Reset() |
a282bf09 | 172 | { |
a15e6d7d | 173 | // Reset raw and visual data. |
174 | ||
6983e87a | 175 | TEveQuadSet::Reset(TEveQuadSet::kQT_RectangleYZ, kTRUE, 64); |
fd31e9de | 176 | // MT fBoxes.fBoxes.clear(); |
e00a9cae | 177 | fData.Reset(); |
a282bf09 | 178 | } |
179 | ||
180 | /////////////////////////////////////////////////////////// | |
fd31e9de | 181 | ///////////// AliEveTRDHits ///////////////////// |
a282bf09 | 182 | /////////////////////////////////////////////////////////// |
183 | ||
fd31e9de | 184 | //______________________________________________________________________________ |
a4197d2e | 185 | AliEveTRDHits::AliEveTRDHits() : TEvePointSet("hits", 20) |
a15e6d7d | 186 | { |
187 | // Constructor. | |
a4197d2e | 188 | SetMarkerSize(.1); |
b3d20a1c | 189 | SetMarkerColor(kGreen); |
a4197d2e | 190 | SetOwnIds(kTRUE); |
6983e87a | 191 | } |
192 | ||
193 | //______________________________________________________________________________ | |
194 | AliEveTRDHits::~AliEveTRDHits() | |
195 | { | |
196 | //AliInfo(GetTitle()); | |
a15e6d7d | 197 | } |
a282bf09 | 198 | |
fd31e9de | 199 | //______________________________________________________________________________ |
d810d0de | 200 | void AliEveTRDHits::PointSelected(Int_t n) |
edf0c4a0 | 201 | { |
a15e6d7d | 202 | // Handle an individual point selection from GL. |
203 | ||
a969af30 | 204 | AliTRDhit *h = 0x0; |
205 | if(!(h = dynamic_cast<AliTRDhit*>(GetPointId(n)))) return; | |
206 | printf("Id[%3d] Det[%3d] Reg[%c] TR[%c] Q[%3d] MC[%d] t[%f]\n", | |
207 | n, h->GetDetector(), | |
208 | h->FromAmplification() ? 'A' : 'D', | |
209 | h->FromTRphoton() ? 'y' : 'n', | |
210 | h->GetCharge(), h->GetTrack(), h->GetTime()); | |
a282bf09 | 211 | } |
212 | ||
edf0c4a0 | 213 | |
214 | /////////////////////////////////////////////////////////// | |
6983e87a | 215 | ///////////// AliEveTRDClusters ///////////////////// |
edf0c4a0 | 216 | /////////////////////////////////////////////////////////// |
217 | ||
fd31e9de | 218 | //______________________________________________________________________________ |
a4197d2e | 219 | AliEveTRDClusters::AliEveTRDClusters():AliEveTRDHits() |
a15e6d7d | 220 | { |
221 | // Constructor. | |
6983e87a | 222 | SetName("clusters"); |
a4197d2e | 223 | |
5524a724 | 224 | SetMarkerSize(.4); |
a4197d2e | 225 | SetMarkerStyle(24); |
5524a724 | 226 | SetMarkerColor(kGray); |
a4197d2e | 227 | SetOwnIds(kTRUE); |
a15e6d7d | 228 | } |
edf0c4a0 | 229 | |
fd31e9de | 230 | //______________________________________________________________________________ |
d810d0de | 231 | void AliEveTRDClusters::PointSelected(Int_t n) |
edf0c4a0 | 232 | { |
a15e6d7d | 233 | // Handle an individual point selection from GL. |
234 | ||
fd31e9de | 235 | AliTRDcluster *c = dynamic_cast<AliTRDcluster*>(GetPointId(n)); |
236 | printf("\nDetector : %d\n", c->GetDetector()); | |
237 | printf("Charge : %f\n", c->GetQ()); | |
238 | printf("Sum S : %4.0f\n", c->GetSumS()); | |
239 | printf("Time bin : %d\n", c->GetLocalTimeBin()); | |
240 | printf("Signals : "); | |
241 | Short_t *cSignals = c->GetSignals(); | |
242 | for(Int_t ipad=0; ipad<7; ipad++) printf("%d ", cSignals[ipad]); printf("\n"); | |
243 | printf("Central pad : %d\n", c->GetPadCol()); | |
244 | printf("MC track labels : "); | |
245 | for(Int_t itrk=0; itrk<3; itrk++) printf("%d ", c->GetLabel(itrk)); printf("\n"); | |
246 | // Bool_t AliCluster::GetGlobalCov(Float_t* cov) const | |
247 | // Bool_t AliCluster::GetGlobalXYZ(Float_t* xyz) const | |
248 | // Float_t AliCluster::GetSigmaY2() const | |
249 | // Float_t AliCluster::GetSigmaYZ() const | |
250 | // Float_t AliCluster::GetSigmaZ2() const | |
edf0c4a0 | 251 | } |
252 | ||
57d55fae | 253 | //______________________________________________________________________________ |
254 | void AliEveTRDClusters::Print(Option_t *o) const | |
255 | { | |
256 | AliTRDcluster *c = 0x0; | |
257 | ||
258 | for(Int_t n = GetN(); n--;){ | |
259 | if(!(c = dynamic_cast<AliTRDcluster*>(GetPointId(n)))) continue; | |
260 | c->Print(o); | |
261 | } | |
262 | } | |
263 | ||
b3d20a1c | 264 | //______________________________________________________________________________ |
265 | void AliEveTRDClusters::Load(Char_t *w, Bool_t stk) const | |
266 | { | |
267 | Int_t typ = -1; | |
268 | if(strcmp(w, "hit")==0) typ = 0; | |
269 | else if(strcmp(w, "dig")==0) typ = 1; | |
270 | else if(strcmp(w, "cls")==0) typ = 2; | |
271 | else if(strcmp(w, "all")==0) typ = 3; | |
272 | else{ | |
273 | AliInfo("The following arguments are accepted:"); | |
274 | AliInfo(" \"hit\" : loading of MC hits"); | |
275 | AliInfo(" \"dig\" : loading of digits"); | |
276 | AliInfo(" \"cls\" : loading of reconstructed clusters"); | |
277 | AliInfo(" \"all\" : loading of MC hits+digits+clusters"); | |
278 | return; | |
279 | } | |
280 | ||
281 | AliTRDcluster *c = 0x0; | |
282 | Int_t n = 0; | |
283 | while((n = GetN() && !(c = dynamic_cast<AliTRDcluster*>(GetPointId(n))))) n++; | |
284 | if(!c) return; | |
285 | ||
286 | Int_t det = c->GetDetector(); | |
287 | AliEveTRDLoader *loader = 0x0; | |
288 | switch(typ){ | |
289 | case 0: | |
290 | loader = new AliEveTRDLoader("Hits"); | |
291 | if(!loader->Open("TRD.Hits.root")){ | |
292 | delete loader; | |
293 | return; | |
294 | } | |
295 | loader->SetDataType(AliEveTRDLoader::kTRDHits); | |
296 | break; | |
297 | case 1: | |
298 | loader = new AliEveTRDLoader("Digits"); | |
299 | if(!loader->Open("TRD.Digits.root")){ | |
300 | delete loader; | |
301 | return; | |
302 | } | |
303 | loader->SetDataType(AliEveTRDLoader::kTRDDigits); | |
304 | break; | |
305 | case 2: | |
306 | loader = new AliEveTRDLoader("Clusters"); | |
307 | if(!loader->Open("TRD.RecPoints.root")){ | |
308 | delete loader; | |
309 | return; | |
310 | } | |
311 | loader->SetDataType(AliEveTRDLoader::kTRDClusters); | |
312 | break; | |
313 | case 3: | |
314 | loader = new AliEveTRDLoaderSim("MC"); | |
315 | if(!loader->Open("galice.root")){ | |
316 | delete loader; | |
317 | return; | |
318 | } | |
319 | loader->SetDataType(AliEveTRDLoader::kTRDHits | AliEveTRDLoader::kTRDDigits | AliEveTRDLoader::kTRDClusters); | |
320 | break; | |
321 | default: return; | |
322 | } | |
323 | ||
324 | loader->AddChambers(AliTRDgeometry::GetSector(det),AliTRDgeometry::GetStack(det), stk ? -1 : AliTRDgeometry::GetLayer(det)); | |
325 | // load first event | |
326 | loader->GoToEvent(AliEveEventManager::GetCurrent()->GetEventId()); | |
327 | ||
328 | // register loader with alieve | |
329 | gEve->AddElement(loader); | |
330 | //loader->SpawnEditor(); | |
331 | gEve->Redraw3D(); | |
332 | } | |
333 | ||
edf0c4a0 | 334 | /////////////////////////////////////////////////////////// |
6983e87a | 335 | ///////////// AliEveTRDTracklet ///////////////////// |
edf0c4a0 | 336 | /////////////////////////////////////////////////////////// |
edf0c4a0 | 337 | |
6983e87a | 338 | //______________________________________________________________________________ |
a4197d2e | 339 | AliEveTRDTracklet::AliEveTRDTracklet(AliTRDseedV1 *trklt):TEveLine() |
340 | ,fClusters(0x0) | |
a282bf09 | 341 | { |
6983e87a | 342 | // Constructor. |
343 | SetName("tracklet"); | |
a4197d2e | 344 | |
345 | SetUserData(trklt); | |
a7cc0364 | 346 | Float_t dx; |
347 | Float_t x0 = trklt->GetX0(); | |
348 | Float_t y0 = trklt->GetYref(0); | |
349 | Float_t z0 = trklt->GetZref(0); | |
350 | Float_t dydx = trklt->GetYref(1); | |
351 | Float_t dzdx = trklt->GetZref(1); | |
352 | Float_t tilt = trklt->GetTilt(); | |
a4197d2e | 353 | Float_t g[3]; |
354 | AliTRDcluster *c = 0x0; | |
c624c106 | 355 | for(Int_t ic=0; ic<AliTRDseedV1::kNclusters; ic++){ |
a4197d2e | 356 | if(!(c = trklt->GetClusters(ic))) continue; |
57d55fae | 357 | if(!fClusters) AddElement(fClusters = new AliEveTRDClusters()); |
a7cc0364 | 358 | dx = x0 - c->GetX(); |
359 | //Float_t yt = y0 - dx*dydx; | |
360 | Float_t zt = z0 - dx*dzdx; | |
57ce0047 | 361 | // backup yc - for testing purposes |
362 | Float_t yc = c->GetY(); | |
363 | c->SetY(yc-tilt*(c->GetZ()-zt)); | |
a4197d2e | 364 | c->GetGlobalXYZ(g); |
365 | Int_t id = fClusters->SetNextPoint(g[0], g[1], g[2]); | |
57d55fae | 366 | //Int_t id = fClusters->SetNextPoint(c->GetX(), c->GetY(), c->GetZ()); |
57ce0047 | 367 | c->SetY(yc); |
a4197d2e | 368 | fClusters->SetPointId(id, new AliTRDcluster(*c)); |
369 | } | |
a7cc0364 | 370 | if(fClusters){ |
371 | fClusters->SetTitle(Form("N[%d]", trklt->GetN2())); | |
372 | fClusters->SetMarkerColor(kMagenta); | |
373 | } | |
a4197d2e | 374 | |
a7cc0364 | 375 | SetTitle(Form("Det[%d] Plane[%d] P[%7.3f]", trklt->GetDetector(), trklt->GetPlane(), trklt->GetMomentum())); |
5524a724 | 376 | SetLineColor(kRed); |
a4197d2e | 377 | //SetOwnIds(kTRUE); |
378 | ||
a7cc0364 | 379 | // init tracklet line |
380 | Int_t sec = AliTRDgeometry::GetSector(trklt->GetDetector()); | |
a4197d2e | 381 | Double_t alpha = AliTRDgeometry::GetAlpha() * (sec<9 ? sec + .5 : sec - 17.5); |
a7cc0364 | 382 | |
aecbd636 | 383 | //trklt->Fit(kTRUE); |
a7cc0364 | 384 | y0 = trklt->GetYfit(0); |
385 | dydx = trklt->GetYfit(1); | |
386 | Double_t xg = x0 * TMath::Cos(alpha) - y0 * TMath::Sin(alpha); | |
387 | Double_t yg = x0 * TMath::Sin(alpha) + y0 * TMath::Cos(alpha); | |
57ce0047 | 388 | SetPoint(0, xg, yg, z0); |
389 | //SetPoint(0, x0, y0, z0); | |
57d55fae | 390 | |
391 | ||
a7cc0364 | 392 | dx = .5*AliTRDgeometry::CamHght()+AliTRDgeometry::CdrHght(); |
393 | x0 -= dx; | |
394 | y0 -= dydx*dx, | |
395 | z0 -= dzdx*dx; | |
396 | xg = x0 * TMath::Cos(alpha) - y0 * TMath::Sin(alpha); | |
397 | yg = x0 * TMath::Sin(alpha) + y0 * TMath::Cos(alpha); | |
398 | SetPoint(1, xg, yg, z0); | |
57ce0047 | 399 | //SetPoint(1, x0, y0, z0); |
a4197d2e | 400 | } |
401 | ||
402 | //______________________________________________________________________________ | |
57d55fae | 403 | void AliEveTRDTracklet::Print(Option_t *o) const |
a4197d2e | 404 | { |
405 | AliTRDseedV1 *tracklet = (AliTRDseedV1*)GetUserData(); | |
57d55fae | 406 | if(!tracklet) return; |
407 | tracklet->Print(o); | |
a282bf09 | 408 | } |
409 | ||
edf0c4a0 | 410 | /////////////////////////////////////////////////////////// |
6983e87a | 411 | ///////////// AliEveTRDTrack ///////////////////// |
edf0c4a0 | 412 | /////////////////////////////////////////////////////////// |
6983e87a | 413 | |
414 | //______________________________________________________________________________ | |
baee73d3 | 415 | AliEveTRDTrack::AliEveTRDTrack(AliTRDtrackV1 *trk) |
416 | :TEveLine() | |
417 | ,fTrackState(0) | |
418 | ,fESDStatus(0) | |
419 | ,fAlpha(0.) | |
420 | ,fPoints(0x0) | |
57ce0047 | 421 | ,fRim(0x0) |
edf0c4a0 | 422 | { |
a15e6d7d | 423 | // Constructor. |
a4197d2e | 424 | SetUserData(trk); |
57d55fae | 425 | SetName(""); |
426 | ||
a4197d2e | 427 | AliTRDtrackerV1::SetNTimeBins(24); |
baee73d3 | 428 | |
57ce0047 | 429 | |
430 | fRim = new AliRieman(trk->GetNumberOfClusters()); | |
a4197d2e | 431 | AliTRDseedV1 *tracklet = 0x0; |
7bc3159a | 432 | for(Int_t il=0; il<AliTRDgeometry::kNlayer; il++){ |
433 | if(!(tracklet = trk->GetTracklet(il))) continue; | |
a4197d2e | 434 | if(!tracklet->IsOK()) continue; |
baee73d3 | 435 | AddElement(new AliEveTRDTracklet(tracklet)); |
a4197d2e | 436 | |
57ce0047 | 437 | AliTRDcluster *c = 0x0; |
438 | tracklet->ResetClusterIter(kFALSE); | |
439 | while((c = tracklet->PrevCluster())){ | |
440 | Float_t xc = c->GetX(); | |
441 | Float_t yc = c->GetY(); | |
442 | Float_t zc = c->GetZ(); | |
443 | Float_t zt = tracklet->GetZref(0) - (tracklet->GetX0()-xc)*tracklet->GetZref(1); | |
444 | yc -= tracklet->GetTilt()*(zc-zt); | |
445 | fRim->AddPoint(xc, yc, zc, 1, 10); | |
446 | } | |
447 | } | |
448 | fRim->Update(); | |
baee73d3 | 449 | SetStatus(fTrackState); |
450 | } | |
a4197d2e | 451 | |
baee73d3 | 452 | //______________________________________________________________________________ |
453 | AliEveTRDTrack::~AliEveTRDTrack() | |
454 | { | |
455 | if(fPoints) delete [] fPoints; fPoints = 0x0; | |
456 | //delete dynamic_cast<AliTRDtrackV1*>(GetUserData()); | |
a4197d2e | 457 | } |
458 | ||
14eef4aa | 459 | //______________________________________________________________________________ |
460 | void AliEveTRDTrack::Print(Option_t *o) const | |
461 | { | |
462 | AliTRDtrackV1 *track = (AliTRDtrackV1*)GetUserData(); | |
463 | if(!track) return; | |
464 | track->Print(o); | |
465 | } | |
baee73d3 | 466 | |
a4197d2e | 467 | //______________________________________________________________________________ |
baee73d3 | 468 | void AliEveTRDTrack::SetStatus(UChar_t s) |
a4197d2e | 469 | { |
baee73d3 | 470 | // nothing to be done |
471 | if(fPoints && fTrackState == s) return; | |
472 | ||
473 | const Int_t nc = AliTRDtrackV1::kMAXCLUSTERSPERTRACK; | |
474 | AliTRDtrackV1 *trk = (AliTRDtrackV1*)GetUserData(); | |
475 | ||
476 | Bool_t BUILD = kFALSE; | |
477 | if(!fPoints){ | |
478 | fPoints = new AliTrackPoint[nc]; | |
479 | ||
b0042d44 | 480 | // define the radial span of the track in the TRD |
481 | Double_t xmin = -1., xmax = -1.; | |
482 | Int_t det = 0; | |
483 | AliTRDseedV1 *trklt = 0x0; | |
484 | for(Int_t ily=AliTRDgeometry::kNlayer; ily--;){ | |
485 | if(!(trklt = trk->GetTracklet(ily))) continue; | |
486 | if(xmin<0.) xmin = trklt->GetX0() - AliTRDgeometry::CamHght() - AliTRDgeometry::CdrHght(); | |
487 | if(xmax<0.) xmax = trklt->GetX0(); | |
488 | det = trklt->GetDetector(); | |
489 | } | |
490 | Int_t sec = det/AliTRDgeometry::kNdets; | |
491 | fAlpha = AliTRDgeometry::GetAlpha() * (sec<9 ? sec + .5 : sec - 17.5); //trk->GetAlpha() | |
baee73d3 | 492 | |
b0042d44 | 493 | Double_t dx =(xmax - xmin)/nc; |
baee73d3 | 494 | for(Int_t ip=0; ip<nc; ip++){ |
b0042d44 | 495 | fPoints[ip].SetXYZ(xmin, 0., 0.); |
496 | xmin+=dx; | |
baee73d3 | 497 | } |
498 | BUILD = kTRUE; | |
499 | } | |
500 | ||
501 | // select track model | |
502 | if(BUILD || ((s&12) != (fTrackState&12))){ | |
503 | if(TESTBIT(s, kTrackCosmics)){ | |
504 | //printf("Straight track\n"); | |
505 | AliTRDtrackerV1::FitLine(trk, 0x0, kFALSE, nc, fPoints); | |
506 | } else { | |
507 | if(TESTBIT(s, kTrackModel)){ | |
508 | //printf("Kalman track\n"); | |
12896fe5 | 509 | if(trk->GetNumberOfTracklets() >=4) AliTRDtrackerV1::FitKalman(trk, 0x0, kFALSE, nc, fPoints); |
baee73d3 | 510 | } else { |
511 | //printf("Rieman track\n"); | |
57ce0047 | 512 | // if(trk->GetNumberOfTracklets() >=4) AliTRDtrackerV1::FitRiemanTilt(trk, 0x0, kTRUE, nc, fPoints); |
513 | Float_t x = 0.; | |
514 | for(Int_t ip = nc; ip--;){ | |
515 | x = fPoints[ip].GetX(); | |
516 | fPoints[ip].SetXYZ(x, fRim->GetYat(x), fRim->GetZat(x)); | |
517 | } | |
baee73d3 | 518 | } |
519 | } | |
a4197d2e | 520 | |
baee73d3 | 521 | Float_t global[3]; |
522 | for(Int_t ip=0; ip<nc; ip++){ | |
523 | fPoints[ip].Rotate(-fAlpha).GetXYZ(global); | |
524 | SetPoint(ip, global[0], global[1], global[2]); | |
525 | } | |
526 | SetSmooth(kTRUE); | |
527 | } | |
528 | ||
529 | // set color | |
530 | if(BUILD || ((s&3) != (fTrackState&3))){ | |
531 | if(TESTBIT(s, kSource)){ | |
532 | //printf("Source color\n"); | |
533 | if(fESDStatus&AliESDtrack::kTRDin){ | |
534 | SetMarkerColor(kGreen); | |
535 | SetLineColor(kGreen); | |
536 | } else { | |
537 | SetMarkerColor(kMagenta); | |
538 | SetLineColor(kMagenta); | |
539 | } | |
540 | } else { | |
9443fb9d | 541 | if(TESTBIT(s, kPID) == AliTRDpidUtil::kLQ){ |
baee73d3 | 542 | //printf("PID color kLQPID\n"); |
543 | //trk->GetReconstructor()->SetOption("!nn"); | |
544 | } else { | |
545 | //printf("PID color kNNPID\n"); | |
546 | //trk->GetReconstructor()->SetOption("nn"); | |
547 | } | |
548 | trk->CookPID(); | |
549 | ||
550 | Int_t species = 0; Float_t pid = 0.; | |
551 | for(Int_t is=0; is<AliPID::kSPECIES; is++) | |
552 | if(trk->GetPID(is) > pid){ | |
553 | pid = trk->GetPID(is); | |
554 | species = is; | |
555 | } | |
556 | switch(species){ | |
557 | case AliPID::kElectron: | |
558 | SetMarkerColor(kRed); | |
559 | SetLineColor(kRed); | |
560 | break; | |
561 | default: | |
562 | SetMarkerColor(kBlue); | |
563 | SetLineColor(kBlue); | |
564 | break; | |
565 | } | |
566 | } | |
567 | SetLineWidth(2); | |
568 | } | |
569 | ||
a6e0ebfe | 570 | const Char_t *model = "line"; |
baee73d3 | 571 | if(!TESTBIT(s, kTrackCosmics)){ |
572 | if(TESTBIT(s, kTrackModel)) model = "kalman"; | |
573 | else model = "rieman"; | |
574 | } | |
575 | Int_t species = 0; Float_t pid = 0.; | |
576 | for(Int_t is=0; is<AliPID::kSPECIES; is++) | |
577 | if(trk->GetPID(is) > pid){ | |
578 | pid = trk->GetPID(is); | |
579 | species = is; | |
580 | } | |
edf0c4a0 | 581 | |
57d55fae | 582 | SetTitle(Form( |
583 | "Tracklets[%d] Clusters[%d]\n" | |
584 | "Reconstruction Source[%s]\n" | |
585 | "PID[%4.1f %4.1f %4.1f %4.1f %4.1f]\n" | |
586 | "MC[%d]", trk->GetNumberOfTracklets(), trk->GetNumberOfClusters(), fESDStatus&AliESDtrack::kTRDin ? "barrel" : "sa", | |
587 | 1.E2*trk->GetPID(0), 1.E2*trk->GetPID(1), | |
588 | 1.E2*trk->GetPID(2), 1.E2*trk->GetPID(3), 1.E2*trk->GetPID(4), trk->GetLabel())); | |
589 | ||
590 | if(GetName()){ | |
591 | char id[6]; strncpy(id, GetName(), 6); | |
592 | SetName(Form("%s %s", id, AliPID::ParticleName(species))); | |
593 | } | |
baee73d3 | 594 | |
595 | // save track status | |
596 | fTrackState = s; | |
597 | } |