]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVE/EveBase/AliEveJetPlaneGL.cxx
Not ready for previous changes, revert to stable code.
[u/mrichter/AliRoot.git] / EVE / EveBase / AliEveJetPlaneGL.cxx
CommitLineData
d810d0de 1// $Id$
2// Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
4673ff03 3
d810d0de 4/**************************************************************************
5 * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
6 * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for *
51346b82 7 * full copyright notice. *
d810d0de 8 **************************************************************************/
9
10#include "AliEveJetPlaneGL.h"
707b281a 11#include "AliEveJetPlane.h"
4673ff03 12
115b6655 13#include <TGLRnrCtx.h>
4673ff03 14#include <TGLSelectRecord.h>
15#include <TGLIncludes.h>
16
17#include "TGLUtil.h"
18#include "TGLAxis.h"
19
20#include <TColor.h>
21#include <TStyle.h>
22#include <TROOT.h>
d810d0de 23
a15e6d7d 24//==============================================================================
25//==============================================================================
26// AliEveJetPlaneGL
27//==============================================================================
4673ff03 28
57ffa5fb 29//______________________________________________________________________________
4673ff03 30//
a97abca8 31// GL renderer for AliEveJetPlane.
4673ff03 32
d810d0de 33ClassImp(AliEveJetPlaneGL)
4673ff03 34
d810d0de 35AliEveJetPlaneGL::AliEveJetPlaneGL() : TGLObject(), fM(0)
4673ff03 36{
a97abca8 37 // Constructor.
38
4673ff03 39 fDLCache = kFALSE; // Disable display list -- axis pain.
40}
41
57ffa5fb 42/******************************************************************************/
4673ff03 43
d810d0de 44Bool_t AliEveJetPlaneGL::SetModel(TObject* obj, const Option_t* /*opt*/)
4673ff03 45{
a97abca8 46 // Set model object.
47
e930bdfa 48 if (SetModelCheckClass(obj, AliEveJetPlane::Class())) {
d810d0de 49 fM = dynamic_cast<AliEveJetPlane*>(obj);
4673ff03 50 return kTRUE;
51 }
52 return kFALSE;
53}
54
d810d0de 55void AliEveJetPlaneGL::SetBBox()
4673ff03 56{
a97abca8 57 // Set bounding box.
58
d810d0de 59 SetAxisAlignedBBox(((AliEveJetPlane*)fExternalObj)->AssertBBox());
4673ff03 60}
61
57ffa5fb 62/******************************************************************************/
4673ff03 63
115b6655 64void AliEveJetPlaneGL::DirectDraw(TGLRnrCtx& rnrCtx) const
4673ff03 65{
a97abca8 66 // Render the object.
4673ff03 67
68 Float_t minEta = (fM->fMinEta)*(fM->fEtaScale);
69 Float_t maxEta = (fM->fMaxEta)*(fM->fEtaScale);
2ea57cb0 70 Float_t minPhi = (fM->fMinPhi)*(fM->fPhiScale) - 350;
71 Float_t maxPhi = (fM->fMaxPhi)*(fM->fPhiScale) - 350;
4673ff03 72 Float_t phiCoord, etaCoord, dPhi, dEta;
4673ff03 73
74 // Show frame for Eta-Phi coordinates
75
76 glBegin(GL_LINE_LOOP);
a15e6d7d 77 glVertex3f(minEta, minPhi, 0);
78 glVertex3f(maxEta, minPhi, 0);
79 glVertex3f(maxEta, maxPhi, 0);
80 glVertex3f(minEta, maxPhi, 0);
4673ff03 81 glEnd();
82
115b6655 83 if (rnrCtx.Selection() == kFALSE && rnrCtx.Highlight() == kFALSE)
4673ff03 84 {
4673ff03 85
115b6655 86 // Show grid in Eta-Phi coordinates
87
88 dPhi = (maxPhi-minPhi)/(fM->fNPhiDiv - 1);
89 dEta = (maxEta-minEta)/(fM->fNEtaDiv - 1);
90
91 for (Int_t count = 1; count < fM->fNPhiDiv-1; ++count)
92 {
93 phiCoord = minPhi + count*dPhi;
94 glBegin(GL_LINES);
95 glVertex3f( minEta, phiCoord, 0);
96 glVertex3f( maxEta, phiCoord, 0);
97 glEnd();
98 }
99
100 for (Int_t count = 1; count < fM->fNEtaDiv-1; ++count)
101 {
102 etaCoord = minEta + count*dEta;
103 glBegin(GL_LINES);
104 glVertex3f(etaCoord, minPhi, 0);
105 glVertex3f(etaCoord, maxPhi, 0);
106 glEnd();
107 }
108
109 // Show axis tick marks and labels
110
111 {
112 TGLCapabilitySwitch lightsOff(GL_LIGHTING, false);
113
114 TGLAxis ap;
115 ap.SetLineColor(fM->fGridColor);
116 ap.SetTextColor(fM->fGridColor);
117 TGLVector3 start, end;
118
119 start.Set(minEta, minPhi, 0);
120 end.Set(maxEta, minPhi, 0);
121 ap.PaintGLAxis(start.CArr(), end.CArr(), fM->fMinEta, fM->fMaxEta, 205);
122
123 start.Set(maxEta, minPhi, 0);
124 end.Set(maxEta, maxPhi, 0);
125 ap.PaintGLAxis(start.CArr(), end.CArr(), fM->fMinPhi, fM->fMaxPhi, 205);
126 }
4673ff03 127
128 }
4673ff03 129}