#ifndef ROOT_TMath
#include "TMath.h"
#endif
#ifndef ROOT_TMVA_PDEFoamKernelGauss
#include "TMVA/PDEFoamKernelGauss.h"
#endif
ClassImp(TMVA::PDEFoamKernelGauss)
TMVA::PDEFoamKernelGauss::PDEFoamKernelGauss(Float_t sigma)
: PDEFoamKernelBase()
, fSigma(sigma)
{
}
TMVA::PDEFoamKernelGauss::PDEFoamKernelGauss(const PDEFoamKernelGauss &other)
: PDEFoamKernelBase(other)
, fSigma(other.fSigma)
{
}
Float_t TMVA::PDEFoamKernelGauss::Estimate(PDEFoam *foam, std::vector<Float_t> &txvec, ECellValue cv)
{
if (foam == NULL)
Log() << kFATAL << "<PDEFoamKernelGauss::Estimate>: PDEFoam not set!" << Endl;
Float_t result = 0, norm = 0;
for (Long_t iCell = 0; iCell <= foam->fLastCe; iCell++) {
if (!(foam->fCells[iCell]->GetStat())) continue;
Float_t cell_val = 0;
if (!foam->CellValueIsUndefined(foam->fCells[iCell]))
cell_val = foam->GetCellValue(foam->fCells[iCell], cv);
else
cell_val = GetAverageNeighborsValue(foam, txvec, cv);
Float_t gau = WeightGaus(foam, foam->fCells[iCell], txvec);
result += gau * cell_val;
norm += gau;
}
return (norm != 0 ? result / norm : 0);
}
Float_t TMVA::PDEFoamKernelGauss::GetAverageNeighborsValue(PDEFoam *foam,
std::vector<Float_t> &txvec,
ECellValue cv)
{
const Float_t xoffset = 1.e-6;
Float_t norm = 0;
Float_t result = 0;
PDEFoamCell *cell = foam->FindCell(txvec);
PDEFoamVect cellSize(foam->GetTotDim());
PDEFoamVect cellPosi(foam->GetTotDim());
cell->GetHcub(cellPosi, cellSize);
for (Int_t dim = 0; dim < foam->GetTotDim(); dim++) {
std::vector<Float_t> ntxvec(txvec);
PDEFoamCell* left_cell = 0;
PDEFoamCell* right_cell = 0;
ntxvec[dim] = cellPosi[dim] - xoffset;
left_cell = foam->FindCell(ntxvec);
if (!foam->CellValueIsUndefined(left_cell)) {
result += foam->GetCellValue(left_cell, cv);
norm++;
}
ntxvec[dim] = cellPosi[dim] + cellSize[dim] + xoffset;
right_cell = foam->FindCell(ntxvec);
if (!foam->CellValueIsUndefined(right_cell)) {
result += foam->GetCellValue(right_cell, cv);
norm++;
}
}
if (norm > 0) result /= norm;
else result = 0;
return result;
}
Float_t TMVA::PDEFoamKernelGauss::WeightGaus(PDEFoam *foam, PDEFoamCell* cell,
std::vector<Float_t> &txvec)
{
PDEFoamVect cellSize(foam->GetTotDim());
PDEFoamVect cellPosi(foam->GetTotDim());
cell->GetHcub(cellPosi, cellSize);
std::vector<Float_t> cell_center;
cell_center.reserve(foam->GetTotDim());
for (Int_t i = 0; i < foam->GetTotDim(); ++i) {
if (txvec[i] < 0.) txvec[i] = 0.;
if (txvec[i] > 1.) txvec[i] = 1.;
if (cellPosi[i] > txvec.at(i))
cell_center.push_back(cellPosi[i]);
else if (cellPosi[i] + cellSize[i] < txvec.at(i))
cell_center.push_back(cellPosi[i] + cellSize[i]);
else
cell_center.push_back(txvec.at(i));
}
Float_t distance = 0;
for (Int_t i = 0; i < foam->GetTotDim(); ++i)
distance += Sqr(txvec.at(i) - cell_center.at(i));
distance = TMath::Sqrt(distance);
return TMath::Gaus(distance, 0, fSigma, kFALSE);
}
PDEFoamKernelGauss.cxx:10 PDEFoamKernelGauss.cxx:11 PDEFoamKernelGauss.cxx:12 PDEFoamKernelGauss.cxx:13 PDEFoamKernelGauss.cxx:14 PDEFoamKernelGauss.cxx:15 PDEFoamKernelGauss.cxx:16 PDEFoamKernelGauss.cxx:17 PDEFoamKernelGauss.cxx:18 PDEFoamKernelGauss.cxx:19 PDEFoamKernelGauss.cxx:20 PDEFoamKernelGauss.cxx:21 PDEFoamKernelGauss.cxx:22 PDEFoamKernelGauss.cxx:23 PDEFoamKernelGauss.cxx:24 PDEFoamKernelGauss.cxx:25 PDEFoamKernelGauss.cxx:26 PDEFoamKernelGauss.cxx:27 PDEFoamKernelGauss.cxx:28 PDEFoamKernelGauss.cxx:29 PDEFoamKernelGauss.cxx:30 PDEFoamKernelGauss.cxx:31 PDEFoamKernelGauss.cxx:32 PDEFoamKernelGauss.cxx:33 PDEFoamKernelGauss.cxx:34 PDEFoamKernelGauss.cxx:35 PDEFoamKernelGauss.cxx:36 PDEFoamKernelGauss.cxx:37 PDEFoamKernelGauss.cxx:38 PDEFoamKernelGauss.cxx:39 PDEFoamKernelGauss.cxx:40 PDEFoamKernelGauss.cxx:41 PDEFoamKernelGauss.cxx:42 PDEFoamKernelGauss.cxx:43 PDEFoamKernelGauss.cxx:44 PDEFoamKernelGauss.cxx:45 PDEFoamKernelGauss.cxx:46 PDEFoamKernelGauss.cxx:47 PDEFoamKernelGauss.cxx:48 PDEFoamKernelGauss.cxx:49 PDEFoamKernelGauss.cxx:50 PDEFoamKernelGauss.cxx:51 PDEFoamKernelGauss.cxx:52 PDEFoamKernelGauss.cxx:53 PDEFoamKernelGauss.cxx:54 PDEFoamKernelGauss.cxx:55 PDEFoamKernelGauss.cxx:56 PDEFoamKernelGauss.cxx:57 PDEFoamKernelGauss.cxx:58 PDEFoamKernelGauss.cxx:59 PDEFoamKernelGauss.cxx:60 PDEFoamKernelGauss.cxx:61 PDEFoamKernelGauss.cxx:62 PDEFoamKernelGauss.cxx:63 PDEFoamKernelGauss.cxx:64 PDEFoamKernelGauss.cxx:65 PDEFoamKernelGauss.cxx:66 PDEFoamKernelGauss.cxx:67 PDEFoamKernelGauss.cxx:68 PDEFoamKernelGauss.cxx:69 PDEFoamKernelGauss.cxx:70 PDEFoamKernelGauss.cxx:71 PDEFoamKernelGauss.cxx:72 PDEFoamKernelGauss.cxx:73 PDEFoamKernelGauss.cxx:74 PDEFoamKernelGauss.cxx:75 PDEFoamKernelGauss.cxx:76 PDEFoamKernelGauss.cxx:77 PDEFoamKernelGauss.cxx:78 PDEFoamKernelGauss.cxx:79 PDEFoamKernelGauss.cxx:80 PDEFoamKernelGauss.cxx:81 PDEFoamKernelGauss.cxx:82 PDEFoamKernelGauss.cxx:83 PDEFoamKernelGauss.cxx:84 PDEFoamKernelGauss.cxx:85 PDEFoamKernelGauss.cxx:86 PDEFoamKernelGauss.cxx:87 PDEFoamKernelGauss.cxx:88 PDEFoamKernelGauss.cxx:89 PDEFoamKernelGauss.cxx:90 PDEFoamKernelGauss.cxx:91 PDEFoamKernelGauss.cxx:92 PDEFoamKernelGauss.cxx:93 PDEFoamKernelGauss.cxx:94 PDEFoamKernelGauss.cxx:95 PDEFoamKernelGauss.cxx:96 PDEFoamKernelGauss.cxx:97 PDEFoamKernelGauss.cxx:98 PDEFoamKernelGauss.cxx:99 PDEFoamKernelGauss.cxx:100 PDEFoamKernelGauss.cxx:101 PDEFoamKernelGauss.cxx:102 PDEFoamKernelGauss.cxx:103 PDEFoamKernelGauss.cxx:104 PDEFoamKernelGauss.cxx:105 PDEFoamKernelGauss.cxx:106 PDEFoamKernelGauss.cxx:107 PDEFoamKernelGauss.cxx:108 PDEFoamKernelGauss.cxx:109 PDEFoamKernelGauss.cxx:110 PDEFoamKernelGauss.cxx:111 PDEFoamKernelGauss.cxx:112 PDEFoamKernelGauss.cxx:113 PDEFoamKernelGauss.cxx:114 PDEFoamKernelGauss.cxx:115 PDEFoamKernelGauss.cxx:116 PDEFoamKernelGauss.cxx:117 PDEFoamKernelGauss.cxx:118 PDEFoamKernelGauss.cxx:119 PDEFoamKernelGauss.cxx:120 PDEFoamKernelGauss.cxx:121 PDEFoamKernelGauss.cxx:122 PDEFoamKernelGauss.cxx:123 PDEFoamKernelGauss.cxx:124 PDEFoamKernelGauss.cxx:125 PDEFoamKernelGauss.cxx:126 PDEFoamKernelGauss.cxx:127 PDEFoamKernelGauss.cxx:128 PDEFoamKernelGauss.cxx:129 PDEFoamKernelGauss.cxx:130 PDEFoamKernelGauss.cxx:131 PDEFoamKernelGauss.cxx:132 PDEFoamKernelGauss.cxx:133 PDEFoamKernelGauss.cxx:134 PDEFoamKernelGauss.cxx:135 PDEFoamKernelGauss.cxx:136 PDEFoamKernelGauss.cxx:137 PDEFoamKernelGauss.cxx:138 PDEFoamKernelGauss.cxx:139 PDEFoamKernelGauss.cxx:140 PDEFoamKernelGauss.cxx:141 PDEFoamKernelGauss.cxx:142 PDEFoamKernelGauss.cxx:143 PDEFoamKernelGauss.cxx:144 PDEFoamKernelGauss.cxx:145 PDEFoamKernelGauss.cxx:146 PDEFoamKernelGauss.cxx:147 PDEFoamKernelGauss.cxx:148 PDEFoamKernelGauss.cxx:149 PDEFoamKernelGauss.cxx:150 PDEFoamKernelGauss.cxx:151 PDEFoamKernelGauss.cxx:152 PDEFoamKernelGauss.cxx:153 PDEFoamKernelGauss.cxx:154 PDEFoamKernelGauss.cxx:155 PDEFoamKernelGauss.cxx:156 PDEFoamKernelGauss.cxx:157 PDEFoamKernelGauss.cxx:158 PDEFoamKernelGauss.cxx:159 PDEFoamKernelGauss.cxx:160 PDEFoamKernelGauss.cxx:161 PDEFoamKernelGauss.cxx:162 PDEFoamKernelGauss.cxx:163 PDEFoamKernelGauss.cxx:164 PDEFoamKernelGauss.cxx:165 PDEFoamKernelGauss.cxx:166 PDEFoamKernelGauss.cxx:167 PDEFoamKernelGauss.cxx:168 PDEFoamKernelGauss.cxx:169 PDEFoamKernelGauss.cxx:170 PDEFoamKernelGauss.cxx:171 PDEFoamKernelGauss.cxx:172 PDEFoamKernelGauss.cxx:173 PDEFoamKernelGauss.cxx:174 PDEFoamKernelGauss.cxx:175 PDEFoamKernelGauss.cxx:176 PDEFoamKernelGauss.cxx:177 PDEFoamKernelGauss.cxx:178 PDEFoamKernelGauss.cxx:179 PDEFoamKernelGauss.cxx:180 PDEFoamKernelGauss.cxx:181 PDEFoamKernelGauss.cxx:182 PDEFoamKernelGauss.cxx:183 PDEFoamKernelGauss.cxx:184 PDEFoamKernelGauss.cxx:185 PDEFoamKernelGauss.cxx:186 PDEFoamKernelGauss.cxx:187 PDEFoamKernelGauss.cxx:188 PDEFoamKernelGauss.cxx:189 PDEFoamKernelGauss.cxx:190 PDEFoamKernelGauss.cxx:191 PDEFoamKernelGauss.cxx:192 PDEFoamKernelGauss.cxx:193 PDEFoamKernelGauss.cxx:194 PDEFoamKernelGauss.cxx:195 PDEFoamKernelGauss.cxx:196 PDEFoamKernelGauss.cxx:197 PDEFoamKernelGauss.cxx:198 PDEFoamKernelGauss.cxx:199 PDEFoamKernelGauss.cxx:200 PDEFoamKernelGauss.cxx:201 PDEFoamKernelGauss.cxx:202 PDEFoamKernelGauss.cxx:203 PDEFoamKernelGauss.cxx:204