Warning, file /include/root/TMVA/ClassifierFactory.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026 #ifndef ROOT_TMVA_ClassifierFactory
0027 #define ROOT_TMVA_ClassifierFactory
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042 #include <map>
0043 #include <string>
0044 #include <vector>
0045
0046
0047 #include "TString.h"
0048
0049
0050 namespace TMVA {
0051
0052 class IMethod;
0053 class DataSetInfo;
0054
0055 class ClassifierFactory {
0056
0057 public:
0058
0059
0060 typedef IMethod* (*Creator)(const TString& job, const TString& title,
0061 DataSetInfo& dsi, const TString& option );
0062
0063 public:
0064
0065 static ClassifierFactory& Instance();
0066 static void DestroyInstance();
0067
0068 Bool_t Register ( const std::string &name, Creator creator );
0069 Bool_t Unregister( const std::string &name );
0070
0071 IMethod* Create ( const std::string &name,
0072 const TString& job,
0073 const TString& title,
0074 DataSetInfo& dsi,
0075 const TString& option );
0076 IMethod* Create ( const std::string &name,
0077 DataSetInfo& dsi,
0078 const TString& weightfile ="" );
0079
0080 const std::vector<std::string> List() const;
0081
0082 void Print() const;
0083
0084 private:
0085
0086
0087 ClassifierFactory() {}
0088 ~ClassifierFactory() {}
0089
0090
0091
0092 ClassifierFactory( const ClassifierFactory& );
0093 const ClassifierFactory& operator =(const ClassifierFactory& );
0094
0095 private:
0096
0097 static ClassifierFactory *fgInstance;
0098 typedef std::map<std::string, Creator> CallMap;
0099
0100 CallMap fCalls;
0101 };
0102 }
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121
0122
0123
0124 #define REGISTER_METHOD(CLASS) \
0125 namespace \
0126 { \
0127 struct RegisterTMVAMethod { \
0128 static TMVA::IMethod* CreateMethod##CLASS(const TString& job, const TString& title, TMVA::DataSetInfo& dsi, const TString& option) \
0129 { \
0130 if(job=="" && title=="") { \
0131 return (TMVA::IMethod*) new TMVA::Method##CLASS(dsi, option); \
0132 } else { \
0133 return (TMVA::IMethod*) new TMVA::Method##CLASS(job, title, dsi, option); \
0134 } \
0135 } \
0136 RegisterTMVAMethod() { \
0137 TMVA::ClassifierFactory::Instance(). Register(#CLASS, CreateMethod##CLASS); \
0138 TMVA::Types::Instance().AddTypeMapping(TMVA::Types::k##CLASS, #CLASS); \
0139 } \
0140 }; \
0141 static RegisterTMVAMethod RegisterTMVAMethod_instance; \
0142 }
0143
0144
0145 #endif
0146
0147