Logo ROOT   6.14/05
Reference Guide
MethodCategory.h
Go to the documentation of this file.
1 // @(#)root/tmva $Id$
2 // Author: Andreas Hoecker, Joerg Stelzer, Helge Voss, Kai Voss,Or Cohen
3 
4 /**********************************************************************************
5  * Project: TMVA - a Root-integrated toolkit for multivariate data analysis *
6  * Package: TMVA *
7  * Class : MethodCompositeBase *
8  * Web : http://tmva.sourceforge.net *
9  * *
10  * Description: *
11  * Virtual base class for all MVA method *
12  * *
13  * Authors (alphabetical): *
14  * Andreas Hoecker <Andreas.Hocker@cern.ch> - CERN, Switzerland *
15  * Joerg Stelzer <Joerg.Stelzer@cern.ch> - CERN, Switzerland *
16  * Peter Speckmayer <Peter.Speckmayer@cern.ch> - CERN, Switzerland *
17  * Helge Voss <Helge.Voss@cern.ch> - MPI-K Heidelberg, Germany *
18  * Eckhard v. Toerne <evt@uni-bonn.de> - U of Bonn, Germany *
19  * *
20  * Copyright (c) 2005: *
21  * CERN, Switzerland *
22  * U. of Victoria, Canada *
23  * MPI-K Heidelberg, Germany *
24  * LAPP, Annecy, France *
25  * *
26  * Redistribution and use in source and binary forms, with or without *
27  * modification, are permitted according to the terms listed in LICENSE *
28  * (http://tmva.sourceforge.net/LICENSE) *
29  **********************************************************************************/
30 
31 #ifndef ROOT_TMVA_MethodCategory
32 #define ROOT_TMVA_MethodCategory
33 
34 //////////////////////////////////////////////////////////////////////////
35 // //
36 // MethodCategory //
37 // //
38 // Class for categorizing the phase space //
39 // //
40 //////////////////////////////////////////////////////////////////////////
41 
42 #include <iosfwd>
43 #include <vector>
44 
45 #include "TMVA/MethodBase.h"
46 
48 
49 namespace TMVA {
50 
51  class Factory; // DSMTEST
52  class Reader; // DSMTEST
53  class MethodBoost; // DSMTEST
54  class DataSetManager; // DSMTEST
55  namespace Experimental {
56  class Classification;
57  }
60 
61  public :
62 
63  // constructors
64  MethodCategory( const TString& jobName,
65  const TString& methodTitle,
66  DataSetInfo& theData,
67  const TString& theOption = "" );
68 
70  const TString& theWeightFile );
71 
72  virtual ~MethodCategory( void );
73 
74  virtual Bool_t HasAnalysisType( Types::EAnalysisType type, UInt_t numberClasses, UInt_t /*numberTargets*/ );
75  // training and boosting all the classifiers
76  void Train( void );
77 
78  // ranking of input variables
79  const Ranking* CreateRanking();
80 
81  // saves the name and options string of the boosted classifier
82  TMVA::IMethod* AddMethod(const TCut&,
83  const TString& theVariables,
84  Types::EMVA theMethod,
85  const TString& theTitle,
86  const TString& theOptions);
87 
88  void AddWeightsXMLTo( void* parent ) const;
89  void ReadWeightsFromXML( void* wghtnode );
90 
91  Double_t GetMvaValue( Double_t* err=0, Double_t* errUpper = 0 );
92 
93  // regression response
94  virtual const std::vector<Float_t>& GetRegressionValues();
95 
96  virtual void MakeClass( const TString& = TString("") ) const {};
97 
98  private :
99 
100  // initializing mostly monitoring tools of the category process
101  void Init();
102 
103  // the option handling methods
104  void DeclareOptions();
105  void ProcessOptions();
106 
107  // build the cut formula for event categorization
108  Bool_t PassesCut( const Event* ev, UInt_t methodIdx );
109 
110  protected:
111 
112  // vectors that contain the added methods and the cuts on which they are to be called
113  std::vector<IMethod*> fMethods;
114  std::vector<TCut> fCategoryCuts;
115  std::vector<UInt_t> fCategorySpecIdx;
116  std::vector<TString> fVars;
117  std::vector <std::vector <UInt_t> > fVarMaps;
118 
119  // get help message text
120  void GetHelpMessage() const;
121 
122  TMVA::DataSetInfo& CreateCategoryDSI(const TCut&, const TString&, const TString&);
123 
124  private:
125 
126  void InitCircularTree(const DataSetInfo& dsi);
127 
128  TTree * fCatTree; //! needed in conjunction with TTreeFormulas for evaluation category expressions
129  std::vector<TTreeFormula*> fCatFormulas;
130 
132  friend class Factory; // DSMTEST
133  friend class Reader; // DSMTEST
134  friend class MethodBoost; // DSMTEST
135 
137  };
138 }
139 
140 #endif
std::vector< IMethod * > fMethods
virtual void MakeClass(const TString &=TString("")) const
create reader class for method (classification only at present)
EAnalysisType
Definition: Types.h:127
std::vector< TCut > fCategoryCuts
std::vector< UInt_t > fCategorySpecIdx
Basic string class.
Definition: TString.h:131
Ranking for variables in method (implementation)
Definition: Ranking.h:48
bool Bool_t
Definition: RtypesCore.h:59
std::vector< std::vector< UInt_t > > fVarMaps
#define ClassDef(name, id)
Definition: Rtypes.h:320
void Init(TClassEdit::TInterpreterLookupHelper *helper)
Definition: TClassEdit.cxx:121
Virtual base class for combining several TMVA method.
Class that contains all the data information.
Definition: DataSetInfo.h:60
Class for boosting a TMVA method.
Definition: MethodBoost.h:58
A specialized string object used for TTree selections.
Definition: TCut.h:25
std::vector< TTreeFormula * > fCatFormulas
needed in conjunction with TTreeFormulas for evaluation category expressions
unsigned int UInt_t
Definition: RtypesCore.h:42
DataSetManager * fDataSetManager
This is the main MVA steering class.
Definition: Factory.h:81
Class for categorizing the phase space.
double Double_t
Definition: RtypesCore.h:55
Class that contains all the data information.
int type
Definition: TGX11.cxx:120
std::vector< TString > fVars
Interface for all concrete MVA method implementations.
Definition: IMethod.h:54
The Reader class serves to use the MVAs in a specific analysis context.
Definition: Reader.h:63
Abstract ClassifierFactory template that handles arbitrary types.
A TTree object has a header with a name and a title.
Definition: TTree.h:70