3 // Author: Anders Vestbo <mailto:vestbo@fi.uib.no>
4 //*-- Copyright © ALICE HLT Group
6 #include "AliL3StandardIncludes.h"
10 #include <TPolyMarker3D.h>
11 #include <TPolyLine3D.h>
13 #include <TGeometry.h>
17 #include "AliL3Logging.h"
18 #include "AliL3Transform.h"
19 #include "AliL3HoughTrack.h"
20 #include "AliL3TrackArray.h"
21 #include "AliL3MemHandler.h"
22 #include "AliL3HoughDisplay.h"
28 //_____________________________________________________________
29 // Display class for Hough transform code
31 ClassImp(AliL3HoughDisplay)
34 AliL3HoughDisplay::AliL3HoughDisplay()
44 AliL3HoughDisplay::~AliL3HoughDisplay()
50 void AliL3HoughDisplay::Init(Char_t *trackfile, Char_t *gfile)
52 TFile *file = TFile::Open(gfile);
54 cerr<<"AliL3HoughDisplay::AliL3HoughDisplay : Geometry file " << gfile << " does not exist"<<endl;
55 fGeom = (TGeometry*)file->Get("AliceGeom");
58 fTracks = new AliL3TrackArray();
59 AliL3MemHandler *tfile = new AliL3MemHandler();
60 tfile->SetBinaryInput(trackfile);
61 tfile->Binary2TrackArray(fTracks);
62 tfile->CloseBinaryInput();
66 void AliL3HoughDisplay::GenerateHits(AliL3Track *track,Float_t *x,Float_t *y,Float_t *z,Int_t &n)
70 for(Int_t i=AliL3Transform::GetFirstRow(0); i<AliL3Transform::GetLastRow(5); i++)
72 if(track->GetCrossingPoint(i,xyz))
74 AliL3Transform::Local2Global(xyz,0);
85 TPolyMarker3D *AliL3HoughDisplay::LoadDigits()
88 AliL3DigitRowData *tempPt = fDigitRowData;
91 cerr<<"AliL3HoughDisplay::LoadDigits : No data"<<endl;
95 UInt_t nrows = AliL3Transform::GetNRows(fPatch);
97 for(UInt_t i=0; i<nrows; i++)
99 count += tempPt->fNDigit;
100 AliL3MemHandler::UpdateRowPointer(tempPt);
102 tempPt = fDigitRowData;
103 TPolyMarker3D *pm = new TPolyMarker3D(count);
107 for(UInt_t i=0; i<nrows; i++)
109 AliL3DigitData *digPt = tempPt->fDigitData;
110 Int_t padrow = (Int_t)tempPt->fRow;
111 for(UInt_t j=0; j<tempPt->fNDigit; j++)
113 AliL3Transform::Slice2Sector(fShowSlice,padrow,sector,row);
114 AliL3Transform::Raw2Global(xyz,sector,row,(Int_t)digPt->fPad,(Int_t)digPt->fTime);
115 pm->SetPoint(count,xyz[0],xyz[1],xyz[2]);
118 AliL3MemHandler::UpdateRowPointer(tempPt);
121 cout<<"Displaying "<<count<<" digits"<<endl;
125 void AliL3HoughDisplay::DisplayEvent()
127 //Display the found tracks.
131 cerr<<"AliL3HoughDisplay::DisplayTracks() : No tracks"<<endl;
135 TCanvas *c1 = new TCanvas("c1","",700,700);
138 TView *v = new TView(1);
139 v->SetRange(-430,-560,-430,430,560,1710);
146 Int_t ntracks = fTracks->GetNTracks();
147 TPolyLine3D *line = new TPolyLine3D[ntracks];
150 Float_t x[176],y[176],z[176];
151 for(Int_t j=0; j<ntracks; j++)
153 AliL3Track *track = fTracks->GetCheckedTrack(j);
155 track->CalculateHelix();
156 GenerateHits(track,x,y,z,n);
157 TPolyMarker3D *pm = new TPolyMarker3D(n);
159 for(Int_t h=0; h<n; h++)
160 pm->SetPoint(h,x[h],y[h],z[h]);
162 pm->SetMarkerColor(2);
164 TPolyLine3D *current_line = &(line[j]);
165 current_line = new TPolyLine3D(n,x,y,z,"");
166 current_line->SetLineColor(4);
167 current_line->Draw("same");
173 TPolyMarker3D *pm = LoadDigits();
174 pm->SetMarkerColor(2);
178 cout<<"Displaying...."<<endl;