]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/Alieve/TPCSector2D.cxx
a6d95c1a187337ab05a8d7965dbdf0d856b96bea
[u/mrichter/AliRoot.git] / EVE / Alieve / TPCSector2D.cxx
1 // $Header$
2
3 #include "TPCSector2D.h"
4
5 #include <Alieve/TPCData.h>
6 #include <Alieve/TPCSectorData.h>
7
8 #include <AliTPCParam.h>
9
10 #include <TBuffer3D.h>
11 #include <TBuffer3DTypes.h>
12 #include <TVirtualPad.h>
13 #include <TVirtualViewer3D.h>
14
15 using namespace Reve;
16 using namespace Alieve;
17 using namespace std;
18
19 //______________________________________________________________________
20 // TPCSector2D
21 //
22 // Displays TPC raw-data in 2D.
23 //
24 // fShowMax: true  - display maximum value for given time interval
25 //           false - display integral
26 // fAverage: only available when fShowMax = false; divide by time window width
27 //
28 // fUseTexture: use OpenGL textures to display data (fast rendering,
29 //   updates take the same time)
30 //
31
32 ClassImp(TPCSector2D)
33
34 /**************************************************************************/
35
36 TPCSector2D::TPCSector2D(const Text_t* n, const Text_t* t) :
37   TPCSectorViz(n,t),
38
39   fShowMax (kTRUE),
40   fAverage (kFALSE),
41
42   fUseTexture (kTRUE)
43 {}
44
45 TPCSector2D::~TPCSector2D()
46 {}
47
48 /**************************************************************************/
49
50 void TPCSector2D::ComputeBBox()
51 {
52   const TPCSectorData::SegmentInfo&  iSeg = TPCSectorData::GetInnSeg();
53   const TPCSectorData::SegmentInfo& o2Seg = TPCSectorData::GetOut2Seg();
54
55   bbox_init();
56   Float_t w = o2Seg.GetNMaxPads()*o2Seg.GetPadWidth()/2;
57   fBBox[0] = -w;
58   fBBox[1] =  w;
59   fBBox[2] =  iSeg.GetRLow();
60   fBBox[3] =  o2Seg.GetRLow() + o2Seg.GetNRows()*o2Seg.GetPadHeight();
61   fBBox[4] = -0.5; // Fake z-width to 1 cm.
62   fBBox[5] =  0.5;
63 }
64
65 /**************************************************************************/
66
67 void TPCSector2D::Paint(Option_t* )
68 {
69   if(fRnrElement == kFALSE)
70     return;
71
72   TBuffer3D buffer(TBuffer3DTypes::kGeneric);
73
74   // Section kCore
75   buffer.fID           = this;
76   buffer.fColor        = 1;
77   buffer.fTransparency = 0;
78   buffer.fLocalFrame   = fTrans; 
79   if (fTrans)
80     memcpy(buffer.fLocalMaster, fMatrix, 16*sizeof(Double_t));
81   buffer.SetSectionsValid(TBuffer3D::kCore);
82    
83   Int_t reqSections = gPad->GetViewer3D()->AddObject(buffer);
84   if (reqSections == TBuffer3D::kNone) {
85     // printf("TPCSector2D::Paint viewer was happy with Core buff3d.\n");
86     return;
87   }
88
89   printf("TPCSector2D::Paint only GL supported.\n");
90   return;
91
92   /*
93     if (reqSections & TBuffer3D::kRawSizes) {
94     Int_t nbPnts = fQuads.size()*4;
95     Int_t nbSegs = nbPnts;
96     if (!buffer.SetRawSizes(nbPnts, 3*nbPnts, nbSegs, 3*nbSegs, fQuads.size(), fQuads.size()*6)) {
97     return;
98     }
99     buffer.SetSectionsValid(TBuffer3D::kRawSizes); 
100     }
101
102     if ((reqSections & TBuffer3D::kRaw) && buffer.SectionsValid(TBuffer3D::kRawSizes)) {
103     // Points
104     Int_t pidx = 0;
105     for (std::vector<Quad>::iterator i=fQuads.begin(); i!=fQuads.end(); ++i) {
106     for (Int_t k = 0; k < 12; k++ ){
107     buffer.fPnts[pidx] = (*i).vertices[k]; 
108     pidx++;
109     }
110     }
111
112     // Segments
113     Int_t sidx = 0;
114     for (Int_t q = 0; q < fQuads.size(); ++q) {
115     for (Int_t s = 0; s < 4; ++s ) {
116     buffer.fSegs[3*sidx ] = 4; 
117     buffer.fSegs[3*sidx+1] = sidx;
118     if (s == 3)
119     buffer.fSegs[3*sidx+2] = q*4;
120     else
121     buffer.fSegs[3*sidx+2] = sidx + 1;
122     sidx ++;
123     }
124     }
125
126     // Polygons
127     for (Int_t q = 0; q < fQuads.size(); ++q) {
128     buffer.fPols[6*q] = fQuads[q].color;   
129     buffer.fPols[6*q +1] = 4;
130     buffer.fPols[6*q +2] = 4*q +0;
131     buffer.fPols[6*q +3] = 4*q +1;
132     buffer.fPols[6*q +4] = 4*q +2;
133     buffer.fPols[6*q +5] = 4*q +3;
134     }
135
136     buffer.SetSectionsValid(TBuffer3D::kRaw);
137     buffer.fColor = 5;
138     }
139    
140   */
141   // gPad->GetViewer3D()->AddObject(buffer);
142 }