Logo ROOT   6.12/07
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 
30 Class that contains all the data information.
31 
32 */
33 
34 #include <vector>
35 #include <iostream>
36 using 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),
62 fDataInput(0),
64 fLogger( 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 {
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
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 }
DataSetInfo * GetDataSetInfo(const TString &dsiName)
returns datasetinfo object for given name
MsgLogger & Endl(MsgLogger &ml)
Definition: MsgLogger.h:158
DataInputHandler * fDataInput
DataSet * CreateDataSet(const TString &dsiName)
Creates the singleton dataset.
Basic string class.
Definition: TString.h:125
void SetDataSetManager(DataSetManager *dsm)
Definition: DataSetInfo.h:179
virtual TObject * FindObject(const char *name) const
Delete a TObjLink object.
Definition: TList.cxx:574
DataSetManager()
constructor
Class that contains all the data information.
Class that contains all the data information.
Definition: DataSetInfo.h:60
Class that contains all the data information.
Definition: DataSet.h:69
Class that contains all the data information.
DataSet * CreateDataSet(DataSetInfo &, DataInputHandler &)
steering the creation of a new dataset
DataSetInfo & AddDataSetInfo(DataSetInfo &dsi)
stores a copy of the dataset info object
MsgLogger & Log() const
message logger
TMVA::DataSetFactory * fDatasetFactory
virtual const char * GetName() const
Returns name of object.
Definition: DataSetInfo.h:67
ostringstream derivative to redirect and format output
Definition: MsgLogger.h:59
virtual void Add(TObject *obj)
Definition: TList.h:87
~DataSetManager()
destructor fDataSetInfoCollection.SetOwner(); // DSMTEST –> created a segfault because the DataSetIn...