From 44be0fdeabe7cc324364556c348442ad231ac47a Mon Sep 17 00:00:00 2001 From: timms Date: Fri, 2 Dec 2005 11:17:04 +0000 Subject: [PATCH] AliHLTTPCSpacePointData: new variable Bool_t fUsed // only needed in AliHLTGUI AliHLTTPCClusterFinder: set variable fUsed = KFALSE // only needed in AliHLTGUI AliHLTTPCDisplay: Rename and Merge of functions Complete new arrangement in order to use the AliHLTGUI - 3D Geometry - display padrows, cluster, tracks - select single Tracks - select used / unused cluster - Histogram - display padrows - display pads in padrows --- HLT/TPCLib/AliHLTTPCClusterFinder.cxx | 2 + HLT/TPCLib/AliHLTTPCDisplay.cxx | 1177 +++++++++------------- HLT/TPCLib/AliHLTTPCDisplay.h | 135 ++- HLT/TPCLib/AliHLTTPCSpacePointData.h | 1 + HLT/TPCLib/Ref/AliHLTTPCSpacePointData.h | 1 + 5 files changed, 581 insertions(+), 735 deletions(-) diff --git a/HLT/TPCLib/AliHLTTPCClusterFinder.cxx b/HLT/TPCLib/AliHLTTPCClusterFinder.cxx index 1535b192428..3948ed33a9e 100644 --- a/HLT/TPCLib/AliHLTTPCClusterFinder.cxx +++ b/HLT/TPCLib/AliHLTTPCClusterFinder.cxx @@ -487,6 +487,8 @@ void AliHLTTPCClusterFinder::WriteClusters(Int_t nclusters,AliClusterData *list) fSpacePointData[counter].fSigmaY2 = fpad2; fSpacePointData[counter].fSigmaZ2 = ftime2; + fSpacePointData[counter].fUsed = kFALSE; // only used / set in AliHLTTPCDisplay + Int_t patch=fCurrentPatch; if(patch==-1) patch=0; //never store negative patch number fSpacePointData[counter].fID = counter diff --git a/HLT/TPCLib/AliHLTTPCDisplay.cxx b/HLT/TPCLib/AliHLTTPCDisplay.cxx index a5835d2bf8b..148a98fc97a 100644 --- a/HLT/TPCLib/AliHLTTPCDisplay.cxx +++ b/HLT/TPCLib/AliHLTTPCDisplay.cxx @@ -5,23 +5,24 @@ //_____________________________________________________________ // AliHLTTPCDisplay // -// Simple display class for the HLT tracks. +// Display class for the HLT TPC events. */ -// Author: Anders Vestbo -// Jochen Thaeder +// Author: Jochen Thaeder +// Anders Vestbo //*-- Copyright © ALICE HLT Group // Recent Changes: // ============== -// - Displaying Padrows in Histograms and in the 3D Geometry, with the SetupPadRow, FillPadRow, DrawPadRow functions -// - Modification of the SetSlice, etc functions -// - Rewrite of the draw geometry functions - - - - +// - Rename and Merge of functions / Complete new arrangement in order to use the AliHLTGUI +// - 3D Geometry +// - display padrows, cluster, tracks +// - select single Tracks +// - select used / unused cluster +// - Histogram +// - display padrows +// - display pads in padrows #include "AliHLTTPCStandardIncludes.h" #include @@ -57,645 +58,232 @@ using namespace std; #endif - ClassImp(AliHLTTPCDisplay) -AliHLTTPCDisplay::AliHLTTPCDisplay() -{ - //constructor - fGeom = NULL; - fTracks = NULL; - - fc1 = new TCanvas("c1","",900,900); - memset(fClusters,0,36*6*sizeof(AliHLTTPCSpacePointData*)); - memset(fNcl, 0, 36*6*sizeof(UInt_t)); - fBackColor = 1; - fLineColor = 0; - fSlicePair = -1; - fTheta = 90.; - - fHistrawcl = NULL; - fHistraw = NULL; +// ############################################################################# +AliHLTTPCDisplay::AliHLTTPCDisplay(Char_t *gfile) { + //constructor + memset(fClusters,0,36*6*sizeof(AliHLTTPCSpacePointData*)); + memset(fNcl, 0, 36*6*sizeof(UInt_t)); + + fTracks = NULL; + fHistrawcl = NULL; + fHistraw = NULL; + fHistpad1 = NULL; + fHistpad2 = NULL; + fHistpad3 = NULL; + + fGeom = NULL; + + fNPads = 0; + fNTimes = 0; + fMinHits = 0; + fPtThreshold = 0.; + fPad = -1; + fPadRow = 0; + fSlicePadRow = 0; + fSelectTrack = -1; + fSelectTrackSlice = 0; + fSelectTrackSwitch = kFALSE; + fSelectCluster = 0; + + fMinSlice = 0; + fMaxSlice = 35; + fSlicePair = kFALSE; + + SetSliceArray(); + + fBackColor = 1; + fLineColor = 0; + + fSwitch3DCluster = kFALSE; + fSwitch3DTracks = kFALSE; + fSwitch3DPadRow = kFALSE; + fSwitch3DGeometry = kFALSE; + + //ctor. Specify which slices you want to look at. + LoadGeometrie(gfile); } -AliHLTTPCDisplay::AliHLTTPCDisplay(Int_t *slice,Char_t *gfile) -{ - //ctor. Specify which slices you want to look at. - LoadGeometrie(gfile); - if (slice) { - SetSlices(slice[0], slice[1]); - } - - fc1 = new TCanvas("c1","",900,900); - memset(fClusters,0,36*6*sizeof(AliHLTTPCSpacePointData*)); - memset(fNcl, 0, 36*6*sizeof(UInt_t)); - fBackColor = 1; - fLineColor = 0; - fSlicePair = -1; - fTheta = 90.; - - fHistrawcl = NULL; - fHistraw = NULL; -} -AliHLTTPCDisplay::~AliHLTTPCDisplay() -{ - //destructor - if(fTracks) - delete fTracks; - if (fc1) - delete fc1; +// ############################################################################# +AliHLTTPCDisplay::~AliHLTTPCDisplay() { + //destructor + if(fTracks) delete fTracks; + fTracks = NULL; } -void AliHLTTPCDisplay::SetSlices(Int_t minslice, Int_t maxslice) { - // set slice range - fTheta = 90.; - - fMinSlice = minslice; - fMaxSlice = maxslice; - - fSlicePair = -1; -} - -void AliHLTTPCDisplay::SetSlices(Int_t slice) { - // Set on slice - fTheta = 0.; - fMinSlice = slice; - fMaxSlice = slice; - fSlicePair = -1; -} - -void AliHLTTPCDisplay::SetSlices() { - // Set all Slices - fTheta = 90.; - fMinSlice = 0; - fMaxSlice = 35; - fSlicePair = -1; -} +// ############################################################################# +Bool_t AliHLTTPCDisplay::LoadGeometrie(Char_t *gfile) { + if (gfile) { + TFile *file = TFile::Open(gfile); + if(!file) { + LOG(AliHLTTPCLog::kError,"AliHLTTPCDisplay::AliHLTTPCDisplay","File Open") <<"Geometry file " << gfile << " does not exist!"<Get("AliceGeom"); -void AliHLTTPCDisplay::SetSlicesPair(Int_t slice) { - // set pair of slices - fTheta = 0.; - fSlicePair = slice; + file->Close(); + delete file; + } + return kTRUE; } -void AliHLTTPCDisplay::SetSlicesPair(Int_t minslice, Int_t maxslice) { - // set range of pair of slices - fTheta = 90.; - fSlicePair = -2; - fSlicePairMax = maxslice; - fSlicePairMin = minslice; -} +// ############################################################################# +// SETTER +// ############################################################################# +void AliHLTTPCDisplay::SetHistPadRowAxis() { + // Set Axis range of Histogramm, due to variable NPads per padrow -void AliHLTTPCDisplay::SetInvert(Bool_t invert) { - Int_t tmp; - if (invert){ - tmp = fBackColor; - fBackColor = fLineColor; - fLineColor = tmp ; - } + fNPads = AliHLTTPCTransform::GetNPads(fPadRow); + fHistrawcl->SetAxisRange(0,fNPads); + fHistraw->SetAxisRange(0,fNPads); + fHistrawcl->SetAxisRange(0,fNTimes,"Y"); + fHistraw->SetAxisRange(0,fNTimes,"Y"); } +void AliHLTTPCDisplay::SetSliceArray() { + Int_t slice=0; + Int_t minSlice = fMinSlice; + Int_t maxSlice = fMaxSlice; + Int_t realslice = 0; -void AliHLTTPCDisplay::SetDrawGeo(Bool_t drawgeo) { - if (drawgeo){ - if (fDrawGeo == kTRUE){ - fDrawGeo = kFALSE; - } - else{ - fDrawGeo = kTRUE; - } - } -} - -// ######################################################################################################################################## -void AliHLTTPCDisplay::DrawGeom(Int_t slice) { - Char_t fname[256]; - Int_t realslice = slice % 18; - - if (realslice < 10){ - sprintf(fname,"LS0%d",realslice); - fGeom->GetNode(fname)->SetLineColor(fLineColor); - fGeom->GetNode(fname)->Draw("same"); - sprintf(fname,"US0%d",realslice); - fGeom->GetNode(fname)->SetLineColor(fLineColor); - fGeom->GetNode(fname)->Draw("same"); - } - else { - sprintf(fname,"LS%d",realslice); - fGeom->GetNode(fname)->SetLineColor(fLineColor); - fGeom->GetNode(fname)->Draw("same"); - sprintf(fname,"US%d",realslice); - fGeom->GetNode(fname)->SetLineColor(fLineColor); - fGeom->GetNode(fname)->Draw("same"); - } -} - -// ######################################################################################################################################## -Bool_t AliHLTTPCDisplay::LoadGeometrie(Char_t *gfile) -{ - if (gfile) { - TFile *file = TFile::Open(gfile); - if(!file) - { - LOG(AliHLTTPCLog::kError,"AliHLTTPCDisplay::AliHLTTPCDisplay","File Open") - <<"Geometry file " << gfile << " does not exist!"<Get("AliceGeom"); - file->Close(); - delete file; - } - return kTRUE; -} - -// ######################################################################################################################################## -void AliHLTTPCDisplay::SetupClusterDataForPatch(Int_t slice, Int_t patch, UInt_t nofClusters, AliHLTTPCSpacePointData* data) -{ - if (data && slice>=0 && slice<36 && patch>=0 && patch maxSlice) maxSlice += 17; + + for (slice=minSlice;slice<=maxSlice;slice++){ + realslice = slice % 18; + fSliceArray[realslice] = kTRUE; + fSliceArray[realslice+18] = kTRUE; } - } else { - LOG(AliHLTTPCLog::kError,"AliHLTTPCDisplay::SetupClusterDataForPatch","argument check") - <<"invalid argument "<SetBinaryInput(fname)) - { - LOG(AliHLTTPCLog::kError,"AliHLTTPCEvaluation::Setup","File Open") - <<"Inputfile "<Allocate(); - clusterfile[s][p]->Binary2Memory(fNcl[s][p],fClusters[s][p]); - clusterfile[s][p]->CloseBinaryInput(); - if(sp==kTRUE) - break; + // Pair of Slices + if (fSlicePair) { + minSlice = fMinSlice + 9; + maxSlice = fMaxSlice + 9; + + if (minSlice > maxSlice) maxSlice += 17; + + for (slice=minSlice;slice<=maxSlice;slice++){ + realslice = slice % 18; + fSliceArray[realslice] = kTRUE; + fSliceArray[realslice+18] = kTRUE; } } -//LOG(AliHLTTPCLog::kError,"AliHLTTPCDisplay::DisplayAll","SETUPTrack") <<" ========================= 1 " << ENDLOG; - if(!trackfile) return; -//LOG(AliHLTTPCLog::kError,"AliHLTTPCDisplay::DisplayAll","SETUPTrack") <<" ========================= 2 " << ENDLOG; - AliHLTTPCMemHandler *tfile = new AliHLTTPCMemHandler(); -//LOG(AliHLTTPCLog::kError,"AliHLTTPCDisplay::DisplayAll","SETUPTrack") <<" ========================= 3 " << ENDLOG; - if(!tfile->SetBinaryInput(trackfile)){ - - LOG(AliHLTTPCLog::kError,"AliHLTTPCEvaluation::Setup","File Open") - <<"Inputfile "<Binary2TrackArray(fTracks); - tfile->CloseBinaryInput(); - delete tfile; - //LOG(AliHLTTPCLog::kError,"AliHLTTPCDisplay::DisplayAll","SETUPTrack") <<" ========================= 5 " << ENDLOG; } -// ######################################################################################################################################## -void AliHLTTPCDisplay::DisplayAll(Int_t minhits,Bool_t clusterswitch,Bool_t trackswitch,Bool_t x3don, Float_t thr, Float_t* etaRange){ - //Display tracks & clusters +// ############################################################################# +// SETUP +// ############################################################################# +void AliHLTTPCDisplay::SetupCluster(Int_t slice, Int_t patch, UInt_t nofClusters, AliHLTTPCSpacePointData* data) { - // Set up canvas - if (!fc1) return; - fc1->cd(); + if (data && slice>=0 && slice<36 && patch>=0 && patchSetRange(-430,-560,-430,430,560,1710); - fc1->Clear(); - fc1->SetFillColor(fBackColor); - fc1->SetTheta(fTheta); - fc1->SetPhi(0.); - - if (clusterswitch){ // Display Clusters --------------------------------------- - - for(Int_t s=fMinSlice; s<=fMaxSlice; s++){ - - for(Int_t p=0;p<6;p++){ - - AliHLTTPCSpacePointData *points = fClusters[s][p]; - if(!points) continue; - Int_t npoints = fNcl[s][p]; - TPolyMarker3D *pm = new TPolyMarker3D(npoints); - - Float_t xyz[3]; - for(Int_t i=0; ietaRange[1] ) - continue; - } - AliHLTTPCTransform::Local2Global(xyz,s); - - pm->SetPoint(i,xyz[0],xyz[1],xyz[2]); - - } - pm->SetMarkerColor(2); - pm->Draw(""); - } - } - - // ------------------- - Int_t minslice = fMinSlice + 18; - Int_t maxslice = fMaxSlice + 18; - if ( minslice < 36 && maxslice < 36) { - for(Int_t s=minslice; s<=maxslice; s++){ - - for(Int_t p=0;p<6;p++){ - - AliHLTTPCSpacePointData *points = fClusters[s][p]; - if(!points) continue; - Int_t npoints = fNcl[s][p]; - TPolyMarker3D *pm = new TPolyMarker3D(npoints); - - Float_t xyz[3]; - for(Int_t i=0; ietaRange[1] ) - continue; - } - AliHLTTPCTransform::Local2Global(xyz,s); - - pm->SetPoint(i,xyz[0],xyz[1],xyz[2]); - - } - pm->SetMarkerColor(2); - pm->Draw(""); - } - } - } - - } // END Display Clusters ---------------------------------- - - - if (trackswitch){ // Display Tracks ----------------------------------------- +// ############################################################################# +void AliHLTTPCDisplay::SetupTracks(AliHLTTPCTrackArray *tracks) { + fTracks=tracks; + // Set USED cluster Int_t ntracks = fTracks->GetNTracks(); - TPolyLine3D *line = new TPolyLine3D[ntracks]; - TPolyLine3D *linetest = new TPolyLine3D[ntracks]; - //THelix *helix = new THelix[ntracks]; - - Float_t xcl[176]; - Float_t ycl[176]; - Float_t zcl[176]; - - for(Int_t j=0; jGetCheckedTrack(j); if(!gtrack) continue; - if((thr>0)&&(gtrack->GetPt() has to be removed - // but that is the problem right now 21 seems to be ok, for most of the tracks, but not for all - // thats why i assume "mass" - Double_t testmass = 21; - - xyz0[0] = gtrack->GetFirstPointX(); - xyz0[1] = gtrack->GetFirstPointY(); - xyz0[2] = gtrack->GetFirstPointZ(); - - v0[0] = testmass * gtrack->GetPx(); - v0[1] = testmass * gtrack->GetPy(); - v0[2] = testmass * gtrack->GetPz(); - - Double_t xEnd = gtrack->GetLastPointX(); - Double_t yEnd = gtrack->GetLastPointY(); - Double_t zEnd = gtrack->GetLastPointZ(); - - Double_t tgl = gtrack->GetTgl(); - Double_t psi = gtrack->GetPsi(); - Double_t bField = AliHLTTPCTransform::GetBFieldValue(); - - Int_t charge = gtrack->GetCharge(); - - Double_t omega; - - // used because bfield is not set yet in the Display class - bField = 0.5; - omega = charge * bField / testmass; - - Double_t hrange[2]; - hrange[0] = xyz0[2]; - hrange[1] = zEnd; - - Double_t rapidity = gtrack->GetRapidity(); - Int_t slice0 = gtrack->GetSector(); - -//if (j == 0){ - LOG(AliHLTTPCLog::kError,"AliHLTTPCDisplay::DisplayAll","HELIX") << "local="<< gtrack->IsLocal() <<" rapidity="<SetLineColor(5); - currenthelix->SetLineWidth(3); - currenthelix->Draw("same"); -// } -*/ -#endif - // -------------------------- Int_t nHits = gtrack->GetNHits(); UInt_t *hitnum = gtrack->GetHitNumbers(); - if(nHits < minhits) continue; - TPolyMarker3D *pm = new TPolyMarker3D(nHits); - Int_t hitcount=0; - - Float_t xArr[2]; - Float_t yArr[2]; - Float_t zArr[2]; - -#if 0 -/* nHits = 50; - Double_t dist = xEnd - xyz0[0]; - Double_t deltax = dist / nHits; - - gtrack->CalculateHelix(); - Double_t pt = gtrack->GetPt(); - Double_t xcenter = gtrack->GetCenterX(); - Double_t ycenter = gtrack->GetCenterY(); - Double_t radius = gtrack->GetRadius(); - - - for(Int_t h=0; h<5; h++) { - Double_t cx = xyz0[0] - xcenter; - Double_t cy = xyz0[1] - ycenter; - - Double_t newx = cx + (h * deltax) ; - Double_t newy = cy - sqrt(radius+radius - h*h*deltax*deltax); - Double_t newz = 0.0; - newx += xcenter; - newy += ycenter; - - LOG(AliHLTTPCLog::kError,"AliHLTTPCDisplay::DisplayAll","HELIX") << "local="<< gtrack->IsLocal() << " slice" << slice0 <<"\n" - << "x=" << newx << " y=" << newy << " z=" << newz << " xcenter=" << xcenter << "\n" - << "dist=" << dist << " deltax=" << deltax << " radius=" << radius << ENDLOG; - pm->SetPoint(h,newx,newy,newz); - hitcount++; - } -*/ -#endif - - for(Int_t h=0; h>25) & 0x7f; Int_t patch = (id>>22) & 0x7; UInt_t pos = id&0x3fffff; - Int_t testslice; - if (slice > 17 && slice <36) testslice = slice - 17; - else testslice = slice; - - if(testslice < fMinSlice || testslice > fMaxSlice) - continue; - + AliHLTTPCSpacePointData *points = fClusters[slice][patch]; - + if(!points) { - LOG(AliHLTTPCLog::kError,"AliHLTTPCDisplay::DisplayAll","Clusterarray") - <<"No points at slice "<=fNcl[slice][patch]) { - LOG(AliHLTTPCLog::kError,"AliHLTTPCDisplay::DisplayAll","Clusterarray") - <<"Pos is too large: pos "<SetPoint(h,xcl[h],ycl[h],zcl[h]); - - hitcount++; - } - - if(hitcount==0) continue; - - pm->SetMarkerColor(6); - //pm->Draw(); - - TPolyLine3D *currentlinetest = &(linetest[j]); - currentlinetest = new TPolyLine3D(2,xArr,yArr,zArr,""); - currentlinetest->SetLineColor(3); - currentlinetest->SetLineWidth(3); -// currentlinetest->Draw("same"); - - TPolyLine3D *currentline = &(line[j]); - currentline = new TPolyLine3D(nHits,xcl,ycl,zcl,""); - currentline->SetLineColor(4); - currentline->SetLineWidth(2); - currentline->Draw("same"); - } - -LOG(AliHLTTPCLog::kError,"AliHLTTPCDisplay::DisplayAll","Track") <<" LEAVING TRACKS " << ENDLOG; - } // END Display Tracks ------------------------------------------------ - - DisplayGeom(x3don); + points[pos].fUsed = kTRUE; + } + } } -// ######################################################################################################################################## -void AliHLTTPCDisplay::DisplayGeom(Bool_t x3don){ - // Draw GEO - Int_t slice=0; - Int_t slicepair[1]; +// ############################################################################# +void AliHLTTPCDisplay::SetupHistPadRow(){ - if (fSlicePair != -1){ - // Draw Pair of Slices - slicepair[0] = fSlicePair; - - if (fSlicePair > 8) slicepair[1] = fSlicePair - 9; - else slicepair[1] = fSlicePair + 9; - - DrawGeom(slicepair[0]); - DrawGeom(slicepair[1]); - - } + Int_t maxpads = 150; + fNTimes = AliHLTTPCTransform::GetNTimeBins(); - else if (fSlicePair != -1){ - for (slice=fSlicePairMin;slice<=fSlicePairMax;slice++){ - DrawGeom(slice); - } - // Draw range Pair of Slices - if (fSlicePairMin > 8) { - slicepair[0] = fSlicePairMin - 9; - slicepair[1] = fSlicePairMax - 9; + if ( fHistraw ){ + delete fHistraw; + fHistraw = NULL; } - else { - slicepair[0] = fSlicePairMin + 9; - slicepair[1] = fSlicePairMax + 9; + if ( fHistrawcl ){ + delete fHistrawcl; + fHistrawcl = NULL; } - for (slice=slicepair[0];slice<=slicepair[1];slice++){ - DrawGeom(slice); + if ( fHistpad1 ){ + delete fHistpad1; + fHistpad1 = NULL; } - - } - else { - // Single Slice, or Range - if (fMinSlice > fMaxSlice){ - fMaxSlice += 17; - } - - for (slice=fMinSlice;slice<=fMaxSlice;slice++){ - if (fDrawGeo){ - DrawGeom(slice); - } - } - } - - - fc1->Draw(); - - if(x3don) fc1->x3d(); - fc1->Modified(); - fc1->Update(); - - -} -// ######################################################################################################################################## -void AliHLTTPCDisplay::SetupPadRow(Int_t histSwitch, Int_t slice, Int_t padrow){ - - fhistSwitch = histSwitch; - fSlice = slice; - fPadRow = padrow; - - fNPads = AliHLTTPCTransform::GetNPads(fPadRow); - fNTimes = AliHLTTPCTransform::GetNTimeBins(); - - if (!fc1) { - LOG(AliHLTTPCLog::kError,"AliHLTTPCDisplay::SetupPadRow","Setup histograms") << "No valid canvas" << ENDLOG; - return; + if ( fHistpad2 ){ + delete fHistpad2; + fHistpad2 = NULL; } - - // --- PADROW with HISTOGRAM "1"--- - if (fhistSwitch == 1){ - if ( fHistraw ){ - delete fHistraw; - fHistraw = NULL; - } - if ( fHistrawcl ){ - delete fHistrawcl; - fHistrawcl = NULL; - } - - // Setup the histograms - Int_t padbinning = fNPads*10; - fHistraw = new TH2F("fHistraw","Selected PadRow with found Clusters;Pad #;Timebin #",fNPads,0,fNPads-1,fNTimes,0,fNTimes-1); - fHistrawcl = new TH1F("fHistrawcl","",padbinning,0,fNPads-1); - fHistraw-> SetOption("COLZ"); + if ( fHistpad3 ){ + delete fHistpad3; + fHistpad3 = NULL; } + // Setup the histograms + Int_t padbinning = maxpads*10; + fHistraw = new TH2F("fHistraw","Selected PadRow with found Clusters;Pad #;Timebin #",maxpads,0,maxpads-1,fNTimes,0,fNTimes-1); + fHistrawcl = new TH1F("fHistrawcl","",padbinning,0,maxpads-1); + fHistpad1 = new TH1F ("fHistpad1","Selected Pad -1;Timebin #",fNTimes,0,fNTimes-1); + fHistpad2 = new TH1F ("fHistpad2","Selected Pad;Timebin #",fNTimes,0,fNTimes-1); + fHistpad3 = new TH1F ("fHistpad3","Selected Pad +1;Timebin #",fNTimes,0,fNTimes-1); + fHistraw->SetOption("COLZ"); gStyle->SetPalette(1); + + SetHistPadRowAxis(); } -// ######################################################################################################################################## -void AliHLTTPCDisplay::FillPadRow(Int_t patch, ULong_t dataBlock, ULong_t dataLen, UInt_t nofClusters, AliHLTTPCSpacePointData* data){ - LOG(AliHLTTPCLog::kError,"AliHLTTPCDisplay::FillPadRow","Enter") << ENDLOG; +// #################################################################################################### +void AliHLTTPCDisplay::FillPadRow(Int_t patch, ULong_t dataBlock, ULong_t dataLen){ AliHLTTPCDigitReaderPacked* fDigitReader = new AliHLTTPCDigitReaderPacked(); - - // reset histogram "1" - if (fhistSwitch == 1){ - fHistraw->Reset(); - fHistrawcl->Reset(); - } - bool readValue = true; Int_t rowOffset = 0; @@ -703,6 +291,9 @@ void AliHLTTPCDisplay::FillPadRow(Int_t patch, ULong_t dataBlock, ULong_t dataLe Int_t firstRow = AliHLTTPCTransform::GetFirstRow(patch); Int_t lastRow = AliHLTTPCTransform::GetLastRow(patch); + // Outer sector, patches 2, 3, 4, 5 - start counting in patch 2 with row 0 + if ( patch >= 2 ) rowOffset = AliHLTTPCTransform::GetFirstRow( 2 ); + // Initialize block for reading packed data void* tmpdataBlock = (void*) dataBlock; fDigitReader->InitBlock(tmpdataBlock,dataLen,firstRow,lastRow); @@ -713,13 +304,9 @@ void AliHLTTPCDisplay::FillPadRow(Int_t patch, ULong_t dataBlock, ULong_t dataLe LOG(AliHLTTPCLog::kError,"AliHLTTPCDisplay::FillPadRow","Read first value") << "No value in data block" << ENDLOG; return; } - - // Outer sector, patches 2, 3, 4, 5 - start counting in patch 2 with row 0 - if ( patch >= 2 ) rowOffset = AliHLTTPCTransform::GetFirstRow( 2 ); - - // --- PADROW with GEOMETRY --- Initialize the colorbins - if (fhistSwitch == 0){ - + + // FILL PADROW 3D --- Initialize the colorbins + if (fSwitch3DPadRow){ for (UInt_t ii=0;ii < 20;ii++){ fbinct[ii] = 0; fcolorbin[ii] = 0; @@ -745,7 +332,6 @@ void AliHLTTPCDisplay::FillPadRow(Int_t patch, ULong_t dataBlock, ULong_t dataLe if(!readValue) break; //No more value } - //Initialize fpmarr[color][3*colorbin[ii]] fpmarr[0] = new Float_t[fcolorbin[0]*3]; fpmarr[1] = new Float_t[fcolorbin[1]*3]; @@ -772,25 +358,28 @@ void AliHLTTPCDisplay::FillPadRow(Int_t patch, ULong_t dataBlock, ULong_t dataLe fDigitReader->InitBlock(tmpdataBlock,dataLen,firstRow,lastRow); readValue = fDigitReader->Next(); + } // END if (fSwitch3DPadRow) - } // END --- PADROW with GEOMETRY --- Initialize the colorbins - + // -- Fill Raw Data while ( readValue ){ Int_t row = fDigitReader->GetRow() + rowOffset; // select padrow to fill in histogramm if (row == fPadRow){ - UChar_t pad = fDigitReader->GetPad(); UShort_t time = fDigitReader->GetTime(); UInt_t charge = fDigitReader->GetSignal(); Float_t xyz[3]; - - // --- PADROW with GEOMETRY --- - if (fhistSwitch == 0){ - // Transform raw coordinates to local coordinates - AliHLTTPCTransform::RawHLT2Global(xyz, fSlice, fPadRow, pad, time); + fHistraw->Fill(pad,time,charge); + + if (pad == (fPad-1) ) fHistpad1->Fill(time,charge); + if (pad == fPad) fHistpad2->Fill(time,charge); + if (pad == (fPad+1) ) fHistpad3->Fill(time,charge); + + if (fSwitch3DPadRow) { + // Transform raw coordinates to local coordinates + AliHLTTPCTransform::RawHLT2Global(xyz, fSlicePadRow, fPadRow, pad, time); for (UInt_t ii=0;ii < 19;ii++){ if ( charge > (ii*21) && charge <= ((ii*21) + 21) ){ @@ -807,17 +396,10 @@ void AliHLTTPCDisplay::FillPadRow(Int_t patch, ULong_t dataBlock, ULong_t dataLe fpmarr[19][fbinct[19]+2] = xyz[2]; fbinct[19] += 3; } - } - - // --- PADROW with HISTOGRAM --- - else { - // Transform raw coordinates to local coordinates - AliHLTTPCTransform::RawHLT2Local(xyz, fSlice, fPadRow, pad, time); - - fHistraw->Fill(pad,time,charge); - } + } // END if (fSwitch3DPadRow) + } - + // read next value readValue = fDigitReader->Next(); @@ -829,71 +411,307 @@ void AliHLTTPCDisplay::FillPadRow(Int_t patch, ULong_t dataBlock, ULong_t dataLe delete fDigitReader; fDigitReader = NULL; - // --- PADROW with HISTOGRAM --- - if (fhistSwitch != 0){ - // ========= FILL CLUSTER DATA - if (data && fSlice>=0 && fSlice<36 && patch>=0 && patchFill(xyz[1],xyz[2]); + } + } +} + + +// ############################################################################# +void AliHLTTPCDisplay::ResetHistPadRow(){ + fHistraw->Reset(); + fHistrawcl->Reset(); + fHistpad1->Reset(); + fHistpad2->Reset(); + fHistpad3->Reset(); +} + + +// ############################################################################# +// DRAWER +// ############################################################################# +void AliHLTTPCDisplay::DrawGeomSector(Int_t sector) { + Char_t fname[256]; + Int_t realsector = sector;// % 18; + + if (realsector < 10){ + sprintf(fname,"LS0%d",realsector); + fGeom->GetNode(fname)->SetLineColor(fLineColor); + fGeom->GetNode(fname)->Draw("same"); + sprintf(fname,"US0%d",realsector); + fGeom->GetNode(fname)->SetLineColor(fLineColor); + fGeom->GetNode(fname)->Draw("same"); + } + else { + sprintf(fname,"LS%d",realsector); + fGeom->GetNode(fname)->SetLineColor(fLineColor); + fGeom->GetNode(fname)->Draw("same"); + sprintf(fname,"US%d",realsector); + fGeom->GetNode(fname)->SetLineColor(fLineColor); + fGeom->GetNode(fname)->Draw("same"); + } +} +// ############################################################################# +void AliHLTTPCDisplay::DrawHistPadRow(){ + Char_t title[256]; + sprintf(title,"Selected PadRow %d with found Clusters",fPadRow); + + fHistraw->SetTitle(title); + fHistraw->SetStats(kFALSE); + fHistraw->Draw("COLZ"); + + fHistrawcl->SetStats(kFALSE); + fHistrawcl->SetMarkerStyle(28); + fHistrawcl->SetMarkerSize(2); + fHistrawcl->SetMarkerColor(1); + fHistrawcl->Draw("psame"); +} + +// ############################################################################# +void AliHLTTPCDisplay::DrawHistPad1(){ + Char_t title[256]; + sprintf(title,"Selected Pad %d",fPad -1); + fHistpad1->SetStats(kFALSE); + fHistpad1->SetTitle(title); + fHistpad1->Draw(); +} + +// ############################################################################# +void AliHLTTPCDisplay::DrawHistPad2(){ + Char_t title[256]; + sprintf(title,"Selected Pad %d",fPad); + + fHistpad2->SetStats(kFALSE); + fHistpad2->SetTitle(title); + fHistpad2->Draw(); +} + +// ############################################################################# +void AliHLTTPCDisplay::DrawHistPad3(){ + Char_t title[256]; + sprintf(title,"Selected Pad %d",fPad +1); + + fHistpad3->SetStats(kFALSE); + fHistpad3->SetTitle(title); + fHistpad3->Draw(); +} + +// ############################################################################# +void AliHLTTPCDisplay::Draw3D(){ + + TView *v = new TView(1); + v->SetRange(-800,-800,-800,800,800,800); + + Float_t* etaRange = NULL; // ------ STILL TO FIX + + //-------------------------------------------------------------------------------------------- + // DRAW 3D CLUSTER + //-------------------------------------------------------------------------------------------- + if (fSwitch3DCluster){ + for (Int_t slice=0; slice <= 35; slice++){ + if (!fSliceArray[slice]) continue; - Int_t arraysize=nofClusters*sizeof(AliHLTTPCSpacePointData); + for(Int_t p=0;p<6;p++){ + + AliHLTTPCSpacePointData *points = fClusters[slice][p]; + if(!points) continue; + Int_t npoints = fNcl[slice][p]; + TPolyMarker3D *pm = new TPolyMarker3D(npoints); + + Float_t xyz[3]; + for(Int_t i=0; ietaRange[1] ) + continue; + } + AliHLTTPCTransform::Local2Global(xyz,slice); + + pm->SetPoint(i,xyz[0],xyz[1],xyz[2]); + + } + pm->SetMarkerColor(2); + pm->Draw(""); + + } + } + } // END - DRAW 3D CLUSTER + + //-------------------------------------------------------------------------------------------- + // DRAW 3D TRACKS + //-------------------------------------------------------------------------------------------- + if (fSwitch3DTracks){ + + Int_t ntracks = fTracks->GetNTracks(); + + TPolyLine3D *line = new TPolyLine3D[ntracks]; + + Float_t xcl[176]; + Float_t ycl[176]; + Float_t zcl[176]; + + Int_t trackcounter = 0; + + for(Int_t j=0; jGetCheckedTrack(j); + if(!gtrack) continue; + + Int_t nHits = gtrack->GetNHits(); + UInt_t *hitnum = gtrack->GetHitNumbers(); + + TPolyMarker3D *pm = new TPolyMarker3D(nHits); + + Int_t hitcount=0; + Float_t xArr[2]; + Float_t yArr[2]; + Float_t zArr[2]; + + Bool_t nexttrack = kFALSE; + + for(Int_t h=0; h>25) & 0x7f; + Int_t patch = (id>>22) & 0x7; + UInt_t pos = id&0x3fffff; + + // select if slice should be displayed or not + if (!fSliceArray[slice]) { + nexttrack = kTRUE; + break; + } + + // select Single Track + if (fSelectTrackSwitch){ + if(slice != fSelectTrackSlice) { + nexttrack = kTRUE; + break; + } + + if (trackcounter != fSelectTrack && h==0){ + trackcounter++; + nexttrack = kTRUE; + break; + } + trackcounter++; + } + + // --> in the hit loop because of 'trackcounter++', otherwise wrong single track in slice will be selected + if((fPtThreshold > 0) && (gtrack->GetPt()< fPtThreshold)) { + nexttrack = kTRUE; + break; + } + + // --> in the hit loop because of 'trackcounter++', otherwise wrong single track in slice will be selected + if(nHits < fMinHits) { + nexttrack = kTRUE; + break; + } + + AliHLTTPCSpacePointData *points = fClusters[slice][patch]; + + if(!points) { + LOG(AliHLTTPCLog::kError,"AliHLTTPCDisplay::Draw3D","Clusterarray") <<"No points at slice "<=fNcl[slice][patch]) { + LOG(AliHLTTPCLog::kError,"AliHLTTPCDisplay::Draw3D","Clusterarray") <<"Pos is too large: pos "<SetPoint(h,xcl[h],ycl[h],zcl[h]); + + hitcount++; } - } - else { - LOG(AliHLTTPCLog::kError,"AliHLTTPCDisplay::SetupClusterDataForPatch","argument check") - <<"invalid argument "<Fill(xyz[1],xyz[2]); - } + //pm->SetMarkerColor(6); + //pm->Draw(); + + TPolyLine3D *currentline = &(line[j]); + currentline = new TPolyLine3D(nHits,xcl,ycl,zcl,""); + currentline->SetLineColor(4); + currentline->SetLineWidth(2); + currentline->Draw("same"); + } // END for tracks + + } // END - DRAW 3D Tracks + + //-------------------------------------------------------------------------------------------- + // DRAW 3D GEOMETRY + //-------------------------------------------------------------------------------------------- + if (fSwitch3DGeometry){ + + for (Int_t slice=0; slice <= 17; slice++){ + if (!fSliceArray[slice]) continue; + DrawGeomSector(slice); } - } // END --- PADROW with HISTOGRAM --- - LOG(AliHLTTPCLog::kError,"AliHLTTPCDisplay::FillPadRow","LEAVE") << ENDLOG; -} - -// ######################################################################################################################################## -void AliHLTTPCDisplay::DrawPadRow(Bool_t x3don){ - LOG(AliHLTTPCLog::kError,"AliHLTTPCDisplay::DrawPadRow","Enter") << ENDLOG; - -// fc1->Clear(); - - // --- PADROW with GEOMETRY --- - if (fhistSwitch == 0){ + } // END - DRAW 3D GEOMETRY + + //-------------------------------------------------------------------------------------------- + // DRAW 3D PadRow + //-------------------------------------------------------------------------------------------- + if (fSwitch3DPadRow && fSliceArray[fSlicePadRow]){ Int_t markercolor = 51; - DisplayGeom(x3don); - for (UInt_t ii=0;ii < 20;ii++){ if (fcolorbin[ii]> 0){ - + TPolyMarker3D *pm = new TPolyMarker3D(fcolorbin[ii], fpmarr[ii], 7 ); pm->SetMarkerColor(markercolor); @@ -905,21 +723,14 @@ void AliHLTTPCDisplay::DrawPadRow(Bool_t x3don){ else markercolor += 3; } } - // --- PADROW with HISTOGRAM --- - else { - if (fBackColor == 1) SetInvert(kTRUE); - fc1->SetFillColor(fBackColor); - fHistraw->Draw("COLZ"); - - fHistrawcl->SetMarkerStyle(28); - fHistrawcl->SetMarkerSize(2); - fHistrawcl->SetMarkerColor(1); - - fHistrawcl->Draw("psame"); - } - - fc1->Modified(); - fc1->Update(); - LOG(AliHLTTPCLog::kError,"AliHLTTPCDisplay::DrawPadRow","LEAVE") << ENDLOG; + //-------------------------------------------------------------------------------------------- + // DRAW 3D + //-------------------------------------------------------------------------------------------- + v->ZoomView(0,4); + v->Draw(); } + + + + diff --git a/HLT/TPCLib/AliHLTTPCDisplay.h b/HLT/TPCLib/AliHLTTPCDisplay.h index 438e4915503..4b5231c7bff 100644 --- a/HLT/TPCLib/AliHLTTPCDisplay.h +++ b/HLT/TPCLib/AliHLTTPCDisplay.h @@ -8,91 +8,122 @@ //_____________________________________________________________ // AliHLTTPCDisplay // -// Simple display class for the HLT tracks. +// Display class for the HLT TPC events. */ -// Author: Anders Vestbo -// Jochen Thaeder +// Author: Jochen Thaeder +// Anders Vestbo //*-- Copyright © ALICE HLT Group +#include #include #include #include -class TGeometry; class AliHLTTPCSpacePointData; class AliHLTTPCTrackArray; class AliHLTTPCDisplay : public TObject { public: - AliHLTTPCDisplay(); - AliHLTTPCDisplay(Int_t *slice, Char_t *gfile="$(ALIHLT_BASEDIR)/geo/alice.geom"); + AliHLTTPCDisplay(Char_t *gfile="$(ALIHLT_BASEDIR)/geo/alice.geom"); virtual ~AliHLTTPCDisplay(); // SETUP - void Setup(Char_t *trackfile,Char_t *path,Int_t event=-1,Bool_t sp=kFALSE); - void SetupClusterDataForPatch(Int_t slice, Int_t patch, UInt_t nofClusters, AliHLTTPCSpacePointData* data); - void SetupPadRow(Int_t histSwitch, Int_t slice, Int_t padrow); - - // SETTER - void SetSlices(Int_t minslice, Int_t maxslice); - void SetSlices(Int_t slice); - void SetSlices(); - void SetSlicesPair(Int_t slice); - void SetSlicesPair(Int_t minslice, Int_t maxslice); - void SetInvert(Bool_t invert=kTRUE); - void SetDrawGeo(Bool_t drawgeo=kTRUE); - void SetTracks(AliHLTTPCTrackArray *tracks) {fTracks=tracks;} + void SetupHistPadRow(); + void SetupCluster(Int_t slice, Int_t patch, UInt_t nofClusters, AliHLTTPCSpacePointData* data); + void SetupTracks(AliHLTTPCTrackArray *tracks); + + + void FillPadRow(Int_t patch, ULong_t dataBlock, ULong_t dataLen); + void ResetHistPadRow(); + + // DRAWER + void Draw3D(); + void DrawHistPadRow(); + void DrawGeomSector(Int_t sector); + void DrawHistPad1(); + void DrawHistPad2(); + void DrawHistPad3(); + + // SETTER + void SetSliceArray(); + void SetSlices(){fMinSlice = 0; fMaxSlice = 35; fSlicePair = kFALSE; SetSliceArray();} + void SetSlices(Int_t s){fMinSlice = s; fMaxSlice = s; fSlicePair = kFALSE; SetSliceArray();} + void SetSlices(Int_t mins, Int_t maxs){fMinSlice = mins; fMaxSlice = maxs; fSlicePair = kFALSE; SetSliceArray();} + void SetSlicesPair(Int_t s){fMinSlice = s; fMaxSlice = s; fSlicePair = kTRUE; SetSliceArray();} + void SetSlicesPair(Int_t mins, Int_t maxs){fMinSlice = mins; fMaxSlice = maxs; fSlicePair = kTRUE; SetSliceArray();} + void SetPad(Int_t f){fPad = f;} + void SetPadRow(Int_t f){fPadRow = f;} + void SetSlicePadRow(Int_t f){fSlicePadRow = f;} + void SetMinHits(Int_t f){fMinHits = f;} + void SetPtThreshold(Float_t f){fPtThreshold = f;} + void SetSwitches(Bool_t f1, Bool_t f2, Bool_t f3, Bool_t f4) {fSwitch3DTracks = f1; fSwitch3DCluster = f2; fSwitch3DPadRow = f3; fSwitch3DGeometry = f4;} + void SetHistPadRowAxis(); + void SetSelectTrack(Int_t f) {fSelectTrack = f;} + void SetSelectTrackSlice(Int_t f) {fSelectTrackSlice = f;} + void SetSelectTrackSwitch(Bool_t f) {fSelectTrackSwitch = f;} + void SetSelectCluster(Int_t f) {fSelectCluster = f;} + void SetInvert() {Int_t tmp = fBackColor; fBackColor = fLineColor; fLineColor = tmp; } + void SetKeepView(Bool_t f){fKeepView = f;} // GETTER - Int_t GetPadrow(){return fPadRow;} - Int_t GetSlice(){return fSlice;} + Int_t GetPadRow(){return fPadRow;} + Int_t GetSlicePadRow(){return fSlicePadRow;} + Int_t GetNPads(){return fNPads;} + Int_t GetBackColor() {return fBackColor;} - void DrawGeom(Int_t slice); + private: Bool_t LoadGeometrie(Char_t *gfile); - void DisplayGeom(Bool_t x3don=kTRUE); - void ResetDisplay(){ fc1->Clear(); } - void DisplayAll(Int_t minhits=10,Bool_t clusterswitch=kTRUE,Bool_t trackswitch=kTRUE,Bool_t x3don=kTRUE, Float_t thr=0., Float_t* etaRange=NULL); - - // PADROW - void FillPadRow(Int_t patch, ULong_t dataBlock, ULong_t dataLen, UInt_t nofClusters, AliHLTTPCSpacePointData* data); - void DrawPadRow(Bool_t x3don=kTRUE); - - private: AliHLTTPCDisplay(const AliHLTTPCDisplay &/*d*/):TObject(){;} AliHLTTPCDisplay& operator=(const AliHLTTPCDisplay &/*d*/){return *this;} - TCanvas *fc1; - TGeometry *fGeom; //! - - AliHLTTPCSpacePointData *fClusters[36][6]; //! - AliHLTTPCTrackArray *fTracks; //! - - UInt_t fNcl[36][6]; //number of cluster - Int_t fMinSlice; //min slice - Int_t fMaxSlice; //max slice - Int_t fBackColor; //Background color - Int_t fLineColor; //Line color - Int_t fSlicePair; //draw pair of slices; - Float_t fTheta; - Int_t fSlicePairMax; - Int_t fSlicePairMin; - Bool_t fDrawGeo; + AliHLTTPCSpacePointData *fClusters[36][6]; + AliHLTTPCTrackArray *fTracks; + + UInt_t fNcl[36][6];//number of cluster + + TH1F *fHistrawcl; // histogram for cluster in padrow + TH2F *fHistraw; // histogram for signals in padrow + TH1F *fHistpad1; // histogram for pad in padrow + TH1F *fHistpad2; // histogram for pad in padrow + TH1F *fHistpad3; // histogram for pad in padrow + + TGeometry *fGeom; // geometry + Int_t fBackColor; // Background color + Int_t fLineColor; // Line color + Bool_t fKeepView; // Keep View when redisplaying - // PADROW - TH1F *fHistrawcl; // Histogram for cluster in padrow - TH2F *fHistraw; // Histogram for signals in padrow - Int_t fSlice; // slice + Int_t fPad; // pad Int_t fPadRow; // padrow + Int_t fSlicePadRow;// slice where padrow is in Int_t fNPads; // number of pads in padrow Int_t fNTimes; // number of timebins - Int_t fhistSwitch; // switch between histogram and geometrie + Int_t fMinHits; // minimum cluster per track + Float_t fPtThreshold;// pt threshold for tracks + + Bool_t fSelectTrackSwitch;// switch ti single track mode + Int_t fSelectTrack;// select single track + Int_t fSelectTrackSlice; // select slice for single track + + Int_t fSelectCluster; // select all=0, used=1, unused=2 cluster + + Int_t fMinSlice; //min slice + Int_t fMaxSlice; //max slice + Bool_t fSlicePair; //draw pair of slices; + Bool_t fSliceArray[36];//Array if slice should be drawn or not + + Bool_t fDrawGeo; Int_t fcolorbin[20]; // number of entries per colorbin Int_t fbinct[20]; // index of colorbin Float_t *fpmarr[20]; // contains point data + Bool_t fSwitch3DCluster; + Bool_t fSwitch3DTracks; + Bool_t fSwitch3DPadRow; + Bool_t fSwitch3DGeometry; + ClassDef(AliHLTTPCDisplay,1) //Display class }; diff --git a/HLT/TPCLib/AliHLTTPCSpacePointData.h b/HLT/TPCLib/AliHLTTPCSpacePointData.h index 382a05b5c15..0af3edc8909 100644 --- a/HLT/TPCLib/AliHLTTPCSpacePointData.h +++ b/HLT/TPCLib/AliHLTTPCSpacePointData.h @@ -16,6 +16,7 @@ struct AliHLTTPCSpacePointData{ Float_t fSigmaY2; //error (former width) of the clusters Float_t fSigmaZ2; //error (former width) of the clusters UInt_t fCharge; + Bool_t fUsed; // only used in AliHLTTPCDisplay }; typedef struct AliHLTTPCSpacePointData AliHLTTPCSpacePointData; diff --git a/HLT/TPCLib/Ref/AliHLTTPCSpacePointData.h b/HLT/TPCLib/Ref/AliHLTTPCSpacePointData.h index 382a05b5c15..cd85764af55 100644 --- a/HLT/TPCLib/Ref/AliHLTTPCSpacePointData.h +++ b/HLT/TPCLib/Ref/AliHLTTPCSpacePointData.h @@ -16,6 +16,7 @@ struct AliHLTTPCSpacePointData{ Float_t fSigmaY2; //error (former width) of the clusters Float_t fSigmaZ2; //error (former width) of the clusters UInt_t fCharge; + Bool_t fUsed; }; typedef struct AliHLTTPCSpacePointData AliHLTTPCSpacePointData; -- 2.43.0