3 // Author: Anders Vestbo <mailto:vestbo@fi.uib.no>
4 //*-- Copyright © ALICE HLT Group
9 #include <TPolyMarker3D.h>
10 #include <TPolyLine3D.h>
12 #include <TGeometry.h>
16 #include "AliL3StandardIncludes.h"
17 #include "AliL3RootTypes.h"
18 #include "AliL3DigitData.h"
19 #include "AliL3Logging.h"
20 #include "AliL3Transform.h"
21 #include "AliL3HoughTrack.h"
22 #include "AliL3TrackArray.h"
23 #include "AliL3MemHandler.h"
24 #include "AliL3HoughDisplay.h"
25 #include "AliL3DigitData.h"
31 //_____________________________________________________________
32 // Display class for Hough transform code
34 ClassImp(AliL3HoughDisplay)
37 AliL3HoughDisplay::AliL3HoughDisplay()
47 AliL3HoughDisplay::~AliL3HoughDisplay()
54 void AliL3HoughDisplay::Init(Char_t *trackfile, Char_t *gfile)
57 TFile *file = TFile::Open(gfile);
59 cerr<<"AliL3HoughDisplay::AliL3HoughDisplay : Geometry file " << gfile << " does not exist"<<endl;
60 fGeom = (TGeometry*)file->Get("AliceGeom");
63 fTracks = new AliL3TrackArray();
64 AliL3MemHandler *tfile = new AliL3MemHandler();
65 tfile->SetBinaryInput(trackfile);
66 tfile->Binary2TrackArray(fTracks);
67 tfile->CloseBinaryInput();
71 void AliL3HoughDisplay::GenerateHits(AliL3Track *track,Float_t *x,Float_t *y,Float_t *z,Int_t &n)
73 //Generate hits according to the track parameters
76 for(Int_t i=AliL3Transform::GetFirstRow(0); i<AliL3Transform::GetLastRow(5); i++)
78 if(track->GetCrossingPoint(i,xyz))
80 AliL3Transform::Local2Global(xyz,0);
91 TPolyMarker3D *AliL3HoughDisplay::LoadDigits()
94 AliL3DigitRowData *tempPt = fDigitRowData;
97 cerr<<"AliL3HoughDisplay::LoadDigits : No data"<<endl;
101 UInt_t nrows = AliL3Transform::GetNRows(fPatch);
103 for(UInt_t i=0; i<nrows; i++)
105 count += tempPt->fNDigit;
106 AliL3MemHandler::UpdateRowPointer(tempPt);
108 tempPt = fDigitRowData;
109 TPolyMarker3D *pm = new TPolyMarker3D(count);
113 for(UInt_t i=0; i<nrows; i++)
115 AliL3DigitData *digPt = tempPt->fDigitData;
116 Int_t padrow = (Int_t)tempPt->fRow;
117 for(UInt_t j=0; j<tempPt->fNDigit; j++)
119 AliL3Transform::Slice2Sector(fShowSlice,padrow,sector,row);
120 AliL3Transform::Raw2Global(xyz,sector,row,(Int_t)digPt->fPad,(Int_t)digPt->fTime);
121 pm->SetPoint(count,xyz[0],xyz[1],xyz[2]);
124 AliL3MemHandler::UpdateRowPointer(tempPt);
127 cout<<"Displaying "<<count<<" digits"<<endl;
131 void AliL3HoughDisplay::DisplayEvent()
133 //Display the found tracks.
137 cerr<<"AliL3HoughDisplay::DisplayTracks() : No tracks"<<endl;
141 TCanvas *c1 = new TCanvas("c1","",700,700);
144 TView *v = new TView(1);
145 v->SetRange(-430,-560,-430,430,560,1710);
152 Int_t ntracks = fTracks->GetNTracks();
153 TPolyLine3D *line = new TPolyLine3D[ntracks];
156 Float_t x[176],y[176],z[176];
157 for(Int_t j=0; j<ntracks; j++)
159 AliL3Track *track = fTracks->GetCheckedTrack(j);
161 track->CalculateHelix();
162 GenerateHits(track,x,y,z,n);
163 TPolyMarker3D *pm = new TPolyMarker3D(n);
165 for(Int_t h=0; h<n; h++)
166 pm->SetPoint(h,x[h],y[h],z[h]);
168 pm->SetMarkerColor(2);
170 TPolyLine3D *currentline = &(line[j]);
171 currentline = new TPolyLine3D(n,x,y,z,"");
172 currentline->SetLineColor(4);
173 currentline->Draw("same");
179 TPolyMarker3D *pm = LoadDigits();
180 pm->SetMarkerColor(2);
184 cout<<"Displaying...."<<endl;