50 #ifndef ROOT_TMVA_PDEFoamDecisionTree
53 #ifndef ROOT_TMVA_PDEFoamDecisionTreeDensity
62 TMVA::PDEFoamDecisionTree::PDEFoamDecisionTree()
63 : PDEFoamDiscriminant()
89 , fSepType(from.fSepType)
91 Log() <<
kFATAL <<
"COPY CONSTRUCTOR NOT IMPLEMENTED" <<
Endl;
121 Log() <<
kFATAL <<
"<DTExplore> Null pointer given!" <<
Endl;
124 std::vector<TH1D*> hsig, hbkg, hsig_unw, hbkg_unw;
127 hsig_unw.reserve(fDim);
128 hbkg_unw.reserve(fDim);
129 for (
Int_t idim = 0; idim < fDim; idim++) {
130 hsig.push_back(
new TH1D(
Form(
"hsig_%i", idim),
131 Form(
"signal[%i]", idim), fNBin, fXmin[idim], fXmax[idim]));
132 hbkg.push_back(
new TH1D(
Form(
"hbkg_%i", idim),
133 Form(
"background[%i]", idim), fNBin, fXmin[idim], fXmax[idim]));
134 hsig_unw.push_back(
new TH1D(
Form(
"hsig_unw_%i", idim),
135 Form(
"signal_unw[%i]", idim), fNBin, fXmin[idim], fXmax[idim]));
136 hbkg_unw.push_back(
new TH1D(
Form(
"hbkg_unw_%i", idim),
137 Form(
"background_unw[%i]", idim), fNBin, fXmin[idim], fXmax[idim]));
141 PDEFoamVect cellSize(GetTotDim()), cellPosi(GetTotDim());
142 cell->
GetHcub(cellPosi, cellSize);
145 std::vector<Double_t> lb(GetTotDim());
146 std::vector<Double_t> ub(GetTotDim());
147 for (
Int_t idim = 0; idim < GetTotDim(); idim++) {
155 Log() <<
kFATAL <<
"<PDEFoamDecisionTree::Explore>: cast failed: "
156 <<
"PDEFoamDensityBase* --> PDEFoamDecisionTreeDensity*" <<
Endl;
168 Double_t nTotS = hsig.at(0)->Integral(0, hsig.at(0)->GetNbinsX() + 1);
169 Double_t nTotB = hbkg.at(0)->Integral(0, hbkg.at(0)->GetNbinsX() + 1);
170 Double_t nTotS_unw = hsig_unw.at(0)->Integral(0, hsig_unw.at(0)->GetNbinsX() + 1);
171 Double_t nTotB_unw = hbkg_unw.at(0)->Integral(0, hbkg_unw.at(0)->GetNbinsX() + 1);
173 for (
Int_t idim = 0; idim < fDim; ++idim) {
174 Double_t nSelS = hsig.at(idim)->GetBinContent(0);
175 Double_t nSelB = hbkg.at(idim)->GetBinContent(0);
176 Double_t nSelS_unw = hsig_unw.at(idim)->GetBinContent(0);
177 Double_t nSelB_unw = hbkg_unw.at(idim)->GetBinContent(0);
178 for (
Int_t jLo = 1; jLo < fNBin; jLo++) {
179 nSelS += hsig.at(idim)->GetBinContent(jLo);
180 nSelB += hbkg.at(idim)->GetBinContent(jLo);
181 nSelS_unw += hsig_unw.at(idim)->GetBinContent(jLo);
182 nSelB_unw += hbkg_unw.at(idim)->GetBinContent(jLo);
186 if (!((nSelS_unw + nSelB_unw) >= GetNmin() &&
187 (nTotS_unw - nSelS_unw + nTotB_unw - nSelB_unw) >= GetNmin()))
193 Double_t gain = fSepType->GetSeparationGain(nSelS, nSelB, nTotS, nTotB);
195 if (gain >= maxGain) {
203 if (kBest >= fDim || kBest < 0) {
214 if (nTotB + nTotS > 0)
215 cell->
SetIntg(nTotS / (nTotB + nTotS));
224 SetCellElement(cell, 0, nTotS + nTotB);
227 for (
UInt_t ih = 0; ih < hsig.size(); ih++)
delete hsig.at(ih);
228 for (
UInt_t ih = 0; ih < hbkg.size(); ih++)
delete hbkg.at(ih);
229 for (
UInt_t ih = 0; ih < hsig_unw.size(); ih++)
delete hsig_unw.at(ih);
230 for (
UInt_t ih = 0; ih < hbkg_unw.size(); ih++)
delete hbkg_unw.at(ih);
ClassImp(TMVA::PDEFoamDecisionTree) TMVA
Default constructor for streamer, user should not use it.
MsgLogger & Endl(MsgLogger &ml)
virtual void FillHistograms(TMVA::Volume &, std::vector< TH1D * > &, std::vector< TH1D * > &, std::vector< TH1D * > &, std::vector< TH1D * > &)
Fill the given histograms with signal and background events, which are found in the volume...
void SetXdiv(Double_t Xdiv)
virtual void Explore(PDEFoamCell *Cell)
Internal subprogram used by Create.
void CalcVolume()
Calculates volume of the cell using size params which are calculated.
char * Form(const char *fmt,...)
void SetDriv(Double_t Driv)
void SetIntg(Double_t Intg)
Abstract ClassifierFactory template that handles arbitrary types.
void GetHcub(PDEFoamVect &, PDEFoamVect &) const
Provides size and position of the cell These parameter are calculated by analyzing information in all...
virtual ~PDEFoamDecisionTree()
Destructor deletes fSepType.