ROOT logo
ROOT » TMVA » TMVA::PDEFoam

class TMVA::PDEFoam: public TObject


 Implementation of PDEFoam

 The PDEFoam method is an
 extension of the PDERS method, which uses self-adapting binning to
 divide the multi-dimensional phase space in a finite number of
 hyper-rectangles (boxes).

 For a given number of boxes, the binning algorithm adjusts the size
 and position of the boxes inside the multidimensional phase space,
 minimizing the variance of the signal and background densities inside
 the boxes. The binned density information is stored in binary trees,
 allowing for a very fast and memory-efficient classification of
 events.

 The implementation of the PDEFoam is based on the monte-carlo
 integration package PDEFoam included in the analysis package ROOT.

Function Members (Methods)

public:
virtual~PDEFoam()
voidTObject::AbstractMethod(const char* method) const
voidAddVariableName(const char* s)
voidAddVariableName(TObjString* s)
voidAddXMLTo(void* parent)
virtual voidTObject::AppendPad(Option_t* option = "")
virtual voidTObject::Browse(TBrowser* b)
voidCalcCellDiscr()
voidCalcCellTarget()
virtual voidCarver(Int_t&, Double_t&, Double_t&)
virtual Int_tCellFill(Int_t, TMVA::PDEFoamCell*)
virtual voidCheckAll(Int_t)
voidCheckCells(Bool_t remove_empty_cells = false)
static TClass*Class()
static TClass*TObject::Class()
virtual const char*TObject::ClassName() const
virtual voidTObject::Clear(Option_t* = "")
virtual TObject*TObject::Clone(const char* newname = "") const
virtual Int_tTObject::Compare(const TObject* obj) const
virtual voidTObject::Copy(TObject& object) const
voidCreate(Bool_t CreateCellElements = false)
Bool_tCutNmin()
voidCutNmin(Bool_t cut)
Bool_tCutRMSmin()
voidCutRMSmin(Bool_t cut)
virtual voidTObject::Delete(Option_t* option = "")MENU
voidDisplayCellContent()
virtual Int_tTObject::DistancetoPrimitive(Int_t px, Int_t py)
virtual Int_tDivide(TMVA::PDEFoamCell*)
virtual voidTObject::Draw(Option_t* option = "")
virtual TH1D*Draw1Dim(const char* opt, Int_t nbin)
virtual voidTObject::DrawClass() constMENU
virtual TObject*TObject::DrawClone(Option_t* option = "") constMENU
virtual voidTObject::Dump() constMENU
virtual voidTObject::Error(const char* method, const char* msgfmt) const
virtual Double_tEval(Double_t* xRand)
virtual Double_tEval(Double_t* xRand, Double_t& event_density)
virtual voidTObject::Execute(const char* method, const char* params, Int_t* error = 0)
virtual voidTObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0)
virtual voidTObject::ExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual voidExplore(TMVA::PDEFoamCell* Cell)
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
voidFillBinarySearchTree(const TMVA::Event* ev, TMVA::EFoamType ft, Bool_t NoNegWeights = kFALSE)
voidFillFoamCells(const TMVA::Event* ev, TMVA::EFoamType ft, Bool_t NoNegWeights = kFALSE)
virtual voidFinalize(Double_t&, Double_t&)
TMVA::PDEFoamCell*FindCell(vector<Float_t>)
virtual TObject*TObject::FindObject(const char* name) const
virtual TObject*TObject::FindObject(const TObject* obj) const
virtual voidGenerCel2(TMVA::PDEFoamCell*&)
Double_tGetCellDensity(TMVA::PDEFoamCell*)
Double_tGetCellDensity(vector<Float_t> xvec, TMVA::EKernel kernel = kNone)
Double_tGetCellDiscr(TMVA::PDEFoamCell* cell)
Double_tGetCellDiscr(vector<Float_t> xvec, TMVA::EKernel kernel = kNone)
Double_tGetCellDiscrError(vector<Float_t> xvec)
Double_tGetCellDiscrError(TMVA::PDEFoamCell* cell)
Double_tGetCellElement(TMVA::PDEFoamCell* cell, UInt_t i)
TVectorD*GetCellElements(vector<Float_t>)
Double_tGetCellEntries(vector<Float_t> xvec)
Double_tGetCellEntries(TMVA::PDEFoamCell* cell)
Double_tGetCellEvents(TMVA::PDEFoamCell* cell)
Double_tGetCellMean(vector<Float_t> xvec)
Double_tGetCellMean(TMVA::PDEFoamCell* cell)
Double_tGetCellRegValue0(TMVA::PDEFoamCell* cell)
Double_tGetCellRegValue0(vector<Float_t>, TMVA::EKernel kernel = kNone)
Double_tGetCellRMS(vector<Float_t> xvec)
Double_tGetCellRMS(TMVA::PDEFoamCell* cell)
Double_tGetCellRMSovMean(TMVA::PDEFoamCell* cell)
Double_tGetCellTarget(UInt_t target_number, vector<Float_t> tvals, TMVA::ETargetSelection ts)
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
virtual TStringGetFoamName() const
virtual const char*TObject::GetIconName() const
virtual voidGetIntegMC(Double_t&, Double_t&)
virtual voidGetIntNorm(Double_t&, Double_t&)
virtual voidGetMCvect(Double_t*)
virtual Double_tGetMCwt()
virtual voidGetMCwt(Double_t&)
UInt_tGetNActiveCells()
virtual const char*TObject::GetName() const
virtual Long_tGetnCalls() const
UInt_tGetNCells()
virtual Long_tGetnEffev() const
UInt_tGetNElements()
UInt_tGetNInActiveCells()
UInt_tGetNmin()
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
virtual Option_t*TObject::GetOption() const
Double_tGetPDEFoamVolumeFraction() const
virtual Double_tGetPrimary() const
virtual voidGetPrimary(Double_t& prime)
Double_tGetProjectedRegValue(UInt_t i, vector<Float_t> vals, TMVA::EKernel kernel = kNone, TMVA::ETargetSelection ts = kMean)
virtual TRandom3*GetPseRan() const
virtual TMVA::PDEFoamIntegrand*GetRho()
Double_tGetRMSmin()
TMVA::PDEFoamCell*GetRootCell()
Double_tGetSumCellElements(UInt_t)
Double_tGetSumCellIntg()
Int_tGetSumCellMemory(TMVA::ECellType ct = kAll)
virtual const char*TObject::GetTitle() const
virtual Int_tGetTotDim() const
virtual UInt_tTObject::GetUniqueID() const
TObjString*GetVariableName(Int_t idx)
virtual const char*GetVersion() const
virtual voidGetWtParams(Double_t, Double_t&, Double_t&, Double_t&)
Double_tGetXmax(Int_t idim)
Double_tGetXmin(Int_t idim)
virtual voidGrow()
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTObject::Hash() const
virtual voidTObject::Info(const char* method, const char* msgfmt) const
virtual Bool_tTObject::InheritsFrom(const char* classname) const
virtual Bool_tTObject::InheritsFrom(const TClass* cl) const
voidInit()
virtual voidInitCells(Bool_t CreateCellElements)
virtual voidInitialize(Bool_t CreateCellElements)
virtual voidInitialize(TRandom3*, TMVA::PDEFoamIntegrand*)
virtual voidTObject::Inspect() constMENU
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
virtual TClass*TObject::IsA() const
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tTObject::IsFolder() const
Bool_tTObject::IsOnHeap() const
virtual Bool_tTObject::IsSortable() const
Bool_tTObject::IsZombie() const
virtual voidLinkCells()
virtual voidTObject::ls(Option_t* option = "") const
virtual voidMakeActiveList()
virtual voidMakeAlpha()
virtual voidMakeEvent()
voidTObject::MayNotUse(const char* method) const
virtual Double_tMCgenerate(Double_t* MCvect)
virtual Bool_tTObject::Notify()
static voidTObject::operator delete(void* ptr)
static voidTObject::operator delete(void* ptr, void* vp)
static voidTObject::operator delete[](void* ptr)
static voidTObject::operator delete[](void* ptr, void* vp)
void*TObject::operator new(size_t sz)
void*TObject::operator new(size_t sz, void* vp)
void*TObject::operator new[](size_t sz)
void*TObject::operator new[](size_t sz, void* vp)
TMVA::PDEFoam&operator=(const TMVA::PDEFoam&)
TObject&TObject::operator=(const TObject& rhs)
virtual voidTObject::Paint(Option_t* option = "")
TMVA::PDEFoamPDEFoam()
TMVA::PDEFoamPDEFoam(const TString&)
TMVA::PDEFoamPDEFoam(const TMVA::PDEFoam&)
virtual Long_tPeekMax()
virtual voidTObject::Pop()
virtual voidTObject::Print(Option_t* option = "") const
voidPrintCellElements()
virtual voidPrintCells()
voidPrintDensity()
voidPrintStream(ostream&) const
virtual TH2D*Project2(Int_t idim1, Int_t idim2, const char* opt = "nev", const char* ker = "kNone", UInt_t maxbins = 0)
virtual TH2D*ProjectMC(Int_t idim1, Int_t idim2, Int_t nevents, Int_t nbin)
virtual Int_tTObject::Read(const char* name)
voidReadStream(istream&)
voidReadXML(void* parent)
virtual voidTObject::RecursiveRemove(TObject* obj)
voidRemoveEmptyCell(Int_t iCell)
voidTObject::ResetBit(UInt_t f)
voidResetCellElements(Bool_t allcells = false)
virtual voidResetPseRan(TRandom3* PseRan)
virtual voidResetRho(TMVA::PDEFoamIntegrand* Rho)
virtual voidRootPlot2dim(const TString& filename, string what, Bool_t CreateCanvas = kTRUE, Bool_t colors = kTRUE, Bool_t log_colors = kFALSE)
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") constMENU
virtual voidTObject::SavePrimitive(basic_ostream<char,char_traits<char> >& out, Option_t* option = "")
voidSetBackgroundClass(Int_t cls)
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
voidSetCellElement(TMVA::PDEFoamCell* cell, UInt_t i, Double_t value)
virtual voidSetChat(Int_t Chat)
virtual voidTObject::SetDrawOption(Option_t* option = "")MENU
static voidTObject::SetDtorOnly(void* obj)
virtual voidSetEvPerBin(Int_t EvPerBin)
voidSetFoamType(TMVA::EFoamType ft)
virtual voidSetInhiDiv(Int_t, Int_t)
virtual voidSetkDim(Int_t kDim)
virtual voidSetMaxWtRej(Double_t MaxWtRej)
virtual voidSetnBin(Int_t nBin)
virtual voidSetnCells(Long_t nCells)
voidSetNElements(UInt_t numb)
voidSetNmin(UInt_t val)
virtual voidSetnSampl(Long_t nSampl)
static voidTObject::SetObjectStat(Bool_t stat)
virtual voidSetOptDrive(Int_t OptDrive)
virtual voidSetOptRej(Int_t OptRej)
voidSetPDEFoamVolumeFraction(Double_t vfr)
virtual voidSetPseRan(TRandom3* PseRan)
virtual voidSetRho(TMVA::PDEFoamIntegrand* Rho)
virtual voidSetRhoInt(void* Rho)
voidSetRMSmin(Double_t val)
voidSetSignalClass(Int_t cls)
virtual voidTObject::SetUniqueID(UInt_t uid)
voidSetVolumeFraction(Double_t)
virtual voidSetXdivPRD(Int_t, Int_t, Double_t*)
voidSetXmax(Int_t idim, Double_t wmax)
voidSetXmin(Int_t idim, Double_t wmin)
virtual voidShowMembers(TMemberInspector& insp, char* parent)
virtual voidTObject::ShowMembers(TMemberInspector& insp, char* parent)
virtual voidStreamer(TBuffer& b)
virtual voidTObject::Streamer(TBuffer& b)
voidStreamerNVirtual(TBuffer& b)
voidTObject::StreamerNVirtual(TBuffer& b)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
virtual voidTObject::UseCurrentStyle()
virtual voidVaredu(Double_t*, Int_t&, Double_t&, Double_t&)
vector<Float_t>VarTransform(vector<Float_t> invec)
Float_tVarTransform(Int_t idim, Float_t x)
vector<Float_t>VarTransformInvers(vector<Float_t> invec)
Float_tVarTransformInvers(Int_t idim, Float_t x)
virtual voidTObject::Warning(const char* method, const char* msgfmt) const
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0)
virtual Int_tTObject::Write(const char* name = 0, Int_t option = 0, Int_t bufsize = 0) const
protected:
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const
TMVA::MsgLogger&Log() const
voidTObject::MakeZombie()
virtual voidOutputGrow(Bool_t finished = false)
Double_tWeightGaus(TMVA::PDEFoamCell*, vector<Float_t>, UInt_t dim = 0)
Double_tWeightLinNeighbors(vector<Float_t> txvec, TMVA::ECellValue cv)
private:
Double_tSqr(Double_t x) const

Data Members

protected:
Double_t*fAlpha[fDim] Internal parameters of the hyperrectangle
Int_tfBackgroundClassTODO: intermediate solution to keep IsSignal() of Event working. TODO: remove IsSignal() from Event
TMVA::PDEFoamCell**fCells[fNCells] Array of ALL cells
TRefArray*fCellsActArray of pointers to active cells, constructed at the end of foam build-up
Int_tfChatChat=0,1,2 chat level in output, Chat=1 normal level
Bool_tfCutNmintrue: activate cut on minimal number of events in cell
Bool_tfCutRMSmintrue: peek cell with max. RMS for next split
TStringfDateRelease date of FOAM
Int_tfDimDimension of the integration/simulation space
TMVA::TFDISTR*fDistr! density from extern
Int_tfEvPerBinMaximum number of effective (wt=1) events per bin
TObjArray*fHistDbgHistograms of wt, for debug
TObjArray*fHistEdgHistograms of wt, one for each cell edge
TH1D*fHistWtHistogram of the MC wt
Int_t*fInhiDiv! [fDim] Flags for inhibiting cell division
Int_tfLastCeIndex of the last cell
TMVA::MsgLogger*fLogger! message logger
TMVA::PDEFoamMaxwt*fMCMonitMonitor of the MC weight for measuring MC efficiency
Double_tfMCerrorand its error
Double_tfMCresultTrue Integral R from MC series
Double_t*fMCvect[fDim] Generated MC vector for the outside user
Double_tfMCwtMC weight
Int_t*fMaskDiv! [fDim] Dynamic Mask for cell division
Double_tfMaxWtRejMaximum weight in rejection for getting wt=1 events
TMethodCall*fMethodCall! ROOT's pointer to user-defined global distribution function
Int_tfNBinNo. of bins in the edge histogram for cell MC exploration
Long_tfNCallsTotal number of the function calls
Int_tfNCellsMaximum number of cells
Long_tfNEffevTotal number of effective events (wt=1) in the foam buildup
UInt_tfNElementsnumber of variables in every cell
Int_tfNSamplNo. of MC events, when dividing (exploring) cell
TStringfNameName of a given instance of the FOAM class
Double_tfNevGenTotal number of the generated MC events
UInt_tfNminminimal number of events in cell to split cell
Int_tfNoActNumber of active cells
Int_tfOptDriveOptimization switch =1,2 for variance or maximum weight optimization
Int_tfOptPRDOption switch for predefined division, for quick check
Int_tfOptRejSwitch =0 for weighted events; =1 for unweighted events in MC
Double_t*fPrimAcu[fNoAct] Array of cumulative probability of all active cells
Double_tfPrimePrimary integral R' (R=R'<wt>)
TRandom3*fPseRanPointer to user-defined generator of pseudorandom numbers
Double_tfRMSminactivate cut: minimal RMS in cell to split cell
Int_tfRNmaxMaximum No. of the rand. numb. requested at once
TMVA::PDEFoamIntegrand*fRho! Pointer to the user-defined integrand function/distribution
Double_t*fRvec[fRNmax] random number vector from r.n. generator fDim+1 maximum elements
Int_tfSignalClassTODO: intermediate solution to keep IsSignal() of Event working. TODO: remove IsSignal() from Event
Double_tfSumOveTotal Sum of overveighted events
Double_tfSumWt
Double_tfSumWt2Total sum of wt and wt^2
TMVA::Timer*fTimertimer for graphical output
TObjArray*fVariableNamescollection of all variable names
TStringfVersionActual version of the FOAM like (1.01m)
Float_tfVolFracvolume fraction (with respect to total phase space
Double_tfWtMax
Double_tfWtMinMaximum/Minimum MC weight
TMVA::PDEFoamVect**fXdivPRD! Lists of division values encoded in one vector per direction
Double_t*fXmax[fDim] maximum for variable transform
Double_t*fXmin[fDim] minimum for variable transform

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

PDEFoam()
 Default constructor for streamer, user should not use it.
PDEFoam(const TString& Name)
 User constructor, to be employed by the user
~PDEFoam()
PDEFoam(const PDEFoam &From)
 Copy Constructor  NOT IMPLEMENTED (NEVER USED)
void Initialize(Bool_t CreateCellElements)
 Basic initialization of FOAM invoked by the user.
 IMPORTANT: Random number generator and the distribution object has to be
 provided using SetPseRan and SetRho prior to invoking this initializator!
void Initialize(TRandom3* , TMVA::PDEFoamIntegrand* )
 Basic initialization of FOAM invoked by the user. Mandatory!

 This method starts the process of the cell build-up.
 User must invoke Initialize with two arguments or Initialize without arguments.
 This is done BEFORE generating first MC event and AFTER allocating FOAM object
 and reseting (optionally) its internal parameters/switches.

 This method invokes several other methods:

 InitCells initializes memory storage for cells and begins exploration process
 from the root cell. The empty cells are allocated/filled using  CellFill.
 The procedure Grow which loops over cells, picks up the cell with the biggest
 ``driver integral'', see Comp. Phys. Commun. 152 152 (2003) 55 for explanations,
 with the help of PeekMax procedure. The chosen cell is split using Divide.
 Subsequently, the procedure Explore called by the Divide
 (and by InitCells for the root cell) does the most important
 job in the FOAM object build-up: it performs a small MC run for each
 newly allocated daughter cell.
 Explore calculates how profitable the future split of the cell will be
 and defines the optimal cell division geometry with the help of Carver or Varedu
 procedures, for maximum weight or variance optimization respectively.
 All essential results of the exploration are written into
 the explored cell object. At the very end of the foam build-up,
 Finally, MakeActiveList is invoked to create a list of pointers to
 all active cells, for the purpose of the quick access during the MC generation.
 The procedure Explore employs MakeAlpha to generate random coordinates
 inside a given cell with the uniform distribution.
void InitCells(Bool_t CreateCellElements)
 Internal subprogram used by Initialize.
 It initializes "root part" of the FOAM of the tree of cells.
Int_t CellFill(Int_t , TMVA::PDEFoamCell* )
 Internal subprogram used by Initialize.
 It initializes content of the newly allocated active cell.
void Explore(TMVA::PDEFoamCell* Cell)
 Internal subprogram used by Initialize.
 It explores newly defined cell with help of special short MC sampling.
 As a result, estimates of kTRUE and drive volume is defined/determined
 Average and dispersion of the weight distribution will is found along
 each edge and the best edge (minimum dispersion, best maximum weight)
 is memorized for future use.
 The optimal division point for eventual future cell division is
 determined/recorded. Recorded are also minimum and maximum weight etc.
 The volume estimate in all (inactive) parent cells is updated.
 Note that links to parents and initial volume = 1/2 parent has to be
 already defined prior to calling this routine.

 This function is overridden from the original PDEFoam::Explore()
 to provide an extra option:   Filling edge histograms directly from the
 input distributions, w/o MC sampling if fNSampl == 0
 Warning:  This option is not tested jet!
void Varedu(Double_t* , Int_t& , Double_t& , Double_t& )
 Internal subrogram used by Initialize.
 In determines the best edge candidate and the position of the cell division plane
 in case of the variance reduction for future cell division,
 using results of the MC exploration run stored in fHistEdg
void Carver(Int_t& , Double_t& , Double_t& )
 Internal subrogram used by Initialize.
 Determines the best edge-candidate and the position of the division plane
 for the future cell division, in the case of the optimization of the maximum weight.
 It exploits results of the cell MC exploration run stored in fHistEdg.
void MakeAlpha()
 Internal subrogram used by Initialize.
 Provides random vector Alpha  0< Alpha(i) < 1
Long_t PeekMax()
 Internal subprogram used by Initialize.
 It finds cell with maximal driver integral for the purpose of the division.
 This function is overridden by the PDEFoam Class to apply cuts
 on Nmin and RMSmin during cell buildup.
Int_t Divide(TMVA::PDEFoamCell* )
 Internal subrogram used by Initialize.
 It divides cell iCell into two daughter cells.
 The iCell is retained and tagged as inactive, daughter cells are appended
 at the end of the buffer.
 New vertex is added to list of vertices.
 List of active cells is updated, iCell removed, two daughters added
 and their properties set with help of MC sampling (PDEFoam_Explore)
 Returns Code RC=-1 of buffer limit is reached,  fLastCe=fnBuf.
void MakeActiveList()
 Internal subrogram used by Initialize.
 It finds out number of active cells fNoAct,
 creates list of active cell fCellsAct and primary cumulative fPrimAcu.
 They are used during the MC generation to choose randomly an active cell.
void GenerCel2(TMVA::PDEFoamCell*& )
 Internal subprogram.
 Return randomly chosen active cell with probability equal to its
 contribution into total driver integral using interpolation search.
Double_t Eval(Double_t* xRand, Double_t& event_density)
 Internal subprogram.
 Evaluates distribution to be generated.
void Grow()
 Internal subrogram used by Initialize.
 It grow new cells by the binary division process.
 This function is overridden by the PDEFoam class to stop the foam buildup process
 if one of the cut conditions stop the cell split.
void MakeEvent(void)
 User subprogram.
 It generates randomly point/vector according to user-defined distribution.
 Prior initialization with help of Initialize() is mandatory.
 Generated MC point/vector is available using GetMCvect and the MC weight with GetMCwt.
 MC point is generated with wt=1 or with variable weight, see OptRej switch.
void GetMCvect(Double_t* )
 User may get generated MC point/vector with help of this method
Double_t GetMCwt(Double_t& )
 User may get weight MC weight using this method
void GetMCwt(Double_t& )
 User may get weight MC weight using this method
Double_t MCgenerate(Double_t* MCvect)
 User subprogram which generates MC event and returns MC weight
void GetIntegMC(Double_t& , Double_t& )
 User subprogram.
 It provides the value of the integral calculated from the averages of the MC run
 May be called after (or during) the MC run.
void GetIntNorm(Double_t& , Double_t& )
 User subprogram.
 It returns NORMALIZATION integral to be combined with the average weights
 and content of the histograms in order to get proper absolute normalization
 of the integrand and distributions.
 It can be called after initialization, before or during the MC run.
void GetWtParams(Double_t , Double_t& , Double_t& , Double_t& )
 May be called optionally after the MC run.
 Returns various parameters of the MC weight for efficiency evaluation
void Finalize(Double_t& , Double_t& )
 May be called optionally by the user after the MC run.
 It provides normalization and also prints some information/statistics on the MC run.
void ResetPseRan(TRandom3* PseRan)
 User may optionally reset random number generator using this method
 Usually it is done when FOAM object is restored from the disk.
 IMPORTANT: this method deletes existing  random number generator registered in the FOAM object.
 In particular such an object is created by the streamer during the disk-read operation.
void SetRho(TMVA::PDEFoamIntegrand* Rho)
 User may use this method to set (register) random number generator used by
 the given instance of the FOAM event generator. Note that single r.n. generator
 may serve several FOAM objects.
void ResetRho(TMVA::PDEFoamIntegrand* Rho)
 User may optionally reset the distribution using this method
 Usually it is done when FOAM object is restored from the disk.
 IMPORTANT: this method deletes existing  distribution object registered in the FOAM object.
 In particular such an object is created by the streamer diring the disk-read operation.
 This method is used only in very special cases, because the distribution in most cases
 should be "owned" by the FOAM object and should not be replaced by another one after initialization.
void SetRhoInt(void* Rho)
 User may use this to set pointer to the global function (not descending
 from PDEFoamIntegrand) serving as a distribution for FOAM.
 It is useful for simple interactive applications.
 Note that persistency for FOAM object will not work in the case of such
 a distribution.
void SetInhiDiv(Int_t , Int_t )
 This can be called before Initialize, after setting kDim
 It defines which variables are excluded in the process of the cell division.
 For example 'FoamX->SetInhiDiv(1, 1);' inhibits division of y-variable.
void SetXdivPRD(Int_t , Int_t , Double_t* )
 This should be called before Initialize, after setting  kDim
 It predefines values of the cell division for certain variable iDim.
void CheckAll(Int_t )
  User utility, miscellaneous and debug.
  Checks all pointers in the tree of cells. This is useful autodiagnostic.
  level=0, no printout, failures causes STOP
  level=1, printout, failures lead to WARNINGS only
void PrintCells(void)
 Prints geometry of ALL cells of the FOAM
void LinkCells()
 Void function for backward compatibility
Double_t GetSumCellElements(UInt_t )
 returns the sum of all cell elements with index i of all active cells
Double_t GetSumCellIntg()
 returns the sum of all cell integrals of all active cells
UInt_t GetNActiveCells()
 returns number of active cells
void RemoveEmptyCell(Int_t iCell)
 This function removes a cell iCell, which has a volume equal to zero.
 It works the following way:
 1) find grandparent to iCell
 2) set daughter of the grandparent cell to the sister of iCell
 Result:
 iCell and its parent are alone standing ==> will be removed
void CheckCells(Bool_t remove_empty_cells = false)
 debug function: checks all cells with respect to critical
 values, f.e. cell volume, ...
void PrintCellElements()
UInt_t GetNInActiveCells()
 returns number of not active cells
UInt_t GetNCells()
 returns the total number of foam cells (active and not active cells)
Int_t GetSumCellMemory(TMVA::ECellType ct = kAll)
 returns total used memory of cells in bytes
 The parameter 'ct' describes the cell type:
 - kAll - get memory usage of all cells
 - kActive - get memory usage of all active cells
 - kInActive - get memory usage of all non-active cells
TMVA::PDEFoamCell* GetRootCell()
 returns pointer to root cell
void ResetCellElements(Bool_t allcells = false)
 creates a TVectorD object with fNElements in every cell
 and initializes them by zero.
 The TVectorD object is used to store classification or
 regression data in every foam cell.

 Parameter:
   allcells == true  : create TVectorD on every cell
   allcells == false : create TVectorD on active cells with
                       cell index <= fLastCe (default)
void DisplayCellContent()
 prints out general cell informations
void CalcCellTarget()
 Calculate average cell target in every cell and save them to the cell.
 This function is called when the Mono target regression option is set.
void CalcCellDiscr()
 Calc discriminator and its error for every cell and save it to the cell.
 This function is called when the fSigBgSeparated==False option is set.
Double_t GetCellDiscr(vector<Float_t> xvec, TMVA::EKernel kernel = kNone)
 Get discriminator saved in cell (previously calculated in CalcCellDiscr())
 which encloses the coordinates given in xvec.
 This function is used, when the fSigBgSeparated==False option is set
 (unified foams).
Double_t GetCellDiscrError( std::vector<Float_t> xvec )
 Return discriminator error of cell (previously calculated in CalcCellDiscr()).
 This function is used, when the fSigBgSeparated==False option is set
 (unified foams).
void FillFoamCells(const TMVA::Event* ev, TMVA::EFoamType ft, Bool_t NoNegWeights = kFALSE)
 This function fills an event into the foam.

 In case of ft==kMonoTarget this function prepares the
 calculation of the average target value in every cell.  Note,
 that only target 0 is saved in the cell!

 In case of ft==kDiscr this function prepares the calculation of
 the cell discriminator in every cell.

 If 'NoNegWeights' is true, an event with negative weight will
 not be filled into the foam.  (Default value: false)
Double_t GetCellMean( std::vector<Float_t> xvec )
Double_t GetCellRMS( std::vector<Float_t> xvec )
Double_t GetCellRegValue0(vector<Float_t> , TMVA::EKernel kernel = kNone)
 Get regression value 0 from cell that contains xvec.
 This function is used when the MultiTargetRegression==False option is set.
Double_t GetCellTarget(UInt_t target_number, vector<Float_t> tvals, TMVA::ETargetSelection ts)
 This function is used when the MultiTargetRegression==True
 option is set.  It calculates the mean target or most probable
 target value with the id 'target_number' if 'tvals' variables
 are given ('tvals' does not contain targets)

 Parameters:
 - tvals - transformed event variables (element of [0,1]) (no targets!)
 - target_number - number of target (i.e. 0= first target)
 - ts - method of target selection (kMean, kMpv)

 Result:
 mean target or most probable target over all cells which first
 coordinates enclose 'tvals'
Double_t GetProjectedRegValue(UInt_t i, vector<Float_t> vals, TMVA::EKernel kernel = kNone, TMVA::ETargetSelection ts = kMean)
 This function is used when the MultiTargetRegression==True option is set.
 Returns regression value i, given the event variables 'vals'.
 Note: number of foam dimensions = number of variables + number of targets

 Parameters:
 - target_number - number of target (i.e. target_number=0 specifies the first target)
 - vals - event variables (no targets)
 - kernel - used kernel (None or Gaus)
 - ts - method of target selection (Mean or Mpv)
Double_t GetCellEntries( std::vector<Float_t> xvec )
Double_t GetCellDensity(TMVA::PDEFoamCell* )
 Returns cell density = number of events in cell / cell volume
Double_t GetCellDensity(vector<Float_t> xvec, TMVA::EKernel kernel = kNone)
 Returns density (=number of entries / volume) of cell that encloses 'xvec'.
 This function is called by GetMvaValue() in case of two separated foams
 (signal and background).
 'kernel' can be either kNone or kGaus.
Double_t GetCellRegValue0(TMVA::PDEFoamCell* cell)
 Returns the content of cell element 0, in which the average target value
 (target 0) is saved.
 Only used if MultiTargetRegression==False.
Double_t GetCellDiscr(TMVA::PDEFoamCell* cell)
 Returns the content of cell element 0, in which the cell discriminator is saved.
 Only used if fSigBgSeparated==False.
Double_t GetCellDiscrError( PDEFoamCell* cell )
 Returns the content of cell element 1, in which the cell discriminator error is saved.
 Only used if fSigBgSeparated==False.
Double_t GetCellMean( PDEFoamCell* cell )
 Returns the mean of the event distribution in the 'cell'.
 Only used if fSigBgSeparated==True.
Double_t GetCellRMS( PDEFoamCell* cell )
 Returns the RMS of the event distribution in the 'cell'.
 Only used if fSigBgSeparated==True.
Double_t GetCellRMSovMean(TMVA::PDEFoamCell* cell)
 returns RMS/Mean for given cell
Double_t GetCellEntries( PDEFoamCell* cell )
 Returns the number of events, saved in the 'cell'.
 Only used if fSigBgSeparated==True.
Double_t GetCellEvents(TMVA::PDEFoamCell* cell)
 Returns the number of events, saved in the 'cell' during foam build-up.
 Only used during foam build-up!
Double_t WeightLinNeighbors(vector<Float_t> txvec, TMVA::ECellValue cv)
 results the cell value, corresponding to txvec, weighted by the
 neighor cells via a linear function

 Parameters
  - txvec - event vector, transformed to interval [0,1]
  - cv - cell value to be weighted
Double_t WeightGaus(TMVA::PDEFoamCell* , vector<Float_t> , UInt_t dim = 0)
 Returns the gauss weight between the 'cell' and a given coordinate 'txvec'.

 Parameters:
 - cell - the cell
 - txvec - the transformed event variables (in [0,1]) (coordinates <0 are set to 0, >1 are set to 1)
 - dim - number of dimensions for the calculation of the euclidean distance.
   If dim=0, all dimensions of the foam are taken.  Else only the first 'dim'
   coordinates of 'txvec' are used for the calculation of the euclidean distance.

 Returns:
 exp(-(d/sigma)^2/2), where
  - d - is the euclidean distance between 'txvec' and the point of the 'cell'
    which is most close to 'txvec' (in order to avoid artefacts because of the
    form of the cells).
  - sigma = 1/VolFrac
TMVA::PDEFoamCell* FindCell(vector<Float_t> )
 Find cell that contains xvec

 loop to find cell that contains xvec
 start from root Cell, uses binary tree to
 find cell quickly

 DD 10.12.2007
 cleaned up a bit and improved performance
TH1D* Draw1Dim(const char* opt, Int_t nbin)
 Draws 1-dimensional foam (= histogram)

 Parameters:
 - opt - "mean", "nev", "rms", "rms_ov_mean", "discr" , "discr_error",
         "MonoTargetRegression", "MultiTargetRegression"
 - nbin - number of bins of result histogram

 Warning: This function is not well tested!
TH2D* Project2(Int_t idim1, Int_t idim2, const char* opt = "nev", const char* ker = "kNone", UInt_t maxbins = 0)
 Project foam variable idim1 and variable idim2 to histogram.

 Parameters:
 - idim1, idim2 - variables to project to
 - opt - rms, rms_ov_mean, nev, discr, MonoTargetRegression, MultiTargetRegression
 - ker - kGaus, kNone (warning: Gaus may be very slow!)
 - maxbins - maximal number of bins in result histogram.
   Set maxbins to 0 if no maximum bin number should be used.

 Returns:
 a 2-dimensional histogram
TH2D* ProjectMC(Int_t idim1, Int_t idim2, Int_t nevents, Int_t nbin)
 Project variable idim1 and variable idim2 to histogram by using
 foams build in MC generation.

 Parameters:
 - nevents - number of events to generate
 - nbin - number of bins of returned histogram
 - idim1, idim2 - foam variables (dimensions) to project to
TVectorD* GetCellElements(vector<Float_t> )
 Returns pointer to cell elements.
Double_t GetCellElement(TMVA::PDEFoamCell* cell, UInt_t i)
 Returns cell element i of cell 'cell'.
void SetCellElement(TMVA::PDEFoamCell* cell, UInt_t i, Double_t value)
 Set cell element i of cell to value.
void OutputGrow(Bool_t finished = false)
 Overridden function of PDEFoam to avoid native foam output.
 Draw TMVA-process bar instead.
void RootPlot2dim(const TString& filename, string what, Bool_t CreateCanvas = kTRUE, Bool_t colors = kTRUE, Bool_t log_colors = kFALSE)
 Debugging tool which plots 2-dimensional cells as rectangles
 in C++ format readable for root.

 Parameters:
 - filename - filename of ouput root macro
 - CreateCanvas - whether to create a new canvas or not
void SetVolumeFraction(Double_t )
 set VolFrac to internal foam density TFDISTR
void FillBinarySearchTree(const TMVA::Event* ev, TMVA::EFoamType ft, Bool_t NoNegWeights = kFALSE)
 Insert event to internal foam density TFDISTR.
void Create(Bool_t CreateCellElements = false)
 Function that builds up the foam.
void Init()
 Initialize internal foam density TFDISTR
void SetFoamType(TMVA::EFoamType ft)
 Set the foam type.  This determinates the method of the
 calculation of the density during the foam build-up.
void PrintDensity()
 Information output
void ReadStream(istream& )
 Read PDEFoam variables from stream 'istr'.
void PrintStream(ostream& ) const
 Write PDEFoam variables to stream 'os'.
void AddXMLTo(void* parent)
 write foam variables to xml
void ReadXML(void* parent)
void SetXmin(Int_t idim, Double_t wmin)
 set foam boundaries
{fXmin[idim]=wmin; return;}
void SetXmax(Int_t idim, Double_t wmax)
{fXmax[idim]=wmax; return;}
Float_t VarTransform(Int_t idim, Float_t x)
 transformation functions for event variable into foam boundaries
 reason: foam allways has boundaries [0, 1]
Float_t VarTransformInvers(Int_t idim, Float_t x)
void SetSignalClass(Int_t cls)
{ fSignalClass = cls; }
void SetBackgroundClass(Int_t cls)
{ fBackgroundClass = cls; }
Double_t Sqr(Double_t x) const
METHODS

{ return x*x;}
Double_t Eval(Double_t* xRand, Double_t& event_density)
 Generation
PDEFoamIntegrand * GetRho()
{return fRho;}
TRandom3* GetPseRan() const
{return fPseRan;}
void SetPseRan(TRandom3* PseRan)
{fPseRan=PseRan;}
void SetkDim(Int_t kDim)
 Getters and Setters
void SetnCells(Long_t nCells)
{fNCells =nCells;}
void SetnSampl(Long_t nSampl)
{fNSampl =nSampl;}
void SetnBin(Int_t nBin)
{fNBin = nBin;}
void SetChat(Int_t Chat)
{fChat = Chat;}
void SetOptRej(Int_t OptRej)
{fOptRej =OptRej;}
void SetOptDrive(Int_t OptDrive)
{fOptDrive =OptDrive;}
void SetEvPerBin(Int_t EvPerBin)
{fEvPerBin =EvPerBin;}
void SetMaxWtRej(Double_t MaxWtRej)
{fMaxWtRej=MaxWtRej;}
const char * GetVersion() const
 Getters and Setters
{return fVersion.Data();}
Int_t GetTotDim() const
{ return fDim;}
Double_t GetPrimary() const
{return fPrime;}
void GetPrimary(Double_t& prime)
{prime = fPrime;}
Long_t GetnCalls() const
{return fNCalls;}
Long_t GetnEffev() const
{return fNEffev;}
TString GetFoamName() const
 Debug
{return fName;}
void CutNmin(Bool_t cut)
 getter and setter to activate cut options
{ fCutNmin = cut; }
Bool_t CutNmin()
{ return fCutNmin; }
void CutRMSmin(Bool_t cut)
{ fCutRMSmin = cut; }
Bool_t CutRMSmin()
{ return fCutRMSmin; }
void SetNmin(UInt_t val)
 getter and setter for cut values
{ fNmin=val; }
UInt_t GetNmin()
{ return fNmin; }
void SetRMSmin(Double_t val)
{ fRMSmin=val; }
Double_t GetRMSmin()
{ return fRMSmin; }
Double_t GetXmin(Int_t idim)
{return fXmin[idim];}
Double_t GetXmax(Int_t idim)
{return fXmax[idim];}
void AddVariableName(const char *s)
 getter/ setter for variable name
AddVariableName(os)
TObjString* GetVariableName(Int_t idx)
Float_t VarTransform(Int_t idim, Float_t x)
 transformation functions for event variable into foam boundaries
 reason: foam allways has boundaries [0, 1]
Float_t VarTransformInvers(Int_t idim, Float_t x)
void SetNElements(UInt_t numb)
{ fNElements = numb; }
UInt_t GetNElements()
{ return fNElements; }
void SetPDEFoamVolumeFraction(Double_t vfr)
 helper functions to include TFDISTR into the PDEFoam class
 set VolFrac to PDEFoam
{ fVolFrac = vfr; }
Double_t GetPDEFoamVolumeFraction() const
{ return fVolFrac; }
PDEFoamCell& operator=(const TMVA::PDEFoam& )
Geometry