28#ifndef ROOT_TMVA_PDEFoam
29#define ROOT_TMVA_PDEFoam
49 class PDEFoamDensityBase;
50 class PDEFoamKernelBase;
153 std::vector<TMVA::PDEFoamCell*>
FindCells(
const std::vector<Float_t>&)
const;
154 std::vector<TMVA::PDEFoamCell*>
FindCells(
const std::map<Int_t,Float_t>&)
const;
155 void FindCells(
const std::map<Int_t, Float_t>&,
PDEFoamCell*, std::vector<PDEFoamCell*> &)
const;
161 template<
typename T> T
Sqr(T
x)
const {
return x*
x; }
229 std::vector<Float_t>
VarTransform(
const std::vector<Float_t> &invec)
const;
291 std::vector<Float_t> outvec;
292 for(
UInt_t i=0; i<invec.size(); i++)
293 outvec.push_back(VarTransform(i, invec.at(i)));
301 return x*(fXmax[idim]-fXmin[idim]) + fXmin[idim];
308 std::vector<Float_t> outvec;
309 for(
UInt_t i=0; i<invec.size(); i++)
310 outvec.push_back(VarTransformInvers(i, invec.at(i)));
#define ClassDef(name, id)
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t wmin
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t wmax
1-D histogram with a double per channel (see TH1 documentation)
2-D histogram with a double per channel (see TH1 documentation)
ostringstream derivative to redirect and format output
This is an abstract class, which provides an interface for a PDEFoam density estimator.
This class is the abstract kernel interface for PDEFoam.
This PDEFoam kernel estimates a cell value for a given event by weighting all cell values with a gaus...
This PDEFoam kernel estimates a cell value for a given event by weighting with cell values of the nea...
This class is a trivial PDEFoam kernel estimator.
Implementation of PDEFoam.
void AddVariableName(const char *s)
Double_t GetCellElement(const PDEFoamCell *cell, UInt_t i) const
Returns cell element i of cell 'cell'.
Bool_t fPeekMax
BACKWARDS COMPATIBILITY: peek up cell with max. driver integral for split.
void DeleteBinarySearchTree()
Delete the foam's density estimator, which contains the binary search tree.
TObjString * GetVariableName(Int_t idx)
void SetMaxDepth(UInt_t maxdepth)
void MakeAlpha()
Internal subprogram used by Create.
Timer * fTimer
! timer for graphical output
TObjArray * fVariableNames
collection of all variable names
Float_t fVolFrac
BACKWARDS COMPATIBILITY: volume fraction (with respect to total phase space.
UInt_t GetMaxDepth() const
virtual Float_t GetCellValue(const std::vector< Float_t > &xvec, ECellValue cv, PDEFoamKernelBase *)
This function finds the cell, which corresponds to the given untransformed event vector 'xvec' and re...
void OutputGrow(Bool_t finished=false)
Overridden function of PDEFoam to avoid native foam output.
UInt_t GetNInActiveCells() const
Double_t GetXmax(Int_t idim) const
void SetCellElement(PDEFoamCell *cell, UInt_t i, Double_t value)
Set cell element i of cell to value.
void SetDensity(PDEFoamDensityBase *dens)
Float_t VarTransformInvers(Int_t idim, Float_t x) const
Double_t * fRvec
[fDim] random number vector from r.n. generator fDim+1 maximum elements
Float_t VarTransform(Int_t idim, Float_t x) const
Int_t Divide(PDEFoamCell *)
Internal subprogram used by Create.
Bool_t fFillFoamWithOrigWeights
BACKWARDS COMPATIBILITY: fill the foam with boost or orig. weights.
EDTSeparation fDTSeparation
BACKWARDS COMPATIBILITY: split cells according to decision tree logic.
void PrintCell(Long_t iCell=0)
Prints geometry of and elements of 'iCell', as well as relations to parent and daughter cells.
void ResetCellElements()
Remove the cell elements from all cells.
void Grow()
Internal subprogram used by Create.
TH1D * Draw1Dim(ECellValue cell_value, Int_t nbin, PDEFoamKernelBase *kernel=nullptr)
Draws 1-dimensional foam (= histogram)
MsgLogger * fLogger
! message logger
Double_t Eval(Double_t *xRand, Double_t &event_density)
Internal subprogram.
Int_t fNBin
No. of bins in the edge histogram for cell MC exploration.
void PrintCells()
Prints geometry of ALL cells of the FOAM.
void SetXmax(Int_t idim, Double_t wmax)
set upper foam bound in dimension idim
PDEFoamDensityBase * GetDistr() const
Double_t * fXmin
[fDim] minimum for variable transform
virtual ~PDEFoam()
Default destructor.
PDEFoam()
Default constructor for streamer, user should not use it.
TRandom3 * fPseRan
Pointer to user-defined generator of pseudorandom numbers.
void SetEvPerBin(Int_t EvPerBin)
PDEFoamCell * GetRootCell() const
virtual TH2D * Project2(Int_t idim1, Int_t idim2, ECellValue cell_value=kValue, PDEFoamKernelBase *kernel=nullptr, UInt_t nbin=50)
Project foam variable idim1 and variable idim2 to histogram.
PDEFoamDensityBase * fDistr
! distribution of training events
virtual Bool_t CellValueIsUndefined(PDEFoamCell *)
Returns true, if the value of the given cell is undefined.
virtual void FillFoamCells(const Event *ev, Float_t wt)
This function fills a weight 'wt' into the PDEFoam cell, which corresponds to the given event 'ev'.
void Create()
Basic initialization of FOAM invoked by the user.
TObjArray * fHistEdg
Histograms of wt, one for each cell edge.
void SetInhiDiv(Int_t, Int_t)
This can be called before Create, after setting kDim It defines which variables are excluded in the p...
Int_t * fInhiDiv
! [fDim] Flags for inhibiting cell division
void InitCells()
Internal subprogram used by Create.
void AddVariableName(TObjString *s)
Double_t * fAlpha
[fDim] Internal parameters of the hyperrectangle
PDEFoamCell * FindCell(const std::vector< Float_t > &) const
Find cell that contains 'xvec' (in foam coordinates [0,1]).
UInt_t fNElements
BACKWARDS COMPATIBILITY: number of variables in every cell.
Int_t * fMaskDiv
! [fDim] Dynamic Mask for cell division
void FillBinarySearchTree(const Event *ev)
Insert event to internal foam's density estimator PDEFoamDensityBase.
UInt_t fMaxDepth
maximum depth of cell tree
Int_t fNCells
Maximum number of cells.
PDEFoamCell ** fCells
[fNCells] Array of ALL cells
virtual void Explore(PDEFoamCell *Cell)
Internal subprogram used by Create.
void SetXmin(Int_t idim, Double_t wmin)
set lower foam bound in dimension idim
std::vector< TMVA::PDEFoamCell * > FindCells(const std::vector< Float_t > &) const
Find all cells, that contain txvec.
UInt_t GetNActiveCells() const
Int_t fDim
Dimension of the integration/simulation space.
UInt_t fNmin
minimal number of events in cell to split cell
void Varedu(Double_t[5], Int_t &, Double_t &, Double_t &)
Internal subprogram used by Create.
Int_t fLastCe
Index of the last cell.
void SetnCells(Long_t nCells)
Int_t CellFill(Int_t, PDEFoamCell *)
Internal subprogram used by Create.
Long_t PeekMax()
Internal subprogram used by Create.
void RootPlot2dim(const TString &filename, TString opt, Bool_t createCanvas=kTRUE, Bool_t colors=kTRUE)
Debugging tool which plots the cells of a 2-dimensional PDEFoam as rectangles in C++ format readable ...
TString fName
Name of a given instance of the FOAM class.
void SetnSampl(Long_t nSampl)
Int_t fNoAct
Number of active cells.
Double_t * fXmax
[fDim] maximum for variable transform
TString GetFoamName() const
Double_t GetXmin(Int_t idim) const
void CheckAll(Int_t)
User utility, miscellaneous and debug.
Int_t fNSampl
No. of MC events, when dividing (exploring) cell.
void SetDim(Int_t kDim)
Sets dimension of cubical space.
Int_t fEvPerBin
Maximum number of effective (wt=1) events per bin.
EFoamType fFoamType
BACKWARDS COMPATIBILITY: type of foam.
Timing information for training and evaluation of MVA methods.
@ kMisClassificationError
TObject * At(Int_t idx) const override
void Add(TObject *obj) override
Collectable string class.
Mother of all ROOT objects.
Random number generator class based on M.
create variable transformations