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()
44 void AliL3HoughDisplay::Init()
46 TFile *file = TFile::Open("/prog/alice/data/GEO/alice.geom");
48 cerr<<"AliL3HoughDisplay::AliL3HoughDisplay : Geometry file alice.geom does not exist"<<endl;
49 fGeom = (TGeometry*)file->Get("AliceGeom");
51 fTransform = new AliL3Transform();
55 void AliL3HoughDisplay::GenerateHits(AliL3HoughTrack *track,Float_t *x,Float_t *y,Float_t *z,Int_t &n)
59 Int_t slice = track->GetSlice();
60 for(Int_t i=track->GetFirstRow(); i<track->GetLastRow(); i++)
62 if(track->GetCrossingPoint(i,xyz))
64 fTransform->Local2Global(xyz,slice);
75 TPolyMarker3D *AliL3HoughDisplay::LoadDigits()
78 AliL3DigitRowData *tempPt = fDigitRowData;
81 cerr<<"AliL3HoughDisplay::LoadDigits : No data"<<endl;
85 Int_t nrows = NRows[fPatch][1] - NRows[fPatch][0] + 1;
87 for(UInt_t i=0; i<nrows; i++)
89 count += tempPt->fNDigit;
90 AliL3MemHandler::UpdateRowPointer(tempPt);
92 tempPt = fDigitRowData;
93 TPolyMarker3D *pm = new TPolyMarker3D(count);
97 for(UInt_t i=0; i<nrows; i++)
99 AliL3DigitData *digPt = tempPt->fDigitData;
100 Int_t padrow = (Int_t)tempPt->fRow;
101 for(UInt_t j=0; j<tempPt->fNDigit; j++)
103 fTransform->Slice2Sector(fShowSlice,padrow,sector,row);
104 fTransform->Raw2Global(xyz,sector,row,(Int_t)digPt->fPad,(Int_t)digPt->fTime);
105 pm->SetPoint(count,xyz[0],xyz[1],xyz[2]);
108 AliL3MemHandler::UpdateRowPointer(tempPt);
111 cout<<"Displaying "<<count<<" digits"<<endl;
115 void AliL3HoughDisplay::DisplayEvent()
117 //Display the found tracks.
121 printf("AliL3HoughDisplay::DisplayTracks() : No tracks\n");
125 TCanvas *c1 = new TCanvas("c1","",700,700);
128 TView *v = new TView(1);
129 v->SetRange(-430,-560,-430,430,560,1710);
136 Int_t ntracks = fTracks->GetNTracks();
137 TPolyLine3D *line = new TPolyLine3D[ntracks];
140 Float_t x[176],y[176],z[176];
141 for(Int_t j=0; j<ntracks; j++)
143 AliL3HoughTrack *track = (AliL3HoughTrack*)fTracks->GetCheckedTrack(j);
145 GenerateHits(track,x,y,z,n);
146 TPolyMarker3D *pm = new TPolyMarker3D(n);
147 for(Int_t h=0; h<n; h++)
148 pm->SetPoint(h,x[h],y[h],z[h]);
150 pm->SetMarkerColor(1);
152 TPolyLine3D *current_line = &(line[j]);
153 current_line = new TPolyLine3D(n,x,y,z,"");
154 current_line->SetLineColor(1);
155 current_line->Draw("same");
161 TPolyMarker3D *pm = LoadDigits();
162 pm->SetMarkerColor(2);