29#include <nlohmann/json.hpp>
43 printf(
"%f, %f %f, %f \n", fEtaMin, fEtaMax, fPhiMin, fPhiMax);
60 ::Error(
"REveCaloData::CellGeom_t::Configure",
"phiMin and phiMax should be between -2*pi and 2*pi (min=%f, max=%f). RhoZ projection will be wrong.",
90 printf(
"%f, %f %f, %f \n", fEtaMin, fEtaMax, fPhiMin, fPhiMax);
98 if (fBinData[bin] == -1)
100 fBinData[bin] = fSliceData.size();
102 for (
Int_t i=0; i<fNSlices; i++)
103 fSliceData.push_back(0.f);
106 return &fSliceData[fBinData[bin]];
148 int id = (i->fSlice << 24) + i->fTower;
235 calo->InvalidateCellIdCache();
236 calo->StampObjProps();
253 calo->StampObjProps();
264 auto sarr = nlohmann::json::array();
267 nlohmann::json slice = {};
268 slice[
"name"] = s.fName;
269 slice[
"threshold"] = s.fThreshold;
270 slice[
"color"] = s.fColor;
271 sarr.push_back(slice);
273 j[
"sliceInfos"] =
sarr;
291 int t =
id & 0xffffff;
304 using namespace TMath;
307 return Pi() - 2*ATan(Exp(- Abs(eta)));
309 return 2*ATan(Exp(- Abs(eta)));
324 int slice = (
id >> 24);
325 int tower =
id & 0xffffff;
377 fSliceVec.push_back(std::vector<Float_t> ());
430 using namespace TMath;
489 rdata.fBinData.assign((
ax->GetNbins()+2)*(
ay->GetNbins()+2), -1);
492 for (
vCellId_i it = ids.begin(); it != ids.end(); ++it)
534 using namespace TMath;
565 std::vector<Double_t> binX;
566 std::vector<Double_t>
binY;
572 binX.push_back(ch.
EtaMin());
573 binX.push_back(ch.
EtaMax());
578 std::sort(binX.begin(), binX.end());
588 std::vector<Double_t>
newX;
589 newX.push_back(binX.front());
593 val = (
sum +binX[i])/(cnt+1);
594 if (binX[i+1] -val >
epsX)
606 newX.push_back(binX.back());
611 std::vector<Double_t>
newY;
671 using namespace TMath;
710 using namespace TMath;
763 rdata.fBinData.assign((
ax->GetNbins()+2)*(
ay->GetNbins()+2), -1);
770 for (
vCellId_i it=ids.begin(); it!=ids.end(); ++it)
773 GetHist(it->fSlice)->GetBinXYZ((*it).fTower, i,
j,
w);
777 val =
rdata.GetSliceVals(bin);
781 val[(*it).fSlice] += cd.
Value(
et)*ratio;
875 si->GetCellsFromSecondaryIndices(
idcs, out);
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
REveElement::List_t fNieces
Int_t AddHistogram(TH2F *hist)
Add new slice to calo tower.
~REveCaloDataHist() override
Destructor.
void DataChanged() override
Update limits and notify data users.
TH2F * GetHist(Int_t slice) const
Get histogram in given slice.
void GetEtaLimits(Double_t &min, Double_t &max) const override
Get eta limits.
void GetCellData(const REveCaloData::CellId_t &id, REveCaloData::CellData_t &data) const override
Get cell geometry and value from cell ID.
void GetPhiLimits(Double_t &min, Double_t &max) const override
Get phi limits.
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.
void Rebin(TAxis *ax, TAxis *ay, vCellId_t &in, Bool_t et, RebinData_t &out) const override
Rebin.
REveCaloDataHist()
Constructor.
void GetCellsFromSecondaryIndices(const std::set< int > &, REveCaloData::vCellId_t &out)
GetCellsFromSecondaryIndices used in implied selection.
void ProcessSelection(REveCaloData::vCellId_t &sel_cells, UInt_t selectionId, Bool_t multi)
Process selection. Called from REveCaloViz object.
std::vector< std::unique_ptr< REveCaloDataSliceSelector > > fSliceSelectors
void GetCellData(const REveCaloData::CellId_t &id, REveCaloData::CellData_t &data) const override
Get cell geometry and value from cell ID.
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 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.
Int_t AddTower(Float_t etaMin, Float_t etaMax, Float_t phiMin, Float_t phiMax)
Add tower within eta/phi range.
void SetAxisFromBins(Double_t epsX=0.001, Double_t epsY=0.001)
Set XY axis from cells geometry.
std::vector< vFloat_t >::iterator vvFloat_i
REveCaloDataVec(Int_t nslices)
~REveCaloDataVec() override
Destructor.
void DataChanged() override
Update limits and notify data users.
void FillSlice(Int_t slice, Float_t value)
Fill given slice in the current tower.
Color_t GetSliceColor(Int_t slice) const
Get color for given slice.
Char_t GetSliceTransparency(Int_t slice) const
Get transparency for given slice.
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
std::vector< CellGeom_t >::const_iterator vCellGeom_ci
void SetSliceTransparency(Int_t slice, Char_t t)
Set transparency for given slice.
static Float_t EtaToTheta(Float_t eta)
std::unique_ptr< REveCaloDataSelector > fSelector
REveCaloData(const char *n="REveCaloData", const char *t="")
std::unique_ptr< TAxis > fEtaAxis
void FillExtraSelectionData(nlohmann::json &, const std::set< int > &) const override
std::string GetHighlightTooltip(const std::set< int > &secondary_idcs) const override
virtual void DataChanged()
Tell users (REveCaloViz instances using this data) that data has changed and they should update the l...
std::unique_ptr< TAxis > fPhiAxis
void ProcessSelection(vCellId_t &sel_cells, UInt_t selectionId, Bool_t multi)
Process newly selected cells with given select-record.
Float_t GetSliceThreshold(Int_t slice) const
Get threshold for given slice.
virtual void InvalidateUsersCellIdCache()
Invalidate cell ids cache on back ptr references.
std::vector< CellId_t > vCellId_t
void SetSliceColor(Int_t slice, Color_t col)
Set color for given slice.
Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override
Write core json.
void FillImpliedSelectedSet(Set_t &impSelSet, const std::set< int > &sec_idcs) override
Populate set impSelSet with derived / dependant elements.
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.
virtual void AddStamp(UChar_t bits)
Add (bitwise or) given stamps to fChangeBits.
std::set< REveElement * > Set_t
ElementId_t GetElementId() const
REveElement * FindElementById(ElementId_t id) const
Lookup ElementId in element map and return corresponding REveElement*.
REveSelection Container for selected and highlighted elements.
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].
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.
const_iterator begin() const
const_iterator end() const
virtual Color_t GetLineColor() const
Return the line color.
Class to manage histogram axis.
virtual Double_t GetBinLowEdge(Int_t bin) const
Return low edge of bin.
virtual Double_t GetBinUpEdge(Int_t bin) const
Return up edge of bin.
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...
2-D histogram with a float per channel (see TH1 documentation)
Service class for 2-D histogram classes.
Int_t GetBin(Int_t binx, Int_t biny, Int_t binz=0) const override
Return Global bin number corresponding to binx,y,z.
Double_t GetBinContent(Int_t binx, Int_t biny) const override
The Histogram stack class.
virtual void Add(TH1 *h, Option_t *option="")
Add a new histogram to the list.
TObject * At(Int_t idx) const override
Returns the object at position idx. Returns 0 if idx is out of range.
const char * GetName() const override
Returns name of object.
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
R__EXTERN REveManager * gEve
Double_t Sin(Double_t)
Returns the sine of an angle of x radians.
Short_t Abs(Short_t d)
Returns the absolute value of parameter Short_t d.
constexpr Double_t TwoPi()
void Dump() const override
Print member data.
Float_t Value(Bool_t) const
Return energy value associated with the cell, usually Et.
void Configure(Float_t etaMin, Float_t etaMax, Float_t phiMin, Float_t phiMax)
virtual void Dump() const
Print member data.
Float_t * GetSliceVals(Int_t bin)
static uint64_t sum(uint64_t i)