21#include "TGLIncludes.h"
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);
94 fM->fManager->GetProjection()->ProjectPoint(
x,
y, z,
fM->fDepth);
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)
137 fM->SetupColorHeight(sliceVal[s], s, towerH);
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])
168 if (!
fM->fCellLists[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) {
191 fM->SetupColorHeight(sliceValRef[s], s, towerHRef);
194 fM->SetupColorHeight(sliceVal[s], s, towerH);
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)
238 zE =
Abs(
fM->GetBackwardEndCapPos());
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;
253 y = phiPlus ?
Abs(pnts[2*
i]) : -
Abs(pnts[2*
i]);
255 fM->fManager->GetProjection()->ProjectPoint(
x,
y, z,
fM->fDepth);
274 Float_t transEtaF =
fM->GetTransitionEtaForward();
275 Float_t transEtaB =
fM->GetTransitionEtaBackward();
279 for (
UInt_t etaBin = 1; etaBin <= nEta; ++etaBin)
281 if (cellLists[etaBin] )
283 assert(
fM->fCellLists[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)
321 fM->SetupColorHeight(sliceValsUp[s], s, towerH);
329 fM->SetupColorHeight(sliceValsLow[s], s, towerH);
340 delete [] sliceValsUp;
341 delete [] sliceValsLow;
349 static const TEveException eh(
"TEveCalo2DGL::DrawRhoZHighlighted ");
355 Float_t transEtaF =
fM->GetTransitionEtaForward();
356 Float_t transEtaB =
fM->GetTransitionEtaBackward();
364 Float_t towerH, towerHRef, offUp, offLow;
367 for (
UInt_t etaBin = 1; etaBin <= nEtaBins; ++etaBin)
369 if (cellLists[etaBin])
371 if (!
fM->fCellLists[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)
416 fM->SetupColorHeight(sliceValsUpRef[s], s, towerHRef);
417 if (sliceValsUp[s] > 0) {
418 fM->SetupColorHeight(sliceValsUp[s], s, towerH);
424 fM->SetupColorHeight(sliceValsLowRef[s], s, towerHRef);
425 if (sliceValsLow[s] > 0) {
426 fM->SetupColorHeight(sliceValsLow[s], s, towerH);
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);
453 fM->BuildCellIdCache();
471 static const TEveException eh(
"TEveCalo2DGL::DrawHighlight ");
473 if (
fM->fData->GetCellsSelected().empty() &&
fM->fData->GetCellsHighlighted().empty())
483 if (!
fM->fData->GetCellsHighlighted().empty())
492 if (!
fM->fData->GetCellsSelected().empty())
518 Int_t bin = rec.GetItem(1);
519 Int_t slice = rec.GetItem(2);
521 it !=
fM->fCellLists[bin]->end(); ++it)
523 if ((*it).fSlice == slice)
531 assert(rec.GetN() > 3);
532 Bool_t is_upper = (rec.GetItem(3) == 1);
534 fM->fData->GetCellData(*it, cd);
541 fM->fData->ProcessSelection(
sel, rec);
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 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
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
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.
void DrawRPhi(TGLRnrCtx &rnrCtx, TEveCalo2D::vBinCells_t &) const
Draw calorimeter cells in RPhi projection.
void ProcessSelection(TGLRnrCtx &rnrCtx, TGLSelectRecord &rec) override
Processes tower selection in eta bin or phi bin.
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 DirectDraw(TGLRnrCtx &rnrCtx) const override
Render with OpenGL.
void SetBBox() override
Set bounding box.
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.
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.
void DrawHighlight(TGLRnrCtx &rnrCtx, const TGLPhysicalShape *ps, Int_t lvl=-1) const override
Draw towers in highlight mode.
TEveCalo2DGL()
Constructor.
Bool_t SetModel(TObject *obj, const Option_t *opt=nullptr) override
Set model object.
Visualization of a calorimeter event data in 2D.
std::vector< TEveCaloData::vCellId_t * > vBinCells_t
A central manager for calorimeter event data.
std::vector< CellId_t > vCellId_t
static Float_t EtaToTheta(Float_t eta)
std::vector< CellId_t >::iterator vCellId_i
Exception class thrown by TEve classes and macros.
const char * what() const noexcept override
TGLColor & Selection(Int_t i)
const UChar_t * CArr() const
TObject * fExternalObj
first replica
TT * SetModelDynCast(TObject *obj)
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).
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.
Double_t Cos(Double_t)
Returns the cosine of an angle of x radians.
Double_t Sin(Double_t)
Returns the sine of an angle of x radians.
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
Cell data inner structure.
Float_t Value(Bool_t) const
Return energy value associated with the cell, usually Et.
Bool_t IsUpperRho() const