From 23c36ba252e0d8fea3fc113d902ecdf9a32af141 Mon Sep 17 00:00:00 2001 From: timms Date: Mon, 12 Dec 2005 12:52:19 +0000 Subject: [PATCH] Added total charge histogram, allresiduals histogram and graphs for the residuals of one track. --- HLT/TPCLib/AliHLTTPCDisplay.cxx | 420 ++++++++++++++++++++++++++------ HLT/TPCLib/AliHLTTPCDisplay.h | 35 ++- 2 files changed, 379 insertions(+), 76 deletions(-) diff --git a/HLT/TPCLib/AliHLTTPCDisplay.cxx b/HLT/TPCLib/AliHLTTPCDisplay.cxx index 148a98fc97a..29d6dc156cb 100644 --- a/HLT/TPCLib/AliHLTTPCDisplay.cxx +++ b/HLT/TPCLib/AliHLTTPCDisplay.cxx @@ -37,6 +37,10 @@ #include #include #include +#include +#include +#include + #ifdef use_aliroot #include @@ -72,6 +76,9 @@ AliHLTTPCDisplay::AliHLTTPCDisplay(Char_t *gfile) { fHistpad1 = NULL; fHistpad2 = NULL; fHistpad3 = NULL; + fHistallresiduals = NULL; + fHistcharge = NULL; + fGraphresiduals = NULL; fGeom = NULL; @@ -237,10 +244,13 @@ void AliHLTTPCDisplay::SetupTracks(AliHLTTPCTrackArray *tracks) { } // ############################################################################# -void AliHLTTPCDisplay::SetupHistPadRow(){ +void AliHLTTPCDisplay::SetupHist(){ Int_t maxpads = 150; fNTimes = AliHLTTPCTransform::GetNTimeBins(); + Float_t xyz[3]; + AliHLTTPCTransform::RawHLT2Global(xyz, 0, 0, 0, 0); + LOG(AliHLTTPCLog::kError,"AliHLTTPCDisplay::ccc","") << "t="<< fNTimes <<"maxZ="<SetOption("COLZ"); - gStyle->SetPalette(1); + + + fHistallresiduals->SetTitleSize(0.03); + fHistallresiduals->GetXaxis()->SetLabelSize(0.03); + fHistallresiduals->GetXaxis()->SetTitleSize(0.03); + fHistallresiduals->GetYaxis()->SetLabelSize(0.03); + fHistallresiduals->GetYaxis()->SetTitleSize(0.03); + + fHistcharge->SetTitleSize(0.03); + fHistcharge->GetXaxis()->SetLabelSize(0.03); + fHistcharge->GetXaxis()->SetTitleSize(0.03); + fHistcharge->GetYaxis()->SetLabelSize(0.03); + fHistcharge->GetYaxis()->SetTitleSize(0.03); + + fHistraw->SetTitleSize(0.03); + fHistraw->GetXaxis()->SetLabelSize(0.03); + fHistraw->GetXaxis()->SetTitleSize(0.03); + fHistraw->GetYaxis()->SetLabelSize(0.03); + fHistraw->GetYaxis()->SetTitleSize(0.03); + + fHistpad1->SetTitleSize(0.03); + fHistpad1->GetXaxis()->SetLabelSize(0.03); + fHistpad1->GetXaxis()->SetTitleSize(0.03); + fHistpad1->GetYaxis()->SetLabelSize(0.03); + fHistpad1->GetYaxis()->SetTitleSize(0.03); + + fHistpad2->SetTitleSize(0.03); + fHistpad2->GetXaxis()->SetLabelSize(0.03); + fHistpad2->GetXaxis()->SetTitleSize(0.03); + fHistpad2->GetYaxis()->SetLabelSize(0.03); + fHistpad2->GetYaxis()->SetTitleSize(0.03); + + fHistpad3->SetTitleSize(0.03); + fHistpad3->GetXaxis()->SetLabelSize(0.03); + fHistpad3->GetXaxis()->SetTitleSize(0.03); + fHistpad3->GetYaxis()->SetLabelSize(0.03); + fHistpad3->GetYaxis()->SetTitleSize(0.03); + gStyle->SetPalette(1); + SetHistPadRowAxis(); + } // #################################################################################################### @@ -440,6 +501,16 @@ void AliHLTTPCDisplay::ResetHistPadRow(){ fHistpad3->Reset(); } +// ############################################################################# +void AliHLTTPCDisplay::ResetHistResiduals(){ + fHistallresiduals->Reset(); +} + +// ############################################################################# +void AliHLTTPCDisplay::ResetHistCharge(){ + fHistcharge->Reset(); +} + // ############################################################################# // DRAWER @@ -510,6 +581,41 @@ void AliHLTTPCDisplay::DrawHistPad3(){ fHistpad3->Draw(); } +// ############################################################################# +void AliHLTTPCDisplay::DrawHistResiduals(){ + if (fSwitch3DTracks){ + + // Residual histogram for 1 track + if (fSelectTrackSwitch){ + Char_t title[256]; + sprintf(title,"Residuals of Track %d in Slice %d",fSelectTrack, fSelectTrackSlice ); + +// fHistresiduals->SetMarkerStyle(2); +// fHistresiduals->SetStats(kFALSE); +// fHistresiduals->SetTitle(title); +// fHistresiduals->Draw("p"); + fGraphresiduals->SetTitle(title); + fGraphresiduals->GetXaxis()->SetTitle("z"); + fGraphresiduals->GetYaxis()->SetTitle("residuals"); + fGraphresiduals->Draw("A*"); + + } + // Global residuals histogram + else{ + fHistallresiduals->SetStats(kFALSE); + fHistallresiduals->Draw(); + } + } +} + +// ############################################################################# +void AliHLTTPCDisplay::DrawHistCharge(){ + if (fSwitch3DCluster){ +// fHistcharge->SetStats(kFALSE); + fHistcharge->Draw(); + } +} + // ############################################################################# void AliHLTTPCDisplay::Draw3D(){ @@ -517,49 +623,72 @@ void AliHLTTPCDisplay::Draw3D(){ 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++){ + + UInt_t maxCharge = 0; + Float_t maxXYZ[3]; + UChar_t padrow; + if (!fSliceArray[slice]) continue; 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]); - + 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; } - pm->SetMarkerColor(2); - pm->Draw(""); - + AliHLTTPCTransform::Local2Global(xyz,slice); + + pm->SetPoint(i,xyz[0],xyz[1],xyz[2]); + + // Fill Charge Histogram + fHistcharge->Fill(points[i].fCharge); + if (points[i].fCharge > maxCharge ){ + maxCharge = points[i].fCharge; + maxXYZ[0] = points[i].fX; + maxXYZ[1] = points[i].fY; + maxXYZ[2] = points[i].fZ; + padrow = points[i].fPadRow; + } + } + pm->SetMarkerSize(4); + pm->SetMarkerColor(2); + pm->Draw(""); + } + + LOG(AliHLTTPCLog::kError,"AliHLTTPCDisplay::CHARGE","")<< "MAX CHARGE =" << maxCharge << " slice=" << slice + << " z=" << maxXYZ[0]<< " y=" << maxXYZ[1]<< " z=" << maxXYZ[2] + + << ENDLOG; + + } } // END - DRAW 3D CLUSTER @@ -571,10 +700,16 @@ void AliHLTTPCDisplay::Draw3D(){ Int_t ntracks = fTracks->GetNTracks(); TPolyLine3D *line = new TPolyLine3D[ntracks]; + TPolyLine3D *lineT = new TPolyLine3D[ntracks]; + Float_t xCl[176]; + Float_t yCl[176]; + Float_t zCl[176]; + + Float_t xT[176]; + Float_t yT[176]; + Float_t zT[176]; - Float_t xcl[176]; - Float_t ycl[176]; - Float_t zcl[176]; + Float_t res[176]; Int_t trackcounter = 0; @@ -585,18 +720,34 @@ void AliHLTTPCDisplay::Draw3D(){ Int_t nHits = gtrack->GetNHits(); UInt_t *hitnum = gtrack->GetHitNumbers(); + Int_t hitcount=0; + + Bool_t nexttrack = kFALSE; - TPolyMarker3D *pm = new TPolyMarker3D(nHits); + TPolyMarker3D *pm = new TPolyMarker3D(nHits,7); + TPolyMarker3D *pmT = new TPolyMarker3D(nHits,7); - Int_t hitcount=0; - Float_t xArr[2]; - Float_t yArr[2]; - Float_t zArr[2]; + TPolyMarker3D *pmL = new TPolyMarker3D(1,2); + TPolyMarker3D *pmF = new TPolyMarker3D(1,2); - Bool_t nexttrack = kFALSE; + Double_t lambda = 0.; // dipAngle lambda + Double_t r = 0.; // radius + Double_t kappa = 0.; // curvature = 1/R , signed + Double_t xyz0[3]; // startingpoint of track + Double_t xyzT[3]; // point on track + Double_t xyzC[3]; // cluster + Double_t s = 0.; // length of track + Double_t phi0 = 0.; // azimuthal angle of startingpoint, with respect to helix axis + Double_t bfield = 0; // BField + + Double_t xyzL[3]; // lastpoint of track + Double_t xyzF[3]; // firstpoint of track + + Double_t maxZ = 0; // range of the histogram + Double_t minZ =99999.; // range of the histogram for(Int_t h=0; h>25) & 0x7f; Int_t patch = (id>>22) & 0x7; @@ -620,7 +771,8 @@ void AliHLTTPCDisplay::Draw3D(){ nexttrack = kTRUE; break; } - trackcounter++; + + trackcounter++; } // --> in the hit loop because of 'trackcounter++', otherwise wrong single track in slice will be selected @@ -638,56 +790,178 @@ void AliHLTTPCDisplay::Draw3D(){ 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 "< Curvature / Radius / Phi0 + //kappa = gtrack->GetKappa(); + //r = gtrack->GetRadius(); + //phi0 = gtrack->GetPhi0(); + //bfield = AliHLTTPCTransform::GetBFieldValue(); + + lambda = atan( gtrack->GetTgl() ); + + bfield = 0.0029980 * 0.4; // KORRIGIERE B für =0.4 T Feld + + xyz0[0] = gtrack->GetFirstPointX(); + xyz0[1] = gtrack->GetFirstPointY(); + xyz0[2] = gtrack->GetFirstPointZ(); + + xyzF[0] = gtrack->GetFirstPointX(); + xyzF[1] = gtrack->GetFirstPointY(); + xyzF[2] = gtrack->GetFirstPointZ(); + + xyzL[0] = gtrack->GetLastPointX(); + xyzL[1] = gtrack->GetLastPointY(); + xyzL[2] = gtrack->GetLastPointZ(); + + pmL->SetPoint(0,xyzL[0],xyzL[1],xyzL[2]); + pmF->SetPoint(0,xyzF[0],xyzF[1],xyzF[2]); + + phi0 = gtrack->GetPsi() + (gtrack->GetCharge() * AliHLTTPCTransform::PiHalf() ); + + if (bfield != 0.){ + r = gtrack->GetPt() / bfield; + kappa = - gtrack->GetCharge() * 1. / r; + } + else { + r = 999999; // just infinity + kappa = 0; + } + + //Write Track Parameters for single track + if (fSelectTrackSwitch){ + fTrackParam.id = trackcounter - 1; + fTrackParam.nHits = nHits; + fTrackParam.charge = gtrack->GetCharge(); + fTrackParam.lambda = lambda; + fTrackParam.kappa = kappa; + fTrackParam.radius = r; + fTrackParam.slice = slice; + fTrackParam.phi0 = phi0; + fTrackParam.pt = gtrack->GetPt(); + fTrackParam.bfield = bfield; + fTrackParam.xyzF[0] = gtrack->GetFirstPointX(); + fTrackParam.xyzF[1] = gtrack->GetFirstPointY(); + fTrackParam.xyzF[2] = gtrack->GetFirstPointZ(); + fTrackParam.xyzL[0] = gtrack->GetLastPointX(); + fTrackParam.xyzL[1] = gtrack->GetLastPointY(); + fTrackParam.xyzL[2] = gtrack->GetLastPointZ(); + fTrackParam.psi = gtrack->GetPsi(); + } } - Int_t maxH = nHits - 1; - if (h == maxH){ - xArr[1]=xyztmp[0]; - yArr[1]=xyztmp[1]; - zArr[1]=xyztmp[2]; - } - - pm->SetPoint(h,xcl[h],ycl[h],zcl[h]); - + Float_t xyzCtmp[3]; // cluster tmp + + xyzCtmp[0] = points[pos].fX; + xyzCtmp[1] = points[pos].fY; + xyzCtmp[2] = points[pos].fZ; + + AliHLTTPCTransform::Local2Global(xyzCtmp,slice); + + xCl[h] = xyzCtmp[0]; + yCl[h] = xyzCtmp[1]; + zCl[h] = xyzCtmp[2]; + + // FILL POLYMARKER FOR THE ORIGINAL TRACKS + pm->SetPoint(h,xCl[h],yCl[h],zCl[h]); + + xyzC[0] = (Double_t) xyzCtmp[0]; + xyzC[1] = (Double_t) xyzCtmp[1]; + xyzC[2] = (Double_t) xyzCtmp[2]; + + xyzT[2] = xyzC[2]; + + //calculate length + s = ( xyzT[2] - xyz0[2] ) / sin(lambda); + + // calculate the corresponding coordinates on the track + xyzT[0] = xyz0[0] + r * ( cos( phi0 + (s*kappa*cos(lambda)) ) - cos( phi0 ) ); + xyzT[1] = xyz0[1] + r * ( sin( phi0 + (s*kappa*cos(lambda)) ) - sin( phi0 ) ); + + Double_t deltaX = ( xyzC[0] - xyzT[0] ); + Double_t deltaY = ( xyzC[1] - xyzT[1] ); + + Double_t residual = sqrt( deltaX*deltaX + deltaY*deltaY ); + res[h] = (Float_t) residual; + + if (maxZ < fabs(xyzT[2])) maxZ = fabs(xyzT[2]); + if (minZ > fabs(xyzT[2])) minZ = fabs(xyzT[2]); + + // FILL RESIDUALS HISTOGRAM + fHistallresiduals->Fill(residual); + + // FILL ARRAYS IN ORDER TO DRAW THE TRACKPOINTS, OUT OF THE PARAMETER + xT[h] = xyzT[0]; + yT[h] = xyzT[1]; + zT[h] = xyzT[2]; + + // FILL POLYMARKER FOR THE NEW TRACKS + pmT->SetPoint(h,xT[h],yT[h],zT[h]); + hitcount++; } if(nexttrack) continue; if(hitcount==0) continue; - //pm->SetMarkerColor(6); - //pm->Draw(); + if ( fGraphresiduals){ + delete fGraphresiduals; + fGraphresiduals = NULL; + } + + // FILL RESIDUALS GRAPH + fGraphresiduals = new TGraph(nHits,zT,res); + fGraphresiduals->GetXaxis()->SetLabelSize(0.02); + fGraphresiduals->GetXaxis()->SetTitleSize(0.02); + fGraphresiduals->GetYaxis()->SetLabelSize(0.02); + fGraphresiduals->GetYaxis()->SetTitleSize(0.02); + TPolyLine3D *currentline = &(line[j]); - currentline = new TPolyLine3D(nHits,xcl,ycl,zcl,""); + currentline = new TPolyLine3D(nHits,xCl,yCl,zCl,""); currentline->SetLineColor(4); currentline->SetLineWidth(2); - currentline->Draw("same"); +// currentline->Draw("same"); + + TPolyLine3D *currentlineT = &(lineT[j]); + currentlineT = new TPolyLine3D(nHits,xT,yT,zT,""); + currentlineT->SetLineColor(7); + currentlineT->SetLineWidth(1); +// currentlineT->Draw("same"); + + + //Last Point of Track + pmL->SetMarkerSize(3); + pmL->SetMarkerColor(4); + pmL->Draw(); + + //First Point of Track + pmF->SetMarkerSize(3); + pmF->SetMarkerColor(5); + pmF->Draw(); + + //Original Track + pm->SetMarkerSize(4); + pm->SetMarkerColor(6); + pm->Draw(); + + //New Track + pmT->SetMarkerSize(4); + pmT->SetMarkerColor(3); + pmT->Draw(); + } // END for tracks } // END - DRAW 3D Tracks diff --git a/HLT/TPCLib/AliHLTTPCDisplay.h b/HLT/TPCLib/AliHLTTPCDisplay.h index 4b5231c7bff..f9a8fa6f413 100644 --- a/HLT/TPCLib/AliHLTTPCDisplay.h +++ b/HLT/TPCLib/AliHLTTPCDisplay.h @@ -19,6 +19,7 @@ #include #include #include +#include class AliHLTTPCSpacePointData; class AliHLTTPCTrackArray; @@ -30,13 +31,16 @@ class AliHLTTPCDisplay : public TObject { virtual ~AliHLTTPCDisplay(); // SETUP - void SetupHistPadRow(); + void SetupHist(); void SetupCluster(Int_t slice, Int_t patch, UInt_t nofClusters, AliHLTTPCSpacePointData* data); void SetupTracks(AliHLTTPCTrackArray *tracks); - + // HISTOGRAM FILL/RESET FUNCTIONS + void FillPadRow(Int_t patch, ULong_t dataBlock, ULong_t dataLen); void ResetHistPadRow(); + void ResetHistResiduals(); + void ResetHistCharge(); // DRAWER void Draw3D(); @@ -45,7 +49,9 @@ class AliHLTTPCDisplay : public TObject { void DrawHistPad1(); void DrawHistPad2(); void DrawHistPad3(); - + void DrawHistResiduals(); + void DrawHistCharge(); + // SETTER void SetSliceArray(); void SetSlices(){fMinSlice = 0; fMaxSlice = 35; fSlicePair = kFALSE; SetSliceArray();} @@ -73,7 +79,26 @@ class AliHLTTPCDisplay : public TObject { Int_t GetNPads(){return fNPads;} Int_t GetBackColor() {return fBackColor;} + struct AliHLTTPCTrackParameter{ + Int_t nHits; + Int_t charge; + Double_t kappa; + Double_t radius; + Double_t xyzF[3]; + Double_t xyzL[3]; + Int_t slice; + Double_t phi0; + Double_t psi; + Double_t lambda; + Double_t pt; + Int_t id; + Double_t bfield; + }; + + AliHLTTPCTrackParameter fTrackParam; + private: + Bool_t LoadGeometrie(Char_t *gfile); AliHLTTPCDisplay(const AliHLTTPCDisplay &/*d*/):TObject(){;} @@ -89,6 +114,10 @@ class AliHLTTPCDisplay : public TObject { TH1F *fHistpad1; // histogram for pad in padrow TH1F *fHistpad2; // histogram for pad in padrow TH1F *fHistpad3; // histogram for pad in padrow + TH1F *fHistallresiduals;//histogram for all residuals + TH1F *fHistcharge; // histogram for clustercharge + + TGraph *fGraphresiduals; // graph of the residuals for one track TGeometry *fGeom; // geometry Int_t fBackColor; // Background color -- 2.39.3