]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/alice-macros/tpc_digits.C
Fix aclic compilation.
[u/mrichter/AliRoot.git] / EVE / alice-macros / tpc_digits.C
1 // $Id$
2 // Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
3
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  **************************************************************************/
9
10 class AliEveTPCData;
11 class AliEveEventManager;
12
13 AliEveTPCData      *g_tpc_data       = 0;
14 AliEveEventManager *g_tpc_last_event = 0;
15
16 void tpc_digits(Int_t mode=1)
17 {
18   if (g_tpc_data == 0 || g_tpc_last_event != gEvent)
19   {
20     AliRunLoader* rl =  AliEveEventManager::AssertRunLoader();
21     rl->LoadDigits("TPC");
22     TTree* dt = rl->GetTreeD("TPC", false);
23
24     g_tpc_data = new AliEveTPCData;
25     g_tpc_data->LoadDigits(dt, kTRUE); // Create all present sectors.
26
27     g_tpc_last_event = gEvent;
28   }
29
30   // Viewport limits.
31   /*
32   Float_t left, right, top, bottom;
33   right  = di->fOut2Seg.fNMaxPads* di->fOut2Seg.fPadWidth;
34   left   = -right;
35   bottom = di->fInnSeg.fRlow;
36   top    = bottom + di->fOut2Seg.fRlow +
37     di->fOut2Seg.fNRows*di->fOut2Seg.fPadLength - di->fInnSeg.fRlow;
38   */
39
40   gStyle->SetPalette(1, 0);
41   Color_t col = 36;
42
43   switch(mode) {
44
45   case 0: { // Display a single sector
46     AliEveTPCSector2D* s = new AliEveTPCSector2D();
47     s->SetFrameColor(col);
48     s->SetDataSource(g_tpc_data);
49     gEve->AddElement(s);
50     gEve->Redraw3D();
51
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);
56
57     break;
58   }
59
60   case 1: { // Display all sectors
61     gEve->DisableRedraw();
62     {
63       TEveElementList* l = new TEveElementList("TPC plate 1");
64       l->SetTitle("TPC Plate");
65       l->SetMainColor(Color_t(col));
66       gEve->AddElement(l);
67
68       for (Int_t i = 0; i<18; i++)
69       {
70         AliEveTPCSector2D* s = new AliEveTPCSector2D(Form("AliEveTPCSector2D %d", i));
71         s->SetSectorID(i);
72         s->SetDataSource(g_tpc_data);
73         s->SetFrameColor(col);
74         s->SetAutoTrans(kTRUE);
75         gEve->AddElement(s, l);
76       }
77     }
78     {
79       TEveElementList* l = new TEveElementList("TPC plate 2");
80       l->SetTitle("TPC Plate");
81       l->SetMainColor(Color_t(col));
82
83       gEve->AddElement(l);
84       for (Int_t i = 18; i<36; i++)
85       {
86         AliEveTPCSector2D* s = new AliEveTPCSector2D(Form("AliEveTPCSector2D %d", i));
87         s->SetSectorID(i);
88         s->SetDataSource(g_tpc_data);
89         s->SetFrameColor(col);
90         s->SetAutoTrans(kTRUE);
91         gEve->AddElement(s, l);
92       }
93     }
94     gEve->EnableRedraw();
95
96     break;
97   }
98
99   case 2 : { // Display a single sector in 3D
100     AliEveTPCSector3D* s = new AliEveTPCSector3D();
101     s->SetFrameColor(col);
102     s->SetDataSource(g_tpc_data);
103     gEve->AddElement(s);
104     gEve->Redraw3D();
105     break;
106   }
107
108   case 3: { // Display all sectors in 3D
109     gEve->DisableRedraw();
110     {
111       TEveElementList* l = new TEveElementList("TPC plate 1");
112       l->SetTitle("TPC Plate");
113       l->SetMainColor(Color_t(col));
114       gEve->AddElement(l);
115
116       for (Int_t i = 0; i<18; i++)
117       {
118         AliEveTPCSector3D* s = new AliEveTPCSector3D(Form("AliEveTPCSector3D %d", i));
119         s->SetSectorID(i);
120         s->SetDataSource(g_tpc_data);
121         s->SetFrameColor(col);
122         s->SetAutoTrans(kTRUE);
123         gEve->AddElement(s, l);
124       }
125     }
126     {
127       TEveElementList* l = new TEveElementList("TPC plate 2");
128       l->SetTitle("TPC Plate");
129       l->SetMainColor(Color_t(col));
130
131       gEve->AddElement(l);
132       for (Int_t i = 18; i<36; i++)
133       {
134         AliEveTPCSector3D* s = new AliEveTPCSector3D(Form("AliEveTPCSector3D %d", i));
135         s->SetSectorID(i);
136         s->SetDataSource(g_tpc_data);
137         s->SetFrameColor(col);
138         s->SetAutoTrans(kTRUE);
139         gEve->AddElement(s, l);
140       }
141     }
142     gEve->EnableRedraw();
143
144     break;
145   }
146
147   } // switch
148 }
149
150
151 void tpc_digits_2drange(Int_t start, Int_t end)
152 {
153   if (start <  0)  start = 0;
154   if (end   > 35)  end   = 35;
155
156   if (g_tpc_data == 0 || g_tpc_last_event != gEvent) {
157     AliRunLoader* rl =  AliEveEventManager::AssertRunLoader();
158     rl->LoadDigits("TPC");
159     TTree* dt = rl->GetTreeD("TPC", false);
160
161     g_tpc_data = new AliEveTPCData;
162     g_tpc_data->LoadDigits(dt, kTRUE); // Create all present sectors.
163
164     g_tpc_last_event = gEvent;
165   }
166
167   gStyle->SetPalette(1, 0);
168   Color_t col = 36;
169
170   gEve->DisableRedraw();
171   {
172     TEveElementList* l = new TEveElementList("TPC sectors");
173     l->SetMainColor(Color_t(col));
174     gEve->AddElement(l);
175
176     for (Int_t i=start; i<=end; i++)
177     {
178       AliEveTPCSector2D* s = new AliEveTPCSector2D();
179       s->SetSectorID(i);
180       s->SetDataSource(g_tpc_data);
181       s->SetFrameColor(col);
182       s->SetAutoTrans(kTRUE);
183       gEve->AddElement(s, l);
184     }
185   }
186   gEve->EnableRedraw();
187 }