Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
REveCalo.cxx
Go to the documentation of this file.
1// @(#)root/eve:$Id$
2// Author: Matevz Tadel 2007
3
4/*************************************************************************
5 * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#include "ROOT/REveCalo.hxx"
13#include "ROOT/REveCaloData.hxx"
17//#include "ROOT/REveText.hxx"
19#include "ROOT/REveTrans.hxx"
20
21#include "TClass.h"
22#include "TMathBase.h"
23#include "TMath.h"
24#include "TAxis.h"
25
26// #include "TGLUtil.h"
27
28#include <cassert>
29#include <iostream>
30
31using namespace ROOT::Experimental;
32
33/** \class REveCaloViz
34\ingroup REve
35Base class for calorimeter data visualization.
36See REveCalo2D and REveCalo3D for concrete implementations.
37*/
38
39
40////////////////////////////////////////////////////////////////////////////////
41
42REveCaloViz::REveCaloViz(REveCaloData* data, const char* n, const char* t) :
45
46 fData(0),
47 fCellIdCacheOK(kFALSE),
48
49 fEtaMin(-10),
50 fEtaMax(10),
51
52 fPhi(0.),
53 fPhiOffset(TMath::Pi()),
54
55 fAutoRange(kTRUE),
56
57 fBarrelRadius(-1.f),
58 fEndCapPosF(-1.f),
59 fEndCapPosB(-1.f),
60
61 fPlotEt(kTRUE),
62
63 fMaxTowerH(100),
64 fScaleAbs(kFALSE),
65 fMaxValAbs(100),
66
67 fValueIsColor(kFALSE),
68 fPalette(0)
69{
70 // Constructor.
71
73 SetNameTitle(n, t);
74 SetData(data);
75}
76
77////////////////////////////////////////////////////////////////////////////////
78/// Destructor.
79
81{
83}
84
85////////////////////////////////////////////////////////////////////////////////
86/// Get threshold for given slice.
87
89{
90 return fData->RefSliceInfo(slice).fThreshold;
91}
92
93////////////////////////////////////////////////////////////////////////////////
94/// Management of selection state and ownership of selected cell list
95/// is done in REveCaloData. This is a reason selection is forwarded to it.
96
98{
99 return fData;
100}
101
102////////////////////////////////////////////////////////////////////////////////
103/// Management of selection state and ownership of selected cell list
104/// is done in REveCaloData. We still want GUI editor to display
105/// concrete calo-viz object.
106
108{
109 return this;
110}
111
112////////////////////////////////////////////////////////////////////////////////
113/// Set threshold for given slice.
114
116{
117 fData->SetSliceThreshold(slice, val);
118}
119
120////////////////////////////////////////////////////////////////////////////////
121/// Get slice color from data.
122
124{
125 return fData->RefSliceInfo(slice).fColor;
126}
127
128////////////////////////////////////////////////////////////////////////////////
129/// Set slice color in data.
130
132{
133 fData->SetSliceColor(slice, col);
134}
135
136////////////////////////////////////////////////////////////////////////////////
137/// Set eta range.
138
140{
141 fEtaMin=l;
142 fEtaMax=u;
143
145}
146
147////////////////////////////////////////////////////////////////////////////////
148/// Set E/Et plot.
149
151{
152 fPlotEt=isEt;
153 if (fPalette)
155
157}
158
159////////////////////////////////////////////////////////////////////////////////
160
162{
163 // Get maximum plotted value.
164
165 return fData->GetMaxVal(fPlotEt);
166
167}
168
169////////////////////////////////////////////////////////////////////////////////
170/// Set phi range.
171
173{
174 using namespace TMath;
175
176 fPhi = phi;
177 fPhiOffset = rng;
178
180}
181
182////////////////////////////////////////////////////////////////////////////////
183/// Get transition angle between barrel and end-cap cells, assuming fEndCapPosF = -fEndCapPosB.
184
186{
188}
189
190////////////////////////////////////////////////////////////////////////////////
191/// Get transition eta between barrel and end-cap cells, assuming fEndCapPosF = -fEndCapPosB.
192
194{
195 using namespace TMath;
196 Float_t t = GetTransitionTheta()*0.5f;
197 return -Log(Tan(t));
198}
199
200////////////////////////////////////////////////////////////////////////////////
201/// Get transition angle between barrel and forward end-cap cells.
202
204{
206}
207
208////////////////////////////////////////////////////////////////////////////////
209/// Get transition eta between barrel and forward end-cap cells.
210
212{
213 using namespace TMath;
215 return -Log(Tan(t));
216}
217
218////////////////////////////////////////////////////////////////////////////////
219/// Get transition angle between barrel and backward end-cap cells.
220
222{
224}
225
226////////////////////////////////////////////////////////////////////////////////
227/// Get transition eta between barrel and backward end-cap cells.
228
230{
231 using namespace TMath;
233 //negative theta means negative eta
234 return Log(-Tan(t));
235}
236
237
238////////////////////////////////////////////////////////////////////////////////
239/// Set calorimeter event data.
240
242{
243
244 if (data == fData) return;
245 fData = data;
246 // SetSelectionMaster(data);
247 if (fData)
248 {
249 fData->AddNiece(this);
250 DataChanged();
251 }
252}
253
254////////////////////////////////////////////////////////////////////////////////
255/// Update setting and cache on data changed.
256/// Called from REvecaloData::BroadcastDataChange()
257
259{
260 Double_t min, max, delta;
261
262 fData->GetEtaLimits(min, max);
263 if (fAutoRange) {
264 fEtaMin = min;
265 fEtaMax = max;
266 } else {
267 if (fEtaMin < min) fEtaMin = min;
268 if (fEtaMax > max) fEtaMax = max;
269 }
270
271 fData->GetPhiLimits(min, max);
272 delta = 0.5*(max - min);
273 if (fAutoRange || fPhi < min || fPhi > max) {
274 fPhi = 0.5*(max + min);
275 fPhiOffset = delta;
276 } else {
277 if (fPhiOffset > delta) fPhiOffset = delta;
278 }
279
280 if (fPalette)
281 {
284 fPalette->SetMin(0);
286 }
287
289}
290
291////////////////////////////////////////////////////////////////////////////////
292/// Assert cell id cache is ok.
293/// Returns true if the cache has been updated.
294
296{
297 REveCaloViz* cv = const_cast<REveCaloViz*>(this);
298 if (!fCellIdCacheOK) {
299 cv->BuildCellIdCache();
300 return kTRUE;
301 } else {
302 return kFALSE;
303 }
304}
305
306////////////////////////////////////////////////////////////////////////////////
307/// Returns true if given cell is in the ceta phi range.
308
310{
311 if (cellData.EtaMin() >= fEtaMin && cellData.EtaMax() <= fEtaMax)
312 {
314 (fPhi-fPhiOffset, fPhi+fPhiOffset, cellData.PhiMin(), cellData.PhiMax()))
315 return kTRUE;
316 }
317 return kFALSE;
318}
319
320////////////////////////////////////////////////////////////////////////////////
321/// Assign parameters from given model.
322
324{
325 SetData(m->fData);
326
327 fEtaMin = m->fEtaMin;
328 fEtaMax = m->fEtaMax;
329
330 fPhi = m->fPhi;
331 fPhiOffset = m->fPhiOffset;
332
333 fBarrelRadius = m->fBarrelRadius;
334 fEndCapPosF = m->fEndCapPosF;
335 fEndCapPosB = m->fEndCapPosB;
336
337 if (m->fPalette)
338 {
339 REveRGBAPalette& mp = * m->fPalette;
343 }
344}
345
346////////////////////////////////////////////////////////////////////////////////
347/// Set REveRGBAPalette object pointer.
348
350{
351 if ( fPalette == p) return;
353 fPalette = p;
355}
356
357////////////////////////////////////////////////////////////////////////////////
358/// Get transformation factor from E/Et to height
359
361{
362 if (fScaleAbs)
363 {
364 return fMaxTowerH/fMaxValAbs;
365 }
366 else
367 {
368 if (fData->Empty()) {
369 assert(false);
370 return 1;
371 }
373 }
374}
375
376////////////////////////////////////////////////////////////////////////////////
377/// Make sure the REveRGBAPalette pointer is not null.
378/// If it is not set, a new one is instantiated and the range is set
379/// to current min/max signal values.
380
382{
383 if (fPalette == 0) {
386
389 fPalette->SetMin(0);
391
392 }
393 return fPalette;
394}
395
396
397////////////////////////////////////////////////////////////////////////////////
398/// Virtual from REveProjectable, returns REveCalo2D class.
399
401{
402 return TClass::GetClass<REveCalo2D>();
403}
404
405////////////////////////////////////////////////////////////////////////////////
406/// Set color and height for a given value and slice using slice color or REveRGBAPalette.
407
408void REveCaloViz::SetupHeight(Float_t value, Int_t /*slice*/, Float_t& outH) const
409{
410 if (fValueIsColor)
411 {
413 assert("fValueIsColor" && false);
414 // UChar_t c[4];
415 // fPalette->ColorFromValue((Int_t)value, c);
416 // c[3] = fData->GetSliceTransparency(slice);
417 // TGLUtil::Color4ubv(c);
418 }
419 else
420 {
421 // TGLUtil::ColorTransparency(fData->GetSliceColor(slice), fData->GetSliceTransparency(slice));
422 outH = GetValToHeight()*value;
423 }
424}
425///////////////////////////////////////////////////////////////////////////////
426/// Fill core part of JSON representation.
427
428Int_t REveCaloViz::WriteCoreJson(nlohmann::json &j, Int_t rnr_offset)
429{
430 // The slice colors need to be streamed becuse at EveElement contruction time, streamed caloData
431 // is not available. Maybe this is not necessary if EveElements have EveManager globaly available
432
433 Int_t ret = REveElement::WriteCoreJson(j, rnr_offset);
434 j["dataId"] = fData->GetElementId();
435 j["sliceColors"] = nlohmann::json::array();
436 for (int i = 0; i < fData->GetNSlices(); ++i)
437 {
438 j["sliceColors"].push_back(fData->GetSliceColor(i));
439 }
440 j["fSecondarySelect"] = true;
441 return ret;
442}
443
444/** \class REveCalo3D
445\ingroup REve
446Visualization of a calorimeter event data in 3D.
447*/
448
449
450////////////////////////////////////////////////////////////////////////////////
451/// Constructor.
452
453REveCalo3D::REveCalo3D(REveCaloData* d, const char* n, const char* t):
454 REveCaloViz(d, n, t),
455
456 fRnrEndCapFrame (kTRUE),
457 fRnrBarrelFrame (kTRUE),
458 fFrameWidth (0.5),
459 fFrameColor (kGray+1),
460 fFrameTransparency (80)
461{
465}
466
467
468////////////////////////////////////////////////////////////////////////////////
469/// Make endcap cell
470//
471void REveCalo3D::MakeEndCapCell(const REveCaloData::CellGeom_t &cellData, float towerH, Float_t& offset, float *pnts) const
472{
473 using namespace TMath;
474 Float_t z1, r1In, r1Out, z2, r2In, r2Out;
475
476 z1 = (cellData.EtaMin()<0) ? fEndCapPosB - offset : fEndCapPosF + offset;
477 z2 = z1 + TMath::Sign(towerH, cellData.EtaMin());
478
479 r1In = z1*Tan(cellData.ThetaMin());
480 r2In = z2*Tan(cellData.ThetaMin());
481 r1Out = z1*Tan(cellData.ThetaMax());
482 r2Out = z2*Tan(cellData.ThetaMax());
483
484 Float_t cos2 = Cos(cellData.PhiMin());
485 Float_t sin2 = Sin(cellData.PhiMin());
486 Float_t cos1 = Cos(cellData.PhiMax());
487 Float_t sin1 = Sin(cellData.PhiMax());
488
489 // 0
490 pnts[0] = r1In*cos1;
491 pnts[1] = r1In*sin1;
492 pnts[2] = z1;
493 pnts += 3;
494 // 1
495 pnts[0] = r1In*cos2;
496 pnts[1] = r1In*sin2;
497 pnts[2] = z1;
498 pnts += 3;
499 // 2
500 pnts[0] = r2In*cos2;
501 pnts[1] = r2In*sin2;
502 pnts[2] = z2;
503 pnts += 3;
504 // 3
505 pnts[0] = r2In*cos1;
506 pnts[1] = r2In*sin1;
507 pnts[2] = z2;
508 pnts += 3;
509 //---------------------------------------------------
510 // 4
511 pnts[0] = r1Out*cos1;
512 pnts[1] = r1Out*sin1;
513 pnts[2] = z1;
514 pnts += 3;
515 // 5
516 pnts[0] = r1Out*cos2;
517 pnts[1] = r1Out*sin2;
518 pnts[2] = z1;
519 pnts += 3;
520 // 6s
521 pnts[0] = r2Out*cos2;
522 pnts[1] = r2Out*sin2;
523 pnts[2] = z2;
524 pnts += 3;
525 // 7
526 pnts[0] = r2Out*cos1;
527 pnts[1] = r2Out*sin1;
528 pnts[2] = z2;
529
530 offset += towerH;
531}
532
533////////////////////////////////////////////////////////////////////////////////
534/// Make endcap cell
535//
536void REveCalo3D::MakeBarrelCell(const REveCaloData::CellGeom_t &cellData, float towerH, Float_t& offset, float *pnts) const
537{
538 using namespace TMath;
539
540 float r1 = GetBarrelRadius() + offset;
541 float r2 = r1 + towerH*Sin(cellData.ThetaMin());
542 float z1In, z1Out, z2In, z2Out;
543
544 z1In = r1/Tan(cellData.ThetaMax());
545 z1Out = r2/Tan(cellData.ThetaMax());
546 z2In = r1/Tan(cellData.ThetaMin());
547 z2Out = r2/Tan(cellData.ThetaMin());
548
549 float cos1 = Cos(cellData.PhiMin());
550 float sin1 = Sin(cellData.PhiMin());
551 float cos2 = Cos(cellData.PhiMax());
552 float sin2 = Sin(cellData.PhiMax());
553
554 // 0
555 pnts[0] = r1*cos2;
556 pnts[1] = r1*sin2;
557 pnts[2] = z1In;
558 pnts += 3;
559 // 1
560 pnts[0] = r1*cos1;
561 pnts[1] = r1*sin1;
562 pnts[2] = z1In;
563 pnts += 3;
564 // 2
565 pnts[0] = r1*cos1;
566 pnts[1] = r1*sin1;
567 pnts[2] = z2In;
568 pnts += 3;
569 // 3
570 pnts[0] = r1*cos2;
571 pnts[1] = r1*sin2;
572 pnts[2] = z2In;
573 pnts += 3;
574 //---------------------------------------------------
575 // 4
576 pnts[0] = r2*cos2;
577 pnts[1] = r2*sin2;
578 pnts[2] = z1Out;
579 pnts += 3;
580 // 5
581 pnts[0] = r2*cos1;
582 pnts[1] = r2*sin1;
583 pnts[2] = z1Out;
584 pnts += 3;
585 // 6
586 pnts[0] = r2*cos1;
587 pnts[1] = r2*sin1;
588 pnts[2] = z2Out;
589 pnts += 3;
590 // 7
591 pnts[0] = r2*cos2;
592 pnts[1] = r2*sin2;
593 pnts[2] = z2Out;
594
595
596 offset += towerH*Sin(cellData.ThetaMin());
597
598}
599
600////////////////////////////////////////////////////////////////////////////////
601/// Crates 3D point array for rendering.
602
604{
606 if (fCellList.empty())
607 return;
608
610 Float_t towerH = 0;
611 Int_t tower = 0;
612 Int_t prevTower = -1;
613 Float_t offset = 0;
614
615 fRenderData = std::make_unique<REveRenderData>("makeCalo3D");
616 float pnts[24];
617 for (REveCaloData::vCellId_i i = fCellList.begin(); i != fCellList.end(); ++i)
618 {
619 fData->GetCellData((*i), cellData);
620 tower = i->fTower;
621 if (tower != prevTower)
622 {
623 offset = 0;
624 prevTower = tower;
625 }
626 // fOffset[cellID] = offset; this is needed to be stored for selection
627
628 SetupHeight(cellData.Value(fPlotEt), (*i).fSlice, towerH);
629
630 if ((cellData.Eta() > 0 && cellData.Eta() < GetTransitionEtaForward()) ||
631 (cellData.Eta() < 0 && cellData.Eta() > GetTransitionEtaBackward()))
632 {
633 MakeBarrelCell(cellData, towerH, offset, pnts);
634 }
635 else
636 {
637 MakeEndCapCell(cellData, towerH, offset, pnts);
638 }
639 /*
640 printf(" REveCalo3D::BuildRenderData push box vertces -------------------------\n");
641 for (int t = 0; t < 8; ++t)
642 {
643 printf("(%f %f %f)\n", pnts[t*3], pnts[t*3+1], pnts[t*3+2] );
644 }
645 */
646 fRenderData->PushV(pnts, 24);
647
648 // REveCaloData::SliceInfo_t& sliceInfo = fData->RefSliceInfo(i->fSlice);
649 fRenderData->PushI( i->fSlice);
650 fRenderData->PushI( i->fTower);
651 fRenderData->PushN(cellData.Value(fPlotEt));
652 }
653}
654
655
656////////////////////////////////////////////////////////////////////////////////
657/// Fill core part of JSON representation.
658
659Int_t REveCalo3D::WriteCoreJson(nlohmann::json &j, Int_t rnr_offset)
660{
661 return REveCaloViz::WriteCoreJson(j, rnr_offset);
662}
663
664////////////////////////////////////////////////////////////////////////////////
665/// Fill core part of JSON representation for selection.
666
668{
669 // selection
670 auto sarr = nlohmann::json::array();
672 for (REveCaloData::vCellId_i i = cells.begin(); i != cells.end(); i++)
673 {
674 fData->GetCellData(*i, cellData);
675 if (CellInEtaPhiRng(cellData))
676 {
677 nlohmann::json jsc;
678 jsc["t"] = i->fTower;
679 jsc["s"] = i->fSlice;
680 jsc["f"] = i->fFraction;
681 sarr.push_back(jsc);
682 }
683 }
684
685 nlohmann::json rec = {};
686 rec["caloVizId"] = GetElementId();
687 rec["cells"] = sarr;
688
689 j.push_back(rec);
690}
691
692
693////////////////////////////////////////////////////////////////////////////////
694/// Build list of drawn cell IDs. See REveCalo3DGL::DirectDraw().
695
697{
698 fCellList.clear();
699
702}
703
704////////////////////////////////////////////////////////////////////////////////
705/// Fill bounding-box information of the base-class TAttBBox (virtual method).
706/// If member 'REveFrameBox* fFrame' is set, frame's corners are used as bbox.
707
709{
710 BBoxInit();
711
713
714 fBBox[0] = -fBarrelRadius - th;
715 fBBox[1] = fBarrelRadius + th;
716 fBBox[2] = fBBox[0];
717 fBBox[3] = fBBox[1];
718 fBBox[4] = fEndCapPosB - th;
719 fBBox[5] = fEndCapPosF + th;
720}
721
722/** \class REveCalo2D
723\ingroup REve
724Visualization of a calorimeter event data in 2D.
725*/
726
727////////////////////////////////////////////////////////////////////////////////
728/// Client selection callback
729
730void REveCalo3D::NewTowerPicked(Int_t tower, Int_t slice, Int_t selectionId, bool multi)
731{
732 REveCaloData::CellId_t cell(tower, slice, 1.0f);
734
735 sel.push_back(cell);
736 fData->ProcessSelection(sel, selectionId, multi);
737}
738
739
740////////////////////////////////////////////////////////////////////////////////
741/// Constructor.
742
743REveCalo2D::REveCalo2D(const char* n, const char* t):
744 REveCaloViz(0, n, t),
746 fOldProjectionType(REveProjection::kPT_Unknown),
747 fMaxESumBin( 0),
748 fMaxEtSumBin(0)
749{
750}
751
752////////////////////////////////////////////////////////////////////////////////
753/// Destructor.
754
756{
758 UInt_t n;
759
760 // clear selected cell ids
761 n = fCellListsSelected.size();
762 for(UInt_t i = 0; i < n; ++i) {
763 cids = fCellListsSelected[i];
764 if (cids) {
765 cids->clear(); delete cids;
766 }
767 }
768 fCellListsSelected.clear();
769
770 // clear all cell dds
771 n = fCellLists.size();
772 for(UInt_t i = 0; i < n; ++i) {
773 cids = fCellLists[i];
774 if (cids) {
775 cids->clear(); delete cids;
776 }
777 }
778 fCellLists.clear();
779}
780
781////////////////////////////////////////////////////////////////////////////////
782/// This is virtual method from base-class REveProjected.
783
785{
787 {
790 }
791 ComputeBBox();
792}
793
794////////////////////////////////////////////////////////////////////////////////
795/// Set projection manager and model object.
796
798{
800 REveCaloViz* viz = dynamic_cast<REveCaloViz*>(model);
802}
803
804////////////////////////////////////////////////////////////////////////////////
805/// Is current projection type RPhi
806
808{
810}
811
812////////////////////////////////////////////////////////////////////////////////
813/// Build lists of drawn cell IDs. See REveCalo2DGL::DirecDraw().
814
816{
817 // clear old cache
818 for (vBinCells_i it = fCellLists.begin(); it != fCellLists.end(); it++)
819 {
820 if (*it)
821 {
822 (*it)->clear();
823 delete *it;
824 }
825 }
826 fCellLists.clear();
827 fCellLists.push_back(0);
828
830 REveCaloData::vCellId_t* clv; // ids per phi bin in r-phi projection else ids per eta bins in rho-z projection
831
832 Bool_t isRPhi = (pt == REveProjection::kPT_RPhi);
833
834 const TAxis* axis = isRPhi ? fData->GetPhiBins() : fData->GetEtaBins();
835 Int_t nBins = axis->GetNbins();
836
837 Float_t min, max;
838 if (isRPhi)
839 {
840 min = GetPhiMin() - fData->GetEps();
841 max = GetPhiMax() + fData->GetEps();
842 for (Int_t ibin = 1; ibin <= nBins; ++ibin) {
843 clv = 0;
845 (min, max, axis->GetBinLowEdge(ibin), axis->GetBinUpEdge(ibin)))
846 {
847 clv = new REveCaloData::vCellId_t();
848 fData->GetCellList(GetEta(), GetEtaRng(), axis->GetBinCenter(ibin), axis->GetBinWidth(ibin), *clv);
849 if (!clv->size()) {
850 delete clv; clv = 0;
851 }
852 }
853 fCellLists.push_back(clv);
854 }
855 }
856 else
857 {
858 min = GetEtaMin() - fData->GetEps();
859 max = GetEtaMax() + fData->GetEps();
860 for (Int_t ibin = 1; ibin <= nBins; ++ibin) {
861 clv = 0;
862 Float_t low = axis->GetBinLowEdge(ibin);
863 Float_t up = axis->GetBinUpEdge(ibin) ;
864 if (low >= min && up <= max)
865 {
866 clv = new REveCaloData::vCellId_t();
867 fData->GetCellList(axis->GetBinCenter(ibin), axis->GetBinWidth(ibin), fPhi, GetPhiRng(), *clv);
868 if (!clv->size()) {
869 delete clv; clv = 0;
870 }
871 }
872 fCellLists.push_back(clv);
873 }
874 }
875
876 // cache max bin sum for auto scale
877 if (!fScaleAbs)
878 {
879 fMaxESumBin = 0;
880 fMaxEtSumBin = 0;
881 Float_t sumE = 0;
882 Float_t sumEt = 0;
884 for (Int_t ibin = 1; ibin <= nBins; ++ibin) {
886 if (cids)
887 {
888 sumE = 0; sumEt = 0;
889 for (REveCaloData::vCellId_i it = cids->begin(); it != cids->end(); it++)
890 {
891 fData->GetCellData(*it, cellData);
892 sumE += cellData.Value(kFALSE);
893 sumEt += cellData.Value(kTRUE);
894 }
897 }
898 }
899 ComputeBBox();
900 }
901
903}
904
905//////////////////////////////////////////////s//////////////////////////////////
906/// Sort selected cells in eta or phi bins.
907
908void REveCalo2D::CellSelectionChangedInternal(REveCaloData::vCellId_t& inputCells, std::vector<REveCaloData::vCellId_t*>& outputCellLists)
909{
911 const TAxis* axis = isRPhi ? fData->GetPhiBins() : fData->GetEtaBins();
912
913 // clear old cache
914 for (vBinCells_i it = outputCellLists.begin(); it != outputCellLists.end(); it++)
915 {
916 if (*it)
917 {
918 (*it)->clear();
919 delete *it;
920 }
921 }
922 outputCellLists.clear();
923 UInt_t nBins = axis->GetNbins();
924 outputCellLists.resize(nBins+1);
925 for (UInt_t b = 0; b <= nBins; ++b)
926 outputCellLists[b] = 0;
927
928 for(UInt_t bin = 1; bin <= nBins; ++bin)
929 {
930 REveCaloData::vCellId_t* idsInBin = fCellLists[bin];
931 if (!idsInBin)
932 continue;
933
934 for (REveCaloData::vCellId_i i = idsInBin->begin(); i != idsInBin->end(); i++)
935 {
936 for (REveCaloData::vCellId_i j = inputCells.begin(); j != inputCells.end(); j++)
937 {
938 if( (*i).fTower == (*j).fTower && (*i).fSlice == (*j).fSlice)
939 {
940 if (!outputCellLists[bin])
941 outputCellLists[bin] = new REveCaloData::vCellId_t();
942
943 outputCellLists[bin]->emplace_back((*i).fTower, (*i).fSlice, (*j).fFraction);
944 }
945 }
946 }
947 }
948}
949
950////////////////////////////////////////////////////////////////////////////////
951/// Set absolute scale in projected calorimeter.
952
954{
957}
958
959////////////////////////////////////////////////////////////////////////////////
960/// Virtual function of REveCaloViz.
961/// Get transformation factor from E/Et to height.
962
964{
966
967 if (fScaleAbs)
968 {
969 return fMaxTowerH/fMaxValAbs;
970 }
971 else
972 {
973 if (fData->Empty())
974 return 1;
975
976 if (fPlotEt)
978 else
979 return fMaxTowerH/fMaxESumBin;
980 }
981}
982
983////////////////////////////////////////////////////////////////////////////////
984/// Fill bounding-box information of the base-class TAttBBox (virtual method).
985/// If member 'REveFrameBox* fFrame' is set, frame's corners are used as bbox.
986
988{
989 BBoxZero();
990
991 Float_t x, y, z;
992 Float_t th = fMaxTowerH ;
993 Float_t r = fBarrelRadius + th;
994
995 x = r, y = 0, z = 0;
997 BBoxCheckPoint(x, y, z);
998 x = -r, y = 0, z = 0;
1000 BBoxCheckPoint(x, y, z);
1001
1002 x = 0, y = 0, z = fEndCapPosF + th;
1004 BBoxCheckPoint(x, y, z);
1005 x = 0, y = 0, z = fEndCapPosB - th;
1007 BBoxCheckPoint(x, y, z);
1008
1009 x = 0, y = r, z = 0;
1011 BBoxCheckPoint(x, y, z);
1012 x = 0, y = -r, z = 0;
1014 BBoxCheckPoint(x, y, z);
1015}
1016
1017////////////////////////////////////////////////////////////////////////////////
1018/// Fill core part of JSON representation.
1019
1020Int_t REveCalo2D::WriteCoreJson(nlohmann::json &j, Int_t rnr_offset)
1021{
1022 Int_t ret = REveCaloViz::WriteCoreJson(j, rnr_offset);
1023 j["isRPhi"] = IsRPhi();
1024 return ret;
1025}
1026
1027////////////////////////////////////////////////////////////////////////////////
1028/// Fill core part of JSON representation for selection.
1029
1031{
1032 static const REveException eh("REveCalo2D::WriteCoreJsonSelection ");
1033 auto sarr = nlohmann::json::array();
1034
1035 // selection
1036 // auto cellLists = isSel ? fCellListsSelected : fCellListsHighlighted;
1037 std::vector<REveCaloData::vCellId_t*> cellLists;
1038 CellSelectionChangedInternal(cells, cellLists);
1039
1040 if (IsRPhi()) {
1041 REveCaloData::CellData_t cellData;
1042 Int_t nSlices = fData->GetNSlices();
1043 Float_t *sliceVal = new Float_t[nSlices];
1044 Float_t *sliceValRef = new Float_t[nSlices];
1045 UInt_t nPhiBins = fData->GetPhiBins()->GetNbins();
1046 for(UInt_t phiBin = 1; phiBin <= nPhiBins; ++phiBin)
1047 {
1048 if (cellLists[phiBin])
1049 {
1050 if (!fCellLists[phiBin]) {
1051 delete[] sliceVal;
1052 delete[] sliceValRef;
1053 throw eh + "selected cell not in cell list cache.";
1054 }
1055
1056 // selected eta sum
1057 for (Int_t s=0; s<nSlices; ++s) sliceVal[s] = 0;
1058 REveCaloData::vCellId_t& cids = *(cellLists[phiBin]);
1059 for (REveCaloData::vCellId_i i=cids.begin(); i!=cids.end(); i++) {
1060 fData->GetCellData((*i), cellData);
1061 sliceVal[i->fSlice] += cellData.Value(fPlotEt)*(*i).fFraction;
1062 }
1063 // referenced eta sum
1064 for (Int_t s=0; s<nSlices; ++s) sliceValRef[s] = 0;
1065 REveCaloData::vCellId_t& cidsRef = *(fCellLists[phiBin]);
1066 for (REveCaloData::vCellId_i i=cidsRef.begin(); i!=cidsRef.end(); i++) {
1067 fData->GetCellData(*i, cellData);
1068 sliceValRef[i->fSlice] += cellData.Value(fPlotEt)*(*i).fFraction;
1069 }
1070
1071 // write
1072 for (Int_t s = 0; s < nSlices; ++s) {
1073 if (sliceVal[s] > 0)
1074 {
1075 nlohmann::json jsc;
1076 jsc["b"] = phiBin;
1077 jsc["s"] = s;
1078 jsc["f"] = sliceVal[s]/sliceValRef[s];
1079 sarr.push_back(jsc);
1080 }
1081 }
1082 }
1083 }
1084 }
1085 else {
1086 TAxis* axis = fData->GetEtaBins();
1087 UInt_t nEtaBins = axis->GetNbins();
1088 Int_t nSlices = fData->GetNSlices();
1089
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.);
1094
1095 Float_t towerH, towerHRef, offUp, offLow;
1096 REveCaloData::CellData_t cellData;
1097
1098 for (UInt_t etaBin = 1; etaBin <= nEtaBins; ++etaBin)
1099 {
1100 if (cellLists[etaBin])
1101 {
1102 if (!fCellLists[etaBin]) {
1103 throw(eh + "selected cell not in cell list cache.");
1104 }
1105 offUp = 0; offLow =0;
1106 // selected phi sum
1107 for (Int_t s = 0; s < nSlices; ++s) {
1108 sliceValsUp[s] = sliceValsLow[s] = 0.;
1109 }
1110 REveCaloData::vCellId_t& cids = *(cellLists[etaBin]);
1111 for (REveCaloData::vCellId_i i=cids.begin(); i!=cids.end(); i++) {
1112 fData->GetCellData(*i, cellData);
1113 if (cellData.IsUpperRho())
1114 sliceValsUp [i->fSlice] += cellData.Value(fPlotEt)*(*i).fFraction;
1115 else
1116 sliceValsLow[i->fSlice] += cellData.Value(fPlotEt)*(*i).fFraction;
1117 }
1118
1119 // reference phi sum
1120 for (Int_t s = 0; s < nSlices; ++s)
1121 {
1122 sliceValsUpRef[s] = sliceValsLowRef[s] = 0;
1123 }
1124 REveCaloData::vCellId_t& cidsRef = *(fCellLists[etaBin]);
1125 for (REveCaloData::vCellId_i i=cidsRef.begin(); i!=cidsRef.end(); i++)
1126 {
1127 fData->GetCellData(*i, cellData);
1128 if (cellData.IsUpperRho())
1129 sliceValsUpRef [i->fSlice] += cellData.Value(fPlotEt)*(*i).fFraction;
1130 else
1131 sliceValsLowRef[i->fSlice] += cellData.Value(fPlotEt)*(*i).fFraction;
1132 }
1133
1134 for (Int_t s = 0; s < nSlices; ++s)
1135 {
1136 // phi +
1137 SetupHeight(sliceValsUpRef[s], s, towerHRef);
1138 if (sliceValsUp[s] > 0) {
1139 SetupHeight(sliceValsUp[s], s, towerH);
1140 nlohmann::json jsc;
1141 jsc["b"] = etaBin;
1142 jsc["s"] = s;
1143 jsc["f"] = sliceValsUp[s]/sliceValsUpRef[s];
1144 sarr.push_back(jsc);
1145 }
1146 offUp += towerHRef;
1147
1148 // phi -
1149 SetupHeight(sliceValsLowRef[s], s, towerHRef);
1150 if (sliceValsLow[s] > 0) {
1151 SetupHeight(sliceValsLow[s], s, towerH);
1152 nlohmann::json jsc;
1153 jsc["b"] = Int_t(-etaBin);
1154 jsc["s"] = s;
1155 jsc["f"] = sliceValsLow[s]/sliceValsLowRef[s];
1156 sarr.push_back(jsc);
1157 }
1158 offLow += towerHRef;
1159 } // slices
1160 } // if eta bin
1161 } //eta bins
1162 } // RhoZ
1163
1164 nlohmann::json rec = {};
1165 rec["caloVizId"] = GetElementId();
1166 rec["cells"] = sarr;
1167 j.push_back(rec);
1168}
1169
1170////////////////////////////////////////////////////////////////////////////////
1171/// Creates 2D point array for rendering.
1172
1174{
1176 bool isEmpty = fData->Empty();
1177
1178 for (vBinCells_i it = fCellLists.begin(); it != fCellLists.end(); ++it)
1179 {
1180 if ((*it) && (*it)->empty())
1181 {
1182 isEmpty = false;
1183 break;
1184 }
1185 }
1186 if (isEmpty) return;
1187
1188 fRenderData = std::make_unique<REveRenderData>("makeCalo2D");
1189
1190 if (IsRPhi())
1192 else
1194}
1195
1196
1197////////////////////////////////////////////////////////////////////////////////
1198/// Creates 2D point array in RhoZ projection.
1199
1201{
1202 Int_t nSlices = fData->GetNSlices();
1203
1204 REveCaloData::CellData_t cellData;
1205 Float_t *sliceValsUp = new Float_t[nSlices];
1206 Float_t *sliceValsLow = new Float_t[nSlices];
1207 Bool_t isBarrel;
1208 Float_t towerH;
1209 Float_t transEtaF = GetTransitionEtaForward();
1210 Float_t transEtaB = GetTransitionEtaBackward();
1211
1212 TAxis* axis = fData->GetEtaBins();
1213 UInt_t nEta = axis->GetNbins();
1214 Float_t pnts[12];
1215 for (UInt_t etaBin = 1; etaBin <= nEta; ++etaBin)
1216 {
1217 if (fCellLists[etaBin] )
1218 {
1219 assert(fCellLists[etaBin]);
1220 Float_t etaMin = axis->GetBinLowEdge(etaBin);
1221 Float_t etaMax = axis->GetBinUpEdge(etaBin);
1222 Float_t thetaMin = REveCaloData::EtaToTheta(etaMax);
1223 Float_t thetaMax = REveCaloData::EtaToTheta(etaMin);
1224 // printf("----------------------------------------- eta(%f, %f)\n", etaMin, etaMax);
1225
1226 // clear
1227 Float_t offUp = 0;
1228 Float_t offLow = 0;
1229 for (Int_t s = 0; s < nSlices; ++s) {
1230 sliceValsUp [s] = 0;
1231 sliceValsLow[s] = 0;
1232 }
1233 // values
1234 REveCaloData::vCellId_t* cids = fCellLists[etaBin];
1235 for (REveCaloData::vCellId_i it = cids->begin(); it != cids->end(); ++it)
1236 {
1237 fData->GetCellData(*it, cellData);
1238 if (cellData.IsUpperRho())
1239 sliceValsUp [it->fSlice] += cellData.Value(fPlotEt)*(*it).fFraction;
1240 else
1241 sliceValsLow[it->fSlice] += cellData.Value(fPlotEt)*(*it).fFraction;
1242 }
1243
1244 isBarrel = !(etaMax > 0 && etaMax > transEtaF) && !(etaMin < 0 && etaMin < transEtaB);
1245 for (Int_t s = 0; s < nSlices; ++s)
1246 {
1247 // phi +
1248 if (sliceValsUp[s])
1249 {
1250 SetupHeight(sliceValsUp[s], s, towerH);
1251 MakeRhoZCell(thetaMin, thetaMax, offUp, isBarrel, kTRUE , towerH, pnts);
1252 offUp += towerH;
1253 fRenderData->PushV(pnts, 12);
1254 fRenderData->PushI( s);
1255 fRenderData->PushI(etaBin);
1256 fRenderData->PushN(sliceValsUp[s]);
1257 }
1258 // phi -
1259 if (sliceValsLow[s])
1260 {
1261 SetupHeight(sliceValsLow[s], s, towerH);
1262 MakeRhoZCell(thetaMin, thetaMax, offLow, isBarrel, kFALSE , towerH, pnts);
1263 offLow += towerH;
1264 fRenderData->PushV(pnts, 12);
1265 fRenderData->PushI( s);
1266 fRenderData->PushI(etaBin);
1267 fRenderData->PushN(sliceValsLow[s]);
1268 }
1269
1270 }
1271 }
1272 }
1273
1274 delete [] sliceValsUp;
1275 delete [] sliceValsLow;
1276}
1277
1278////////////////////////////////////////////////////////////////////////////////
1279/// Get cell vertices in RhoZ projection.
1280///
1282 Float_t& offset, Bool_t isBarrel, Bool_t phiPlus, Float_t towerH, float *pntsOut) const
1283{
1284 using namespace TMath;
1285
1286 Float_t sin1 = Sin(thetaMin);
1287 Float_t cos1 = Cos(thetaMin);
1288 Float_t sin2 = Sin(thetaMax);
1289 Float_t cos2 = Cos(thetaMax);
1290
1291 Float_t pnts[8];
1292 if (isBarrel)
1293 {
1294 Float_t r1 = fBarrelRadius/Abs(Sin(0.5f*(thetaMin+thetaMax))) + offset;
1295 Float_t r2 = r1 + towerH;
1296
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;
1301 }
1302 else
1303 {
1304 // endcap
1306 // uses a different theta definition than GetTransitionThetaBackward(), so we need a conversion
1308 if (thetaMax >= transThetaB)
1309 zE = Abs(GetBackwardEndCapPos());
1310 Float_t r1 = zE/Abs(Cos(0.5f*(thetaMin+thetaMax))) + offset;
1311 Float_t r2 = r1 + towerH;
1312
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;
1317 }
1318
1319
1320 Float_t x, y, z;
1321 for (Int_t i = 0; i < 4; ++i)
1322 {
1323 x = 0.f;
1324 y = phiPlus ? Abs(pnts[2*i]) : -Abs(pnts[2*i]);
1325 z = pnts[2*i+1];
1327
1328 int j = phiPlus ? i : (3 -i);
1329 pntsOut[j*3] = x;
1330 pntsOut[j*3 + 1] = y;
1331 pntsOut[j*3 + 2] = z;
1332 }
1333}
1334
1335////////////////////////////////////////////////////////////////////////////////
1336/// Creates 2D point array in RPhi() projection.
1337
1339{
1340 REveCaloData* data = fData;
1341 Int_t nSlices = data->GetNSlices();
1342 Float_t *sliceVal = new Float_t[nSlices];
1343 REveCaloData::CellData_t cellData;
1344 Float_t towerH;
1345
1346 UInt_t nPhi = data->GetPhiBins()->GetNbins();
1347 TAxis* axis = data->GetPhiBins();
1348 float pnts[12];
1349 for(UInt_t phiBin = 1; phiBin <= nPhi; ++phiBin)
1350 {
1351 if (fCellLists[phiBin] )
1352 {
1353 // reset values
1354 Float_t off = 0;
1355 for (Int_t s=0; s<nSlices; ++s)
1356 sliceVal[s] = 0;
1357
1358 // sum eta cells
1359 REveCaloData::vCellId_t* cids = fCellLists[phiBin];
1360 for (REveCaloData::vCellId_i it = cids->begin(); it != cids->end(); it++)
1361 {
1362 data->GetCellData(*it, cellData);
1363 sliceVal[(*it).fSlice] += cellData.Value(fPlotEt)*(*it).fFraction;
1364 }
1365 for (Int_t s = 0; s < nSlices; ++s)
1366 {
1367 SetupHeight(sliceVal[s], s, towerH);
1368 MakeRPhiCell(axis->GetBinLowEdge(phiBin), axis->GetBinUpEdge(phiBin), towerH, off, pnts);
1369 fRenderData->PushV(pnts, 12);
1370 fRenderData->PushI(s);
1371 fRenderData->PushI(phiBin);
1372 fRenderData->PushN(sliceVal[s]);
1373 off += towerH;
1374 }
1375 }
1376 }
1377
1378 delete [] sliceVal;
1379}
1380
1381////////////////////////////////////////////////////////////////////////////////
1382/// Calculate vertices for the calorimeter cell in RPhi projection.
1383/// Returns outside radius of the tower.
1384
1386 Float_t towerH, Float_t offset, float* pntsOut) const
1387{
1388 using namespace TMath;
1389
1390 Float_t r1 = fBarrelRadius + offset;
1391 Float_t r2 = r1 + towerH;
1392
1393 Float_t pnts[8];
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);
1398
1399 Float_t x, y, z;
1400 for (Int_t i = 0; i < 4; ++i)
1401 {
1402 pntsOut[i*3] = pnts[2*i];
1403 pntsOut[i*3+1] = pnts[2*i+1];
1404 pntsOut[i*3+2] = 0.f;
1406 }
1407}
1408
1409////////////////////////////////////////////////////////////////////////////////
1410/// Client callback
1411
1412void REveCalo2D::NewBinPicked(Int_t bin, Int_t slice, Int_t selectionId, bool multi)
1413{
1414 bool is_upper = bin >= 0;
1415 bin = abs(bin);
1416
1418 for (REveCaloData::vCellId_i it = fCellLists[bin]->begin(); it != fCellLists[bin]->end(); ++it)
1419 {
1420 if ((*it).fSlice == slice)
1421 {
1422 if (IsRPhi())
1423 {
1424 sel.push_back(*it);
1425 }
1426 else
1427 {
1429 fData->GetCellData(*it, cd);
1430 if ((is_upper && cd.IsUpperRho()) || (!is_upper && !cd.IsUpperRho()))
1431 sel.push_back(*it);
1432 }
1433 }
1434 }
1435 fData->ProcessSelection(sel, selectionId, multi);
1436}
1437
1438
1439/** \class REveCaloLego
1440\ingroup REve
1441Visualization of calorimeter data as eta/phi histogram.
1442*/
1443
1444////////////////////////////////////////////////////////////////////////////////
1445/// Constructor.
1446
1447REveCaloLego::REveCaloLego(REveCaloData* d, const char* n, const char* t):
1448 REveCaloViz(d, n, t),
1449
1450 fFontColor(-1),
1451 fGridColor(-1),
1452 fPlaneColor(kRed-5),
1453 fPlaneTransparency(60),
1454
1455 fNZSteps(6),
1456 fZAxisStep(0.f),
1457
1458 fAutoRebin(kTRUE),
1459
1460 fPixelsPerBin(12),
1461 fNormalizeRebin(kFALSE),
1462
1463 fProjection(kAuto),
1464 f2DMode(kValSize),
1465 fBoxMode(kBack),
1466
1467 fDrawHPlane(kFALSE),
1468 fHPlaneVal(0),
1469
1470 fHasFixedHeightIn2DMode(kFALSE),
1471 fFixedHeightValIn2DMode(0.f),
1472
1473 fDrawNumberCellPixels(18), // draw numbers on cell above 30 pixels
1474 fCellPixelFontSize(12) // size of cell fonts in pixels
1475{
1476 fMaxTowerH = 4;
1477 SetNameTitle("REveCaloLego", "REveCaloLego");
1478}
1479
1480////////////////////////////////////////////////////////////////////////////////
1481// Set data.
1482
1484{
1486}
1487
1488////////////////////////////////////////////////////////////////////////////////
1489/// Build list of drawn cell IDs. For more information see REveCaloLegoGL:DirectDraw().
1490
1492{
1493 fCellList.clear();
1494
1497}
1498
1499////////////////////////////////////////////////////////////////////////////////
1500/// Fill bounding-box information of the base-class TAttBBox (virtual method).
1501/// If member 'REveFrameBox* fFrame' is set, frame's corners are used as bbox.
1502
1504{
1505
1506 // fBBox = Float_t[6] X(min,max), Y(min,max), Z(min,max)
1507
1508 BBoxZero();
1509
1510 Float_t ex = 1.2; // 20% offset for axis labels
1511
1512 Float_t a = 0.5*ex;
1513
1514 fBBox[0] = -a;
1515 fBBox[1] = a;
1516 fBBox[2] = -a;
1517 fBBox[3] = a;
1518
1519 // scaling is relative to shortest XY axis
1520 Double_t em, eM, pm, pM;
1521 fData->GetEtaLimits(em, eM);
1522 fData->GetPhiLimits(pm, pM);
1523 Double_t r = (eM-em)/(pM-pm);
1524 if (r<1)
1525 {
1526 fBBox[2] /= r;
1527 fBBox[3] /= r;
1528 }
1529 else
1530 {
1531 fBBox[0] *= r;
1532 fBBox[1] *= r;
1533 }
1534
1535 fBBox[4] = 0;
1536 if (fScaleAbs && !fData->Empty())
1538 else
1539 fBBox[5] = fMaxTowerH;
1540}
1541
ROOT::R::TRInterface & r
Definition Object.C:4
#define d(i)
Definition RSha256.hxx:102
#define b(i)
Definition RSha256.hxx:100
#define a(i)
Definition RSha256.hxx:99
int Int_t
Definition RtypesCore.h:45
const Bool_t kFALSE
Definition RtypesCore.h:92
short Color_t
Definition RtypesCore.h:83
const Bool_t kTRUE
Definition RtypesCore.h:91
@ kGray
Definition Rtypes.h:65
@ kRed
Definition Rtypes.h:66
#define hlimit
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.
Definition REveCalo.cxx:797
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.
Definition REveCalo.cxx:807
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).
Definition REveCalo.cxx:987
std::vector< REveCaloData::vCellId_t * >::iterator vBinCells_i
Definition REveCalo.hxx:208
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.
Definition REveCalo.cxx:908
REveProjection::EPType_e fOldProjectionType
Definition REveCalo.hxx:213
REveCalo2D(const char *n="REveCalo2D", const char *t="")
Constructor.
Definition REveCalo.cxx:743
void UpdateProjection() override
This is virtual method from base-class REveProjected.
Definition REveCalo.cxx:784
Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override
Fill core part of JSON representation.
std::vector< REveCaloData::vCellId_t * > fCellLists
Definition REveCalo.hxx:226
std::vector< REveCaloData::vCellId_t * > fCellListsSelected
Definition REveCalo.hxx:228
void BuildCellIdCache() override
Build lists of drawn cell IDs. See REveCalo2DGL::DirecDraw().
Definition REveCalo.cxx:815
void BuildRenderDataRhoZ()
Creates 2D point array in RhoZ projection.
virtual ~REveCalo2D()
Destructor.
Definition REveCalo.cxx:755
Float_t GetValToHeight() const override
Virtual function of REveCaloViz.
Definition REveCalo.cxx:963
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.
Definition REveCalo.cxx:953
Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override
Fill core part of JSON representation.
Definition REveCalo.cxx:659
void ComputeBBox() override
Fill bounding-box information of the base-class TAttBBox (virtual method).
Definition REveCalo.cxx:708
void MakeBarrelCell(const REveCaloData::CellGeom_t &cellData, float towerH, Float_t &offset, float *pnts) const
Make endcap cell.
Definition REveCalo.cxx:536
void MakeEndCapCell(const REveCaloData::CellGeom_t &cellData, float towerH, Float_t &offset, float *pnts) const
Make endcap cell.
Definition REveCalo.cxx:471
REveCalo3D(REveCaloData *d=0, const char *n="REveCalo3D", const char *t="")
Constructor.
Definition REveCalo.cxx:453
void WriteCoreJsonSelection(nlohmann::json &j, REveCaloData::vCellId_t) override
Fill core part of JSON representation for selection.
Definition REveCalo.cxx:667
void BuildRenderData() override
Crates 3D point array for rendering.
Definition REveCalo.cxx:603
void BuildCellIdCache() override
Build list of drawn cell IDs. See REveCalo3DGL::DirectDraw().
Definition REveCalo.cxx:696
void NewTowerPicked(Int_t tower, Int_t slice, Int_t selectionId, Bool_t multi)
Client selection callback.
Definition REveCalo.cxx:730
REveCaloData::vCellId_t fCellList
Definition REveCalo.hxx:164
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
Definition REveCalo.hxx:275
REveCaloLego(REveCaloData *data=0, const char *n="REveCaloLego", const char *t="")
Constructor.
Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override
Fill core part of JSON representation.
Definition REveCalo.cxx:428
virtual REveElement * ForwardSelection()
Management of selection state and ownership of selected cell list is done in REveCaloData.
Definition REveCalo.cxx:97
Float_t GetBarrelRadius() const
Definition REveCalo.hxx:97
Float_t GetBackwardEndCapPos() const
Definition REveCalo.hxx:101
void SetPlotEt(Bool_t x)
Set E/Et plot.
Definition REveCalo.cxx:150
Float_t GetTransitionTheta() const
Get transition angle between barrel and end-cap cells, assuming fEndCapPosF = -fEndCapPosB.
Definition REveCalo.cxx:185
virtual void BuildCellIdCache()=0
void SetPalette(REveRGBAPalette *p)
Set REveRGBAPalette object pointer.
Definition REveCalo.cxx:349
virtual void SetScaleAbs(Bool_t x)
Definition REveCalo.hxx:82
Float_t GetTransitionEtaForward() const
Get transition eta between barrel and forward end-cap cells.
Definition REveCalo.cxx:211
void DataChanged()
Update setting and cache on data changed.
Definition REveCalo.cxx:258
void SetDataSliceColor(Int_t slice, Color_t col)
Set slice color in data.
Definition REveCalo.cxx:131
Float_t GetTransitionEta() const
Get transition eta between barrel and end-cap cells, assuming fEndCapPosF = -fEndCapPosB.
Definition REveCalo.cxx:193
Color_t GetDataSliceColor(Int_t slice) const
Get slice color from data.
Definition REveCalo.cxx:123
Float_t GetTransitionEtaBackward() const
Get transition eta between barrel and backward end-cap cells.
Definition REveCalo.cxx:229
Bool_t AssertCellIdCache() const
Assert cell id cache is ok.
Definition REveCalo.cxx:295
void SetPhiWithRng(Float_t x, Float_t r)
Set phi range.
Definition REveCalo.cxx:172
virtual ~REveCaloViz()
Destructor.
Definition REveCalo.cxx:80
virtual Float_t GetValToHeight() const
Get transformation factor from E/Et to height.
Definition REveCalo.cxx:360
TClass * ProjectedClass(const REveProjection *p) const override
Virtual from REveProjectable, returns REveCalo2D class.
Definition REveCalo.cxx:400
Float_t GetDataSliceThreshold(Int_t slice) const
Get threshold for given slice.
Definition REveCalo.cxx:88
Float_t GetForwardEndCapPos() const
Definition REveCalo.hxx:100
Bool_t CellInEtaPhiRng(REveCaloData::CellData_t &) const
Returns true if given cell is in the ceta phi range.
Definition REveCalo.cxx:309
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.
Definition REveCalo.cxx:408
Float_t GetTransitionThetaForward() const
Get transition angle between barrel and forward end-cap cells.
Definition REveCalo.cxx:203
void SetData(REveCaloData *d)
Set calorimeter event data.
Definition REveCalo.cxx:241
Float_t GetTransitionThetaBackward() const
Get transition angle between barrel and backward end-cap cells.
Definition REveCalo.cxx:221
void AssignCaloVizParameters(REveCaloViz *cv)
Assign parameters from given model.
Definition REveCalo.cxx:323
virtual REveElement * ForwardEdit()
Management of selection state and ownership of selected cell list is done in REveCaloData.
Definition REveCalo.cxx:107
void SetDataSliceThreshold(Int_t slice, Float_t val)
Set threshold for given slice.
Definition REveCalo.cxx:115
REveRGBAPalette * AssertPalette()
Make sure the REveRGBAPalette pointer is not null.
Definition REveCalo.cxx:381
void SetEta(Float_t l, Float_t u)
Set eta range.
Definition REveCalo.cxx:139
void SetNameTitle(const std::string &name, const std::string &title)
Set name and title of an element.
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.
Definition REveTypes.hxx:40
virtual void SetProjection(REveProjectionManager *mng, REveProjectable *model)
Sets projection manager and reference in the projectable object.
REveProjectionManager Manager class for steering of projections and managing projected objects.
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
void SetMin(Int_t min)
Set current min value.
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.
Definition REveUtil.cxx:297
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.
Definition REveUtil.cxx:276
void BBoxCheckPoint(Float_t x, Float_t y, Float_t z)
Definition TAttBBox.h:58
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).
Definition TAttBBox.cxx:42
void BBoxInit(Float_t infinity=1e6)
Dynamic Float_t[6] X(min,max), Y(min,max), Z(min,max)
Definition TAttBBox.cxx:29
Float_t * fBBox
Definition TAttBBox.h:20
Class to manage histogram axis.
Definition TAxis.h:30
virtual Double_t GetBinCenter(Int_t bin) const
Return center of bin.
Definition TAxis.cxx:478
virtual Double_t GetBinLowEdge(Int_t bin) const
Return low edge of bin.
Definition TAxis.cxx:518
Int_t GetNbins() const
Definition TAxis.h:121
virtual Double_t GetBinWidth(Int_t bin) const
Return bin width.
Definition TAxis.cxx:540
virtual Double_t GetBinUpEdge(Int_t bin) const
Return up edge of bin.
Definition TAxis.cxx:528
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:80
TPaveText * pt
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
const Int_t n
Definition legend1.C:16
Double_t ex[n]
Definition legend1.C:17
TMath.
Definition TMathBase.h:35
Short_t Max(Short_t a, Short_t b)
Definition TMathBase.h:212
Double_t ATan(Double_t)
Definition TMath.h:675
T1 Sign(T1 a, T2 b)
Definition TMathBase.h:165
Int_t CeilNint(Double_t x)
Definition TMath.h:699
Float_t Value(Bool_t) const
Return energy value associated with the cell, usually Et.
auto * m
Definition textangle.C:8
auto * l
Definition textangle.C:4