]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/exa/Display.C
Latest version
[u/mrichter/AliRoot.git] / HLT / exa / Display.C
CommitLineData
058d766f 1/**
2 Displays tracks and clusters read from a file.
3 Functionality is now in AliL3Display. See also the
4 display.C macro.
5*/
6
7void Display(char *trackfile=0,Bool_t rpoints = kFALSE,Bool_t tpoints = kTRUE,Char_t *gfile="/prog/alice/data/GEO/alice.geom")
f2793c29 8{
9// gROOT->Reset();
10 Int_t minslice=0;
11 Int_t maxslice=35;
12 /*
13 Display tracks and clusters already written to file.
14 */
15 char fname[256];
eb13caca 16 UInt_t npp[36][6];
17 AliL3SpacePointData *ppp[36][6];
18 AliL3FileHandler *fff[36][6];
f2793c29 19 for(int s=minslice;s<=maxslice;s++){
eb13caca 20 for(int p=0;p<6;p++){
f2793c29 21 ppp[s][p]=0;
22 fff[s][p] = new AliL3FileHandler();
23 sprintf(fname,"points_%d_%d.raw",s,p);
24 if(!fff[s][p]->SetBinaryInput(fname)){
f2793c29 25 delete fff[s][p];
26 continue;
27 }
28 ppp[s][p] = (AliL3SpacePointData *)fff[s][p]->Allocate();
29 fff[s][p]->Binary2Memory(npp[s][p],ppp[s][p]);
30 fff[s][p]->CloseBinaryInput();
31 printf("%s: %d points\n",fname,npp[s][p]);
32 }
33 }
34 if(trackfile){
35 AliL3FileHandler *trackf = new AliL3FileHandler();
36 if(!trackf->SetBinaryInput(trackfile)) return;
37 AliL3TrackArray *tracks= new AliL3TrackArray();
38 trackf->Binary2TrackArray(tracks);
39 trackf->CloseBinaryInput();
40 delete trackf;
41 printf("%s: %d tracks\n",trackfile,tracks->GetNPresent());
42 }
43
44 //display the event in 3D
45 TCanvas *c1 = new TCanvas("v1","",700,700);
46 TView *v = new TView(1);
47 v->SetRange(-430,-560,-430,430,560,1710);
48 //v->SetRange(0,0,-430,430,560,1710);
49 c1->Clear();
50 c1->SetFillColor(1);
51 c1->SetTheta(90.);
52 c1->SetPhi(0.);
53
54 if(rpoints){
55 for(Int_t s=0;s<36;s++){
eb13caca 56 for(int p=0;p<6;p++){
f2793c29 57 AliL3SpacePointData *points = ppp[s][p];
58 if(!points) continue;
59 int npoints = npp[s][p];
60 TPolyMarker3D *pm = new TPolyMarker3D(npoints);
61
62 float xyz[3];
63 for(int i=0; i<npoints; i++){
64 xyz[0] = points[i].fX;
65 xyz[1] = points[i].fY;
66 xyz[2] = points[i].fZ;
67
68 pm->SetPoint(i,xyz[0],xyz[1],xyz[2]);
69 if(xyz[0]==0){
70 printf("%d %d %d %d\n",npoints,s,p,i);
71 }
72 }
73 pm->SetMarkerColor(2);
74 pm->Draw("");
75 }
76 }
77 }
78
79 if(trackfile)
80 {
81 int ntracks = tracks->GetNTracks();
82 TPolyLine3D *line = new TPolyLine3D[ntracks];
eb13caca 83 Float_t xcl[176];
84 Float_t ycl[176];
85 Float_t zcl[176];
f2793c29 86
87 printf("ntracks %d\n",ntracks);
88
89 for(int j=0; j<ntracks; j++)
90 {
91 AliL3Track *gtrack = tracks->GetCheckedTrack(j);
92 if(!gtrack) continue;
93 Int_t nHits = gtrack->GetNHits();
94 UInt_t *hitnum=gtrack->GetHitNumbers();
95 //printf("nhits %d\n",nHits);
96 if(nHits < 10) continue;
97 TPolyMarker3D *pm = new TPolyMarker3D(nHits);
98 for(int h=0; h<nHits; h++)
99 {
100 UInt_t id=hitnum[h];
101 Int_t slice = (id>>25) & 0x7f;
102 Int_t patch = (id>>22) & 0x7;
103 UInt_t pos = id&0x3fffff;
104// printf("slice: %d patch: %d #%d \n",slice,patch,pos);
105
106 AliL3SpacePointData *points = ppp[slice][patch];
107
108 if(!points) {
109 printf("*** No Points at slice: %d patch: %d #%d \n",
110 slice,patch,pos);
111 continue;
112 }
113 if(pos>=npp[slice][patch]) {printf("Error \n"); continue;}
114 //printf("hit %d %d\n",curclust->GetHitNumber(),id);
115 xcl[h] = points[pos].fX;
116 ycl[h] = points[pos].fY;
117 zcl[h] = points[pos].fZ;
118 pm->SetPoint(h,xcl[h],ycl[h],zcl[h]);
119 }
120 pm->SetMarkerColor(4);
121 if(tpoints) pm->Draw();
122 TPolyLine3D *current_line = &(line[j]);
123 current_line = new TPolyLine3D(nHits,xcl,ycl,zcl,"");
124
125 current_line->SetLineColor(4);
126 current_line->Draw("same");
127 }
128 }
058d766f 129
130 TFile *geofile = new TFile(gfile,"READ");
f2793c29 131 TGeometry *geom=(TGeometry*)geofile->Get("AliceGeom");
132 geom->Draw("same");
133
134 c1->cd();
135
136 c1->x3d();
137 // c1->Modified();
138 //c1->Update();
139
140 return;
141}