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