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>
19 //______________________________________________________________________________
20 // AliEveMUONChamberGL
23 ClassImp(AliEveMUONChamberGL)
25 //______________________________________________________________________________
26 AliEveMUONChamberGL::AliEveMUONChamberGL() :
38 //______________________________________________________________________________
39 AliEveMUONChamberGL::~AliEveMUONChamberGL()
47 //______________________________________________________________________________
48 Bool_t AliEveMUONChamberGL::SetModel(TObject* obj, const Option_t* /*opt*/)
54 if(SetModelCheckClass(obj, AliEveMUONChamber::Class())) {
56 fChamber = (AliEveMUONChamber*) fExternalObj;
57 fQS1.SetModel(&fChamber->fQuadSet1);
58 fQS2.SetModel(&fChamber->fQuadSet2);
67 //______________________________________________________________________________
68 void AliEveMUONChamberGL::SetBBox()
74 SetAxisAlignedBBox(((AliEveMUONChamber*)fExternalObj)->AssertBBox());
78 //______________________________________________________________________________
79 void AliEveMUONChamberGL::DirectDraw(TGLRnrCtx& rnrCtx) const
85 glDisable(GL_LIGHTING);
87 //Double_t width = 10;
88 //glOrtho(-width,+width,-width,+width,-width,+width);
90 if(fRTS < fChamber->fRTS) {
91 fChamber->UpdateQuads();
92 fRTS = fChamber->fRTS;
95 Bool_t hasData = (fChamber->GetChamberData() != 0);
108 //______________________________________________________________________________
109 void AliEveMUONChamberGL::DrawQuads(TGLRnrCtx& rnrCtx) const
112 // draw the digits as GL_QUADS
115 glPushAttrib(GL_ENABLE_BIT | GL_POLYGON_BIT);
117 glDisable(GL_LIGHTING);
118 glDisable(GL_CULL_FACE);
120 //Float_t c[4]; glGetFloatv(GL_CURRENT_COLOR, c);
122 glPolygonMode(GL_FRONT, GL_FILL);
123 glPolygonMode(GL_BACK, GL_LINE);
125 fQS1.DirectDraw(rnrCtx);
127 glPolygonMode(GL_FRONT, GL_LINE);
128 glPolygonMode(GL_BACK, GL_FILL);
130 fQS2.DirectDraw(rnrCtx);
136 //______________________________________________________________________________
137 void AliEveMUONChamberGL::DrawPoints() const
140 // draw the clusters as GL_QUADS
145 glDisable(GL_LIGHTING);
148 TGLUtil::Color3f(1.0,1.0,1.0);
154 Int_t clsSize = fChamber->fClusterSize;
158 for (Int_t i = 0; i < fChamber->fPointSet1.GetN(); i++) {
160 fChamber->fPointSet1.GetPoint(i,x,y,z);
162 glVertex3f(x-clsSize,y+clsSize,z);
163 glVertex3f(x+clsSize,y-clsSize,z);
165 glVertex3f(x-clsSize,y-clsSize,z);
166 glVertex3f(x+clsSize,y+clsSize,z);
174 Int_t hitSize = fChamber->fHitSize;
178 for (Int_t i = 0; i < fChamber->fPointSet2.GetN(); i++) {
180 fChamber->fPointSet2.GetPoint(i,x,y,z);
182 glVertex3f(x-hitSize,y,z);
183 glVertex3f(x+hitSize,y,z);
185 glVertex3f(x,y-hitSize,z);
186 glVertex3f(x,y+hitSize,z);
196 //______________________________________________________________________________
197 void AliEveMUONChamberGL::DrawChamberFrame() const
200 // draw the chamber frame as GL_LINE_LOOP
203 AliEveMUONChamberData* chamberData = fChamber->GetChamberData();
204 Int_t nDetElem = chamberData->GetNDetElem();
206 Float_t xOrig, yOrig, xRad, yRad, x, y, z;
208 TGLUtil::Color4ub(255, 0, 0, 255);
210 for (Int_t id = 0; id < nDetElem; id++) {
212 frameCoord = chamberData->GetFrameCoord(id);
214 if (fChamber->GetID() < 4) {
216 xOrig = frameCoord[0];
217 yOrig = frameCoord[1];
218 xRad = frameCoord[2];
219 yRad = frameCoord[3];
222 if (fChamber->GetID() < 2) {
223 xRad += TMath::Sign(15.0,(Double_t)xRad);
224 yRad += TMath::Sign(15.0,(Double_t)yRad);
226 xRad += TMath::Sign( 5.0,(Double_t)xRad);
227 yRad += TMath::Sign( 5.0,(Double_t)yRad);
230 glBegin(GL_LINE_LOOP);
232 glVertex3f(xOrig,yOrig,z);
235 Float_t dstep = TMath::Pi()/2.0 / (Float_t)nstep;
237 for (Int_t istep = 0; istep < nstep; istep++) {
240 x = xOrig + xRad * TMath::Cos(d);
241 y = yOrig + yRad * TMath::Sin(d);
247 glVertex3f(xOrig,yOrig,z);
253 glBegin(GL_LINE_LOOP);
254 glVertex3f(frameCoord[0],frameCoord[1],frameCoord[4]);
255 glVertex3f(frameCoord[0],frameCoord[3],frameCoord[4]);
256 glVertex3f(frameCoord[2],frameCoord[3],frameCoord[4]);
257 glVertex3f(frameCoord[2],frameCoord[1],frameCoord[4]);
258 glVertex3f(frameCoord[0],frameCoord[1],frameCoord[4]);