2 // Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
4 /**************************************************************************
5 * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
6 * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for *
7 * full copyright notice. *
8 **************************************************************************/
10 #include "TGLViewer.h"
14 class AliEveEventManager;
17 AliEveTPCData* g_tpc_data = 0;
18 AliEveEventManager* g_tpc_last_event = 0;
20 void tpc_digits(Int_t mode=1)
22 if (g_tpc_data == 0 || g_tpc_last_event != gEvent) {
23 AliRunLoader* rl = AliEveEventManager::AssertRunLoader();
24 rl->LoadDigits("TPC");
25 TTree* dt = rl->GetTreeD("TPC", false);
27 g_tpc_data = new AliEveTPCData;
28 g_tpc_data->LoadDigits(dt, kTRUE); // Create all present sectors.
30 g_tpc_last_event = gEvent;
35 Float_t left, right, top, bottom;
36 right = di->fOut2Seg.fNMaxPads* di->fOut2Seg.fPadWidth;
38 bottom = di->fInnSeg.fRlow;
39 top = bottom + di->fOut2Seg.fRlow +
40 di->fOut2Seg.fNRows*di->fOut2Seg.fPadLength - di->fInnSeg.fRlow;
43 gStyle->SetPalette(1, 0);
48 case 0: { // Display a single sector
49 AliEveTPCSector2D* s = new AliEveTPCSector2D();
50 s->SetFrameColor(col);
51 s->SetDataSource(g_tpc_data);
55 //TGLViewer* cam = gEve->GetGLViewer();
56 //cam->SetCurrentCamera(TGLViewer::kCameraOrthoXOY) ;
57 //cam->SetOrthoCamera(TGLViewer::kCameraOrthoXOY, 2*left, 2*right, 2*top, bottom);
58 //printf("%f %f %f %f\n", left, right, top, bottom);
63 case 1: { // Display all sectors
64 gEve->DisableRedraw();
66 TEveElementList* l = new TEveElementList("TPC plate 1");
67 l->SetTitle("TPC Plate");
68 l->SetMainColor(Color_t(col));
71 for(Int_t i = 0; i<18; i++) {
72 AliEveTPCSector2D* s = new AliEveTPCSector2D(Form("AliEveTPCSector2D %d", i));
74 s->SetDataSource(g_tpc_data);
75 s->SetFrameColor(col);
76 s->SetAutoTrans(kTRUE);
77 gEve->AddElement(s, l);
81 TEveElementList* l = new TEveElementList("TPC plate 2");
82 l->SetTitle("TPC Plate");
83 l->SetMainColor(Color_t(col));
86 for(Int_t i = 18; i<36; i++) {
87 AliEveTPCSector2D* s = new AliEveTPCSector2D(Form("AliEveTPCSector2D %d", i));
89 s->SetDataSource(g_tpc_data);
90 s->SetFrameColor(col);
91 s->SetAutoTrans(kTRUE);
92 gEve->AddElement(s, l);
100 case 2 : { // Display a single sector in 3D
101 AliEveTPCSector3D* s = new AliEveTPCSector3D();
102 s->SetFrameColor(col);
103 s->SetDataSource(g_tpc_data);
109 case 3: { // Display all sectors in 3D
110 gEve->DisableRedraw();
112 TEveElementList* l = new TEveElementList("TPC plate 1");
113 l->SetTitle("TPC Plate");
114 l->SetMainColor(Color_t(col));
117 for(Int_t i = 0; i<18; i++) {
118 AliEveTPCSector3D* s = new AliEveTPCSector3D(Form("AliEveTPCSector3D %d", i));
120 s->SetDataSource(g_tpc_data);
121 s->SetFrameColor(col);
122 s->SetAutoTrans(kTRUE);
123 gEve->AddElement(s, l);
127 TEveElementList* l = new TEveElementList("TPC plate 2");
128 l->SetTitle("TPC Plate");
129 l->SetMainColor(Color_t(col));
132 for(Int_t i = 18; i<36; i++) {
133 AliEveTPCSector3D* s = new AliEveTPCSector3D(Form("AliEveTPCSector3D %d", i));
135 s->SetDataSource(g_tpc_data);
136 s->SetFrameColor(col);
137 s->SetAutoTrans(kTRUE);
138 gEve->AddElement(s, l);
141 gEve->EnableRedraw();
150 void tpc_digits_2drange(Int_t start, Int_t end)
152 if (start < 0) start = 0;
153 if (end > 35) end = 35;
155 if (g_tpc_data == 0 || g_tpc_last_event != gEvent) {
156 AliRunLoader* rl = AliEveEventManager::AssertRunLoader();
157 rl->LoadDigits("TPC");
158 TTree* dt = rl->GetTreeD("TPC", false);
160 g_tpc_data = new AliEveTPCData;
161 g_tpc_data->LoadDigits(dt, kTRUE); // Create all present sectors.
163 g_tpc_last_event = gEvent;
166 gStyle->SetPalette(1, 0);
169 gEve->DisableRedraw();
171 TEveElementList* l = new TEveElementList("TPC sectors");
172 l->SetMainColor(Color_t(col));
175 for(Int_t i=start; i<=end; i++) {
176 AliEveTPCSector2D* s = new AliEveTPCSector2D();
178 s->SetDataSource(g_tpc_data);
179 s->SetFrameColor(col);
180 s->SetAutoTrans(kTRUE);
181 gEve->AddElement(s, l);
184 gEve->EnableRedraw();