Logo ROOT  
Reference Guide
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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"
18#include "ROOT/REveTrans.hxx"
19
20#include "TClass.h"
21#include "TMathBase.h"
22#include "TMath.h"
23#include "TAxis.h"
24
25#include <cassert>
26#include <iostream>
27
28#include <nlohmann/json.hpp>
29
30using namespace ROOT::Experimental;
31
32/** \class REveCaloViz
33\ingroup REve
34Base class for calorimeter data visualization.
35See REveCalo2D and REveCalo3D for concrete implementations.
36*/
37
38
39////////////////////////////////////////////////////////////////////////////////
40
41REveCaloViz::REveCaloViz(REveCaloData* data, const char* n, const char* t) :
44
45 fData(nullptr),
46 fCellIdCacheOK(kFALSE),
47
48 fEtaMin(-10),
49 fEtaMax(10),
50
51 fPhi(0.),
52 fPhiOffset(TMath::Pi()),
53
54 fAutoRange(kTRUE),
55
56 fBarrelRadius(-1.f),
57 fEndCapPosF(-1.f),
58 fEndCapPosB(-1.f),
59
60 fPlotEt(kTRUE),
61
62 fMaxTowerH(100),
63 fScaleAbs(kFALSE),
64 fMaxValAbs(100),
65
66 fValueIsColor(kFALSE),
67 fPalette(nullptr)
68{
69 // Constructor.
70
72 SetNameTitle(n, t);
74}
75
76////////////////////////////////////////////////////////////////////////////////
77/// Destructor.
78
80{
82}
83
84////////////////////////////////////////////////////////////////////////////////
85/// Get threshold for given slice.
86
88{
89 return fData->RefSliceInfo(slice).fThreshold;
90}
91
92////////////////////////////////////////////////////////////////////////////////
93/// Management of selection state and ownership of selected cell list
94/// is done in REveCaloData. This is a reason selection is forwarded to it.
95
97{
98 return fData;
99}
100
101////////////////////////////////////////////////////////////////////////////////
102/// Management of selection state and ownership of selected cell list
103/// is done in REveCaloData. We still want GUI editor to display
104/// concrete calo-viz object.
105
107{
108 return this;
109}
110
111////////////////////////////////////////////////////////////////////////////////
112/// Set threshold for given slice.
113
115{
116 fData->SetSliceThreshold(slice, val);
117}
118
119////////////////////////////////////////////////////////////////////////////////
120/// Get slice color from data.
121
123{
124 return fData->RefSliceInfo(slice).fColor;
125}
126
127////////////////////////////////////////////////////////////////////////////////
128/// Set slice color in data.
129
131{
132 fData->SetSliceColor(slice, col);
133}
134
135////////////////////////////////////////////////////////////////////////////////
136/// Set eta range.
137
139{
140 fEtaMin=l;
141 fEtaMax=u;
142
144}
145
146////////////////////////////////////////////////////////////////////////////////
147/// Set E/Et plot.
148
150{
151 fPlotEt=isEt;
152 if (fPalette)
154
156}
157
158////////////////////////////////////////////////////////////////////////////////
159
161{
162 // Get maximum plotted value.
163
164 return fData->GetMaxVal(fPlotEt);
165
166}
167
168////////////////////////////////////////////////////////////////////////////////
169/// Set phi range.
170
172{
173 using namespace TMath;
174
175 fPhi = phi;
176 fPhiOffset = rng;
177
179}
180
181////////////////////////////////////////////////////////////////////////////////
182/// Get transition angle between barrel and end-cap cells, assuming fEndCapPosF = -fEndCapPosB.
183
185{
187}
188
189////////////////////////////////////////////////////////////////////////////////
190/// Get transition eta between barrel and end-cap cells, assuming fEndCapPosF = -fEndCapPosB.
191
193{
194 using namespace TMath;
195 Float_t t = GetTransitionTheta()*0.5f;
196 return -Log(Tan(t));
197}
198
199////////////////////////////////////////////////////////////////////////////////
200/// Get transition angle between barrel and forward end-cap cells.
201
203{
205}
206
207////////////////////////////////////////////////////////////////////////////////
208/// Get transition eta between barrel and forward end-cap cells.
209
211{
212 using namespace TMath;
214 return -Log(Tan(t));
215}
216
217////////////////////////////////////////////////////////////////////////////////
218/// Get transition angle between barrel and backward end-cap cells.
219
221{
223}
224
225////////////////////////////////////////////////////////////////////////////////
226/// Get transition eta between barrel and backward end-cap cells.
227
229{
230 using namespace TMath;
232 //negative theta means negative eta
233 return Log(-Tan(t));
234}
235
236
237////////////////////////////////////////////////////////////////////////////////
238/// Set calorimeter event data.
239
241{
242
243 if (data == fData) return;
244 fData = data;
245 // SetSelectionMaster(data);
246 if (fData)
247 {
248 fData->AddNiece(this);
249 DataChanged();
250 }
251}
252
253////////////////////////////////////////////////////////////////////////////////
254/// Update setting and cache on data changed.
255/// Called from REvecaloData::BroadcastDataChange()
256
258{
259 Double_t min, max, delta;
260
261 fData->GetEtaLimits(min, max);
262 if (fAutoRange) {
263 fEtaMin = min;
264 fEtaMax = max;
265 } else {
266 if (fEtaMin < min) fEtaMin = min;
267 if (fEtaMax > max) fEtaMax = max;
268 }
269
270 fData->GetPhiLimits(min, max);
271 delta = 0.5*(max - min);
272 if (fAutoRange || fPhi < min || fPhi > max) {
273 fPhi = 0.5*(max + min);
274 fPhiOffset = delta;
275 } else {
276 if (fPhiOffset > delta) fPhiOffset = delta;
277 }
278
279 if (fPalette)
280 {
283 fPalette->SetMin(0);
285 }
286
288}
289
290////////////////////////////////////////////////////////////////////////////////
291/// Assert cell id cache is ok.
292/// Returns true if the cache has been updated.
293
295{
296 REveCaloViz* cv = const_cast<REveCaloViz*>(this);
297 if (!fCellIdCacheOK) {
298 cv->BuildCellIdCache();
299 return kTRUE;
300 } else {
301 return kFALSE;
302 }
303}
304
305////////////////////////////////////////////////////////////////////////////////
306/// Returns true if given cell is in the ceta phi range.
307
309{
310 if (cellData.EtaMin() >= fEtaMin && cellData.EtaMax() <= fEtaMax)
311 {
313 (fPhi-fPhiOffset, fPhi+fPhiOffset, cellData.PhiMin(), cellData.PhiMax()))
314 return kTRUE;
315 }
316 return kFALSE;
317}
318
319////////////////////////////////////////////////////////////////////////////////
320/// Assign parameters from given model.
321
323{
324 SetData(m->fData);
325
326 fEtaMin = m->fEtaMin;
327 fEtaMax = m->fEtaMax;
328
329 fPhi = m->fPhi;
330 fPhiOffset = m->fPhiOffset;
331
332 fBarrelRadius = m->fBarrelRadius;
333 fEndCapPosF = m->fEndCapPosF;
334 fEndCapPosB = m->fEndCapPosB;
335
336 if (m->fPalette)
337 {
338 REveRGBAPalette& mp = * m->fPalette;
342 }
343}
344
345////////////////////////////////////////////////////////////////////////////////
346/// Set REveRGBAPalette object pointer.
347
349{
350 if ( fPalette == p) return;
352 fPalette = p;
354}
355
356////////////////////////////////////////////////////////////////////////////////
357/// Get transformation factor from E/Et to height
358
360{
361 if (fScaleAbs)
362 {
363 return fMaxTowerH/fMaxValAbs;
364 }
365 else
366 {
367 if (fData->Empty()) {
368 assert(false);
369 return 1;
370 }
372 }
373}
374
375////////////////////////////////////////////////////////////////////////////////
376/// Make sure the REveRGBAPalette pointer is not null.
377/// If it is not set, a new one is instantiated and the range is set
378/// to current min/max signal values.
379
381{
382 if (fPalette == nullptr) {
385
388 fPalette->SetMin(0);
390
391 }
392 return fPalette;
393}
394
395
396////////////////////////////////////////////////////////////////////////////////
397/// Virtual from REveProjectable, returns REveCalo2D class.
398
400{
401 return TClass::GetClass<REveCalo2D>();
402}
403
404////////////////////////////////////////////////////////////////////////////////
405/// Set color and height for a given value and slice using slice color or REveRGBAPalette.
406
408{
409 if (fValueIsColor)
410 {
412 assert("fValueIsColor" && false);
413 // UChar_t c[4];
414 // fPalette->ColorFromValue((Int_t)value, c);
415 // c[3] = fData->GetSliceTransparency(slice);
416 // TGLUtil::Color4ubv(c);
417 }
418 else
419 {
420 // TGLUtil::ColorTransparency(fData->GetSliceColor(slice), fData->GetSliceTransparency(slice));
421 outH = GetValToHeight()*value;
422 }
423}
424///////////////////////////////////////////////////////////////////////////////
425/// Fill core part of JSON representation.
426
427Int_t REveCaloViz::WriteCoreJson(nlohmann::json &j, Int_t rnr_offset)
428{
429 // The slice colors need to be streamed becuse at EveElement contruction time, streamed caloData
430 // is not available. Maybe this is not necessary if EveElements have EveManager globaly available
431
432 Int_t ret = REveElement::WriteCoreJson(j, rnr_offset);
433 j["dataId"] = fData->GetElementId();
434 j["sliceColors"] = nlohmann::json::array();
435 for (int i = 0; i < fData->GetNSlices(); ++i)
436 {
437 j["sliceColors"].push_back(fData->GetSliceColor(i));
438 }
439 j["fSecondarySelect"] = true;
440 return ret;
441}
442
443/** \class REveCalo3D
444\ingroup REve
445Visualization of a calorimeter event data in 3D.
446*/
447
448
449////////////////////////////////////////////////////////////////////////////////
450/// Constructor.
451
452REveCalo3D::REveCalo3D(REveCaloData* d, const char* n, const char* t):
453 REveCaloViz(d, n, t),
454
455 fRnrEndCapFrame (kTRUE),
456 fRnrBarrelFrame (kTRUE),
457 fFrameWidth (0.5),
458 fFrameColor (kGray+1),
459 fFrameTransparency (80)
460{
464}
465
466
467////////////////////////////////////////////////////////////////////////////////
468/// Make endcap cell
469//
470void REveCalo3D::MakeEndCapCell(const REveCaloData::CellGeom_t &cellData, float towerH, Float_t& offset, float *pnts) const
471{
472 using namespace TMath;
473 Float_t z1, r1In, r1Out, z2, r2In, r2Out;
474
475 z1 = (cellData.EtaMin()<0) ? fEndCapPosB - offset : fEndCapPosF + offset;
476 z2 = z1 + TMath::Sign(towerH, cellData.EtaMin());
477
478 r1In = z1*Tan(cellData.ThetaMin());
479 r2In = z2*Tan(cellData.ThetaMin());
480 r1Out = z1*Tan(cellData.ThetaMax());
481 r2Out = z2*Tan(cellData.ThetaMax());
482
483 Float_t cos2 = Cos(cellData.PhiMin());
484 Float_t sin2 = Sin(cellData.PhiMin());
485 Float_t cos1 = Cos(cellData.PhiMax());
486 Float_t sin1 = Sin(cellData.PhiMax());
487
488 // 0
489 pnts[0] = r1In*cos1;
490 pnts[1] = r1In*sin1;
491 pnts[2] = z1;
492 pnts += 3;
493 // 1
494 pnts[0] = r1In*cos2;
495 pnts[1] = r1In*sin2;
496 pnts[2] = z1;
497 pnts += 3;
498 // 2
499 pnts[0] = r2In*cos2;
500 pnts[1] = r2In*sin2;
501 pnts[2] = z2;
502 pnts += 3;
503 // 3
504 pnts[0] = r2In*cos1;
505 pnts[1] = r2In*sin1;
506 pnts[2] = z2;
507 pnts += 3;
508 //---------------------------------------------------
509 // 4
510 pnts[0] = r1Out*cos1;
511 pnts[1] = r1Out*sin1;
512 pnts[2] = z1;
513 pnts += 3;
514 // 5
515 pnts[0] = r1Out*cos2;
516 pnts[1] = r1Out*sin2;
517 pnts[2] = z1;
518 pnts += 3;
519 // 6s
520 pnts[0] = r2Out*cos2;
521 pnts[1] = r2Out*sin2;
522 pnts[2] = z2;
523 pnts += 3;
524 // 7
525 pnts[0] = r2Out*cos1;
526 pnts[1] = r2Out*sin1;
527 pnts[2] = z2;
528
529 offset += towerH;
530}
531
532////////////////////////////////////////////////////////////////////////////////
533/// Make endcap cell
534//
535void REveCalo3D::MakeBarrelCell(const REveCaloData::CellGeom_t &cellData, float towerH, Float_t& offset, float *pnts) const
536{
537 using namespace TMath;
538
539 float r1 = GetBarrelRadius() + offset;
540 float r2 = r1 + towerH*Sin(cellData.ThetaMin());
541 float z1In, z1Out, z2In, z2Out;
542
543 z1In = r1/Tan(cellData.ThetaMax());
544 z1Out = r2/Tan(cellData.ThetaMax());
545 z2In = r1/Tan(cellData.ThetaMin());
546 z2Out = r2/Tan(cellData.ThetaMin());
547
548 float cos1 = Cos(cellData.PhiMin());
549 float sin1 = Sin(cellData.PhiMin());
550 float cos2 = Cos(cellData.PhiMax());
551 float sin2 = Sin(cellData.PhiMax());
552
553 // 0
554 pnts[0] = r1*cos2;
555 pnts[1] = r1*sin2;
556 pnts[2] = z1In;
557 pnts += 3;
558 // 1
559 pnts[0] = r1*cos1;
560 pnts[1] = r1*sin1;
561 pnts[2] = z1In;
562 pnts += 3;
563 // 2
564 pnts[0] = r1*cos1;
565 pnts[1] = r1*sin1;
566 pnts[2] = z2In;
567 pnts += 3;
568 // 3
569 pnts[0] = r1*cos2;
570 pnts[1] = r1*sin2;
571 pnts[2] = z2In;
572 pnts += 3;
573 //---------------------------------------------------
574 // 4
575 pnts[0] = r2*cos2;
576 pnts[1] = r2*sin2;
577 pnts[2] = z1Out;
578 pnts += 3;
579 // 5
580 pnts[0] = r2*cos1;
581 pnts[1] = r2*sin1;
582 pnts[2] = z1Out;
583 pnts += 3;
584 // 6
585 pnts[0] = r2*cos1;
586 pnts[1] = r2*sin1;
587 pnts[2] = z2Out;
588 pnts += 3;
589 // 7
590 pnts[0] = r2*cos2;
591 pnts[1] = r2*sin2;
592 pnts[2] = z2Out;
593
594
595 offset += towerH*Sin(cellData.ThetaMin());
596
597}
598
599////////////////////////////////////////////////////////////////////////////////
600/// Crates 3D point array for rendering.
601
603{
605 fRenderData = std::make_unique<REveRenderData>("makeCalo3D");
606
607 if (fCellList.empty())
608 return;
609
611 Float_t towerH = 0;
612 Int_t tower = 0;
613 Int_t prevTower = -1;
614 Float_t offset = 0;
615
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(nullptr, 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(nullptr);
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 = nullptr;
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->empty()) {
850 delete clv; clv = nullptr;
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 = nullptr;
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->empty()) {
869 delete clv; clv = nullptr;
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] = nullptr;
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;
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 // selected phi sum
1106 for (Int_t s = 0; s < nSlices; ++s) {
1107 sliceValsUp[s] = sliceValsLow[s] = 0.;
1108 }
1109 REveCaloData::vCellId_t& cids = *(cellLists[etaBin]);
1110 for (REveCaloData::vCellId_i i=cids.begin(); i!=cids.end(); i++) {
1111 fData->GetCellData(*i, cellData);
1112 if (cellData.IsUpperRho())
1113 sliceValsUp [i->fSlice] += cellData.Value(fPlotEt)*(*i).fFraction;
1114 else
1115 sliceValsLow[i->fSlice] += cellData.Value(fPlotEt)*(*i).fFraction;
1116 }
1117
1118 // reference phi sum
1119 for (Int_t s = 0; s < nSlices; ++s)
1120 {
1121 sliceValsUpRef[s] = sliceValsLowRef[s] = 0;
1122 }
1123 REveCaloData::vCellId_t& cidsRef = *(fCellLists[etaBin]);
1124 for (REveCaloData::vCellId_i i=cidsRef.begin(); i!=cidsRef.end(); i++)
1125 {
1126 fData->GetCellData(*i, cellData);
1127 if (cellData.IsUpperRho())
1128 sliceValsUpRef [i->fSlice] += cellData.Value(fPlotEt)*(*i).fFraction;
1129 else
1130 sliceValsLowRef[i->fSlice] += cellData.Value(fPlotEt)*(*i).fFraction;
1131 }
1132
1133 for (Int_t s = 0; s < nSlices; ++s)
1134 {
1135 // phi +
1136 SetupHeight(sliceValsUpRef[s], s, towerHRef);
1137 if (sliceValsUp[s] > 0) {
1138 SetupHeight(sliceValsUp[s], s, towerH);
1139 nlohmann::json jsc;
1140 jsc["b"] = etaBin;
1141 jsc["s"] = s;
1142 jsc["f"] = sliceValsUp[s]/sliceValsUpRef[s];
1143 sarr.push_back(jsc);
1144 }
1145
1146 // phi -
1147 SetupHeight(sliceValsLowRef[s], s, towerHRef);
1148 if (sliceValsLow[s] > 0) {
1149 SetupHeight(sliceValsLow[s], s, towerH);
1150 nlohmann::json jsc;
1151 jsc["b"] = Int_t(-etaBin);
1152 jsc["s"] = s;
1153 jsc["f"] = sliceValsLow[s]/sliceValsLowRef[s];
1154 sarr.push_back(jsc);
1155 }
1156 } // slices
1157 } // if eta bin
1158 } //eta bins
1159 } // RhoZ
1160
1161 nlohmann::json rec = {};
1162 rec["caloVizId"] = GetElementId();
1163 rec["cells"] = sarr;
1164 j.push_back(rec);
1165}
1166
1167////////////////////////////////////////////////////////////////////////////////
1168/// Creates 2D point array for rendering.
1169
1171{
1173 fRenderData = std::make_unique<REveRenderData>("makeCalo2D");
1174
1175 bool isEmpty = fData->Empty();
1176
1177 for (vBinCells_i it = fCellLists.begin(); it != fCellLists.end(); ++it)
1178 {
1179 if ((*it) && (*it)->empty())
1180 {
1181 isEmpty = false;
1182 break;
1183 }
1184 }
1185 if (isEmpty) return;
1186
1187 if (IsRPhi())
1189 else
1191}
1192
1193
1194////////////////////////////////////////////////////////////////////////////////
1195/// Creates 2D point array in RhoZ projection.
1196
1198{
1199 Int_t nSlices = fData->GetNSlices();
1200
1201 REveCaloData::CellData_t cellData;
1202 Float_t *sliceValsUp = new Float_t[nSlices];
1203 Float_t *sliceValsLow = new Float_t[nSlices];
1204 Bool_t isBarrel;
1205 Float_t towerH;
1206 Float_t transEtaF = GetTransitionEtaForward();
1207 Float_t transEtaB = GetTransitionEtaBackward();
1208
1209 TAxis* axis = fData->GetEtaBins();
1210 UInt_t nEta = axis->GetNbins();
1211 Float_t pnts[12];
1212 for (UInt_t etaBin = 1; etaBin <= nEta; ++etaBin)
1213 {
1214 if (fCellLists[etaBin] )
1215 {
1216 assert(fCellLists[etaBin]);
1217 Float_t etaMin = axis->GetBinLowEdge(etaBin);
1218 Float_t etaMax = axis->GetBinUpEdge(etaBin);
1219 Float_t thetaMin = REveCaloData::EtaToTheta(etaMax);
1220 Float_t thetaMax = REveCaloData::EtaToTheta(etaMin);
1221 // printf("----------------------------------------- eta(%f, %f)\n", etaMin, etaMax);
1222
1223 // clear
1224 Float_t offUp = 0;
1225 Float_t offLow = 0;
1226 for (Int_t s = 0; s < nSlices; ++s) {
1227 sliceValsUp [s] = 0;
1228 sliceValsLow[s] = 0;
1229 }
1230 // values
1231 REveCaloData::vCellId_t* cids = fCellLists[etaBin];
1232 for (REveCaloData::vCellId_i it = cids->begin(); it != cids->end(); ++it)
1233 {
1234 fData->GetCellData(*it, cellData);
1235 if (cellData.IsUpperRho())
1236 sliceValsUp [it->fSlice] += cellData.Value(fPlotEt)*(*it).fFraction;
1237 else
1238 sliceValsLow[it->fSlice] += cellData.Value(fPlotEt)*(*it).fFraction;
1239 }
1240
1241 isBarrel = !(etaMax > 0 && etaMax > transEtaF) && !(etaMin < 0 && etaMin < transEtaB);
1242 for (Int_t s = 0; s < nSlices; ++s)
1243 {
1244 // phi +
1245 if (sliceValsUp[s])
1246 {
1247 SetupHeight(sliceValsUp[s], s, towerH);
1248 MakeRhoZCell(thetaMin, thetaMax, offUp, isBarrel, kTRUE , towerH, pnts);
1249 offUp += towerH;
1250 fRenderData->PushV(pnts, 12);
1251 fRenderData->PushI( s);
1252 fRenderData->PushI(etaBin);
1253 fRenderData->PushN(sliceValsUp[s]);
1254 }
1255 // phi -
1256 if (sliceValsLow[s])
1257 {
1258 SetupHeight(sliceValsLow[s], s, towerH);
1259 MakeRhoZCell(thetaMin, thetaMax, offLow, isBarrel, kFALSE , towerH, pnts);
1260 offLow += towerH;
1261 fRenderData->PushV(pnts, 12);
1262 fRenderData->PushI( s);
1263 fRenderData->PushI(etaBin);
1264 fRenderData->PushN(sliceValsLow[s]);
1265 }
1266
1267 }
1268 }
1269 }
1270
1271 delete [] sliceValsUp;
1272 delete [] sliceValsLow;
1273}
1274
1275////////////////////////////////////////////////////////////////////////////////
1276/// Get cell vertices in RhoZ projection.
1277///
1279 Float_t& offset, Bool_t isBarrel, Bool_t phiPlus, Float_t towerH, float *pntsOut) const
1280{
1281 using namespace TMath;
1282
1283 Float_t sin1 = Sin(thetaMin);
1284 Float_t cos1 = Cos(thetaMin);
1285 Float_t sin2 = Sin(thetaMax);
1286 Float_t cos2 = Cos(thetaMax);
1287
1288 Float_t pnts[8];
1289 if (isBarrel)
1290 {
1291 Float_t r1 = fBarrelRadius/Abs(Sin(0.5f*(thetaMin+thetaMax))) + offset;
1292 Float_t r2 = r1 + towerH;
1293
1294 pnts[0] = r1*sin1; pnts[1] = r1*cos1;
1295 pnts[2] = r2*sin1; pnts[3] = r2*cos1;
1296 pnts[4] = r2*sin2; pnts[5] = r2*cos2;
1297 pnts[6] = r1*sin2; pnts[7] = r1*cos2;
1298 }
1299 else
1300 {
1301 // endcap
1303 // uses a different theta definition than GetTransitionThetaBackward(), so we need a conversion
1305 if (thetaMax >= transThetaB)
1306 zE = Abs(GetBackwardEndCapPos());
1307 Float_t r1 = zE/Abs(Cos(0.5f*(thetaMin+thetaMax))) + offset;
1308 Float_t r2 = r1 + towerH;
1309
1310 pnts[0] = r1*sin1; pnts[1] = r1*cos1;
1311 pnts[2] = r2*sin1; pnts[3] = r2*cos1;
1312 pnts[4] = r2*sin2; pnts[5] = r2*cos2;
1313 pnts[6] = r1*sin2; pnts[7] = r1*cos2;
1314 }
1315
1316
1317 Float_t x, y, z;
1318 for (Int_t i = 0; i < 4; ++i)
1319 {
1320 x = 0.f;
1321 y = phiPlus ? Abs(pnts[2*i]) : -Abs(pnts[2*i]);
1322 z = pnts[2*i+1];
1324
1325 int j = phiPlus ? i : (3 -i);
1326 pntsOut[j*3] = x;
1327 pntsOut[j*3 + 1] = y;
1328 pntsOut[j*3 + 2] = z;
1329 }
1330}
1331
1332////////////////////////////////////////////////////////////////////////////////
1333/// Creates 2D point array in RPhi() projection.
1334
1336{
1338 Int_t nSlices = data->GetNSlices();
1339 Float_t *sliceVal = new Float_t[nSlices];
1340 REveCaloData::CellData_t cellData;
1341 Float_t towerH;
1342
1343 UInt_t nPhi = data->GetPhiBins()->GetNbins();
1344 TAxis* axis = data->GetPhiBins();
1345 float pnts[12];
1346 for(UInt_t phiBin = 1; phiBin <= nPhi; ++phiBin)
1347 {
1348 if (fCellLists[phiBin] )
1349 {
1350 // reset values
1351 Float_t off = 0;
1352 for (Int_t s=0; s<nSlices; ++s)
1353 sliceVal[s] = 0;
1354
1355 // sum eta cells
1356 REveCaloData::vCellId_t* cids = fCellLists[phiBin];
1357 for (REveCaloData::vCellId_i it = cids->begin(); it != cids->end(); it++)
1358 {
1359 data->GetCellData(*it, cellData);
1360 sliceVal[(*it).fSlice] += cellData.Value(fPlotEt)*(*it).fFraction;
1361 }
1362 for (Int_t s = 0; s < nSlices; ++s)
1363 {
1364 SetupHeight(sliceVal[s], s, towerH);
1365 MakeRPhiCell(axis->GetBinLowEdge(phiBin), axis->GetBinUpEdge(phiBin), towerH, off, pnts);
1366 fRenderData->PushV(pnts, 12);
1367 fRenderData->PushI(s);
1368 fRenderData->PushI(phiBin);
1369 fRenderData->PushN(sliceVal[s]);
1370 off += towerH;
1371 }
1372 }
1373 }
1374
1375 delete [] sliceVal;
1376}
1377
1378////////////////////////////////////////////////////////////////////////////////
1379/// Calculate vertices for the calorimeter cell in RPhi projection.
1380/// Returns outside radius of the tower.
1381
1383 Float_t towerH, Float_t offset, float* pntsOut) const
1384{
1385 using namespace TMath;
1386
1388 Float_t r2 = r1 + towerH;
1389
1390 Float_t pnts[8];
1391 pnts[0] = r1*Cos(phiMin); pnts[1] = r1*Sin(phiMin);
1392 pnts[2] = r2*Cos(phiMin); pnts[3] = r2*Sin(phiMin);
1393 pnts[4] = r2*Cos(phiMax); pnts[5] = r2*Sin(phiMax);
1394 pnts[6] = r1*Cos(phiMax); pnts[7] = r1*Sin(phiMax);
1395
1396 for (Int_t i = 0; i < 4; ++i)
1397 {
1398 pntsOut[i*3] = pnts[2*i];
1399 pntsOut[i*3+1] = pnts[2*i+1];
1400 pntsOut[i*3+2] = 0.f;
1401 fManager->GetProjection()->ProjectPoint(pntsOut[3*i], pntsOut[3*i+1], pntsOut[3*i + 2], fDepth);
1402 }
1403}
1404
1405////////////////////////////////////////////////////////////////////////////////
1406/// Client callback
1407
1408void REveCalo2D::NewBinPicked(Int_t bin, Int_t slice, Int_t selectionId, bool multi)
1409{
1410 bool is_upper = bin >= 0;
1411 bin = abs(bin);
1412
1414 for (REveCaloData::vCellId_i it = fCellLists[bin]->begin(); it != fCellLists[bin]->end(); ++it)
1415 {
1416 if ((*it).fSlice == slice)
1417 {
1418 if (IsRPhi())
1419 {
1420 sel.push_back(*it);
1421 }
1422 else
1423 {
1425 fData->GetCellData(*it, cd);
1426 if ((is_upper && cd.IsUpperRho()) || (!is_upper && !cd.IsUpperRho()))
1427 sel.push_back(*it);
1428 }
1429 }
1430 }
1431 fData->ProcessSelection(sel, selectionId, multi);
1432}
1433
1434
1435/** \class REveCaloLego
1436\ingroup REve
1437Visualization of calorimeter data as eta/phi histogram.
1438*/
1439
1440////////////////////////////////////////////////////////////////////////////////
1441/// Constructor.
1442
1443REveCaloLego::REveCaloLego(REveCaloData* d, const char* n, const char* t):
1444 REveCaloViz(d, n, t),
1445
1446 fFontColor(-1),
1447 fGridColor(-1),
1448 fPlaneColor(kRed-5),
1449 fPlaneTransparency(60),
1450
1451 fNZSteps(6),
1452 fZAxisStep(0.f),
1453
1454 fAutoRebin(kTRUE),
1455
1456 fPixelsPerBin(12),
1457 fNormalizeRebin(kFALSE),
1458
1459 fProjection(kAuto),
1460 f2DMode(kValSize),
1461 fBoxMode(kBack),
1462
1463 fDrawHPlane(kFALSE),
1464 fHPlaneVal(0),
1465
1466 fHasFixedHeightIn2DMode(kFALSE),
1467 fFixedHeightValIn2DMode(0.f),
1468
1469 fDrawNumberCellPixels(18), // draw numbers on cell above 30 pixels
1470 fCellPixelFontSize(12) // size of cell fonts in pixels
1471{
1472 fMaxTowerH = 4;
1473 SetNameTitle("REveCaloLego", "REveCaloLego");
1474}
1475
1476////////////////////////////////////////////////////////////////////////////////
1477// Set data.
1478
1480{
1482}
1483
1484////////////////////////////////////////////////////////////////////////////////
1485/// Build list of drawn cell IDs. For more information see REveCaloLegoGL:DirectDraw().
1486
1488{
1489 fCellList.clear();
1490
1493}
1494
1495////////////////////////////////////////////////////////////////////////////////
1496/// Fill bounding-box information of the base-class TAttBBox (virtual method).
1497/// If member 'REveFrameBox* fFrame' is set, frame's corners are used as bbox.
1498
1500{
1501
1502 // fBBox = Float_t[6] X(min,max), Y(min,max), Z(min,max)
1503
1504 BBoxZero();
1505
1506 Float_t ex = 1.2; // 20% offset for axis labels
1507
1508 Float_t a = 0.5*ex;
1509
1510 fBBox[0] = -a;
1511 fBBox[1] = a;
1512 fBBox[2] = -a;
1513 fBBox[3] = a;
1514
1515 // scaling is relative to shortest XY axis
1516 Double_t em, eM, pm, pM;
1517 fData->GetEtaLimits(em, eM);
1518 fData->GetPhiLimits(pm, pM);
1519 Double_t r = (eM-em)/(pM-pm);
1520 if (r<1)
1521 {
1522 fBBox[2] /= r;
1523 fBBox[3] /= r;
1524 }
1525 else
1526 {
1527 fBBox[0] *= r;
1528 fBBox[1] *= r;
1529 }
1530
1531 fBBox[4] = 0;
1532 if (fScaleAbs && !fData->Empty())
1534 else
1535 fBBox[5] = fMaxTowerH;
1536}
1537
std::string kAuto
Definition RColor.cxx:37
#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
short Color_t
Definition RtypesCore.h:92
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
@ kGray
Definition Rtypes.h:65
@ kRed
Definition Rtypes.h:66
winID h TVirtualViewer3D TVirtualGLPainter p
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
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 r
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
#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
~REveCalo2D() override
Destructor.
Definition REveCalo.cxx:755
std::vector< REveCaloData::vCellId_t * >::iterator vBinCells_i
Definition REveCalo.hxx:209
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:214
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:227
std::vector< REveCaloData::vCellId_t * > fCellListsSelected
Definition REveCalo.hxx:229
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.
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
REveCalo3D(REveCaloData *d=nullptr, const char *n="REveCalo3D", const char *t="")
Constructor.
Definition REveCalo.cxx:452
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:535
void MakeEndCapCell(const REveCaloData::CellGeom_t &cellData, float towerH, Float_t &offset, float *pnts) const
Make endcap cell.
Definition REveCalo.cxx:470
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:602
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:165
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:276
REveCaloLego(REveCaloData *data=nullptr, 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:427
virtual REveElement * ForwardSelection()
Management of selection state and ownership of selected cell list is done in REveCaloData.
Definition REveCalo.cxx:96
Float_t GetBarrelRadius() const
Definition REveCalo.hxx:98
Float_t GetBackwardEndCapPos() const
Definition REveCalo.hxx:102
void SetPlotEt(Bool_t x)
Set E/Et plot.
Definition REveCalo.cxx:149
Float_t GetTransitionTheta() const
Get transition angle between barrel and end-cap cells, assuming fEndCapPosF = -fEndCapPosB.
Definition REveCalo.cxx:184
virtual void BuildCellIdCache()=0
void SetPalette(REveRGBAPalette *p)
Set REveRGBAPalette object pointer.
Definition REveCalo.cxx:348
virtual void SetScaleAbs(Bool_t x)
Definition REveCalo.hxx:83
Float_t GetTransitionEtaForward() const
Get transition eta between barrel and forward end-cap cells.
Definition REveCalo.cxx:210
void DataChanged()
Update setting and cache on data changed.
Definition REveCalo.cxx:257
void SetDataSliceColor(Int_t slice, Color_t col)
Set slice color in data.
Definition REveCalo.cxx:130
Float_t GetTransitionEta() const
Get transition eta between barrel and end-cap cells, assuming fEndCapPosF = -fEndCapPosB.
Definition REveCalo.cxx:192
Color_t GetDataSliceColor(Int_t slice) const
Get slice color from data.
Definition REveCalo.cxx:122
Float_t GetTransitionEtaBackward() const
Get transition eta between barrel and backward end-cap cells.
Definition REveCalo.cxx:228
Bool_t AssertCellIdCache() const
Assert cell id cache is ok.
Definition REveCalo.cxx:294
void SetPhiWithRng(Float_t x, Float_t r)
Set phi range.
Definition REveCalo.cxx:171
~REveCaloViz() override
Destructor.
Definition REveCalo.cxx:79
virtual Float_t GetValToHeight() const
Get transformation factor from E/Et to height.
Definition REveCalo.cxx:359
TClass * ProjectedClass(const REveProjection *p) const override
Virtual from REveProjectable, returns REveCalo2D class.
Definition REveCalo.cxx:399
Float_t GetDataSliceThreshold(Int_t slice) const
Get threshold for given slice.
Definition REveCalo.cxx:87
Float_t GetForwardEndCapPos() const
Definition REveCalo.hxx:101
Bool_t CellInEtaPhiRng(REveCaloData::CellData_t &) const
Returns true if given cell is in the ceta phi range.
Definition REveCalo.cxx:308
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:407
Float_t GetTransitionThetaForward() const
Get transition angle between barrel and forward end-cap cells.
Definition REveCalo.cxx:202
void SetData(REveCaloData *d)
Set calorimeter event data.
Definition REveCalo.cxx:240
Float_t GetTransitionThetaBackward() const
Get transition angle between barrel and backward end-cap cells.
Definition REveCalo.cxx:220
void AssignCaloVizParameters(REveCaloViz *cv)
Assign parameters from given model.
Definition REveCalo.cxx:322
virtual REveElement * ForwardEdit()
Management of selection state and ownership of selected cell list is done in REveCaloData.
Definition REveCalo.cxx:106
void SetDataSliceThreshold(Int_t slice, Float_t val)
Set threshold for given slice.
Definition REveCalo.cxx:114
REveRGBAPalette * AssertPalette()
Make sure the REveRGBAPalette pointer is not null.
Definition REveCalo.cxx:380
void SetEta(Float_t l, Float_t u)
Set eta range.
Definition REveCalo.cxx:138
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:41
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:293
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:272
void BBoxCheckPoint(Float_t x, Float_t y, Float_t z)
Definition TAttBBox.h:69
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:31
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:125
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:81
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)
Returns the largest of a and b.
Definition TMathBase.h:250
Double_t ATan(Double_t)
Returns the principal value of the arc tangent of x, expressed in radians.
Definition TMath.h:640
T1 Sign(T1 a, T2 b)
Returns a value with the magnitude of a and the sign of b.
Definition TMathBase.h:175
Int_t CeilNint(Double_t x)
Returns the nearest integer of TMath::Ceil(x).
Definition TMath.h:674
Float_t Value(Bool_t) const
Return energy value associated with the cell, usually Et.
TMarker m
Definition textangle.C:8
TLine l
Definition textangle.C:4