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() :
27 fSector(0), fBoxRnr(0),
30 // fCached = false; // Disable display list.
33 TPCSector3DGL::~TPCSector3DGL()
38 /**************************************************************************/
40 Bool_t TPCSector3DGL::SetModel(TObject* obj)
42 #if ROOT_VERSION_CODE <= ROOT_VERSION(5,11,2)
43 if(set_model(obj, "Alieve::TPCSector3D")) {
44 #elif ROOT_VERSION_CODE <= ROOT_VERSION(5,13,0)
45 if(SetModelCheckClass(obj, "Alieve::TPCSector3D")) {
47 if(SetModelCheckClass(obj, Alieve::TPCSector3D::Class())) {
49 fSector = (TPCSector3D*) fExternalObj;
51 fBoxRnr = new BoxSetGL;
52 fBoxRnr->SetModel(&fSector->fBoxSet);
59 void TPCSector3DGL::SetBBox()
61 #if ROOT_VERSION_CODE <= ROOT_VERSION(5,11,2)
62 set_axis_aligned_bbox(((TPCSector3D*)fExternalObj)->AssertBBox());
64 SetAxisAlignedBBox(((TPCSector3D*)fExternalObj)->AssertBBox());
68 /**************************************************************************/
70 void TPCSector3DGL::DirectDraw(const TGLDrawFlags & flags) const
72 // printf("TPCSector3DGL::DirectDraw Style %d, LOD %d\n", flags.Style(), flags.LOD());
74 if(fRTS < fSector->fRTS) {
75 fSector->UpdateBoxes();
79 Bool_t hasData = (fSector->GetSectorData() != 0);
82 fBoxRnr->Render(flags);
84 glPushAttrib(GL_CURRENT_BIT | GL_POINT_BIT | GL_ENABLE_BIT);
85 glDisable(GL_LIGHTING);
88 if(hasData && fSector->fPointSetOn) {
90 glEnable(GL_POINT_SMOOTH);
91 glPointSize(fSector->fPointSize);
93 glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT);
94 glEnableClientState(GL_VERTEX_ARRAY);
96 const Reve::PointSetArray& psa = fSector->fPointSetArray;
97 for(Int_t b=0; b<psa.GetNBins(); ++b) {
98 Reve::PointSet* ps = psa.GetBin(b);
100 ColorFromIdx(ps->GetMarkerColor(), col);
103 glVertexPointer(3, GL_FLOAT, 0, ps->GetP());
104 glDrawArrays(GL_POINTS, 0, ps->Size());
111 if(fSector->fRnrFrame) {
112 ColorFromIdx(fSector->fFrameColor, col);
116 DrawSegmentFrame(TPCSectorData::GetInnSeg(), 0, 2);
117 if(fSector->fRnrOut1)
118 DrawSegmentFrame(TPCSectorData::GetOut1Seg(), 2, 1);
119 if(fSector->fRnrOut2)
120 DrawSegmentFrame(TPCSectorData::GetOut2Seg(), 2, 2);
126 void TPCSector3DGL::DrawSegmentFrame(const TPCSectorData::SegmentInfo& s,
127 Int_t botExtraPads, Int_t topExtraPads) const
129 Float_t xl, xh, yl, yh, zl, zh;
130 xl = 0.5*s.GetPadWidth()*(TPCSectorData::GetNPadsInRow(s.GetFirstRow()) + botExtraPads);
131 xh = 0.5*s.GetPadWidth()*(TPCSectorData::GetNPadsInRow(s.GetLastRow()) + topExtraPads);
133 yh = yl + s.GetNRows()*s.GetPadHeight();
135 zh = TPCSectorData::GetZLength();
137 glBegin(GL_LINE_LOOP);
138 glVertex3f( xl, yl, zl); glVertex3f( xh, yh, zl);
139 glVertex3f(-xh, yh, zl); glVertex3f(-xl, yl, zl);
141 glBegin(GL_LINE_LOOP);
142 glVertex3f( xl, yl, zh); glVertex3f( xh, yh, zh);
143 glVertex3f(-xh, yh, zh); glVertex3f(-xl, yl, zh);
146 glVertex3f( xl, yl, zl); glVertex3f( xl, yl, zh);
147 glVertex3f( xh, yh, zl); glVertex3f( xh, yh, zh);
148 glVertex3f(-xh, yh, zl); glVertex3f(-xh, yh, zh);
149 glVertex3f(-xl, yl, zl); glVertex3f(-xl, yl, zh);