This commit was generated by cvs2svn to compensate for changes in r13732,
[u/mrichter/AliRoot.git] / EVE / alice-macros / tpc_digits.C
1 // $Id$
2
3 #include "TGLViewer.h"
4
5 void tpc_digits(Int_t mode = 0)
6 {
7   AliRunLoader* rl =  Alieve::Event::AssertRunLoader();
8   rl->LoadDigits("TPC");
9   TTree* dt = rl->GetTreeD("TPC", false);
10
11   rl->CdGAFile();
12   AliTPCParam* tpcpar = gDirectory->Get("75x40_100x60_150x60");
13
14   Alieve::TPCDigitsInfo* di = new Alieve::TPCDigitsInfo();
15   di->SetData(tpcpar, dt);
16   // di->Dump();
17
18   // Viewport limits.
19   Float_t left, right, top, bottom;
20   right  = di->fOut2Seg.fNMaxPads* di->fOut2Seg.fPadWidth;
21   left   = -right;
22   bottom = di->fInnSeg.fRlow;
23   top    = bottom + di->fOut2Seg.fRlow +
24     di->fOut2Seg.fNRows*di->fOut2Seg.fPadLength - di->fInnSeg.fRlow;
25
26   gStyle->SetPalette(1, 0);
27   UInt_t col = 36;
28
29   if(mode == 0) {
30     // create an object, so the camera will not jump
31    
32     gReve->DisableRedraw();
33     Reve::RenderElementList* l = new Reve::RenderElementList("TPC");
34     l->SetTitle("TPC Segment");
35     l->SetMainColor(Color_t(col));
36     TGListTreeItem *ti = gReve->AddRenderElement(l);
37   
38     Int_t i = 0;
39     //  for(Int_t i = 0; i<7; i++) {
40     Alieve::TPCSegment* s = new Alieve::TPCSegment();
41     s->SetSegmentID(i);
42     s->SetInfo(di);
43     s->SetMainColor(Color_t(col));
44     l->AddElement(s);
45     gReve->AddRenderElement(ti, s);
46     //  }
47     gReve->DrawRenderElement(l);
48
49
50     /*
51     TPolyMarker3D* framebox = new TPolyMarker3D(8);
52     const Float_t a = 250.0;
53     framebox->SetPoint(0, a, a,a);
54     framebox->SetPoint(1, a, -a,a);
55     framebox->SetPoint(2, -a, -a,a);
56     framebox->SetPoint(3, -a, a,a);
57
58     framebox->SetPoint(4, a, a,-a);
59     framebox->SetPoint(5, a, -a,-a);
60     framebox->SetPoint(6, -a, a,-a);
61     framebox->SetPoint(7, -a, -a,-a);
62
63     framebox->Draw();
64     */
65
66     gReve->EnableRedraw();
67
68     TGLViewer* cam = dynamic_cast<TGLViewer*>(gReve->GetCC()->GetViewer3D());
69     //cam->SetCurrentCamera(TGLViewer::kCameraOrthoXOY) ;
70     //cam->SetOrthoCamera(TGLViewer::kCameraOrthoXOY, 2*left, 2*right, 2*top, bottom); 
71     //printf("%f %f %f %f\n", left, right, top, bottom);
72
73   } else {
74
75     gReve->DisableRedraw();
76     {
77       Reve::RenderElementList* l = new Reve::RenderElementList("TPC plate 1");
78       l->SetTitle("TPC Plate");
79       l->SetMainColor(Color_t(col));
80       TGListTreeItem *ti = gReve->AddRenderElement(l);
81       
82       for(Int_t i = 0; i<18; i++) {
83         Alieve::TPCSegment* s = new Alieve::TPCSegment();
84         s->SetSegmentID(i);
85         s->SetInfo(di);
86         s->SetMainColor(Color_t(col));
87         s->SetTrans(true);
88         l->AddElement(s);
89         gReve->AddRenderElement(ti, s);
90       }
91       gReve->DrawRenderElement(l);
92     }
93     {
94       Reve::RenderElementList* l = new Reve::RenderElementList("TPC plate 2");
95       l->SetTitle("TPC Plate");
96       l->SetMainColor(Color_t(col));
97
98       TGListTreeItem *ti = gReve->AddRenderElement(l);
99       for(Int_t i = 18; i<36; i++) {
100         Alieve::TPCSegment* s = new Alieve::TPCSegment();
101         s->SetSegmentID(i);
102         s->SetMainColor(Color_t(col));
103         s->SetInfo(di);
104         s->SetTrans(true);
105         l->AddElement(s);
106         gReve->AddRenderElement(ti, s);
107       }
108       gReve->DrawRenderElement(l);
109     }
110     gReve->EnableRedraw();
111   }
112 }