Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TEveCaloData.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 "TEveCaloData.h"
13#include "TEveCalo.h"
14
15#include "TGLSelectRecord.h"
16
17#include "TAxis.h"
18#include "THStack.h"
19#include "TH2.h"
20#include "TMath.h"
21#include "TList.h"
22
23#include <cassert>
24#include <algorithm>
25#include <set>
26
27/** \class TEveCaloData::CellGeom_t
28\ingroup TEve
29Cell geometry inner structure.
30*/
31
32////////////////////////////////////////////////////////////////////////////////
33/// Print member data.
34
36{
37 printf("%f, %f %f, %f \n", fEtaMin, fEtaMax, fPhiMin, fPhiMax);
38}
39
40////////////////////////////////////////////////////////////////////////////////
41
43{
44 fEtaMin = etaMin;
45 fEtaMax = etaMax;
46
47 fPhiMin = phiMin;
48 fPhiMax = phiMax;
49
50 // Complain if phi is out of [-2*pi, 2*pi] range.
51 if (fPhiMin < - TMath::TwoPi() || fPhiMin > TMath::TwoPi() ||
52 fPhiMax < - TMath::TwoPi() || fPhiMax > TMath::TwoPi())
53 {
54 ::Error("TEveCaloData::CellGeom_t::Configure", "phiMin and phiMax should be between -2*pi and 2*pi (min=%f, max=%f). RhoZ projection will be wrong.",
55 fPhiMin, fPhiMax);
56 }
57
58 fThetaMin = EtaToTheta(fEtaMax);
59 fThetaMax = EtaToTheta(fEtaMin);
60}
61
62/** \class TEveCaloData::CellData_t
63\ingroup TEve
64Cell data inner structure.
65*/
66
67////////////////////////////////////////////////////////////////////////////////
68/// Return energy value associated with the cell, usually Et.
69/// If isEt is false it is transformed into energy E.
70
72{
73 if (isEt)
74 return fValue;
75 else
76 return TMath::Abs(fValue/TMath::Sin(Theta()));
77}
78
79////////////////////////////////////////////////////////////////////////////////
80/// Print member data.
81
83{
84 printf("%f, %f %f, %f \n", fEtaMin, fEtaMax, fPhiMin, fPhiMax);
85}
86
87////////////////////////////////////////////////////////////////////////////////
88
90{
91 // printf("get val vec bin %d size %d\n", bin, fBinData.size());
92 if (fBinData[bin] == -1)
93 {
94 fBinData[bin] = fSliceData.size();
95
96 for (Int_t i=0; i<fNSlices; i++)
97 fSliceData.push_back(0.f);
98 }
99
100 return &fSliceData[fBinData[bin]];
101}
102
103/** \class TEveCaloData
104\ingroup TEve
105A central manager for calorimeter event data. It provides a list of
106cells within requested phi and eta range.
107*/
108
109
110////////////////////////////////////////////////////////////////////////////////
111
112TEveCaloData::TEveCaloData(const char* n, const char* t):
113 TEveElement(),
114 TNamed(n, t),
115
116 fEtaAxis(nullptr),
117 fPhiAxis(nullptr),
118
120
121 fMaxValEt(0),
122 fMaxValE(0),
123
124 fEps(0)
125{
126 // Constructor.
127}
128
129////////////////////////////////////////////////////////////////////////////////
130/// Virtual method TEveElement::UnSelect.
131/// Clear selected towers when deselected.
132
134{
135 fCellsSelected.clear();
136}
137
138////////////////////////////////////////////////////////////////////////////////
139/// Virtual method TEveElement::UnHighlighted.
140
142{
143 fCellsHighlighted.clear();
144}
145
146////////////////////////////////////////////////////////////////////////////////
147
149{
150 if (fCellsHighlighted.empty()) return "";
151
153
154 Bool_t single = fCellsHighlighted.size() == 1;
155 Float_t sum = 0;
156 TString s;
157 for (vCellId_i i = fCellsHighlighted.begin(); i!=fCellsHighlighted.end(); ++i)
158 {
160
161 s += TString::Format("%s %.2f (%.3f, %.3f)",
162 fSliceInfos[i->fSlice].fName.Data(), cellData.fValue,
163 cellData.Eta(), cellData.Phi());
164
165 if (single) return s;
166 s += "\n";
167 sum += cellData.fValue;
168 }
169 s += TString::Format("Sum = %.2f", sum);
170 return s;
171}
172
173////////////////////////////////////////////////////////////////////////////////
174/// Populate set impSelSet with derived / dependant elements.
175///
176
178{
179 for (List_ci i=fChildren.begin(); i!=fChildren.end(); ++i)
180 {
181 impSelSet.insert(*i);
182 }
183}
184
185////////////////////////////////////////////////////////////////////////////////
186/// Print selected cells info.
187
189{
190 printf("%d Selected selected cells:\n", (Int_t)fCellsSelected.size());
192
193 for (vCellId_i i = fCellsSelected.begin(); i != fCellsSelected.end(); ++i)
194 {
196 printf("Tower [%d] Slice [%d] Value [%.2f] ", i->fTower, i->fSlice, cellData.fValue);
197 printf("Eta:(%f, %f) Phi(%f, %f)\n", cellData.fEtaMin, cellData.fEtaMax, cellData.fPhiMin, cellData.fPhiMax);
198 }
199}
200
201////////////////////////////////////////////////////////////////////////////////
202/// Process newly selected cells with given select-record.
203/// Secondary-select status is set.
204/// CellSelectionChanged() is called if needed.
205
207{
208 typedef std::set<CellId_t> sCellId_t;
209 typedef std::set<CellId_t>::iterator sCellId_i;
210
211 struct helper
212 {
214 {
215 for (vCellId_i i = cvec.begin(); i != cvec.end(); ++i)
216 cset.insert(*i);
217 }
219 {
220 for (sCellId_i i = cset.begin(); i != cset.end(); ++i)
221 cvec.push_back(*i);
222 }
223 };
224
225 vCellId_t& cells = rec.GetHighlight() ? fCellsHighlighted : fCellsSelected;
226
227 if (cells.empty())
228 {
229 if (!sel_cells.empty())
230 {
231 cells.swap(sel_cells);
232 rec.SetSecSelResult(TGLSelectRecord::kEnteringSelection);
233 }
234 }
235 else
236 {
237 if (!sel_cells.empty())
238 {
239 if (rec.GetMultiple())
240 {
242 helper::fill_cell_set(cs, cells);
243 for (vCellId_i i = sel_cells.begin(); i != sel_cells.end(); ++i)
244 {
245 std::set<CellId_t>::iterator csi = cs.find(*i);
246 if (csi == cs.end())
247 cs.insert(*i);
248 else
249 cs.erase(csi);
250 }
251 cells.clear();
252 if (cs.empty())
253 {
254 rec.SetSecSelResult(TGLSelectRecord::kLeavingSelection);
255 }
256 else
257 {
258 helper::fill_cell_vec(cells, cs);
260 }
261 }
262 else
263 {
265 if (cells.size() == sel_cells.size())
266 {
268 helper::fill_cell_set(cs, cells);
269 for (vCellId_i i = sel_cells.begin(); i != sel_cells.end(); ++i)
270 {
271 if (cs.find(*i) == cs.end())
272 {
273 differ = kTRUE;
274 break;
275 }
276 }
277 }
278 else
279 {
280 differ = kTRUE;
281 }
282 if (differ)
283 {
284 cells.swap(sel_cells);
286 }
287 }
288 }
289 else
290 {
291 if (!rec.GetMultiple())
292 {
293 cells.clear();
294 rec.SetSecSelResult(TGLSelectRecord::kLeavingSelection);
295 }
296 }
297 }
298
299 if (rec.GetSecSelResult() != TGLSelectRecord::kNone)
300 {
302 }
303}
304
305////////////////////////////////////////////////////////////////////////////////
306/// Set threshold for given slice.
307
309{
310 fSliceInfos[slice].fThreshold = val;
312}
313
314////////////////////////////////////////////////////////////////////////////////
315/// Get threshold for given slice.
316
318{
319 return fSliceInfos[slice].fThreshold;
320}
321
322////////////////////////////////////////////////////////////////////////////////
323/// Set color for given slice.
324
326{
327 fSliceInfos[slice].fColor = col;
328 for (List_ci i=fChildren.begin(); i!=fChildren.end(); ++i)
329 {
330 (*i)->AddStamp(TEveElement::kCBObjProps);
331 }
332}
333
334////////////////////////////////////////////////////////////////////////////////
335/// Get color for given slice.
336
338{
339 return fSliceInfos[slice].fColor;
340}
341
342////////////////////////////////////////////////////////////////////////////////
343/// Set transparency for given slice.
344
346{
347 fSliceInfos[slice].fTransparency = t;
348 for (List_ci i=fChildren.begin(); i!=fChildren.end(); ++i)
349 {
350 (*i)->AddStamp(TEveElement::kCBObjProps);
351 }
352}
353
354////////////////////////////////////////////////////////////////////////////////
355/// Get transparency for given slice.
356
358{
359 return fSliceInfos[slice].fTransparency;
360}
361
362////////////////////////////////////////////////////////////////////////////////
363/// Invalidate cell ids cache on back ptr references.
364
366{
368 for (List_ci i=fChildren.begin(); i!=fChildren.end(); ++i)
369 {
370 calo = dynamic_cast<TEveCaloViz*>(*i);
371 calo->InvalidateCellIdCache();
372 calo->StampObjProps();
373 }
374}
375
376////////////////////////////////////////////////////////////////////////////////
377/// Tell users (TEveCaloViz instances using this data) that data
378/// has changed and they should update the limits/scales etc.
379/// This is done by calling TEveCaloViz::DataChanged().
380
382{
384 for (List_ci i=fChildren.begin(); i!=fChildren.end(); ++i)
385 {
386 calo = dynamic_cast<TEveCaloViz*>(*i);
387 calo->DataChanged();
388 calo->StampObjProps();
389 }
390}
391
392////////////////////////////////////////////////////////////////////////////////
393/// Tell users (TEveCaloViz instances using this data) that cell selection
394/// has changed and they should update selection cache if necessary.
395/// This is done by calling TEveCaloViz::CellSelectionChanged().
396
398{
400 for (List_ci i=fChildren.begin(); i!=fChildren.end(); ++i)
401 {
402 calo = dynamic_cast<TEveCaloViz*>(*i);
403 calo->CellSelectionChanged();
404 calo->StampColorSelection();
405 }
406}
407
408////////////////////////////////////////////////////////////////////////////////
409
411{
412 using namespace TMath;
413
414 if (eta < 0)
415 return Pi() - 2*ATan(Exp(- Abs(eta)));
416 else
417 return 2*ATan(Exp(- Abs(eta)));
418}
419
420
421/** \class TEveCaloDataVec
422\ingroup TEve
423Calo data for universal cell geometry.
424*/
425
426
427////////////////////////////////////////////////////////////////////////////////
428
430 TEveCaloData(),
431
432 fTower(0),
433 fEtaMin( 1e3),
434 fEtaMax(-1e3),
435 fPhiMin( 1e3),
436 fPhiMax(-1e3)
437{
438 // Constructor.
439
441
442 fSliceVec.assign(nslices, std::vector<Float_t> ());
443}
444
445////////////////////////////////////////////////////////////////////////////////
446/// Destructor.
447
449{
450 if (fEtaAxis) delete fEtaAxis;
451 if (fPhiAxis) delete fPhiAxis;
452}
453
454////////////////////////////////////////////////////////////////////////////////
455/// Add new slice.
456
458{
459 fSliceInfos.push_back(SliceInfo_t());
460 fSliceVec.push_back(std::vector<Float_t> ());
461 fSliceVec.back().resize(fGeomVec.size(), 0.f);
462
463 return fSliceInfos.size() - 1;
464}
465
466////////////////////////////////////////////////////////////////////////////////
467/// Add tower within eta/phi range.
468
470{
471 assert (etaMin < etaMax);
472 assert (phiMin < phiMax);
473
474 fGeomVec.push_back(CellGeom_t(etaMin, etaMax, phiMin, phiMax));
475
476 for (vvFloat_i it=fSliceVec.begin(); it!=fSliceVec.end(); ++it)
477 (*it).push_back(0);
478
479 if (etaMin < fEtaMin) fEtaMin = etaMin;
480 if (etaMax > fEtaMax) fEtaMax = etaMax;
481
482 if (phiMin < fPhiMin) fPhiMin = phiMin;
483 if (phiMax > fPhiMax) fPhiMax = phiMax;
484
485 fTower = fGeomVec.size() - 1;
486 return fTower;
487}
488
489////////////////////////////////////////////////////////////////////////////////
490/// Fill given slice in the current tower.
491
493{
494 fSliceVec[slice][fTower] = val;
495}
496
497////////////////////////////////////////////////////////////////////////////////
498/// Fill given slice in a given tower.
499
501{
502 fSliceVec[slice][tower] = val;
503}
504
505
506////////////////////////////////////////////////////////////////////////////////
507/// Get list of cell-ids for given eta/phi range.
508
510 Float_t phi, Float_t phiD,
511 TEveCaloData::vCellId_t &out) const
512{
513 using namespace TMath;
514
515 Float_t etaMin = eta - etaD*0.5;
516 Float_t etaMax = eta + etaD*0.5;
517
518 Float_t phiMin = phi - phiD*0.5;
519 Float_t phiMax = phi + phiD*0.5;
520
521 Int_t nS = fSliceVec.size();
522
523 Int_t tower = 0;
524 Float_t fracx=0, fracy=0, frac;
526
527 for(vCellGeom_ci i=fGeomVec.begin(); i!=fGeomVec.end(); i++)
528 {
529 const CellGeom_t &cg = *i;
530 fracx = TEveUtil::GetFraction(etaMin, etaMax, cg.fEtaMin, cg.fEtaMax);
531 if (fracx > 1e-3)
532 {
533 minQ = cg.fPhiMin;
534 maxQ = cg.fPhiMax;
535
536 if (fWrapTwoPi)
537 {
538 if (maxQ < phiMin)
539 {
540 minQ += TwoPi(); maxQ += TwoPi();
541 }
542 else if (minQ > phiMax)
543 {
544 minQ -= TwoPi(); maxQ -= TwoPi();
545 }
546 }
547
548 if (maxQ >= phiMin && minQ <= phiMax)
549 {
551 if (fracy > 1e-3)
552 {
553 frac = fracx*fracy;
554 for (Int_t s=0; s<nS; s++)
555 {
556 if (fSliceVec[s][tower] > fSliceInfos[s].fThreshold)
557 out.push_back(CellId_t(tower, s, frac));
558 }
559 }
560 }
561 }
562 tower++;
563 }
564}
565
566////////////////////////////////////////////////////////////////////////////////
567/// Rebin cells.
568
570{
571 rdata.fNSlices = GetNSlices();
572 rdata.fBinData.assign((ax->GetNbins()+2)*(ay->GetNbins()+2), -1);
573
574 CellData_t cd;
575 for (vCellId_i it = ids.begin(); it != ids.end(); ++it)
576 {
577 GetCellData(*it, cd);
578 Int_t iMin = ax->FindBin(cd.EtaMin());
579 Int_t iMax = ax->FindBin(cd.EtaMax());
580 Int_t jMin = ay->FindBin(cd.PhiMin());
581 Int_t jMax = ay->FindBin(cd.PhiMax());
582 for (Int_t i = iMin; i <= iMax; ++i)
583 {
584 if (i < 0 || i > ax->GetNbins()) continue;
585 for (Int_t j = jMin; j <= jMax; ++j)
586 {
587 if (j < 0 || j > ay->GetNbins()) continue;
588
589 Double_t ratio = TEveUtil::GetFraction(ax->GetBinLowEdge(i), ax->GetBinUpEdge(i), cd.EtaMin(), cd.EtaMax())
590 * TEveUtil::GetFraction(ay->GetBinLowEdge(j), ay->GetBinUpEdge(j), cd.PhiMin(), cd.PhiMax());
591
592 if (ratio > 1e-6f)
593 {
594 Float_t* slices = rdata.GetSliceVals(i + j*(ax->GetNbins()+2));
595 slices[(*it).fSlice] += ratio * cd.Value(et);
596 }
597 }
598 }
599 }
600}
601
602////////////////////////////////////////////////////////////////////////////////
603/// Get cell geometry and value from cell ID.
604
607{
608 cellData.CellGeom_t::operator=( fGeomVec[id.fTower] );
609 cellData.fValue = fSliceVec[id.fSlice][id.fTower];
610}
611
612////////////////////////////////////////////////////////////////////////////////
613/// Update limits and notify data users.
614
616{
617 using namespace TMath;
618
619 // update max E/Et values
620
621 fMaxValE = 0;
622 fMaxValEt = 0;
623 Float_t sum=0;
624 // printf("geom vec %d slices %d\n",fGeomVec.size(), fSliceVec.size() );
625
626 for (UInt_t tw=0; tw<fGeomVec.size(); tw++)
627 {
628 sum=0;
629 for (vvFloat_i it=fSliceVec.begin(); it!=fSliceVec.end(); ++it)
630 sum += (*it)[tw];
631
632 if (sum > fMaxValEt ) fMaxValEt=sum;
633
634 sum /= Abs(Sin(EtaToTheta(fGeomVec[tw].Eta())));
635
636 if (sum > fMaxValE) fMaxValE=sum;
637 }
638
640}
641
642
643////////////////////////////////////////////////////////////////////////////////
644/// Set XY axis from cells geometry.
645
647{
648 std::vector<Double_t> binX;
649 std::vector<Double_t> binY;
650
651 for(vCellGeom_ci i=fGeomVec.begin(); i!=fGeomVec.end(); i++)
652 {
653 const CellGeom_t &ch = *i;
654
655 binX.push_back(ch.EtaMin());
656 binX.push_back(ch.EtaMax());
657 binY.push_back(ch.PhiMin());
658 binY.push_back(ch.PhiMax());
659 }
660
661 std::sort(binX.begin(), binX.end());
662 std::sort(binY.begin(), binY.end());
663
664 Int_t cnt = 0;
665 Double_t sum = 0;
666 Double_t val;
667
668 // X axis
669 Double_t dx = binX.back() - binX.front();
670 epsX *= dx;
671 std::vector<Double_t> newX;
672 newX.push_back(binX.front()); // underflow
673 Int_t nX = binX.size()-1;
674 for(Int_t i=0; i<nX; i++)
675 {
676 val = (sum +binX[i])/(cnt+1);
677 if (binX[i+1] -val > epsX)
678 {
679 newX.push_back(val);
680 cnt = 0;
681 sum = 0;
682 }
683 else
684 {
685 sum += binX[i];
686 cnt++;
687 }
688 }
689 newX.push_back(binX.back()); // overflow
690
691 // Y axis
692 cnt = 0;
693 sum = 0;
694 std::vector<Double_t> newY;
695 Double_t dy = binY.back() - binY.front();
696 epsY *= dy;
697 newY.push_back(binY.front());// underflow
698 Int_t nY = binY.size()-1;
699 for(Int_t i=0 ; i<nY; i++)
700 {
701 val = (sum +binY[i])/(cnt+1);
702 if (binY[i+1] -val > epsY )
703 {
704 newY.push_back(val);
705 cnt = 0;
706 sum = 0;
707 }
708 else
709 {
710 sum += binY[i];
711 cnt++;
712 }
713
714 }
715 newY.push_back(binY.back()); // overflow
716
717 if (fEtaAxis) delete fEtaAxis;
718 if (fPhiAxis) delete fPhiAxis;
719
720 fEtaAxis = new TAxis(newX.size()-1, &newX[0]);
721 fPhiAxis = new TAxis(newY.size()-1, &newY[0]);
724}
725
726/** \class TEveCaloDataHist
727\ingroup TEve
728A central manager for calorimeter data of an event written in TH2F.
729X axis is used for eta and Y axis for phi.
730*/
731
732
733////////////////////////////////////////////////////////////////////////////////
734/// Constructor.
735
737 TEveCaloData(),
738
739 fHStack(nullptr)
740{
741 fHStack = new THStack();
742 fEps = 1e-5;
743}
744
745////////////////////////////////////////////////////////////////////////////////
746/// Destructor.
747
752
753////////////////////////////////////////////////////////////////////////////////
754/// Update limits and notify data users.
755
757{
758 using namespace TMath;
759
760 // update max E/Et values
761 fMaxValE = 0;
762 fMaxValEt = 0;
763
764 if (GetNSlices() < 1) return;
765
766 TH2* hist = GetHist(0);
767 fEtaAxis = hist->GetXaxis();
768 fPhiAxis = hist->GetYaxis();
769 for (Int_t ieta = 1; ieta <= fEtaAxis->GetNbins(); ++ieta)
770 {
771 Double_t eta = fEtaAxis->GetBinCenter(ieta); // conversion E/Et
772 for (Int_t iphi = 1; iphi <= fPhiAxis->GetNbins(); ++iphi)
773 {
774 Double_t value = 0;
775 for (Int_t i = 0; i < GetNSlices(); ++i)
776 {
777 hist = GetHist(i);
778 Int_t bin = hist->GetBin(ieta, iphi);
779 value += hist->GetBinContent(bin);
780 }
781
782 if (value > fMaxValEt ) fMaxValEt = value;
783
784 value /= Abs(Sin(EtaToTheta(eta)));
785
786 if (value > fMaxValE) fMaxValE = value;
787 }
788 }
790}
791
792////////////////////////////////////////////////////////////////////////////////
793/// Get list of cell IDs in given eta and phi range.
794
796 Float_t phi, Float_t phiD,
797 TEveCaloData::vCellId_t &out) const
798{
799 using namespace TMath;
800
801 Float_t etaMin = eta - etaD*0.5 -fEps;
802 Float_t etaMax = eta + etaD*0.5 +fEps;
803
804 Float_t phiMin = phi - phiD*0.5 -fEps;
805 Float_t phiMax = phi + phiD*0.5 +fEps;
806
810
811 Int_t bin = 0;
812
814 for (Int_t ieta = 1; ieta <= nEta; ++ieta)
815 {
817 {
818 for (Int_t iphi = 1; iphi <= nPhi; ++iphi)
819 {
820 if (fWrapTwoPi )
821 {
824 }
825 else
826 {
829 }
830
831 if (accept)
832 {
833 for (Int_t s = 0; s < nSlices; ++s)
834 {
835 TH2F *hist = GetHist(s);
836 bin = hist->GetBin(ieta, iphi);
837 if (hist->GetBinContent(bin) > fSliceInfos[s].fThreshold)
838 out.push_back(TEveCaloData::CellId_t(bin, s));
839 } // hist slices
840 }
841 } // phi bins
842 }
843 } // eta bins
844}
845
846////////////////////////////////////////////////////////////////////////////////
847/// Rebin
848
850{
851 rdata.fNSlices = GetNSlices();
852 rdata.fBinData.assign((ax->GetNbins()+2)*(ay->GetNbins()+2), -1);
854 Float_t *val;
855 Int_t i, j, w;
856 Int_t binx, biny;
857 Int_t bin;
858
859 for (vCellId_i it=ids.begin(); it!=ids.end(); ++it)
860 {
861 GetCellData(*it, cd);
862 GetHist(it->fSlice)->GetBinXYZ((*it).fTower, i, j, w);
863 binx = ax->FindBin(fEtaAxis->GetBinCenter(i));
864 biny = ay->FindBin(fPhiAxis->GetBinCenter(j));
865 bin = biny*(ax->GetNbins()+2)+binx;
866 val = rdata.GetSliceVals(bin);
867 Double_t ratio = TEveUtil::GetFraction(ax->GetBinLowEdge(binx), ax->GetBinUpEdge(binx), cd.EtaMin(), cd.EtaMax())
868 * TEveUtil::GetFraction(ay->GetBinLowEdge(biny), ay->GetBinUpEdge(biny), cd.PhiMin(), cd.PhiMax());
869
870 val[(*it).fSlice] += cd.Value(et)*ratio;
871 }
872}
873
874////////////////////////////////////////////////////////////////////////////////
875/// Get cell geometry and value from cell ID.
876
879{
880 TH2F* hist = GetHist(id.fSlice);
881
882 Int_t x, y, z;
883 hist->GetBinXYZ(id.fTower, x, y, z);
884
885 cellData.fValue = hist->GetBinContent(id.fTower);
886 cellData.Configure(hist->GetXaxis()->GetBinLowEdge(x),
887 hist->GetXaxis()->GetBinUpEdge(x),
888 hist->GetYaxis()->GetBinLowEdge(y),
889 hist->GetYaxis()->GetBinUpEdge(y));
890}
891
892////////////////////////////////////////////////////////////////////////////////
893/// Add new slice to calo tower. Updates cached variables fMaxValE
894/// and fMaxValEt
895/// Return last index in the vector of slice infos.
896
898{
899 fHStack->Add(hist);
900 fSliceInfos.push_back(SliceInfo_t());
901 fSliceInfos.back().fName = hist->GetName();
902 fSliceInfos.back().fColor = hist->GetLineColor();
903
904 DataChanged();
905
906 return fSliceInfos.size() - 1;
907}
908
909////////////////////////////////////////////////////////////////////////////////
910/// Get histogram in given slice.
911
913{
914 assert(slice >= 0 && slice < fHStack->GetHists()->GetSize());
915 return (TH2F*) fHStack->GetHists()->At(slice);
916}
917
918////////////////////////////////////////////////////////////////////////////////
919/// Get eta limits.
920
922{
923 min = fEtaAxis->GetXmin();
924 max = fEtaAxis->GetXmax();
925}
926
927////////////////////////////////////////////////////////////////////////////////
928/// Get phi limits.
929
931{
932 min = fPhiAxis->GetXmin();
933 max = fPhiAxis->GetXmax();
934}
#define e(i)
Definition RSha256.hxx:103
short Color_t
Color number (short)
Definition RtypesCore.h:99
char Char_t
Character 1 byte (char)
Definition RtypesCore.h:51
float Float_t
Float 4 bytes (float)
Definition RtypesCore.h:71
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
const_iterator begin() const
const_iterator end() const
virtual void SetNdivisions(Int_t n=510, Bool_t optim=kTRUE)
Set the number of divisions for this axis.
Definition TAttAxis.cxx:214
virtual Color_t GetLineColor() const
Return the line color.
Definition TAttLine.h:35
Class to manage histogram axis.
Definition TAxis.h:32
virtual Double_t GetBinCenter(Int_t bin) const
Return center of bin.
Definition TAxis.cxx:481
Double_t GetXmax() const
Definition TAxis.h:142
virtual Double_t GetBinLowEdge(Int_t bin) const
Return low edge of bin.
Definition TAxis.cxx:521
Double_t GetXmin() const
Definition TAxis.h:141
Int_t GetNbins() const
Definition TAxis.h:127
virtual Double_t GetBinUpEdge(Int_t bin) const
Return up edge of bin.
Definition TAxis.cxx:531
TH2F * GetHist(Int_t slice) const
Get histogram in given slice.
void Rebin(TAxis *ax, TAxis *ay, vCellId_t &in, Bool_t et, RebinData_t &out) const override
Rebin.
void GetCellList(Float_t etaMin, Float_t etaMax, Float_t phi, Float_t phiRng, vCellId_t &out) const override
Get list of cell IDs in given eta and phi range.
Int_t AddHistogram(TH2F *hist)
Add new slice to calo tower.
TEveCaloDataHist()
Constructor.
void GetEtaLimits(Double_t &min, Double_t &max) const override
Get eta limits.
void GetCellData(const TEveCaloData::CellId_t &id, TEveCaloData::CellData_t &data) const override
Get cell geometry and value from cell ID.
void DataChanged() override
Update limits and notify data users.
~TEveCaloDataHist() override
Destructor.
void GetPhiLimits(Double_t &min, Double_t &max) const override
Get phi limits.
void Rebin(TAxis *ax, TAxis *ay, vCellId_t &in, Bool_t et, RebinData_t &out) const override
Rebin cells.
Int_t AddSlice()
Add new slice.
void SetAxisFromBins(Double_t epsX=0.001, Double_t epsY=0.001)
Set XY axis from cells geometry.
~TEveCaloDataVec() override
Destructor.
TEveCaloDataVec(const TEveCaloDataVec &)
std::vector< vFloat_t >::iterator vvFloat_i
vvFloat_t fSliceVec
void FillSlice(Int_t slice, Float_t value)
Fill given slice in the current tower.
vCellGeom_t fGeomVec
void DataChanged() override
Update limits and notify data users.
Int_t AddTower(Float_t etaMin, Float_t etaMax, Float_t phiMin, Float_t phiMax)
Add tower within eta/phi range.
void GetCellList(Float_t etaMin, Float_t etaMax, Float_t phi, Float_t phiRng, vCellId_t &out) const override
Get list of cell-ids for given eta/phi range.
void GetCellData(const TEveCaloData::CellId_t &id, TEveCaloData::CellData_t &data) const override
Get cell geometry and value from cell ID.
A central manager for calorimeter event data.
TEveCaloData(const TEveCaloData &)
Float_t fMaxValEt
Bool_t fWrapTwoPi
vCellId_t fCellsSelected
void FillImpliedSelectedSet(Set_t &impSelSet) override
Populate set impSelSet with derived / dependant elements.
vSliceInfo_t fSliceInfos
std::vector< CellId_t > vCellId_t
static Float_t EtaToTheta(Float_t eta)
void SetSliceColor(Int_t slice, Color_t col)
Set color for given slice.
void ProcessSelection(vCellId_t &sel_cells, TGLSelectRecord &rec)
Process newly selected cells with given select-record.
virtual void GetCellData(const CellId_t &id, CellData_t &data) const =0
Char_t GetSliceTransparency(Int_t slice) const
Get transparency for given slice.
vCellId_t fCellsHighlighted
void UnHighlighted() override
Virtual method TEveElement::UnHighlighted.
void SetSliceTransparency(Int_t slice, Char_t t)
Set transparency for given slice.
void SetSliceThreshold(Int_t slice, Float_t threshold)
Set threshold for given slice.
virtual void InvalidateUsersCellIdCache()
Invalidate cell ids cache on back ptr references.
Color_t GetSliceColor(Int_t slice) const
Get color for given slice.
TAxis * fEtaAxis
virtual void DataChanged()
Tell users (TEveCaloViz instances using this data) that data has changed and they should update the l...
TString GetHighlightTooltip() override
std::vector< CellGeom_t >::const_iterator vCellGeom_ci
virtual void CellSelectionChanged()
Tell users (TEveCaloViz instances using this data) that cell selection has changed and they should up...
Float_t GetSliceThreshold(Int_t slice) const
Get threshold for given slice.
Int_t GetNSlices() const
Float_t fMaxValE
void UnSelected() override
Virtual method TEveElement::UnSelect.
void PrintCellsSelected()
Print selected cells info.
TAxis * fPhiAxis
std::vector< CellId_t >::iterator vCellId_i
Base class for calorimeter data visualization.
Definition TEveCalo.h:32
Base class for TEveUtil visualization elements, providing hierarchy management, rendering control and...
Definition TEveElement.h:36
List_t fChildren
Definition TEveElement.h:81
std::set< TEveElement * > Set_t
Definition TEveElement.h:75
List_t::const_iterator List_ci
Definition TEveElement.h:73
static Float_t GetFraction(Float_t minM, Float_t maxM, Float_t minQ, Float_t maxQ)
Get fraction of interval [minQ, maxQ] in [minM, maxM].
Definition TEveUtil.cxx:381
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 TEveUtil.cxx:341
Standard selection record including information about containing scene and details ob out selected ob...
TAxis * GetXaxis()
Definition TH1.h:572
virtual void GetBinXYZ(Int_t binglobal, Int_t &binx, Int_t &biny, Int_t &binz) const
Return binx, biny, binz corresponding to the global bin number globalbin see TH1::GetBin function abo...
Definition TH1.cxx:4987
TAxis * GetYaxis()
Definition TH1.h:573
2-D histogram with a float per channel (see TH1 documentation)
Definition TH2.h:307
Service class for 2-D histogram classes.
Definition TH2.h:30
Int_t GetBin(Int_t binx, Int_t biny, Int_t binz=0) const override
Return Global bin number corresponding to binx,y,z.
Definition TH2.cxx:1046
Double_t GetBinContent(Int_t binx, Int_t biny) const override
Definition TH2.h:97
The Histogram stack class.
Definition THStack.h:40
TList * GetHists() const
Definition THStack.h:72
virtual void Add(TH1 *h, Option_t *option="")
Add a new histogram to the list.
Definition THStack.cxx:364
TObject * At(Int_t idx) const override
Returns the object at position idx. Returns 0 if idx is out of range.
Definition TList.cxx:354
The TNamed class is the base class for all named ROOT classes.
Definition TNamed.h:29
const char * GetName() const override
Returns name of object.
Definition TNamed.h:49
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition TObject.cxx:1071
Basic string class.
Definition TString.h:138
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Definition TString.cxx:2384
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17
const Int_t n
Definition legend1.C:16
TMath.
Definition TMathBase.h:35
Double_t Sin(Double_t)
Returns the sine of an angle of x radians.
Definition TMath.h:599
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
Definition TMathBase.h:124
constexpr Double_t TwoPi()
Definition TMath.h:47
Cell data inner structure.
Float_t Value(Bool_t) const
Return energy value associated with the cell, usually Et.
void Dump() const override
Print member data.
Cell geometry inner structure.
Float_t EtaMax() const
Float_t PhiMin() const
Float_t PhiMax() const
virtual void Dump() const
Print member data.
void Configure(Float_t etaMin, Float_t etaMax, Float_t phiMin, Float_t phiMax)
Float_t EtaMin() const
Float_t * GetSliceVals(Int_t bin)
static uint64_t sum(uint64_t i)
Definition Factory.cxx:2339