67 TMVA::PDEFoamDiscriminant::PDEFoamDiscriminant()
87 Log() <<
kFATAL <<
"COPY CONSTRUCTOR NOT IMPLEMENTED" <<
Endl;
99 std::vector<Float_t> tvalues = VarTransform(values);
105 SetCellElement(cell, 0, GetCellElement(cell, 0) + wt);
107 SetCellElement(cell, 1, GetCellElement(cell, 1) + wt);
117 for (
Long_t iCell = 0; iCell <= fLastCe; iCell++) {
118 if (!(fCells[iCell]->GetStat()))
121 Double_t n_sig = GetCellElement(fCells[iCell], 0);
122 Double_t n_bg = GetCellElement(fCells[iCell], 1);
125 Log() <<
kWARNING <<
"Negative number of signal events in cell " << iCell
126 <<
": " << n_sig <<
". Set to 0." <<
Endl;
130 Log() <<
kWARNING <<
"Negative number of background events in cell " << iCell
131 <<
": " << n_bg <<
". Set to 0." <<
Endl;
136 if (n_sig + n_bg > 0) {
138 SetCellElement(fCells[iCell], 0, n_sig / (n_sig + n_bg));
140 SetCellElement(fCells[iCell], 1,
TMath::Sqrt(Sqr(n_sig / Sqr(n_sig + n_bg))*n_sig +
141 Sqr(n_bg / Sqr(n_sig + n_bg))*n_bg));
144 SetCellElement(fCells[iCell], 0, 0.5);
145 SetCellElement(fCells[iCell], 1, 1.);
177 if ((idim1 >= GetTotDim()) || (idim1 < 0) ||
178 (idim2 >= GetTotDim()) || (idim2 < 0) ||
180 Log() <<
kFATAL <<
"<Project2>: wrong dimensions given: "
181 << idim1 <<
", " << idim2 <<
Endl;
187 Log() <<
kWARNING <<
"Warning: number of bins too big: " << nbin
188 <<
" Using 1000 bins for each dimension instead." <<
Endl;
190 }
else if (nbin < 1) {
192 <<
"; set nbin=50" <<
Endl;
202 h1 =
new TH2D(hname.
Data(),
Form(
"var%d vs var%d", idim1, idim2), nbin, fXmin[idim1], fXmax[idim1], nbin, fXmin[idim2], fXmax[idim2]);
204 if (!h1)
Log() <<
kFATAL <<
"ERROR: Can not create histo" << hname <<
Endl;
215 std::map<Int_t, Float_t> txvec;
221 std::vector<TMVA::PDEFoamCell*> cells = FindCells(txvec);
226 for (std::vector<TMVA::PDEFoamCell*>::const_iterator it = cells.begin();
227 it != cells.end(); ++it) {
229 PDEFoamVect cellPosi(GetTotDim()), cellSize(GetTotDim());
230 (*it)->GetHcub(cellPosi, cellSize);
233 std::vector<Float_t> tvec;
234 for (
Int_t i = 0; i < GetTotDim(); ++i) {
235 if (i != idim1 && i != idim2)
236 tvec.push_back(cellPosi[i] + 0.5 * cellSize[i]);
238 tvec.push_back(txvec[i]);
242 if (kernel !=
NULL) {
243 cv = kernel->
Estimate(
this, tvec, cell_value);
245 cv = GetCellValue(FindCell(tvec), cell_value);
247 if (cell_value ==
kValue) {
251 for (
Int_t d1 = 0; d1 < GetTotDim(); ++d1) {
252 if ((d1 != idim1) && (d1 != idim2))
253 area_cell *= cellSize[d1];
MsgLogger & Endl(MsgLogger &ml)
ClassImp(TMVA::PDEFoamDiscriminant) TMVA
Default constructor for streamer, user should not use it.
std::vector< double > values
virtual TH2D * Project2(Int_t, Int_t, ECellValue, PDEFoamKernelBase *, UInt_t)
Project foam variable idim1 and variable idim2 to histogram.
virtual Int_t GetNbinsX() const
const char * Data() const
virtual void SetRangeUser(Double_t ufirst, Double_t ulast)
Set the viewing range for the axis from ufirst to ulast (in user coordinates).
virtual Float_t Estimate(PDEFoam *, std::vector< Float_t > &, ECellValue)=0
TClass * fClass
pointer to the foreign object
virtual Double_t GetBinContent(Int_t bin) const
Return content of bin number bin.
char * Form(const char *fmt,...)
virtual void Finalize()
Calc discriminator and its error for every cell and save it to the cell.
virtual Double_t GetBinCenter(Int_t bin) const
Return center of bin.
virtual void FillFoamCells(const Event *ev, Float_t wt)
This function fills an event into the discriminant PDEFoam.
virtual Int_t GetNbinsY() const
std::vector< Float_t > & GetValues()
virtual void SetBinContent(Int_t bin, Double_t content)
Set bin content.
Double_t Sqrt(Double_t x)
2-D histogram with a double per channel (see TH1 documentation)}