21#include "TGLIncludes.h"
48 fM = SetModelDynCast<TEveCalo2D>(obj);
75 using namespace TMath;
82 pnts[0] = r1*Cos(phiMin); pnts[1] = r1*Sin(phiMin);
83 pnts[2] = r2*Cos(phiMin); pnts[3] = r2*Sin(phiMin);
84 pnts[4] = r2*Cos(phiMax); pnts[5] = r2*Sin(phiMax);
85 pnts[6] = r1*Cos(phiMax); pnts[7] = r1*Sin(phiMax);
89 for (
Int_t i = 0; i < 4; ++i)
113 for(
UInt_t phiBin = 1; phiBin <= nPhi; ++phiBin)
115 if (cellLists[phiBin] )
119 for (
Int_t s=0; s<nSlices; ++s)
126 data->GetCellData(*it, cellData);
127 sliceVal[(*it).fSlice] += cellData.
Value(
fM->
fPlotEt)*(*it).fFraction;
134 for (
Int_t s = 0; s < nSlices; ++s)
153 static const TEveException eh(
"TEveCalo2DGL::DrawRPhiHighlighted ");
158 UInt_t nPhiBins =
data->GetPhiBins()->GetNbins();
164 for(
UInt_t phiBin = 1; phiBin <= nPhiBins; ++phiBin)
166 if (cellLists[phiBin])
170 delete[] sliceValRef;
171 throw eh +
"selected cell not in cell list cache.";
176 for (
Int_t s=0; s<nSlices; ++s) sliceVal[s] = 0;
179 data->GetCellData((*i), cellData);
180 sliceVal[i->fSlice] += cellData.
Value(
fM->
fPlotEt)*(*i).fFraction;
183 for (
Int_t s=0; s<nSlices; ++s) sliceValRef[s] = 0;
186 data->GetCellData(*i, cellData);
187 sliceValRef[i->fSlice] += cellData.
Value(
fM->
fPlotEt)*(*i).fFraction;
190 for (
Int_t s = 0; s < nSlices; ++s) {
203 delete [] sliceValRef;
212 using namespace TMath;
226 pnts[0] = r1*sin1; pnts[1] = r1*cos1;
227 pnts[2] = r2*sin1; pnts[3] = r2*cos1;
228 pnts[4] = r2*sin2; pnts[5] = r2*cos2;
229 pnts[6] = r1*sin2; pnts[7] = r1*cos2;
237 if (thetaMax >= transThetaB)
242 pnts[0] = r1*sin1; pnts[1] = r1*cos1;
243 pnts[2] = r2*sin1; pnts[3] = r2*cos1;
244 pnts[4] = r2*sin2; pnts[5] = r2*cos2;
245 pnts[6] = r1*sin2; pnts[7] = r1*cos2;
250 for (
Int_t i = 0; i < 4; ++i)
253 y = phiPlus ? Abs(pnts[2*i]) : -Abs(pnts[2*i]);
279 for (
UInt_t etaBin = 1; etaBin <= nEta; ++etaBin)
281 if (cellLists[etaBin] )
292 for (
Int_t s = 0; s < nSlices; ++s) {
300 data->GetCellData(*it, cellData);
302 sliceValsUp [it->fSlice] += cellData.
Value(
fM->
fPlotEt)*(*it).fFraction;
304 sliceValsLow[it->fSlice] += cellData.
Value(
fM->
fPlotEt)*(*it).fFraction;
307 isBarrel = !(etaMax > 0 && etaMax > transEtaF) && !(etaMin < 0 && etaMin < transEtaB);
313 for (
Int_t s = 0; s < nSlices; ++s)
340 delete [] sliceValsUp;
341 delete [] sliceValsLow;
349 static const TEveException eh(
"TEveCalo2DGL::DrawRhoZHighlighted ");
364 Float_t towerH, towerHRef, offUp, offLow;
367 for (
UInt_t etaBin = 1; etaBin <= nEtaBins; ++etaBin)
369 if (cellLists[etaBin])
372 delete[] sliceValsUp;
373 delete[] sliceValsLow;
374 delete[] sliceValsUpRef;
375 delete[] sliceValsLowRef;
376 throw(eh +
"selected cell not in cell list cache.");
379 offUp = 0; offLow =0;
381 for (
Int_t s = 0; s < nSlices; ++s) {
382 sliceValsUp[s] = 0; sliceValsLow[s] = 0;
386 data->GetCellData(*i, cellData);
388 sliceValsUp [i->fSlice] += cellData.
Value(
fM->
fPlotEt)*(*i).fFraction;
390 sliceValsLow[i->fSlice] += cellData.
Value(
fM->
fPlotEt)*(*i).fFraction;
394 for (
Int_t s = 0; s < nSlices; ++s)
396 sliceValsUpRef[s] = 0; sliceValsLowRef[s] = 0;
401 data->GetCellData(*i, cellData);
403 sliceValsUpRef [i->fSlice] += cellData.
Value(
fM->
fPlotEt)*(*i).fFraction;
405 sliceValsLowRef[i->fSlice] += cellData.
Value(
fM->
fPlotEt)*(*i).fFraction;
409 isBarrel = !(bincenterEta > 0 && bincenterEta > transEtaF) && !(bincenterEta < 0 && bincenterEta < transEtaB);
411 for (
Int_t s = 0; s < nSlices; ++s)
417 if (sliceValsUp[s] > 0) {
425 if (sliceValsLow[s] > 0) {
434 delete [] sliceValsUp;
435 delete [] sliceValsLow;
436 delete [] sliceValsUpRef;
437 delete [] sliceValsLowRef;
448 glPushAttrib(GL_ENABLE_BIT | GL_POLYGON_BIT);
450 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
471 static const TEveException eh(
"TEveCalo2DGL::DrawHighlight ");
523 if ((*it).fSlice == slice)
531 assert(rec.
GetN() > 3);
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t sel
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h offset
Class to manage histogram axis.
virtual Double_t GetBinCenter(Int_t bin) const
Return center of bin.
virtual Double_t GetBinLowEdge(Int_t bin) const
Return low edge of bin.
virtual Double_t GetBinUpEdge(Int_t bin) const
Return up edge of bin.
OpenGL renderer class for TEveCalo2D.
virtual Bool_t SetModel(TObject *obj, const Option_t *opt=nullptr)
Set model object.
void DrawRPhi(TGLRnrCtx &rnrCtx, TEveCalo2D::vBinCells_t &) const
Draw calorimeter cells in RPhi projection.
void MakeRPhiCell(Float_t phiMin, Float_t phiMax, Float_t towerH, Float_t offset) const
Calculate vertices for the calorimeter cell in RPhi projection.
void DrawRhoZ(TGLRnrCtx &rnrCtx, TEveCalo2D::vBinCells_t &) const
Draw calorimeter in RhoZ projection.
Bool_t IsRPhi() const
Is current projection type RPhi.
void DrawRPhiHighlighted(std::vector< TEveCaloData::vCellId_t * > &cellLists) const
Draw selected calorimeter cells in RPhi projection.
void DrawRhoZHighlighted(std::vector< TEveCaloData::vCellId_t * > &cellLists) const
Draw selected calorimeter cells in RhoZ projection.
virtual void DirectDraw(TGLRnrCtx &rnrCtx) const
Render with OpenGL.
virtual void ProcessSelection(TGLRnrCtx &rnrCtx, TGLSelectRecord &rec)
Processes tower selection in eta bin or phi bin.
void MakeRhoZCell(Float_t thetaMin, Float_t thetaMax, Float_t &offset, Bool_t isBarrel, Bool_t phiPlus, Float_t towerH) const
Draw cell in RhoZ projection.
TEveCalo2DGL()
Constructor.
virtual void SetBBox()
Set bounding box.
virtual void DrawHighlight(TGLRnrCtx &rnrCtx, const TGLPhysicalShape *ps, Int_t lvl=-1) const
Draw towers in highlight mode.
Visualization of a calorimeter event data in 2D.
std::vector< TEveCaloData::vCellId_t * > fCellListsHighlighted
std::vector< TEveCaloData::vCellId_t * > vBinCells_t
virtual void BuildCellIdCache()
Build lists of drawn cell IDs. See TEveCalo2DGL::DirecDraw().
std::vector< TEveCaloData::vCellId_t * > fCellLists
std::vector< TEveCaloData::vCellId_t * > fCellListsSelected
A central manager for calorimeter event data.
std::vector< CellId_t > vCellId_t
static Float_t EtaToTheta(Float_t eta)
void ProcessSelection(vCellId_t &sel_cells, TGLSelectRecord &rec)
Process newly selected cells with given select-record.
virtual void GetCellData(const CellId_t &id, CellData_t &data) const =0
vCellId_t & GetCellsHighlighted()
vCellId_t & GetCellsSelected()
std::vector< CellId_t >::iterator vCellId_i
Float_t GetTransitionEtaBackward() const
Get transition eta between barrel and backward end-cap cells.
Float_t GetBackwardEndCapPos() const
Float_t GetForwardEndCapPos() const
TEveCaloData * GetData() const
TEveRGBAPalette * AssertPalette()
Make sure the TEveRGBAPalette pointer is not null.
Float_t GetTransitionEtaForward() const
Get transition eta between barrel and forward end-cap cells.
void SetupColorHeight(Float_t value, Int_t slice, Float_t &height) const
Set color and height for a given value and slice using slice color or TEveRGBAPalette.
Exception class thrown by TEve classes and macros.
virtual const char * what() const noexcept
TEveProjectionManager * fManager
TEveProjection * GetProjection()
virtual void ProjectPoint(Float_t &x, Float_t &y, Float_t &z, Float_t d, EPProc_e p=kPP_Full)=0
TGLColor & Selection(Int_t i)
const UChar_t * CArr() const
TObject * fExternalObj
first replica
Base-class for direct OpenGL renderers.
void SetAxisAlignedBBox(Float_t xmin, Float_t xmax, Float_t ymin, Float_t ymax, Float_t zmin, Float_t zmax)
Set axis-aligned bounding-box.
Concrete physical shape - a GL drawable.
The TGLRnrCtx class aggregates data for a given redering context as needed by various parts of the RO...
Bool_t SecSelection() const
TGLColorSet & ColorSet()
Return reference to current color-set (top of the stack).
UInt_t GetItem(Int_t i) const
Standard selection record including information about containing scene and details ob out selected ob...
static UInt_t LockColor()
Prevent further color changes.
static UInt_t UnlockColor()
Allow color changes.
Mother of all ROOT objects.
Cell data inner structure.
Float_t Value(Bool_t) const
Return energy value associated with the cell, usually Et.
Bool_t IsUpperRho() const