DataSetManager.cxx

Go to the documentation of this file.
00001 // @(#)root/tmva $Id: DataSetManager.cxx 33928 2010-06-15 16:19:31Z stelzer $
00002 // Author: Andreas Hoecker, Peter Speckmayer, Joerg Stelzer, Helge Voss
00003 
00004 /**********************************************************************************
00005  * Project: TMVA - a Root-integrated toolkit for multivariate data analysis       *
00006  * Package: TMVA                                                                  *
00007  * Class  : DataSetManager                                                        *
00008  * Web    : http://tmva.sourceforge.net                                           *
00009  *                                                                                *
00010  * Description:                                                                   *
00011  *      Implementation (see header for description)                               *
00012  *                                                                                *
00013  * Authors (alphabetical):                                                        *
00014  *      Andreas Hoecker <Andreas.Hocker@cern.ch> - CERN, Switzerland              *
00015  *      Joerg Stelzer   <Joerg.Stelzer@cern.ch>  - CERN, Switzerland              *
00016  *      Helge Voss      <Helge.Voss@cern.ch>     - MPI-K Heidelberg, Germany      *
00017  *                                                                                *
00018  * Copyright (c) 2006:                                                            *
00019  *      CERN, Switzerland                                                         *
00020  *      MPI-K Heidelberg, Germany                                                 *
00021  *                                                                                *
00022  * Redistribution and use in source and binary forms, with or without             *
00023  * modification, are permitted according to the terms listed in LICENSE           *
00024  * (http://tmva.sourceforge.net/LICENSE)                                          *
00025  **********************************************************************************/
00026 
00027 #include <vector>
00028 #include <iostream>
00029 using std::endl;
00030 
00031 #ifndef ROOT_TMVA_DataSetManager
00032 #include "TMVA/DataSetManager.h"
00033 #endif
00034 #ifndef ROOT_TMVA_DataSetFactory
00035 #include "TMVA/DataSetFactory.h"
00036 #endif
00037 #ifndef ROOT_TMVA_DataSet
00038 #include "TMVA/DataSet.h"
00039 #endif
00040 #ifndef ROOT_TMVA_DataSetInfo
00041 #include "TMVA/DataSetInfo.h"
00042 #endif
00043 #ifndef ROOT_TMVA_MsgLogger
00044 #include "TMVA/MsgLogger.h"
00045 #endif
00046 
00047 //TMVA::DataSetManager* TMVA::DataSetManager::fgDSManager = 0; // DSMTEST removed
00048 //TMVA::DataSetManager& TMVA::DataSetManager::Instance() { return *fgDSManager; }      // DSMTEST removed
00049 // void TMVA::DataSetManager::CreateInstance( DataInputHandler& dataInput ) { fgDSManager = new DataSetManager(dataInput); } // DSMTEST removed
00050 
00051 // void TMVA::DataSetManager::DestroyInstance() { if (fgDSManager) { delete fgDSManager; fgDSManager=0; } } // DSMTEST removed
00052 
00053 //_______________________________________________________________________
00054 TMVA::DataSetManager::DataSetManager( DataInputHandler& dataInput ) 
00055    : fDataInput(dataInput),
00056      fDataSetInfoCollection(),
00057      fLogger( new MsgLogger("DataSetManager", kINFO) )
00058 {
00059    // constructor
00060 }
00061 
00062 //_______________________________________________________________________
00063 TMVA::DataSetManager::~DataSetManager() 
00064 {
00065    // destructor
00066 //   fDataSetInfoCollection.SetOwner(); // DSMTEST --> created a segfault because the DataSetInfo-objects got deleted twice
00067 
00068    TMVA::DataSetFactory::destroyInstance(); 
00069    
00070    delete fLogger;
00071 }
00072 
00073 //_______________________________________________________________________
00074 TMVA::DataSet* TMVA::DataSetManager::CreateDataSet( const TString& dsiName ) 
00075 {
00076    // Creates the singleton dataset 
00077    DataSetInfo* dsi = GetDataSetInfo( dsiName );
00078    if (!dsi) Log() << kFATAL << "DataSetInfo object '" << dsiName << "' not found" << Endl;
00079 
00080    // factory to create dataset from datasetinfo and datainput
00081    return TMVA::DataSetFactory::Instance().CreateDataSet( *dsi, fDataInput );
00082 }
00083 
00084 //_______________________________________________________________________
00085 TMVA::DataSetInfo* TMVA::DataSetManager::GetDataSetInfo(const TString& dsiName) 
00086 {
00087    // returns datasetinfo object for given name
00088    return (DataSetInfo*)fDataSetInfoCollection.FindObject( dsiName );
00089 }
00090 
00091 //_______________________________________________________________________
00092 TMVA::DataSetInfo& TMVA::DataSetManager::AddDataSetInfo(DataSetInfo& dsi) 
00093 {
00094    // stores a copy of the dataset info object
00095 
00096    dsi.SetDataSetManager( this ); // DSMTEST
00097 
00098    DataSetInfo * dsiInList = GetDataSetInfo(dsi.GetName());
00099    if (dsiInList!=0) return *dsiInList;
00100    fDataSetInfoCollection.Add( const_cast<DataSetInfo*>(&dsi) );
00101    return dsi;
00102 }

Generated on Tue Jul 5 15:16:47 2011 for ROOT_528-00b_version by  doxygen 1.5.1