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 **************************************************************************/
11 class AliEveEventManager;
13 AliEveTPCData *g_tpc_data = 0;
14 AliEveEventManager *g_tpc_last_event = 0;
16 void tpc_digits(Int_t mode=1)
18 if (g_tpc_data == 0 || g_tpc_last_event != gAliEveEvent)
20 AliRunLoader* rl = AliEveEventManager::AssertRunLoader();
21 rl->LoadDigits("TPC");
22 TTree* dt = rl->GetTreeD("TPC", false);
24 g_tpc_data = new AliEveTPCData;
25 g_tpc_data->LoadDigits(dt, kTRUE); // Create all present sectors.
27 g_tpc_last_event = gAliEveEvent;
32 Float_t left, right, top, bottom;
33 right = di->fOut2Seg.fNMaxPads* di->fOut2Seg.fPadWidth;
35 bottom = di->fInnSeg.fRlow;
36 top = bottom + di->fOut2Seg.fRlow +
37 di->fOut2Seg.fNRows*di->fOut2Seg.fPadLength - di->fInnSeg.fRlow;
40 gStyle->SetPalette(1, 0);
45 case 0: { // Display a single sector
46 AliEveTPCSector2D* s = new AliEveTPCSector2D();
47 s->SetFrameColor(col);
48 s->SetDataSource(g_tpc_data);
52 //TGLViewer* cam = gEve->GetGLViewer();
53 //cam->SetCurrentCamera(TGLViewer::kCameraOrthoXOY) ;
54 //cam->SetOrthoCamera(TGLViewer::kCameraOrthoXOY, 2*left, 2*right, 2*top, bottom);
55 //printf("%f %f %f %f\n", left, right, top, bottom);
60 case 1: { // Display all sectors
61 gEve->DisableRedraw();
63 TEveElementList* l = new TEveElementList("TPC plate 1");
64 l->SetTitle("TPC Plate");
68 for (Int_t i = 0; i<18; i++)
70 AliEveTPCSector2D* s = new AliEveTPCSector2D(Form("AliEveTPCSector2D %d", i));
72 s->SetDataSource(g_tpc_data);
73 s->SetFrameColor(col);
74 s->SetAutoTrans(kTRUE);
75 gEve->AddElement(s, l);
79 TEveElementList* l = new TEveElementList("TPC plate 2");
80 l->SetTitle("TPC Plate");
84 for (Int_t i = 18; i<36; i++)
86 AliEveTPCSector2D* s = new AliEveTPCSector2D(Form("AliEveTPCSector2D %d", i));
88 s->SetDataSource(g_tpc_data);
89 s->SetFrameColor(col);
90 s->SetAutoTrans(kTRUE);
91 gEve->AddElement(s, l);
99 case 2 : { // Display a single sector in 3D
100 AliEveTPCSector3D* s = new AliEveTPCSector3D();
101 s->SetFrameColor(col);
102 s->SetDataSource(g_tpc_data);
108 case 3: { // Display all sectors in 3D
109 gEve->DisableRedraw();
111 TEveElementList* l = new TEveElementList("TPC plate 1");
112 l->SetTitle("TPC Plate");
113 l->SetMainColor(col);
116 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(col);
132 for (Int_t i = 18; i<36; i++)
134 AliEveTPCSector3D* s = new AliEveTPCSector3D(Form("AliEveTPCSector3D %d", i));
136 s->SetDataSource(g_tpc_data);
137 s->SetFrameColor(col);
138 s->SetAutoTrans(kTRUE);
139 gEve->AddElement(s, l);
142 gEve->EnableRedraw();
151 void tpc_digits_2drange(Int_t start, Int_t end)
153 if (start < 0) start = 0;
154 if (end > 35) end = 35;
156 if (g_tpc_data == 0 || g_tpc_last_event != gAliEveEvent) {
157 AliRunLoader* rl = AliEveEventManager::AssertRunLoader();
158 rl->LoadDigits("TPC");
159 TTree* dt = rl->GetTreeD("TPC", false);
161 g_tpc_data = new AliEveTPCData;
162 g_tpc_data->LoadDigits(dt, kTRUE); // Create all present sectors.
164 g_tpc_last_event = gAliEveEvent;
167 gStyle->SetPalette(1, 0);
170 gEve->DisableRedraw();
172 TEveElementList* l = new TEveElementList("TPC sectors");
173 l->SetMainColor(col);
176 for (Int_t i=start; i<=end; i++)
178 AliEveTPCSector2D* s = new AliEveTPCSector2D();
180 s->SetDataSource(g_tpc_data);
181 s->SetFrameColor(col);
182 s->SetAutoTrans(kTRUE);
183 gEve->AddElement(s, l);
186 gEve->EnableRedraw();