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 "AliEveMUONChamberGL.h"
12 #include <EveDet/AliEveMUONChamber.h>
13 #include <EveDet/AliEveMUONChamberData.h>
15 #include <TGLRnrCtx.h>
16 #include <TGLIncludes.h>
20 //______________________________________________________________________________
21 // AliEveMUONChamberGL
24 ClassImp(AliEveMUONChamberGL)
26 //______________________________________________________________________________
27 AliEveMUONChamberGL::AliEveMUONChamberGL() :
39 //______________________________________________________________________________
40 AliEveMUONChamberGL::~AliEveMUONChamberGL()
48 //______________________________________________________________________________
49 Bool_t AliEveMUONChamberGL::SetModel(TObject* obj, const Option_t* /*opt*/)
55 if(SetModelCheckClass(obj, AliEveMUONChamber::Class())) {
57 fChamber = (AliEveMUONChamber*) fExternalObj;
58 fQS1.SetModel(&fChamber->fQuadSet1);
59 fQS2.SetModel(&fChamber->fQuadSet2);
68 //______________________________________________________________________________
69 void AliEveMUONChamberGL::SetBBox()
75 SetAxisAlignedBBox(((AliEveMUONChamber*)fExternalObj)->AssertBBox());
79 //______________________________________________________________________________
80 void AliEveMUONChamberGL::DirectDraw(TGLRnrCtx& rnrCtx) const
86 glDisable(GL_LIGHTING);
88 //Double_t width = 10;
89 //glOrtho(-width,+width,-width,+width,-width,+width);
91 if(fRTS < fChamber->fRTS) {
92 fChamber->UpdateQuads();
93 fRTS = fChamber->fRTS;
96 Bool_t hasData = (fChamber->GetChamberData() != 0);
109 //______________________________________________________________________________
110 void AliEveMUONChamberGL::DrawQuads(TGLRnrCtx& rnrCtx) const
113 // draw the digits as GL_QUADS
116 glPushAttrib(GL_ENABLE_BIT | GL_POLYGON_BIT);
118 glDisable(GL_LIGHTING);
119 glDisable(GL_CULL_FACE);
121 //Float_t c[4]; glGetFloatv(GL_CURRENT_COLOR, c);
123 glPolygonMode(GL_FRONT, GL_FILL);
124 glPolygonMode(GL_BACK, GL_LINE);
126 fQS1.DirectDraw(rnrCtx);
128 glPolygonMode(GL_FRONT, GL_LINE);
129 glPolygonMode(GL_BACK, GL_FILL);
131 fQS2.DirectDraw(rnrCtx);
137 //______________________________________________________________________________
138 void AliEveMUONChamberGL::DrawPoints() const
141 // draw the clusters as GL_QUADS
146 glDisable(GL_LIGHTING);
149 TGLUtil::Color3f(1.0,1.0,1.0);
155 Int_t clsSize = fChamber->fClusterSize;
159 for (Int_t i = 0; i < fChamber->fPointSet1.GetN(); i++) {
161 fChamber->fPointSet1.GetPoint(i,x,y,z);
163 glVertex3f(x-clsSize,y+clsSize,z);
164 glVertex3f(x+clsSize,y-clsSize,z);
166 glVertex3f(x-clsSize,y-clsSize,z);
167 glVertex3f(x+clsSize,y+clsSize,z);
175 Int_t hitSize = fChamber->fHitSize;
179 for (Int_t i = 0; i < fChamber->fPointSet2.GetN(); i++) {
181 fChamber->fPointSet2.GetPoint(i,x,y,z);
183 glVertex3f(x-hitSize,y,z);
184 glVertex3f(x+hitSize,y,z);
186 glVertex3f(x,y-hitSize,z);
187 glVertex3f(x,y+hitSize,z);
197 //______________________________________________________________________________
198 void AliEveMUONChamberGL::DrawChamberFrame() const
201 // draw the chamber frame as GL_LINE_LOOP
204 AliEveMUONChamberData* chamberData = fChamber->GetChamberData();
205 Int_t nDetElem = chamberData->GetNDetElem();
207 Float_t xOrig, yOrig, xRad, yRad, x, y, z;
209 TGLUtil::Color4ub(255, 0, 0, 255);
211 for (Int_t id = 0; id < nDetElem; id++) {
213 frameCoord = chamberData->GetFrameCoord(id);
215 if (fChamber->GetID() < 4) {
217 xOrig = frameCoord[0];
218 yOrig = frameCoord[1];
219 xRad = frameCoord[2];
220 yRad = frameCoord[3];
223 if (fChamber->GetID() < 2) {
224 xRad += TMath::Sign(15.0,(Double_t)xRad);
225 yRad += TMath::Sign(15.0,(Double_t)yRad);
227 xRad += TMath::Sign( 5.0,(Double_t)xRad);
228 yRad += TMath::Sign( 5.0,(Double_t)yRad);
231 glBegin(GL_LINE_LOOP);
233 glVertex3f(xOrig,yOrig,z);
236 Float_t dstep = TMath::Pi()/2.0 / (Float_t)nstep;
238 for (Int_t istep = 0; istep < nstep; istep++) {
241 x = xOrig + xRad * TMath::Cos(d);
242 y = yOrig + yRad * TMath::Sin(d);
248 glVertex3f(xOrig,yOrig,z);
254 glBegin(GL_LINE_LOOP);
255 glVertex3f(frameCoord[0],frameCoord[1],frameCoord[4]);
256 glVertex3f(frameCoord[0],frameCoord[3],frameCoord[4]);
257 glVertex3f(frameCoord[2],frameCoord[3],frameCoord[4]);
258 glVertex3f(frameCoord[2],frameCoord[1],frameCoord[4]);
259 glVertex3f(frameCoord[0],frameCoord[1],frameCoord[4]);