-// $Header$
+// $Id$
+// Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
-#include "TPCSector2DGL.h"
+/**************************************************************************
+ * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
+ * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for *
+ * full copyright notice. *
+ **************************************************************************/
-#include <Alieve/TPCData.h>
+#include "AliEveTPCSector2DGL.h"
+
+#include <Alieve/AliEveTPCData.h>
#include <TGLRnrCtx.h>
#include <TGLSelectRecord.h>
#include <TGLIncludes.h>
-using namespace Alieve;
+
using namespace std;
//______________________________________________________________________
-// TPCSector2DGL
+// AliEveTPCSector2DGL
//
-ClassImp(TPCSector2DGL)
+ClassImp(AliEveTPCSector2DGL)
// This can be optimized to non-pow-2 values once everybody has GL 1.4.
-const Int_t TPCSector2DGL::fgkTextureWidth = 256;
-const Int_t TPCSector2DGL::fgkTextureHeight = 128;
-const Int_t TPCSector2DGL::fgkTextureByteSize = 4*256*128;
+const Int_t AliEveTPCSector2DGL::fgkTextureWidth = 256;
+const Int_t AliEveTPCSector2DGL::fgkTextureHeight = 128;
+const Int_t AliEveTPCSector2DGL::fgkTextureByteSize = 4*256*128;
/**************************************************************************/
-TPCSector2DGL::TPCSector2DGL() :
+AliEveTPCSector2DGL::AliEveTPCSector2DGL() :
TGLObject(),
fSector (0),
fRTS (0)
{}
-TPCSector2DGL::~TPCSector2DGL()
+AliEveTPCSector2DGL::~AliEveTPCSector2DGL()
{
if(fImage) delete fImage;
if(fTexture) glDeleteTextures(1, &fTexture);
/**************************************************************************/
-Bool_t TPCSector2DGL::SetModel(TObject* obj, const Option_t* /*opt*/)
+Bool_t AliEveTPCSector2DGL::SetModel(TObject* obj, const Option_t* /*opt*/)
{
- if(SetModelCheckClass(obj, Alieve::TPCSector2D::Class())) {
- fSector = (TPCSector2D*) fExternalObj;
+ if(SetModelCheckClass(obj, AliEveTPCSector2D::Class())) {
+ fSector = (AliEveTPCSector2D*) fExternalObj;
return kTRUE;
}
return kFALSE;
}
-void TPCSector2DGL::SetBBox()
+void AliEveTPCSector2DGL::SetBBox()
{
- SetAxisAlignedBBox(((TPCSector2D*)fExternalObj)->AssertBBox());
+ SetAxisAlignedBBox(((AliEveTPCSector2D*)fExternalObj)->AssertBBox());
}
/**************************************************************************/
-void TPCSector2DGL::ProcessSelection(TGLRnrCtx & /*rnrCtx*/,
+void AliEveTPCSector2DGL::ProcessSelection(TGLRnrCtx & /*rnrCtx*/,
TGLSelectRecord & rec)
{
if (rec.GetN() != 3) return;
Int_t row = rec.GetItem(1);
Int_t pad = rec.GetItem(2);
- if (row < 0 || row >= TPCSectorData::GetNAllRows()) return;
- if (pad < 0 || pad >= TPCSectorData::GetNPadsInRow(row)) return;
+ if (row < 0 || row >= AliEveTPCSectorData::GetNAllRows()) return;
+ if (pad < 0 || pad >= AliEveTPCSectorData::GetNPadsInRow(row)) return;
fSector->PadSelected(row, pad);
}
/**************************************************************************/
-void TPCSector2DGL::DirectDraw(TGLRnrCtx& rnrCtx) const
+void AliEveTPCSector2DGL::DirectDraw(TGLRnrCtx& rnrCtx) const
{
// Actual GL drawing.
- // printf("TPCSector2DGL::DirectDraw \n");
+ // printf("AliEveTPCSector2DGL::DirectDraw \n");
fSectorData = fSector->GetSectorData();
// Display digits
if(fSectorData != 0) {
- const TPCSectorData::SegmentInfo& iSeg = TPCSectorData::GetInnSeg();
- const TPCSectorData::SegmentInfo& o1Seg = TPCSectorData::GetOut1Seg();
- const TPCSectorData::SegmentInfo& o2Seg = TPCSectorData::GetOut2Seg();
+ const AliEveTPCSectorData::SegmentInfo& iSeg = AliEveTPCSectorData::GetInnSeg();
+ const AliEveTPCSectorData::SegmentInfo& o1Seg = AliEveTPCSectorData::GetOut1Seg();
+ const AliEveTPCSectorData::SegmentInfo& o2Seg = AliEveTPCSectorData::GetOut2Seg();
if(rnrCtx.SecSelection()) {
// Data import
/**************************************************************************/
-void TPCSector2DGL::LoadPadrow(TPCSectorData::RowIterator& iter,
+void AliEveTPCSector2DGL::LoadPadrow(AliEveTPCSectorData::RowIterator& iter,
Int_t row, Int_t col_off) const
{
Int_t padVal;
/**************************************************************************/
-void TPCSector2DGL::CreateTexture() const
+void AliEveTPCSector2DGL::CreateTexture() const
{
if (fImage == 0 ) {
fImage = new UChar_t[fgkTextureByteSize];
Int_t rowOff[3], colOff[3];
Bool_t isOn[3];
rowOff[0] = 0;
- rowOff[1] = rowOff[2] = -TPCSectorData::GetSeg(1).GetFirstRow();
+ rowOff[1] = rowOff[2] = -AliEveTPCSectorData::GetSeg(1).GetFirstRow();
colOff[0] = colOff[2] = 0;
- colOff[1] = TPCSectorData::GetSeg(0).GetNMaxPads();
+ colOff[1] = AliEveTPCSectorData::GetSeg(0).GetNMaxPads();
isOn[0] = fSector->fRnrInn;
isOn[1] = fSector->fRnrOut1;
isOn[2] = fSector->fRnrOut2;
for (Int_t sId = 0; sId <= 2; ++sId) {
if(isOn[sId] == kFALSE)
continue;
- const TPCSectorData::SegmentInfo& sInfo = TPCSectorData::GetSeg(sId);
+ const AliEveTPCSectorData::SegmentInfo& sInfo = AliEveTPCSectorData::GetSeg(sId);
for (Int_t row=sInfo.GetFirstRow(); row<=sInfo.GetLastRow(); ++row) {
- TPCSectorData::RowIterator i = fSectorData->MakeRowIterator(row);
- Int_t offset = (sInfo.GetNMaxPads() - TPCSectorData::GetNPadsInRow(row))/2;
+ AliEveTPCSectorData::RowIterator i = fSectorData->MakeRowIterator(row);
+ Int_t offset = (sInfo.GetNMaxPads() - AliEveTPCSectorData::GetNPadsInRow(row))/2;
LoadPadrow(i, row + rowOff[sId], offset + colOff[sId]);
}
}
// Data display
/**************************************************************************/
-void TPCSector2DGL::DisplayTexture(const TPCSectorData::SegmentInfo& seg,
+void AliEveTPCSector2DGL::DisplayTexture(const AliEveTPCSectorData::SegmentInfo& seg,
Int_t startCol, Int_t startRow) const
{
Float_t w = seg.GetNMaxPads()*seg.GetPadWidth()/2;
/**************************************************************************/
-void TPCSector2DGL::DisplayQuads(const TPCSectorData::SegmentInfo& seg,
+void AliEveTPCSector2DGL::DisplayQuads(const AliEveTPCSectorData::SegmentInfo& seg,
Int_t startCol, Int_t startRow) const
{
Float_t y_d, y_u;
y_u = y_d + padH;
x_off = -seg.GetNMaxPads()*padW/2;
Int_t tpcRow = row + seg.GetFirstRow();
- Int_t deltaPad = (seg.GetNMaxPads() - TPCSectorData::GetNPadsInRow(tpcRow))/2;
+ Int_t deltaPad = (seg.GetNMaxPads() - AliEveTPCSectorData::GetNPadsInRow(tpcRow))/2;
Int_t maxPad = seg.GetNMaxPads() - deltaPad;
UChar_t *pix = GetRowCol(row + startRow, startCol + deltaPad);
for (Int_t pad=deltaPad; pad<maxPad; pad++, pix+=4) {
glEnd();
}
-void TPCSector2DGL::DisplayNamedQuads(const TPCSectorData::SegmentInfo& seg,
+void AliEveTPCSector2DGL::DisplayNamedQuads(const AliEveTPCSectorData::SegmentInfo& seg,
Int_t startCol, Int_t startRow) const
{
Float_t y_d, y_u;
x_off = -seg.GetNMaxPads()*padW/2;
Int_t tpcRow = row + seg.GetFirstRow();
glLoadName(tpcRow);
- Int_t deltaPad = (seg.GetNMaxPads() - TPCSectorData::GetNPadsInRow(tpcRow))/2;
+ Int_t deltaPad = (seg.GetNMaxPads() - AliEveTPCSectorData::GetNPadsInRow(tpcRow))/2;
Int_t maxPad = seg.GetNMaxPads() - deltaPad;
UChar_t *pix = GetRowCol(row + startRow, startCol + deltaPad);
glPushName(0);
// Frame drawing
/**************************************************************************/
-void TPCSector2DGL::TraceStepsUp(const TPCSectorData::SegmentInfo& s)
+void AliEveTPCSector2DGL::TraceStepsUp(const AliEveTPCSectorData::SegmentInfo& s)
{
Float_t x = -(s.GetNMaxPads()*1.0/2 - s.GetNYSteps())*s.GetPadWidth();
Float_t y = s.GetRLow();
glVertex2f(-s.GetNMaxPads()*s.GetPadWidth()/2, y);
}
-void TPCSector2DGL::TraceStepsDown(const TPCSectorData::SegmentInfo& s)
+void AliEveTPCSector2DGL::TraceStepsDown(const AliEveTPCSectorData::SegmentInfo& s)
{
Float_t x = s.GetNMaxPads()*s.GetPadWidth()/2;
Float_t y = s.GetRLow() + s.GetNRows()*s.GetPadHeight();
glVertex2f((0.5*s.GetNMaxPads() - s.GetNYSteps())*s.GetPadWidth(), y);
}
-void TPCSector2DGL::DisplayFrame() const
+void AliEveTPCSector2DGL::DisplayFrame() const
{
UChar_t col[4];
- TEveUtil::ColorFromIdx(fSector->fFrameColor, col);
+ TEveUtil::TEveUtil::ColorFromIdx(fSector->fFrameColor, col);
glColor4ubv(col);
if(fSector->fRnrInn) {
glBegin(GL_POLYGON);
- TraceStepsUp (TPCSectorData::GetInnSeg());
- TraceStepsDown(TPCSectorData::GetInnSeg());
+ TraceStepsUp (AliEveTPCSectorData::GetInnSeg());
+ TraceStepsDown(AliEveTPCSectorData::GetInnSeg());
glEnd();
}
if(fSector->fRnrOut1) {
glBegin(GL_POLYGON);
- TraceStepsUp (TPCSectorData::GetOut1Seg());
- TraceStepsDown(TPCSectorData::GetOut1Seg());
+ TraceStepsUp (AliEveTPCSectorData::GetOut1Seg());
+ TraceStepsDown(AliEveTPCSectorData::GetOut1Seg());
glEnd();
}
if(fSector->fRnrOut2) {
glBegin(GL_POLYGON);
- TraceStepsUp (TPCSectorData::GetOut2Seg());
- TraceStepsDown(TPCSectorData::GetOut2Seg());
+ TraceStepsUp (AliEveTPCSectorData::GetOut2Seg());
+ TraceStepsDown(AliEveTPCSectorData::GetOut2Seg());
glEnd();
}
}