]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/alice-macros/tpc_digits.C
Coverity
[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 void tpc_digits(Int_t mode=1)
11 {
12   AliRunLoader* rl =  AliEveEventManager::AssertRunLoader();
13   rl->LoadDigits("TPC");
14   TTree* dt = rl->GetTreeD("TPC", false);
15   if (dt == 0)
16   {
17     throw TEveException("tpc_digits Can not access digits tree.");
18   }
19
20   AliEveTPCData *x = new AliEveTPCData;
21
22   x->LoadDigits(dt, kTRUE); // Create all present sectors.
23
24   gStyle->SetPalette(1, 0);
25   Color_t col = 36;
26
27   switch(mode) {
28
29   case 0: { // Display a single sector
30     AliEveTPCSector2D* s = new AliEveTPCSector2D();
31     s->SetFrameColor(col);
32     s->SetDataSource(x);
33     gEve->AddElement(s);
34     gEve->Redraw3D();
35
36     //TGLViewer* cam = gEve->GetDefaultGLViewer();
37     //cam->SetCurrentCamera(TGLViewer::kCameraOrthoXOY) ;
38     //cam->SetOrthoCamera(TGLViewer::kCameraOrthoXOY, 2*left, 2*right, 2*top, bottom);
39     //printf("%f %f %f %f\n", left, right, top, bottom);
40
41     break;
42   }
43
44   case 1: { // Display all sectors
45     gEve->DisableRedraw();
46     {
47       TEveElementList* l = new TEveElementList("TPC plate 1");
48       l->SetTitle("TPC Plate");
49       l->SetMainColor(col);
50       gEve->AddElement(l);
51
52       for (Int_t i = 0; i<18; i++)
53       {
54         AliEveTPCSector2D* s = new AliEveTPCSector2D(Form("AliEveTPCSector2D %d", i));
55         s->SetSectorID(i);
56         s->SetDataSource(x);
57         s->SetFrameColor(col);
58         s->SetAutoTrans(kTRUE);
59         l->AddElement(s);
60       }
61     }
62     {
63       TEveElementList* l = new TEveElementList("TPC plate 2");
64       l->SetTitle("TPC Plate");
65       l->SetMainColor(col);
66
67       gEve->AddElement(l);
68       for (Int_t i = 18; i<36; i++)
69       {
70         AliEveTPCSector2D* s = new AliEveTPCSector2D(Form("AliEveTPCSector2D %d", i));
71         s->SetSectorID(i);
72         s->SetDataSource(x);
73         s->SetFrameColor(col);
74         s->SetAutoTrans(kTRUE);
75         l->AddElement(s);
76       }
77     }
78     gEve->EnableRedraw();
79
80     break;
81   }
82
83   case 2 : { // Display a single sector in 3D
84     AliEveTPCSector3D* s = new AliEveTPCSector3D();
85     s->SetFrameColor(col);
86     s->SetDataSource(x);
87     gEve->AddElement(s);
88     gEve->Redraw3D();
89     break;
90   }
91
92   case 3: { // Display all sectors in 3D
93     gEve->DisableRedraw();
94     {
95       TEveElementList* l = new TEveElementList("TPC plate 1");
96       l->SetTitle("TPC Plate");
97       l->SetMainColor(col);
98       gEve->AddElement(l);
99
100       for (Int_t i = 0; i<18; i++)
101       {
102         AliEveTPCSector3D* s = new AliEveTPCSector3D(Form("AliEveTPCSector3D %d", i));
103         s->SetSectorID(i);
104         s->SetDataSource(x);
105         s->SetFrameColor(col);
106         s->SetAutoTrans(kTRUE);
107         l->AddElement(s);
108       }
109     }
110     {
111       TEveElementList* l = new TEveElementList("TPC plate 2");
112       l->SetTitle("TPC Plate");
113       l->SetMainColor(col);
114
115       gEve->AddElement(l);
116       for (Int_t i = 18; i<36; i++)
117       {
118         AliEveTPCSector3D* s = new AliEveTPCSector3D(Form("AliEveTPCSector3D %d", i));
119         s->SetSectorID(i);
120         s->SetDataSource(x);
121         s->SetFrameColor(col);
122         s->SetAutoTrans(kTRUE);
123         l->AddElement(s);
124       }
125     }
126     gEve->EnableRedraw();
127
128     break;
129   }
130
131   } // switch
132 }
133
134
135 void tpc_digits_2drange(Int_t start, Int_t end)
136 {
137   if (start <  0)  start = 0;
138   if (end   > 35)  end   = 35;
139
140   AliRunLoader* rl =  AliEveEventManager::AssertRunLoader();
141   rl->LoadDigits("TPC");
142   TTree* dt = rl->GetTreeD("TPC", false);
143   if (dt == 0)
144   {
145     throw TEveException("tpc_digits Can not access digits tree.");
146   }
147
148   AliEveTPCData *x = new AliEveTPCData;
149
150   x->LoadDigits(dt, kTRUE); // Create all present sectors.
151
152   gStyle->SetPalette(1, 0);
153   Color_t col = 36;
154
155   gEve->DisableRedraw();
156   {
157     TEveElementList* l = new TEveElementList("TPC sectors");
158     l->SetMainColor(col);
159     gEve->AddElement(l);
160
161     for (Int_t i=start; i<=end; i++)
162     {
163       AliEveTPCSector2D* s = new AliEveTPCSector2D();
164       s->SetSectorID(i);
165       s->SetDataSource(x);
166       s->SetFrameColor(col);
167       s->SetAutoTrans(kTRUE);
168       gEve->AddElement(s, l);
169     }
170   }
171   gEve->EnableRedraw();
172 }