Logo ROOT  
Reference Guide
DataSetManager.cxx
Go to the documentation of this file.
1// @(#)root/tmva $Id$
2// Author: Andreas Hoecker, Peter Speckmayer, Joerg Stelzer, Helge Voss
3
4/**********************************************************************************
5 * Project: TMVA - a Root-integrated toolkit for multivariate data analysis *
6 * Package: TMVA *
7 * Class : DataSetManager *
8 * Web : http://tmva.sourceforge.net *
9 * *
10 * Description: *
11 * Implementation (see header for description) *
12 * *
13 * Authors (alphabetical): *
14 * Andreas Hoecker <Andreas.Hocker@cern.ch> - CERN, Switzerland *
15 * Joerg Stelzer <Joerg.Stelzer@cern.ch> - CERN, Switzerland *
16 * Helge Voss <Helge.Voss@cern.ch> - MPI-K Heidelberg, Germany *
17 * *
18 * Copyright (c) 2006: *
19 * CERN, Switzerland *
20 * MPI-K Heidelberg, Germany *
21 * *
22 * Redistribution and use in source and binary forms, with or without *
23 * modification, are permitted according to the terms listed in LICENSE *
24 * (http://tmva.sourceforge.net/LICENSE) *
25 **********************************************************************************/
26
27/*! \class TMVA::DataSetManager
28\ingroup TMVA
29
30Class that contains all the data information.
31
32*/
33
34#include <vector>
35#include <iostream>
36using std::endl;
37
38#include "TMVA/DataSetManager.h"
39#include "TMVA/DataSetFactory.h"
40#include "TMVA/DataSet.h"
41#include "TMVA/DataSetInfo.h"
42#include "TMVA/MsgLogger.h"
43
44#include "TMVA/Types.h"
45
46////////////////////////////////////////////////////////////////////////////////
47/// constructor
48
50 : fDatasetFactory(0),
51 fDataInput(&dataInput),
52 fDataSetInfoCollection(),
53 fLogger( new MsgLogger("DataSetManager", kINFO) )
54{
55}
56
57////////////////////////////////////////////////////////////////////////////////
58/// constructor
59
61: fDatasetFactory(0),
62fDataInput(0),
63fDataSetInfoCollection(),
64fLogger( new MsgLogger("DataSetManager", kINFO) )
65{
66}
67
68
69////////////////////////////////////////////////////////////////////////////////
70/// destructor
71/// fDataSetInfoCollection.SetOwner(); // DSMTEST --> created a segfault because the DataSetInfo-objects got deleted twice
72
74{
75 if(fDatasetFactory) delete fDatasetFactory;
76
77 delete fLogger;
78}
79
80////////////////////////////////////////////////////////////////////////////////
81/// Creates the singleton dataset
82
84{
85 DataSetInfo* dsi = GetDataSetInfo( dsiName );
86 if (!dsi) Log() << kFATAL << "DataSetInfo object '" << dsiName << "' not found" << Endl;
87 if (!fDataInput ) Log() << kFATAL << "DataInputHandler object 'fDataInput' not found" << Endl;
88
89 // factory to create dataset from datasetinfo and datainput
90 if(!fDatasetFactory) { fDatasetFactory =new DataSetFactory(); }
91 return fDatasetFactory->CreateDataSet( *dsi, *fDataInput );
92}
93
94////////////////////////////////////////////////////////////////////////////////
95/// returns datasetinfo object for given name
96
98{
99 return (DataSetInfo*)fDataSetInfoCollection.FindObject( dsiName );
100}
101
102////////////////////////////////////////////////////////////////////////////////
103/// stores a copy of the dataset info object
104
106{
107 dsi.SetDataSetManager( this ); // DSMTEST
108
109 DataSetInfo * dsiInList = GetDataSetInfo(dsi.GetName());
110 if (dsiInList!=0) return *dsiInList;
111 fDataSetInfoCollection.Add( const_cast<DataSetInfo*>(&dsi) );
112 return dsi;
113}
Class that contains all the data information.
Class that contains all the data information.
Class that contains all the data information.
Definition: DataSetInfo.h:62
virtual const char * GetName() const
Returns name of object.
Definition: DataSetInfo.h:71
void SetDataSetManager(DataSetManager *dsm)
Definition: DataSetInfo.h:198
DataSetManager()
constructor
DataSetInfo * GetDataSetInfo(const TString &dsiName)
returns datasetinfo object for given name
~DataSetManager()
destructor fDataSetInfoCollection.SetOwner(); // DSMTEST --> created a segfault because the DataSetIn...
DataSet * CreateDataSet(const TString &dsiName)
Creates the singleton dataset.
DataSetInfo & AddDataSetInfo(DataSetInfo &dsi)
stores a copy of the dataset info object
Class that contains all the data information.
Definition: DataSet.h:58
ostringstream derivative to redirect and format output
Definition: MsgLogger.h:57
@ kINFO
Definition: Types.h:58
@ kFATAL
Definition: Types.h:61
virtual TObject * FindObject(const char *name) const
Must be redefined in derived classes.
Definition: TObject.cxx:323
Basic string class.
Definition: TString.h:136
MsgLogger & Endl(MsgLogger &ml)
Definition: MsgLogger.h:148
Double_t Log(Double_t x)
Returns the natural logarithm of x.
Definition: TMath.h:753