]>
Commit | Line | Data |
---|---|---|
3e87ef69 | 1 | // @(#) $Id$ |
1ed2ff53 | 2 | |
b1886074 | 3 | // Author: Anders Vestbo <mailto:vestbo@fi.uib.no> |
3e87ef69 | 4 | //*-- Copyright © ALICE HLT Group |
db739bef | 5 | |
e06900d5 | 6 | #include "AliL3StandardIncludes.h" |
7 | ||
db739bef | 8 | #include <TCanvas.h> |
9 | #include <TView.h> | |
10 | #include <TPolyMarker3D.h> | |
11 | #include <TPolyLine3D.h> | |
12 | #include <TNode.h> | |
13 | #include <TGeometry.h> | |
14 | #include <TShape.h> | |
15 | #include <TFile.h> | |
16 | ||
e06900d5 | 17 | #include "AliL3Logging.h" |
db739bef | 18 | #include "AliL3Transform.h" |
19 | #include "AliL3HoughTrack.h" | |
20 | #include "AliL3TrackArray.h" | |
b1886074 | 21 | #include "AliL3MemHandler.h" |
e06900d5 | 22 | #include "AliL3HoughDisplay.h" |
b1886074 | 23 | |
3e87ef69 | 24 | #if GCCVERSION == 3 |
25 | using namespace std; | |
26 | #endif | |
27 | ||
b1886074 | 28 | //_____________________________________________________________ |
29 | // Display class for Hough transform code | |
db739bef | 30 | |
31 | ClassImp(AliL3HoughDisplay) | |
32 | ||
33 | ||
34 | AliL3HoughDisplay::AliL3HoughDisplay() | |
35 | { | |
db739bef | 36 | |
37 | fTracks = 0; | |
b1886074 | 38 | fDigitRowData = 0; |
39 | fNDigitRowData = 0; | |
40 | fShowSlice = -1; | |
41 | fPatch = -1; | |
db739bef | 42 | } |
43 | ||
44 | AliL3HoughDisplay::~AliL3HoughDisplay() | |
45 | { | |
1ed2ff53 | 46 | if(fTracks) |
47 | delete fTracks; | |
db739bef | 48 | } |
49 | ||
da010058 | 50 | void AliL3HoughDisplay::Init(Char_t *trackfile, Char_t *gfile) |
db739bef | 51 | { |
da010058 | 52 | TFile *file = TFile::Open(gfile); |
db739bef | 53 | if(!file->IsOpen()) |
da010058 | 54 | cerr<<"AliL3HoughDisplay::AliL3HoughDisplay : Geometry file " << gfile << " does not exist"<<endl; |
db739bef | 55 | fGeom = (TGeometry*)file->Get("AliceGeom"); |
56 | file->Close(); | |
1ed2ff53 | 57 | |
58 | fTracks = new AliL3TrackArray(); | |
59 | AliL3MemHandler *tfile = new AliL3MemHandler(); | |
60 | tfile->SetBinaryInput(trackfile); | |
61 | tfile->Binary2TrackArray(fTracks); | |
62 | tfile->CloseBinaryInput(); | |
63 | delete tfile; | |
db739bef | 64 | } |
65 | ||
1ed2ff53 | 66 | void AliL3HoughDisplay::GenerateHits(AliL3Track *track,Float_t *x,Float_t *y,Float_t *z,Int_t &n) |
db739bef | 67 | { |
68 | n=0; | |
69 | Float_t xyz[3]; | |
1ed2ff53 | 70 | for(Int_t i=AliL3Transform::GetFirstRow(0); i<AliL3Transform::GetLastRow(5); i++) |
db739bef | 71 | { |
72 | if(track->GetCrossingPoint(i,xyz)) | |
73 | { | |
1ed2ff53 | 74 | AliL3Transform::Local2Global(xyz,0); |
db739bef | 75 | x[n] = xyz[0]; |
76 | y[n] = xyz[1]; | |
77 | z[n] = xyz[2]; | |
78 | n++; | |
79 | } | |
80 | else | |
81 | break; | |
82 | } | |
83 | } | |
84 | ||
b1886074 | 85 | TPolyMarker3D *AliL3HoughDisplay::LoadDigits() |
86 | { | |
87 | ||
88 | AliL3DigitRowData *tempPt = fDigitRowData; | |
89 | if(!tempPt) | |
90 | { | |
91 | cerr<<"AliL3HoughDisplay::LoadDigits : No data"<<endl; | |
92 | return 0; | |
93 | } | |
94 | ||
1ed2ff53 | 95 | UInt_t nrows = AliL3Transform::GetNRows(fPatch); |
b1886074 | 96 | Int_t count=0; |
97 | for(UInt_t i=0; i<nrows; i++) | |
98 | { | |
99 | count += tempPt->fNDigit; | |
100 | AliL3MemHandler::UpdateRowPointer(tempPt); | |
101 | } | |
102 | tempPt = fDigitRowData; | |
103 | TPolyMarker3D *pm = new TPolyMarker3D(count); | |
104 | Float_t xyz[3]; | |
105 | Int_t sector,row; | |
106 | count=0; | |
107 | for(UInt_t i=0; i<nrows; i++) | |
108 | { | |
109 | AliL3DigitData *digPt = tempPt->fDigitData; | |
110 | Int_t padrow = (Int_t)tempPt->fRow; | |
111 | for(UInt_t j=0; j<tempPt->fNDigit; j++) | |
112 | { | |
4ab9f8f0 | 113 | AliL3Transform::Slice2Sector(fShowSlice,padrow,sector,row); |
114 | AliL3Transform::Raw2Global(xyz,sector,row,(Int_t)digPt->fPad,(Int_t)digPt->fTime); | |
b1886074 | 115 | pm->SetPoint(count,xyz[0],xyz[1],xyz[2]); |
116 | count++; | |
117 | } | |
118 | AliL3MemHandler::UpdateRowPointer(tempPt); | |
119 | } | |
120 | ||
121 | cout<<"Displaying "<<count<<" digits"<<endl; | |
122 | return pm; | |
123 | } | |
124 | ||
125 | void AliL3HoughDisplay::DisplayEvent() | |
db739bef | 126 | { |
127 | //Display the found tracks. | |
128 | ||
129 | if(!fTracks) | |
130 | { | |
1ed2ff53 | 131 | cerr<<"AliL3HoughDisplay::DisplayTracks() : No tracks"<<endl; |
db739bef | 132 | return; |
133 | } | |
134 | ||
135 | TCanvas *c1 = new TCanvas("c1","",700,700); | |
136 | c1->cd(); | |
137 | ||
138 | TView *v = new TView(1); | |
139 | v->SetRange(-430,-560,-430,430,560,1710); | |
b1886074 | 140 | |
db739bef | 141 | c1->Clear(); |
142 | c1->SetFillColor(1); | |
143 | c1->SetTheta(90.); | |
144 | c1->SetPhi(0.); | |
145 | ||
146 | Int_t ntracks = fTracks->GetNTracks(); | |
147 | TPolyLine3D *line = new TPolyLine3D[ntracks]; | |
148 | ||
149 | Int_t n; | |
150 | Float_t x[176],y[176],z[176]; | |
151 | for(Int_t j=0; j<ntracks; j++) | |
152 | { | |
1ed2ff53 | 153 | AliL3Track *track = fTracks->GetCheckedTrack(j); |
db739bef | 154 | if(!track) continue; |
1ed2ff53 | 155 | track->CalculateHelix(); |
db739bef | 156 | GenerateHits(track,x,y,z,n); |
157 | TPolyMarker3D *pm = new TPolyMarker3D(n); | |
1ed2ff53 | 158 | |
db739bef | 159 | for(Int_t h=0; h<n; h++) |
160 | pm->SetPoint(h,x[h],y[h],z[h]); | |
161 | ||
1ed2ff53 | 162 | pm->SetMarkerColor(2); |
db739bef | 163 | pm->Draw(); |
164 | TPolyLine3D *current_line = &(line[j]); | |
165 | current_line = new TPolyLine3D(n,x,y,z,""); | |
1ed2ff53 | 166 | current_line->SetLineColor(4); |
db739bef | 167 | current_line->Draw("same"); |
168 | ||
169 | } | |
170 | ||
b1886074 | 171 | if(fShowSlice>=0) |
172 | { | |
173 | TPolyMarker3D *pm = LoadDigits(); | |
174 | pm->SetMarkerColor(2); | |
175 | pm->Draw("same"); | |
176 | } | |
177 | ||
1ed2ff53 | 178 | cout<<"Displaying...."<<endl; |
db739bef | 179 | fGeom->Draw("same"); |
da010058 | 180 | c1->x3d(); |
db739bef | 181 | } |
1ed2ff53 | 182 | |
da010058 | 183 |