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"
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
83
84////////////////////////////////////////////////////////////////////////////////
85/// Get threshold for given slice.
86
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
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
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
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
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
703
704////////////////////////////////////////////////////////////////////////////////
705/// Fill the bounding box (virtual from REveElement).
706/// If member 'REveFrameBox* fFrame' is set, frame's corners are used as bbox.
707
709{
710 BBoxInit();
711
713 Float_t r = fBarrelRadius + th;
714
715 fBBoxMin.Set(-r, -r, fEndCapPosB - th);
716 fBBoxMax.Set(r, r, fEndCapPosF + th);
717}
718
719/** \class REveCalo2D
720\ingroup REve
721Visualization of a calorimeter event data in 2D.
722*/
723
724////////////////////////////////////////////////////////////////////////////////
725/// Client selection callback
726
727void REveCalo3D::NewTowerPicked(Int_t tower, Int_t slice, Int_t selectionId, bool multi)
728{
729 REveCaloData::CellId_t cell(tower, slice, 1.0f);
731
732 sel.push_back(cell);
733 fData->ProcessSelection(sel, selectionId, multi);
734}
735
736
737////////////////////////////////////////////////////////////////////////////////
738/// Constructor.
739
740REveCalo2D::REveCalo2D(const char* n, const char* t):
741 REveCaloViz(nullptr, n, t),
743 fOldProjectionType(REveProjection::kPT_Unknown),
744 fMaxESumBin( 0),
745 fMaxEtSumBin(0)
746{
747}
748
749////////////////////////////////////////////////////////////////////////////////
750/// Destructor.
751
753{
755 UInt_t n;
756
757 // clear selected cell ids
758 n = fCellListsSelected.size();
759 for(UInt_t i = 0; i < n; ++i) {
760 cids = fCellListsSelected[i];
761 if (cids) {
762 cids->clear(); delete cids;
763 }
764 }
765 fCellListsSelected.clear();
766
767 // clear all cell dds
768 n = fCellLists.size();
769 for(UInt_t i = 0; i < n; ++i) {
770 cids = fCellLists[i];
771 if (cids) {
772 cids->clear(); delete cids;
773 }
774 }
775 fCellLists.clear();
776}
777
778////////////////////////////////////////////////////////////////////////////////
779/// This is virtual method from base-class REveProjected.
780
790
791////////////////////////////////////////////////////////////////////////////////
792/// Set projection manager and model object.
793
795{
797 REveCaloViz* viz = dynamic_cast<REveCaloViz*>(model);
799}
800
801////////////////////////////////////////////////////////////////////////////////
802/// Is current projection type RPhi
803
808
809////////////////////////////////////////////////////////////////////////////////
810/// Build lists of drawn cell IDs. See REveCalo2DGL::DirecDraw().
811
813{
814 // clear old cache
815 for (vBinCells_i it = fCellLists.begin(); it != fCellLists.end(); it++)
816 {
817 if (*it)
818 {
819 (*it)->clear();
820 delete *it;
821 }
822 }
823 fCellLists.clear();
824 fCellLists.push_back(nullptr);
825
827 REveCaloData::vCellId_t* clv; // ids per phi bin in r-phi projection else ids per eta bins in rho-z projection
828
829 Bool_t isRPhi = (pt == REveProjection::kPT_RPhi);
830
831 const TAxis* axis = isRPhi ? fData->GetPhiBins() : fData->GetEtaBins();
832 Int_t nBins = axis->GetNbins();
833
834 Float_t min, max;
835 if (isRPhi)
836 {
837 min = GetPhiMin() - fData->GetEps();
838 max = GetPhiMax() + fData->GetEps();
839 for (Int_t ibin = 1; ibin <= nBins; ++ibin) {
840 clv = nullptr;
842 (min, max, axis->GetBinLowEdge(ibin), axis->GetBinUpEdge(ibin)))
843 {
844 clv = new REveCaloData::vCellId_t();
845 fData->GetCellList(GetEta(), GetEtaRng(), axis->GetBinCenter(ibin), axis->GetBinWidth(ibin), *clv);
846 if (clv->empty()) {
847 delete clv; clv = nullptr;
848 }
849 }
850 fCellLists.push_back(clv);
851 }
852 }
853 else
854 {
855 min = GetEtaMin() - fData->GetEps();
856 max = GetEtaMax() + fData->GetEps();
857 for (Int_t ibin = 1; ibin <= nBins; ++ibin) {
858 clv = nullptr;
859 Float_t low = axis->GetBinLowEdge(ibin);
860 Float_t up = axis->GetBinUpEdge(ibin) ;
861 if (low >= min && up <= max)
862 {
863 clv = new REveCaloData::vCellId_t();
864 fData->GetCellList(axis->GetBinCenter(ibin), axis->GetBinWidth(ibin), fPhi, GetPhiRng(), *clv);
865 if (clv->empty()) {
866 delete clv; clv = nullptr;
867 }
868 }
869 fCellLists.push_back(clv);
870 }
871 }
872
873 // cache max bin sum for auto scale
874 if (!fScaleAbs)
875 {
876 fMaxESumBin = 0;
877 fMaxEtSumBin = 0;
878 Float_t sumE = 0;
879 Float_t sumEt = 0;
881 for (Int_t ibin = 1; ibin <= nBins; ++ibin) {
883 if (cids)
884 {
885 sumE = 0; sumEt = 0;
886 for (REveCaloData::vCellId_i it = cids->begin(); it != cids->end(); it++)
887 {
888 fData->GetCellData(*it, cellData);
889 sumE += cellData.Value(kFALSE);
890 sumEt += cellData.Value(kTRUE);
891 }
894 }
895 }
896 ComputeBBox();
897 }
898
900}
901
902//////////////////////////////////////////////s//////////////////////////////////
903/// Sort selected cells in eta or phi bins.
904
905void REveCalo2D::CellSelectionChangedInternal(REveCaloData::vCellId_t& inputCells, std::vector<REveCaloData::vCellId_t*>& outputCellLists)
906{
908 const TAxis* axis = isRPhi ? fData->GetPhiBins() : fData->GetEtaBins();
909
910 // clear old cache
911 for (vBinCells_i it = outputCellLists.begin(); it != outputCellLists.end(); it++)
912 {
913 if (*it)
914 {
915 (*it)->clear();
916 delete *it;
917 }
918 }
919 outputCellLists.clear();
920 UInt_t nBins = axis->GetNbins();
921 outputCellLists.resize(nBins+1);
922 for (UInt_t b = 0; b <= nBins; ++b)
923 outputCellLists[b] = nullptr;
924
925 for(UInt_t bin = 1; bin <= nBins; ++bin)
926 {
927 REveCaloData::vCellId_t* idsInBin = fCellLists[bin];
928 if (!idsInBin)
929 continue;
930
931 for (REveCaloData::vCellId_i i = idsInBin->begin(); i != idsInBin->end(); i++)
932 {
933 for (REveCaloData::vCellId_i j = inputCells.begin(); j != inputCells.end(); j++)
934 {
935 if( (*i).fTower == (*j).fTower && (*i).fSlice == (*j).fSlice)
936 {
937 if (!outputCellLists[bin])
938 outputCellLists[bin] = new REveCaloData::vCellId_t();
939
940 outputCellLists[bin]->emplace_back((*i).fTower, (*i).fSlice, (*j).fFraction);
941 }
942 }
943 }
944 }
945}
946
947////////////////////////////////////////////////////////////////////////////////
948/// Set absolute scale in projected calorimeter.
949
955
956////////////////////////////////////////////////////////////////////////////////
957/// Virtual function of REveCaloViz.
958/// Get transformation factor from E/Et to height.
959
961{
963
964 if (fScaleAbs)
965 {
966 return fMaxTowerH/fMaxValAbs;
967 }
968 else
969 {
970 if (fData->Empty())
971 return 1;
972
973 if (fPlotEt)
975 else
976 return fMaxTowerH/fMaxESumBin;
977 }
978}
979
980////////////////////////////////////////////////////////////////////////////////
981/// Fill the bounding box (virtual from REveElement).
982/// If member 'REveFrameBox* fFrame' is set, frame's corners are used as bbox.
983
985{
986 BBoxZero();
987
988 Float_t x, y, z;
989 Float_t th = fMaxTowerH ;
990 Float_t r = fBarrelRadius + th;
991
992 x = r, y = 0, z = 0;
994 BBoxCheckPoint(x, y, z);
995 x = -r, y = 0, z = 0;
997 BBoxCheckPoint(x, y, z);
998
999 x = 0, y = 0, z = fEndCapPosF + th;
1001 BBoxCheckPoint(x, y, z);
1002 x = 0, y = 0, z = fEndCapPosB - th;
1004 BBoxCheckPoint(x, y, z);
1005
1006 x = 0, y = r, z = 0;
1008 BBoxCheckPoint(x, y, z);
1009 x = 0, y = -r, z = 0;
1011 BBoxCheckPoint(x, y, z);
1012}
1013
1014////////////////////////////////////////////////////////////////////////////////
1015/// Fill core part of JSON representation.
1016
1017Int_t REveCalo2D::WriteCoreJson(nlohmann::json &j, Int_t rnr_offset)
1018{
1019 Int_t ret = REveCaloViz::WriteCoreJson(j, rnr_offset);
1020 j["isRPhi"] = IsRPhi();
1021 return ret;
1022}
1023
1024////////////////////////////////////////////////////////////////////////////////
1025/// Fill core part of JSON representation for selection.
1026
1028{
1029 static const REveException eh("REveCalo2D::WriteCoreJsonSelection ");
1030 auto sarr = nlohmann::json::array();
1031
1032 // selection
1033 // auto cellLists = isSel ? fCellListsSelected : fCellListsHighlighted;
1034 std::vector<REveCaloData::vCellId_t*> cellLists;
1035 CellSelectionChangedInternal(cells, cellLists);
1036
1037 if (IsRPhi()) {
1038 REveCaloData::CellData_t cellData;
1039 Int_t nSlices = fData->GetNSlices();
1040 Float_t *sliceVal = new Float_t[nSlices];
1041 Float_t *sliceValRef = new Float_t[nSlices];
1042 UInt_t nPhiBins = fData->GetPhiBins()->GetNbins();
1043 for(UInt_t phiBin = 1; phiBin <= nPhiBins; ++phiBin)
1044 {
1045 if (cellLists[phiBin])
1046 {
1047 if (!fCellLists[phiBin]) {
1048 delete[] sliceVal;
1049 delete[] sliceValRef;
1050 throw eh + "selected cell not in cell list cache.";
1051 }
1052
1053 // selected eta sum
1054 for (Int_t s=0; s<nSlices; ++s) sliceVal[s] = 0;
1055 REveCaloData::vCellId_t& cids = *(cellLists[phiBin]);
1056 for (REveCaloData::vCellId_i i=cids.begin(); i!=cids.end(); i++) {
1057 fData->GetCellData((*i), cellData);
1058 sliceVal[i->fSlice] += cellData.Value(fPlotEt)*(*i).fFraction;
1059 }
1060 // referenced eta sum
1061 for (Int_t s=0; s<nSlices; ++s) sliceValRef[s] = 0;
1062 REveCaloData::vCellId_t& cidsRef = *(fCellLists[phiBin]);
1063 for (REveCaloData::vCellId_i i=cidsRef.begin(); i!=cidsRef.end(); i++) {
1064 fData->GetCellData(*i, cellData);
1065 sliceValRef[i->fSlice] += cellData.Value(fPlotEt)*(*i).fFraction;
1066 }
1067
1068 // write
1069 for (Int_t s = 0; s < nSlices; ++s) {
1070 if (sliceVal[s] > 0)
1071 {
1072 nlohmann::json jsc;
1073 jsc["b"] = phiBin;
1074 jsc["s"] = s;
1075 jsc["f"] = sliceVal[s]/sliceValRef[s];
1076 sarr.push_back(jsc);
1077 }
1078 }
1079 }
1080 }
1081 }
1082 else {
1083 TAxis* axis = fData->GetEtaBins();
1084 UInt_t nEtaBins = axis->GetNbins();
1085 Int_t nSlices = fData->GetNSlices();
1086
1087 std::vector<Float_t> sliceValsUp(nSlices, 0.);
1088 std::vector<Float_t> sliceValsLow(nSlices, 0.);
1089 std::vector<Float_t> sliceValsUpRef(nSlices, 0.);
1090 std::vector<Float_t> sliceValsLowRef(nSlices, 0.);
1091
1092 Float_t towerH, towerHRef;
1093 REveCaloData::CellData_t cellData;
1094
1095 for (UInt_t etaBin = 1; etaBin <= nEtaBins; ++etaBin)
1096 {
1097 if (cellLists[etaBin])
1098 {
1099 if (!fCellLists[etaBin]) {
1100 throw(eh + "selected cell not in cell list cache.");
1101 }
1102 // selected phi sum
1103 for (Int_t s = 0; s < nSlices; ++s) {
1104 sliceValsUp[s] = sliceValsLow[s] = 0.;
1105 }
1106 REveCaloData::vCellId_t& cids = *(cellLists[etaBin]);
1107 for (REveCaloData::vCellId_i i=cids.begin(); i!=cids.end(); i++) {
1108 fData->GetCellData(*i, cellData);
1109 if (cellData.IsUpperRho())
1110 sliceValsUp [i->fSlice] += cellData.Value(fPlotEt)*(*i).fFraction;
1111 else
1112 sliceValsLow[i->fSlice] += cellData.Value(fPlotEt)*(*i).fFraction;
1113 }
1114
1115 // reference phi sum
1116 for (Int_t s = 0; s < nSlices; ++s)
1117 {
1118 sliceValsUpRef[s] = sliceValsLowRef[s] = 0;
1119 }
1120 REveCaloData::vCellId_t& cidsRef = *(fCellLists[etaBin]);
1121 for (REveCaloData::vCellId_i i=cidsRef.begin(); i!=cidsRef.end(); i++)
1122 {
1123 fData->GetCellData(*i, cellData);
1124 if (cellData.IsUpperRho())
1125 sliceValsUpRef [i->fSlice] += cellData.Value(fPlotEt)*(*i).fFraction;
1126 else
1127 sliceValsLowRef[i->fSlice] += cellData.Value(fPlotEt)*(*i).fFraction;
1128 }
1129
1130 for (Int_t s = 0; s < nSlices; ++s)
1131 {
1132 // phi +
1133 SetupHeight(sliceValsUpRef[s], s, towerHRef);
1134 if (sliceValsUp[s] > 0) {
1135 SetupHeight(sliceValsUp[s], s, towerH);
1136 nlohmann::json jsc;
1137 jsc["b"] = etaBin;
1138 jsc["s"] = s;
1139 jsc["f"] = sliceValsUp[s]/sliceValsUpRef[s];
1140 sarr.push_back(jsc);
1141 }
1142
1143 // phi -
1144 SetupHeight(sliceValsLowRef[s], s, towerHRef);
1145 if (sliceValsLow[s] > 0) {
1146 SetupHeight(sliceValsLow[s], s, towerH);
1147 nlohmann::json jsc;
1148 jsc["b"] = Int_t(-etaBin);
1149 jsc["s"] = s;
1150 jsc["f"] = sliceValsLow[s]/sliceValsLowRef[s];
1151 sarr.push_back(jsc);
1152 }
1153 } // slices
1154 } // if eta bin
1155 } //eta bins
1156 } // RhoZ
1157
1158 nlohmann::json rec = {};
1159 rec["caloVizId"] = GetElementId();
1160 rec["cells"] = sarr;
1161 j.push_back(rec);
1162}
1163
1164////////////////////////////////////////////////////////////////////////////////
1165/// Creates 2D point array for rendering.
1166
1168{
1170 fRenderData = std::make_unique<REveRenderData>("makeCalo2D");
1171
1172 bool isEmpty = fData->Empty();
1173
1174 for (vBinCells_i it = fCellLists.begin(); it != fCellLists.end(); ++it)
1175 {
1176 if ((*it) && (*it)->empty())
1177 {
1178 isEmpty = false;
1179 break;
1180 }
1181 }
1182 if (isEmpty) return;
1183
1184 if (IsRPhi())
1186 else
1188}
1189
1190
1191////////////////////////////////////////////////////////////////////////////////
1192/// Creates 2D point array in RhoZ projection.
1193
1195{
1196 Int_t nSlices = fData->GetNSlices();
1197
1198 REveCaloData::CellData_t cellData;
1199 Float_t *sliceValsUp = new Float_t[nSlices];
1200 Float_t *sliceValsLow = new Float_t[nSlices];
1201 Bool_t isBarrel;
1202 Float_t towerH;
1203 Float_t transEtaF = GetTransitionEtaForward();
1204 Float_t transEtaB = GetTransitionEtaBackward();
1205
1206 TAxis* axis = fData->GetEtaBins();
1207 UInt_t nEta = axis->GetNbins();
1208 Float_t pnts[12];
1209 for (UInt_t etaBin = 1; etaBin <= nEta; ++etaBin)
1210 {
1211 if (fCellLists[etaBin] )
1212 {
1213 assert(fCellLists[etaBin]);
1214 Float_t etaMin = axis->GetBinLowEdge(etaBin);
1215 Float_t etaMax = axis->GetBinUpEdge(etaBin);
1216 Float_t thetaMin = REveCaloData::EtaToTheta(etaMax);
1217 Float_t thetaMax = REveCaloData::EtaToTheta(etaMin);
1218 // printf("----------------------------------------- eta(%f, %f)\n", etaMin, etaMax);
1219
1220 // clear
1221 Float_t offUp = 0;
1222 Float_t offLow = 0;
1223 for (Int_t s = 0; s < nSlices; ++s) {
1224 sliceValsUp [s] = 0;
1225 sliceValsLow[s] = 0;
1226 }
1227 // values
1228 REveCaloData::vCellId_t* cids = fCellLists[etaBin];
1229 for (REveCaloData::vCellId_i it = cids->begin(); it != cids->end(); ++it)
1230 {
1231 fData->GetCellData(*it, cellData);
1232 if (cellData.IsUpperRho())
1233 sliceValsUp [it->fSlice] += cellData.Value(fPlotEt)*(*it).fFraction;
1234 else
1235 sliceValsLow[it->fSlice] += cellData.Value(fPlotEt)*(*it).fFraction;
1236 }
1237
1238 isBarrel = !(etaMax > 0 && etaMax > transEtaF) && !(etaMin < 0 && etaMin < transEtaB);
1239 for (Int_t s = 0; s < nSlices; ++s)
1240 {
1241 // phi +
1242 if (sliceValsUp[s])
1243 {
1244 SetupHeight(sliceValsUp[s], s, towerH);
1245 MakeRhoZCell(thetaMin, thetaMax, offUp, isBarrel, kTRUE , towerH, pnts);
1246 offUp += towerH;
1247 fRenderData->PushV(pnts, 12);
1248 fRenderData->PushI( s);
1249 fRenderData->PushI(etaBin);
1250 fRenderData->PushN(sliceValsUp[s]);
1251 }
1252 // phi -
1253 if (sliceValsLow[s])
1254 {
1255 SetupHeight(sliceValsLow[s], s, towerH);
1256 MakeRhoZCell(thetaMin, thetaMax, offLow, isBarrel, kFALSE , towerH, pnts);
1257 offLow += towerH;
1258 fRenderData->PushV(pnts, 12);
1259 fRenderData->PushI( s);
1260 fRenderData->PushI(etaBin);
1261 fRenderData->PushN(sliceValsLow[s]);
1262 }
1263
1264 }
1265 }
1266 }
1267
1268 delete [] sliceValsUp;
1269 delete [] sliceValsLow;
1270}
1271
1272////////////////////////////////////////////////////////////////////////////////
1273/// Get cell vertices in RhoZ projection.
1274///
1276 Float_t& offset, Bool_t isBarrel, Bool_t phiPlus, Float_t towerH, float *pntsOut) const
1277{
1278 using namespace TMath;
1279
1280 Float_t sin1 = Sin(thetaMin);
1281 Float_t cos1 = Cos(thetaMin);
1282 Float_t sin2 = Sin(thetaMax);
1283 Float_t cos2 = Cos(thetaMax);
1284
1285 Float_t pnts[8];
1286 if (isBarrel)
1287 {
1288 Float_t r1 = fBarrelRadius/Abs(Sin(0.5f*(thetaMin+thetaMax))) + offset;
1289 Float_t r2 = r1 + towerH;
1290
1291 pnts[0] = r1*sin1; pnts[1] = r1*cos1;
1292 pnts[2] = r2*sin1; pnts[3] = r2*cos1;
1293 pnts[4] = r2*sin2; pnts[5] = r2*cos2;
1294 pnts[6] = r1*sin2; pnts[7] = r1*cos2;
1295 }
1296 else
1297 {
1298 // endcap
1300 // uses a different theta definition than GetTransitionThetaBackward(), so we need a conversion
1302 if (thetaMax >= transThetaB)
1303 zE = Abs(GetBackwardEndCapPos());
1304 Float_t r1 = zE/Abs(Cos(0.5f*(thetaMin+thetaMax))) + offset;
1305 Float_t r2 = r1 + towerH;
1306
1307 pnts[0] = r1*sin1; pnts[1] = r1*cos1;
1308 pnts[2] = r2*sin1; pnts[3] = r2*cos1;
1309 pnts[4] = r2*sin2; pnts[5] = r2*cos2;
1310 pnts[6] = r1*sin2; pnts[7] = r1*cos2;
1311 }
1312
1313
1314 Float_t x, y, z;
1315 for (Int_t i = 0; i < 4; ++i)
1316 {
1317 x = 0.f;
1318 y = phiPlus ? Abs(pnts[2*i]) : -Abs(pnts[2*i]);
1319 z = pnts[2*i+1];
1321
1322 int j = phiPlus ? i : (3 -i);
1323 pntsOut[j*3] = x;
1324 pntsOut[j*3 + 1] = y;
1325 pntsOut[j*3 + 2] = z;
1326 }
1327}
1328
1329////////////////////////////////////////////////////////////////////////////////
1330/// Creates 2D point array in RPhi() projection.
1331
1333{
1335 Int_t nSlices = data->GetNSlices();
1336 Float_t *sliceVal = new Float_t[nSlices];
1337 REveCaloData::CellData_t cellData;
1338 Float_t towerH;
1339
1340 UInt_t nPhi = data->GetPhiBins()->GetNbins();
1341 TAxis* axis = data->GetPhiBins();
1342 float pnts[12];
1343 for(UInt_t phiBin = 1; phiBin <= nPhi; ++phiBin)
1344 {
1345 if (fCellLists[phiBin] )
1346 {
1347 // reset values
1348 Float_t off = 0;
1349 for (Int_t s=0; s<nSlices; ++s)
1350 sliceVal[s] = 0;
1351
1352 // sum eta cells
1353 REveCaloData::vCellId_t* cids = fCellLists[phiBin];
1354 for (REveCaloData::vCellId_i it = cids->begin(); it != cids->end(); it++)
1355 {
1356 data->GetCellData(*it, cellData);
1357 sliceVal[(*it).fSlice] += cellData.Value(fPlotEt)*(*it).fFraction;
1358 }
1359 for (Int_t s = 0; s < nSlices; ++s)
1360 {
1361 SetupHeight(sliceVal[s], s, towerH);
1362 MakeRPhiCell(axis->GetBinLowEdge(phiBin), axis->GetBinUpEdge(phiBin), towerH, off, pnts);
1363 fRenderData->PushV(pnts, 12);
1364 fRenderData->PushI(s);
1365 fRenderData->PushI(phiBin);
1366 fRenderData->PushN(sliceVal[s]);
1367 off += towerH;
1368 }
1369 }
1370 }
1371
1372 delete [] sliceVal;
1373}
1374
1375////////////////////////////////////////////////////////////////////////////////
1376/// Calculate vertices for the calorimeter cell in RPhi projection.
1377/// Returns outside radius of the tower.
1378
1380 Float_t towerH, Float_t offset, float* pntsOut) const
1381{
1382 using namespace TMath;
1383
1385 Float_t r2 = r1 + towerH;
1386
1387 Float_t pnts[8];
1388 pnts[0] = r1*Cos(phiMin); pnts[1] = r1*Sin(phiMin);
1389 pnts[2] = r2*Cos(phiMin); pnts[3] = r2*Sin(phiMin);
1390 pnts[4] = r2*Cos(phiMax); pnts[5] = r2*Sin(phiMax);
1391 pnts[6] = r1*Cos(phiMax); pnts[7] = r1*Sin(phiMax);
1392
1393 for (Int_t i = 0; i < 4; ++i)
1394 {
1395 pntsOut[i*3] = pnts[2*i];
1396 pntsOut[i*3+1] = pnts[2*i+1];
1397 pntsOut[i*3+2] = 0.f;
1398 fManager->GetProjection()->ProjectPoint(pntsOut[3*i], pntsOut[3*i+1], pntsOut[3*i + 2], fDepth);
1399 }
1400}
1401
1402////////////////////////////////////////////////////////////////////////////////
1403/// Client callback
1404
1405void REveCalo2D::NewBinPicked(Int_t bin, Int_t slice, Int_t selectionId, bool multi)
1406{
1407 bool is_upper = bin >= 0;
1408 bin = abs(bin);
1409
1411 for (REveCaloData::vCellId_i it = fCellLists[bin]->begin(); it != fCellLists[bin]->end(); ++it)
1412 {
1413 if ((*it).fSlice == slice)
1414 {
1415 if (IsRPhi())
1416 {
1417 sel.push_back(*it);
1418 }
1419 else
1420 {
1422 fData->GetCellData(*it, cd);
1423 if ((is_upper && cd.IsUpperRho()) || (!is_upper && !cd.IsUpperRho()))
1424 sel.push_back(*it);
1425 }
1426 }
1427 }
1428 fData->ProcessSelection(sel, selectionId, multi);
1429}
1430
1431
1432/** \class REveCaloLego
1433\ingroup REve
1434Visualization of calorimeter data as eta/phi histogram.
1435*/
1436
1437////////////////////////////////////////////////////////////////////////////////
1438/// Constructor.
1439
1440REveCaloLego::REveCaloLego(REveCaloData* d, const char* n, const char* t):
1441 REveCaloViz(d, n, t),
1442
1443 fFontColor(-1),
1444 fGridColor(-1),
1445 fPlaneColor(kRed-5),
1446 fPlaneTransparency(60),
1447
1448 fNZSteps(6),
1449 fZAxisStep(0.f),
1450
1451 fAutoRebin(kTRUE),
1452
1453 fPixelsPerBin(12),
1454 fNormalizeRebin(kFALSE),
1455
1456 fProjection(kAuto),
1457 f2DMode(kValSize),
1458 fBoxMode(kBack),
1459
1460 fDrawHPlane(kFALSE),
1461 fHPlaneVal(0),
1462
1463 fHasFixedHeightIn2DMode(kFALSE),
1464 fFixedHeightValIn2DMode(0.f),
1465
1466 fDrawNumberCellPixels(18), // draw numbers on cell above 30 pixels
1467 fCellPixelFontSize(12) // size of cell fonts in pixels
1468{
1469 fMaxTowerH = 4;
1470 SetNameTitle("REveCaloLego", "REveCaloLego");
1471}
1472
1473////////////////////////////////////////////////////////////////////////////////
1474// Set data.
1475
1480
1481////////////////////////////////////////////////////////////////////////////////
1482/// Build list of drawn cell IDs. For more information see REveCaloLegoGL:DirectDraw().
1483
1491
1492////////////////////////////////////////////////////////////////////////////////
1493/// Fill the bounding box (virtual from REveElement).
1494/// If member 'REveFrameBox* fFrame' is set, frame's corners are used as bbox.
1495
1497{
1498 BBoxZero();
1499
1500 Float_t ex = 1.2; // 20% offset for axis labels
1501
1502 Float_t a = 0.5*ex;
1503
1504 fBBoxMin.fX = -a;
1505 fBBoxMax.fX = a;
1506 fBBoxMin.fY = -a;
1507 fBBoxMax.fY = a;
1508
1509 // scaling is relative to shortest XY axis
1510 Double_t em, eM, pm, pM;
1511 fData->GetEtaLimits(em, eM);
1512 fData->GetPhiLimits(pm, pM);
1513 Double_t r = (eM-em)/(pM-pm);
1514 if (r<1)
1515 {
1516 fBBoxMin.fY /= r;
1517 fBBoxMax.fY /= r;
1518 }
1519 else
1520 {
1521 fBBoxMin.fX *= r;
1522 fBBoxMax.fX *= r;
1523 }
1524
1525 fBBoxMin.fZ = 0;
1526 if (fScaleAbs && !fData->Empty())
1528 else
1530}
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
Signed integer 4 bytes (int)
Definition RtypesCore.h:60
short Color_t
Color number (short)
Definition RtypesCore.h:100
constexpr Bool_t kFALSE
Definition RtypesCore.h:109
constexpr Bool_t kTRUE
Definition RtypesCore.h:108
@ 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 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 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 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:794
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:804
void WriteCoreJsonSelection(nlohmann::json &j, REveCaloData::vCellId_t) override
Fill core part of JSON representation for selection.
void ComputeBBox() override
Fill the bounding box (virtual from REveElement).
Definition REveCalo.cxx:984
~REveCalo2D() override
Destructor.
Definition REveCalo.cxx:752
std::vector< REveCaloData::vCellId_t * >::iterator vBinCells_i
Definition REveCalo.hxx:203
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:905
REveProjection::EPType_e fOldProjectionType
Definition REveCalo.hxx:208
REveCalo2D(const char *n="REveCalo2D", const char *t="")
Constructor.
Definition REveCalo.cxx:740
void UpdateProjection() override
This is virtual method from base-class REveProjected.
Definition REveCalo.cxx:781
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:221
std::vector< REveCaloData::vCellId_t * > fCellListsSelected
Definition REveCalo.hxx:223
void BuildCellIdCache() override
Build lists of drawn cell IDs. See REveCalo2DGL::DirecDraw().
Definition REveCalo.cxx:812
void BuildRenderDataRhoZ()
Creates 2D point array in RhoZ projection.
Float_t GetValToHeight() const override
Virtual function of REveCaloViz.
Definition REveCalo.cxx:960
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:950
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 the bounding box (virtual from REveElement).
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:727
REveCaloData::vCellId_t fCellList
Definition REveCalo.hxx:159
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 the bounding box (virtual from REveElement).
REveCaloData::vCellId_t fCellList
Definition REveCalo.hxx:270
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:92
Float_t GetBackwardEndCapPos() const
Definition REveCalo.hxx:96
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:77
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:95
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.
void BBoxCheckPoint(const REveVector &v)
std::unique_ptr< REveRenderData > fRenderData
! Vertex / normal / triangle index information for rendering.
void BBoxZero(Float_t epsilon=0, Float_t x=0, Float_t y=0, Float_t z=0)
Set the bounding box to a cube of half-side epsilon at (x, y, z); with the defaults,...
void BBoxInit()
Start filling the bounding box with BBoxCheckPoint(): min at +infinity, max at -infinity,...
ElementId_t GetElementId() const
REveVector fBBoxMin
! Bounding box in the element's own frame.
REveException Exception-type thrown by Eve classes.
Definition REveTypes.hxx:42
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:362
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:341
void Set(const Float_t *v)
Class to manage histogram axis.
Definition TAxis.h:32
virtual Double_t GetBinCenter(Int_t bin) const
Return center of bin.
Definition TAxis.cxx:489
virtual Double_t GetBinLowEdge(Int_t bin) const
Return low edge of bin.
Definition TAxis.cxx:529
Int_t GetNbins() const
Definition TAxis.h:127
virtual Double_t GetBinWidth(Int_t bin) const
Return bin width.
Definition TAxis.cxx:553
virtual Double_t GetBinUpEdge(Int_t bin) const
Return up edge of bin.
Definition TAxis.cxx:539
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:84
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
Namespace for ROOT features in testing.
Definition TROOT.h:100
TMath.
Definition TMathBase.h:35
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
Definition TMathBase.h:249
Double_t ATan(Double_t)
Returns the principal value of the arc tangent of x, expressed in radians.
Definition TMath.h:653
T1 Sign(T1 a, T2 b)
Returns a value with the magnitude of a and the sign of b.
Definition TMathBase.h:174
Int_t CeilNint(Double_t x)
Returns the nearest integer of TMath::Ceil(x).
Definition TMath.h:687
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