3 #include "TPCSector3DGL.h"
4 #include <Alieve/TPCSector3D.h>
6 #include <Reve/BoxSetGL.h>
8 #include <TGLDrawFlags.h>
11 #include "Windows4root.h"
17 using namespace Alieve;
19 //______________________________________________________________________
23 ClassImp(TPCSector3DGL)
25 TPCSector3DGL::TPCSector3DGL() : fSector(0), fBoxRnr(0)
27 // fCached = false; // Disable display list.
31 TPCSector3DGL::~TPCSector3DGL()
36 /**************************************************************************/
38 Bool_t TPCSector3DGL::SetModel(TObject* obj)
40 #if ROOT_VERSION_CODE <= ROOT_VERSION(5,11,2)
41 if(set_model(obj, "Alieve::TPCSector3D")) {
42 #elif ROOT_VERSION_CODE <= ROOT_VERSION(5,13,0)
43 if(SetModelCheckClass(obj, "Alieve::TPCSector3D")) {
45 if(SetModelCheckClass(obj, Alieve::TPCSector3D::Class())) {
47 fSector = (TPCSector3D*) fExternalObj;
49 fBoxRnr = new BoxSetGL;
50 fBoxRnr->SetModel(&fSector->fBoxSet);
57 void TPCSector3DGL::SetBBox()
59 #if ROOT_VERSION_CODE <= ROOT_VERSION(5,11,2)
60 set_axis_aligned_bbox(((TPCSector3D*)fExternalObj)->AssertBBox());
62 SetAxisAlignedBBox(((TPCSector3D*)fExternalObj)->AssertBBox());
66 /**************************************************************************/
68 void TPCSector3DGL::DirectDraw(const TGLDrawFlags & flags) const
70 // printf("TPCSector3DGL::DirectDraw Style %d, LOD %d\n", flags.Style(), flags.LOD());
72 if(fRTS < fSector->fRTS) {
73 fSector->UpdateBoxes();
77 Bool_t hasData = (fSector->GetSectorData() != 0);
80 fBoxRnr->Render(flags);
82 glPushAttrib(GL_CURRENT_BIT | GL_POINT_BIT | GL_ENABLE_BIT);
83 glDisable(GL_LIGHTING);
86 if(hasData && fSector->fPointSetOn) {
88 glEnable(GL_POINT_SMOOTH);
89 glPointSize(fSector->fPointSize);
91 glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT);
92 glEnableClientState(GL_VERTEX_ARRAY);
94 const Reve::PointSetArray& psa = fSector->fPointSetArray;
95 for(Int_t b=0; b<psa.GetNBins(); ++b) {
96 Reve::PointSet* ps = psa.GetBin(b);
98 ColorFromIdx(ps->GetMarkerColor(), col);
101 glVertexPointer(3, GL_FLOAT, 0, ps->GetP());
102 glDrawArrays(GL_POINTS, 0, ps->Size());
109 if(fSector->fRnrFrame) {
110 ColorFromIdx(fSector->fFrameColor, col);
114 DrawSegmentFrame(TPCSectorData::GetInnSeg(), 0, 2);
115 if(fSector->fRnrOut1)
116 DrawSegmentFrame(TPCSectorData::GetOut1Seg(), 2, 1);
117 if(fSector->fRnrOut2)
118 DrawSegmentFrame(TPCSectorData::GetOut2Seg(), 2, 2);
124 void TPCSector3DGL::DrawSegmentFrame(const TPCSectorData::SegmentInfo& s,
125 Int_t botExtraPads, Int_t topExtraPads) const
127 Float_t xl, xh, yl, yh, zl, zh;
128 xl = 0.5*s.GetPadWidth()*(TPCSectorData::GetNPadsInRow(s.GetFirstRow()) + botExtraPads);
129 xh = 0.5*s.GetPadWidth()*(TPCSectorData::GetNPadsInRow(s.GetLastRow()) + topExtraPads);
131 yh = yl + s.GetNRows()*s.GetPadHeight();
133 zh = TPCSectorData::GetZLength();
135 glBegin(GL_LINE_LOOP);
136 glVertex3f( xl, yl, zl); glVertex3f( xh, yh, zl);
137 glVertex3f(-xh, yh, zl); glVertex3f(-xl, yl, zl);
139 glBegin(GL_LINE_LOOP);
140 glVertex3f( xl, yl, zh); glVertex3f( xh, yh, zh);
141 glVertex3f(-xh, yh, zh); glVertex3f(-xl, yl, zh);
144 glVertex3f( xl, yl, zl); glVertex3f( xl, yl, zh);
145 glVertex3f( xh, yh, zl); glVertex3f( xh, yh, zh);
146 glVertex3f(-xh, yh, zl); glVertex3f(-xh, yh, zh);
147 glVertex3f(-xl, yl, zl); glVertex3f(-xl, yl, zh);