Logo ROOT   6.10/09
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 
57 
58  public :
59 
60  // constructors
61  MethodCategory( const TString& jobName,
62  const TString& methodTitle,
63  DataSetInfo& theData,
64  const TString& theOption = "" );
65 
67  const TString& theWeightFile );
68 
69  virtual ~MethodCategory( void );
70 
71  virtual Bool_t HasAnalysisType( Types::EAnalysisType type, UInt_t numberClasses, UInt_t /*numberTargets*/ );
72  // training and boosting all the classifiers
73  void Train( void );
74 
75  // ranking of input variables
76  const Ranking* CreateRanking();
77 
78  // saves the name and options string of the boosted classifier
80  const TString& theVariables,
81  Types::EMVA theMethod,
82  const TString& theTitle,
83  const TString& theOptions);
84 
85  void AddWeightsXMLTo( void* parent ) const;
86  void ReadWeightsFromXML( void* wghtnode );
87 
88  Double_t GetMvaValue( Double_t* err=0, Double_t* errUpper = 0 );
89 
90  // regression response
91  virtual const std::vector<Float_t>& GetRegressionValues();
92 
93  virtual void MakeClass( const TString& = TString("") ) const {};
94 
95  private :
96 
97  // initializing mostly monitoring tools of the category process
98  void Init();
99 
100  // the option handling methods
101  void DeclareOptions();
102  void ProcessOptions();
103 
104  // build the cut formula for event categorization
105  Bool_t PassesCut( const Event* ev, UInt_t methodIdx );
106 
107  protected:
108 
109  // vectors that contain the added methods and the cuts on which they are to be called
110  std::vector<IMethod*> fMethods;
111  std::vector<TCut> fCategoryCuts;
112  std::vector<UInt_t> fCategorySpecIdx;
113  std::vector<TString> fVars;
114  std::vector <std::vector <UInt_t> > fVarMaps;
115 
116  // get help message text
117  void GetHelpMessage() const;
118 
119  TMVA::DataSetInfo& CreateCategoryDSI(const TCut&, const TString&, const TString&);
120 
121  private:
122 
123  void InitCircularTree(const DataSetInfo& dsi);
124 
125  TTree * fCatTree; //! needed in conjunction with TTreeFormulas for evaluation category expressions
126  std::vector<TTreeFormula*> fCatFormulas;
127 
129  friend class Factory; // DSMTEST
130  friend class Reader; // DSMTEST
131  friend class MethodBoost; // DSMTEST
132 
134  };
135 }
136 
137 #endif
std::vector< IMethod * > fMethods
void Init()
initialize the method
TMVA::IMethod * AddMethod(const TCut &, const TString &theVariables, Types::EMVA theMethod, const TString &theTitle, const TString &theOptions)
adds sub-classifier for a category
virtual void MakeClass(const TString &=TString("")) const
create reader class for method (classification only at present)
void InitCircularTree(const DataSetInfo &dsi)
initialize the circular tree
EAnalysisType
Definition: Types.h:125
std::vector< TCut > fCategoryCuts
std::vector< UInt_t > fCategorySpecIdx
Basic string class.
Definition: TString.h:129
Ranking for variables in method (implementation)
Definition: Ranking.h:48
bool Bool_t
Definition: RtypesCore.h:59
virtual ~MethodCategory(void)
destructor
std::vector< std::vector< UInt_t > > fVarMaps
#define ClassDef(name, id)
Definition: Rtypes.h:297
void DeclareOptions()
options for this method
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:56
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
MethodCategory(const TString &jobName, const TString &methodTitle, DataSetInfo &theData, const TString &theOption="")
standard constructor
const Ranking * CreateRanking()
no ranking
TMVA::DataSetInfo & CreateCategoryDSI(const TCut &, const TString &, const TString &)
create a DataSetInfo object for a sub-classifier
unsigned int UInt_t
Definition: RtypesCore.h:42
DataSetManager * fDataSetManager
void Train(void)
train all sub-classifiers
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
virtual Bool_t HasAnalysisType(Types::EAnalysisType type, UInt_t numberClasses, UInt_t)
check whether method category has analysis type the method type has to be the same for all sub-method...
std::vector< TString > fVars
void GetHelpMessage() const
Get help message text.
Double_t GetMvaValue(Double_t *err=0, Double_t *errUpper=0)
returns the mva value of the right sub-classifier
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.
void AddWeightsXMLTo(void *parent) const
create XML description of Category classifier
A TTree object has a header with a name and a title.
Definition: TTree.h:78
void ReadWeightsFromXML(void *wghtnode)
read weights of sub-classifiers of MethodCategory from xml weight file
Bool_t PassesCut(const Event *ev, UInt_t methodIdx)
virtual const std::vector< Float_t > & GetRegressionValues()
returns the mva value of the right sub-classifier
void ProcessOptions()
process user options