// @(#)root/tmva $Id$
// Author: S.Jadach, Tancredi Carli, Dominik Dannheim, Alexander Voigt

/**********************************************************************************
 * Project: TMVA - a Root-integrated toolkit for multivariate data analysis       *
 * Package: TMVA                                                                  *
 * Classes: PDEFoam                                                               *
 * Web    : http://tmva.sourceforge.net                                           *
 *                                                                                *
 * Description:                                                                   *
 *      Implementations                                                           *
 *                                                                                *
 * Authors (alphabetical):                                                        *
 *      Tancredi Carli   - CERN, Switzerland                                      *
 *      Dominik Dannheim - CERN, Switzerland                                      *
 *      S. Jadach        - Institute of Nuclear Physics, Cracow, Poland           *
 *      Alexander Voigt  - TU Dresden, Germany                                    *
 *      Peter Speckmayer - CERN, Switzerland                                      *
 *                                                                                *
 * Copyright (c) 2008, 2010:                                                      *
 *      CERN, Switzerland                                                         *
 *      MPI-K Heidelberg, Germany                                                 *
 *                                                                                *
 * Redistribution and use in source and binary forms, with or without             *
 * modification, are permitted according to the terms listed in LICENSE           *
 * (http://tmva.sourceforge.net/LICENSE)                                          *
 **********************************************************************************/

//_____________________________________________________________________
//
// 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 TFoam included in the analysis package ROOT.
//
// The class TMVA::PDEFoam defines the default interface for the
// PDEFoam variants:
//
//   - PDEFoamEvent
//   - PDEFoamDiscriminant
//   - PDEFoamTarget
//   - PDEFoamMultiTarget
//   - PDEFoamDecisionTree
//
// Per default PDEFoam stores in the cells the number of events (event
// weights) and therefore acts as an event density estimator.
// However, the above listed derived classes override this behaviour
// to implement certain PDEFoam variations.
//
// In order to use PDEFoam the user has to set the density estimator
// of the type TMVA::PDEFoamDensityBase, which is used to during the foam
// build-up.  The default PDEFoam should be used with
// PDEFoamEventDensity.
// _____________________________________________________________________


#include <iostream>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <cassert>
#include <limits>

#include "TMVA/Event.h"
#include "TMVA/Tools.h"
#include "TMVA/PDEFoam.h"
#include "TMVA/MsgLogger.h"
#include "TMVA/Types.h"

#ifndef ROOT_TStyle
#include "TStyle.h"
#endif
#ifndef ROOT_TObject
#include "TObject.h"
#endif
#ifndef ROOT_TH1D
#include "TH1D.h"
#endif
#ifndef ROOT_TMath
#include "TMath.h"
#endif
#ifndef ROOT_TVectorT
#include "TVectorT.h"
#endif
#ifndef ROOT_TRandom3
#include "TRandom3.h"
#endif
#ifndef ROOT_TColor
#include "TColor.h"
#endif

ClassImp(TMVA::PDEFoam)

static const Float_t kHigh= FLT_MAX;
static const Float_t kVlow=-FLT_MAX;

using namespace std;

//_____________________________________________________________________
TMVA::PDEFoam::PDEFoam() :
   fName("PDEFoam"),
   fDim(0),
   fNCells(0),
   fNBin(5),
   fNSampl(2000),
   fEvPerBin(0),
   fMaskDiv(0),
   fInhiDiv(0),
   fNoAct(1),
   fLastCe(-1),
   fCells(0),
   fHistEdg(0),
   fRvec(0),
   fPseRan(new TRandom3(4356)),
   fAlpha(0),
   fFoamType(kSeparate),
   fXmin(0),
   fXmax(0),
   fNElements(0),
   fNmin(100),
   fMaxDepth(0),
   fVolFrac(1.0/15.0),
   fFillFoamWithOrigWeights(kFALSE),
   fDTSeparation(kFoam),
   fPeekMax(kTRUE),
   fDistr(NULL),
   fTimer(new Timer(0, "PDEFoam", kTRUE)),
   fVariableNames(new TObjArray()),
   fLogger(new MsgLogger("PDEFoam"))
{
   // Default constructor for streamer, user should not use it.

   // fVariableNames may delete it's heap-based content
   if (fVariableNames)
      fVariableNames->SetOwner(kTRUE);
}

//_____________________________________________________________________
TMVA::PDEFoam::PDEFoam(const TString& name) :
   fName(name),
   fDim(0),
   fNCells(1000),
   fNBin(5),
   fNSampl(2000),
   fEvPerBin(0),
   fMaskDiv(0),
   fInhiDiv(0),
   fNoAct(1),
   fLastCe(-1),
   fCells(0),
   fHistEdg(0),
   fRvec(0),
   fPseRan(new TRandom3(4356)),
   fAlpha(0),
   fFoamType(kSeparate),
   fXmin(0),
   fXmax(0),
   fNElements(0),
   fNmin(100),
   fMaxDepth(0),
   fVolFrac(1.0/15.0),
   fFillFoamWithOrigWeights(kFALSE),
   fDTSeparation(kFoam),
   fPeekMax(kTRUE),
   fDistr(NULL),
   fTimer(new Timer(1, "PDEFoam", kTRUE)),
   fVariableNames(new TObjArray()),
   fLogger(new MsgLogger("PDEFoam"))
{
   // User constructor, to be employed by the user
   if(strlen(name) > 128)
      Log() << kFATAL << "Name too long " << name.Data() << Endl;

   // fVariableNames may delete it's heap-based content
   if (fVariableNames)
      fVariableNames->SetOwner(kTRUE);
}

//_____________________________________________________________________
TMVA::PDEFoam::~PDEFoam()
{
   // Default destructor

   delete fVariableNames;
   delete fTimer;
   if (fDistr)  delete fDistr;
   if (fPseRan) delete fPseRan;
   if (fXmin) delete [] fXmin;  fXmin=0;
   if (fXmax) delete [] fXmax;  fXmax=0;

   ResetCellElements();
   if(fCells!= 0) {
      for(Int_t i=0; i<fNCells; i++) delete fCells[i]; // PDEFoamCell*[]
      delete [] fCells;
   }
   delete [] fRvec;    //double[]
   delete [] fAlpha;   //double[]
   delete [] fMaskDiv; //int[]
   delete [] fInhiDiv; //int[]

   delete fLogger;
}

//_____________________________________________________________________
TMVA::PDEFoam::PDEFoam(const PDEFoam &from) :
   TObject(from)
   , fDim(0)
   , fNCells(0)
   , fNBin(0)
   , fNSampl(0)
   , fEvPerBin(0)
   , fMaskDiv(0)
   , fInhiDiv(0)
   , fNoAct(0)
   , fLastCe(0)
   , fCells(0)
   , fHistEdg(0)
   , fRvec(0)
   , fPseRan(0)
   , fAlpha(0)
   , fFoamType(kSeparate)
   , fXmin(0)
   , fXmax(0)
   , fNElements(0)
   , fNmin(0)
   , fMaxDepth(0)
   , fVolFrac(1.0/15.0)
   , fFillFoamWithOrigWeights(kFALSE)
   , fDTSeparation(kFoam)
   , fPeekMax(kTRUE)
   , fDistr(0)
   , fTimer(0)
   , fVariableNames(0)
   , fLogger(new MsgLogger(*from.fLogger))
{
   // Copy Constructor  NOT IMPLEMENTED (NEVER USED)
   Log() << kFATAL << "COPY CONSTRUCTOR NOT IMPLEMENTED" << Endl;

   // fVariableNames may delete it's heap-based content
   if (fVariableNames)
      fVariableNames->SetOwner(kTRUE);
}

//_____________________________________________________________________
void TMVA::PDEFoam::SetDim(Int_t kDim)
{
   // Sets dimension of cubical space
   if (kDim < 1)
      Log() << kFATAL << "<SetDim>: Dimension is zero or negative!" << Endl;

   fDim = kDim;
   if (fXmin) delete [] fXmin;
   if (fXmax) delete [] fXmax;
   fXmin = new Double_t[GetTotDim()];
   fXmax = new Double_t[GetTotDim()];
}

//_____________________________________________________________________
void TMVA::PDEFoam::SetXmin(Int_t idim, Double_t wmin)
{
   // set lower foam bound in dimension idim
   if (idim<0 || idim>=GetTotDim())
      Log() << kFATAL << "<SetXmin>: Dimension out of bounds!" << Endl;

   fXmin[idim]=wmin;
}

//_____________________________________________________________________
void TMVA::PDEFoam::SetXmax(Int_t idim, Double_t wmax)
{
   // set upper foam bound in dimension idim
   if (idim<0 || idim>=GetTotDim())
      Log() << kFATAL << "<SetXmax>: Dimension out of bounds!" << Endl;

   fXmax[idim]=wmax;
}

//_____________________________________________________________________
void TMVA::PDEFoam::Create()
{
   // 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!
   //
   // After the foam is grown, space for 2 variables is reserved in
   // every cell.  They are used for filling the foam cells.

   Bool_t addStatus = TH1::AddDirectoryStatus();
   TH1::AddDirectory(kFALSE);

   if(fPseRan==0) Log() << kFATAL << "Random number generator not set" << Endl;
   if(fDistr==0)  Log() << kFATAL << "Distribution function not set" << Endl;
   if(fDim==0)    Log() << kFATAL << "Zero dimension not allowed" << Endl;

   /////////////////////////////////////////////////////////////////////////
   //                   ALLOCATE SMALL LISTS                              //
   //  it is done globally, not for each cell, to save on allocation time //
   /////////////////////////////////////////////////////////////////////////
   fRvec = new Double_t[fDim];   // Vector of random numbers
   if(fRvec==0)  Log() << kFATAL << "Cannot initialize buffer fRvec" << Endl;

   if(fDim>0){
      fAlpha = new Double_t[fDim];    // sum<1 for internal parametrization of the simplex
      if(fAlpha==0)  Log() << kFATAL << "Cannot initialize buffer fAlpha" << Endl;
   }

   //====== List of directions inhibited for division
   if(fInhiDiv == 0){
      fInhiDiv = new Int_t[fDim];
      for(Int_t i=0; i<fDim; i++) fInhiDiv[i]=0;
   }
   //====== Dynamic mask used in Explore for edge determination
   if(fMaskDiv == 0){
      fMaskDiv = new Int_t[fDim];
      for(Int_t i=0; i<fDim; i++) fMaskDiv[i]=1;
   }
   //====== Initialize list of histograms
   fHistEdg = new TObjArray(fDim);           // Initialize list of histograms
   for(Int_t i=0; i<fDim; i++){
      TString hname, htitle;
      hname   = fName+TString("_HistEdge_");
      hname  += i;
      htitle  = TString("Edge Histogram No. ");
      htitle += i;
      (*fHistEdg)[i] = new TH1D(hname.Data(),htitle.Data(),fNBin,0.0, 1.0); // Initialize histogram for each edge
      ((TH1D*)(*fHistEdg)[i])->Sumw2();
   }

   // ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| //
   //                     BUILD-UP of the FOAM                            //
   // ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| //

   // prepare PDEFoam for growing
   ResetCellElements(); // reset all cell elements

   // Define and explore root cell(s)
   InitCells();
   Grow();

   TH1::AddDirectory(addStatus);

   // prepare PDEFoam for the filling with events
   ResetCellElements(); // reset all cell elements
} // Create

//_____________________________________________________________________
void TMVA::PDEFoam::InitCells()
{
   // Internal subprogram used by Create.
   // It initializes "root part" of the FOAM of the tree of cells.

   fLastCe =-1;                             // Index of the last cell
   if(fCells!= 0) {
      for(Int_t i=0; i<fNCells; i++) delete fCells[i];
      delete [] fCells;
   }

   fCells = new(nothrow) PDEFoamCell*[fNCells];
   if (!fCells) {
      Log() << kFATAL << "not enough memory to create " << fNCells
            << " cells" << Endl;
   }
   for(Int_t i=0; i<fNCells; i++){
      fCells[i]= new PDEFoamCell(fDim); // Allocate BIG list of cells
      fCells[i]->SetSerial(i);
   }

   /////////////////////////////////////////////////////////////////////////////
   //              Single Root Hypercube                                      //
   /////////////////////////////////////////////////////////////////////////////
   CellFill(1,   0);  //  0-th cell ACTIVE

   // Exploration of the root cell(s)
   for(Long_t iCell=0; iCell<=fLastCe; iCell++){
      Explore( fCells[iCell] );    // Exploration of root cell(s)
   }
}//InitCells

//_____________________________________________________________________
Int_t TMVA::PDEFoam::CellFill(Int_t status, PDEFoamCell *parent)
{
   // Internal subprogram used by Create.
   // It initializes content of the newly allocated active cell.

   PDEFoamCell *cell;
   if (fLastCe==fNCells){
      Log() << kFATAL << "Too many cells" << Endl;
   }
   fLastCe++;   // 0-th cell is the first

   cell = fCells[fLastCe];

   cell->Fill(status, parent, 0, 0);

   cell->SetBest( -1);         // pointer for planning division of the cell
   cell->SetXdiv(0.5);         // factor for division
   Double_t xInt2,xDri2;
   if(parent!=0){
      xInt2  = 0.5*parent->GetIntg();
      xDri2  = 0.5*parent->GetDriv();
      cell->SetIntg(xInt2);
      cell->SetDriv(xDri2);
   }else{
      cell->SetIntg(0.0);
      cell->SetDriv(0.0);
   }
   return fLastCe;
}

//_____________________________________________________________________
void TMVA::PDEFoam::Explore(PDEFoamCell *cell)
{
   // Internal subprogram used by Create.
   // 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.
   //
   // If fNmin > 0 then the total number of (training) events found in
   // the cell during the exploration is stored in the cell.  This
   // information is used withing PeekMax() to avoid splitting cells
   // which contain less than fNmin events.

   Double_t wt, dx, xBest=0, yBest;
   Double_t intOld, driOld;

   Long_t iev;
   Double_t nevMC;
   Int_t i, j, k;
   Int_t nProj, kBest;
   Double_t ceSum[5], xproj;

   Double_t event_density = 0;
   Double_t totevents     = 0;
   Double_t toteventsOld  = 0;

   PDEFoamVect  cellSize(fDim);
   PDEFoamVect  cellPosi(fDim);

   cell->GetHcub(cellPosi,cellSize);

   PDEFoamCell  *parent;

   Double_t *xRand = new Double_t[fDim];

   Double_t *volPart=0;

   // calculate volume scale
   Double_t vol_scale = 1.0;
   for (Int_t idim = 0; idim < fDim; ++idim)
      vol_scale *= fXmax[idim] - fXmin[idim];

   cell->CalcVolume();
   dx = cell->GetVolume() * vol_scale;
   intOld = cell->GetIntg(); //memorize old values,
   driOld = cell->GetDriv(); //will be needed for correcting parent cells
   toteventsOld = GetCellElement(cell, 0);

   /////////////////////////////////////////////////////
   //    Special Short MC sampling to probe cell      //
   /////////////////////////////////////////////////////
   ceSum[0]=0;
   ceSum[1]=0;
   ceSum[2]=0;
   ceSum[3]=kHigh;  //wtmin
   ceSum[4]=kVlow;  //wtmax

   for (i=0;i<fDim;i++) ((TH1D *)(*fHistEdg)[i])->Reset(); // Reset histograms

   Double_t nevEff=0.;
   // ||||||||||||||||||||||||||BEGIN MC LOOP|||||||||||||||||||||||||||||
   for (iev=0;iev<fNSampl;iev++){
      MakeAlpha();               // generate uniformly vector inside hypercube

      if (fDim>0) for (j=0; j<fDim; j++) xRand[j]= cellPosi[j] +fAlpha[j]*(cellSize[j]);

      wt         = dx*Eval(xRand, event_density);
      totevents += event_density;

      nProj = 0;
      if (fDim>0) {
         for (k=0; k<fDim; k++) {
            xproj =fAlpha[k];
            ((TH1D *)(*fHistEdg)[nProj])->Fill(xproj,wt);
            nProj++;
         }
      }

      ceSum[0] += wt;    // sum of weights
      ceSum[1] += wt*wt; // sum of weights squared
      ceSum[2]++;        // sum of 1
      if (ceSum[3]>wt) ceSum[3]=wt;  // minimum weight;
      if (ceSum[4]<wt) ceSum[4]=wt;  // maximum weight
      // test MC loop exit condition
      if (ceSum[1]>0) nevEff = ceSum[0]*ceSum[0]/ceSum[1];
      else            nevEff = 0;
      if ( nevEff >= fNBin*fEvPerBin) break;
   }   // ||||||||||||||||||||||||||END MC LOOP|||||||||||||||||||||||||||||
   totevents *= dx;
   
   if (fNSampl>0) totevents /= fNSampl;

   // make shure that, if root cell is explored, more than zero
   // events were found.
   if (cell==fCells[0] && ceSum[0]<=0.0){
      if (ceSum[0]==0.0)
         Log() << kFATAL << "No events were found during exploration of "
               << "root cell.  Please check PDEFoam parameters nSampl "
               << "and VolFrac." << Endl;
      else
         Log() << kWARNING << "Negative number of events found during "
               << "exploration of root cell" << Endl;
   }

   //------------------------------------------------------------------
   //---  predefine logics of searching for the best division edge ---
   for (k=0; k<fDim;k++){
      fMaskDiv[k] =1;                       // default is all
      if ( fInhiDiv[k]==1) fMaskDiv[k] =0; // inhibit some...
   }
   kBest=-1;

   //------------------------------------------------------------------
   nevMC            = ceSum[2];
   Double_t intTrue = ceSum[0]/(nevMC+0.000001);
   Double_t intDriv=0.;

   if (kBest == -1) Varedu(ceSum,kBest,xBest,yBest); // determine the best edge,
   intDriv =sqrt(ceSum[1]/nevMC) -intTrue; // Foam build-up, sqrt(<w**2>) -<w>

   //=================================================================================
   cell->SetBest(kBest);
   cell->SetXdiv(xBest);
   cell->SetIntg(intTrue);
   cell->SetDriv(intDriv);
   SetCellElement(cell, 0, totevents);

   // correct/update integrals in all parent cells to the top of the tree
   Double_t  parIntg, parDriv;
   for (parent = cell->GetPare(); parent!=0; parent = parent->GetPare()){
      parIntg = parent->GetIntg();
      parDriv = parent->GetDriv();
      parent->SetIntg( parIntg   +intTrue -intOld );
      parent->SetDriv( parDriv   +intDriv -driOld );
      SetCellElement( parent, 0, GetCellElement(parent, 0) + totevents - toteventsOld);
   }
   delete [] volPart;
   delete [] xRand;
}

//_____________________________________________________________________
void TMVA::PDEFoam::Varedu(Double_t ceSum[5], Int_t &kBest, Double_t &xBest, Double_t &yBest)
{
   // Internal subrogram used by Create.
   // 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

   Double_t nent   = ceSum[2];
   // Double_t swAll  = ceSum[0];
   Double_t sswAll = ceSum[1];
   Double_t ssw    = sqrt(sswAll)/sqrt(nent);
   //
   Double_t sswIn,sswOut,xLo,xUp;
   kBest =-1;
   xBest =0.5;
   yBest =1.0;
   Double_t maxGain=0.0;
   // Now go over all projections kProj
   for(Int_t kProj=0; kProj<fDim; kProj++) {
      if( fMaskDiv[kProj]) {
         // initialize search over bins
         // Double_t sigmIn =0.0; Double_t sigmOut =0.0;
         Double_t sswtBest = kHigh;
         Double_t gain =0.0;
         Double_t xMin=0.0; Double_t xMax=0.0;
         // Double loop over all pairs jLo<jUp
         for(Int_t jLo=1; jLo<=fNBin; jLo++) {
            Double_t aswIn=0;  Double_t asswIn=0;
            for(Int_t jUp=jLo; jUp<=fNBin;jUp++) {
               aswIn  +=     ((TH1D *)(*fHistEdg)[kProj])->GetBinContent(jUp);
               asswIn += Sqr(((TH1D *)(*fHistEdg)[kProj])->GetBinError(  jUp));
               xLo=(jLo-1.0)/fNBin;
               xUp=(jUp*1.0)/fNBin;
               // swIn  =        aswIn/nent;
               // swOut = (swAll-aswIn)/nent;
               if ( (xUp-xLo) < std::numeric_limits<double>::epsilon()) sswIn=0.;
               else sswIn = sqrt(asswIn)       /sqrt(nent*(xUp-xLo))     *(xUp-xLo);
               if ( (1.0-xUp+xLo) < std::numeric_limits<double>::epsilon()) sswOut=0.;
               else if ( sswAll-asswIn < std::numeric_limits<double>::epsilon()) sswOut=0.;
               else sswOut= sqrt(sswAll-asswIn)/sqrt(nent*(1.0-xUp+xLo)) *(1.0-xUp+xLo);
               if( (sswIn+sswOut) < sswtBest) {
                  sswtBest = sswIn+sswOut;
                  gain     = ssw-sswtBest;
                  // sigmIn   = sswIn -swIn;  // Debug
                  // sigmOut  = sswOut-swOut; // Debug
                  xMin    = xLo;
                  xMax    = xUp;
               }
            }//jUp
         }//jLo
         Int_t iLo = (Int_t) (fNBin*xMin);
         Int_t iUp = (Int_t) (fNBin*xMax);

         if(gain>=maxGain) {
            maxGain=gain;
            kBest=kProj; // <--- !!!!! The best edge
            xBest=xMin;
            yBest=xMax;
            if(iLo == 0)     xBest=yBest; // The best division point
            if(iUp == fNBin) yBest=xBest; // this is not really used
         }
      }
   } //kProj

   if( (kBest >= fDim) || (kBest<0) )
      Log() << kFATAL << "Something wrong with kBest" << Endl;
}          //PDEFoam::Varedu

//_____________________________________________________________________
void TMVA::PDEFoam::MakeAlpha()
{
   // Internal subrogram used by Create.
   // Provides random vector Alpha  0< Alpha(i) < 1

   // simply generate and load kDim uniform random numbers
   fPseRan->RndmArray(fDim,fRvec);   // kDim random numbers needed
   for(Int_t k=0; k<fDim; k++) fAlpha[k] = fRvec[k];
} //MakeAlpha

//_____________________________________________________________________
Long_t TMVA::PDEFoam::PeekMax()
{
   // Internal subprogram used by Create.  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 the number
   // of events in the cell (fNmin) and the cell tree depth
   // (GetMaxDepth() > 0) during cell buildup.

   Long_t iCell = -1;

   Long_t  i;
   Double_t  drivMax, driv, xDiv;
   Bool_t bCutNmin = kTRUE;
   Bool_t bCutMaxDepth = kTRUE;
   //   drivMax = kVlow;
   drivMax = 0;  // only split cells if gain>0 (this also avoids splitting at cell boundary)
   for(i=0; i<=fLastCe; i++) {//without root
      if( fCells[i]->GetStat() == 1 ) {
         // if driver integral < numeric limit, skip cell
         driv = fCells[i]->GetDriv();
         if (driv < std::numeric_limits<float>::epsilon())
            continue;

         // do not split cell at the edges
         xDiv = TMath::Abs(fCells[i]->GetXdiv());
         if (xDiv <= std::numeric_limits<Double_t>::epsilon() ||
             xDiv >= 1.0 - std::numeric_limits<Double_t>::epsilon())
            continue;

         // apply cut on depth
         if (GetMaxDepth() > 0)
            bCutMaxDepth = fCells[i]->GetDepth() < GetMaxDepth();

         // apply Nmin-cut
         if (GetNmin() > 0)
            bCutNmin = GetCellElement(fCells[i], 0) > GetNmin();

         // choose cell
         if(driv > drivMax && bCutNmin && bCutMaxDepth) {
            drivMax = driv;
            iCell = i;
         }
      }
   }

   if (iCell == -1){
      if (!bCutNmin)
         Log() << kVERBOSE << "Warning: No cell with more than "
               << GetNmin() << " events found!" << Endl;
      else if (!bCutMaxDepth)
         Log() << kVERBOSE << "Warning: Maximum depth reached: "
               << GetMaxDepth() << Endl;
      else
         Log() << kWARNING << "<PDEFoam::PeekMax>: no more candidate cells (drivMax>0) found for further splitting." << Endl;
   }

   return(iCell);
}

//_____________________________________________________________________
Int_t TMVA::PDEFoam::Divide(PDEFoamCell *cell)
{
   // Internal subrogram used by Create.
   // 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.

   // Double_t xdiv;
   Int_t   kBest;

   if(fLastCe+1 >= fNCells) Log() << kFATAL << "Buffer limit is reached, fLastCe=fnBuf" << Endl;

   cell->SetStat(0); // reset cell as inactive
   fNoAct++;

   // xdiv  = cell->GetXdiv();
   kBest = cell->GetBest();
   if( kBest<0 || kBest>=fDim ) Log() << kFATAL << "Wrong kBest" << Endl;

   //////////////////////////////////////////////////////////////////
   //           define two daughter cells (active)                 //
   //////////////////////////////////////////////////////////////////

   Int_t d1 = CellFill(1,   cell);
   Int_t d2 = CellFill(1,   cell);
   cell->SetDau0((fCells[d1]));
   cell->SetDau1((fCells[d2]));

   Explore( (fCells[d1]) );
   Explore( (fCells[d2]) );

   return 1;
} // PDEFoam_Divide

//_____________________________________________________________________
Double_t TMVA::PDEFoam::Eval(Double_t *xRand, Double_t &event_density)
{
   // Internal subprogram.
   // Evaluates (training) distribution.

   // Transform variable xRand, since Foam boundaries are [0,1] and
   // fDistr is filled with events which range in [fXmin,fXmax]
   //
   // Transformation:  [0, 1] --> [xmin, xmax]
   std::vector<Double_t> xvec;
   xvec.reserve(GetTotDim());
   for (Int_t idim = 0; idim < GetTotDim(); ++idim)
      xvec.push_back( VarTransformInvers(idim, xRand[idim]) );

   return GetDistr()->Density(xvec, event_density);
}

//_____________________________________________________________________
void TMVA::PDEFoam::Grow()
{
   // Internal subrogram used by Create.
   // 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.

   fTimer->Init(fNCells);

   Long_t iCell;
   PDEFoamCell* newCell;

   while ( (fLastCe+2) < fNCells ) {  // this condition also checked inside Divide
      iCell = PeekMax(); // peek up cell with maximum driver integral

      if ( (iCell<0) || (iCell>fLastCe) ) {
         Log() << kVERBOSE << "Break: "<< fLastCe+1 << " cells created" << Endl;
         // remove remaining empty cells
         for (Long_t jCell=fLastCe+1; jCell<fNCells; jCell++)
            delete fCells[jCell];
         fNCells = fLastCe+1;
         break;
      }
      newCell = fCells[iCell];

      OutputGrow();

      if ( Divide( newCell )==0) break;  // and divide it into two
   }
   OutputGrow( kTRUE );
   CheckAll(1);   // set arg=1 for more info

   Log() << kVERBOSE << GetNActiveCells() << " active cells created" << Endl;
}// Grow

//_____________________________________________________________________
void  TMVA::PDEFoam::SetInhiDiv(Int_t iDim, Int_t inhiDiv)
{
   // This can be called before Create, 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.

   if(fDim==0) Log() << kFATAL << "SetInhiDiv: fDim=0" << Endl;
   if(fInhiDiv == 0) {
      fInhiDiv = new Int_t[ fDim ];
      for(Int_t i=0; i<fDim; i++) fInhiDiv[i]=0;
   }
   //
   if( ( 0<=iDim) && (iDim<fDim)) {
      fInhiDiv[iDim] = inhiDiv;
   } else
      Log() << kFATAL << "Wrong iDim" << Endl;
}//SetInhiDiv

//_____________________________________________________________________
void TMVA::PDEFoam::CheckAll(Int_t level)
{
   //  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

   Int_t errors, warnings;
   PDEFoamCell *cell;
   Long_t iCell;

   errors = 0; warnings = 0;
   if (level==1) Log() << kVERBOSE <<  "Performing consistency checks for created foam" << Endl;
   for(iCell=1; iCell<=fLastCe; iCell++) {
      cell = fCells[iCell];
      //  checking general rules
      if( ((cell->GetDau0()==0) && (cell->GetDau1()!=0) ) ||
          ((cell->GetDau1()==0) && (cell->GetDau0()!=0) ) ) {
         errors++;
         if (level==1) Log() << kFATAL << "ERROR: Cell's no %d has only one daughter " << iCell << Endl;
      }
      if( (cell->GetDau0()==0) && (cell->GetDau1()==0) && (cell->GetStat()==0) ) {
         errors++;
         if (level==1) Log() << kFATAL << "ERROR: Cell's no %d  has no daughter and is inactive " << iCell << Endl;
      }
      if( (cell->GetDau0()!=0) && (cell->GetDau1()!=0) && (cell->GetStat()==1) ) {
         errors++;
         if (level==1) Log() << kFATAL << "ERROR: Cell's no %d has two daughters and is active " << iCell << Endl;
      }

      // checking parents
      if( (cell->GetPare())!=fCells[0] ) { // not child of the root
         if ( (cell != cell->GetPare()->GetDau0()) && (cell != cell->GetPare()->GetDau1()) ) {
            errors++;
            if (level==1) Log() << kFATAL << "ERROR: Cell's no %d parent not pointing to this cell " << iCell << Endl;
         }
      }

      // checking daughters
      if(cell->GetDau0()!=0) {
         if(cell != (cell->GetDau0())->GetPare()) {
            errors++;
            if (level==1)  Log() << kFATAL << "ERROR: Cell's no %d daughter 0 not pointing to this cell " << iCell << Endl;
         }
      }
      if(cell->GetDau1()!=0) {
         if(cell != (cell->GetDau1())->GetPare()) {
            errors++;
            if (level==1) Log() << kFATAL << "ERROR: Cell's no %d daughter 1 not pointing to this cell " << iCell << Endl;
         }
      }
      if(cell->GetVolume()<1E-50) {
         errors++;
         if(level==1) Log() << kFATAL << "ERROR: Cell no. " << iCell << " has Volume of <1E-50" << Endl;
      }
   }// loop after cells;

   // Check for cells with Volume=0
   for(iCell=0; iCell<=fLastCe; iCell++) {
      cell = fCells[iCell];
      if( (cell->GetStat()==1) && (cell->GetVolume()<1E-11) ) {
         errors++;
         if(level==1) Log() << kFATAL << "ERROR: Cell no. " << iCell << " is active but Volume is 0 " <<  Endl;
      }
   }
   // summary
   if(level==1){
      Log() << kVERBOSE << "Check has found " << errors << " errors and " << warnings << " warnings." << Endl;
   }
   if(errors>0){
      Info("CheckAll","Check - found total %d  errors \n",errors);
   }
} // Check

//_____________________________________________________________________
void TMVA::PDEFoam::PrintCell(Long_t iCell)
{
   // Prints geometry of and elements of 'iCell', as well as relations
   // to parent and daughter cells.

   if (iCell < 0 || iCell > fLastCe) {
      Log() << kWARNING << "<PrintCell(iCell=" << iCell
            << ")>: cell number " << iCell << " out of bounds!"
            << Endl;
      return;
   }

   PDEFoamVect cellPosi(fDim), cellSize(fDim);
   fCells[iCell]->GetHcub(cellPosi,cellSize);
   Int_t    kBest = fCells[iCell]->GetBest();
   Double_t xBest = fCells[iCell]->GetXdiv();

   Log() << "Cell[" << iCell << "]={ ";
   Log() << "  " << fCells[iCell] << "  " << Endl;  // extra DEBUG
   Log() << " Xdiv[abs. coord.]="
         << VarTransformInvers(kBest,cellPosi[kBest] + xBest*cellSize[kBest])
         << Endl;
   Log() << " Abs. coord. = (";
   for (Int_t idim=0; idim<fDim; idim++) {
      Log() << "dim[" << idim << "]={"
            << VarTransformInvers(idim,cellPosi[idim]) << ","
            << VarTransformInvers(idim,cellPosi[idim] + cellSize[idim])
            << "}";
      if (idim < fDim-1)
         Log() << ", ";
   }
   Log() << ")" << Endl;
   fCells[iCell]->Print("1");
   // print the cell elements
   Log() << "Elements: [";
   TVectorD *vec = (TVectorD*)fCells[iCell]->GetElement();
   if (vec != NULL){
      for (Int_t i=0; i<vec->GetNrows(); i++){
	 if (i>0) Log() << ", ";
	 Log() << GetCellElement(fCells[iCell], i);
      }
   } else
      Log() << "not set";
   Log() << "]" << Endl;
   Log()<<"}"<<Endl;
}

//_____________________________________________________________________
void TMVA::PDEFoam::PrintCells(void)
{
   // Prints geometry of ALL cells of the FOAM

   for(Long_t iCell=0; iCell<=fLastCe; iCell++)
      PrintCell(iCell);
}

//_____________________________________________________________________
void TMVA::PDEFoam::FillFoamCells(const Event* ev, Float_t wt)
{
   // This function fills a weight 'wt' into the PDEFoam cell, which
   // corresponds to the given event 'ev'.  Per default cell element 0
   // is filled with the weight 'wt', and cell element 1 is filled
   // with the squared weight.  This function can be overridden by a
   // subclass in order to change the values stored in the foam cells.

   // find corresponding foam cell
   std::vector<Float_t> values  = ev->GetValues();
   std::vector<Float_t> tvalues = VarTransform(values);
   PDEFoamCell *cell = FindCell(tvalues);

   // 0. Element: Sum of weights 'wt'
   // 1. Element: Sum of weights 'wt' squared
   SetCellElement(cell, 0, GetCellElement(cell, 0) + wt);
   SetCellElement(cell, 1, GetCellElement(cell, 1) + wt*wt);
}

//_____________________________________________________________________
void TMVA::PDEFoam::ResetCellElements()
{
   // Remove the cell elements from all cells.

   if (!fCells) return;

   Log() << kVERBOSE << "Delete cell elements" << Endl;
   for (Long_t iCell = 0; iCell < fNCells; ++iCell) {
      TObject* elements = fCells[iCell]->GetElement();
      if (elements) {
         delete elements;
         fCells[iCell]->SetElement(NULL);
      }
   }
}

//_____________________________________________________________________
Bool_t TMVA::PDEFoam::CellValueIsUndefined( PDEFoamCell* /* cell */ )
{
   // Returns true, if the value of the given cell is undefined.
   // Default value: kFALSE.  This function can be overridden by
   // sub-classes.
   return kFALSE;
}

//_____________________________________________________________________
Float_t TMVA::PDEFoam::GetCellValue(const std::vector<Float_t> &xvec, ECellValue cv, PDEFoamKernelBase *kernel)
{
   // This function finds the cell, which corresponds to the given
   // untransformed event vector 'xvec' and return its value, which is
   // given by the parameter 'cv'.  If kernel != NULL, then
   // PDEFoamKernelBase::Estimate() is called on the transformed event
   // variables.
   //
   // Parameters:
   //
   // - xvec - event vector (untransformed, [fXmin,fXmax])
   //
   // - cv - the cell value to return
   //
   // - kernel - PDEFoam kernel estimator.  If NULL is given, than the
   //   pure cell value is returned
   //
   // Return:
   //
   // The cell value, corresponding to 'xvec', estimated by the given
   // kernel.

   std::vector<Float_t> txvec(VarTransform(xvec));
   if (kernel == NULL)
      return GetCellValue(FindCell(txvec), cv);
   else
      return kernel->Estimate(this, txvec, cv);
}

//_____________________________________________________________________
std::vector<Float_t> TMVA::PDEFoam::GetCellValue( const std::map<Int_t,Float_t>& xvec, ECellValue cv )
{
   // This function finds all cells, which corresponds to the given
   // (incomplete) untransformed event vector 'xvec' and returns the
   // cell values, according to the parameter 'cv'.
   //
   // Parameters:
   //
   // - xvec - map for the untransformed vector.  The key (Int_t) is
   //   the dimension, and the value (Float_t) is the event
   //   coordinate.  Note that not all coordinates have to be
   //   specified.
   //
   // - cv - cell values to return
   //
   // Return:
   //
   // cell values from all cells that were found

   // transformed event
   std::map<Int_t,Float_t> txvec;
   for (std::map<Int_t,Float_t>::const_iterator it=xvec.begin(); it!=xvec.end(); ++it)
      txvec.insert(std::pair<Int_t, Float_t>(it->first, VarTransform(it->first, it->second)));

   // find all cells, which correspond to the transformed event
   std::vector<PDEFoamCell*> cells = FindCells(txvec);

   // get the cell values
   std::vector<Float_t> cell_values;
   cell_values.reserve(cells.size());
   for (std::vector<PDEFoamCell*>::const_iterator cell_it=cells.begin();
	cell_it != cells.end(); ++cell_it)
      cell_values.push_back(GetCellValue(*cell_it, cv));

   return cell_values;
}

//_____________________________________________________________________
TMVA::PDEFoamCell* TMVA::PDEFoam::FindCell( const std::vector<Float_t> &xvec ) const
{
   // Find cell that contains 'xvec' (in foam coordinates [0,1]).
   //
   // Loop to find cell that contains 'xvec' starting at root cell,
   // and traversing binary tree to find the cell quickly.  Note, that
   // if 'xvec' lies outside the foam, the cell which is nearest to
   // 'xvec' is returned.  (The returned pointer should never be
   // NULL.)
   //
   // Parameters:
   //
   // - xvec - event vector (in foam coordinates [0,1])
   //
   // Return:
   //
   // PDEFoam cell corresponding to 'xvec'

   PDEFoamVect  cellPosi0(GetTotDim()), cellSize0(GetTotDim());
   PDEFoamCell *cell, *cell0;

   cell=fCells[0]; // start with root cell
   Int_t idim=0;
   while (cell->GetStat()!=1) { //go down binary tree until cell is found
      idim=cell->GetBest();  // dimension that changed
      cell0=cell->GetDau0();
      cell0->GetHcub(cellPosi0,cellSize0);

      if (xvec.at(idim)<=cellPosi0[idim]+cellSize0[idim])
         cell=cell0;
      else
         cell=(cell->GetDau1());
   }
   return cell;
}

//_____________________________________________________________________
void TMVA::PDEFoam::FindCells(const std::map<Int_t, Float_t> &txvec, PDEFoamCell* cell, std::vector<PDEFoamCell*> &cells) const
{
   // This is a helper function for std::vector<PDEFoamCell*>
   // FindCells(...) and a generalisation of PDEFoamCell* FindCell().
   // It saves in 'cells' all cells, which contain the coordinates
   // specifies in 'txvec'.  Note, that not all coordinates have to be
   // specified in 'txvec'.
   //
   // Parameters:
   //
   // - txvec - event vector in foam coordinates [0,1].  The key is
   //   the dimension and the value is the event coordinate.  Note,
   //   that not all coordinates have to be specified.
   //
   // - cell - cell to start searching with (usually root cell
   //   fCells[0])
   //
   // - cells - list of cells that were found

   PDEFoamVect  cellPosi0(GetTotDim()), cellSize0(GetTotDim());
   PDEFoamCell *cell0;
   Int_t idim=0;

   while (cell->GetStat()!=1) { //go down binary tree until cell is found
      idim=cell->GetBest();  // dimension that changed

      // check if dimension 'idim' is specified in 'txvec'
      map<Int_t, Float_t>::const_iterator it = txvec.find(idim);

      if (it != txvec.end()){
         // case 1: cell is splitten in a dimension which is specified
         // in txvec
         cell0=cell->GetDau0();
         cell0->GetHcub(cellPosi0,cellSize0);
         // check, whether left daughter cell contains txvec
         if (it->second <= cellPosi0[idim] + cellSize0[idim])
            cell=cell0;
         else
            cell=cell->GetDau1();
      } else {
         // case 2: cell is splitten in target dimension
         FindCells(txvec, cell->GetDau0(), cells);
         FindCells(txvec, cell->GetDau1(), cells);
         return;
      }
   }
   cells.push_back(cell);
}

//_____________________________________________________________________
std::vector<TMVA::PDEFoamCell*> TMVA::PDEFoam::FindCells(const std::vector<Float_t> &txvec) const
{
   // Find all cells, that contain txvec.  This function can be used,
   // when the dimension of the foam is greater than the dimension of
   // txvec.  E.g. this is the case for multi-target regression.
   //
   // Parameters:
   //
   // - txvec - event vector of variables, transformed into foam
   //   coordinates [0,1].  The size of txvec can be smaller than the
   //   dimension of the foam.
   //
   // Return value:
   //
   // - vector of cells, that fit txvec

   // copy the coordinates from 'txvec' into a map
   std::map<Int_t, Float_t> txvec_map;
   for (UInt_t i=0; i<txvec.size(); ++i)
      txvec_map.insert(std::pair<Int_t, Float_t>(i, txvec.at(i)));

   // the cells found
   std::vector<PDEFoamCell*> cells(0);

   // loop over all target dimensions
   FindCells(txvec_map, fCells[0], cells);

   return cells;
}

//_____________________________________________________________________
std::vector<TMVA::PDEFoamCell*> TMVA::PDEFoam::FindCells(const std::map<Int_t, Float_t> &txvec) const
{
   // Find all cells, that contain the coordinates specified in txvec.
   // The key in 'txvec' is the dimension, and the corresponding value
   // is the coordinate.  Note, that not all coordinates have to be
   // specified in txvec.
   //
   // Parameters:
   //
   // - txvec - map of coordinates (transformed into foam coordinates
   //   [0,1])
   //
   // Return value:
   //
   // - vector of cells, that fit txvec

   // the cells found
   std::vector<PDEFoamCell*> cells(0);

   // loop over all target dimensions
   FindCells(txvec, fCells[0], cells);

   return cells;
}

//_____________________________________________________________________
TH1D* TMVA::PDEFoam::Draw1Dim( ECellValue cell_value, Int_t nbin, PDEFoamKernelBase *kernel )
{
   // Draws 1-dimensional foam (= histogram)
   //
   // Parameters:
   //
   // - cell_value - the cell value to draw
   //
   // - nbin - number of bins of result histogram
   //
   // - kernel - a PDEFoam kernel.

   // avoid plotting of wrong dimensions
   if ( GetTotDim()!=1 )
      Log() << kFATAL << "<Draw1Dim>: function can only be used for 1-dimensional foams!"
	    << Endl;

   TString hname("h_1dim");
   TH1D* h1=(TH1D*)gDirectory->Get(hname);
   if (h1) delete h1;
   h1= new TH1D(hname, "1-dimensional Foam", nbin, fXmin[0], fXmax[0]);

   if (!h1) Log() << kFATAL << "ERROR: Can not create histo" << hname << Endl;

   // loop over all bins
   for (Int_t ibinx=1; ibinx<=h1->GetNbinsX(); ++ibinx) {
      // get event vector corresponding to bin
      std::vector<Float_t> txvec;
      txvec.push_back( VarTransform(0, h1->GetBinCenter(ibinx)) );
      Float_t val = 0;
      if (kernel != NULL) {
	 // get cell value using the kernel
	 val = kernel->Estimate(this, txvec, cell_value);
      } else {
	 val = GetCellValue(FindCell(txvec), cell_value);
      }
      // fill value to histogram
      h1->SetBinContent(ibinx, val + h1->GetBinContent(ibinx));
   }

   return h1;
}

//_____________________________________________________________________
TH2D* TMVA::PDEFoam::Project2( Int_t idim1, Int_t idim2, ECellValue cell_value, PDEFoamKernelBase *kernel, UInt_t nbin )
{
   // Project foam variable idim1 and variable idim2 to histogram.
   //
   // Parameters:
   //
   // - idim1, idim2 - dimensions to project to
   //
   // - cell_value - the cell value to draw
   //
   // - kernel - a PDEFoam kernel (optional).  If NULL is given, the
   //            kernel is ignored and the pure cell values are
   //            plotted.
   //
   // - nbin - number of bins in x and y direction of result histogram
   //          (optional, default is 50).
   //
   // Returns:
   // a 2-dimensional histogram

   // avoid plotting of wrong dimensions
   if ((idim1>=GetTotDim()) || (idim1<0) ||
       (idim2>=GetTotDim()) || (idim2<0) ||
       (idim1==idim2) )
      Log() << kFATAL << "<Project2>: wrong dimensions given: "
	    << idim1 << ", " << idim2 << Endl;

   // root can not handle too many bins in one histogram --> catch this
   // Furthermore, to have more than 1000 bins in the histogram doesn't make
   // sense.
   if (nbin>1000){
      Log() << kWARNING << "Warning: number of bins too big: " << nbin
            << " Using 1000 bins for each dimension instead." << Endl;
      nbin = 1000;
   } else if (nbin<1) {
      Log() << kWARNING << "Wrong bin number: " << nbin
            << "; set nbin=50" << Endl;
      nbin = 50;
   }

   // create result histogram
   TString hname(Form("h_%d_vs_%d",idim1,idim2));

   // if histogram with this name already exists, delete it
   TH2D* h1=(TH2D*)gDirectory->Get(hname.Data());
   if (h1) delete h1;
   h1= new TH2D(hname.Data(), Form("var%d vs var%d",idim1,idim2), nbin, fXmin[idim1], fXmax[idim1], nbin, fXmin[idim2], fXmax[idim2]);

   if (!h1) Log() << kFATAL << "ERROR: Can not create histo" << hname << Endl;

   // ============== start projection algorithm ================
   // loop over all histogram bins (2-dim)
   for (Int_t xbin = 1; xbin <= h1->GetNbinsX(); ++xbin) {
      for (Int_t ybin = 1; ybin <= h1->GetNbinsY(); ++ybin) {
	 // calculate the phase space point, which corresponds to this
	 // bin combination
	 std::map<Int_t, Float_t> txvec;
	 txvec[idim1] = VarTransform(idim1, h1->GetXaxis()->GetBinCenter(xbin));
	 txvec[idim2] = VarTransform(idim2, h1->GetYaxis()->GetBinCenter(ybin));

	 // find the cells, which corresponds to this phase space
	 // point
	 std::vector<TMVA::PDEFoamCell*> cells = FindCells(txvec);

	 // loop over cells and fill the histogram with the cell
	 // values
	 Float_t sum_cv = 0; // sum of the cell values
	 for (std::vector<TMVA::PDEFoamCell*>::const_iterator it = cells.begin();
	      it != cells.end(); ++it) {
	    // get cell position and size
	    PDEFoamVect cellPosi(GetTotDim()), cellSize(GetTotDim());
	    (*it)->GetHcub(cellPosi,cellSize);
	    // Create complete event vector from txvec.  The missing
	    // coordinates of txvec are set to the cell center.
	    std::vector<Float_t> tvec;
	    for (Int_t i=0; i<GetTotDim(); ++i) {
	       if ( i != idim1 && i != idim2 )
	 	  tvec.push_back(cellPosi[i] + 0.5*cellSize[i]);
	       else
	 	  tvec.push_back(txvec[i]);
	    }
	    if (kernel != NULL) {
	       // get the cell value using the kernel
	       sum_cv += kernel->Estimate(this, tvec, cell_value);
	    } else {
	       sum_cv += GetCellValue(FindCell(tvec), cell_value);
	    }
	 }

	 // fill the bin content
	 h1->SetBinContent(xbin, ybin, sum_cv + h1->GetBinContent(xbin, ybin));
      }
   }

   return h1;
}

//_____________________________________________________________________
Float_t TMVA::PDEFoam::GetCellValue(const PDEFoamCell* cell, ECellValue cv)
{
   // Returns the cell value of 'cell' corresponding to the given
   // option 'cv'.  This function should be overridden by the subclass
   // in order to specify which cell elements to return for a given
   // cell value 'cv'.  By default kValue returns cell element 0, and
   // kValueError returns cell element 1.

   // calculate cell value (depending on the given option 'cv')
   switch (cv) {

   case kValue:
      return GetCellElement(cell, 0);

   case kValueError:
      return GetCellElement(cell, 1);

   case kValueDensity: {

      Double_t volume  = cell->GetVolume();
      if (volume > numeric_limits<double>::epsilon()) {
         return GetCellValue(cell, kValue)/volume;
      } else {
         if (volume<=0){
            cell->Print("1"); // debug output
            Log() << kWARNING << "<GetCellDensity(cell)>: ERROR: cell volume"
                  << " negative or zero!"
                  << " ==> return cell density 0!"
                  << " cell volume=" << volume
                  << " cell entries=" << GetCellValue(cell, kValue) << Endl;
         } else {
            Log() << kWARNING << "<GetCellDensity(cell)>: WARNING: cell volume"
                  << " close to zero!"
                  << " cell volume: " << volume << Endl;
	 }
      }
   }
      return 0;

   case kMeanValue:
      return cell->GetIntg();

   case kRms:
      return cell->GetDriv();

   case kRmsOvMean:
      if (cell->GetIntg() != 0)
	 return cell->GetDriv()/cell->GetIntg();
      else
         return 0;

   case kCellVolume:
      return cell->GetVolume();

   default:
      Log() << kFATAL << "<GetCellValue>: unknown cell value" << Endl;
      return 0;
   }

   return 0;
}

//_____________________________________________________________________
Double_t TMVA::PDEFoam::GetCellElement( const PDEFoamCell *cell, UInt_t i ) const
{
   // Returns cell element i of cell 'cell'.  If the cell has no
   // elements or the index 'i' is out of range, than 0 is returned.

   // dynamic_cast doesn't seem to work here ?!
   TVectorD *vec = (TVectorD*)cell->GetElement();

   // if vec is not set or index out of range, return 0
   if (!vec || i >= (UInt_t) vec->GetNrows())
      return 0;

   return (*vec)(i);
}

//_____________________________________________________________________
void TMVA::PDEFoam::SetCellElement( PDEFoamCell *cell, UInt_t i, Double_t value )
{
   // Set cell element i of cell to value.  If the cell element i does
   // not exist, it is created.

   TVectorD *vec = NULL;

   // if no cell elements are set, create TVectorD with i+1 entries,
   // ranging from [0,i]
   if (cell->GetElement() == NULL) {
      vec = new TVectorD(i+1);
      vec->Zero();       // set all values to zero
      (*vec)(i) = value; // set element i to value
      cell->SetElement(vec);
   } else {
      // dynamic_cast doesn't seem to work here ?!
      vec = (TVectorD*)cell->GetElement();
      if (!vec)
	 Log() << kFATAL << "<SetCellElement> ERROR: cell element is not a TVectorD*" << Endl;
      // check vector size and resize if necessary
      if (i >= (UInt_t) vec->GetNrows())
	 vec->ResizeTo(0,i);
      // set element i to value
      (*vec)(i) = value;
   }
}

//_____________________________________________________________________
void TMVA::PDEFoam::OutputGrow( Bool_t finished )
{
   // Overridden function of PDEFoam to avoid native foam output.
   // Draw TMVA-process bar instead.

   if (finished) {
      Log() << kINFO << "Elapsed time: " + fTimer->GetElapsedTime()
            << "                                 " << Endl;
      return;
   }

   Int_t modulo = 1;

   if (fNCells        >= 100) modulo = Int_t(fNCells/100);
   if (fLastCe%modulo == 0)   fTimer->DrawProgressBar( fLastCe );
}

//_____________________________________________________________________
void TMVA::PDEFoam::RootPlot2dim( const TString& filename, TString opt,
                                  Bool_t createCanvas, Bool_t colors )
{
   // Debugging tool which plots the cells of a 2-dimensional PDEFoam
   // as rectangles in C++ format readable for ROOT.
   //
   // Parameters:
   // - filename - filename of ouput root macro
   //
   // - opt - cell_value, rms, rms_ov_mean
   //   If cell_value is set, the following values will be filled into
   //   the result histogram:
   //    - number of events - in case of classification with 2 separate
   //                         foams or multi-target regression
   //    - discriminator    - in case of classification with one
   //                         unified foam
   //    - target           - in case of mono-target regression
   //   If none of {cell_value, rms, rms_ov_mean} is given, the cells
   //   will not be filled.
   //   If 'opt' contains the string 'cellnumber', the index of
   //   each cell is draw in addition.
   //
   // - createCanvas - whether to create a new canvas or not
   //
   // - colors - whether to fill cells with colors or shades of grey
   //
   // Example:
   //
   //   The following commands load a mono-target regression foam from
   //   file 'foam.root' and create a ROOT macro 'output.C', which
   //   draws all PDEFoam cells with little boxes.  The latter are
   //   filled with colors according to the target value stored in the
   //   cell.  Also the cell number is drawn.
   //
   //   TFile file("foam.root");
   //   TMVA::PDEFoam *foam = (TMVA::PDEFoam*) gDirectory->Get("MonoTargetRegressionFoam");
   //   foam->RootPlot2dim("output.C","cell_value,cellnumber");
   //   gROOT->Macro("output.C");

   if (GetTotDim() != 2)
      Log() << kFATAL << "RootPlot2dim() can only be used with "
            << "two-dimensional foams!" << Endl;

   // select value to plot
   ECellValue cell_value = kValue;
   Bool_t plotcellnumber = kFALSE;
   Bool_t fillcells      = kTRUE;
   if (opt.Contains("cell_value")){
      cell_value = kValue;
   } else if (opt.Contains("rms_ov_mean")){
      cell_value = kRmsOvMean;
   } else if (opt.Contains("rms")){
      cell_value = kRms;
   } else {
      fillcells = kFALSE;
   }
   if (opt.Contains("cellnumber"))
      plotcellnumber = kTRUE;

   // open file (root macro)
   std::ofstream outfile(filename, std::ios::out);

   outfile<<"{" << std::endl;

   // declare boxes and set the fill styles
   if (!colors) { // define grayscale colors from light to dark,
      // starting from color index 1000
      outfile << "TColor *graycolors[100];" << std::endl;
      outfile << "for (Int_t i=0.; i<100; i++)" << std::endl;
      outfile << "  graycolors[i]=new TColor(1000+i, 1-(Float_t)i/100.,1-(Float_t)i/100.,1-(Float_t)i/100.);"<< std::endl;
   }
   if (createCanvas)
      outfile << "cMap = new TCanvas(\"" << fName << "\",\"Cell Map for "
              << fName << "\",600,600);" << std::endl;

   outfile<<"TBox*a=new TBox();"<<std::endl;
   outfile<<"a->SetFillStyle(0);"<<std::endl;  // big frame
   outfile<<"a->SetLineWidth(4);"<<std::endl;
   outfile<<"TBox *b1=new TBox();"<<std::endl;  // single cell
   outfile<<"TText*t=new TText();"<<std::endl;  // text for numbering
   if (fillcells) {
      outfile << (colors ? "gStyle->SetPalette(1, 0);" : "gStyle->SetPalette(0);")
              << std::endl;
      outfile <<"b1->SetFillStyle(1001);"<<std::endl;
      outfile<<"TBox *b2=new TBox();"<<std::endl;  // single cell
      outfile <<"b2->SetFillStyle(0);"<<std::endl;
   }
   else {
      outfile <<"b1->SetFillStyle(0);"<<std::endl;
   }

   if (fillcells)
      (colors ? gStyle->SetPalette(1, 0) : gStyle->SetPalette(0) );

   Float_t zmin = 1E8;  // minimal value (for color calculation)
   Float_t zmax = -1E8; // maximal value (for color calculation)

   // if cells shall be filled, calculate minimal and maximal plot
   // value --> store in zmin and zmax
   if (fillcells) {
      for (Long_t iCell=1; iCell<=fLastCe; iCell++) {
         if ( fCells[iCell]->GetStat() == 1) {
            Float_t value = GetCellValue(fCells[iCell], cell_value);
            if (value<zmin)
               zmin=value;
            if (value>zmax)
               zmax=value;
         }
      }
      outfile << "// observed minimum and maximum of distribution: " << std::endl;
      outfile << "// Float_t zmin = "<< zmin << ";" << std::endl;
      outfile << "// Float_t zmax = "<< zmax << ";" << std::endl;
   }

   outfile << "// used minimum and maximum of distribution (taking into account log scale if applicable): " << std::endl;
   outfile << "Float_t zmin = "<< zmin << ";" << std::endl;
   outfile << "Float_t zmax = "<< zmax << ";" << std::endl;

   Float_t x1,y1,x2,y2,x,y; // box and text coordintates
   Float_t offs  = 0.01;
   Float_t lpag  = 1-2*offs;
   Int_t ncolors  = colors ? gStyle->GetNumberOfColors() : 100;
   Float_t scale = (ncolors-1)/(zmax - zmin);
   PDEFoamVect cellPosi(GetTotDim()), cellSize(GetTotDim());

   // loop over cells and draw a box for every cell (and maybe the
   // cell number as well)
   outfile << "// =========== Rectangular cells  ==========="<< std::endl;
   for (Long_t iCell=1; iCell<=fLastCe; iCell++) {
      if ( fCells[iCell]->GetStat() == 1) {
         fCells[iCell]->GetHcub(cellPosi,cellSize);
         x1 = offs+lpag*(cellPosi[0]);
         y1 = offs+lpag*(cellPosi[1]);
         x2 = offs+lpag*(cellPosi[0]+cellSize[0]);
         y2 = offs+lpag*(cellPosi[1]+cellSize[1]);

         if (fillcells) {
            // get cell value
            Float_t value = GetCellValue(fCells[iCell], cell_value);

            // calculate fill color
            Int_t color;
            if (colors)
               color = gStyle->GetColorPalette(Int_t((value-zmin)*scale));
            else
               color = 1000+(Int_t((value-zmin)*scale));

            // set fill color of box b1
            outfile << "b1->SetFillColor(" << color << ");" << std::endl;
         }

         //     cell rectangle
         outfile<<"b1->DrawBox("<<x1<<","<<y1<<","<<x2<<","<<y2<<");"<<std::endl;
         if (fillcells)
            outfile<<"b2->DrawBox("<<x1<<","<<y1<<","<<x2<<","<<y2<<");"<<std::endl;

         //     cell number
         if (plotcellnumber) {
            outfile<<"t->SetTextColor(4);"<<std::endl;
            if(fLastCe<51)
               outfile<<"t->SetTextSize(0.025);"<<std::endl;  // text for numbering
            else if(fLastCe<251)
               outfile<<"t->SetTextSize(0.015);"<<std::endl;
            else
               outfile<<"t->SetTextSize(0.008);"<<std::endl;
            x = offs+lpag*(cellPosi[0]+0.5*cellSize[0]);
            y = offs+lpag*(cellPosi[1]+0.5*cellSize[1]);
            outfile<<"t->DrawText("<<x<<","<<y<<","<<"\""<<iCell<<"\""<<");"<<std::endl;
         }
      }
   }
   outfile<<"// ============== End Rectangles ==========="<< std::endl;

   outfile << "}" << std::endl;
   outfile.flush();
   outfile.close();
}

//_____________________________________________________________________
void TMVA::PDEFoam::FillBinarySearchTree( const Event* ev )
{
   // Insert event to internal foam's density estimator
   // PDEFoamDensityBase.
   GetDistr()->FillBinarySearchTree(ev);
}

//_____________________________________________________________________
void TMVA::PDEFoam::DeleteBinarySearchTree()
{
   // Delete the foam's density estimator, which contains the binary
   // search tree.
   if(fDistr) delete fDistr;
   fDistr = NULL;
}
 PDEFoam.cxx:1
 PDEFoam.cxx:2
 PDEFoam.cxx:3
 PDEFoam.cxx:4
 PDEFoam.cxx:5
 PDEFoam.cxx:6
 PDEFoam.cxx:7
 PDEFoam.cxx:8
 PDEFoam.cxx:9
 PDEFoam.cxx:10
 PDEFoam.cxx:11
 PDEFoam.cxx:12
 PDEFoam.cxx:13
 PDEFoam.cxx:14
 PDEFoam.cxx:15
 PDEFoam.cxx:16
 PDEFoam.cxx:17
 PDEFoam.cxx:18
 PDEFoam.cxx:19
 PDEFoam.cxx:20
 PDEFoam.cxx:21
 PDEFoam.cxx:22
 PDEFoam.cxx:23
 PDEFoam.cxx:24
 PDEFoam.cxx:25
 PDEFoam.cxx:26
 PDEFoam.cxx:27
 PDEFoam.cxx:28
 PDEFoam.cxx:29
 PDEFoam.cxx:30
 PDEFoam.cxx:31
 PDEFoam.cxx:32
 PDEFoam.cxx:33
 PDEFoam.cxx:34
 PDEFoam.cxx:35
 PDEFoam.cxx:36
 PDEFoam.cxx:37
 PDEFoam.cxx:38
 PDEFoam.cxx:39
 PDEFoam.cxx:40
 PDEFoam.cxx:41
 PDEFoam.cxx:42
 PDEFoam.cxx:43
 PDEFoam.cxx:44
 PDEFoam.cxx:45
 PDEFoam.cxx:46
 PDEFoam.cxx:47
 PDEFoam.cxx:48
 PDEFoam.cxx:49
 PDEFoam.cxx:50
 PDEFoam.cxx:51
 PDEFoam.cxx:52
 PDEFoam.cxx:53
 PDEFoam.cxx:54
 PDEFoam.cxx:55
 PDEFoam.cxx:56
 PDEFoam.cxx:57
 PDEFoam.cxx:58
 PDEFoam.cxx:59
 PDEFoam.cxx:60
 PDEFoam.cxx:61
 PDEFoam.cxx:62
 PDEFoam.cxx:63
 PDEFoam.cxx:64
 PDEFoam.cxx:65
 PDEFoam.cxx:66
 PDEFoam.cxx:67
 PDEFoam.cxx:68
 PDEFoam.cxx:69
 PDEFoam.cxx:70
 PDEFoam.cxx:71
 PDEFoam.cxx:72
 PDEFoam.cxx:73
 PDEFoam.cxx:74
 PDEFoam.cxx:75
 PDEFoam.cxx:76
 PDEFoam.cxx:77
 PDEFoam.cxx:78
 PDEFoam.cxx:79
 PDEFoam.cxx:80
 PDEFoam.cxx:81
 PDEFoam.cxx:82
 PDEFoam.cxx:83
 PDEFoam.cxx:84
 PDEFoam.cxx:85
 PDEFoam.cxx:86
 PDEFoam.cxx:87
 PDEFoam.cxx:88
 PDEFoam.cxx:89
 PDEFoam.cxx:90
 PDEFoam.cxx:91
 PDEFoam.cxx:92
 PDEFoam.cxx:93
 PDEFoam.cxx:94
 PDEFoam.cxx:95
 PDEFoam.cxx:96
 PDEFoam.cxx:97
 PDEFoam.cxx:98
 PDEFoam.cxx:99
 PDEFoam.cxx:100
 PDEFoam.cxx:101
 PDEFoam.cxx:102
 PDEFoam.cxx:103
 PDEFoam.cxx:104
 PDEFoam.cxx:105
 PDEFoam.cxx:106
 PDEFoam.cxx:107
 PDEFoam.cxx:108
 PDEFoam.cxx:109
 PDEFoam.cxx:110
 PDEFoam.cxx:111
 PDEFoam.cxx:112
 PDEFoam.cxx:113
 PDEFoam.cxx:114
 PDEFoam.cxx:115
 PDEFoam.cxx:116
 PDEFoam.cxx:117
 PDEFoam.cxx:118
 PDEFoam.cxx:119
 PDEFoam.cxx:120
 PDEFoam.cxx:121
 PDEFoam.cxx:122
 PDEFoam.cxx:123
 PDEFoam.cxx:124
 PDEFoam.cxx:125
 PDEFoam.cxx:126
 PDEFoam.cxx:127
 PDEFoam.cxx:128
 PDEFoam.cxx:129
 PDEFoam.cxx:130
 PDEFoam.cxx:131
 PDEFoam.cxx:132
 PDEFoam.cxx:133
 PDEFoam.cxx:134
 PDEFoam.cxx:135
 PDEFoam.cxx:136
 PDEFoam.cxx:137
 PDEFoam.cxx:138
 PDEFoam.cxx:139
 PDEFoam.cxx:140
 PDEFoam.cxx:141
 PDEFoam.cxx:142
 PDEFoam.cxx:143
 PDEFoam.cxx:144
 PDEFoam.cxx:145
 PDEFoam.cxx:146
 PDEFoam.cxx:147
 PDEFoam.cxx:148
 PDEFoam.cxx:149
 PDEFoam.cxx:150
 PDEFoam.cxx:151
 PDEFoam.cxx:152
 PDEFoam.cxx:153
 PDEFoam.cxx:154
 PDEFoam.cxx:155
 PDEFoam.cxx:156
 PDEFoam.cxx:157
 PDEFoam.cxx:158
 PDEFoam.cxx:159
 PDEFoam.cxx:160
 PDEFoam.cxx:161
 PDEFoam.cxx:162
 PDEFoam.cxx:163
 PDEFoam.cxx:164
 PDEFoam.cxx:165
 PDEFoam.cxx:166
 PDEFoam.cxx:167
 PDEFoam.cxx:168
 PDEFoam.cxx:169
 PDEFoam.cxx:170
 PDEFoam.cxx:171
 PDEFoam.cxx:172
 PDEFoam.cxx:173
 PDEFoam.cxx:174
 PDEFoam.cxx:175
 PDEFoam.cxx:176
 PDEFoam.cxx:177
 PDEFoam.cxx:178
 PDEFoam.cxx:179
 PDEFoam.cxx:180
 PDEFoam.cxx:181
 PDEFoam.cxx:182
 PDEFoam.cxx:183
 PDEFoam.cxx:184
 PDEFoam.cxx:185
 PDEFoam.cxx:186
 PDEFoam.cxx:187
 PDEFoam.cxx:188
 PDEFoam.cxx:189
 PDEFoam.cxx:190
 PDEFoam.cxx:191
 PDEFoam.cxx:192
 PDEFoam.cxx:193
 PDEFoam.cxx:194
 PDEFoam.cxx:195
 PDEFoam.cxx:196
 PDEFoam.cxx:197
 PDEFoam.cxx:198
 PDEFoam.cxx:199
 PDEFoam.cxx:200
 PDEFoam.cxx:201
 PDEFoam.cxx:202
 PDEFoam.cxx:203
 PDEFoam.cxx:204
 PDEFoam.cxx:205
 PDEFoam.cxx:206
 PDEFoam.cxx:207
 PDEFoam.cxx:208
 PDEFoam.cxx:209
 PDEFoam.cxx:210
 PDEFoam.cxx:211
 PDEFoam.cxx:212
 PDEFoam.cxx:213
 PDEFoam.cxx:214
 PDEFoam.cxx:215
 PDEFoam.cxx:216
 PDEFoam.cxx:217
 PDEFoam.cxx:218
 PDEFoam.cxx:219
 PDEFoam.cxx:220
 PDEFoam.cxx:221
 PDEFoam.cxx:222
 PDEFoam.cxx:223
 PDEFoam.cxx:224
 PDEFoam.cxx:225
 PDEFoam.cxx:226
 PDEFoam.cxx:227
 PDEFoam.cxx:228
 PDEFoam.cxx:229
 PDEFoam.cxx:230
 PDEFoam.cxx:231
 PDEFoam.cxx:232
 PDEFoam.cxx:233
 PDEFoam.cxx:234
 PDEFoam.cxx:235
 PDEFoam.cxx:236
 PDEFoam.cxx:237
 PDEFoam.cxx:238
 PDEFoam.cxx:239
 PDEFoam.cxx:240
 PDEFoam.cxx:241
 PDEFoam.cxx:242
 PDEFoam.cxx:243
 PDEFoam.cxx:244
 PDEFoam.cxx:245
 PDEFoam.cxx:246
 PDEFoam.cxx:247
 PDEFoam.cxx:248
 PDEFoam.cxx:249
 PDEFoam.cxx:250
 PDEFoam.cxx:251
 PDEFoam.cxx:252
 PDEFoam.cxx:253
 PDEFoam.cxx:254
 PDEFoam.cxx:255
 PDEFoam.cxx:256
 PDEFoam.cxx:257
 PDEFoam.cxx:258
 PDEFoam.cxx:259
 PDEFoam.cxx:260
 PDEFoam.cxx:261
 PDEFoam.cxx:262
 PDEFoam.cxx:263
 PDEFoam.cxx:264
 PDEFoam.cxx:265
 PDEFoam.cxx:266
 PDEFoam.cxx:267
 PDEFoam.cxx:268
 PDEFoam.cxx:269
 PDEFoam.cxx:270
 PDEFoam.cxx:271
 PDEFoam.cxx:272
 PDEFoam.cxx:273
 PDEFoam.cxx:274
 PDEFoam.cxx:275
 PDEFoam.cxx:276
 PDEFoam.cxx:277
 PDEFoam.cxx:278
 PDEFoam.cxx:279
 PDEFoam.cxx:280
 PDEFoam.cxx:281
 PDEFoam.cxx:282
 PDEFoam.cxx:283
 PDEFoam.cxx:284
 PDEFoam.cxx:285
 PDEFoam.cxx:286
 PDEFoam.cxx:287
 PDEFoam.cxx:288
 PDEFoam.cxx:289
 PDEFoam.cxx:290
 PDEFoam.cxx:291
 PDEFoam.cxx:292
 PDEFoam.cxx:293
 PDEFoam.cxx:294
 PDEFoam.cxx:295
 PDEFoam.cxx:296
 PDEFoam.cxx:297
 PDEFoam.cxx:298
 PDEFoam.cxx:299
 PDEFoam.cxx:300
 PDEFoam.cxx:301
 PDEFoam.cxx:302
 PDEFoam.cxx:303
 PDEFoam.cxx:304
 PDEFoam.cxx:305
 PDEFoam.cxx:306
 PDEFoam.cxx:307
 PDEFoam.cxx:308
 PDEFoam.cxx:309
 PDEFoam.cxx:310
 PDEFoam.cxx:311
 PDEFoam.cxx:312
 PDEFoam.cxx:313
 PDEFoam.cxx:314
 PDEFoam.cxx:315
 PDEFoam.cxx:316
 PDEFoam.cxx:317
 PDEFoam.cxx:318
 PDEFoam.cxx:319
 PDEFoam.cxx:320
 PDEFoam.cxx:321
 PDEFoam.cxx:322
 PDEFoam.cxx:323
 PDEFoam.cxx:324
 PDEFoam.cxx:325
 PDEFoam.cxx:326
 PDEFoam.cxx:327
 PDEFoam.cxx:328
 PDEFoam.cxx:329
 PDEFoam.cxx:330
 PDEFoam.cxx:331
 PDEFoam.cxx:332
 PDEFoam.cxx:333
 PDEFoam.cxx:334
 PDEFoam.cxx:335
 PDEFoam.cxx:336
 PDEFoam.cxx:337
 PDEFoam.cxx:338
 PDEFoam.cxx:339
 PDEFoam.cxx:340
 PDEFoam.cxx:341
 PDEFoam.cxx:342
 PDEFoam.cxx:343
 PDEFoam.cxx:344
 PDEFoam.cxx:345
 PDEFoam.cxx:346
 PDEFoam.cxx:347
 PDEFoam.cxx:348
 PDEFoam.cxx:349
 PDEFoam.cxx:350
 PDEFoam.cxx:351
 PDEFoam.cxx:352
 PDEFoam.cxx:353
 PDEFoam.cxx:354
 PDEFoam.cxx:355
 PDEFoam.cxx:356
 PDEFoam.cxx:357
 PDEFoam.cxx:358
 PDEFoam.cxx:359
 PDEFoam.cxx:360
 PDEFoam.cxx:361
 PDEFoam.cxx:362
 PDEFoam.cxx:363
 PDEFoam.cxx:364
 PDEFoam.cxx:365
 PDEFoam.cxx:366
 PDEFoam.cxx:367
 PDEFoam.cxx:368
 PDEFoam.cxx:369
 PDEFoam.cxx:370
 PDEFoam.cxx:371
 PDEFoam.cxx:372
 PDEFoam.cxx:373
 PDEFoam.cxx:374
 PDEFoam.cxx:375
 PDEFoam.cxx:376
 PDEFoam.cxx:377
 PDEFoam.cxx:378
 PDEFoam.cxx:379
 PDEFoam.cxx:380
 PDEFoam.cxx:381
 PDEFoam.cxx:382
 PDEFoam.cxx:383
 PDEFoam.cxx:384
 PDEFoam.cxx:385
 PDEFoam.cxx:386
 PDEFoam.cxx:387
 PDEFoam.cxx:388
 PDEFoam.cxx:389
 PDEFoam.cxx:390
 PDEFoam.cxx:391
 PDEFoam.cxx:392
 PDEFoam.cxx:393
 PDEFoam.cxx:394
 PDEFoam.cxx:395
 PDEFoam.cxx:396
 PDEFoam.cxx:397
 PDEFoam.cxx:398
 PDEFoam.cxx:399
 PDEFoam.cxx:400
 PDEFoam.cxx:401
 PDEFoam.cxx:402
 PDEFoam.cxx:403
 PDEFoam.cxx:404
 PDEFoam.cxx:405
 PDEFoam.cxx:406
 PDEFoam.cxx:407
 PDEFoam.cxx:408
 PDEFoam.cxx:409
 PDEFoam.cxx:410
 PDEFoam.cxx:411
 PDEFoam.cxx:412
 PDEFoam.cxx:413
 PDEFoam.cxx:414
 PDEFoam.cxx:415
 PDEFoam.cxx:416
 PDEFoam.cxx:417
 PDEFoam.cxx:418
 PDEFoam.cxx:419
 PDEFoam.cxx:420
 PDEFoam.cxx:421
 PDEFoam.cxx:422
 PDEFoam.cxx:423
 PDEFoam.cxx:424
 PDEFoam.cxx:425
 PDEFoam.cxx:426
 PDEFoam.cxx:427
 PDEFoam.cxx:428
 PDEFoam.cxx:429
 PDEFoam.cxx:430
 PDEFoam.cxx:431
 PDEFoam.cxx:432
 PDEFoam.cxx:433
 PDEFoam.cxx:434
 PDEFoam.cxx:435
 PDEFoam.cxx:436
 PDEFoam.cxx:437
 PDEFoam.cxx:438
 PDEFoam.cxx:439
 PDEFoam.cxx:440
 PDEFoam.cxx:441
 PDEFoam.cxx:442
 PDEFoam.cxx:443
 PDEFoam.cxx:444
 PDEFoam.cxx:445
 PDEFoam.cxx:446
 PDEFoam.cxx:447
 PDEFoam.cxx:448
 PDEFoam.cxx:449
 PDEFoam.cxx:450
 PDEFoam.cxx:451
 PDEFoam.cxx:452
 PDEFoam.cxx:453
 PDEFoam.cxx:454
 PDEFoam.cxx:455
 PDEFoam.cxx:456
 PDEFoam.cxx:457
 PDEFoam.cxx:458
 PDEFoam.cxx:459
 PDEFoam.cxx:460
 PDEFoam.cxx:461
 PDEFoam.cxx:462
 PDEFoam.cxx:463
 PDEFoam.cxx:464
 PDEFoam.cxx:465
 PDEFoam.cxx:466
 PDEFoam.cxx:467
 PDEFoam.cxx:468
 PDEFoam.cxx:469
 PDEFoam.cxx:470
 PDEFoam.cxx:471
 PDEFoam.cxx:472
 PDEFoam.cxx:473
 PDEFoam.cxx:474
 PDEFoam.cxx:475
 PDEFoam.cxx:476
 PDEFoam.cxx:477
 PDEFoam.cxx:478
 PDEFoam.cxx:479
 PDEFoam.cxx:480
 PDEFoam.cxx:481
 PDEFoam.cxx:482
 PDEFoam.cxx:483
 PDEFoam.cxx:484
 PDEFoam.cxx:485
 PDEFoam.cxx:486
 PDEFoam.cxx:487
 PDEFoam.cxx:488
 PDEFoam.cxx:489
 PDEFoam.cxx:490
 PDEFoam.cxx:491
 PDEFoam.cxx:492
 PDEFoam.cxx:493
 PDEFoam.cxx:494
 PDEFoam.cxx:495
 PDEFoam.cxx:496
 PDEFoam.cxx:497
 PDEFoam.cxx:498
 PDEFoam.cxx:499
 PDEFoam.cxx:500
 PDEFoam.cxx:501
 PDEFoam.cxx:502
 PDEFoam.cxx:503
 PDEFoam.cxx:504
 PDEFoam.cxx:505
 PDEFoam.cxx:506
 PDEFoam.cxx:507
 PDEFoam.cxx:508
 PDEFoam.cxx:509
 PDEFoam.cxx:510
 PDEFoam.cxx:511
 PDEFoam.cxx:512
 PDEFoam.cxx:513
 PDEFoam.cxx:514
 PDEFoam.cxx:515
 PDEFoam.cxx:516
 PDEFoam.cxx:517
 PDEFoam.cxx:518
 PDEFoam.cxx:519
 PDEFoam.cxx:520
 PDEFoam.cxx:521
 PDEFoam.cxx:522
 PDEFoam.cxx:523
 PDEFoam.cxx:524
 PDEFoam.cxx:525
 PDEFoam.cxx:526
 PDEFoam.cxx:527
 PDEFoam.cxx:528
 PDEFoam.cxx:529
 PDEFoam.cxx:530
 PDEFoam.cxx:531
 PDEFoam.cxx:532
 PDEFoam.cxx:533
 PDEFoam.cxx:534
 PDEFoam.cxx:535
 PDEFoam.cxx:536
 PDEFoam.cxx:537
 PDEFoam.cxx:538
 PDEFoam.cxx:539
 PDEFoam.cxx:540
 PDEFoam.cxx:541
 PDEFoam.cxx:542
 PDEFoam.cxx:543
 PDEFoam.cxx:544
 PDEFoam.cxx:545
 PDEFoam.cxx:546
 PDEFoam.cxx:547
 PDEFoam.cxx:548
 PDEFoam.cxx:549
 PDEFoam.cxx:550
 PDEFoam.cxx:551
 PDEFoam.cxx:552
 PDEFoam.cxx:553
 PDEFoam.cxx:554
 PDEFoam.cxx:555
 PDEFoam.cxx:556
 PDEFoam.cxx:557
 PDEFoam.cxx:558
 PDEFoam.cxx:559
 PDEFoam.cxx:560
 PDEFoam.cxx:561
 PDEFoam.cxx:562
 PDEFoam.cxx:563
 PDEFoam.cxx:564
 PDEFoam.cxx:565
 PDEFoam.cxx:566
 PDEFoam.cxx:567
 PDEFoam.cxx:568
 PDEFoam.cxx:569
 PDEFoam.cxx:570
 PDEFoam.cxx:571
 PDEFoam.cxx:572
 PDEFoam.cxx:573
 PDEFoam.cxx:574
 PDEFoam.cxx:575
 PDEFoam.cxx:576
 PDEFoam.cxx:577
 PDEFoam.cxx:578
 PDEFoam.cxx:579
 PDEFoam.cxx:580
 PDEFoam.cxx:581
 PDEFoam.cxx:582
 PDEFoam.cxx:583
 PDEFoam.cxx:584
 PDEFoam.cxx:585
 PDEFoam.cxx:586
 PDEFoam.cxx:587
 PDEFoam.cxx:588
 PDEFoam.cxx:589
 PDEFoam.cxx:590
 PDEFoam.cxx:591
 PDEFoam.cxx:592
 PDEFoam.cxx:593
 PDEFoam.cxx:594
 PDEFoam.cxx:595
 PDEFoam.cxx:596
 PDEFoam.cxx:597
 PDEFoam.cxx:598
 PDEFoam.cxx:599
 PDEFoam.cxx:600
 PDEFoam.cxx:601
 PDEFoam.cxx:602
 PDEFoam.cxx:603
 PDEFoam.cxx:604
 PDEFoam.cxx:605
 PDEFoam.cxx:606
 PDEFoam.cxx:607
 PDEFoam.cxx:608
 PDEFoam.cxx:609
 PDEFoam.cxx:610
 PDEFoam.cxx:611
 PDEFoam.cxx:612
 PDEFoam.cxx:613
 PDEFoam.cxx:614
 PDEFoam.cxx:615
 PDEFoam.cxx:616
 PDEFoam.cxx:617
 PDEFoam.cxx:618
 PDEFoam.cxx:619
 PDEFoam.cxx:620
 PDEFoam.cxx:621
 PDEFoam.cxx:622
 PDEFoam.cxx:623
 PDEFoam.cxx:624
 PDEFoam.cxx:625
 PDEFoam.cxx:626
 PDEFoam.cxx:627
 PDEFoam.cxx:628
 PDEFoam.cxx:629
 PDEFoam.cxx:630
 PDEFoam.cxx:631
 PDEFoam.cxx:632
 PDEFoam.cxx:633
 PDEFoam.cxx:634
 PDEFoam.cxx:635
 PDEFoam.cxx:636
 PDEFoam.cxx:637
 PDEFoam.cxx:638
 PDEFoam.cxx:639
 PDEFoam.cxx:640
 PDEFoam.cxx:641
 PDEFoam.cxx:642
 PDEFoam.cxx:643
 PDEFoam.cxx:644
 PDEFoam.cxx:645
 PDEFoam.cxx:646
 PDEFoam.cxx:647
 PDEFoam.cxx:648
 PDEFoam.cxx:649
 PDEFoam.cxx:650
 PDEFoam.cxx:651
 PDEFoam.cxx:652
 PDEFoam.cxx:653
 PDEFoam.cxx:654
 PDEFoam.cxx:655
 PDEFoam.cxx:656
 PDEFoam.cxx:657
 PDEFoam.cxx:658
 PDEFoam.cxx:659
 PDEFoam.cxx:660
 PDEFoam.cxx:661
 PDEFoam.cxx:662
 PDEFoam.cxx:663
 PDEFoam.cxx:664
 PDEFoam.cxx:665
 PDEFoam.cxx:666
 PDEFoam.cxx:667
 PDEFoam.cxx:668
 PDEFoam.cxx:669
 PDEFoam.cxx:670
 PDEFoam.cxx:671
 PDEFoam.cxx:672
 PDEFoam.cxx:673
 PDEFoam.cxx:674
 PDEFoam.cxx:675
 PDEFoam.cxx:676
 PDEFoam.cxx:677
 PDEFoam.cxx:678
 PDEFoam.cxx:679
 PDEFoam.cxx:680
 PDEFoam.cxx:681
 PDEFoam.cxx:682
 PDEFoam.cxx:683
 PDEFoam.cxx:684
 PDEFoam.cxx:685
 PDEFoam.cxx:686
 PDEFoam.cxx:687
 PDEFoam.cxx:688
 PDEFoam.cxx:689
 PDEFoam.cxx:690
 PDEFoam.cxx:691
 PDEFoam.cxx:692
 PDEFoam.cxx:693
 PDEFoam.cxx:694
 PDEFoam.cxx:695
 PDEFoam.cxx:696
 PDEFoam.cxx:697
 PDEFoam.cxx:698
 PDEFoam.cxx:699
 PDEFoam.cxx:700
 PDEFoam.cxx:701
 PDEFoam.cxx:702
 PDEFoam.cxx:703
 PDEFoam.cxx:704
 PDEFoam.cxx:705
 PDEFoam.cxx:706
 PDEFoam.cxx:707
 PDEFoam.cxx:708
 PDEFoam.cxx:709
 PDEFoam.cxx:710
 PDEFoam.cxx:711
 PDEFoam.cxx:712
 PDEFoam.cxx:713
 PDEFoam.cxx:714
 PDEFoam.cxx:715
 PDEFoam.cxx:716
 PDEFoam.cxx:717
 PDEFoam.cxx:718
 PDEFoam.cxx:719
 PDEFoam.cxx:720
 PDEFoam.cxx:721
 PDEFoam.cxx:722
 PDEFoam.cxx:723
 PDEFoam.cxx:724
 PDEFoam.cxx:725
 PDEFoam.cxx:726
 PDEFoam.cxx:727
 PDEFoam.cxx:728
 PDEFoam.cxx:729
 PDEFoam.cxx:730
 PDEFoam.cxx:731
 PDEFoam.cxx:732
 PDEFoam.cxx:733
 PDEFoam.cxx:734
 PDEFoam.cxx:735
 PDEFoam.cxx:736
 PDEFoam.cxx:737
 PDEFoam.cxx:738
 PDEFoam.cxx:739
 PDEFoam.cxx:740
 PDEFoam.cxx:741
 PDEFoam.cxx:742
 PDEFoam.cxx:743
 PDEFoam.cxx:744
 PDEFoam.cxx:745
 PDEFoam.cxx:746
 PDEFoam.cxx:747
 PDEFoam.cxx:748
 PDEFoam.cxx:749
 PDEFoam.cxx:750
 PDEFoam.cxx:751
 PDEFoam.cxx:752
 PDEFoam.cxx:753
 PDEFoam.cxx:754
 PDEFoam.cxx:755
 PDEFoam.cxx:756
 PDEFoam.cxx:757
 PDEFoam.cxx:758
 PDEFoam.cxx:759
 PDEFoam.cxx:760
 PDEFoam.cxx:761
 PDEFoam.cxx:762
 PDEFoam.cxx:763
 PDEFoam.cxx:764
 PDEFoam.cxx:765
 PDEFoam.cxx:766
 PDEFoam.cxx:767
 PDEFoam.cxx:768
 PDEFoam.cxx:769
 PDEFoam.cxx:770
 PDEFoam.cxx:771
 PDEFoam.cxx:772
 PDEFoam.cxx:773
 PDEFoam.cxx:774
 PDEFoam.cxx:775
 PDEFoam.cxx:776
 PDEFoam.cxx:777
 PDEFoam.cxx:778
 PDEFoam.cxx:779
 PDEFoam.cxx:780
 PDEFoam.cxx:781
 PDEFoam.cxx:782
 PDEFoam.cxx:783
 PDEFoam.cxx:784
 PDEFoam.cxx:785
 PDEFoam.cxx:786
 PDEFoam.cxx:787
 PDEFoam.cxx:788
 PDEFoam.cxx:789
 PDEFoam.cxx:790
 PDEFoam.cxx:791
 PDEFoam.cxx:792
 PDEFoam.cxx:793
 PDEFoam.cxx:794
 PDEFoam.cxx:795
 PDEFoam.cxx:796
 PDEFoam.cxx:797
 PDEFoam.cxx:798
 PDEFoam.cxx:799
 PDEFoam.cxx:800
 PDEFoam.cxx:801
 PDEFoam.cxx:802
 PDEFoam.cxx:803
 PDEFoam.cxx:804
 PDEFoam.cxx:805
 PDEFoam.cxx:806
 PDEFoam.cxx:807
 PDEFoam.cxx:808
 PDEFoam.cxx:809
 PDEFoam.cxx:810
 PDEFoam.cxx:811
 PDEFoam.cxx:812
 PDEFoam.cxx:813
 PDEFoam.cxx:814
 PDEFoam.cxx:815
 PDEFoam.cxx:816
 PDEFoam.cxx:817
 PDEFoam.cxx:818
 PDEFoam.cxx:819
 PDEFoam.cxx:820
 PDEFoam.cxx:821
 PDEFoam.cxx:822
 PDEFoam.cxx:823
 PDEFoam.cxx:824
 PDEFoam.cxx:825
 PDEFoam.cxx:826
 PDEFoam.cxx:827
 PDEFoam.cxx:828
 PDEFoam.cxx:829
 PDEFoam.cxx:830
 PDEFoam.cxx:831
 PDEFoam.cxx:832
 PDEFoam.cxx:833
 PDEFoam.cxx:834
 PDEFoam.cxx:835
 PDEFoam.cxx:836
 PDEFoam.cxx:837
 PDEFoam.cxx:838
 PDEFoam.cxx:839
 PDEFoam.cxx:840
 PDEFoam.cxx:841
 PDEFoam.cxx:842
 PDEFoam.cxx:843
 PDEFoam.cxx:844
 PDEFoam.cxx:845
 PDEFoam.cxx:846
 PDEFoam.cxx:847
 PDEFoam.cxx:848
 PDEFoam.cxx:849
 PDEFoam.cxx:850
 PDEFoam.cxx:851
 PDEFoam.cxx:852
 PDEFoam.cxx:853
 PDEFoam.cxx:854
 PDEFoam.cxx:855
 PDEFoam.cxx:856
 PDEFoam.cxx:857
 PDEFoam.cxx:858
 PDEFoam.cxx:859
 PDEFoam.cxx:860
 PDEFoam.cxx:861
 PDEFoam.cxx:862
 PDEFoam.cxx:863
 PDEFoam.cxx:864
 PDEFoam.cxx:865
 PDEFoam.cxx:866
 PDEFoam.cxx:867
 PDEFoam.cxx:868
 PDEFoam.cxx:869
 PDEFoam.cxx:870
 PDEFoam.cxx:871
 PDEFoam.cxx:872
 PDEFoam.cxx:873
 PDEFoam.cxx:874
 PDEFoam.cxx:875
 PDEFoam.cxx:876
 PDEFoam.cxx:877
 PDEFoam.cxx:878
 PDEFoam.cxx:879
 PDEFoam.cxx:880
 PDEFoam.cxx:881
 PDEFoam.cxx:882
 PDEFoam.cxx:883
 PDEFoam.cxx:884
 PDEFoam.cxx:885
 PDEFoam.cxx:886
 PDEFoam.cxx:887
 PDEFoam.cxx:888
 PDEFoam.cxx:889
 PDEFoam.cxx:890
 PDEFoam.cxx:891
 PDEFoam.cxx:892
 PDEFoam.cxx:893
 PDEFoam.cxx:894
 PDEFoam.cxx:895
 PDEFoam.cxx:896
 PDEFoam.cxx:897
 PDEFoam.cxx:898
 PDEFoam.cxx:899
 PDEFoam.cxx:900
 PDEFoam.cxx:901
 PDEFoam.cxx:902
 PDEFoam.cxx:903
 PDEFoam.cxx:904
 PDEFoam.cxx:905
 PDEFoam.cxx:906
 PDEFoam.cxx:907
 PDEFoam.cxx:908
 PDEFoam.cxx:909
 PDEFoam.cxx:910
 PDEFoam.cxx:911
 PDEFoam.cxx:912
 PDEFoam.cxx:913
 PDEFoam.cxx:914
 PDEFoam.cxx:915
 PDEFoam.cxx:916
 PDEFoam.cxx:917
 PDEFoam.cxx:918
 PDEFoam.cxx:919
 PDEFoam.cxx:920
 PDEFoam.cxx:921
 PDEFoam.cxx:922
 PDEFoam.cxx:923
 PDEFoam.cxx:924
 PDEFoam.cxx:925
 PDEFoam.cxx:926
 PDEFoam.cxx:927
 PDEFoam.cxx:928
 PDEFoam.cxx:929
 PDEFoam.cxx:930
 PDEFoam.cxx:931
 PDEFoam.cxx:932
 PDEFoam.cxx:933
 PDEFoam.cxx:934
 PDEFoam.cxx:935
 PDEFoam.cxx:936
 PDEFoam.cxx:937
 PDEFoam.cxx:938
 PDEFoam.cxx:939
 PDEFoam.cxx:940
 PDEFoam.cxx:941
 PDEFoam.cxx:942
 PDEFoam.cxx:943
 PDEFoam.cxx:944
 PDEFoam.cxx:945
 PDEFoam.cxx:946
 PDEFoam.cxx:947
 PDEFoam.cxx:948
 PDEFoam.cxx:949
 PDEFoam.cxx:950
 PDEFoam.cxx:951
 PDEFoam.cxx:952
 PDEFoam.cxx:953
 PDEFoam.cxx:954
 PDEFoam.cxx:955
 PDEFoam.cxx:956
 PDEFoam.cxx:957
 PDEFoam.cxx:958
 PDEFoam.cxx:959
 PDEFoam.cxx:960
 PDEFoam.cxx:961
 PDEFoam.cxx:962
 PDEFoam.cxx:963
 PDEFoam.cxx:964
 PDEFoam.cxx:965
 PDEFoam.cxx:966
 PDEFoam.cxx:967
 PDEFoam.cxx:968
 PDEFoam.cxx:969
 PDEFoam.cxx:970
 PDEFoam.cxx:971
 PDEFoam.cxx:972
 PDEFoam.cxx:973
 PDEFoam.cxx:974
 PDEFoam.cxx:975
 PDEFoam.cxx:976
 PDEFoam.cxx:977
 PDEFoam.cxx:978
 PDEFoam.cxx:979
 PDEFoam.cxx:980
 PDEFoam.cxx:981
 PDEFoam.cxx:982
 PDEFoam.cxx:983
 PDEFoam.cxx:984
 PDEFoam.cxx:985
 PDEFoam.cxx:986
 PDEFoam.cxx:987
 PDEFoam.cxx:988
 PDEFoam.cxx:989
 PDEFoam.cxx:990
 PDEFoam.cxx:991
 PDEFoam.cxx:992
 PDEFoam.cxx:993
 PDEFoam.cxx:994
 PDEFoam.cxx:995
 PDEFoam.cxx:996
 PDEFoam.cxx:997
 PDEFoam.cxx:998
 PDEFoam.cxx:999
 PDEFoam.cxx:1000
 PDEFoam.cxx:1001
 PDEFoam.cxx:1002
 PDEFoam.cxx:1003
 PDEFoam.cxx:1004
 PDEFoam.cxx:1005
 PDEFoam.cxx:1006
 PDEFoam.cxx:1007
 PDEFoam.cxx:1008
 PDEFoam.cxx:1009
 PDEFoam.cxx:1010
 PDEFoam.cxx:1011
 PDEFoam.cxx:1012
 PDEFoam.cxx:1013
 PDEFoam.cxx:1014
 PDEFoam.cxx:1015
 PDEFoam.cxx:1016
 PDEFoam.cxx:1017
 PDEFoam.cxx:1018
 PDEFoam.cxx:1019
 PDEFoam.cxx:1020
 PDEFoam.cxx:1021
 PDEFoam.cxx:1022
 PDEFoam.cxx:1023
 PDEFoam.cxx:1024
 PDEFoam.cxx:1025
 PDEFoam.cxx:1026
 PDEFoam.cxx:1027
 PDEFoam.cxx:1028
 PDEFoam.cxx:1029
 PDEFoam.cxx:1030
 PDEFoam.cxx:1031
 PDEFoam.cxx:1032
 PDEFoam.cxx:1033
 PDEFoam.cxx:1034
 PDEFoam.cxx:1035
 PDEFoam.cxx:1036
 PDEFoam.cxx:1037
 PDEFoam.cxx:1038
 PDEFoam.cxx:1039
 PDEFoam.cxx:1040
 PDEFoam.cxx:1041
 PDEFoam.cxx:1042
 PDEFoam.cxx:1043
 PDEFoam.cxx:1044
 PDEFoam.cxx:1045
 PDEFoam.cxx:1046
 PDEFoam.cxx:1047
 PDEFoam.cxx:1048
 PDEFoam.cxx:1049
 PDEFoam.cxx:1050
 PDEFoam.cxx:1051
 PDEFoam.cxx:1052
 PDEFoam.cxx:1053
 PDEFoam.cxx:1054
 PDEFoam.cxx:1055
 PDEFoam.cxx:1056
 PDEFoam.cxx:1057
 PDEFoam.cxx:1058
 PDEFoam.cxx:1059
 PDEFoam.cxx:1060
 PDEFoam.cxx:1061
 PDEFoam.cxx:1062
 PDEFoam.cxx:1063
 PDEFoam.cxx:1064
 PDEFoam.cxx:1065
 PDEFoam.cxx:1066
 PDEFoam.cxx:1067
 PDEFoam.cxx:1068
 PDEFoam.cxx:1069
 PDEFoam.cxx:1070
 PDEFoam.cxx:1071
 PDEFoam.cxx:1072
 PDEFoam.cxx:1073
 PDEFoam.cxx:1074
 PDEFoam.cxx:1075
 PDEFoam.cxx:1076
 PDEFoam.cxx:1077
 PDEFoam.cxx:1078
 PDEFoam.cxx:1079
 PDEFoam.cxx:1080
 PDEFoam.cxx:1081
 PDEFoam.cxx:1082
 PDEFoam.cxx:1083
 PDEFoam.cxx:1084
 PDEFoam.cxx:1085
 PDEFoam.cxx:1086
 PDEFoam.cxx:1087
 PDEFoam.cxx:1088
 PDEFoam.cxx:1089
 PDEFoam.cxx:1090
 PDEFoam.cxx:1091
 PDEFoam.cxx:1092
 PDEFoam.cxx:1093
 PDEFoam.cxx:1094
 PDEFoam.cxx:1095
 PDEFoam.cxx:1096
 PDEFoam.cxx:1097
 PDEFoam.cxx:1098
 PDEFoam.cxx:1099
 PDEFoam.cxx:1100
 PDEFoam.cxx:1101
 PDEFoam.cxx:1102
 PDEFoam.cxx:1103
 PDEFoam.cxx:1104
 PDEFoam.cxx:1105
 PDEFoam.cxx:1106
 PDEFoam.cxx:1107
 PDEFoam.cxx:1108
 PDEFoam.cxx:1109
 PDEFoam.cxx:1110
 PDEFoam.cxx:1111
 PDEFoam.cxx:1112
 PDEFoam.cxx:1113
 PDEFoam.cxx:1114
 PDEFoam.cxx:1115
 PDEFoam.cxx:1116
 PDEFoam.cxx:1117
 PDEFoam.cxx:1118
 PDEFoam.cxx:1119
 PDEFoam.cxx:1120
 PDEFoam.cxx:1121
 PDEFoam.cxx:1122
 PDEFoam.cxx:1123
 PDEFoam.cxx:1124
 PDEFoam.cxx:1125
 PDEFoam.cxx:1126
 PDEFoam.cxx:1127
 PDEFoam.cxx:1128
 PDEFoam.cxx:1129
 PDEFoam.cxx:1130
 PDEFoam.cxx:1131
 PDEFoam.cxx:1132
 PDEFoam.cxx:1133
 PDEFoam.cxx:1134
 PDEFoam.cxx:1135
 PDEFoam.cxx:1136
 PDEFoam.cxx:1137
 PDEFoam.cxx:1138
 PDEFoam.cxx:1139
 PDEFoam.cxx:1140
 PDEFoam.cxx:1141
 PDEFoam.cxx:1142
 PDEFoam.cxx:1143
 PDEFoam.cxx:1144
 PDEFoam.cxx:1145
 PDEFoam.cxx:1146
 PDEFoam.cxx:1147
 PDEFoam.cxx:1148
 PDEFoam.cxx:1149
 PDEFoam.cxx:1150
 PDEFoam.cxx:1151
 PDEFoam.cxx:1152
 PDEFoam.cxx:1153
 PDEFoam.cxx:1154
 PDEFoam.cxx:1155
 PDEFoam.cxx:1156
 PDEFoam.cxx:1157
 PDEFoam.cxx:1158
 PDEFoam.cxx:1159
 PDEFoam.cxx:1160
 PDEFoam.cxx:1161
 PDEFoam.cxx:1162
 PDEFoam.cxx:1163
 PDEFoam.cxx:1164
 PDEFoam.cxx:1165
 PDEFoam.cxx:1166
 PDEFoam.cxx:1167
 PDEFoam.cxx:1168
 PDEFoam.cxx:1169
 PDEFoam.cxx:1170
 PDEFoam.cxx:1171
 PDEFoam.cxx:1172
 PDEFoam.cxx:1173
 PDEFoam.cxx:1174
 PDEFoam.cxx:1175
 PDEFoam.cxx:1176
 PDEFoam.cxx:1177
 PDEFoam.cxx:1178
 PDEFoam.cxx:1179
 PDEFoam.cxx:1180
 PDEFoam.cxx:1181
 PDEFoam.cxx:1182
 PDEFoam.cxx:1183
 PDEFoam.cxx:1184
 PDEFoam.cxx:1185
 PDEFoam.cxx:1186
 PDEFoam.cxx:1187
 PDEFoam.cxx:1188
 PDEFoam.cxx:1189
 PDEFoam.cxx:1190
 PDEFoam.cxx:1191
 PDEFoam.cxx:1192
 PDEFoam.cxx:1193
 PDEFoam.cxx:1194
 PDEFoam.cxx:1195
 PDEFoam.cxx:1196
 PDEFoam.cxx:1197
 PDEFoam.cxx:1198
 PDEFoam.cxx:1199
 PDEFoam.cxx:1200
 PDEFoam.cxx:1201
 PDEFoam.cxx:1202
 PDEFoam.cxx:1203
 PDEFoam.cxx:1204
 PDEFoam.cxx:1205
 PDEFoam.cxx:1206
 PDEFoam.cxx:1207
 PDEFoam.cxx:1208
 PDEFoam.cxx:1209
 PDEFoam.cxx:1210
 PDEFoam.cxx:1211
 PDEFoam.cxx:1212
 PDEFoam.cxx:1213
 PDEFoam.cxx:1214
 PDEFoam.cxx:1215
 PDEFoam.cxx:1216
 PDEFoam.cxx:1217
 PDEFoam.cxx:1218
 PDEFoam.cxx:1219
 PDEFoam.cxx:1220
 PDEFoam.cxx:1221
 PDEFoam.cxx:1222
 PDEFoam.cxx:1223
 PDEFoam.cxx:1224
 PDEFoam.cxx:1225
 PDEFoam.cxx:1226
 PDEFoam.cxx:1227
 PDEFoam.cxx:1228
 PDEFoam.cxx:1229
 PDEFoam.cxx:1230
 PDEFoam.cxx:1231
 PDEFoam.cxx:1232
 PDEFoam.cxx:1233
 PDEFoam.cxx:1234
 PDEFoam.cxx:1235
 PDEFoam.cxx:1236
 PDEFoam.cxx:1237
 PDEFoam.cxx:1238
 PDEFoam.cxx:1239
 PDEFoam.cxx:1240
 PDEFoam.cxx:1241
 PDEFoam.cxx:1242
 PDEFoam.cxx:1243
 PDEFoam.cxx:1244
 PDEFoam.cxx:1245
 PDEFoam.cxx:1246
 PDEFoam.cxx:1247
 PDEFoam.cxx:1248
 PDEFoam.cxx:1249
 PDEFoam.cxx:1250
 PDEFoam.cxx:1251
 PDEFoam.cxx:1252
 PDEFoam.cxx:1253
 PDEFoam.cxx:1254
 PDEFoam.cxx:1255
 PDEFoam.cxx:1256
 PDEFoam.cxx:1257
 PDEFoam.cxx:1258
 PDEFoam.cxx:1259
 PDEFoam.cxx:1260
 PDEFoam.cxx:1261
 PDEFoam.cxx:1262
 PDEFoam.cxx:1263
 PDEFoam.cxx:1264
 PDEFoam.cxx:1265
 PDEFoam.cxx:1266
 PDEFoam.cxx:1267
 PDEFoam.cxx:1268
 PDEFoam.cxx:1269
 PDEFoam.cxx:1270
 PDEFoam.cxx:1271
 PDEFoam.cxx:1272
 PDEFoam.cxx:1273
 PDEFoam.cxx:1274
 PDEFoam.cxx:1275
 PDEFoam.cxx:1276
 PDEFoam.cxx:1277
 PDEFoam.cxx:1278
 PDEFoam.cxx:1279
 PDEFoam.cxx:1280
 PDEFoam.cxx:1281
 PDEFoam.cxx:1282
 PDEFoam.cxx:1283
 PDEFoam.cxx:1284
 PDEFoam.cxx:1285
 PDEFoam.cxx:1286
 PDEFoam.cxx:1287
 PDEFoam.cxx:1288
 PDEFoam.cxx:1289
 PDEFoam.cxx:1290
 PDEFoam.cxx:1291
 PDEFoam.cxx:1292
 PDEFoam.cxx:1293
 PDEFoam.cxx:1294
 PDEFoam.cxx:1295
 PDEFoam.cxx:1296
 PDEFoam.cxx:1297
 PDEFoam.cxx:1298
 PDEFoam.cxx:1299
 PDEFoam.cxx:1300
 PDEFoam.cxx:1301
 PDEFoam.cxx:1302
 PDEFoam.cxx:1303
 PDEFoam.cxx:1304
 PDEFoam.cxx:1305
 PDEFoam.cxx:1306
 PDEFoam.cxx:1307
 PDEFoam.cxx:1308
 PDEFoam.cxx:1309
 PDEFoam.cxx:1310
 PDEFoam.cxx:1311
 PDEFoam.cxx:1312
 PDEFoam.cxx:1313
 PDEFoam.cxx:1314
 PDEFoam.cxx:1315
 PDEFoam.cxx:1316
 PDEFoam.cxx:1317
 PDEFoam.cxx:1318
 PDEFoam.cxx:1319
 PDEFoam.cxx:1320
 PDEFoam.cxx:1321
 PDEFoam.cxx:1322
 PDEFoam.cxx:1323
 PDEFoam.cxx:1324
 PDEFoam.cxx:1325
 PDEFoam.cxx:1326
 PDEFoam.cxx:1327
 PDEFoam.cxx:1328
 PDEFoam.cxx:1329
 PDEFoam.cxx:1330
 PDEFoam.cxx:1331
 PDEFoam.cxx:1332
 PDEFoam.cxx:1333
 PDEFoam.cxx:1334
 PDEFoam.cxx:1335
 PDEFoam.cxx:1336
 PDEFoam.cxx:1337
 PDEFoam.cxx:1338
 PDEFoam.cxx:1339
 PDEFoam.cxx:1340
 PDEFoam.cxx:1341
 PDEFoam.cxx:1342
 PDEFoam.cxx:1343
 PDEFoam.cxx:1344
 PDEFoam.cxx:1345
 PDEFoam.cxx:1346
 PDEFoam.cxx:1347
 PDEFoam.cxx:1348
 PDEFoam.cxx:1349
 PDEFoam.cxx:1350
 PDEFoam.cxx:1351
 PDEFoam.cxx:1352
 PDEFoam.cxx:1353
 PDEFoam.cxx:1354
 PDEFoam.cxx:1355
 PDEFoam.cxx:1356
 PDEFoam.cxx:1357
 PDEFoam.cxx:1358
 PDEFoam.cxx:1359
 PDEFoam.cxx:1360
 PDEFoam.cxx:1361
 PDEFoam.cxx:1362
 PDEFoam.cxx:1363
 PDEFoam.cxx:1364
 PDEFoam.cxx:1365
 PDEFoam.cxx:1366
 PDEFoam.cxx:1367
 PDEFoam.cxx:1368
 PDEFoam.cxx:1369
 PDEFoam.cxx:1370
 PDEFoam.cxx:1371
 PDEFoam.cxx:1372
 PDEFoam.cxx:1373
 PDEFoam.cxx:1374
 PDEFoam.cxx:1375
 PDEFoam.cxx:1376
 PDEFoam.cxx:1377
 PDEFoam.cxx:1378
 PDEFoam.cxx:1379
 PDEFoam.cxx:1380
 PDEFoam.cxx:1381
 PDEFoam.cxx:1382
 PDEFoam.cxx:1383
 PDEFoam.cxx:1384
 PDEFoam.cxx:1385
 PDEFoam.cxx:1386
 PDEFoam.cxx:1387
 PDEFoam.cxx:1388
 PDEFoam.cxx:1389
 PDEFoam.cxx:1390
 PDEFoam.cxx:1391
 PDEFoam.cxx:1392
 PDEFoam.cxx:1393
 PDEFoam.cxx:1394
 PDEFoam.cxx:1395
 PDEFoam.cxx:1396
 PDEFoam.cxx:1397
 PDEFoam.cxx:1398
 PDEFoam.cxx:1399
 PDEFoam.cxx:1400
 PDEFoam.cxx:1401
 PDEFoam.cxx:1402
 PDEFoam.cxx:1403
 PDEFoam.cxx:1404
 PDEFoam.cxx:1405
 PDEFoam.cxx:1406
 PDEFoam.cxx:1407
 PDEFoam.cxx:1408
 PDEFoam.cxx:1409
 PDEFoam.cxx:1410
 PDEFoam.cxx:1411
 PDEFoam.cxx:1412
 PDEFoam.cxx:1413
 PDEFoam.cxx:1414
 PDEFoam.cxx:1415
 PDEFoam.cxx:1416
 PDEFoam.cxx:1417
 PDEFoam.cxx:1418
 PDEFoam.cxx:1419
 PDEFoam.cxx:1420
 PDEFoam.cxx:1421
 PDEFoam.cxx:1422
 PDEFoam.cxx:1423
 PDEFoam.cxx:1424
 PDEFoam.cxx:1425
 PDEFoam.cxx:1426
 PDEFoam.cxx:1427
 PDEFoam.cxx:1428
 PDEFoam.cxx:1429
 PDEFoam.cxx:1430
 PDEFoam.cxx:1431
 PDEFoam.cxx:1432
 PDEFoam.cxx:1433
 PDEFoam.cxx:1434
 PDEFoam.cxx:1435
 PDEFoam.cxx:1436
 PDEFoam.cxx:1437
 PDEFoam.cxx:1438
 PDEFoam.cxx:1439
 PDEFoam.cxx:1440
 PDEFoam.cxx:1441
 PDEFoam.cxx:1442
 PDEFoam.cxx:1443
 PDEFoam.cxx:1444
 PDEFoam.cxx:1445
 PDEFoam.cxx:1446
 PDEFoam.cxx:1447
 PDEFoam.cxx:1448
 PDEFoam.cxx:1449
 PDEFoam.cxx:1450
 PDEFoam.cxx:1451
 PDEFoam.cxx:1452
 PDEFoam.cxx:1453
 PDEFoam.cxx:1454
 PDEFoam.cxx:1455
 PDEFoam.cxx:1456
 PDEFoam.cxx:1457
 PDEFoam.cxx:1458
 PDEFoam.cxx:1459
 PDEFoam.cxx:1460
 PDEFoam.cxx:1461
 PDEFoam.cxx:1462
 PDEFoam.cxx:1463
 PDEFoam.cxx:1464
 PDEFoam.cxx:1465
 PDEFoam.cxx:1466
 PDEFoam.cxx:1467
 PDEFoam.cxx:1468
 PDEFoam.cxx:1469
 PDEFoam.cxx:1470
 PDEFoam.cxx:1471
 PDEFoam.cxx:1472
 PDEFoam.cxx:1473
 PDEFoam.cxx:1474
 PDEFoam.cxx:1475
 PDEFoam.cxx:1476
 PDEFoam.cxx:1477
 PDEFoam.cxx:1478
 PDEFoam.cxx:1479
 PDEFoam.cxx:1480
 PDEFoam.cxx:1481
 PDEFoam.cxx:1482
 PDEFoam.cxx:1483
 PDEFoam.cxx:1484
 PDEFoam.cxx:1485
 PDEFoam.cxx:1486
 PDEFoam.cxx:1487
 PDEFoam.cxx:1488
 PDEFoam.cxx:1489
 PDEFoam.cxx:1490
 PDEFoam.cxx:1491
 PDEFoam.cxx:1492
 PDEFoam.cxx:1493
 PDEFoam.cxx:1494
 PDEFoam.cxx:1495
 PDEFoam.cxx:1496
 PDEFoam.cxx:1497
 PDEFoam.cxx:1498
 PDEFoam.cxx:1499
 PDEFoam.cxx:1500
 PDEFoam.cxx:1501
 PDEFoam.cxx:1502
 PDEFoam.cxx:1503
 PDEFoam.cxx:1504
 PDEFoam.cxx:1505
 PDEFoam.cxx:1506
 PDEFoam.cxx:1507
 PDEFoam.cxx:1508
 PDEFoam.cxx:1509
 PDEFoam.cxx:1510
 PDEFoam.cxx:1511
 PDEFoam.cxx:1512
 PDEFoam.cxx:1513
 PDEFoam.cxx:1514
 PDEFoam.cxx:1515
 PDEFoam.cxx:1516
 PDEFoam.cxx:1517
 PDEFoam.cxx:1518
 PDEFoam.cxx:1519
 PDEFoam.cxx:1520
 PDEFoam.cxx:1521
 PDEFoam.cxx:1522
 PDEFoam.cxx:1523
 PDEFoam.cxx:1524
 PDEFoam.cxx:1525
 PDEFoam.cxx:1526
 PDEFoam.cxx:1527
 PDEFoam.cxx:1528
 PDEFoam.cxx:1529
 PDEFoam.cxx:1530
 PDEFoam.cxx:1531
 PDEFoam.cxx:1532
 PDEFoam.cxx:1533
 PDEFoam.cxx:1534
 PDEFoam.cxx:1535
 PDEFoam.cxx:1536
 PDEFoam.cxx:1537
 PDEFoam.cxx:1538
 PDEFoam.cxx:1539
 PDEFoam.cxx:1540
 PDEFoam.cxx:1541
 PDEFoam.cxx:1542
 PDEFoam.cxx:1543
 PDEFoam.cxx:1544
 PDEFoam.cxx:1545
 PDEFoam.cxx:1546
 PDEFoam.cxx:1547
 PDEFoam.cxx:1548
 PDEFoam.cxx:1549
 PDEFoam.cxx:1550
 PDEFoam.cxx:1551
 PDEFoam.cxx:1552
 PDEFoam.cxx:1553
 PDEFoam.cxx:1554
 PDEFoam.cxx:1555
 PDEFoam.cxx:1556
 PDEFoam.cxx:1557
 PDEFoam.cxx:1558
 PDEFoam.cxx:1559
 PDEFoam.cxx:1560
 PDEFoam.cxx:1561
 PDEFoam.cxx:1562
 PDEFoam.cxx:1563
 PDEFoam.cxx:1564
 PDEFoam.cxx:1565
 PDEFoam.cxx:1566
 PDEFoam.cxx:1567
 PDEFoam.cxx:1568
 PDEFoam.cxx:1569
 PDEFoam.cxx:1570
 PDEFoam.cxx:1571
 PDEFoam.cxx:1572
 PDEFoam.cxx:1573
 PDEFoam.cxx:1574
 PDEFoam.cxx:1575
 PDEFoam.cxx:1576
 PDEFoam.cxx:1577
 PDEFoam.cxx:1578
 PDEFoam.cxx:1579
 PDEFoam.cxx:1580
 PDEFoam.cxx:1581
 PDEFoam.cxx:1582
 PDEFoam.cxx:1583
 PDEFoam.cxx:1584
 PDEFoam.cxx:1585
 PDEFoam.cxx:1586
 PDEFoam.cxx:1587
 PDEFoam.cxx:1588
 PDEFoam.cxx:1589
 PDEFoam.cxx:1590
 PDEFoam.cxx:1591
 PDEFoam.cxx:1592
 PDEFoam.cxx:1593
 PDEFoam.cxx:1594
 PDEFoam.cxx:1595
 PDEFoam.cxx:1596
 PDEFoam.cxx:1597
 PDEFoam.cxx:1598
 PDEFoam.cxx:1599
 PDEFoam.cxx:1600
 PDEFoam.cxx:1601
 PDEFoam.cxx:1602
 PDEFoam.cxx:1603
 PDEFoam.cxx:1604
 PDEFoam.cxx:1605
 PDEFoam.cxx:1606
 PDEFoam.cxx:1607
 PDEFoam.cxx:1608
 PDEFoam.cxx:1609
 PDEFoam.cxx:1610
 PDEFoam.cxx:1611
 PDEFoam.cxx:1612
 PDEFoam.cxx:1613
 PDEFoam.cxx:1614
 PDEFoam.cxx:1615
 PDEFoam.cxx:1616
 PDEFoam.cxx:1617
 PDEFoam.cxx:1618
 PDEFoam.cxx:1619
 PDEFoam.cxx:1620
 PDEFoam.cxx:1621
 PDEFoam.cxx:1622
 PDEFoam.cxx:1623
 PDEFoam.cxx:1624
 PDEFoam.cxx:1625
 PDEFoam.cxx:1626
 PDEFoam.cxx:1627
 PDEFoam.cxx:1628
 PDEFoam.cxx:1629
 PDEFoam.cxx:1630
 PDEFoam.cxx:1631
 PDEFoam.cxx:1632
 PDEFoam.cxx:1633
 PDEFoam.cxx:1634
 PDEFoam.cxx:1635
 PDEFoam.cxx:1636
 PDEFoam.cxx:1637
 PDEFoam.cxx:1638
 PDEFoam.cxx:1639
 PDEFoam.cxx:1640
 PDEFoam.cxx:1641
 PDEFoam.cxx:1642
 PDEFoam.cxx:1643
 PDEFoam.cxx:1644
 PDEFoam.cxx:1645
 PDEFoam.cxx:1646
 PDEFoam.cxx:1647
 PDEFoam.cxx:1648
 PDEFoam.cxx:1649
 PDEFoam.cxx:1650
 PDEFoam.cxx:1651
 PDEFoam.cxx:1652
 PDEFoam.cxx:1653
 PDEFoam.cxx:1654
 PDEFoam.cxx:1655
 PDEFoam.cxx:1656
 PDEFoam.cxx:1657
 PDEFoam.cxx:1658
 PDEFoam.cxx:1659
 PDEFoam.cxx:1660
 PDEFoam.cxx:1661
 PDEFoam.cxx:1662
 PDEFoam.cxx:1663
 PDEFoam.cxx:1664
 PDEFoam.cxx:1665
 PDEFoam.cxx:1666
 PDEFoam.cxx:1667
 PDEFoam.cxx:1668
 PDEFoam.cxx:1669
 PDEFoam.cxx:1670
 PDEFoam.cxx:1671