//C++ includes #include #include #include #include #include #include //Root includes #include "TBrowser.h" #include "TCanvas.h" #include "TFile.h" #include "TH1D.h" #include "TH1F.h" #include "TLeaf.h" #include "TTree.h" #include "TMatrixD.h" #include "TGraph.h" #include "TPad.h" #include "TLatex.h" #include "TRandom.h" #include "TMatrixD.h" #include "TCanvas.h" #include "TH2D.h" #include "TMatrixDEigen.h" #include "TRandom.h" #include "TSystem.h" #include "TStopwatch.h" //KDE Includes //#include "../include/KDE.h" //#include "../include/FileUtils.h" //#include "../include/StringUtils.h" using namespace std; //using namespace pde_tools; int split(const string& original, const string& delimiter, vector& results) { int numFound = 0; int currentPos=0, findPos=0; results.clear(); findPos = original.find( delimiter, 0); while( 0 <= findPos){ assert( currentPos < original.size() ); if( findPos - currentPos > 1){ //make sure the token value is not empty numFound++; results.push_back( original.substr(currentPos, findPos - currentPos) ); } //cout<<"token("<GetName()<<" to TMatrixD . . ."< variablesVec; string variableString(variableList); Int_t numberVars = split(variableString, ":", variablesVec); assert( numberVars == (Int_t)variablesVec.size() ); printf("%d variables in variableVec\n", variablesVec.size() ); int rows = dataTree->GetEntries(); int columns = variablesVec.size(); dataMatrix->Clear(); dataMatrix->ResizeTo( rows, columns ); for(int i=0; i < rows; ++i){ Long64_t bytesRead = dataTree->GetEntry(i); for(int j=0; j< columns; j++){ //cout<<"getting "<GetLeaf( variablesVec[j].c_str() )->GetValue( ); //cout<< dataTree->GetLeaf( variablesVec[j].c_str() )->GetValue(0) << endl; } } cout << "Built TMatrixD: (" << dataMatrix->GetNrows() << "," << dataMatrix->GetNcols() << ") matrix"<Fill( ); tree.Fill( ); } delete[] leaves; } int memError(){ static const Int_t numberOfTrainingEvents = 3000; static const Int_t numberOfTestEvents = 30; static const Int_t numberOfVariables = 100; cout<<"Testing KDE . . ."<GetName()<GetName()<GetName()<Delete(); bgData->Delete(); testData->Delete(); testTree->Delete(); signalTree->Delete(); bgTree->Delete(); cout<<"\ntest complete."<Load("libTree"); memError(); }