00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #ifndef ROOT_TMVA_MethodCuts
00034 #define ROOT_TMVA_MethodCuts
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046 #include <vector>
00047 #include <map>
00048
00049 #ifndef ROOT_TMVA_MethodBase
00050 #include "TMVA/MethodBase.h"
00051 #endif
00052 #ifndef ROOT_TMVA_BinarySearchTree
00053 #include "TMVA/BinarySearchTree.h"
00054 #endif
00055 #ifndef ROOT_TMVA_PDF
00056 #include "TMVA/PDF.h"
00057 #endif
00058 #ifndef ROOT_TMVA_TMatrixDfwd
00059 #ifndef ROOT_TMatrixDfwd
00060 #include "TMatrixDfwd.h"
00061 #endif
00062 #endif
00063 #ifndef ROOT_TMVA_IFitterTarget
00064 #ifndef ROOT_IFitterTarget
00065 #include "IFitterTarget.h"
00066 #endif
00067 #endif
00068
00069 class TRandom;
00070
00071 namespace TMVA {
00072
00073 class Interval;
00074
00075 class MethodCuts : public MethodBase, public IFitterTarget {
00076
00077 public:
00078
00079 MethodCuts( const TString& jobName,
00080 const TString& methodTitle,
00081 DataSetInfo& theData,
00082 const TString& theOption = "MC:150:10000:",
00083 TDirectory* theTargetFile = 0 );
00084
00085 MethodCuts( DataSetInfo& theData,
00086 const TString& theWeightFile,
00087 TDirectory* theTargetDir = NULL );
00088
00089
00090 static MethodCuts* DynamicCast( IMethod* method ) { return dynamic_cast<MethodCuts*>(method); }
00091
00092 virtual ~MethodCuts( void );
00093
00094 virtual Bool_t HasAnalysisType( Types::EAnalysisType type, UInt_t numberClasses, UInt_t numberTargets );
00095
00096
00097 void Train( void );
00098
00099 using MethodBase::ReadWeightsFromStream;
00100
00101 void AddWeightsXMLTo ( void* parent ) const;
00102
00103 void ReadWeightsFromStream( std::istream & i );
00104 void ReadWeightsFromXML ( void* wghtnode );
00105
00106
00107 Double_t GetMvaValue( Double_t* err = 0, Double_t* errUpper = 0 );
00108
00109
00110 void WriteMonitoringHistosToFile( void ) const;
00111
00112
00113 void TestClassification();
00114
00115
00116 Double_t GetSeparation ( TH1*, TH1* ) const { return -1; }
00117 Double_t GetSeparation ( PDF* = 0, PDF* = 0 ) const { return -1; }
00118 Double_t GetSignificance( void ) const { return -1; }
00119 Double_t GetmuTransform ( TTree *) { return -1; }
00120 Double_t GetEfficiency ( const TString&, Types::ETreeType, Double_t& );
00121 Double_t GetTrainingEfficiency(const TString& );
00122
00123
00124 Double_t GetRarity( Double_t, Types::ESBType ) const { return 0; }
00125
00126
00127 Double_t ComputeEstimator( std::vector<Double_t> & );
00128
00129 Double_t EstimatorFunction( std::vector<Double_t> & );
00130 Double_t EstimatorFunction( Int_t ievt1, Int_t ievt2 );
00131
00132 void SetTestSignalEfficiency( Double_t effS ) { fTestSignalEff = effS; }
00133
00134
00135 void PrintCuts( Double_t effS ) const;
00136 Double_t GetCuts ( Double_t effS, std::vector<Double_t>& cutMin, std::vector<Double_t>& cutMax ) const;
00137 Double_t GetCuts ( Double_t effS, Double_t* cutMin, Double_t* cutMax ) const;
00138
00139
00140 const Ranking* CreateRanking() { return 0; }
00141
00142 void DeclareOptions();
00143 void ProcessOptions();
00144
00145
00146 static const Double_t fgMaxAbsCutVal;
00147
00148
00149 void CheckSetup() {}
00150
00151 protected:
00152
00153
00154 void MakeClassSpecific( std::ostream&, const TString& ) const;
00155
00156
00157 void GetHelpMessage() const;
00158
00159 private:
00160
00161
00162 enum EFitMethodType { kUseMonteCarlo = 0,
00163 kUseGeneticAlgorithm,
00164 kUseSimulatedAnnealing,
00165 kUseMinuit,
00166 kUseEventScan,
00167 kUseMonteCarloEvents };
00168
00169
00170
00171
00172
00173 enum EEffMethod { kUseEventSelection = 0,
00174 kUsePDFs };
00175
00176
00177 enum EFitParameters { kNotEnforced = 0,
00178 kForceMin,
00179 kForceMax,
00180 kForceSmart };
00181
00182
00183 TString fFitMethodS;
00184 EFitMethodType fFitMethod;
00185 TString fEffMethodS;
00186 EEffMethod fEffMethod;
00187 std::vector<EFitParameters>* fFitParams;
00188 Double_t fTestSignalEff;
00189 Double_t fEffSMin;
00190 Double_t fEffSMax;
00191 Double_t* fCutRangeMin;
00192 Double_t* fCutRangeMax;
00193 std::vector<Interval*> fCutRange;
00194
00195
00196 BinarySearchTree* fBinaryTreeS;
00197 BinarySearchTree* fBinaryTreeB;
00198
00199
00200 Double_t** fCutMin;
00201 Double_t** fCutMax;
00202 Double_t* fTmpCutMin;
00203 Double_t* fTmpCutMax;
00204 TString* fAllVarsI;
00205
00206
00207 Int_t fNpar;
00208 Double_t fEffRef;
00209 std::vector<Int_t>* fRangeSign;
00210 TRandom* fRandom;
00211
00212
00213 std::vector<Double_t>* fMeanS;
00214 std::vector<Double_t>* fMeanB;
00215 std::vector<Double_t>* fRmsS;
00216 std::vector<Double_t>* fRmsB;
00217
00218 TH1* fEffBvsSLocal;
00219
00220
00221 std::vector<TH1*>* fVarHistS;
00222 std::vector<TH1*>* fVarHistB;
00223 std::vector<TH1*>* fVarHistS_smooth;
00224 std::vector<TH1*>* fVarHistB_smooth;
00225 std::vector<PDF*>* fVarPdfS;
00226 std::vector<PDF*>* fVarPdfB;
00227
00228
00229 Bool_t fNegEffWarning;
00230
00231
00232
00233
00234 void MatchParsToCuts( const std::vector<Double_t>&, Double_t*, Double_t* );
00235 void MatchParsToCuts( Double_t*, Double_t*, Double_t* );
00236
00237 void MatchCutsToPars( std::vector<Double_t>&, Double_t*, Double_t* );
00238 void MatchCutsToPars( std::vector<Double_t>&, Double_t**, Double_t**, Int_t ibin );
00239
00240
00241
00242 void CreateVariablePDFs( void );
00243
00244
00245 void GetEffsfromSelection( Double_t* cutMin, Double_t* cutMax,
00246 Double_t& effS, Double_t& effB );
00247
00248 void GetEffsfromPDFs( Double_t* cutMin, Double_t* cutMax,
00249 Double_t& effS, Double_t& effB );
00250
00251
00252 void Init( void );
00253
00254 ClassDef(MethodCuts,0)
00255 };
00256
00257 }
00258
00259 #endif