21#include "TGLIncludes.h"
74 using namespace TMath;
81 pnts[0] = r1*
Cos(phiMin); pnts[1] = r1*
Sin(phiMin);
82 pnts[2] = r2*
Cos(phiMin); pnts[3] = r2*
Sin(phiMin);
83 pnts[4] = r2*
Cos(phiMax); pnts[5] = r2*
Sin(phiMax);
84 pnts[6] = r1*
Cos(phiMax); pnts[7] = r1*
Sin(phiMax);
88 for (
Int_t i = 0; i < 4; ++i)
93 fM->fManager->GetProjection()->ProjectPoint(
x,
y, z,
fM->fDepth);
105 Int_t nSlices = data->GetNSlices();
110 UInt_t nPhi = data->GetPhiBins()->GetNbins();
111 TAxis* axis = data->GetPhiBins();
112 for(
UInt_t phiBin = 1; phiBin <= nPhi; ++phiBin)
114 if (cellLists[phiBin] )
118 for (
Int_t s=0; s<nSlices; ++s)
125 data->GetCellData(*it, cellData);
126 sliceVal[(*it).fSlice] += cellData.
Value(
fM->fPlotEt)*(*it).fFraction;
133 for (
Int_t s = 0; s < nSlices; ++s)
136 fM->SetupColorHeight(sliceVal[s], s, towerH);
152 static const TEveException eh(
"TEveCalo2DGL::DrawRPhiHighlighted ");
156 Int_t nSlices = data->GetNSlices();
157 UInt_t nPhiBins = data->GetPhiBins()->GetNbins();
162 TAxis* axis = data->GetPhiBins();
163 for(
UInt_t phiBin = 1; phiBin <= nPhiBins; ++phiBin)
165 if (cellLists[phiBin])
167 if (!
fM->fCellLists[phiBin]) {
169 delete[] sliceValRef;
170 throw eh +
"selected cell not in cell list cache.";
175 for (
Int_t s=0; s<nSlices; ++s) sliceVal[s] = 0;
178 data->GetCellData((*i), cellData);
179 sliceVal[i->fSlice] += cellData.
Value(
fM->fPlotEt)*(*i).fFraction;
182 for (
Int_t s=0; s<nSlices; ++s) sliceValRef[s] = 0;
185 data->GetCellData(*i, cellData);
186 sliceValRef[i->fSlice] += cellData.
Value(
fM->fPlotEt)*(*i).fFraction;
189 for (
Int_t s = 0; s < nSlices; ++s) {
190 fM->SetupColorHeight(sliceValRef[s], s, towerHRef);
193 fM->SetupColorHeight(sliceVal[s], s, towerH);
202 delete [] sliceValRef;
211 using namespace TMath;
222 Float_t r1 =
fM->fBarrelRadius/
Abs(
Sin(0.5f*(thetaMin+thetaMax))) + offset;
225 pnts[0] = r1*sin1; pnts[1] = r1*cos1;
226 pnts[2] = r2*sin1; pnts[3] = r2*cos1;
227 pnts[4] = r2*sin2; pnts[5] = r2*cos2;
228 pnts[6] = r1*sin2; pnts[7] = r1*cos2;
236 if (thetaMax >= transThetaB)
237 zE =
Abs(
fM->GetBackwardEndCapPos());
241 pnts[0] = r1*sin1; pnts[1] = r1*cos1;
242 pnts[2] = r2*sin1; pnts[3] = r2*cos1;
243 pnts[4] = r2*sin2; pnts[5] = r2*cos2;
244 pnts[6] = r1*sin2; pnts[7] = r1*cos2;
249 for (
Int_t i = 0; i < 4; ++i)
252 y = phiPlus ?
Abs(pnts[2*i]) : -
Abs(pnts[2*i]);
254 fM->fManager->GetProjection()->ProjectPoint(
x,
y, z,
fM->fDepth);
266 Int_t nSlices = data->GetNSlices();
273 Float_t transEtaF =
fM->GetTransitionEtaForward();
274 Float_t transEtaB =
fM->GetTransitionEtaBackward();
276 TAxis* axis = data->GetEtaBins();
278 for (
UInt_t etaBin = 1; etaBin <= nEta; ++etaBin)
280 if (cellLists[etaBin] )
282 assert(
fM->fCellLists[etaBin]);
291 for (
Int_t s = 0; s < nSlices; ++s) {
299 data->GetCellData(*it, cellData);
301 sliceValsUp [it->fSlice] += cellData.
Value(
fM->fPlotEt)*(*it).fFraction;
303 sliceValsLow[it->fSlice] += cellData.
Value(
fM->fPlotEt)*(*it).fFraction;
306 isBarrel = !(etaMax > 0 && etaMax > transEtaF) && !(etaMin < 0 && etaMin < transEtaB);
312 for (
Int_t s = 0; s < nSlices; ++s)
320 fM->SetupColorHeight(sliceValsUp[s], s, towerH);
328 fM->SetupColorHeight(sliceValsLow[s], s, towerH);
339 delete [] sliceValsUp;
340 delete [] sliceValsLow;
348 static const TEveException eh(
"TEveCalo2DGL::DrawRhoZHighlighted ");
351 TAxis* axis = data->GetEtaBins();
353 Int_t nSlices = data->GetNSlices();
354 Float_t transEtaF =
fM->GetTransitionEtaForward();
355 Float_t transEtaB =
fM->GetTransitionEtaBackward();
363 Float_t towerH, towerHRef, offUp, offLow;
366 for (
UInt_t etaBin = 1; etaBin <= nEtaBins; ++etaBin)
368 if (cellLists[etaBin])
370 if (!
fM->fCellLists[etaBin]) {
371 delete[] sliceValsUp;
372 delete[] sliceValsLow;
373 delete[] sliceValsUpRef;
374 delete[] sliceValsLowRef;
375 throw(eh +
"selected cell not in cell list cache.");
378 offUp = 0; offLow =0;
380 for (
Int_t s = 0; s < nSlices; ++s) {
381 sliceValsUp[s] = 0; sliceValsLow[s] = 0;
385 data->GetCellData(*i, cellData);
387 sliceValsUp [i->fSlice] += cellData.
Value(
fM->fPlotEt)*(*i).fFraction;
389 sliceValsLow[i->fSlice] += cellData.
Value(
fM->fPlotEt)*(*i).fFraction;
393 for (
Int_t s = 0; s < nSlices; ++s)
395 sliceValsUpRef[s] = 0; sliceValsLowRef[s] = 0;
400 data->GetCellData(*i, cellData);
402 sliceValsUpRef [i->fSlice] += cellData.
Value(
fM->fPlotEt)*(*i).fFraction;
404 sliceValsLowRef[i->fSlice] += cellData.
Value(
fM->fPlotEt)*(*i).fFraction;
408 isBarrel = !(bincenterEta > 0 && bincenterEta > transEtaF) && !(bincenterEta < 0 && bincenterEta < transEtaB);
410 for (
Int_t s = 0; s < nSlices; ++s)
415 fM->SetupColorHeight(sliceValsUpRef[s], s, towerHRef);
416 if (sliceValsUp[s] > 0) {
417 fM->SetupColorHeight(sliceValsUp[s], s, towerH);
423 fM->SetupColorHeight(sliceValsLowRef[s], s, towerHRef);
424 if (sliceValsLow[s] > 0) {
425 fM->SetupColorHeight(sliceValsLow[s], s, towerH);
433 delete [] sliceValsUp;
434 delete [] sliceValsLow;
435 delete [] sliceValsUpRef;
436 delete [] sliceValsLowRef;
447 glPushAttrib(GL_ENABLE_BIT | GL_POLYGON_BIT);
449 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
452 fM->BuildCellIdCache();
470 static const TEveException eh(
"TEveCalo2DGL::DrawHighlight ");
472 if (
fM->fData->GetCellsSelected().empty() &&
fM->fData->GetCellsHighlighted().empty())
482 if (!
fM->fData->GetCellsHighlighted().empty())
491 if (!
fM->fData->GetCellsSelected().empty())
520 it !=
fM->fCellLists[bin]->end(); ++it)
522 if ((*it).fSlice == slice)
530 assert(rec.
GetN() > 3);
533 fM->fData->GetCellData(*it, cd);
540 fM->fData->ProcessSelection(sel, rec);
int Int_t
Signed integer 4 bytes (int).
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
bool Bool_t
Boolean (0=false, 1=true) (bool).
float Float_t
Float 4 bytes (float).
const char Option_t
Option string (const char).
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
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.
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
! Also plays the role of ID.
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).
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.
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