26 TKDEAdapter::TKDEAdapter()
27 : fW(0), fH(0), fD(0),
29 fXMin(0.), fXStep(0.),
30 fYMin(0.), fYStep(0.),
31 fZMin(0.), fZStep(0.),
40 void TKDEAdapter::SetGeometry(
const TGL5DDataSet *dataSet)
42 const TAxis *xA = dataSet->GetXAxis();
43 const Rgl::Range_t &xMinMax = dataSet->GetXRange();
44 const Double_t xRange = xMinMax.second - xMinMax.first;
46 const TAxis *yA = dataSet->GetYAxis();
47 const Rgl::Range_t &yMinMax = dataSet->GetYRange();
48 const Double_t yRange = yMinMax.second - yMinMax.first;
50 const TAxis *zA = dataSet->GetZAxis();
51 const Rgl::Range_t &zMinMax = dataSet->GetZRange();
52 const Double_t zRange = zMinMax.second - zMinMax.first;
60 fXMin = (xA->GetBinLowEdge(1) - xMinMax.first) / xRange;
61 fXStep = (xA->GetBinUpEdge(xA->GetLast()) - xA->GetBinLowEdge(xA->GetFirst())) / (fW - 1) / xRange;
63 fYMin = (yA->GetBinLowEdge(1) - yMinMax.first) / yRange;
64 fYStep = (yA->GetBinUpEdge(yA->GetLast()) - yA->GetBinLowEdge(yA->GetFirst())) / (fH - 1) / yRange;
66 fZMin = (zA->GetBinLowEdge(1) - zMinMax.first) / zRange;
67 fZStep = (zA->GetBinCenter(zA->GetLast()) - zA->GetBinLowEdge(zA->GetFirst())) / (fD - 1) / zRange;
73 void TKDEAdapter::SetE(Double_t e)
81 Double_t TKDEAdapter::GetE()
const
89 UInt_t TKDEAdapter::GetW()
const
97 UInt_t TKDEAdapter::GetH()
const
105 UInt_t TKDEAdapter::GetD()
const
113 void TKDEAdapter::SetDataSource(
const TKDEFGT *de)
121 void TKDEAdapter::FetchDensities()
const
124 Error(
"TKDEAdapter::FetchFirstSlices",
"Density estimator is a null pointer."
125 " Set it correctly first.");
126 throw std::runtime_error(
"No density estimator.");
129 fGrid.resize(fD * fSliceSize * 3);
134 for(UInt_t k = 0; k < fD; ++k) {
135 for (UInt_t i = 0; i < fH; ++i) {
136 for (UInt_t j = 0; j < fW; ++j, ind += 3) {
137 fGrid[ind] = fXMin + j * fXStep;
138 fGrid[ind + 1] = fYMin + i * fYStep;
139 fGrid[ind + 2] = fZMin + k * fZStep;
144 fDensities.resize(fSliceSize * fD);
146 fDE->Predict(fGrid, fDensities, fE);
152 Float_t TKDEAdapter::GetData(UInt_t i, UInt_t j, UInt_t k)
const
154 const UInt_t ind = k * fSliceSize + j * fW + i;
155 return fDensities[ind];
161 void TKDEAdapter::FreeVectors()
163 vector_t().swap(fGrid);
164 vector_t().swap(fDensities);