3 // Author: Anders Vestbo <mailto:vestbo@fi.uib.no>
4 //*-- Copyright © ALICE HLT Group
8 #if ROOT_VERSION_CODE>= 331523
13 #include <TPolyMarker3D.h>
14 #include <TPolyLine3D.h>
16 #include <TGeometry.h>
20 #include "AliHLTStandardIncludes.h"
21 #include "AliHLTRootTypes.h"
22 #include "AliHLTDigitData.h"
23 #include "AliHLTLogging.h"
24 #include "AliHLTTransform.h"
25 #include "AliHLTHoughTrack.h"
26 #include "AliHLTTrackArray.h"
27 #include "AliHLTMemHandler.h"
28 #include "AliHLTHoughDisplay.h"
29 #include "AliHLTDigitData.h"
35 //_____________________________________________________________
36 // Display class for Hough transform code
38 ClassImp(AliHLTHoughDisplay)
41 AliHLTHoughDisplay::AliHLTHoughDisplay()
51 AliHLTHoughDisplay::~AliHLTHoughDisplay()
58 void AliHLTHoughDisplay::Init(Char_t *trackfile, Char_t *gfile)
61 TFile *file = TFile::Open(gfile);
63 cerr<<"AliHLTHoughDisplay::AliHLTHoughDisplay : Geometry file " << gfile << " does not exist"<<endl;
64 fGeom = (TGeometry*)file->Get("AliceGeom");
67 fTracks = new AliHLTTrackArray();
68 AliHLTMemHandler *tfile = new AliHLTMemHandler();
69 tfile->SetBinaryInput(trackfile);
70 tfile->Binary2TrackArray(fTracks);
71 tfile->CloseBinaryInput();
75 void AliHLTHoughDisplay::GenerateHits(AliHLTTrack *track,Float_t *x,Float_t *y,Float_t *z,Int_t &n)
77 //Generate hits according to the track parameters
80 for(Int_t i=AliHLTTransform::GetFirstRow(0); i<AliHLTTransform::GetLastRow(5); i++)
82 if(track->GetCrossingPoint(i,xyz))
84 AliHLTTransform::Local2Global(xyz,0);
95 TPolyMarker3D *AliHLTHoughDisplay::LoadDigits()
98 AliHLTDigitRowData *tempPt = fDigitRowData;
101 cerr<<"AliHLTHoughDisplay::LoadDigits : No data"<<endl;
105 UInt_t nrows = AliHLTTransform::GetNRows(fPatch);
107 for(UInt_t i=0; i<nrows; i++)
109 count += tempPt->fNDigit;
110 AliHLTMemHandler::UpdateRowPointer(tempPt);
112 tempPt = fDigitRowData;
113 TPolyMarker3D *pm = new TPolyMarker3D(count);
117 for(UInt_t i=0; i<nrows; i++)
119 AliHLTDigitData *digPt = tempPt->fDigitData;
120 Int_t padrow = (Int_t)tempPt->fRow;
121 for(UInt_t j=0; j<tempPt->fNDigit; j++)
123 AliHLTTransform::Slice2Sector(fShowSlice,padrow,sector,row);
124 AliHLTTransform::Raw2Global(xyz,sector,row,(Int_t)digPt->fPad,(Int_t)digPt->fTime);
125 pm->SetPoint(count,xyz[0],xyz[1],xyz[2]);
128 AliHLTMemHandler::UpdateRowPointer(tempPt);
131 cout<<"Displaying "<<count<<" digits"<<endl;
135 void AliHLTHoughDisplay::DisplayEvent()
137 //Display the found tracks.
141 cerr<<"AliHLTHoughDisplay::DisplayTracks() : No tracks"<<endl;
145 TCanvas *c1 = new TCanvas("c1","",700,700);
148 #if ROOT_VERSION_CODE>= 331523
149 Double_t rmin[]={-1,-1,-1};
150 Double_t rmax[]={ 1, 1, 1};
151 TView *v = new TView3D(1,rmin,rmax);
153 TView *v = new TView(1);
155 v->SetRange(-430,-560,-430,430,560,1710);
162 Int_t ntracks = fTracks->GetNTracks();
163 TPolyLine3D *line = new TPolyLine3D[ntracks];
166 Float_t x[176],y[176],z[176];
167 for(Int_t j=0; j<ntracks; j++)
169 AliHLTTrack *track = fTracks->GetCheckedTrack(j);
171 track->CalculateHelix();
172 GenerateHits(track,x,y,z,n);
173 TPolyMarker3D *pm = new TPolyMarker3D(n);
175 for(Int_t h=0; h<n; h++)
176 pm->SetPoint(h,x[h],y[h],z[h]);
178 pm->SetMarkerColor(2);
180 TPolyLine3D *currentline = &(line[j]);
181 currentline = new TPolyLine3D(n,x,y,z,"");
182 currentline->SetLineColor(4);
183 currentline->Draw("same");
189 TPolyMarker3D *pm = LoadDigits();
190 pm->SetMarkerColor(2);
194 cout<<"Displaying...."<<endl;