1 // Author: Anders Vestbo <mailto:vestbo@fi.uib.no>
2 //*-- Copyright © ASV
7 #include <TPolyMarker3D.h>
8 #include <TPolyLine3D.h>
10 #include <TGeometry.h>
14 #include "AliL3Transform.h"
15 #include "AliL3HoughTrack.h"
16 #include "AliL3TrackArray.h"
17 #include "AliL3HoughDisplay.h"
18 #include "AliL3Defs.h"
19 #include "AliL3MemHandler.h"
21 //_____________________________________________________________
22 // Display class for Hough transform code
24 ClassImp(AliL3HoughDisplay)
27 AliL3HoughDisplay::AliL3HoughDisplay()
38 AliL3HoughDisplay::~AliL3HoughDisplay()
42 void AliL3HoughDisplay::Init()
44 TFile *file = TFile::Open("$(LEVEL3)/GEO/alice.geom");
46 cerr<<"AliL3HoughDisplay::AliL3HoughDisplay : Geometry file alice.geom does not exist"<<endl;
47 fGeom = (TGeometry*)file->Get("AliceGeom");
52 void AliL3HoughDisplay::GenerateHits(AliL3HoughTrack *track,Float_t *x,Float_t *y,Float_t *z,Int_t &n)
56 Int_t slice = track->GetSlice();
57 for(Int_t i=track->GetFirstRow(); i<track->GetLastRow(); i++)
59 if(track->GetCrossingPoint(i,xyz))
61 AliL3Transform::Local2Global(xyz,slice);
72 TPolyMarker3D *AliL3HoughDisplay::LoadDigits()
75 AliL3DigitRowData *tempPt = fDigitRowData;
78 cerr<<"AliL3HoughDisplay::LoadDigits : No data"<<endl;
82 Int_t nrows = NRows[fPatch][1] - NRows[fPatch][0] + 1;
84 for(UInt_t i=0; i<nrows; i++)
86 count += tempPt->fNDigit;
87 AliL3MemHandler::UpdateRowPointer(tempPt);
89 tempPt = fDigitRowData;
90 TPolyMarker3D *pm = new TPolyMarker3D(count);
94 for(UInt_t i=0; i<nrows; i++)
96 AliL3DigitData *digPt = tempPt->fDigitData;
97 Int_t padrow = (Int_t)tempPt->fRow;
98 for(UInt_t j=0; j<tempPt->fNDigit; j++)
100 AliL3Transform::Slice2Sector(fShowSlice,padrow,sector,row);
101 AliL3Transform::Raw2Global(xyz,sector,row,(Int_t)digPt->fPad,(Int_t)digPt->fTime);
102 pm->SetPoint(count,xyz[0],xyz[1],xyz[2]);
105 AliL3MemHandler::UpdateRowPointer(tempPt);
108 cout<<"Displaying "<<count<<" digits"<<endl;
112 void AliL3HoughDisplay::DisplayEvent()
114 //Display the found tracks.
118 printf("AliL3HoughDisplay::DisplayTracks() : No tracks\n");
122 TCanvas *c1 = new TCanvas("c1","",700,700);
125 TView *v = new TView(1);
126 v->SetRange(-430,-560,-430,430,560,1710);
133 Int_t ntracks = fTracks->GetNTracks();
134 TPolyLine3D *line = new TPolyLine3D[ntracks];
137 Float_t x[176],y[176],z[176];
138 for(Int_t j=0; j<ntracks; j++)
140 AliL3HoughTrack *track = (AliL3HoughTrack*)fTracks->GetCheckedTrack(j);
142 GenerateHits(track,x,y,z,n);
143 TPolyMarker3D *pm = new TPolyMarker3D(n);
144 for(Int_t h=0; h<n; h++)
145 pm->SetPoint(h,x[h],y[h],z[h]);
147 pm->SetMarkerColor(1);
149 TPolyLine3D *current_line = &(line[j]);
150 current_line = new TPolyLine3D(n,x,y,z,"");
151 current_line->SetLineColor(1);
152 current_line->Draw("same");
158 TPolyMarker3D *pm = LoadDigits();
159 pm->SetMarkerColor(2);