Skip to content
Snippets Groups Projects
Commit 6f80a98d authored by Matevz Tadel's avatar Matevz Tadel
Browse files

Merge the following revisions from branches/dev/fireworks:

34053, 34057, 34063, 34065


34053
=====

Author: alja
Date: Tue Jun 22 13:43:49 2010
New Revision: 34053

URL: http://root.cern.ch/viewvc?rev=34053&root=root&view=rev
Log:
Add a possibility to draw cells in 2D mode at fixed height.

Modified:
    branches/dev/fireworks/graf3d/eve/inc/TEveCalo.h
    branches/dev/fireworks/graf3d/eve/src/TEveCalo.cxx
    branches/dev/fireworks/graf3d/eve/src/TEveCaloLegoGL.cxx


34057
=====

Author: alja
Date: Tue Jun 22 14:51:00 2010
New Revision: 34057

URL: http://root.cern.ch/viewvc?rev=34057&root=root&view=rev
Log:

Cange realted to previous commit. Fix points height which mark 2D cells with small value.

Modified:
    branches/dev/fireworks/graf3d/eve/src/TEveCaloLegoGL.cxx


34063
=====

Author: alja
Date: Tue Jun 22 16:07:11 2010
New Revision: 34063

URL: http://root.cern.ch/viewvc?rev=34063&root=root&view=rev
Log:
Fix z-scale in case of auto-rebin.

Modified:
    branches/dev/fireworks/graf3d/eve/src/TEveCaloLegoGL.cxx


34065
=====

Author: alja
Date: Tue Jun 22 18:25:28 2010
New Revision: 34065

URL: http://root.cern.ch/viewvc?rev=34065&root=root&view=rev
Log:
Fix tick mark offset in case calo data is empty.

Modified:
    branches/dev/fireworks/graf3d/eve/src/TEveCaloLegoGL.cxx


git-svn-id: http://root.cern.ch/svn/root/trunk@34066 27541ba8-7e3a-0410-8455-c3a389f83636
parent 3e91fa55
No related branches found
No related tags found
No related merge requests found
...@@ -262,6 +262,9 @@ protected: ...@@ -262,6 +262,9 @@ protected:
Bool_t fDrawHPlane; Bool_t fDrawHPlane;
Float_t fHPlaneVal; Float_t fHPlaneVal;
Bool_t fHasFixedHeightIn2DMode;
Float_t fFixedHeightValIn2DMode; // 1% of whole height
Int_t fDrawNumberCellPixels; Int_t fDrawNumberCellPixels;
Int_t fCellPixelFontSize; Int_t fCellPixelFontSize;
...@@ -298,12 +301,18 @@ public: ...@@ -298,12 +301,18 @@ public:
Bool_t GetNormalizeRebin() const { return fNormalizeRebin; } Bool_t GetNormalizeRebin() const { return fNormalizeRebin; }
void SetNormalizeRebin(Bool_t s) { fNormalizeRebin = s; fCellIdCacheOK=kFALSE;} void SetNormalizeRebin(Bool_t s) { fNormalizeRebin = s; fCellIdCacheOK=kFALSE;}
EProjection_e GetProjection() const { return fProjection; }
void SetProjection(EProjection_e p) { fProjection = p; } void SetProjection(EProjection_e p) { fProjection = p; }
EProjection_e GetProjection() { return fProjection; }
void Set2DMode(E2DMode_e p) { f2DMode = p; } void Set2DMode(E2DMode_e p) { f2DMode = p; }
E2DMode_e Get2DMode() { return f2DMode; } E2DMode_e Get2DMode() { return f2DMode; }
bool GetHasFixedHeightIn2DMode() const { return fHasFixedHeightIn2DMode; }
void SetHasFixedHeightIn2DMode(bool x) { fHasFixedHeightIn2DMode = x; }
float GetFixedHeightValIn2DMode() const { return fFixedHeightValIn2DMode; }
void SetFixedHeightValIn2DMode(float x) { fFixedHeightValIn2DMode = x; }
void SetBoxMode(EBoxMode_e p) { fBoxMode = p; } void SetBoxMode(EBoxMode_e p) { fBoxMode = p; }
EBoxMode_e GetBoxMode() { return fBoxMode; } EBoxMode_e GetBoxMode() { return fBoxMode; }
......
...@@ -778,6 +778,9 @@ TEveCaloLego::TEveCaloLego(TEveCaloData* d, const char* n, const char* t): ...@@ -778,6 +778,9 @@ TEveCaloLego::TEveCaloLego(TEveCaloData* d, const char* n, const char* t):
fDrawHPlane(kFALSE), fDrawHPlane(kFALSE),
fHPlaneVal(0), fHPlaneVal(0),
fHasFixedHeightIn2DMode(kFALSE),
fFixedHeightValIn2DMode(0.f),
fDrawNumberCellPixels(18), // draw numbers on cell above 30 pixels fDrawNumberCellPixels(18), // draw numbers on cell above 30 pixels
fCellPixelFontSize(12) // size of cell fonts in pixels fCellPixelFontSize(12) // size of cell fonts in pixels
{ {
......
...@@ -572,6 +572,9 @@ void TEveCaloLegoGL::DrawAxis2D(TGLRnrCtx & rnrCtx) const ...@@ -572,6 +572,9 @@ void TEveCaloLegoGL::DrawAxis2D(TGLRnrCtx & rnrCtx) const
{ {
// Draw XY axis. // Draw XY axis.
if (fM->GetData()->Empty())
fAxisPainter.SetTMNDim(1);
TGLCamera& cam = rnrCtx.RefCamera(); TGLCamera& cam = rnrCtx.RefCamera();
TAxis ax; TAxis ax;
...@@ -637,6 +640,8 @@ void TEveCaloLegoGL::DrawAxis2D(TGLRnrCtx & rnrCtx) const ...@@ -637,6 +640,8 @@ void TEveCaloLegoGL::DrawAxis2D(TGLRnrCtx & rnrCtx) const
glTranslatef(fM->GetEtaMin(), 0, 0); glTranslatef(fM->GetEtaMin(), 0, 0);
fAxisPainter.PaintAxis(rnrCtx, &ax); fAxisPainter.PaintAxis(rnrCtx, &ax);
glPopMatrix(); glPopMatrix();
fAxisPainter.SetTMNDim(2);
} }
//______________________________________________________________________________ //______________________________________________________________________________
...@@ -900,6 +905,8 @@ void TEveCaloLegoGL::DrawCells2D(TGLRnrCtx &rnrCtx, vCell2D_t& cells2D) const ...@@ -900,6 +905,8 @@ void TEveCaloLegoGL::DrawCells2D(TGLRnrCtx &rnrCtx, vCell2D_t& cells2D) const
Float_t bws = -1; //smallest bin Float_t bws = -1; //smallest bin
Float_t logMax = -1; Float_t logMax = -1;
Float_t baseOffset = fM->GetFixedHeightValIn2DMode()*fMaxVal;
if (fM->f2DMode == TEveCaloLego::kValColor) if (fM->f2DMode == TEveCaloLego::kValColor)
{ {
fM->AssertPalette(); fM->AssertPalette();
...@@ -909,14 +916,14 @@ void TEveCaloLegoGL::DrawCells2D(TGLRnrCtx &rnrCtx, vCell2D_t& cells2D) const ...@@ -909,14 +916,14 @@ void TEveCaloLegoGL::DrawCells2D(TGLRnrCtx &rnrCtx, vCell2D_t& cells2D) const
{ {
if (rnrCtx.SecSelection()) glLoadName(i->fId); if (rnrCtx.SecSelection()) glLoadName(i->fId);
glBegin(GL_POLYGON); glBegin(GL_POLYGON);
Float_t val = i->fSumVal; fM->fPalette->ColorFromValue(TMath::FloorNint(i->fSumVal), col);
fM->fPalette->ColorFromValue(TMath::FloorNint(val), col);
col[3] = fM->GetData()->GetSliceTransparency(i->fMaxSlice); col[3] = fM->GetData()->GetSliceTransparency(i->fMaxSlice);
TGLUtil::Color4ubv(col); TGLUtil::Color4ubv(col);
glVertex3f(i->fX0, i->fY0, val); Float_t z = fM->GetHasFixedHeightIn2DMode() ? baseOffset : i->fSumVal;
glVertex3f(i->fX1, i->fY0, val); glVertex3f(i->fX0, i->fY0, z);
glVertex3f(i->fX1, i->fY1, val); glVertex3f(i->fX1, i->fY0, z);
glVertex3f(i->fX0, i->fY1, val); glVertex3f(i->fX1, i->fY1, z);
glVertex3f(i->fX0, i->fY1, z);
glEnd(); glEnd();
} }
} }
...@@ -946,10 +953,11 @@ void TEveCaloLegoGL::DrawCells2D(TGLRnrCtx &rnrCtx, vCell2D_t& cells2D) const ...@@ -946,10 +953,11 @@ void TEveCaloLegoGL::DrawCells2D(TGLRnrCtx &rnrCtx, vCell2D_t& cells2D) const
glPushName(i->fId); glPushName(i->fId);
glBegin(GL_QUADS); glBegin(GL_QUADS);
glVertex3f(i->fX0, i->fY0, i->fSumVal); Float_t z = fM->GetHasFixedHeightIn2DMode() ? baseOffset : i->fSumVal;
glVertex3f(i->fX1, i->fY0, i->fSumVal); glVertex3f(i->fX0, i->fY0, z);
glVertex3f(i->fX1, i->fY1, i->fSumVal); glVertex3f(i->fX1, i->fY0, z);
glVertex3f(i->fX0, i->fY1, i->fSumVal); glVertex3f(i->fX1, i->fY1, z);
glVertex3f(i->fX0, i->fY1, z);
glEnd(); glEnd();
glPopName(); glPopName();
...@@ -963,7 +971,8 @@ void TEveCaloLegoGL::DrawCells2D(TGLRnrCtx &rnrCtx, vCell2D_t& cells2D) const ...@@ -963,7 +971,8 @@ void TEveCaloLegoGL::DrawCells2D(TGLRnrCtx &rnrCtx, vCell2D_t& cells2D) const
for (vCell2D_i i = cells2D.begin(); i != cells2D.end(); ++i) for (vCell2D_i i = cells2D.begin(); i != cells2D.end(); ++i)
{ {
TGLUtil::ColorTransparency(fM->fData->GetSliceColor(i->fMaxSlice), fM->fData->GetSliceTransparency(i->fMaxSlice)); TGLUtil::ColorTransparency(fM->fData->GetSliceColor(i->fMaxSlice), fM->fData->GetSliceTransparency(i->fMaxSlice));
glVertex3f(i->X(), i->Y() , i->fSumVal); Float_t z = fM->GetHasFixedHeightIn2DMode() ? baseOffset : i->fSumVal;
glVertex3f(i->X(), i->Y() , z);
} }
glEnd(); glEnd();
} }
...@@ -975,10 +984,11 @@ void TEveCaloLegoGL::DrawCells2D(TGLRnrCtx &rnrCtx, vCell2D_t& cells2D) const ...@@ -975,10 +984,11 @@ void TEveCaloLegoGL::DrawCells2D(TGLRnrCtx &rnrCtx, vCell2D_t& cells2D) const
Float_t bw = fValToPixel*TMath::Log10(i->fSumVal+1); Float_t bw = fValToPixel*TMath::Log10(i->fSumVal+1);
x = i->X(); x = i->X();
y = i->Y(); y = i->Y();
glVertex3f(x - bw, y - bw, i->fSumVal); Float_t z = fM->GetHasFixedHeightIn2DMode() ? baseOffset : i->fSumVal;
glVertex3f(x + bw, y - bw, i->fSumVal); glVertex3f(x - bw, y - bw, z);
glVertex3f(x + bw, y + bw, i->fSumVal); glVertex3f(x + bw, y - bw, z);
glVertex3f(x - bw, y + bw, i->fSumVal); glVertex3f(x + bw, y + bw, z);
glVertex3f(x - bw, y + bw, z);
} }
glEnd(); glEnd();
...@@ -986,12 +996,13 @@ void TEveCaloLegoGL::DrawCells2D(TGLRnrCtx &rnrCtx, vCell2D_t& cells2D) const ...@@ -986,12 +996,13 @@ void TEveCaloLegoGL::DrawCells2D(TGLRnrCtx &rnrCtx, vCell2D_t& cells2D) const
{ {
glPushAttrib(GL_ENABLE_BIT | GL_POLYGON_BIT); glPushAttrib(GL_ENABLE_BIT | GL_POLYGON_BIT);
Float_t z = 0; Float_t z = 0;
Float_t zOff = fDataMax*0.1 ; Float_t zOff = fDataMax*0.001 ; // avoid polygon stpiling
glBegin(GL_QUADS); glBegin(GL_QUADS);
for ( vCell2D_i i = cells2D.begin(); i != cells2D.end(); ++i) { for ( vCell2D_i i = cells2D.begin(); i != cells2D.end(); ++i) {
Char_t transp = TMath::Min(100, 80 + fM->fData->GetSliceTransparency(i->fMaxSlice) / 5); Char_t transp = TMath::Min(100, 80 + fM->fData->GetSliceTransparency(i->fMaxSlice) / 5);
TGLUtil::ColorTransparency(fM->fData->GetSliceColor(i->fMaxSlice), transp); TGLUtil::ColorTransparency(fM->fData->GetSliceColor(i->fMaxSlice), transp);
z = i->fSumVal - zOff; z = fM->GetHasFixedHeightIn2DMode() ? baseOffset : i->fSumVal;
z -= zOff;
glVertex3f(i->fX0, i->fY0, z); glVertex3f(i->fX0, i->fY0, z);
glVertex3f(i->fX1, i->fY0, z); glVertex3f(i->fX1, i->fY0, z);
glVertex3f(i->fX1, i->fY1, z); glVertex3f(i->fX1, i->fY1, z);
...@@ -1003,7 +1014,8 @@ void TEveCaloLegoGL::DrawCells2D(TGLRnrCtx &rnrCtx, vCell2D_t& cells2D) const ...@@ -1003,7 +1014,8 @@ void TEveCaloLegoGL::DrawCells2D(TGLRnrCtx &rnrCtx, vCell2D_t& cells2D) const
glBegin(GL_QUADS); glBegin(GL_QUADS);
for ( vCell2D_i i = cells2D.begin(); i != cells2D.end(); ++i) { for ( vCell2D_i i = cells2D.begin(); i != cells2D.end(); ++i) {
TGLUtil::ColorTransparency(fM->fData->GetSliceColor(i->fMaxSlice), 60); TGLUtil::ColorTransparency(fM->fData->GetSliceColor(i->fMaxSlice), 60);
z = i->fSumVal + zOff; z = fM->GetHasFixedHeightIn2DMode() ? baseOffset : i->fSumVal;
z += zOff;
glVertex3f(i->fX0, i->fY0, z); glVertex3f(i->fX0, i->fY0, z);
glVertex3f(i->fX1, i->fY0, z); glVertex3f(i->fX1, i->fY0, z);
glVertex3f(i->fX1, i->fY1, z); glVertex3f(i->fX1, i->fY1, z);
...@@ -1060,7 +1072,8 @@ void TEveCaloLegoGL::DrawHighlight(TGLRnrCtx& rnrCtx, const TGLPhysicalShape* /* ...@@ -1060,7 +1072,8 @@ void TEveCaloLegoGL::DrawHighlight(TGLRnrCtx& rnrCtx, const TGLPhysicalShape* /*
Double_t unit = ((eM - em) < (pM - pm)) ? (eM - em) : (pM - pm); Double_t unit = ((eM - em) < (pM - pm)) ? (eM - em) : (pM - pm);
Float_t sx = (eM - em) / fM->GetEtaRng(); Float_t sx = (eM - em) / fM->GetEtaRng();
Float_t sy = (pM - pm) / fM->GetPhiRng(); Float_t sy = (pM - pm) / fM->GetPhiRng();
glScalef(sx / unit, sy / unit, fM->GetValToHeight()); Float_t sz = (fM->fData->Empty() && (fM->GetScaleAbs() == false)) ? 1 : fM->GetMaxTowerH() / fDataMax;
glScalef(sx / unit, sy / unit, sz);
glTranslatef(-fM->GetEta(), -fM->fPhi, 0); glTranslatef(-fM->GetEta(), -fM->fPhi, 0);
glDisable(GL_LIGHTING); glDisable(GL_LIGHTING);
...@@ -1277,10 +1290,10 @@ void TEveCaloLegoGL::DirectDraw(TGLRnrCtx & rnrCtx) const ...@@ -1277,10 +1290,10 @@ void TEveCaloLegoGL::DirectDraw(TGLRnrCtx & rnrCtx) const
glPushMatrix(); glPushMatrix();
Float_t sx = (eM - em) / fM->GetEtaRng(); Float_t sx = (eM - em) / fM->GetEtaRng();
Float_t sy = (pM - pm) / fM->GetPhiRng(); Float_t sy = (pM - pm) / fM->GetPhiRng();
glScalef(sx / unit, sy / unit, fM->GetValToHeight()); Float_t sz = (fM->fData->Empty() && (fM->GetScaleAbs() == false)) ? 1 : fM->GetMaxTowerH() / fDataMax;
glScalef(sx / unit, sy / unit, sz);
glTranslatef(-fM->GetEta(), -fM->fPhi, 0); glTranslatef(-fM->GetEta(), -fM->fPhi, 0);
fFontColor = fM->fFontColor; fFontColor = fM->fFontColor;
fGridColor = fM->fGridColor; fGridColor = fM->fGridColor;
if (fGridColor < 0 || fFontColor < 0) if (fGridColor < 0 || fFontColor < 0)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment