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(0),
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(0)
68{
69 // Constructor.
70
72 SetNameTitle(n, t);
73 SetData(data);
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 == 0) {
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
407void REveCaloViz::SetupHeight(Float_t value, Int_t /*slice*/, Float_t& outH) const
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
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
660{
661 return REveCaloViz::WriteCoreJson(j, rnr_offset);
662}
663
664////////////////////////////////////////////////////////////////////////////////
665/// Fill core part of JSON representation for selection.
666
668{
669 // selection
670 auto sarr = nlohmann::json::array();
672 for (REveCaloData::vCellId_i i = cells.begin(); i != cells.end(); i++)
673 {
674 fData->GetCellData(*i, cellData);
675 if (CellInEtaPhiRng(cellData))
676 {
677 nlohmann::json jsc;
678 jsc["t"] = i->fTower;
679 jsc["s"] = i->fSlice;
680 jsc["f"] = i->fFraction;
681 sarr.push_back(jsc);
682 }
683 }
684
685 nlohmann::json rec = {};
686 rec["caloVizId"] = GetElementId();
687 rec["cells"] = sarr;
688
689 j.push_back(rec);
690}
691
692
693////////////////////////////////////////////////////////////////////////////////
694/// Build list of drawn cell IDs. See REveCalo3DGL::DirectDraw().
695
697{
698 fCellList.clear();
699
702}
703
704////////////////////////////////////////////////////////////////////////////////
705/// Fill bounding-box information of the base-class TAttBBox (virtual method).
706/// If member 'REveFrameBox* fFrame' is set, frame's corners are used as bbox.
707
709{
710 BBoxInit();
711
713
714 fBBox[0] = -fBarrelRadius - th;
715 fBBox[1] = fBarrelRadius + th;
716 fBBox[2] = fBBox[0];
717 fBBox[3] = fBBox[1];
718 fBBox[4] = fEndCapPosB - th;
719 fBBox[5] = fEndCapPosF + th;
720}
721
722/** \class REveCalo2D
723\ingroup REve
724Visualization of a calorimeter event data in 2D.
725*/
726
727////////////////////////////////////////////////////////////////////////////////
728/// Client selection callback
729
730void REveCalo3D::NewTowerPicked(Int_t tower, Int_t slice, Int_t selectionId, bool multi)
731{
732 REveCaloData::CellId_t cell(tower, slice, 1.0f);
734
735 sel.push_back(cell);
736 fData->ProcessSelection(sel, selectionId, multi);
737}
738
739
740////////////////////////////////////////////////////////////////////////////////
741/// Constructor.
742
743REveCalo2D::REveCalo2D(const char* n, const char* t):
744 REveCaloViz(0, n, t),
746 fOldProjectionType(REveProjection::kPT_Unknown),
747 fMaxESumBin( 0),
748 fMaxEtSumBin(0)
749{
750}
751
752////////////////////////////////////////////////////////////////////////////////
753/// Destructor.
754
756{
758 UInt_t n;
759
760 // clear selected cell ids
761 n = fCellListsSelected.size();
762 for(UInt_t i = 0; i < n; ++i) {
763 cids = fCellListsSelected[i];
764 if (cids) {
765 cids->clear(); delete cids;
766 }
767 }
768 fCellListsSelected.clear();
769
770 // clear all cell dds
771 n = fCellLists.size();
772 for(UInt_t i = 0; i < n; ++i) {
773 cids = fCellLists[i];
774 if (cids) {
775 cids->clear(); delete cids;
776 }
777 }
778 fCellLists.clear();
779}
780
781////////////////////////////////////////////////////////////////////////////////
782/// This is virtual method from base-class REveProjected.
783
785{
787 {
790 }
791 ComputeBBox();
792}
793
794////////////////////////////////////////////////////////////////////////////////
795/// Set projection manager and model object.
796
798{
800 REveCaloViz* viz = dynamic_cast<REveCaloViz*>(model);
802}
803
804////////////////////////////////////////////////////////////////////////////////
805/// Is current projection type RPhi
806
808{
810}
811
812////////////////////////////////////////////////////////////////////////////////
813/// Build lists of drawn cell IDs. See REveCalo2DGL::DirecDraw().
814
816{
817 // clear old cache
818 for (vBinCells_i it = fCellLists.begin(); it != fCellLists.end(); it++)
819 {
820 if (*it)
821 {
822 (*it)->clear();
823 delete *it;
824 }
825 }
826 fCellLists.clear();
827 fCellLists.push_back(0);
828
830 REveCaloData::vCellId_t* clv; // ids per phi bin in r-phi projection else ids per eta bins in rho-z projection
831
832 Bool_t isRPhi = (pt == REveProjection::kPT_RPhi);
833
834 const TAxis* axis = isRPhi ? fData->GetPhiBins() : fData->GetEtaBins();
835 Int_t nBins = axis->GetNbins();
836
837 Float_t min, max;
838 if (isRPhi)
839 {
840 min = GetPhiMin() - fData->GetEps();
841 max = GetPhiMax() + fData->GetEps();
842 for (Int_t ibin = 1; ibin <= nBins; ++ibin) {
843 clv = 0;
845 (min, max, axis->GetBinLowEdge(ibin), axis->GetBinUpEdge(ibin)))
846 {
847 clv = new REveCaloData::vCellId_t();
848 fData->GetCellList(GetEta(), GetEtaRng(), axis->GetBinCenter(ibin), axis->GetBinWidth(ibin), *clv);
849 if (!clv->size()) {
850 delete clv; clv = 0;
851 }
852 }
853 fCellLists.push_back(clv);
854 }
855 }
856 else
857 {
858 min = GetEtaMin() - fData->GetEps();
859 max = GetEtaMax() + fData->GetEps();
860 for (Int_t ibin = 1; ibin <= nBins; ++ibin) {
861 clv = 0;
862 Float_t low = axis->GetBinLowEdge(ibin);
863 Float_t up = axis->GetBinUpEdge(ibin) ;
864 if (low >= min && up <= max)
865 {
866 clv = new REveCaloData::vCellId_t();
867 fData->GetCellList(axis->GetBinCenter(ibin), axis->GetBinWidth(ibin), fPhi, GetPhiRng(), *clv);
868 if (!clv->size()) {
869 delete clv; clv = 0;
870 }
871 }
872 fCellLists.push_back(clv);
873 }
874 }
875
876 // cache max bin sum for auto scale
877 if (!fScaleAbs)
878 {
879 fMaxESumBin = 0;
880 fMaxEtSumBin = 0;
881 Float_t sumE = 0;
882 Float_t sumEt = 0;
884 for (Int_t ibin = 1; ibin <= nBins; ++ibin) {
886 if (cids)
887 {
888 sumE = 0; sumEt = 0;
889 for (REveCaloData::vCellId_i it = cids->begin(); it != cids->end(); it++)
890 {
891 fData->GetCellData(*it, cellData);
892 sumE += cellData.Value(kFALSE);
893 sumEt += cellData.Value(kTRUE);
894 }
897 }
898 }
899 ComputeBBox();
900 }
901
903}
904
905//////////////////////////////////////////////s//////////////////////////////////
906/// Sort selected cells in eta or phi bins.
907
908void REveCalo2D::CellSelectionChangedInternal(REveCaloData::vCellId_t& inputCells, std::vector<REveCaloData::vCellId_t*>& outputCellLists)
909{
911 const TAxis* axis = isRPhi ? fData->GetPhiBins() : fData->GetEtaBins();
912
913 // clear old cache
914 for (vBinCells_i it = outputCellLists.begin(); it != outputCellLists.end(); it++)
915 {
916 if (*it)
917 {
918 (*it)->clear();
919 delete *it;
920 }
921 }
922 outputCellLists.clear();
923 UInt_t nBins = axis->GetNbins();
924 outputCellLists.resize(nBins+1);
925 for (UInt_t b = 0; b <= nBins; ++b)
926 outputCellLists[b] = 0;
927
928 for(UInt_t bin = 1; bin <= nBins; ++bin)
929 {
930 REveCaloData::vCellId_t* idsInBin = fCellLists[bin];
931 if (!idsInBin)
932 continue;
933
934 for (REveCaloData::vCellId_i i = idsInBin->begin(); i != idsInBin->end(); i++)
935 {
936 for (REveCaloData::vCellId_i j = inputCells.begin(); j != inputCells.end(); j++)
937 {
938 if( (*i).fTower == (*j).fTower && (*i).fSlice == (*j).fSlice)
939 {
940 if (!outputCellLists[bin])
941 outputCellLists[bin] = new REveCaloData::vCellId_t();
942
943 outputCellLists[bin]->emplace_back((*i).fTower, (*i).fSlice, (*j).fFraction);
944 }
945 }
946 }
947 }
948}
949
950////////////////////////////////////////////////////////////////////////////////
951/// Set absolute scale in projected calorimeter.
952
954{
957}
958
959////////////////////////////////////////////////////////////////////////////////
960/// Virtual function of REveCaloViz.
961/// Get transformation factor from E/Et to height.
962
964{
966
967 if (fScaleAbs)
968 {
969 return fMaxTowerH/fMaxValAbs;
970 }
971 else
972 {
973 if (fData->Empty())
974 return 1;
975
976 if (fPlotEt)
978 else
979 return fMaxTowerH/fMaxESumBin;
980 }
981}
982
983////////////////////////////////////////////////////////////////////////////////
984/// Fill bounding-box information of the base-class TAttBBox (virtual method).
985/// If member 'REveFrameBox* fFrame' is set, frame's corners are used as bbox.
986
988{
989 BBoxZero();
990
991 Float_t x, y, z;
992 Float_t th = fMaxTowerH ;
993 Float_t r = fBarrelRadius + th;
994
995 x = r, y = 0, z = 0;
997 BBoxCheckPoint(x, y, z);
998 x = -r, y = 0, z = 0;
1000 BBoxCheckPoint(x, y, z);
1001
1002 x = 0, y = 0, z = fEndCapPosF + th;
1004 BBoxCheckPoint(x, y, z);
1005 x = 0, y = 0, z = fEndCapPosB - th;
1007 BBoxCheckPoint(x, y, z);
1008
1009 x = 0, y = r, z = 0;
1011 BBoxCheckPoint(x, y, z);
1012 x = 0, y = -r, z = 0;
1014 BBoxCheckPoint(x, y, z);
1015}
1016
1017////////////////////////////////////////////////////////////////////////////////
1018/// Fill core part of JSON representation.
1019
1021{
1022 Int_t ret = REveCaloViz::WriteCoreJson(j, rnr_offset);
1023 j["isRPhi"] = IsRPhi();
1024 return ret;
1025}
1026
1027////////////////////////////////////////////////////////////////////////////////
1028/// Fill core part of JSON representation for selection.
1029
1031{
1032 static const REveException eh("REveCalo2D::WriteCoreJsonSelection ");
1033 auto sarr = nlohmann::json::array();
1034
1035 // selection
1036 // auto cellLists = isSel ? fCellListsSelected : fCellListsHighlighted;
1037 std::vector<REveCaloData::vCellId_t*> cellLists;
1038 CellSelectionChangedInternal(cells, cellLists);
1039
1040 if (IsRPhi()) {
1041 REveCaloData::CellData_t cellData;
1042 Int_t nSlices = fData->GetNSlices();
1043 Float_t *sliceVal = new Float_t[nSlices];
1044 Float_t *sliceValRef = new Float_t[nSlices];
1045 UInt_t nPhiBins = fData->GetPhiBins()->GetNbins();
1046 for(UInt_t phiBin = 1; phiBin <= nPhiBins; ++phiBin)
1047 {
1048 if (cellLists[phiBin])
1049 {
1050 if (!fCellLists[phiBin]) {
1051 delete[] sliceVal;
1052 delete[] sliceValRef;
1053 throw eh + "selected cell not in cell list cache.";
1054 }
1055
1056 // selected eta sum
1057 for (Int_t s=0; s<nSlices; ++s) sliceVal[s] = 0;
1058 REveCaloData::vCellId_t& cids = *(cellLists[phiBin]);
1059 for (REveCaloData::vCellId_i i=cids.begin(); i!=cids.end(); i++) {
1060 fData->GetCellData((*i), cellData);
1061 sliceVal[i->fSlice] += cellData.Value(fPlotEt)*(*i).fFraction;
1062 }
1063 // referenced eta sum
1064 for (Int_t s=0; s<nSlices; ++s) sliceValRef[s] = 0;
1065 REveCaloData::vCellId_t& cidsRef = *(fCellLists[phiBin]);
1066 for (REveCaloData::vCellId_i i=cidsRef.begin(); i!=cidsRef.end(); i++) {
1067 fData->GetCellData(*i, cellData);
1068 sliceValRef[i->fSlice] += cellData.Value(fPlotEt)*(*i).fFraction;
1069 }
1070
1071 // write
1072 for (Int_t s = 0; s < nSlices; ++s) {
1073 if (sliceVal[s] > 0)
1074 {
1075 nlohmann::json jsc;
1076 jsc["b"] = phiBin;
1077 jsc["s"] = s;
1078 jsc["f"] = sliceVal[s]/sliceValRef[s];
1079 sarr.push_back(jsc);
1080 }
1081 }
1082 }
1083 }
1084 }
1085 else {
1086 TAxis* axis = fData->GetEtaBins();
1087 UInt_t nEtaBins = axis->GetNbins();
1088 Int_t nSlices = fData->GetNSlices();
1089
1090 std::vector<Float_t> sliceValsUp(nSlices, 0.);
1091 std::vector<Float_t> sliceValsLow(nSlices, 0.);
1092 std::vector<Float_t> sliceValsUpRef(nSlices, 0.);
1093 std::vector<Float_t> sliceValsLowRef(nSlices, 0.);
1094
1095 Float_t towerH, towerHRef, offUp, offLow;
1096 REveCaloData::CellData_t cellData;
1097
1098 for (UInt_t etaBin = 1; etaBin <= nEtaBins; ++etaBin)
1099 {
1100 if (cellLists[etaBin])
1101 {
1102 if (!fCellLists[etaBin]) {
1103 throw(eh + "selected cell not in cell list cache.");
1104 }
1105 offUp = 0; offLow =0;
1106 // selected phi sum
1107 for (Int_t s = 0; s < nSlices; ++s) {
1108 sliceValsUp[s] = sliceValsLow[s] = 0.;
1109 }
1110 REveCaloData::vCellId_t& cids = *(cellLists[etaBin]);
1111 for (REveCaloData::vCellId_i i=cids.begin(); i!=cids.end(); i++) {
1112 fData->GetCellData(*i, cellData);
1113 if (cellData.IsUpperRho())
1114 sliceValsUp [i->fSlice] += cellData.Value(fPlotEt)*(*i).fFraction;
1115 else
1116 sliceValsLow[i->fSlice] += cellData.Value(fPlotEt)*(*i).fFraction;
1117 }
1118
1119 // reference phi sum
1120 for (Int_t s = 0; s < nSlices; ++s)
1121 {
1122 sliceValsUpRef[s] = sliceValsLowRef[s] = 0;
1123 }
1124 REveCaloData::vCellId_t& cidsRef = *(fCellLists[etaBin]);
1125 for (REveCaloData::vCellId_i i=cidsRef.begin(); i!=cidsRef.end(); i++)
1126 {
1127 fData->GetCellData(*i, cellData);
1128 if (cellData.IsUpperRho())
1129 sliceValsUpRef [i->fSlice] += cellData.Value(fPlotEt)*(*i).fFraction;
1130 else
1131 sliceValsLowRef[i->fSlice] += cellData.Value(fPlotEt)*(*i).fFraction;
1132 }
1133
1134 for (Int_t s = 0; s < nSlices; ++s)
1135 {
1136 // phi +
1137 SetupHeight(sliceValsUpRef[s], s, towerHRef);
1138 if (sliceValsUp[s] > 0) {
1139 SetupHeight(sliceValsUp[s], s, towerH);
1140 nlohmann::json jsc;
1141 jsc["b"] = etaBin;
1142 jsc["s"] = s;
1143 jsc["f"] = sliceValsUp[s]/sliceValsUpRef[s];
1144 sarr.push_back(jsc);
1145 }
1146 offUp += towerHRef;
1147
1148 // phi -
1149 SetupHeight(sliceValsLowRef[s], s, towerHRef);
1150 if (sliceValsLow[s] > 0) {
1151 SetupHeight(sliceValsLow[s], s, towerH);
1152 nlohmann::json jsc;
1153 jsc["b"] = Int_t(-etaBin);
1154 jsc["s"] = s;
1155 jsc["f"] = sliceValsLow[s]/sliceValsLowRef[s];
1156 sarr.push_back(jsc);
1157 }
1158 offLow += towerHRef;
1159 } // slices
1160 } // if eta bin
1161 } //eta bins
1162 } // RhoZ
1163
1164 nlohmann::json rec = {};
1165 rec["caloVizId"] = GetElementId();
1166 rec["cells"] = sarr;
1167 j.push_back(rec);
1168}
1169
1170////////////////////////////////////////////////////////////////////////////////
1171/// Creates 2D point array for rendering.
1172
1174{
1176 fRenderData = std::make_unique<REveRenderData>("makeCalo2D");
1177
1178 bool isEmpty = fData->Empty();
1179
1180 for (vBinCells_i it = fCellLists.begin(); it != fCellLists.end(); ++it)
1181 {
1182 if ((*it) && (*it)->empty())
1183 {
1184 isEmpty = false;
1185 break;
1186 }
1187 }
1188 if (isEmpty) return;
1189
1190 if (IsRPhi())
1192 else
1194}
1195
1196
1197////////////////////////////////////////////////////////////////////////////////
1198/// Creates 2D point array in RhoZ projection.
1199
1201{
1202 Int_t nSlices = fData->GetNSlices();
1203
1204 REveCaloData::CellData_t cellData;
1205 Float_t *sliceValsUp = new Float_t[nSlices];
1206 Float_t *sliceValsLow = new Float_t[nSlices];
1207 Bool_t isBarrel;
1208 Float_t towerH;
1209 Float_t transEtaF = GetTransitionEtaForward();
1210 Float_t transEtaB = GetTransitionEtaBackward();
1211
1212 TAxis* axis = fData->GetEtaBins();
1213 UInt_t nEta = axis->GetNbins();
1214 Float_t pnts[12];
1215 for (UInt_t etaBin = 1; etaBin <= nEta; ++etaBin)
1216 {
1217 if (fCellLists[etaBin] )
1218 {
1219 assert(fCellLists[etaBin]);
1220 Float_t etaMin = axis->GetBinLowEdge(etaBin);
1221 Float_t etaMax = axis->GetBinUpEdge(etaBin);
1222 Float_t thetaMin = REveCaloData::EtaToTheta(etaMax);
1223 Float_t thetaMax = REveCaloData::EtaToTheta(etaMin);
1224 // printf("----------------------------------------- eta(%f, %f)\n", etaMin, etaMax);
1225
1226 // clear
1227 Float_t offUp = 0;
1228 Float_t offLow = 0;
1229 for (Int_t s = 0; s < nSlices; ++s) {
1230 sliceValsUp [s] = 0;
1231 sliceValsLow[s] = 0;
1232 }
1233 // values
1234 REveCaloData::vCellId_t* cids = fCellLists[etaBin];
1235 for (REveCaloData::vCellId_i it = cids->begin(); it != cids->end(); ++it)
1236 {
1237 fData->GetCellData(*it, cellData);
1238 if (cellData.IsUpperRho())
1239 sliceValsUp [it->fSlice] += cellData.Value(fPlotEt)*(*it).fFraction;
1240 else
1241 sliceValsLow[it->fSlice] += cellData.Value(fPlotEt)*(*it).fFraction;
1242 }
1243
1244 isBarrel = !(etaMax > 0 && etaMax > transEtaF) && !(etaMin < 0 && etaMin < transEtaB);
1245 for (Int_t s = 0; s < nSlices; ++s)
1246 {
1247 // phi +
1248 if (sliceValsUp[s])
1249 {
1250 SetupHeight(sliceValsUp[s], s, towerH);
1251 MakeRhoZCell(thetaMin, thetaMax, offUp, isBarrel, kTRUE , towerH, pnts);
1252 offUp += towerH;
1253 fRenderData->PushV(pnts, 12);
1254 fRenderData->PushI( s);
1255 fRenderData->PushI(etaBin);
1256 fRenderData->PushN(sliceValsUp[s]);
1257 }
1258 // phi -
1259 if (sliceValsLow[s])
1260 {
1261 SetupHeight(sliceValsLow[s], s, towerH);
1262 MakeRhoZCell(thetaMin, thetaMax, offLow, isBarrel, kFALSE , towerH, pnts);
1263 offLow += towerH;
1264 fRenderData->PushV(pnts, 12);
1265 fRenderData->PushI( s);
1266 fRenderData->PushI(etaBin);
1267 fRenderData->PushN(sliceValsLow[s]);
1268 }
1269
1270 }
1271 }
1272 }
1273
1274 delete [] sliceValsUp;
1275 delete [] sliceValsLow;
1276}
1277
1278////////////////////////////////////////////////////////////////////////////////
1279/// Get cell vertices in RhoZ projection.
1280///
1282 Float_t& offset, Bool_t isBarrel, Bool_t phiPlus, Float_t towerH, float *pntsOut) const
1283{
1284 using namespace TMath;
1285
1286 Float_t sin1 = Sin(thetaMin);
1287 Float_t cos1 = Cos(thetaMin);
1288 Float_t sin2 = Sin(thetaMax);
1289 Float_t cos2 = Cos(thetaMax);
1290
1291 Float_t pnts[8];
1292 if (isBarrel)
1293 {
1294 Float_t r1 = fBarrelRadius/Abs(Sin(0.5f*(thetaMin+thetaMax))) + offset;
1295 Float_t r2 = r1 + towerH;
1296
1297 pnts[0] = r1*sin1; pnts[1] = r1*cos1;
1298 pnts[2] = r2*sin1; pnts[3] = r2*cos1;
1299 pnts[4] = r2*sin2; pnts[5] = r2*cos2;
1300 pnts[6] = r1*sin2; pnts[7] = r1*cos2;
1301 }
1302 else
1303 {
1304 // endcap
1306 // uses a different theta definition than GetTransitionThetaBackward(), so we need a conversion
1308 if (thetaMax >= transThetaB)
1309 zE = Abs(GetBackwardEndCapPos());
1310 Float_t r1 = zE/Abs(Cos(0.5f*(thetaMin+thetaMax))) + offset;
1311 Float_t r2 = r1 + towerH;
1312
1313 pnts[0] = r1*sin1; pnts[1] = r1*cos1;
1314 pnts[2] = r2*sin1; pnts[3] = r2*cos1;
1315 pnts[4] = r2*sin2; pnts[5] = r2*cos2;
1316 pnts[6] = r1*sin2; pnts[7] = r1*cos2;
1317 }
1318
1319
1320 Float_t x, y, z;
1321 for (Int_t i = 0; i < 4; ++i)
1322 {
1323 x = 0.f;
1324 y = phiPlus ? Abs(pnts[2*i]) : -Abs(pnts[2*i]);
1325 z = pnts[2*i+1];
1327
1328 int j = phiPlus ? i : (3 -i);
1329 pntsOut[j*3] = x;
1330 pntsOut[j*3 + 1] = y;
1331 pntsOut[j*3 + 2] = z;
1332 }
1333}
1334
1335////////////////////////////////////////////////////////////////////////////////
1336/// Creates 2D point array in RPhi() projection.
1337
1339{
1340 REveCaloData* data = fData;
1341 Int_t nSlices = data->GetNSlices();
1342 Float_t *sliceVal = new Float_t[nSlices];
1343 REveCaloData::CellData_t cellData;
1344 Float_t towerH;
1345
1346 UInt_t nPhi = data->GetPhiBins()->GetNbins();
1347 TAxis* axis = data->GetPhiBins();
1348 float pnts[12];
1349 for(UInt_t phiBin = 1; phiBin <= nPhi; ++phiBin)
1350 {
1351 if (fCellLists[phiBin] )
1352 {
1353 // reset values
1354 Float_t off = 0;
1355 for (Int_t s=0; s<nSlices; ++s)
1356 sliceVal[s] = 0;
1357
1358 // sum eta cells
1359 REveCaloData::vCellId_t* cids = fCellLists[phiBin];
1360 for (REveCaloData::vCellId_i it = cids->begin(); it != cids->end(); it++)
1361 {
1362 data->GetCellData(*it, cellData);
1363 sliceVal[(*it).fSlice] += cellData.Value(fPlotEt)*(*it).fFraction;
1364 }
1365 for (Int_t s = 0; s < nSlices; ++s)
1366 {
1367 SetupHeight(sliceVal[s], s, towerH);
1368 MakeRPhiCell(axis->GetBinLowEdge(phiBin), axis->GetBinUpEdge(phiBin), towerH, off, pnts);
1369 fRenderData->PushV(pnts, 12);
1370 fRenderData->PushI(s);
1371 fRenderData->PushI(phiBin);
1372 fRenderData->PushN(sliceVal[s]);
1373 off += towerH;
1374 }
1375 }
1376 }
1377
1378 delete [] sliceVal;
1379}
1380
1381////////////////////////////////////////////////////////////////////////////////
1382/// Calculate vertices for the calorimeter cell in RPhi projection.
1383/// Returns outside radius of the tower.
1384
1386 Float_t towerH, Float_t offset, float* pntsOut) const
1387{
1388 using namespace TMath;
1389
1390 Float_t r1 = fBarrelRadius + offset;
1391 Float_t r2 = r1 + towerH;
1392
1393 Float_t pnts[8];
1394 pnts[0] = r1*Cos(phiMin); pnts[1] = r1*Sin(phiMin);
1395 pnts[2] = r2*Cos(phiMin); pnts[3] = r2*Sin(phiMin);
1396 pnts[4] = r2*Cos(phiMax); pnts[5] = r2*Sin(phiMax);
1397 pnts[6] = r1*Cos(phiMax); pnts[7] = r1*Sin(phiMax);
1398
1399 Float_t x, y, z;
1400 for (Int_t i = 0; i < 4; ++i)
1401 {
1402 pntsOut[i*3] = pnts[2*i];
1403 pntsOut[i*3+1] = pnts[2*i+1];
1404 pntsOut[i*3+2] = 0.f;
1406 }
1407}
1408
1409////////////////////////////////////////////////////////////////////////////////
1410/// Client callback
1411
1412void REveCalo2D::NewBinPicked(Int_t bin, Int_t slice, Int_t selectionId, bool multi)
1413{
1414 bool is_upper = bin >= 0;
1415 bin = abs(bin);
1416
1418 for (REveCaloData::vCellId_i it = fCellLists[bin]->begin(); it != fCellLists[bin]->end(); ++it)
1419 {
1420 if ((*it).fSlice == slice)
1421 {
1422 if (IsRPhi())
1423 {
1424 sel.push_back(*it);
1425 }
1426 else
1427 {
1429 fData->GetCellData(*it, cd);
1430 if ((is_upper && cd.IsUpperRho()) || (!is_upper && !cd.IsUpperRho()))
1431 sel.push_back(*it);
1432 }
1433 }
1434 }
1435 fData->ProcessSelection(sel, selectionId, multi);
1436}
1437
1438
1439/** \class REveCaloLego
1440\ingroup REve
1441Visualization of calorimeter data as eta/phi histogram.
1442*/
1443
1444////////////////////////////////////////////////////////////////////////////////
1445/// Constructor.
1446
1447REveCaloLego::REveCaloLego(REveCaloData* d, const char* n, const char* t):
1448 REveCaloViz(d, n, t),
1449
1450 fFontColor(-1),
1451 fGridColor(-1),
1452 fPlaneColor(kRed-5),
1453 fPlaneTransparency(60),
1454
1455 fNZSteps(6),
1456 fZAxisStep(0.f),
1457
1458 fAutoRebin(kTRUE),
1459
1460 fPixelsPerBin(12),
1461 fNormalizeRebin(kFALSE),
1462
1463 fProjection(kAuto),
1464 f2DMode(kValSize),
1465 fBoxMode(kBack),
1466
1467 fDrawHPlane(kFALSE),
1468 fHPlaneVal(0),
1469
1470 fHasFixedHeightIn2DMode(kFALSE),
1471 fFixedHeightValIn2DMode(0.f),
1472
1473 fDrawNumberCellPixels(18), // draw numbers on cell above 30 pixels
1474 fCellPixelFontSize(12) // size of cell fonts in pixels
1475{
1476 fMaxTowerH = 4;
1477 SetNameTitle("REveCaloLego", "REveCaloLego");
1478}
1479
1480////////////////////////////////////////////////////////////////////////////////
1481// Set data.
1482
1484{
1486}
1487
1488////////////////////////////////////////////////////////////////////////////////
1489/// Build list of drawn cell IDs. For more information see REveCaloLegoGL:DirectDraw().
1490
1492{
1493 fCellList.clear();
1494
1497}
1498
1499////////////////////////////////////////////////////////////////////////////////
1500/// Fill bounding-box information of the base-class TAttBBox (virtual method).
1501/// If member 'REveFrameBox* fFrame' is set, frame's corners are used as bbox.
1502
1504{
1505
1506 // fBBox = Float_t[6] X(min,max), Y(min,max), Z(min,max)
1507
1508 BBoxZero();
1509
1510 Float_t ex = 1.2; // 20% offset for axis labels
1511
1512 Float_t a = 0.5*ex;
1513
1514 fBBox[0] = -a;
1515 fBBox[1] = a;
1516 fBBox[2] = -a;
1517 fBBox[3] = a;
1518
1519 // scaling is relative to shortest XY axis
1520 Double_t em, eM, pm, pM;
1521 fData->GetEtaLimits(em, eM);
1522 fData->GetPhiLimits(pm, pM);
1523 Double_t r = (eM-em)/(pM-pm);
1524 if (r<1)
1525 {
1526 fBBox[2] /= r;
1527 fBBox[3] /= r;
1528 }
1529 else
1530 {
1531 fBBox[0] *= r;
1532 fBBox[1] *= r;
1533 }
1534
1535 fBBox[4] = 0;
1536 if (fScaleAbs && !fData->Empty())
1538 else
1539 fBBox[5] = fMaxTowerH;
1540}
1541
ROOT::R::TRInterface & r
Definition Object.C:4
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
const Bool_t kFALSE
Definition RtypesCore.h:101
short Color_t
Definition RtypesCore.h:92
const Bool_t kTRUE
Definition RtypesCore.h:100
@ kGray
Definition Rtypes.h:65
@ kRed
Definition Rtypes.h:66
#define hlimit
virtual void AddNiece(REveElement *el)
void BuildRenderData() override
Creates 2D point array for rendering.
void SetProjection(REveProjectionManager *proj, REveProjectable *model) override
Set projection manager and model object.
Definition REveCalo.cxx:797
void MakeRhoZCell(Float_t thetaMin, Float_t thetaMax, Float_t &offset, Bool_t isBarrel, Bool_t phiPlus, Float_t towerH, float *pntsOut) const
Get cell vertices in RhoZ projection.
void BuildRenderDataRPhi()
Creates 2D point array in RPhi() projection.
bool IsRPhi() const
Is current projection type RPhi.
Definition REveCalo.cxx:807
void WriteCoreJsonSelection(nlohmann::json &j, REveCaloData::vCellId_t) override
Fill core part of JSON representation for selection.
void ComputeBBox() override
Fill bounding-box information of the base-class TAttBBox (virtual method).
Definition REveCalo.cxx:987
std::vector< REveCaloData::vCellId_t * >::iterator vBinCells_i
Definition REveCalo.hxx:208
void NewBinPicked(Int_t bin, Int_t slice, Int_t selectionId, Bool_t multi)
Client callback.
void CellSelectionChangedInternal(REveCaloData::vCellId_t &cells, std::vector< REveCaloData::vCellId_t * > &cellLists)
s////////////////////////////////// Sort selected cells in eta or phi bins.
Definition REveCalo.cxx:908
REveProjection::EPType_e fOldProjectionType
Definition REveCalo.hxx:213
REveCalo2D(const char *n="REveCalo2D", const char *t="")
Constructor.
Definition REveCalo.cxx:743
void UpdateProjection() override
This is virtual method from base-class REveProjected.
Definition REveCalo.cxx:784
Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override
Fill core part of JSON representation.
std::vector< REveCaloData::vCellId_t * > fCellLists
Definition REveCalo.hxx:226
std::vector< REveCaloData::vCellId_t * > fCellListsSelected
Definition REveCalo.hxx:228
void BuildCellIdCache() override
Build lists of drawn cell IDs. See REveCalo2DGL::DirecDraw().
Definition REveCalo.cxx:815
void BuildRenderDataRhoZ()
Creates 2D point array in RhoZ projection.
virtual ~REveCalo2D()
Destructor.
Definition REveCalo.cxx:755
Float_t GetValToHeight() const override
Virtual function of REveCaloViz.
Definition REveCalo.cxx:963
void MakeRPhiCell(Float_t phiMin, Float_t phiMax, Float_t towerH, Float_t offset, float *pntsOut) const
Calculate vertices for the calorimeter cell in RPhi projection.
void SetScaleAbs(Bool_t) override
Set absolute scale in projected calorimeter.
Definition REveCalo.cxx:953
Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override
Fill core part of JSON representation.
Definition REveCalo.cxx:659
void ComputeBBox() override
Fill bounding-box information of the base-class TAttBBox (virtual method).
Definition REveCalo.cxx:708
void MakeBarrelCell(const REveCaloData::CellGeom_t &cellData, float towerH, Float_t &offset, float *pnts) const
Make endcap cell.
Definition REveCalo.cxx:535
void MakeEndCapCell(const REveCaloData::CellGeom_t &cellData, float towerH, Float_t &offset, float *pnts) const
Make endcap cell.
Definition REveCalo.cxx:470
REveCalo3D(REveCaloData *d=0, const char *n="REveCalo3D", const char *t="")
Constructor.
Definition REveCalo.cxx:452
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:164
Color_t GetSliceColor(Int_t slice) const
Get color for given slice.
virtual Float_t GetMaxVal(Bool_t et) const
std::vector< CellId_t >::iterator vCellId_i
void SetSliceThreshold(Int_t slice, Float_t threshold)
Set threshold for given slice.
virtual void GetCellData(const CellId_t &id, CellData_t &data) const =0
virtual TAxis * GetEtaBins() const
static Float_t EtaToTheta(Float_t eta)
virtual Float_t GetEps() const
void ProcessSelection(vCellId_t &sel_cells, UInt_t selectionId, Bool_t multi)
Process newly selected cells with given select-record.
SliceInfo_t & RefSliceInfo(Int_t s)
virtual void GetEtaLimits(Double_t &min, Double_t &max) const =0
virtual void GetCellList(Float_t etaMin, Float_t etaMax, Float_t phi, Float_t phiRng, vCellId_t &out) const =0
virtual TAxis * GetPhiBins() const
std::vector< CellId_t > vCellId_t
void SetSliceColor(Int_t slice, Color_t col)
Set color for given slice.
virtual void GetPhiLimits(Double_t &min, Double_t &max) const =0
void BuildCellIdCache() override
Build list of drawn cell IDs. For more information see REveCaloLegoGL:DirectDraw().
virtual void SetData(REveCaloData *d)
void ComputeBBox() override
Fill bounding-box information of the base-class TAttBBox (virtual method).
REveCaloData::vCellId_t fCellList
Definition REveCalo.hxx:275
REveCaloLego(REveCaloData *data=0, const char *n="REveCaloLego", const char *t="")
Constructor.
Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override
Fill core part of JSON representation.
Definition REveCalo.cxx: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:97
Float_t GetBackwardEndCapPos() const
Definition REveCalo.hxx:101
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:82
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
virtual ~REveCaloViz()
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:100
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:58
void BBoxZero(Float_t epsilon=0, Float_t x=0, Float_t y=0, Float_t z=0)
Create cube of volume (2*epsilon)^3 at (x,y,z).
Definition TAttBBox.cxx:42
void BBoxInit(Float_t infinity=1e6)
Dynamic Float_t[6] X(min,max), Y(min,max), Z(min,max)
Definition TAttBBox.cxx:29
Float_t * fBBox
Definition TAttBBox.h:20
Class to manage histogram axis.
Definition TAxis.h:30
virtual Double_t GetBinCenter(Int_t bin) const
Return center of bin.
Definition TAxis.cxx:478
virtual Double_t GetBinLowEdge(Int_t bin) const
Return low edge of bin.
Definition TAxis.cxx:518
Int_t GetNbins() const
Definition TAxis.h:121
virtual Double_t GetBinWidth(Int_t bin) const
Return bin width.
Definition TAxis.cxx:540
virtual Double_t GetBinUpEdge(Int_t bin) const
Return up edge of bin.
Definition TAxis.cxx:528
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:80
TPaveText * pt
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
const Int_t n
Definition legend1.C:16
Double_t ex[n]
Definition legend1.C:17
TMath.
Definition TMathBase.h:35
Short_t Max(Short_t a, Short_t b)
Definition TMathBase.h:208
Double_t ATan(Double_t)
Definition TMath.h:625
T1 Sign(T1 a, T2 b)
Definition TMathBase.h:161
Int_t CeilNint(Double_t x)
Definition TMath.h:649
basic_json< std::map, std::vector, std::string, bool, std::int64_t, std::uint64_t, double, std::allocator, adl_serializer, std::vector< std::uint8_t > > json
Float_t Value(Bool_t) const
Return energy value associated with the cell, usually Et.
auto * m
Definition textangle.C:8
auto * l
Definition textangle.C:4