3 #include "TPCSector2D.h"
5 #include <Alieve/TPCData.h>
6 #include <Alieve/TPCSectorData.h>
8 #include <AliTPCParam.h>
10 #include <TBuffer3D.h>
11 #include <TBuffer3DTypes.h>
12 #include <TVirtualPad.h>
13 #include <TVirtualViewer3D.h>
16 using namespace Alieve;
19 //______________________________________________________________________
22 // Displays TPC raw-data in 2D.
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
28 // fUseTexture: use OpenGL textures to display data (fast rendering,
29 // updates take the same time)
34 /**************************************************************************/
36 TPCSector2D::TPCSector2D(const Text_t* n, const Text_t* t) :
45 TPCSector2D::~TPCSector2D()
48 /**************************************************************************/
50 void TPCSector2D::ComputeBBox()
52 const TPCSectorData::SegmentInfo& iSeg = TPCSectorData::GetInnSeg();
53 const TPCSectorData::SegmentInfo& o2Seg = TPCSectorData::GetOut2Seg();
55 #if ROOT_VERSION_CODE <= ROOT_VERSION(5,11,2)
60 Float_t w = o2Seg.GetNMaxPads()*o2Seg.GetPadWidth()/2;
63 fBBox[2] = iSeg.GetRLow();
64 fBBox[3] = o2Seg.GetRLow() + o2Seg.GetNRows()*o2Seg.GetPadHeight();
65 fBBox[4] = -0.5; // Fake z-width to 1 cm.
69 /**************************************************************************/
71 void TPCSector2D::Paint(Option_t* )
73 if(fRnrElement == kFALSE)
76 TBuffer3D buffer(TBuffer3DTypes::kGeneric);
81 buffer.fTransparency = 0;
82 buffer.fLocalFrame = fTrans;
84 memcpy(buffer.fLocalMaster, fMatrix, 16*sizeof(Double_t));
85 buffer.SetSectionsValid(TBuffer3D::kCore);
87 Int_t reqSections = gPad->GetViewer3D()->AddObject(buffer);
88 if (reqSections == TBuffer3D::kNone) {
89 // printf("TPCSector2D::Paint viewer was happy with Core buff3d.\n");
93 printf("TPCSector2D::Paint only GL supported.\n");
97 if (reqSections & TBuffer3D::kRawSizes) {
98 Int_t nbPnts = fQuads.size()*4;
99 Int_t nbSegs = nbPnts;
100 if (!buffer.SetRawSizes(nbPnts, 3*nbPnts, nbSegs, 3*nbSegs, fQuads.size(), fQuads.size()*6)) {
103 buffer.SetSectionsValid(TBuffer3D::kRawSizes);
106 if ((reqSections & TBuffer3D::kRaw) && buffer.SectionsValid(TBuffer3D::kRawSizes)) {
109 for (std::vector<Quad>::iterator i=fQuads.begin(); i!=fQuads.end(); ++i) {
110 for (Int_t k = 0; k < 12; k++ ){
111 buffer.fPnts[pidx] = (*i).vertices[k];
118 for (Int_t q = 0; q < fQuads.size(); ++q) {
119 for (Int_t s = 0; s < 4; ++s ) {
120 buffer.fSegs[3*sidx ] = 4;
121 buffer.fSegs[3*sidx+1] = sidx;
123 buffer.fSegs[3*sidx+2] = q*4;
125 buffer.fSegs[3*sidx+2] = sidx + 1;
131 for (Int_t q = 0; q < fQuads.size(); ++q) {
132 buffer.fPols[6*q] = fQuads[q].color;
133 buffer.fPols[6*q +1] = 4;
134 buffer.fPols[6*q +2] = 4*q +0;
135 buffer.fPols[6*q +3] = 4*q +1;
136 buffer.fPols[6*q +4] = 4*q +2;
137 buffer.fPols[6*q +5] = 4*q +3;
140 buffer.SetSectionsValid(TBuffer3D::kRaw);
145 // gPad->GetViewer3D()->AddObject(buffer);