112 std::vector<TH1D*> &hbkg, std::vector<TH1D*> &hsig_unw,
113 std::vector<TH1D*> &hbkg_unw)
116 if (hsig.size() != volume.
fLower->size()
117 || hbkg.size() != volume.
fLower->size()
118 || hsig_unw.size() != volume.
fLower->size()
119 || hbkg_unw.size() != volume.
fLower->size())
120 Log() << kFATAL <<
"<PDEFoamDistr::FillHistograms> Edge histograms have wrong size!" <<
Endl;
123 for (
UInt_t idim = 0; idim < hsig.size(); ++idim) {
124 if (!hsig.at(idim) || !hbkg.at(idim) ||
125 !hsig_unw.at(idim) || !hbkg_unw.at(idim))
126 Log() << kFATAL <<
"<PDEFoamDistr::FillHist> Histograms not initialized!" <<
Endl;
130 std::vector<const TMVA::BinarySearchTreeNode*> nodes;
136 std::vector<Float_t>
xmin(volume.
fLower->size(), std::numeric_limits<float>::max());
137 std::vector<Float_t>
xmax(volume.
fLower->size(), -std::numeric_limits<float>::max());
138 for (std::vector<const TMVA::BinarySearchTreeNode*>::const_iterator it = nodes.begin();
139 it != nodes.end(); ++it) {
140 std::vector<Float_t> ev = (*it)->GetEventV();
141 for (
UInt_t idim = 0; idim <
xmin.size(); ++idim) {
142 if (ev.at(idim) <
xmin.at(idim))
xmin.at(idim) = ev.at(idim);
143 if (ev.at(idim) >
xmax.at(idim))
xmax.at(idim) = ev.at(idim);
148 for (
UInt_t idim = 0; idim < hsig.size(); ++idim) {
149 hsig.at(idim)->GetXaxis()->SetLimits(
xmin.at(idim),
xmax.at(idim));
150 hbkg.at(idim)->GetXaxis()->SetLimits(
xmin.at(idim),
xmax.at(idim));
151 hsig_unw.at(idim)->GetXaxis()->SetLimits(
xmin.at(idim),
xmax.at(idim));
152 hbkg_unw.at(idim)->GetXaxis()->SetLimits(
xmin.at(idim),
xmax.at(idim));
153 hsig.at(idim)->Reset();
154 hbkg.at(idim)->Reset();
155 hsig_unw.at(idim)->Reset();
156 hbkg_unw.at(idim)->Reset();
160 for (std::vector<const TMVA::BinarySearchTreeNode*>::const_iterator it = nodes.begin();
161 it != nodes.end(); ++it) {
162 std::vector<Float_t> ev = (*it)->GetEventV();
163 Float_t wt = (*it)->GetWeight();
164 for (
UInt_t idim = 0; idim < ev.size(); ++idim) {
165 if ((*it)->GetClass() ==
fClass) {
166 hsig.at(idim)->Fill(ev.at(idim), wt);
167 hsig_unw.at(idim)->Fill(ev.at(idim), 1);
169 hbkg.at(idim)->Fill(ev.at(idim), wt);
170 hbkg_unw.at(idim)->Fill(ev.at(idim), 1);
This is a concrete implementation of PDEFoam.
std::vector< Double_t > * fLower
MsgLogger & Endl(MsgLogger &ml)
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Volume for BinarySearchTree.
PDEFoamDecisionTreeDensity()
MsgLogger & Log() const
message logger
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...
virtual Double_t Density(std::vector< Double_t > &Xarg, Double_t &event_density)
This function is not used in the decision tree like PDEFoam, instead FillHist() is used...
This is an abstract class, which provides an interface for a PDEFoam density estimator.
Double_t SearchVolume(Volume *, std::vector< const TMVA::BinarySearchTreeNode *> *events=0)
search the whole tree and add up all weights of events that lie within the given volume ...