Changes accompanying migration to usage of ZTrans in TPCSectorViz.
[u/mrichter/AliRoot.git] / EVE / alice-macros / tpc_digits.C
CommitLineData
5a5a1232 1// $Id$
2
3#include "TGLViewer.h"
4
915dabe1 5namespace Alieve {
6class TPCData;
7class Event;
8}
9
10Alieve::TPCData* g_tpc_data = 0;
11Alieve::Event* g_tpc_last_event = 0;
12
13void tpc_digits(Int_t mode=0)
5a5a1232 14{
915dabe1 15 if (g_tpc_data == 0 || g_tpc_last_event != Alieve::gEvent) {
16 AliRunLoader* rl = Alieve::Event::AssertRunLoader();
17 rl->LoadDigits("TPC");
18 TTree* dt = rl->GetTreeD("TPC", false);
5a5a1232 19
915dabe1 20 g_tpc_data = new Alieve::TPCData;
21 g_tpc_data->LoadDigits(dt, kTRUE); // Create all present sectors.
5a5a1232 22
915dabe1 23 g_tpc_last_event = Alieve::gEvent;
24 }
5a5a1232 25
26 // Viewport limits.
915dabe1 27 /*
5a5a1232 28 Float_t left, right, top, bottom;
29 right = di->fOut2Seg.fNMaxPads* di->fOut2Seg.fPadWidth;
30 left = -right;
31 bottom = di->fInnSeg.fRlow;
32 top = bottom + di->fOut2Seg.fRlow +
33 di->fOut2Seg.fNRows*di->fOut2Seg.fPadLength - di->fInnSeg.fRlow;
915dabe1 34 */
5a5a1232 35
36 gStyle->SetPalette(1, 0);
092578a7 37 Color_t col = 36;
5a5a1232 38
915dabe1 39 switch(mode) {
40
41 case 0: { // Display a single sector
915dabe1 42 Alieve::TPCSector2D* s = new Alieve::TPCSector2D();
092578a7 43 s->SetFrameColor(col);
915dabe1 44 s->SetDataSource(g_tpc_data);
915dabe1 45 gReve->AddRenderElement(s);
5b96ea20 46 gReve->Redraw3D();
5a5a1232 47
a8600b56 48 TGLViewer* cam = dynamic_cast<TGLViewer*>(gReve->GetGLCanvas()->GetViewer3D());
5a5a1232 49 //cam->SetCurrentCamera(TGLViewer::kCameraOrthoXOY) ;
50 //cam->SetOrthoCamera(TGLViewer::kCameraOrthoXOY, 2*left, 2*right, 2*top, bottom);
51 //printf("%f %f %f %f\n", left, right, top, bottom);
52
915dabe1 53 break;
54 }
55
56 case 1: { // Display all sectors
5a5a1232 57 gReve->DisableRedraw();
58 {
59 Reve::RenderElementList* l = new Reve::RenderElementList("TPC plate 1");
60 l->SetTitle("TPC Plate");
61 l->SetMainColor(Color_t(col));
5b96ea20 62 gReve->AddRenderElement(l);
5a5a1232 63
64 for(Int_t i = 0; i<18; i++) {
915dabe1 65 Alieve::TPCSector2D* s = new Alieve::TPCSector2D();
092578a7 66 s->SetSectorID(i);
915dabe1 67 s->SetDataSource(g_tpc_data);
092578a7 68 s->SetFrameColor(col);
601bca51 69 s->SetAutoTrans(kTRUE);
5b96ea20 70 gReve->AddRenderElement(l, s);
5a5a1232 71 }
5a5a1232 72 }
73 {
74 Reve::RenderElementList* l = new Reve::RenderElementList("TPC plate 2");
75 l->SetTitle("TPC Plate");
76 l->SetMainColor(Color_t(col));
77
5b96ea20 78 gReve->AddRenderElement(l);
5a5a1232 79 for(Int_t i = 18; i<36; i++) {
915dabe1 80 Alieve::TPCSector2D* s = new Alieve::TPCSector2D();
092578a7 81 s->SetSectorID(i);
915dabe1 82 s->SetDataSource(g_tpc_data);
092578a7 83 s->SetFrameColor(col);
601bca51 84 s->SetAutoTrans(kTRUE);
5b96ea20 85 gReve->AddRenderElement(l, s);
5a5a1232 86 }
5a5a1232 87 }
88 gReve->EnableRedraw();
915dabe1 89
90 break;
5a5a1232 91 }
915dabe1 92
915dabe1 93 case 2 : { // Display a single sector in 3D
092578a7 94 Alieve::TPCSector3D* s = new Alieve::TPCSector3D();
95 s->SetFrameColor(col);
96 s->SetDataSource(g_tpc_data);
97 gReve->AddRenderElement(s);
5b96ea20 98 gReve->Redraw3D();
915dabe1 99 break;
100 }
915dabe1 101
a8600b56 102 case 3: { // Display all sectors in 3D
103 gReve->DisableRedraw();
104 {
105 Reve::RenderElementList* l = new Reve::RenderElementList("TPC plate 1");
106 l->SetTitle("TPC Plate");
107 l->SetMainColor(Color_t(col));
108 gReve->AddRenderElement(l);
109
110 for(Int_t i = 0; i<18; i++) {
111 Alieve::TPCSector3D* s = new Alieve::TPCSector3D();
112 s->SetSectorID(i);
113 s->SetDataSource(g_tpc_data);
114 s->SetFrameColor(col);
601bca51 115 s->SetAutoTrans(kTRUE);
a8600b56 116 gReve->AddRenderElement(l, s);
117 }
118 }
119 {
120 Reve::RenderElementList* l = new Reve::RenderElementList("TPC plate 2");
121 l->SetTitle("TPC Plate");
122 l->SetMainColor(Color_t(col));
123
124 gReve->AddRenderElement(l);
125 for(Int_t i = 18; i<36; i++) {
126 Alieve::TPCSector3D* s = new Alieve::TPCSector3D();
127 s->SetSectorID(i);
128 s->SetDataSource(g_tpc_data);
129 s->SetFrameColor(col);
601bca51 130 s->SetAutoTrans(kTRUE);
a8600b56 131 gReve->AddRenderElement(l, s);
132 }
133 }
134 gReve->EnableRedraw();
135
136 break;
137 }
138
915dabe1 139 } // switch
5a5a1232 140}