3 /** \class AliHLTTPCDisplay
5 //_____________________________________________________________
8 // Display class for the HLT TPC events.
11 // Author: Jochen Thaeder <mailto:thaeder@kip.uni-heidelberg.de>
12 // Anders Vestbo <mailto:vestbo@fi.uib.no>
13 //*-- Copyright © ALICE HLT Group
18 // - Rename and Merge of functions / Complete new arrangement in order to use the AliHLTGUI
20 // - display padrows, cluster, tracks
21 // - select single Tracks
22 // - select used / unused cluster
25 // - display pads in padrows
27 #include "AliHLTTPCStandardIncludes.h"
29 #include <TPolyMarker3D.h>
30 #include <TPolyLine3D.h>
34 #include <TGeometry.h>
36 #include <TParticle.h>
46 #include <TClonesArray.h>
48 #include <AliSimDigits.h>
49 #include <AliTPCParam.h>
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"
59 #include "AliHLTTPCDigitReaderPacked.h"
65 ClassImp(AliHLTTPCDisplay)
67 // #############################################################################
68 AliHLTTPCDisplay::AliHLTTPCDisplay(Char_t *gfile) {
70 memset(fClusters,0,36*6*sizeof(AliHLTTPCSpacePointData*));
71 memset(fNcl, 0, 36*6*sizeof(UInt_t));
79 fHistallresiduals = NULL;
81 fGraphresiduals = NULL;
93 fSelectTrackSlice = 0;
94 fSelectTrackSwitch = kFALSE;
106 fSwitch3DCluster = kFALSE;
107 fSwitch3DTracks = kFALSE;
108 fSwitch3DPadRow = kFALSE;
109 fSwitch3DGeometry = kFALSE;
111 //ctor. Specify which slices you want to look at.
112 LoadGeometrie(gfile);
116 // #############################################################################
117 AliHLTTPCDisplay::~AliHLTTPCDisplay() {
119 if(fTracks) delete fTracks;
123 // #############################################################################
124 Bool_t AliHLTTPCDisplay::LoadGeometrie(Char_t *gfile) {
126 TFile *file = TFile::Open(gfile);
128 LOG(AliHLTTPCLog::kError,"AliHLTTPCDisplay::AliHLTTPCDisplay","File Open") <<"Geometry file " << gfile << " does not exist!"<<ENDLOG;
132 fGeom = (TGeometry*)file->Get("AliceGeom");
140 // #############################################################################
142 // #############################################################################
143 void AliHLTTPCDisplay::SetHistPadRowAxis() {
144 // Set Axis range of Histogramm, due to variable NPads per padrow
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");
153 void AliHLTTPCDisplay::SetSliceArray() {
155 Int_t minSlice = fMinSlice;
156 Int_t maxSlice = fMaxSlice;
159 for (slice=0;slice<=35;slice++){
160 fSliceArray[slice] = kFALSE;
163 // Single Slice, or Range
164 if (minSlice > maxSlice) maxSlice += 17;
166 for (slice=minSlice;slice<=maxSlice;slice++){
167 realslice = slice % 18;
168 fSliceArray[realslice] = kTRUE;
169 fSliceArray[realslice+18] = kTRUE;
174 minSlice = fMinSlice + 9;
175 maxSlice = fMaxSlice + 9;
177 if (minSlice > maxSlice) maxSlice += 17;
179 for (slice=minSlice;slice<=maxSlice;slice++){
180 realslice = slice % 18;
181 fSliceArray[realslice] = kTRUE;
182 fSliceArray[realslice+18] = kTRUE;
187 // #############################################################################
189 // #############################################################################
190 void AliHLTTPCDisplay::SetupCluster(Int_t slice, Int_t patch, UInt_t nofClusters, AliHLTTPCSpacePointData* data) {
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;
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;
203 fNcl[slice][patch]=nofClusters;
204 LOG(AliHLTTPCLog::kError,"AliHLTTPCDisplay::SetupCluster","memory allocation") << "memory allocation failed "<<ENDLOG;
206 } else LOG(AliHLTTPCLog::kError,"AliHLTTPCDisplay::SetupCluster","argument check") << "invalid argument "<<ENDLOG;
209 // #############################################################################
210 void AliHLTTPCDisplay::SetupTracks(AliHLTTPCTrackArray *tracks) {
214 Int_t ntracks = fTracks->GetNTracks();
216 for(Int_t j=0; j<ntracks; j++) {
217 AliHLTTPCTrack *gtrack = fTracks->GetCheckedTrack(j);
218 if(!gtrack) continue;
220 Int_t nHits = gtrack->GetNHits();
221 UInt_t *hitnum = gtrack->GetHitNumbers();
223 for(Int_t h=0; h<nHits; h++){
226 Int_t slice = (id>>25) & 0x7f;
227 Int_t patch = (id>>22) & 0x7;
228 UInt_t pos = id&0x3fffff;
230 AliHLTTPCSpacePointData *points = fClusters[slice][patch];
233 LOG(AliHLTTPCLog::kError,"AliHLTTPCDisplay::Draw3D","Clusterarray") <<"No points at slice "<<slice<<" patch "<<patch<<" pos "<<pos<<ENDLOG;
237 if(pos>=fNcl[slice][patch]) {
238 LOG(AliHLTTPCLog::kError,"AliHLTTPCDisplay::Draw3D","Clusterarray") <<"Pos is too large: pos "<<pos <<" ncl "<<fNcl[slice][patch]<<ENDLOG;
241 points[pos].fUsed = kTRUE;
246 // #############################################################################
247 void AliHLTTPCDisplay::SetupHist(){
250 fNTimes = AliHLTTPCTransform::GetNTimeBins();
252 AliHLTTPCTransform::RawHLT2Global(xyz, 0, 0, 0, 0);
253 LOG(AliHLTTPCLog::kError,"AliHLTTPCDisplay::ccc","") << "t="<< fNTimes <<"maxZ="<<xyz[2] << "|" << xyz[0]<< "|"<< xyz[1]<< ENDLOG;
279 if ( fHistallresiduals){
280 delete fHistallresiduals;
281 fHistallresiduals = NULL;
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);
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);
299 fHistraw->SetOption("COLZ");
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);
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);
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);
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);
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);
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);
339 gStyle->SetPalette(1);
345 // ####################################################################################################
346 void AliHLTTPCDisplay::FillPadRow(Int_t patch, ULong_t dataBlock, ULong_t dataLen){
347 AliHLTTPCDigitReaderPacked* fDigitReader = new AliHLTTPCDigitReaderPacked();
348 bool readValue = true;
351 // Initialize RAW DATA
352 Int_t firstRow = AliHLTTPCTransform::GetFirstRow(patch);
353 Int_t lastRow = AliHLTTPCTransform::GetLastRow(patch);
355 // Outer sector, patches 2, 3, 4, 5 - start counting in patch 2 with row 0
356 if ( patch >= 2 ) rowOffset = AliHLTTPCTransform::GetFirstRow( 2 );
358 // Initialize block for reading packed data
359 void* tmpdataBlock = (void*) dataBlock;
360 fDigitReader->InitBlock(tmpdataBlock,dataLen,firstRow,lastRow);
362 readValue = fDigitReader->Next();
365 LOG(AliHLTTPCLog::kError,"AliHLTTPCDisplay::FillPadRow","Read first value") << "No value in data block" << ENDLOG;
369 // FILL PADROW 3D --- Initialize the colorbins
370 if (fSwitch3DPadRow){
371 for (UInt_t ii=0;ii < 20;ii++){
376 // read number of entries in colorbin
379 Int_t row = fDigitReader->GetRow() + rowOffset;
382 UInt_t charge = fDigitReader->GetSignal();
384 for (UInt_t ii=0;ii < 19;ii++){
385 if ( charge > (ii*21) && charge <= ((ii*21) + 21) ) fcolorbin[ii]++;
387 // larger than 19 * 21
388 if (charge > 399 ) fcolorbin[19]++;
392 readValue = fDigitReader->Next();
394 if(!readValue) break; //No more value
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];
418 // Rewind the raw reader and fill the polymarker3D
419 fDigitReader->InitBlock(tmpdataBlock,dataLen,firstRow,lastRow);
421 readValue = fDigitReader->Next();
422 } // END if (fSwitch3DPadRow)
427 Int_t row = fDigitReader->GetRow() + rowOffset;
429 // select padrow to fill in histogramm
431 UChar_t pad = fDigitReader->GetPad();
432 UShort_t time = fDigitReader->GetTime();
433 UInt_t charge = fDigitReader->GetSignal();
435 fHistraw->Fill(pad,time,charge);
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);
441 if (fSwitch3DPadRow) {
442 // Transform raw coordinates to local coordinates
443 AliHLTTPCTransform::RawHLT2Global(xyz, fSlicePadRow, fPadRow, pad, time);
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];
453 // larger than 19 * 21
455 fpmarr[19][fbinct[19]] = xyz[0];
456 fpmarr[19][fbinct[19]+1] = xyz[1];
457 fpmarr[19][fbinct[19]+2] = xyz[2];
460 } // END if (fSwitch3DPadRow)
465 readValue = fDigitReader->Next();
467 //Check where to stop:
468 if(!readValue) break; //No more value
475 AliHLTTPCSpacePointData *points = fClusters[fSlicePadRow][patch];
477 Int_t npoints = fNcl[fSlicePadRow][patch];
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;
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]);
495 // #############################################################################
496 void AliHLTTPCDisplay::ResetHistPadRow(){
504 // #############################################################################
505 void AliHLTTPCDisplay::ResetHistResiduals(){
506 fHistallresiduals->Reset();
509 // #############################################################################
510 void AliHLTTPCDisplay::ResetHistCharge(){
511 fHistcharge->Reset();
515 // #############################################################################
517 // #############################################################################
518 void AliHLTTPCDisplay::DrawGeomSector(Int_t sector) {
520 Int_t realsector = sector;// % 18;
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");
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");
539 // #############################################################################
540 void AliHLTTPCDisplay::DrawHistPadRow(){
542 sprintf(title,"Selected PadRow %d with found Clusters",fPadRow);
544 fHistraw->SetTitle(title);
545 fHistraw->SetStats(kFALSE);
546 fHistraw->Draw("COLZ");
548 fHistrawcl->SetStats(kFALSE);
549 fHistrawcl->SetMarkerStyle(28);
550 fHistrawcl->SetMarkerSize(2);
551 fHistrawcl->SetMarkerColor(1);
552 fHistrawcl->Draw("psame");
555 // #############################################################################
556 void AliHLTTPCDisplay::DrawHistPad1(){
558 sprintf(title,"Selected Pad %d",fPad -1);
559 fHistpad1->SetStats(kFALSE);
560 fHistpad1->SetTitle(title);
564 // #############################################################################
565 void AliHLTTPCDisplay::DrawHistPad2(){
567 sprintf(title,"Selected Pad %d",fPad);
569 fHistpad2->SetStats(kFALSE);
570 fHistpad2->SetTitle(title);
574 // #############################################################################
575 void AliHLTTPCDisplay::DrawHistPad3(){
577 sprintf(title,"Selected Pad %d",fPad +1);
579 fHistpad3->SetStats(kFALSE);
580 fHistpad3->SetTitle(title);
584 // #############################################################################
585 void AliHLTTPCDisplay::DrawHistResiduals(){
586 if (fSwitch3DTracks){
588 // Residual histogram for 1 track
589 if (fSelectTrackSwitch){
591 sprintf(title,"Residuals of Track %d in Slice %d",fSelectTrack, fSelectTrackSlice );
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*");
603 // Global residuals histogram
605 fHistallresiduals->SetStats(kFALSE);
606 fHistallresiduals->Draw();
611 // #############################################################################
612 void AliHLTTPCDisplay::DrawHistCharge(){
613 if (fSwitch3DCluster){
614 // fHistcharge->SetStats(kFALSE);
619 // #############################################################################
620 void AliHLTTPCDisplay::Draw3D(){
622 TView *v = new TView(1);
623 v->SetRange(-800,-800,-800,800,800,800);
625 Float_t* etaRange = NULL; // ------ STILL TO FIX
628 //--------------------------------------------------------------------------------------------
630 //--------------------------------------------------------------------------------------------
631 if (fSwitch3DCluster){
632 for (Int_t slice=0; slice <= 35; slice++){
634 UInt_t maxCharge = 0;
638 if (!fSliceArray[slice]) continue;
640 for(Int_t p=0;p<6;p++){
642 AliHLTTPCSpacePointData *points = fClusters[slice][p];
643 if(!points) continue;
644 Int_t npoints = fNcl[slice][p];
645 TPolyMarker3D *pm = new TPolyMarker3D(npoints);
648 for(Int_t i=0; i<npoints; i++){
650 if (fSelectCluster == 1 && points[i].fUsed == kFALSE) continue;
651 // Unused cluster only
652 if (fSelectCluster == 2 && points[i].fUsed == kTRUE) continue;
654 xyz[0] = points[i].fX;
655 xyz[1] = points[i].fY;
656 xyz[2] = points[i].fZ;
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] )
666 AliHLTTPCTransform::Local2Global(xyz,slice);
668 pm->SetPoint(i,xyz[0],xyz[1],xyz[2]);
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;
681 pm->SetMarkerSize(4);
682 pm->SetMarkerColor(2);
686 LOG(AliHLTTPCLog::kError,"AliHLTTPCDisplay::CHARGE","")<< "MAX CHARGE =" << maxCharge << " slice=" << slice
687 << " z=" << maxXYZ[0]<< " y=" << maxXYZ[1]<< " z=" << maxXYZ[2]
693 } // END - DRAW 3D CLUSTER
695 //--------------------------------------------------------------------------------------------
697 //--------------------------------------------------------------------------------------------
698 if (fSwitch3DTracks){
700 Int_t ntracks = fTracks->GetNTracks();
702 TPolyLine3D *line = new TPolyLine3D[ntracks];
703 TPolyLine3D *lineT = new TPolyLine3D[ntracks];
714 Int_t trackcounter = 0;
716 for(Int_t j=0; j<ntracks; j++) {
718 AliHLTTPCTrack *gtrack = fTracks->GetCheckedTrack(j);
719 if(!gtrack) continue;
721 Int_t nHits = gtrack->GetNHits();
722 UInt_t *hitnum = gtrack->GetHitNumbers();
725 Bool_t nexttrack = kFALSE;
727 TPolyMarker3D *pm = new TPolyMarker3D(nHits,7);
728 TPolyMarker3D *pmT = new TPolyMarker3D(nHits,7);
730 TPolyMarker3D *pmL = new TPolyMarker3D(1,2);
731 TPolyMarker3D *pmF = new TPolyMarker3D(1,2);
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
743 Double_t xyzL[3]; // lastpoint of track
744 Double_t xyzF[3]; // firstpoint of track
746 Double_t maxZ = 0; // range of the histogram
747 Double_t minZ =99999.; // range of the histogram
749 for(Int_t h=0; h<nHits; h++){
752 Int_t slice = (id>>25) & 0x7f;
753 Int_t patch = (id>>22) & 0x7;
754 UInt_t pos = id&0x3fffff;
756 // select if slice should be displayed or not
757 if (!fSliceArray[slice]) {
762 // select Single Track
763 if (fSelectTrackSwitch){
764 if(slice != fSelectTrackSlice) {
769 if (trackcounter != fSelectTrack && h==0){
778 // --> in the hit loop because of 'trackcounter++', otherwise wrong single track in slice will be selected
779 if((fPtThreshold > 0) && (gtrack->GetPt()< fPtThreshold)) {
784 // --> in the hit loop because of 'trackcounter++', otherwise wrong single track in slice will be selected
785 if(nHits < fMinHits) {
790 AliHLTTPCSpacePointData *points = fClusters[slice][patch];
793 LOG(AliHLTTPCLog::kError,"AliHLTTPCDisplay::Draw3D","Clusterarray") <<"No points at slice "<<slice<<" patch "<<patch
794 <<" pos "<<pos<<ENDLOG;
798 if(pos>=fNcl[slice][patch]) {
799 LOG(AliHLTTPCLog::kError,"AliHLTTPCDisplay::Draw3D","Clusterarray") <<"Pos is too large: pos "<<pos <<" ncl "
800 <<fNcl[slice][patch]<<ENDLOG;
804 // set the data for the residuals
806 // -> Curvature / Radius / Phi0
807 //kappa = gtrack->GetKappa();
808 //r = gtrack->GetRadius();
809 //phi0 = gtrack->GetPhi0();
810 //bfield = AliHLTTPCTransform::GetBFieldValue();
812 lambda = atan( gtrack->GetTgl() );
814 bfield = 0.0029980 * 0.4; // KORRIGIERE B für =0.4 T Feld
816 xyz0[0] = gtrack->GetFirstPointX();
817 xyz0[1] = gtrack->GetFirstPointY();
818 xyz0[2] = gtrack->GetFirstPointZ();
820 xyzF[0] = gtrack->GetFirstPointX();
821 xyzF[1] = gtrack->GetFirstPointY();
822 xyzF[2] = gtrack->GetFirstPointZ();
824 xyzL[0] = gtrack->GetLastPointX();
825 xyzL[1] = gtrack->GetLastPointY();
826 xyzL[2] = gtrack->GetLastPointZ();
828 pmL->SetPoint(0,xyzL[0],xyzL[1],xyzL[2]);
829 pmF->SetPoint(0,xyzF[0],xyzF[1],xyzF[2]);
831 phi0 = gtrack->GetPsi() + (gtrack->GetCharge() * AliHLTTPCTransform::PiHalf() );
834 r = gtrack->GetPt() / bfield;
835 kappa = - gtrack->GetCharge() * 1. / r;
838 r = 999999; // just infinity
842 //Write Track Parameters for single track
843 if (fSelectTrackSwitch){
844 fTrackParam.id = trackcounter - 1;
845 fTrackParam.nHits = nHits;
846 fTrackParam.charge = gtrack->GetCharge();
847 fTrackParam.lambda = lambda;
848 fTrackParam.kappa = kappa;
849 fTrackParam.radius = r;
850 fTrackParam.slice = slice;
851 fTrackParam.phi0 = phi0;
852 fTrackParam.pt = gtrack->GetPt();
853 fTrackParam.bfield = bfield;
854 fTrackParam.xyzF[0] = gtrack->GetFirstPointX();
855 fTrackParam.xyzF[1] = gtrack->GetFirstPointY();
856 fTrackParam.xyzF[2] = gtrack->GetFirstPointZ();
857 fTrackParam.xyzL[0] = gtrack->GetLastPointX();
858 fTrackParam.xyzL[1] = gtrack->GetLastPointY();
859 fTrackParam.xyzL[2] = gtrack->GetLastPointZ();
860 fTrackParam.psi = gtrack->GetPsi();
865 Float_t xyzCtmp[3]; // cluster tmp
867 xyzCtmp[0] = points[pos].fX;
868 xyzCtmp[1] = points[pos].fY;
869 xyzCtmp[2] = points[pos].fZ;
871 AliHLTTPCTransform::Local2Global(xyzCtmp,slice);
877 // FILL POLYMARKER FOR THE ORIGINAL TRACKS
878 pm->SetPoint(h,xCl[h],yCl[h],zCl[h]);
880 xyzC[0] = (Double_t) xyzCtmp[0];
881 xyzC[1] = (Double_t) xyzCtmp[1];
882 xyzC[2] = (Double_t) xyzCtmp[2];
887 s = ( xyzT[2] - xyz0[2] ) / sin(lambda);
889 // calculate the corresponding coordinates on the track
890 xyzT[0] = xyz0[0] + r * ( cos( phi0 + (s*kappa*cos(lambda)) ) - cos( phi0 ) );
891 xyzT[1] = xyz0[1] + r * ( sin( phi0 + (s*kappa*cos(lambda)) ) - sin( phi0 ) );
893 Double_t deltaX = ( xyzC[0] - xyzT[0] );
894 Double_t deltaY = ( xyzC[1] - xyzT[1] );
896 Double_t residual = sqrt( deltaX*deltaX + deltaY*deltaY );
897 res[h] = (Float_t) residual;
899 if (maxZ < fabs(xyzT[2])) maxZ = fabs(xyzT[2]);
900 if (minZ > fabs(xyzT[2])) minZ = fabs(xyzT[2]);
902 // FILL RESIDUALS HISTOGRAM
903 fHistallresiduals->Fill(residual);
905 // FILL ARRAYS IN ORDER TO DRAW THE TRACKPOINTS, OUT OF THE PARAMETER
910 // FILL POLYMARKER FOR THE NEW TRACKS
911 pmT->SetPoint(h,xT[h],yT[h],zT[h]);
916 if(nexttrack) continue;
917 if(hitcount==0) continue;
920 if ( fGraphresiduals){
921 delete fGraphresiduals;
922 fGraphresiduals = NULL;
925 // FILL RESIDUALS GRAPH
926 fGraphresiduals = new TGraph(nHits,zT,res);
927 fGraphresiduals->GetXaxis()->SetLabelSize(0.02);
928 fGraphresiduals->GetXaxis()->SetTitleSize(0.02);
929 fGraphresiduals->GetYaxis()->SetLabelSize(0.02);
930 fGraphresiduals->GetYaxis()->SetTitleSize(0.02);
932 TPolyLine3D *currentline = &(line[j]);
933 currentline = new TPolyLine3D(nHits,xCl,yCl,zCl,"");
934 currentline->SetLineColor(4);
935 currentline->SetLineWidth(2);
936 // currentline->Draw("same");
938 TPolyLine3D *currentlineT = &(lineT[j]);
939 currentlineT = new TPolyLine3D(nHits,xT,yT,zT,"");
940 currentlineT->SetLineColor(7);
941 currentlineT->SetLineWidth(1);
942 // currentlineT->Draw("same");
945 //Last Point of Track
946 pmL->SetMarkerSize(3);
947 pmL->SetMarkerColor(4);
950 //First Point of Track
951 pmF->SetMarkerSize(3);
952 pmF->SetMarkerColor(5);
956 pm->SetMarkerSize(4);
957 pm->SetMarkerColor(6);
961 pmT->SetMarkerSize(4);
962 pmT->SetMarkerColor(3);
967 } // END - DRAW 3D Tracks
969 //--------------------------------------------------------------------------------------------
971 //--------------------------------------------------------------------------------------------
972 if (fSwitch3DGeometry){
974 for (Int_t slice=0; slice <= 17; slice++){
975 if (!fSliceArray[slice]) continue;
976 DrawGeomSector(slice);
978 } // END - DRAW 3D GEOMETRY
980 //--------------------------------------------------------------------------------------------
982 //--------------------------------------------------------------------------------------------
983 if (fSwitch3DPadRow && fSliceArray[fSlicePadRow]){
984 Int_t markercolor = 51;
986 for (UInt_t ii=0;ii < 20;ii++){
987 if (fcolorbin[ii]> 0){
989 TPolyMarker3D *pm = new TPolyMarker3D(fcolorbin[ii], fpmarr[ii], 7 );
991 pm->SetMarkerColor(markercolor);
995 // in order to have the SetPalette(1), so called "pretty"
996 if (ii % 2 == 0 ) markercolor += 2;
997 else markercolor += 3;
1001 //--------------------------------------------------------------------------------------------
1003 //--------------------------------------------------------------------------------------------