2 // Main authors: Matevz Tadel & Alja Mrak-Tadel & Bogdan Vulpescu: 2006, 2007
4 /**************************************************************************
5 * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
6 * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for *
7 * full copyright notice. *
8 **************************************************************************/
10 #include <Riostream.h>
14 #include "AliEveMUONChamberGL.h"
16 #include <EveDet/AliEveMUONChamber.h>
17 #include <EveDet/AliEveMUONChamberData.h>
19 #include <TEveQuadSetGL.h>
20 #include <TGLRnrCtx.h>
21 #include <TGLIncludes.h>
24 //______________________________________________________________________________
25 // AliEveMUONChamberGL
28 ClassImp(AliEveMUONChamberGL)
30 //______________________________________________________________________________
31 AliEveMUONChamberGL::AliEveMUONChamberGL() :
43 //______________________________________________________________________________
44 AliEveMUONChamberGL::~AliEveMUONChamberGL()
52 //______________________________________________________________________________
53 Bool_t AliEveMUONChamberGL::SetModel(TObject* obj, const Option_t* /*opt*/)
59 if(SetModelCheckClass(obj, AliEveMUONChamber::Class())) {
61 fChamber = (AliEveMUONChamber*) fExternalObj;
62 fQS1.SetModel(&fChamber->fQuadSet1);
63 fQS2.SetModel(&fChamber->fQuadSet2);
72 //______________________________________________________________________________
73 void AliEveMUONChamberGL::SetBBox()
79 SetAxisAlignedBBox(((AliEveMUONChamber*)fExternalObj)->AssertBBox());
83 //______________________________________________________________________________
84 void AliEveMUONChamberGL::DirectDraw(TGLRnrCtx& rnrCtx) const
90 glDisable(GL_LIGHTING);
92 //Double_t width = 10;
93 //glOrtho(-width,+width,-width,+width,-width,+width);
95 if(fRTS < fChamber->fRTS) {
96 fChamber->UpdateQuads();
97 fRTS = fChamber->fRTS;
100 Bool_t hasData = (fChamber->GetChamberData() != 0);
113 //______________________________________________________________________________
114 void AliEveMUONChamberGL::DrawQuads(TGLRnrCtx& rnrCtx) const
117 // draw the digits as GL_QUADS
120 glPushAttrib(GL_ENABLE_BIT | GL_POLYGON_BIT);
122 glDisable(GL_LIGHTING);
123 glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
124 glEnable(GL_COLOR_MATERIAL);
125 glDisable(GL_CULL_FACE);
127 //Float_t c[4]; glGetFloatv(GL_CURRENT_COLOR, c);
129 glPolygonMode(GL_FRONT, GL_FILL);
130 glPolygonMode(GL_BACK, GL_LINE);
132 fQS1.DirectDraw(rnrCtx);
134 glPolygonMode(GL_FRONT, GL_LINE);
135 glPolygonMode(GL_BACK, GL_FILL);
137 fQS2.DirectDraw(rnrCtx);
143 //______________________________________________________________________________
144 void AliEveMUONChamberGL::DrawPoints() const
147 // draw the clusters as GL_QUADS
152 glDisable(GL_LIGHTING);
155 glColor3f(1.0,1.0,1.0);
161 Int_t clsSize = fChamber->fClusterSize;
165 for (Int_t i = 0; i < fChamber->fPointSet1.GetN(); i++) {
167 fChamber->fPointSet1.GetPoint(i,x,y,z);
169 glVertex3f(x-clsSize,y+clsSize,z);
170 glVertex3f(x+clsSize,y-clsSize,z);
172 glVertex3f(x-clsSize,y-clsSize,z);
173 glVertex3f(x+clsSize,y+clsSize,z);
181 Int_t hitSize = fChamber->fHitSize;
185 for (Int_t i = 0; i < fChamber->fPointSet2.GetN(); i++) {
187 fChamber->fPointSet2.GetPoint(i,x,y,z);
189 glVertex3f(x-hitSize,y,z);
190 glVertex3f(x+hitSize,y,z);
192 glVertex3f(x,y-hitSize,z);
193 glVertex3f(x,y+hitSize,z);
203 //______________________________________________________________________________
204 void AliEveMUONChamberGL::DrawChamberFrame() const
207 // draw the chamber frame as GL_LINE_LOOP
210 AliEveMUONChamberData* chamberData = fChamber->GetChamberData();
211 Int_t nDetElem = chamberData->GetNDetElem();
213 Float_t xOrig, yOrig, xRad, yRad, x, y, z;
223 for (Int_t id = 0; id < nDetElem; id++) {
225 frameCoord = chamberData->GetFrameCoord(id);
227 if (fChamber->GetID() < 4) {
229 xOrig = frameCoord[0];
230 yOrig = frameCoord[1];
231 xRad = frameCoord[2];
232 yRad = frameCoord[3];
235 if (fChamber->GetID() < 2) {
236 xRad += TMath::Sign(15.0,(Double_t)xRad);
237 yRad += TMath::Sign(15.0,(Double_t)yRad);
239 xRad += TMath::Sign( 5.0,(Double_t)xRad);
240 yRad += TMath::Sign( 5.0,(Double_t)yRad);
243 glBegin(GL_LINE_LOOP);
245 glVertex3f(xOrig,yOrig,z);
248 Float_t dstep = TMath::Pi()/2.0 / (Float_t)nstep;
250 for (Int_t istep = 0; istep < nstep; istep++) {
253 x = xOrig + xRad * TMath::Cos(d);
254 y = yOrig + yRad * TMath::Sin(d);
260 glVertex3f(xOrig,yOrig,z);
266 glBegin(GL_LINE_LOOP);
267 glVertex3f(frameCoord[0],frameCoord[1],frameCoord[4]);
268 glVertex3f(frameCoord[0],frameCoord[3],frameCoord[4]);
269 glVertex3f(frameCoord[2],frameCoord[3],frameCoord[4]);
270 glVertex3f(frameCoord[2],frameCoord[1],frameCoord[4]);
271 glVertex3f(frameCoord[0],frameCoord[1],frameCoord[4]);