]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVE/Alieve/TPCSector2D.cxx
Merge from EVE-dev to HEAD.
[u/mrichter/AliRoot.git] / EVE / Alieve / TPCSector2D.cxx
CommitLineData
b56d8877 1// $Header$
2
915dabe1 3#include "TPCSector2D.h"
5a5a1232 4
915dabe1 5#include <Alieve/TPCData.h>
6#include <Alieve/TPCSectorData.h>
7
8#include <AliTPCParam.h>
5a5a1232 9
092578a7 10#include <TBuffer3D.h>
11#include <TBuffer3DTypes.h>
12#include <TVirtualPad.h>
13#include <TVirtualViewer3D.h>
14
5a5a1232 15using namespace Reve;
16using namespace Alieve;
17using namespace std;
18
092578a7 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
2aef44c1 32ClassImp(TPCSector2D)
5a5a1232 33
34/**************************************************************************/
35
092578a7 36TPCSector2D::TPCSector2D(const Text_t* n, const Text_t* t) :
37 TPCSectorViz(n,t),
b56d8877 38
092578a7 39 fShowMax (kTRUE),
40 fAverage (kFALSE),
915dabe1 41
a8600b56 42 fUseTexture (kTRUE),
43 fPickEmpty (kFALSE),
44 fPickMode (0)
092578a7 45{}
5a5a1232 46
915dabe1 47TPCSector2D::~TPCSector2D()
092578a7 48{}
5a5a1232 49
50/**************************************************************************/
51
915dabe1 52void TPCSector2D::ComputeBBox()
5a5a1232 53{
915dabe1 54 const TPCSectorData::SegmentInfo& iSeg = TPCSectorData::GetInnSeg();
55 const TPCSectorData::SegmentInfo& o2Seg = TPCSectorData::GetOut2Seg();
5a5a1232 56
606c4ed7 57#if ROOT_VERSION_CODE <= ROOT_VERSION(5,11,2)
5a5a1232 58 bbox_init();
606c4ed7 59#else
60 BBoxInit();
61#endif
915dabe1 62 Float_t w = o2Seg.GetNMaxPads()*o2Seg.GetPadWidth()/2;
63 fBBox[0] = -w;
64 fBBox[1] = w;
65 fBBox[2] = iSeg.GetRLow();
66 fBBox[3] = o2Seg.GetRLow() + o2Seg.GetNRows()*o2Seg.GetPadHeight();
67 fBBox[4] = -0.5; // Fake z-width to 1 cm.
68 fBBox[5] = 0.5;
5a5a1232 69}
70
71/**************************************************************************/
72
915dabe1 73void TPCSector2D::Paint(Option_t* )
5a5a1232 74{
092578a7 75 if(fRnrElement == kFALSE)
76 return;
77
5a5a1232 78 TBuffer3D buffer(TBuffer3DTypes::kGeneric);
79
80 // Section kCore
81 buffer.fID = this;
82 buffer.fColor = 1;
83 buffer.fTransparency = 0;
84 buffer.fLocalFrame = fTrans;
5a5a1232 85 if (fTrans)
86 memcpy(buffer.fLocalMaster, fMatrix, 16*sizeof(Double_t));
87 buffer.SetSectionsValid(TBuffer3D::kCore);
88
5a5a1232 89 Int_t reqSections = gPad->GetViewer3D()->AddObject(buffer);
90 if (reqSections == TBuffer3D::kNone) {
915dabe1 91 // printf("TPCSector2D::Paint viewer was happy with Core buff3d.\n");
5a5a1232 92 return;
93 }
915dabe1 94
95 printf("TPCSector2D::Paint only GL supported.\n");
5a5a1232 96 return;
915dabe1 97
5a5a1232 98 /*
99 if (reqSections & TBuffer3D::kRawSizes) {
100 Int_t nbPnts = fQuads.size()*4;
101 Int_t nbSegs = nbPnts;
102 if (!buffer.SetRawSizes(nbPnts, 3*nbPnts, nbSegs, 3*nbSegs, fQuads.size(), fQuads.size()*6)) {
103 return;
104 }
105 buffer.SetSectionsValid(TBuffer3D::kRawSizes);
106 }
107
108 if ((reqSections & TBuffer3D::kRaw) && buffer.SectionsValid(TBuffer3D::kRawSizes)) {
109 // Points
110 Int_t pidx = 0;
111 for (std::vector<Quad>::iterator i=fQuads.begin(); i!=fQuads.end(); ++i) {
112 for (Int_t k = 0; k < 12; k++ ){
113 buffer.fPnts[pidx] = (*i).vertices[k];
114 pidx++;
115 }
116 }
117
118 // Segments
119 Int_t sidx = 0;
120 for (Int_t q = 0; q < fQuads.size(); ++q) {
121 for (Int_t s = 0; s < 4; ++s ) {
122 buffer.fSegs[3*sidx ] = 4;
123 buffer.fSegs[3*sidx+1] = sidx;
124 if (s == 3)
125 buffer.fSegs[3*sidx+2] = q*4;
126 else
127 buffer.fSegs[3*sidx+2] = sidx + 1;
128 sidx ++;
129 }
130 }
131
132 // Polygons
133 for (Int_t q = 0; q < fQuads.size(); ++q) {
134 buffer.fPols[6*q] = fQuads[q].color;
135 buffer.fPols[6*q +1] = 4;
136 buffer.fPols[6*q +2] = 4*q +0;
137 buffer.fPols[6*q +3] = 4*q +1;
138 buffer.fPols[6*q +4] = 4*q +2;
139 buffer.fPols[6*q +5] = 4*q +3;
140 }
141
142 buffer.SetSectionsValid(TBuffer3D::kRaw);
143 buffer.fColor = 5;
144 }
145
146 */
147 // gPad->GetViewer3D()->AddObject(buffer);
148}