2 // Main authors: Matevz Tadel & Alja Mrak-Tadel: 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 **************************************************************************/
9 /**************************************************************************
10 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
12 * Author: The ALICE Off-line Project. *
13 * Contributors are mentioned in the code where appropriate. *
15 * Permission to use, copy, modify and distribute this software and its *
16 * documentation strictly for non-commercial purposes is hereby granted *
17 * without fee, provided that the above copyright notice appears in all *
18 * copies and that both the copyright notice and this permission notice *
19 * appear in the supporting documentation. The authors make no claims *
20 * about the suitability of this software for any purpose. It is *
21 * provided "as is" without express or implied warranty. *
22 **************************************************************************/
26 #include <Riostream.h>
30 #include "AliEveMUONChamberGL.h"
32 #include <Alieve/AliEveMUONChamber.h>
33 #include <Alieve/AliEveMUONChamberData.h>
35 #include <TEveQuadSetGL.h>
36 #include <TGLRnrCtx.h>
37 #include <TGLIncludes.h>
40 //______________________________________________________________________
41 // AliEveMUONChamberGL
44 ClassImp(AliEveMUONChamberGL)
46 //______________________________________________________________________
47 AliEveMUONChamberGL::AliEveMUONChamberGL() :
58 //______________________________________________________________________
59 AliEveMUONChamberGL::~AliEveMUONChamberGL()
67 //______________________________________________________________________
68 Bool_t AliEveMUONChamberGL::SetModel(TObject* obj, const Option_t* /*opt*/)
74 if(SetModelCheckClass(obj, AliEveMUONChamber::Class())) {
76 fChamber = (AliEveMUONChamber*) fExternalObj;
77 fQS1.SetModel(&fChamber->fQuadSet1);
78 fQS2.SetModel(&fChamber->fQuadSet2);
87 //______________________________________________________________________
88 void AliEveMUONChamberGL::SetBBox()
94 SetAxisAlignedBBox(((AliEveMUONChamber*)fExternalObj)->AssertBBox());
98 //______________________________________________________________________
99 void AliEveMUONChamberGL::DirectDraw(TGLRnrCtx& rnrCtx) const
102 // Actual GL drawing.
105 glDisable(GL_LIGHTING);
107 //Double_t width = 10;
108 //glOrtho(-width,+width,-width,+width,-width,+width);
110 if(fRTS < fChamber->fRTS) {
111 fChamber->UpdateQuads();
112 fRTS = fChamber->fRTS;
115 Bool_t hasData = (fChamber->GetChamberData() != 0);
128 //______________________________________________________________________
129 void AliEveMUONChamberGL::DrawQuads(TGLRnrCtx& rnrCtx) const
132 // draw the digits as GL_QUADS
135 glPushAttrib(GL_ENABLE_BIT | GL_POLYGON_BIT);
137 glDisable(GL_LIGHTING);
138 glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE);
139 glEnable(GL_COLOR_MATERIAL);
140 glDisable(GL_CULL_FACE);
142 //Float_t c[4]; glGetFloatv(GL_CURRENT_COLOR, c);
144 glPolygonMode(GL_FRONT, GL_FILL);
145 glPolygonMode(GL_BACK, GL_LINE);
147 fQS1.DirectDraw(rnrCtx);
149 glPolygonMode(GL_FRONT, GL_LINE);
150 glPolygonMode(GL_BACK, GL_FILL);
152 fQS2.DirectDraw(rnrCtx);
158 //______________________________________________________________________
159 void AliEveMUONChamberGL::DrawPoints() const
162 // draw the clusters as GL_QUADS
167 glDisable(GL_LIGHTING);
170 glColor3f(1.0,1.0,1.0);
176 Int_t clsSize = fChamber->fClusterSize;
180 for (Int_t i = 0; i < fChamber->fPointSet1.GetN(); i++) {
182 fChamber->fPointSet1.GetPoint(i,x,y,z);
184 glVertex3f(x-clsSize,y+clsSize,z);
185 glVertex3f(x+clsSize,y-clsSize,z);
187 glVertex3f(x-clsSize,y-clsSize,z);
188 glVertex3f(x+clsSize,y+clsSize,z);
196 Int_t hitSize = fChamber->fHitSize;
200 for (Int_t i = 0; i < fChamber->fPointSet2.GetN(); i++) {
202 fChamber->fPointSet2.GetPoint(i,x,y,z);
204 glVertex3f(x-hitSize,y,z);
205 glVertex3f(x+hitSize,y,z);
207 glVertex3f(x,y-hitSize,z);
208 glVertex3f(x,y+hitSize,z);
218 //______________________________________________________________________
219 void AliEveMUONChamberGL::DrawChamberFrame() const
222 // draw the chamber frame as GL_LINE_LOOP
225 AliEveMUONChamberData* chamberData = fChamber->GetChamberData();
226 Int_t nDetElem = chamberData->GetNDetElem();
228 Float_t xOrig, yOrig, xRad, yRad, x, y, z;
238 for (Int_t id = 0; id < nDetElem; id++) {
240 frameCoord = chamberData->GetFrameCoord(id);
242 if (fChamber->GetID() < 4) {
244 xOrig = frameCoord[0];
245 yOrig = frameCoord[1];
246 xRad = frameCoord[2];
247 yRad = frameCoord[3];
253 glBegin(GL_LINE_LOOP);
255 glVertex3f(xOrig,yOrig,z);
258 Float_t dstep = TMath::Pi()/2.0 / (Float_t)nstep;
260 for (Int_t istep = 0; istep < nstep; istep++) {
263 x = xOrig + xRad * TMath::Cos(d);
264 y = yOrig + yRad * TMath::Sin(d);
270 glVertex3f(xOrig,yOrig,z);
276 glBegin(GL_LINE_LOOP);
277 glVertex3f(frameCoord[0],frameCoord[1],frameCoord[4]);
278 glVertex3f(frameCoord[0],frameCoord[3],frameCoord[4]);
279 glVertex3f(frameCoord[2],frameCoord[3],frameCoord[4]);
280 glVertex3f(frameCoord[2],frameCoord[1],frameCoord[4]);
281 glVertex3f(frameCoord[0],frameCoord[1],frameCoord[4]);