File indexing completed on 2025-01-30 10:22:53
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
0027
0028
0029
0030
0031
0032
0033 #ifndef ROOT_TMVA_MethodCuts
0034 #define ROOT_TMVA_MethodCuts
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046 #include <vector>
0047
0048
0049 #include "TMVA/MethodBase.h"
0050 #include "TMVA/BinarySearchTree.h"
0051 #include "TMVA/PDF.h"
0052 #include "TMatrixDfwd.h"
0053 #include "IFitterTarget.h"
0054
0055 class TRandom;
0056
0057 namespace TMVA {
0058
0059 class Interval;
0060
0061 class MethodCuts : public MethodBase, public IFitterTarget {
0062
0063 public:
0064
0065 MethodCuts( const TString& jobName,
0066 const TString& methodTitle,
0067 DataSetInfo& theData,
0068 const TString& theOption = "MC:150:10000:");
0069
0070 MethodCuts( DataSetInfo& theData,
0071 const TString& theWeightFile);
0072
0073
0074 static MethodCuts* DynamicCast( IMethod* method ) { return dynamic_cast<MethodCuts*>(method); }
0075
0076 virtual ~MethodCuts( void );
0077
0078 virtual Bool_t HasAnalysisType( Types::EAnalysisType type, UInt_t numberClasses, UInt_t numberTargets );
0079
0080
0081 void Train( void );
0082
0083 using MethodBase::ReadWeightsFromStream;
0084
0085 void AddWeightsXMLTo ( void* parent ) const;
0086
0087 void ReadWeightsFromStream( std::istream & i );
0088 void ReadWeightsFromXML ( void* wghtnode );
0089
0090
0091 Double_t GetMvaValue( Double_t* err = nullptr, Double_t* errUpper = nullptr );
0092
0093
0094 void WriteMonitoringHistosToFile( void ) const;
0095
0096
0097 void TestClassification();
0098
0099
0100 Double_t GetSeparation ( TH1*, TH1* ) const { return -1; }
0101 Double_t GetSeparation ( PDF* = nullptr, PDF* = nullptr ) const { return -1; }
0102 Double_t GetSignificance( void ) const { return -1; }
0103 Double_t GetmuTransform ( TTree *) { return -1; }
0104 Double_t GetEfficiency ( const TString&, Types::ETreeType, Double_t& );
0105 Double_t GetTrainingEfficiency(const TString& );
0106
0107
0108 Double_t GetRarity( Double_t, Types::ESBType ) const { return 0; }
0109
0110
0111 Double_t ComputeEstimator( std::vector<Double_t> & );
0112
0113 Double_t EstimatorFunction( std::vector<Double_t> & );
0114 Double_t EstimatorFunction( Int_t ievt1, Int_t ievt2 );
0115
0116 void SetTestSignalEfficiency( Double_t effS ) { fTestSignalEff = effS; }
0117
0118
0119 void PrintCuts( Double_t effS ) const;
0120 Double_t GetCuts ( Double_t effS, std::vector<Double_t>& cutMin, std::vector<Double_t>& cutMax ) const;
0121 Double_t GetCuts ( Double_t effS, Double_t* cutMin, Double_t* cutMax ) const;
0122
0123
0124 const Ranking* CreateRanking() { return nullptr; }
0125
0126 void DeclareOptions();
0127 void ProcessOptions();
0128
0129
0130 static const Double_t fgMaxAbsCutVal;
0131
0132
0133 void CheckSetup() {}
0134
0135 protected:
0136
0137
0138 void MakeClassSpecific( std::ostream&, const TString& ) const;
0139
0140
0141 void GetHelpMessage() const;
0142
0143 private:
0144
0145
0146 enum EFitMethodType { kUseMonteCarlo = 0,
0147 kUseGeneticAlgorithm,
0148 kUseSimulatedAnnealing,
0149 kUseMinuit,
0150 kUseEventScan,
0151 kUseMonteCarloEvents };
0152
0153
0154
0155
0156
0157 enum EEffMethod { kUseEventSelection = 0,
0158 kUsePDFs };
0159
0160
0161 enum EFitParameters { kNotEnforced = 0,
0162 kForceMin,
0163 kForceMax,
0164 kForceSmart };
0165
0166
0167 TString fFitMethodS;
0168 EFitMethodType fFitMethod;
0169 TString fEffMethodS;
0170 EEffMethod fEffMethod;
0171 std::vector<EFitParameters>* fFitParams;
0172 Double_t fTestSignalEff;
0173 Double_t fEffSMin;
0174 Double_t fEffSMax;
0175 Double_t* fCutRangeMin;
0176 Double_t* fCutRangeMax;
0177 std::vector<Interval*> fCutRange;
0178
0179
0180 BinarySearchTree* fBinaryTreeS;
0181 BinarySearchTree* fBinaryTreeB;
0182
0183
0184 Double_t** fCutMin;
0185 Double_t** fCutMax;
0186 Double_t* fTmpCutMin;
0187 Double_t* fTmpCutMax;
0188 TString* fAllVarsI;
0189
0190
0191 Int_t fNpar;
0192 Double_t fEffRef;
0193 std::vector<Int_t>* fRangeSign;
0194 TRandom* fRandom;
0195
0196
0197 std::vector<Double_t>* fMeanS;
0198 std::vector<Double_t>* fMeanB;
0199 std::vector<Double_t>* fRmsS;
0200 std::vector<Double_t>* fRmsB;
0201
0202 TH1* fEffBvsSLocal;
0203
0204
0205 std::vector<TH1*>* fVarHistS;
0206 std::vector<TH1*>* fVarHistB;
0207 std::vector<TH1*>* fVarHistS_smooth;
0208 std::vector<TH1*>* fVarHistB_smooth;
0209 std::vector<PDF*>* fVarPdfS;
0210 std::vector<PDF*>* fVarPdfB;
0211
0212
0213 Bool_t fNegEffWarning;
0214
0215
0216
0217
0218 void MatchParsToCuts( const std::vector<Double_t>&, Double_t*, Double_t* );
0219 void MatchParsToCuts( Double_t*, Double_t*, Double_t* );
0220
0221 void MatchCutsToPars( std::vector<Double_t>&, Double_t*, Double_t* );
0222 void MatchCutsToPars( std::vector<Double_t>&, Double_t**, Double_t**, Int_t ibin );
0223
0224
0225
0226 void CreateVariablePDFs( void );
0227
0228
0229 void GetEffsfromSelection( Double_t* cutMin, Double_t* cutMax,
0230 Double_t& effS, Double_t& effB );
0231
0232 void GetEffsfromPDFs( Double_t* cutMin, Double_t* cutMax,
0233 Double_t& effS, Double_t& effB );
0234
0235
0236 void Init( void );
0237
0238 ClassDef(MethodCuts,0);
0239 };
0240
0241 }
0242
0243 #endif