42REveCaloViz::REveCaloViz(
REveCaloData* data,
const char*
n,
const char* t) :
53 fPhiOffset(
TMath::Pi()),
174 using namespace TMath;
195 using namespace TMath;
213 using namespace TMath;
231 using namespace TMath;
244 if (data ==
fData)
return;
272 delta = 0.5*(max - min);
274 fPhi = 0.5*(max + min);
402 return TClass::GetClass<REveCalo2D>();
413 assert(
"fValueIsColor" &&
false);
435 j[
"sliceColors"] = nlohmann::json::array();
440 j[
"fSecondarySelect"] =
true;
456 fRnrEndCapFrame (
kTRUE),
457 fRnrBarrelFrame (
kTRUE),
459 fFrameColor (
kGray+1),
460 fFrameTransparency (80)
473 using namespace TMath;
474 Float_t z1, r1In, r1Out, z2, r2In, r2Out;
481 r1Out = z1*Tan(cellData.
ThetaMax());
482 r2Out = z2*Tan(cellData.
ThetaMax());
511 pnts[0] = r1Out*cos1;
512 pnts[1] = r1Out*sin1;
516 pnts[0] = r1Out*cos2;
517 pnts[1] = r1Out*sin2;
521 pnts[0] = r2Out*cos2;
522 pnts[1] = r2Out*sin2;
526 pnts[0] = r2Out*cos1;
527 pnts[1] = r2Out*sin1;
538 using namespace TMath;
541 float r2 = r1 + towerH*Sin(cellData.
ThetaMin());
542 float z1In, z1Out, z2In, z2Out;
545 z1Out = r2/Tan(cellData.
ThetaMax());
547 z2Out = r2/Tan(cellData.
ThetaMin());
549 float cos1 = Cos(cellData.
PhiMin());
550 float sin1 = Sin(cellData.
PhiMin());
551 float cos2 = Cos(cellData.
PhiMax());
552 float sin2 = Sin(cellData.
PhiMax());
596 offset += towerH*Sin(cellData.
ThetaMin());
612 Int_t prevTower = -1;
615 fRenderData = std::make_unique<REveRenderData>(
"makeCalo3D");
621 if (tower != prevTower)
670 auto sarr = nlohmann::json::array();
678 jsc[
"t"] = i->fTower;
679 jsc[
"s"] = i->fSlice;
680 jsc[
"f"] = i->fFraction;
685 nlohmann::json rec = {};
762 for(
UInt_t i = 0; i <
n; ++i) {
765 cids->clear();
delete cids;
772 for(
UInt_t i = 0; i <
n; ++i) {
775 cids->clear();
delete cids;
842 for (
Int_t ibin = 1; ibin <= nBins; ++ibin) {
860 for (
Int_t ibin = 1; ibin <= nBins; ++ibin) {
864 if (low >= min && up <= max)
884 for (
Int_t ibin = 1; ibin <= nBins; ++ibin) {
914 for (
vBinCells_i it = outputCellLists.begin(); it != outputCellLists.end(); it++)
922 outputCellLists.clear();
924 outputCellLists.resize(nBins+1);
926 outputCellLists[
b] = 0;
928 for(
UInt_t bin = 1; bin <= nBins; ++bin)
938 if( (*i).fTower == (*j).fTower && (*i).fSlice == (*j).fSlice)
940 if (!outputCellLists[bin])
943 outputCellLists[bin]->emplace_back((*i).fTower, (*i).fSlice, (*j).fFraction);
998 x = -
r,
y = 0, z = 0;
1009 x = 0,
y =
r, z = 0;
1012 x = 0,
y = -
r, z = 0;
1032 static const REveException eh(
"REveCalo2D::WriteCoreJsonSelection ");
1033 auto sarr = nlohmann::json::array();
1037 std::vector<REveCaloData::vCellId_t*> cellLists;
1046 for(
UInt_t phiBin = 1; phiBin <= nPhiBins; ++phiBin)
1048 if (cellLists[phiBin])
1052 delete[] sliceValRef;
1053 throw eh +
"selected cell not in cell list cache.";
1057 for (
Int_t s=0; s<nSlices; ++s) sliceVal[s] = 0;
1061 sliceVal[i->fSlice] += cellData.
Value(
fPlotEt)*(*i).fFraction;
1064 for (
Int_t s=0; s<nSlices; ++s) sliceValRef[s] = 0;
1068 sliceValRef[i->fSlice] += cellData.
Value(
fPlotEt)*(*i).fFraction;
1072 for (
Int_t s = 0; s < nSlices; ++s) {
1073 if (sliceVal[s] > 0)
1078 jsc[
"f"] = sliceVal[s]/sliceValRef[s];
1079 sarr.push_back(jsc);
1090 std::vector<Float_t> sliceValsUp(nSlices, 0.);
1091 std::vector<Float_t> sliceValsLow(nSlices, 0.);
1092 std::vector<Float_t> sliceValsUpRef(nSlices, 0.);
1093 std::vector<Float_t> sliceValsLowRef(nSlices, 0.);
1095 Float_t towerH, towerHRef, offUp, offLow;
1098 for (
UInt_t etaBin = 1; etaBin <= nEtaBins; ++etaBin)
1100 if (cellLists[etaBin])
1103 throw(eh +
"selected cell not in cell list cache.");
1105 offUp = 0; offLow =0;
1107 for (
Int_t s = 0; s < nSlices; ++s) {
1108 sliceValsUp[s] = sliceValsLow[s] = 0.;
1114 sliceValsUp [i->fSlice] += cellData.
Value(
fPlotEt)*(*i).fFraction;
1116 sliceValsLow[i->fSlice] += cellData.
Value(
fPlotEt)*(*i).fFraction;
1120 for (
Int_t s = 0; s < nSlices; ++s)
1122 sliceValsUpRef[s] = sliceValsLowRef[s] = 0;
1129 sliceValsUpRef [i->fSlice] += cellData.
Value(
fPlotEt)*(*i).fFraction;
1131 sliceValsLowRef[i->fSlice] += cellData.
Value(
fPlotEt)*(*i).fFraction;
1134 for (
Int_t s = 0; s < nSlices; ++s)
1138 if (sliceValsUp[s] > 0) {
1143 jsc[
"f"] = sliceValsUp[s]/sliceValsUpRef[s];
1144 sarr.push_back(jsc);
1150 if (sliceValsLow[s] > 0) {
1153 jsc[
"b"] =
Int_t(-etaBin);
1155 jsc[
"f"] = sliceValsLow[s]/sliceValsLowRef[s];
1156 sarr.push_back(jsc);
1158 offLow += towerHRef;
1164 nlohmann::json rec = {};
1166 rec[
"cells"] = sarr;
1180 if ((*it) && (*it)->empty())
1186 if (isEmpty)
return;
1188 fRenderData = std::make_unique<REveRenderData>(
"makeCalo2D");
1215 for (
UInt_t etaBin = 1; etaBin <= nEta; ++etaBin)
1229 for (
Int_t s = 0; s < nSlices; ++s) {
1230 sliceValsUp [s] = 0;
1231 sliceValsLow[s] = 0;
1239 sliceValsUp [it->fSlice] += cellData.
Value(
fPlotEt)*(*it).fFraction;
1241 sliceValsLow[it->fSlice] += cellData.
Value(
fPlotEt)*(*it).fFraction;
1244 isBarrel = !(etaMax > 0 && etaMax > transEtaF) && !(etaMin < 0 && etaMin < transEtaB);
1245 for (
Int_t s = 0; s < nSlices; ++s)
1259 if (sliceValsLow[s])
1274 delete [] sliceValsUp;
1275 delete [] sliceValsLow;
1284 using namespace TMath;
1297 pnts[0] = r1*sin1; pnts[1] = r1*cos1;
1298 pnts[2] = r2*sin1; pnts[3] = r2*cos1;
1299 pnts[4] = r2*sin2; pnts[5] = r2*cos2;
1300 pnts[6] = r1*sin2; pnts[7] = r1*cos2;
1308 if (thetaMax >= transThetaB)
1310 Float_t r1 = zE/Abs(Cos(0.5f*(thetaMin+thetaMax))) + offset;
1313 pnts[0] = r1*sin1; pnts[1] = r1*cos1;
1314 pnts[2] = r2*sin1; pnts[3] = r2*cos1;
1315 pnts[4] = r2*sin2; pnts[5] = r2*cos2;
1316 pnts[6] = r1*sin2; pnts[7] = r1*cos2;
1321 for (
Int_t i = 0; i < 4; ++i)
1324 y = phiPlus ? Abs(pnts[2*i]) : -Abs(pnts[2*i]);
1328 int j = phiPlus ? i : (3 -i);
1330 pntsOut[j*3 + 1] =
y;
1331 pntsOut[j*3 + 2] = z;
1349 for(
UInt_t phiBin = 1; phiBin <= nPhi; ++phiBin)
1355 for (
Int_t s=0; s<nSlices; ++s)
1363 sliceVal[(*it).fSlice] += cellData.
Value(
fPlotEt)*(*it).fFraction;
1365 for (
Int_t s = 0; s < nSlices; ++s)
1388 using namespace TMath;
1394 pnts[0] = r1*Cos(phiMin); pnts[1] = r1*Sin(phiMin);
1395 pnts[2] = r2*Cos(phiMin); pnts[3] = r2*Sin(phiMin);
1396 pnts[4] = r2*Cos(phiMax); pnts[5] = r2*Sin(phiMax);
1397 pnts[6] = r1*Cos(phiMax); pnts[7] = r1*Sin(phiMax);
1400 for (
Int_t i = 0; i < 4; ++i)
1402 pntsOut[i*3] = pnts[2*i];
1403 pntsOut[i*3+1] = pnts[2*i+1];
1404 pntsOut[i*3+2] = 0.f;
1414 bool is_upper = bin >= 0;
1420 if ((*it).fSlice == slice)
1452 fPlaneColor(
kRed-5),
1453 fPlaneTransparency(60),
1470 fHasFixedHeightIn2DMode(
kFALSE),
1471 fFixedHeightValIn2DMode(0.f),
1473 fDrawNumberCellPixels(18),
1474 fCellPixelFontSize(12)
virtual void AddNiece(REveElement *el)
void BuildRenderData() override
Creates 2D point array for rendering.
void SetProjection(REveProjectionManager *proj, REveProjectable *model) override
Set projection manager and model object.
void MakeRhoZCell(Float_t thetaMin, Float_t thetaMax, Float_t &offset, Bool_t isBarrel, Bool_t phiPlus, Float_t towerH, float *pntsOut) const
Get cell vertices in RhoZ projection.
void BuildRenderDataRPhi()
Creates 2D point array in RPhi() projection.
bool IsRPhi() const
Is current projection type RPhi.
void WriteCoreJsonSelection(nlohmann::json &j, REveCaloData::vCellId_t) override
Fill core part of JSON representation for selection.
void ComputeBBox() override
Fill bounding-box information of the base-class TAttBBox (virtual method).
std::vector< REveCaloData::vCellId_t * >::iterator vBinCells_i
void NewBinPicked(Int_t bin, Int_t slice, Int_t selectionId, Bool_t multi)
Client callback.
void CellSelectionChangedInternal(REveCaloData::vCellId_t &cells, std::vector< REveCaloData::vCellId_t * > &cellLists)
s////////////////////////////////// Sort selected cells in eta or phi bins.
REveProjection::EPType_e fOldProjectionType
REveCalo2D(const char *n="REveCalo2D", const char *t="")
Constructor.
void UpdateProjection() override
This is virtual method from base-class REveProjected.
Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override
Fill core part of JSON representation.
std::vector< REveCaloData::vCellId_t * > fCellLists
std::vector< REveCaloData::vCellId_t * > fCellListsSelected
void BuildCellIdCache() override
Build lists of drawn cell IDs. See REveCalo2DGL::DirecDraw().
void BuildRenderDataRhoZ()
Creates 2D point array in RhoZ projection.
virtual ~REveCalo2D()
Destructor.
Float_t GetValToHeight() const override
Virtual function of REveCaloViz.
void MakeRPhiCell(Float_t phiMin, Float_t phiMax, Float_t towerH, Float_t offset, float *pntsOut) const
Calculate vertices for the calorimeter cell in RPhi projection.
void SetScaleAbs(Bool_t) override
Set absolute scale in projected calorimeter.
Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override
Fill core part of JSON representation.
void ComputeBBox() override
Fill bounding-box information of the base-class TAttBBox (virtual method).
void MakeBarrelCell(const REveCaloData::CellGeom_t &cellData, float towerH, Float_t &offset, float *pnts) const
Make endcap cell.
void MakeEndCapCell(const REveCaloData::CellGeom_t &cellData, float towerH, Float_t &offset, float *pnts) const
Make endcap cell.
REveCalo3D(REveCaloData *d=0, const char *n="REveCalo3D", const char *t="")
Constructor.
void WriteCoreJsonSelection(nlohmann::json &j, REveCaloData::vCellId_t) override
Fill core part of JSON representation for selection.
void BuildRenderData() override
Crates 3D point array for rendering.
void BuildCellIdCache() override
Build list of drawn cell IDs. See REveCalo3DGL::DirectDraw().
void NewTowerPicked(Int_t tower, Int_t slice, Int_t selectionId, Bool_t multi)
Client selection callback.
REveCaloData::vCellId_t fCellList
Color_t GetSliceColor(Int_t slice) const
Get color for given slice.
virtual Float_t GetMaxVal(Bool_t et) const
std::vector< CellId_t >::iterator vCellId_i
void SetSliceThreshold(Int_t slice, Float_t threshold)
Set threshold for given slice.
virtual void GetCellData(const CellId_t &id, CellData_t &data) const =0
virtual TAxis * GetEtaBins() const
static Float_t EtaToTheta(Float_t eta)
virtual Float_t GetEps() const
void ProcessSelection(vCellId_t &sel_cells, UInt_t selectionId, Bool_t multi)
Process newly selected cells with given select-record.
SliceInfo_t & RefSliceInfo(Int_t s)
virtual void GetEtaLimits(Double_t &min, Double_t &max) const =0
virtual void GetCellList(Float_t etaMin, Float_t etaMax, Float_t phi, Float_t phiRng, vCellId_t &out) const =0
virtual TAxis * GetPhiBins() const
std::vector< CellId_t > vCellId_t
void SetSliceColor(Int_t slice, Color_t col)
Set color for given slice.
virtual void GetPhiLimits(Double_t &min, Double_t &max) const =0
void BuildCellIdCache() override
Build list of drawn cell IDs. For more information see REveCaloLegoGL:DirectDraw().
virtual void SetData(REveCaloData *d)
void ComputeBBox() override
Fill bounding-box information of the base-class TAttBBox (virtual method).
REveCaloData::vCellId_t fCellList
REveCaloLego(REveCaloData *data=0, const char *n="REveCaloLego", const char *t="")
Constructor.
Float_t GetPhiMax() const
Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override
Fill core part of JSON representation.
virtual REveElement * ForwardSelection()
Management of selection state and ownership of selected cell list is done in REveCaloData.
Float_t GetPhiRng() const
Float_t GetBarrelRadius() const
Float_t GetEtaMin() const
Float_t GetMaxVal() const
Float_t GetEtaMax() const
Float_t GetBackwardEndCapPos() const
void SetPlotEt(Bool_t x)
Set E/Et plot.
Float_t GetTransitionTheta() const
Get transition angle between barrel and end-cap cells, assuming fEndCapPosF = -fEndCapPosB.
virtual void BuildCellIdCache()=0
void SetPalette(REveRGBAPalette *p)
Set REveRGBAPalette object pointer.
Float_t GetPhiMin() const
virtual void SetScaleAbs(Bool_t x)
Float_t GetTransitionEtaForward() const
Get transition eta between barrel and forward end-cap cells.
void DataChanged()
Update setting and cache on data changed.
void SetDataSliceColor(Int_t slice, Color_t col)
Set slice color in data.
Float_t GetTransitionEta() const
Get transition eta between barrel and end-cap cells, assuming fEndCapPosF = -fEndCapPosB.
Color_t GetDataSliceColor(Int_t slice) const
Get slice color from data.
Float_t GetTransitionEtaBackward() const
Get transition eta between barrel and backward end-cap cells.
Bool_t AssertCellIdCache() const
Assert cell id cache is ok.
void SetPhiWithRng(Float_t x, Float_t r)
Set phi range.
virtual ~REveCaloViz()
Destructor.
virtual Float_t GetValToHeight() const
Get transformation factor from E/Et to height.
TClass * ProjectedClass(const REveProjection *p) const override
Virtual from REveProjectable, returns REveCalo2D class.
Float_t GetDataSliceThreshold(Int_t slice) const
Get threshold for given slice.
Float_t GetForwardEndCapPos() const
Bool_t CellInEtaPhiRng(REveCaloData::CellData_t &) const
Returns true if given cell is in the ceta phi range.
void SetupHeight(Float_t value, Int_t slice, Float_t &height) const
Set color and height for a given value and slice using slice color or REveRGBAPalette.
Float_t GetEtaRng() const
Float_t GetTransitionThetaForward() const
Get transition angle between barrel and forward end-cap cells.
void SetData(REveCaloData *d)
Set calorimeter event data.
void InvalidateCellIdCache()
Float_t GetTransitionThetaBackward() const
Get transition angle between barrel and backward end-cap cells.
void AssignCaloVizParameters(REveCaloViz *cv)
Assign parameters from given model.
virtual REveElement * ForwardEdit()
Management of selection state and ownership of selected cell list is done in REveCaloData.
void SetDataSliceThreshold(Int_t slice, Float_t val)
Set threshold for given slice.
REveRGBAPalette * fPalette
REveRGBAPalette * AssertPalette()
Make sure the REveRGBAPalette pointer is not null.
void SetEta(Float_t l, Float_t u)
Set eta range.
void SetNameTitle(const std::string &name, const std::string &title)
Set name and title of an element.
Bool_t fCanEditMainTransparency
virtual Int_t WriteCoreJson(nlohmann::json &cj, Int_t rnr_offset)
Write core json.
std::unique_ptr< REveRenderData > fRenderData
Externally assigned and controlled user data.
ElementId_t GetElementId() const
REveException Exception-type thrown by Eve classes.
virtual void SetProjection(REveProjectionManager *mng, REveProjectable *model)
Sets projection manager and reference in the projectable object.
REveProjectionManager * fManager
REveProjectionManager Manager class for steering of projections and managing projected objects.
REveProjection * GetProjection()
REveProjection Base for specific classes that implement non-linear projections.
virtual void ProjectPoint(Float_t &x, Float_t &y, Float_t &z, Float_t d, EPProc_e p=kPP_Full)=0
Color_t GetDefaultColor() const
void SetMin(Int_t min)
Set current min value.
Bool_t GetInterpolate() const
void SetMax(Int_t max)
Set current max value.
void SetLimits(Int_t low, Int_t high)
Set low/high limits on signal value.
void SetDefaultColor(Color_t ci)
Set default color.
static Bool_t IsU1IntervalOverlappingByMinMax(Float_t minM, Float_t maxM, Float_t minQ, Float_t maxQ)
Return true if interval Q is overlapping within interval M for U1 variables.
static Bool_t IsU1IntervalContainedByMinMax(Float_t minM, Float_t maxM, Float_t minQ, Float_t maxQ)
Return true if interval Q is contained within interval M for U1 variables.
void BBoxCheckPoint(Float_t x, Float_t y, Float_t z)
void BBoxZero(Float_t epsilon=0, Float_t x=0, Float_t y=0, Float_t z=0)
Create cube of volume (2*epsilon)^3 at (x,y,z).
void BBoxInit(Float_t infinity=1e6)
Dynamic Float_t[6] X(min,max), Y(min,max), Z(min,max)
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 GetBinWidth(Int_t bin) const
Return bin width.
virtual Double_t GetBinUpEdge(Int_t bin) const
Return up edge of bin.
TClass instances represent classes, structs and namespaces in the ROOT type system.
Short_t Max(Short_t a, Short_t b)
Int_t CeilNint(Double_t x)
Float_t Value(Bool_t) const
Return energy value associated with the cell, usually Et.
Bool_t IsUpperRho() const