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