File indexing completed on 2025-01-18 10:10:57
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 #ifndef ROOT_TMVA_Config
0030 #define ROOT_TMVA_Config
0031
0032
0033
0034
0035
0036
0037
0038
0039 #include <atomic>
0040 #include "Rtypes.h"
0041 #include "TString.h"
0042
0043 #include "Executor.h"
0044
0045 namespace TMVA {
0046
0047 class MsgLogger;
0048
0049 class Config {
0050 protected:
0051
0052 Executor fExecutor;
0053
0054 public:
0055
0056 static Config& Instance();
0057 static void DestroyInstance();
0058
0059 Bool_t UseColor() const { return fUseColoredConsole; }
0060 void SetUseColor( Bool_t uc ) { fUseColoredConsole = uc; }
0061
0062 Bool_t IsSilent() const { return fSilent; }
0063 void SetSilent( Bool_t s ) { fSilent = s; }
0064
0065 Bool_t WriteOptionsReference() const { return fWriteOptionsReference; }
0066 void SetWriteOptionsReference( Bool_t w ) { fWriteOptionsReference = w; }
0067
0068 Bool_t DrawProgressBar() const { return fDrawProgressBar; }
0069 void SetDrawProgressBar( Bool_t d ) { fDrawProgressBar = d; }
0070 UInt_t GetNCpu() { return fExecutor.GetPoolSize(); }
0071
0072 UInt_t GetNumWorkers() const { return fNWorkers; }
0073 void SetNumWorkers(UInt_t n) { fNWorkers = n; }
0074
0075 #ifdef R__USE_IMT
0076 ROOT::TThreadExecutor &GetMultiThreadExecutor() { return *(fExecutor.GetMultiThreadExecutor()); }
0077
0078 #endif
0079
0080
0081 Executor & GetThreadExecutor() { return fExecutor; }
0082
0083
0084 void EnableMT(int numthreads = 0) { fExecutor = Executor(numthreads); }
0085
0086
0087 void DisableMT() { fExecutor = Executor(1); }
0088
0089
0090 Bool_t IsMTEnabled() const { return fExecutor.GetPoolSize() > 1; }
0091
0092 public:
0093
0094 class VariablePlotting;
0095 class IONames;
0096
0097 VariablePlotting& GetVariablePlotting() { return fVariablePlotting; }
0098 IONames& GetIONames() { return fIONames; }
0099
0100
0101 class VariablePlotting {
0102
0103 public:
0104
0105 Float_t fTimesRMS;
0106 Int_t fNbins1D;
0107 Int_t fNbins2D;
0108 Int_t fMaxNumOfAllowedVariables;
0109 Int_t fMaxNumOfAllowedVariablesForScatterPlots;
0110 Int_t fNbinsMVAoutput;
0111 Int_t fNbinsXOfROCCurve;
0112 Bool_t fUsePaperStyle;
0113 enum { kPNG = 0, kGIF = 1, kPDF = 2, kEPS = 3 };
0114 Int_t fPlotFormat;
0115
0116 } fVariablePlotting;
0117
0118
0119 class IONames {
0120
0121 public:
0122
0123 TString fWeightFileDirPrefix;
0124 TString fWeightFileDir;
0125 TString fWeightFileExtension;
0126 TString fOptionsReferenceFileDir;
0127 } fIONames;
0128
0129
0130 private:
0131
0132
0133 Config();
0134 Config( const Config& );
0135 Config& operator=( const Config&);
0136 virtual ~Config();
0137 static std::atomic<Config*> fgConfigPtr;
0138 private:
0139
0140 std::atomic<Bool_t> fDrawProgressBar;
0141 std::atomic<UInt_t> fNWorkers;
0142 std::atomic<Bool_t> fUseColoredConsole;
0143 std::atomic<Bool_t> fSilent;
0144 std::atomic<Bool_t> fWriteOptionsReference;
0145 mutable MsgLogger* fLogger;
0146 MsgLogger& Log() const { return *fLogger; }
0147
0148 ClassDef(Config,0);
0149 };
0150
0151
0152 Config& gConfig();
0153 }
0154
0155 #endif