]>
Commit | Line | Data |
---|---|---|
a6c02c85 | 1 | // @(#) $Id$ |
2 | ||
3 | /** \class AliHLTTPCDisplay | |
4 | <pre> | |
5 | //_____________________________________________________________ | |
6 | // AliHLTTPCDisplay | |
7 | // | |
44be0fde | 8 | // Display class for the HLT TPC events. |
a6c02c85 | 9 | </pre> |
10 | */ | |
44be0fde | 11 | // Author: Jochen Thaeder <mailto:thaeder@kip.uni-heidelberg.de> |
12 | // Anders Vestbo <mailto:vestbo@fi.uib.no> | |
a6c02c85 | 13 | //*-- Copyright © ALICE HLT Group |
14 | ||
c846a312 | 15 | |
16 | // Recent Changes: | |
17 | // ============== | |
44be0fde | 18 | // - Rename and Merge of functions / Complete new arrangement in order to use the AliHLTGUI |
19 | // - 3D Geometry | |
20 | // - display padrows, cluster, tracks | |
21 | // - select single Tracks | |
22 | // - select used / unused cluster | |
23 | // - Histogram | |
24 | // - display padrows | |
25 | // - display pads in padrows | |
c846a312 | 26 | |
a6c02c85 | 27 | #include "AliHLTTPCStandardIncludes.h" |
28 | #include <TView.h> | |
29 | #include <TPolyMarker3D.h> | |
30 | #include <TPolyLine3D.h> | |
31 | #include <TH2.h> | |
32 | #include <TTree.h> | |
33 | #include <TNode.h> | |
34 | #include <TGeometry.h> | |
35 | #include <TShape.h> | |
36 | #include <TParticle.h> | |
37 | #include <TFile.h> | |
c846a312 | 38 | #include <THelix.h> |
39 | #include <TStyle.h> | |
23c36ba2 | 40 | #include <TGraph.h> |
41 | #include <TAttText.h> | |
42 | #include <TAxis.h> | |
43 | ||
c846a312 | 44 | |
a6c02c85 | 45 | #ifdef use_aliroot |
46 | #include <TClonesArray.h> | |
47 | #include <AliRun.h> | |
48 | #include <AliSimDigits.h> | |
49 | #include <AliTPCParam.h> | |
50 | #endif | |
51 | ||
52 | #include "AliHLTTPCLogging.h" | |
53 | #include "AliHLTTPCDisplay.h" | |
54 | #include "AliHLTTPCTransform.h" | |
55 | #include "AliHLTTPCTrack.h" | |
56 | #include "AliHLTTPCTrackArray.h" | |
57 | #include "AliHLTTPCSpacePointData.h" | |
58 | #include "AliHLTTPCMemHandler.h" | |
c846a312 | 59 | #include "AliHLTTPCDigitReaderPacked.h" |
a6c02c85 | 60 | |
61 | #if __GNUC__ == 3 | |
62 | using namespace std; | |
63 | #endif | |
64 | ||
a6c02c85 | 65 | ClassImp(AliHLTTPCDisplay) |
66 | ||
44be0fde | 67 | // ############################################################################# |
68 | AliHLTTPCDisplay::AliHLTTPCDisplay(Char_t *gfile) { | |
69 | //constructor | |
70 | memset(fClusters,0,36*6*sizeof(AliHLTTPCSpacePointData*)); | |
71 | memset(fNcl, 0, 36*6*sizeof(UInt_t)); | |
72 | ||
73 | fTracks = NULL; | |
74 | fHistrawcl = NULL; | |
75 | fHistraw = NULL; | |
76 | fHistpad1 = NULL; | |
77 | fHistpad2 = NULL; | |
78 | fHistpad3 = NULL; | |
23c36ba2 | 79 | fHistallresiduals = NULL; |
80 | fHistcharge = NULL; | |
81 | fGraphresiduals = NULL; | |
44be0fde | 82 | |
83 | fGeom = NULL; | |
84 | ||
85 | fNPads = 0; | |
86 | fNTimes = 0; | |
87 | fMinHits = 0; | |
88 | fPtThreshold = 0.; | |
89 | fPad = -1; | |
90 | fPadRow = 0; | |
91 | fSlicePadRow = 0; | |
92 | fSelectTrack = -1; | |
93 | fSelectTrackSlice = 0; | |
94 | fSelectTrackSwitch = kFALSE; | |
95 | fSelectCluster = 0; | |
96 | ||
97 | fMinSlice = 0; | |
98 | fMaxSlice = 35; | |
99 | fSlicePair = kFALSE; | |
100 | ||
101 | SetSliceArray(); | |
102 | ||
103 | fBackColor = 1; | |
104 | fLineColor = 0; | |
105 | ||
106 | fSwitch3DCluster = kFALSE; | |
107 | fSwitch3DTracks = kFALSE; | |
108 | fSwitch3DPadRow = kFALSE; | |
109 | fSwitch3DGeometry = kFALSE; | |
110 | ||
111 | //ctor. Specify which slices you want to look at. | |
112 | LoadGeometrie(gfile); | |
a6c02c85 | 113 | } |
114 | ||
a6c02c85 | 115 | |
44be0fde | 116 | // ############################################################################# |
117 | AliHLTTPCDisplay::~AliHLTTPCDisplay() { | |
118 | //destructor | |
119 | if(fTracks) delete fTracks; | |
120 | fTracks = NULL; | |
a6c02c85 | 121 | } |
122 | ||
44be0fde | 123 | // ############################################################################# |
124 | Bool_t AliHLTTPCDisplay::LoadGeometrie(Char_t *gfile) { | |
125 | if (gfile) { | |
126 | TFile *file = TFile::Open(gfile); | |
127 | if(!file) { | |
128 | LOG(AliHLTTPCLog::kError,"AliHLTTPCDisplay::AliHLTTPCDisplay","File Open") <<"Geometry file " << gfile << " does not exist!"<<ENDLOG; | |
129 | return kFALSE; | |
130 | } | |
131 | ||
132 | fGeom = (TGeometry*)file->Get("AliceGeom"); | |
a6c02c85 | 133 | |
44be0fde | 134 | file->Close(); |
135 | delete file; | |
136 | } | |
137 | return kTRUE; | |
c846a312 | 138 | } |
139 | ||
44be0fde | 140 | // ############################################################################# |
141 | // SETTER | |
142 | // ############################################################################# | |
143 | void AliHLTTPCDisplay::SetHistPadRowAxis() { | |
144 | // Set Axis range of Histogramm, due to variable NPads per padrow | |
c846a312 | 145 | |
44be0fde | 146 | fNPads = AliHLTTPCTransform::GetNPads(fPadRow); |
147 | fHistrawcl->SetAxisRange(0,fNPads); | |
148 | fHistraw->SetAxisRange(0,fNPads); | |
149 | fHistrawcl->SetAxisRange(0,fNTimes,"Y"); | |
150 | fHistraw->SetAxisRange(0,fNTimes,"Y"); | |
c846a312 | 151 | } |
152 | ||
44be0fde | 153 | void AliHLTTPCDisplay::SetSliceArray() { |
154 | Int_t slice=0; | |
155 | Int_t minSlice = fMinSlice; | |
156 | Int_t maxSlice = fMaxSlice; | |
157 | Int_t realslice = 0; | |
c846a312 | 158 | |
44be0fde | 159 | for (slice=0;slice<=35;slice++){ |
160 | fSliceArray[slice] = kFALSE; | |
a6c02c85 | 161 | } |
a6c02c85 | 162 | |
44be0fde | 163 | // Single Slice, or Range |
164 | if (minSlice > maxSlice) maxSlice += 17; | |
165 | ||
166 | for (slice=minSlice;slice<=maxSlice;slice++){ | |
167 | realslice = slice % 18; | |
168 | fSliceArray[realslice] = kTRUE; | |
169 | fSliceArray[realslice+18] = kTRUE; | |
a6c02c85 | 170 | } |
a6c02c85 | 171 | |
44be0fde | 172 | // Pair of Slices |
173 | if (fSlicePair) { | |
174 | minSlice = fMinSlice + 9; | |
175 | maxSlice = fMaxSlice + 9; | |
176 | ||
177 | if (minSlice > maxSlice) maxSlice += 17; | |
178 | ||
179 | for (slice=minSlice;slice<=maxSlice;slice++){ | |
180 | realslice = slice % 18; | |
181 | fSliceArray[realslice] = kTRUE; | |
182 | fSliceArray[realslice+18] = kTRUE; | |
a6c02c85 | 183 | } |
184 | } | |
a6c02c85 | 185 | } |
186 | ||
44be0fde | 187 | // ############################################################################# |
188 | // SETUP | |
189 | // ############################################################################# | |
190 | void AliHLTTPCDisplay::SetupCluster(Int_t slice, Int_t patch, UInt_t nofClusters, AliHLTTPCSpacePointData* data) { | |
a6c02c85 | 191 | |
44be0fde | 192 | if (data && slice>=0 && slice<36 && patch>=0 && patch<AliHLTTPCTransform::GetNPatches()) { |
193 | if (fClusters[slice][patch]!=NULL) { | |
194 | delete(fClusters[slice][patch]); | |
195 | fClusters[slice][patch]=NULL; | |
196 | } | |
197 | Int_t arraysize=nofClusters*sizeof(AliHLTTPCSpacePointData); | |
198 | fClusters[slice][patch] = (AliHLTTPCSpacePointData*)new Byte_t[arraysize]; | |
199 | if (fClusters[slice][patch]) { | |
200 | memcpy(fClusters[slice][patch], data, arraysize); | |
201 | fNcl[slice][patch]=nofClusters; | |
202 | } else { | |
203 | fNcl[slice][patch]=nofClusters; | |
204 | LOG(AliHLTTPCLog::kError,"AliHLTTPCDisplay::SetupCluster","memory allocation") << "memory allocation failed "<<ENDLOG; | |
205 | } | |
206 | } else LOG(AliHLTTPCLog::kError,"AliHLTTPCDisplay::SetupCluster","argument check") << "invalid argument "<<ENDLOG; | |
207 | } | |
c846a312 | 208 | |
44be0fde | 209 | // ############################################################################# |
210 | void AliHLTTPCDisplay::SetupTracks(AliHLTTPCTrackArray *tracks) { | |
211 | fTracks=tracks; | |
c846a312 | 212 | |
44be0fde | 213 | // Set USED cluster |
c846a312 | 214 | Int_t ntracks = fTracks->GetNTracks(); |
215 | ||
44be0fde | 216 | for(Int_t j=0; j<ntracks; j++) { |
c846a312 | 217 | AliHLTTPCTrack *gtrack = fTracks->GetCheckedTrack(j); |
218 | if(!gtrack) continue; | |
c846a312 | 219 | |
220 | Int_t nHits = gtrack->GetNHits(); | |
221 | UInt_t *hitnum = gtrack->GetHitNumbers(); | |
c846a312 | 222 | |
44be0fde | 223 | for(Int_t h=0; h<nHits; h++){ |
224 | ||
c846a312 | 225 | UInt_t id=hitnum[h]; |
226 | Int_t slice = (id>>25) & 0x7f; | |
227 | Int_t patch = (id>>22) & 0x7; | |
228 | UInt_t pos = id&0x3fffff; | |
44be0fde | 229 | |
c846a312 | 230 | AliHLTTPCSpacePointData *points = fClusters[slice][patch]; |
44be0fde | 231 | |
c846a312 | 232 | if(!points) { |
44be0fde | 233 | LOG(AliHLTTPCLog::kError,"AliHLTTPCDisplay::Draw3D","Clusterarray") <<"No points at slice "<<slice<<" patch "<<patch<<" pos "<<pos<<ENDLOG; |
234 | continue; | |
c846a312 | 235 | } |
236 | ||
237 | if(pos>=fNcl[slice][patch]) { | |
44be0fde | 238 | LOG(AliHLTTPCLog::kError,"AliHLTTPCDisplay::Draw3D","Clusterarray") <<"Pos is too large: pos "<<pos <<" ncl "<<fNcl[slice][patch]<<ENDLOG; |
239 | continue; | |
c846a312 | 240 | } |
44be0fde | 241 | points[pos].fUsed = kTRUE; |
242 | } | |
243 | } | |
a6c02c85 | 244 | } |
245 | ||
44be0fde | 246 | // ############################################################################# |
23c36ba2 | 247 | void AliHLTTPCDisplay::SetupHist(){ |
a6c02c85 | 248 | |
44be0fde | 249 | Int_t maxpads = 150; |
250 | fNTimes = AliHLTTPCTransform::GetNTimeBins(); | |
23c36ba2 | 251 | Float_t xyz[3]; |
252 | AliHLTTPCTransform::RawHLT2Global(xyz, 0, 0, 0, 0); | |
253 | LOG(AliHLTTPCLog::kError,"AliHLTTPCDisplay::ccc","") << "t="<< fNTimes <<"maxZ="<<xyz[2] << "|" << xyz[0]<< "|"<< xyz[1]<< ENDLOG; | |
c846a312 | 254 | |
44be0fde | 255 | if ( fHistraw ){ |
256 | delete fHistraw; | |
257 | fHistraw = NULL; | |
c846a312 | 258 | } |
44be0fde | 259 | if ( fHistrawcl ){ |
260 | delete fHistrawcl; | |
261 | fHistrawcl = NULL; | |
c846a312 | 262 | } |
263 | ||
44be0fde | 264 | if ( fHistpad1 ){ |
265 | delete fHistpad1; | |
266 | fHistpad1 = NULL; | |
a6c02c85 | 267 | } |
a6c02c85 | 268 | |
44be0fde | 269 | if ( fHistpad2 ){ |
270 | delete fHistpad2; | |
271 | fHistpad2 = NULL; | |
a6c02c85 | 272 | } |
c846a312 | 273 | |
44be0fde | 274 | if ( fHistpad3 ){ |
275 | delete fHistpad3; | |
276 | fHistpad3 = NULL; | |
a6c02c85 | 277 | } |
c846a312 | 278 | |
23c36ba2 | 279 | if ( fHistallresiduals){ |
280 | delete fHistallresiduals; | |
281 | fHistallresiduals = NULL; | |
282 | } | |
283 | ||
284 | if ( fHistcharge){ | |
285 | delete fHistcharge; | |
286 | fHistcharge = NULL; | |
287 | } | |
288 | ||
44be0fde | 289 | // Setup the histograms |
290 | Int_t padbinning = maxpads*10; | |
291 | fHistraw = new TH2F("fHistraw","Selected PadRow with found Clusters;Pad #;Timebin #",maxpads,0,maxpads-1,fNTimes,0,fNTimes-1); | |
292 | fHistrawcl = new TH1F("fHistrawcl","",padbinning,0,maxpads-1); | |
293 | fHistpad1 = new TH1F ("fHistpad1","Selected Pad -1;Timebin #",fNTimes,0,fNTimes-1); | |
294 | fHistpad2 = new TH1F ("fHistpad2","Selected Pad;Timebin #",fNTimes,0,fNTimes-1); | |
295 | fHistpad3 = new TH1F ("fHistpad3","Selected Pad +1;Timebin #",fNTimes,0,fNTimes-1); | |
23c36ba2 | 296 | fHistallresiduals = new TH1F ("fHistallresiduals","Residuals of all Tracks in selected slices;residuals",5000,0,100); |
297 | fHistcharge = new TH1F ("fHistcharge","Cluster distribution per charge;charge;#cluster",500,0,6000); | |
c846a312 | 298 | |
44be0fde | 299 | fHistraw->SetOption("COLZ"); |
c846a312 | 300 | |
23c36ba2 | 301 | |
302 | ||
303 | fHistallresiduals->SetTitleSize(0.03); | |
304 | fHistallresiduals->GetXaxis()->SetLabelSize(0.03); | |
305 | fHistallresiduals->GetXaxis()->SetTitleSize(0.03); | |
306 | fHistallresiduals->GetYaxis()->SetLabelSize(0.03); | |
307 | fHistallresiduals->GetYaxis()->SetTitleSize(0.03); | |
308 | ||
309 | fHistcharge->SetTitleSize(0.03); | |
310 | fHistcharge->GetXaxis()->SetLabelSize(0.03); | |
311 | fHistcharge->GetXaxis()->SetTitleSize(0.03); | |
312 | fHistcharge->GetYaxis()->SetLabelSize(0.03); | |
313 | fHistcharge->GetYaxis()->SetTitleSize(0.03); | |
314 | ||
315 | fHistraw->SetTitleSize(0.03); | |
316 | fHistraw->GetXaxis()->SetLabelSize(0.03); | |
317 | fHistraw->GetXaxis()->SetTitleSize(0.03); | |
318 | fHistraw->GetYaxis()->SetLabelSize(0.03); | |
319 | fHistraw->GetYaxis()->SetTitleSize(0.03); | |
320 | ||
321 | fHistpad1->SetTitleSize(0.03); | |
322 | fHistpad1->GetXaxis()->SetLabelSize(0.03); | |
323 | fHistpad1->GetXaxis()->SetTitleSize(0.03); | |
324 | fHistpad1->GetYaxis()->SetLabelSize(0.03); | |
325 | fHistpad1->GetYaxis()->SetTitleSize(0.03); | |
326 | ||
327 | fHistpad2->SetTitleSize(0.03); | |
328 | fHistpad2->GetXaxis()->SetLabelSize(0.03); | |
329 | fHistpad2->GetXaxis()->SetTitleSize(0.03); | |
330 | fHistpad2->GetYaxis()->SetLabelSize(0.03); | |
331 | fHistpad2->GetYaxis()->SetTitleSize(0.03); | |
332 | ||
333 | fHistpad3->SetTitleSize(0.03); | |
334 | fHistpad3->GetXaxis()->SetLabelSize(0.03); | |
335 | fHistpad3->GetXaxis()->SetTitleSize(0.03); | |
336 | fHistpad3->GetYaxis()->SetLabelSize(0.03); | |
337 | fHistpad3->GetYaxis()->SetTitleSize(0.03); | |
44be0fde | 338 | |
23c36ba2 | 339 | gStyle->SetPalette(1); |
340 | ||
44be0fde | 341 | SetHistPadRowAxis(); |
23c36ba2 | 342 | |
a6c02c85 | 343 | } |
344 | ||
44be0fde | 345 | // #################################################################################################### |
346 | void AliHLTTPCDisplay::FillPadRow(Int_t patch, ULong_t dataBlock, ULong_t dataLen){ | |
c846a312 | 347 | AliHLTTPCDigitReaderPacked* fDigitReader = new AliHLTTPCDigitReaderPacked(); |
c846a312 | 348 | bool readValue = true; |
349 | Int_t rowOffset = 0; | |
350 | ||
351 | // Initialize RAW DATA | |
352 | Int_t firstRow = AliHLTTPCTransform::GetFirstRow(patch); | |
353 | Int_t lastRow = AliHLTTPCTransform::GetLastRow(patch); | |
354 | ||
44be0fde | 355 | // Outer sector, patches 2, 3, 4, 5 - start counting in patch 2 with row 0 |
356 | if ( patch >= 2 ) rowOffset = AliHLTTPCTransform::GetFirstRow( 2 ); | |
357 | ||
c846a312 | 358 | // Initialize block for reading packed data |
359 | void* tmpdataBlock = (void*) dataBlock; | |
360 | fDigitReader->InitBlock(tmpdataBlock,dataLen,firstRow,lastRow); | |
361 | ||
362 | readValue = fDigitReader->Next(); | |
363 | ||
364 | if (!readValue){ | |
365 | LOG(AliHLTTPCLog::kError,"AliHLTTPCDisplay::FillPadRow","Read first value") << "No value in data block" << ENDLOG; | |
366 | return; | |
367 | } | |
44be0fde | 368 | |
369 | // FILL PADROW 3D --- Initialize the colorbins | |
370 | if (fSwitch3DPadRow){ | |
c846a312 | 371 | for (UInt_t ii=0;ii < 20;ii++){ |
372 | fbinct[ii] = 0; | |
373 | fcolorbin[ii] = 0; | |
374 | } | |
375 | ||
376 | // read number of entries in colorbin | |
377 | while ( readValue ){ | |
378 | ||
379 | Int_t row = fDigitReader->GetRow() + rowOffset; | |
380 | ||
381 | if (row == fPadRow){ | |
382 | UInt_t charge = fDigitReader->GetSignal(); | |
383 | ||
384 | for (UInt_t ii=0;ii < 19;ii++){ | |
385 | if ( charge > (ii*21) && charge <= ((ii*21) + 21) ) fcolorbin[ii]++; | |
386 | } | |
387 | // larger than 19 * 21 | |
388 | if (charge > 399 ) fcolorbin[19]++; | |
389 | } | |
390 | ||
391 | // read next value | |
392 | readValue = fDigitReader->Next(); | |
a6c02c85 | 393 | |
c846a312 | 394 | if(!readValue) break; //No more value |
395 | } | |
c846a312 | 396 | //Initialize fpmarr[color][3*colorbin[ii]] |
397 | fpmarr[0] = new Float_t[fcolorbin[0]*3]; | |
398 | fpmarr[1] = new Float_t[fcolorbin[1]*3]; | |
399 | fpmarr[2] = new Float_t[fcolorbin[2]*3]; | |
400 | fpmarr[3] = new Float_t[fcolorbin[3]*3]; | |
401 | fpmarr[4] = new Float_t[fcolorbin[4]*3]; | |
402 | fpmarr[5] = new Float_t[fcolorbin[5]*3]; | |
403 | fpmarr[6] = new Float_t[fcolorbin[6]*3]; | |
404 | fpmarr[7] = new Float_t[fcolorbin[7]*3]; | |
405 | fpmarr[8] = new Float_t[fcolorbin[8]*3]; | |
406 | fpmarr[9] = new Float_t[fcolorbin[9]*3]; | |
407 | fpmarr[10] = new Float_t[fcolorbin[10]*3]; | |
408 | fpmarr[11] = new Float_t[fcolorbin[11]*3]; | |
409 | fpmarr[12] = new Float_t[fcolorbin[12]*3]; | |
410 | fpmarr[13] = new Float_t[fcolorbin[13]*3]; | |
411 | fpmarr[14] = new Float_t[fcolorbin[14]*3]; | |
412 | fpmarr[15] = new Float_t[fcolorbin[15]*3]; | |
413 | fpmarr[16] = new Float_t[fcolorbin[16]*3]; | |
414 | fpmarr[17] = new Float_t[fcolorbin[17]*3]; | |
415 | fpmarr[18] = new Float_t[fcolorbin[18]*3]; | |
416 | fpmarr[19] = new Float_t[fcolorbin[19]*3]; | |
417 | ||
418 | // Rewind the raw reader and fill the polymarker3D | |
419 | fDigitReader->InitBlock(tmpdataBlock,dataLen,firstRow,lastRow); | |
420 | ||
421 | readValue = fDigitReader->Next(); | |
44be0fde | 422 | } // END if (fSwitch3DPadRow) |
c846a312 | 423 | |
44be0fde | 424 | // -- Fill Raw Data |
c846a312 | 425 | while ( readValue ){ |
426 | ||
427 | Int_t row = fDigitReader->GetRow() + rowOffset; | |
428 | ||
429 | // select padrow to fill in histogramm | |
430 | if (row == fPadRow){ | |
c846a312 | 431 | UChar_t pad = fDigitReader->GetPad(); |
432 | UShort_t time = fDigitReader->GetTime(); | |
433 | UInt_t charge = fDigitReader->GetSignal(); | |
434 | Float_t xyz[3]; | |
44be0fde | 435 | fHistraw->Fill(pad,time,charge); |
436 | ||
437 | if (pad == (fPad-1) ) fHistpad1->Fill(time,charge); | |
438 | if (pad == fPad) fHistpad2->Fill(time,charge); | |
439 | if (pad == (fPad+1) ) fHistpad3->Fill(time,charge); | |
440 | ||
441 | if (fSwitch3DPadRow) { | |
442 | // Transform raw coordinates to local coordinates | |
443 | AliHLTTPCTransform::RawHLT2Global(xyz, fSlicePadRow, fPadRow, pad, time); | |
c846a312 | 444 | |
445 | for (UInt_t ii=0;ii < 19;ii++){ | |
446 | if ( charge > (ii*21) && charge <= ((ii*21) + 21) ){ | |
447 | fpmarr[ii][fbinct[ii]] = xyz[0]; | |
448 | fpmarr[ii][fbinct[ii]+1] = xyz[1]; | |
449 | fpmarr[ii][fbinct[ii]+2] = xyz[2]; | |
450 | fbinct[ii] += 3; | |
451 | } | |
452 | } | |
453 | // larger than 19 * 21 | |
454 | if (charge > 399 ) { | |
455 | fpmarr[19][fbinct[19]] = xyz[0]; | |
456 | fpmarr[19][fbinct[19]+1] = xyz[1]; | |
457 | fpmarr[19][fbinct[19]+2] = xyz[2]; | |
458 | fbinct[19] += 3; | |
459 | } | |
44be0fde | 460 | } // END if (fSwitch3DPadRow) |
461 | ||
a6c02c85 | 462 | } |
44be0fde | 463 | |
c846a312 | 464 | // read next value |
465 | readValue = fDigitReader->Next(); | |
a6c02c85 | 466 | |
c846a312 | 467 | //Check where to stop: |
468 | if(!readValue) break; //No more value | |
469 | } | |
470 | ||
471 | if ( fDigitReader ) | |
472 | delete fDigitReader; | |
473 | fDigitReader = NULL; | |
474 | ||
44be0fde | 475 | AliHLTTPCSpacePointData *points = fClusters[fSlicePadRow][patch]; |
476 | if(!points) return; | |
477 | Int_t npoints = fNcl[fSlicePadRow][patch]; | |
478 | ||
479 | Float_t xyz[3]; | |
480 | for(Int_t i=0; i<npoints; i++){ | |
481 | xyz[0] = points[i].fX; | |
482 | xyz[1] = points[i].fY; | |
483 | xyz[2] = points[i].fZ; | |
484 | ||
485 | Int_t clrow = AliHLTTPCTransform::GetPadRow(xyz[0]); | |
486 | // select padrow to fill in histogramm | |
487 | if (clrow == fPadRow){ | |
488 | AliHLTTPCTransform::LocHLT2Raw(xyz, fSlicePadRow, fPadRow); | |
489 | fHistrawcl->Fill(xyz[1],xyz[2]); | |
490 | } | |
491 | } | |
492 | } | |
493 | ||
494 | ||
495 | // ############################################################################# | |
496 | void AliHLTTPCDisplay::ResetHistPadRow(){ | |
497 | fHistraw->Reset(); | |
498 | fHistrawcl->Reset(); | |
499 | fHistpad1->Reset(); | |
500 | fHistpad2->Reset(); | |
501 | fHistpad3->Reset(); | |
502 | } | |
503 | ||
23c36ba2 | 504 | // ############################################################################# |
505 | void AliHLTTPCDisplay::ResetHistResiduals(){ | |
506 | fHistallresiduals->Reset(); | |
507 | } | |
508 | ||
509 | // ############################################################################# | |
510 | void AliHLTTPCDisplay::ResetHistCharge(){ | |
511 | fHistcharge->Reset(); | |
512 | } | |
513 | ||
44be0fde | 514 | |
515 | // ############################################################################# | |
516 | // DRAWER | |
517 | // ############################################################################# | |
518 | void AliHLTTPCDisplay::DrawGeomSector(Int_t sector) { | |
519 | Char_t fname[256]; | |
520 | Int_t realsector = sector;// % 18; | |
521 | ||
522 | if (realsector < 10){ | |
523 | sprintf(fname,"LS0%d",realsector); | |
524 | fGeom->GetNode(fname)->SetLineColor(fLineColor); | |
525 | fGeom->GetNode(fname)->Draw("same"); | |
526 | sprintf(fname,"US0%d",realsector); | |
527 | fGeom->GetNode(fname)->SetLineColor(fLineColor); | |
528 | fGeom->GetNode(fname)->Draw("same"); | |
529 | } | |
530 | else { | |
531 | sprintf(fname,"LS%d",realsector); | |
532 | fGeom->GetNode(fname)->SetLineColor(fLineColor); | |
533 | fGeom->GetNode(fname)->Draw("same"); | |
534 | sprintf(fname,"US%d",realsector); | |
535 | fGeom->GetNode(fname)->SetLineColor(fLineColor); | |
536 | fGeom->GetNode(fname)->Draw("same"); | |
537 | } | |
538 | } | |
539 | // ############################################################################# | |
540 | void AliHLTTPCDisplay::DrawHistPadRow(){ | |
541 | Char_t title[256]; | |
542 | sprintf(title,"Selected PadRow %d with found Clusters",fPadRow); | |
543 | ||
544 | fHistraw->SetTitle(title); | |
545 | fHistraw->SetStats(kFALSE); | |
546 | fHistraw->Draw("COLZ"); | |
547 | ||
548 | fHistrawcl->SetStats(kFALSE); | |
549 | fHistrawcl->SetMarkerStyle(28); | |
550 | fHistrawcl->SetMarkerSize(2); | |
551 | fHistrawcl->SetMarkerColor(1); | |
552 | fHistrawcl->Draw("psame"); | |
553 | } | |
554 | ||
555 | // ############################################################################# | |
556 | void AliHLTTPCDisplay::DrawHistPad1(){ | |
557 | Char_t title[256]; | |
558 | sprintf(title,"Selected Pad %d",fPad -1); | |
559 | fHistpad1->SetStats(kFALSE); | |
560 | fHistpad1->SetTitle(title); | |
561 | fHistpad1->Draw(); | |
562 | } | |
563 | ||
564 | // ############################################################################# | |
565 | void AliHLTTPCDisplay::DrawHistPad2(){ | |
566 | Char_t title[256]; | |
567 | sprintf(title,"Selected Pad %d",fPad); | |
568 | ||
569 | fHistpad2->SetStats(kFALSE); | |
570 | fHistpad2->SetTitle(title); | |
571 | fHistpad2->Draw(); | |
572 | } | |
573 | ||
574 | // ############################################################################# | |
575 | void AliHLTTPCDisplay::DrawHistPad3(){ | |
576 | Char_t title[256]; | |
577 | sprintf(title,"Selected Pad %d",fPad +1); | |
578 | ||
579 | fHistpad3->SetStats(kFALSE); | |
580 | fHistpad3->SetTitle(title); | |
581 | fHistpad3->Draw(); | |
582 | } | |
583 | ||
23c36ba2 | 584 | // ############################################################################# |
585 | void AliHLTTPCDisplay::DrawHistResiduals(){ | |
586 | if (fSwitch3DTracks){ | |
587 | ||
588 | // Residual histogram for 1 track | |
589 | if (fSelectTrackSwitch){ | |
590 | Char_t title[256]; | |
591 | sprintf(title,"Residuals of Track %d in Slice %d",fSelectTrack, fSelectTrackSlice ); | |
592 | ||
593 | // fHistresiduals->SetMarkerStyle(2); | |
594 | // fHistresiduals->SetStats(kFALSE); | |
595 | // fHistresiduals->SetTitle(title); | |
596 | // fHistresiduals->Draw("p"); | |
597 | fGraphresiduals->SetTitle(title); | |
598 | fGraphresiduals->GetXaxis()->SetTitle("z"); | |
599 | fGraphresiduals->GetYaxis()->SetTitle("residuals"); | |
600 | fGraphresiduals->Draw("A*"); | |
601 | ||
602 | } | |
603 | // Global residuals histogram | |
604 | else{ | |
605 | fHistallresiduals->SetStats(kFALSE); | |
606 | fHistallresiduals->Draw(); | |
607 | } | |
608 | } | |
609 | } | |
610 | ||
611 | // ############################################################################# | |
612 | void AliHLTTPCDisplay::DrawHistCharge(){ | |
613 | if (fSwitch3DCluster){ | |
614 | // fHistcharge->SetStats(kFALSE); | |
615 | fHistcharge->Draw(); | |
616 | } | |
617 | } | |
618 | ||
44be0fde | 619 | // ############################################################################# |
620 | void AliHLTTPCDisplay::Draw3D(){ | |
621 | ||
622 | TView *v = new TView(1); | |
623 | v->SetRange(-800,-800,-800,800,800,800); | |
624 | ||
625 | Float_t* etaRange = NULL; // ------ STILL TO FIX | |
23c36ba2 | 626 | |
44be0fde | 627 | |
628 | //-------------------------------------------------------------------------------------------- | |
629 | // DRAW 3D CLUSTER | |
630 | //-------------------------------------------------------------------------------------------- | |
631 | if (fSwitch3DCluster){ | |
632 | for (Int_t slice=0; slice <= 35; slice++){ | |
23c36ba2 | 633 | |
634 | UInt_t maxCharge = 0; | |
635 | Float_t maxXYZ[3]; | |
636 | UChar_t padrow; | |
637 | ||
44be0fde | 638 | if (!fSliceArray[slice]) continue; |
c846a312 | 639 | |
44be0fde | 640 | for(Int_t p=0;p<6;p++){ |
641 | ||
23c36ba2 | 642 | AliHLTTPCSpacePointData *points = fClusters[slice][p]; |
643 | if(!points) continue; | |
644 | Int_t npoints = fNcl[slice][p]; | |
645 | TPolyMarker3D *pm = new TPolyMarker3D(npoints); | |
646 | ||
647 | Float_t xyz[3]; | |
648 | for(Int_t i=0; i<npoints; i++){ | |
649 | // Used cluster only | |
650 | if (fSelectCluster == 1 && points[i].fUsed == kFALSE) continue; | |
651 | // Unused cluster only | |
652 | if (fSelectCluster == 2 && points[i].fUsed == kTRUE) continue; | |
653 | ||
654 | xyz[0] = points[i].fX; | |
655 | xyz[1] = points[i].fY; | |
656 | xyz[2] = points[i].fZ; | |
657 | ||
658 | if ( etaRange ){ | |
659 | // Do this before the transform, because the tracker also uses | |
660 | // local coordinates when using this limit to determine | |
661 | // which clusters to use for tracking | |
662 | Double_t pointEta = AliHLTTPCTransform::GetEta( xyz ); | |
663 | if ( pointEta<etaRange[0] || pointEta>etaRange[1] ) | |
664 | continue; | |
44be0fde | 665 | } |
23c36ba2 | 666 | AliHLTTPCTransform::Local2Global(xyz,slice); |
667 | ||
668 | pm->SetPoint(i,xyz[0],xyz[1],xyz[2]); | |
669 | ||
670 | // Fill Charge Histogram | |
671 | fHistcharge->Fill(points[i].fCharge); | |
672 | if (points[i].fCharge > maxCharge ){ | |
673 | maxCharge = points[i].fCharge; | |
674 | maxXYZ[0] = points[i].fX; | |
675 | maxXYZ[1] = points[i].fY; | |
676 | maxXYZ[2] = points[i].fZ; | |
677 | padrow = points[i].fPadRow; | |
678 | } | |
679 | ||
44be0fde | 680 | } |
23c36ba2 | 681 | pm->SetMarkerSize(4); |
682 | pm->SetMarkerColor(2); | |
683 | pm->Draw(""); | |
684 | } | |
685 | ||
686 | LOG(AliHLTTPCLog::kError,"AliHLTTPCDisplay::CHARGE","")<< "MAX CHARGE =" << maxCharge << " slice=" << slice | |
687 | << " z=" << maxXYZ[0]<< " y=" << maxXYZ[1]<< " z=" << maxXYZ[2] | |
688 | ||
689 | << ENDLOG; | |
690 | ||
691 | ||
44be0fde | 692 | } |
693 | } // END - DRAW 3D CLUSTER | |
694 | ||
695 | //-------------------------------------------------------------------------------------------- | |
696 | // DRAW 3D TRACKS | |
697 | //-------------------------------------------------------------------------------------------- | |
698 | if (fSwitch3DTracks){ | |
699 | ||
700 | Int_t ntracks = fTracks->GetNTracks(); | |
701 | ||
702 | TPolyLine3D *line = new TPolyLine3D[ntracks]; | |
23c36ba2 | 703 | TPolyLine3D *lineT = new TPolyLine3D[ntracks]; |
704 | Float_t xCl[176]; | |
705 | Float_t yCl[176]; | |
706 | Float_t zCl[176]; | |
707 | ||
708 | Float_t xT[176]; | |
709 | Float_t yT[176]; | |
710 | Float_t zT[176]; | |
44be0fde | 711 | |
23c36ba2 | 712 | Float_t res[176]; |
44be0fde | 713 | |
714 | Int_t trackcounter = 0; | |
715 | ||
716 | for(Int_t j=0; j<ntracks; j++) { | |
717 | ||
718 | AliHLTTPCTrack *gtrack = fTracks->GetCheckedTrack(j); | |
719 | if(!gtrack) continue; | |
720 | ||
721 | Int_t nHits = gtrack->GetNHits(); | |
722 | UInt_t *hitnum = gtrack->GetHitNumbers(); | |
23c36ba2 | 723 | Int_t hitcount=0; |
724 | ||
725 | Bool_t nexttrack = kFALSE; | |
44be0fde | 726 | |
23c36ba2 | 727 | TPolyMarker3D *pm = new TPolyMarker3D(nHits,7); |
728 | TPolyMarker3D *pmT = new TPolyMarker3D(nHits,7); | |
44be0fde | 729 | |
23c36ba2 | 730 | TPolyMarker3D *pmL = new TPolyMarker3D(1,2); |
731 | TPolyMarker3D *pmF = new TPolyMarker3D(1,2); | |
44be0fde | 732 | |
23c36ba2 | 733 | Double_t lambda = 0.; // dipAngle lambda |
734 | Double_t r = 0.; // radius | |
735 | Double_t kappa = 0.; // curvature = 1/R , signed | |
736 | Double_t xyz0[3]; // startingpoint of track | |
737 | Double_t xyzT[3]; // point on track | |
738 | Double_t xyzC[3]; // cluster | |
739 | Double_t s = 0.; // length of track | |
740 | Double_t phi0 = 0.; // azimuthal angle of startingpoint, with respect to helix axis | |
741 | Double_t bfield = 0; // BField | |
742 | ||
743 | Double_t xyzL[3]; // lastpoint of track | |
744 | Double_t xyzF[3]; // firstpoint of track | |
745 | ||
746 | Double_t maxZ = 0; // range of the histogram | |
747 | Double_t minZ =99999.; // range of the histogram | |
44be0fde | 748 | |
749 | for(Int_t h=0; h<nHits; h++){ | |
23c36ba2 | 750 | |
44be0fde | 751 | UInt_t id=hitnum[h]; |
752 | Int_t slice = (id>>25) & 0x7f; | |
753 | Int_t patch = (id>>22) & 0x7; | |
754 | UInt_t pos = id&0x3fffff; | |
755 | ||
756 | // select if slice should be displayed or not | |
757 | if (!fSliceArray[slice]) { | |
758 | nexttrack = kTRUE; | |
759 | break; | |
760 | } | |
761 | ||
762 | // select Single Track | |
763 | if (fSelectTrackSwitch){ | |
764 | if(slice != fSelectTrackSlice) { | |
765 | nexttrack = kTRUE; | |
766 | break; | |
767 | } | |
768 | ||
769 | if (trackcounter != fSelectTrack && h==0){ | |
770 | trackcounter++; | |
771 | nexttrack = kTRUE; | |
772 | break; | |
773 | } | |
23c36ba2 | 774 | |
775 | trackcounter++; | |
44be0fde | 776 | } |
777 | ||
778 | // --> in the hit loop because of 'trackcounter++', otherwise wrong single track in slice will be selected | |
779 | if((fPtThreshold > 0) && (gtrack->GetPt()< fPtThreshold)) { | |
780 | nexttrack = kTRUE; | |
781 | break; | |
782 | } | |
783 | ||
784 | // --> in the hit loop because of 'trackcounter++', otherwise wrong single track in slice will be selected | |
785 | if(nHits < fMinHits) { | |
786 | nexttrack = kTRUE; | |
787 | break; | |
788 | } | |
789 | ||
790 | AliHLTTPCSpacePointData *points = fClusters[slice][patch]; | |
791 | ||
792 | if(!points) { | |
23c36ba2 | 793 | LOG(AliHLTTPCLog::kError,"AliHLTTPCDisplay::Draw3D","Clusterarray") <<"No points at slice "<<slice<<" patch "<<patch |
794 | <<" pos "<<pos<<ENDLOG; | |
44be0fde | 795 | continue; |
796 | } | |
797 | ||
798 | if(pos>=fNcl[slice][patch]) { | |
23c36ba2 | 799 | LOG(AliHLTTPCLog::kError,"AliHLTTPCDisplay::Draw3D","Clusterarray") <<"Pos is too large: pos "<<pos <<" ncl " |
800 | <<fNcl[slice][patch]<<ENDLOG; | |
44be0fde | 801 | continue; |
802 | } | |
803 | ||
23c36ba2 | 804 | // set the data for the residuals |
44be0fde | 805 | if (h == 0){ |
23c36ba2 | 806 | // -> Curvature / Radius / Phi0 |
807 | //kappa = gtrack->GetKappa(); | |
808 | //r = gtrack->GetRadius(); | |
809 | //phi0 = gtrack->GetPhi0(); | |
810 | //bfield = AliHLTTPCTransform::GetBFieldValue(); | |
811 | ||
812 | lambda = atan( gtrack->GetTgl() ); | |
813 | ||
814 |