3 // Author: Anders Vestbo <mailto:vestbo@fi.uib.no>
4 //*-- Copyright © ASV
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"
24 //_____________________________________________________________
25 // Display class for Hough transform code
27 ClassImp(AliL3HoughDisplay)
30 AliL3HoughDisplay::AliL3HoughDisplay()
40 AliL3HoughDisplay::~AliL3HoughDisplay()
46 void AliL3HoughDisplay::Init(Char_t *trackfile, Char_t *gfile)
48 TFile *file = TFile::Open(gfile);
50 cerr<<"AliL3HoughDisplay::AliL3HoughDisplay : Geometry file " << gfile << " does not exist"<<endl;
51 fGeom = (TGeometry*)file->Get("AliceGeom");
54 fTracks = new AliL3TrackArray();
55 AliL3MemHandler *tfile = new AliL3MemHandler();
56 tfile->SetBinaryInput(trackfile);
57 tfile->Binary2TrackArray(fTracks);
58 tfile->CloseBinaryInput();
62 void AliL3HoughDisplay::GenerateHits(AliL3Track *track,Float_t *x,Float_t *y,Float_t *z,Int_t &n)
66 for(Int_t i=AliL3Transform::GetFirstRow(0); i<AliL3Transform::GetLastRow(5); i++)
68 if(track->GetCrossingPoint(i,xyz))
70 AliL3Transform::Local2Global(xyz,0);
81 TPolyMarker3D *AliL3HoughDisplay::LoadDigits()
84 AliL3DigitRowData *tempPt = fDigitRowData;
87 cerr<<"AliL3HoughDisplay::LoadDigits : No data"<<endl;
91 UInt_t nrows = AliL3Transform::GetNRows(fPatch);
93 for(UInt_t i=0; i<nrows; i++)
95 count += tempPt->fNDigit;
96 AliL3MemHandler::UpdateRowPointer(tempPt);
98 tempPt = fDigitRowData;
99 TPolyMarker3D *pm = new TPolyMarker3D(count);
103 for(UInt_t i=0; i<nrows; i++)
105 AliL3DigitData *digPt = tempPt->fDigitData;
106 Int_t padrow = (Int_t)tempPt->fRow;
107 for(UInt_t j=0; j<tempPt->fNDigit; j++)
109 AliL3Transform::Slice2Sector(fShowSlice,padrow,sector,row);
110 AliL3Transform::Raw2Global(xyz,sector,row,(Int_t)digPt->fPad,(Int_t)digPt->fTime);
111 pm->SetPoint(count,xyz[0],xyz[1],xyz[2]);
114 AliL3MemHandler::UpdateRowPointer(tempPt);
117 cout<<"Displaying "<<count<<" digits"<<endl;
121 void AliL3HoughDisplay::DisplayEvent()
123 //Display the found tracks.
127 cerr<<"AliL3HoughDisplay::DisplayTracks() : No tracks"<<endl;
131 TCanvas *c1 = new TCanvas("c1","",700,700);
134 TView *v = new TView(1);
135 v->SetRange(-430,-560,-430,430,560,1710);
142 Int_t ntracks = fTracks->GetNTracks();
143 TPolyLine3D *line = new TPolyLine3D[ntracks];
146 Float_t x[176],y[176],z[176];
147 for(Int_t j=0; j<ntracks; j++)
149 AliL3Track *track = fTracks->GetCheckedTrack(j);
151 track->CalculateHelix();
152 GenerateHits(track,x,y,z,n);
153 TPolyMarker3D *pm = new TPolyMarker3D(n);
155 for(Int_t h=0; h<n; h++)
156 pm->SetPoint(h,x[h],y[h],z[h]);
158 pm->SetMarkerColor(2);
160 TPolyLine3D *current_line = &(line[j]);
161 current_line = new TPolyLine3D(n,x,y,z,"");
162 current_line->SetLineColor(4);
163 current_line->Draw("same");
169 TPolyMarker3D *pm = LoadDigits();
170 pm->SetMarkerColor(2);
174 cout<<"Displaying...."<<endl;