Logo ROOT   6.16/01
Reference Guide
Config.cxx
Go to the documentation of this file.
1// @(#)root/tmva $Id$
2// Author: Andreas Hoecker, Joerg Stelzer, Fredrik Tegenfeldt, Helge Voss
3
4/**********************************************************************************
5 * Project: TMVA - a Root-integrated toolkit for multivariate data analysis *
6 * Package: TMVA *
7 * Class : Config *
8 * Web : http://tmva.sourceforge.net *
9 * *
10 * Description: *
11 * Implementation *
12 * *
13 * Authors (alphabetical): *
14 * Andreas Hoecker <Andreas.Hocker@cern.ch> - CERN, Switzerland *
15 * Joerg Stelzer <Joerg.Stelzer@cern.ch> - CERN, Switzerland *
16 * Fredrik Tegenfeldt <Fredrik.Tegenfeldt@cern.ch> - Iowa State U., USA *
17 * Helge Voss <Helge.Voss@cern.ch> - MPI-K Heidelberg, GER *
18 * *
19 * Copyright (c) 2006: *
20 * CERN, Switzerland *
21 * Iowa State U., USA *
22 * MPI-K Heidelberg, Germany *
23 * *
24 * Redistribution and use in source and binary forms, with or without *
25 * modification, are permitted according to the terms listed in LICENSE *
26 * (http://mva.sourceforge.net/license.txt) *
27 **********************************************************************************/
28
29/*! \class TMVA::Config
30\ingroup TMVA
31
32Singleton class for global configuration settings used by TMVA.
33
34*/
35
36#include "TMVA/Config.h"
37#include "TMVA/MsgLogger.h"
38
39#include "Rtypes.h"
40#include "TString.h"
41#include "TSystem.h"
42#include "TROOT.h"
43
45
46#if __cplusplus > 199711L
47std::atomic<TMVA::Config*> TMVA::Config::fgConfigPtr{ 0 };
48#else
50#endif
51
53
54////////////////////////////////////////////////////////////////////////////////
55/// constructor - set defaults
56
58 fDrawProgressBar ( kFALSE ),
59 fNWorkers (1),
60 fUseColoredConsole ( kTRUE ),
61 fSilent ( kFALSE ),
62 fWriteOptionsReference( kFALSE ),
63 fLogger (new MsgLogger("Config"))
64{
65 // plotting
70
74
75 // IO names
76 fIONames.fWeightFileDir = "weights";
79
80 // get number of CPU allocated (i.e. pool size)
81 // need to have created an instance of TThreadExecutor before
83}
84
85////////////////////////////////////////////////////////////////////////////////
86/// destructor
87
89{
90 delete fLogger;
91}
92
93////////////////////////////////////////////////////////////////////////////////
94/// static function: destroy TMVA instance
95
97{
98#if __cplusplus > 199711L
99 delete fgConfigPtr.exchange(0);
100#else
101 if (fgConfigPtr != 0) { delete fgConfigPtr; fgConfigPtr = 0;}
102#endif
103}
104
105////////////////////////////////////////////////////////////////////////////////
106/// static function: returns TMVA instance
107
109{
110#if __cplusplus > 199711L
111 if(!fgConfigPtr) {
112 TMVA::Config* tmp = new Config();
113 TMVA::Config* expected = 0;
114 if(! fgConfigPtr.compare_exchange_strong(expected,tmp) ) {
115 //another thread beat us to the switch
116 delete tmp;
117 }
118 }
119 return *fgConfigPtr;
120#else
121 return fgConfigPtr ? *fgConfigPtr :*(fgConfigPtr = new Config());
122#endif
123}
124
const Bool_t kFALSE
Definition: RtypesCore.h:88
const Bool_t kTRUE
Definition: RtypesCore.h:87
#define ClassImp(name)
Definition: Rtypes.h:363
TString fWeightFileDir
Definition: Config.h:112
TString fOptionsReferenceFileDir
Definition: Config.h:114
TString fWeightFileExtension
Definition: Config.h:113
Int_t fMaxNumOfAllowedVariablesForScatterPlots
Definition: Config.h:100
Singleton class for global configuration settings used by TMVA.
Definition: Config.h:53
class TMVA::Config::IONames fIONames
static Config * fgConfigPtr
Definition: Config.h:128
static void DestroyInstance()
static function: destroy TMVA instance
Definition: Config.cxx:96
virtual ~Config()
destructor
Definition: Config.cxx:88
UInt_t fNCpu
Definition: Config.h:58
static Config & Instance()
static function: returns TMVA instance
Definition: Config.cxx:108
Config()
constructor - set defaults
Definition: Config.cxx:57
class TMVA::Config::VariablePlotting fVariablePlotting
ostringstream derivative to redirect and format output
Definition: MsgLogger.h:59
UInt_t GetImplicitMTPoolSize()
Returns the size of the pool used for implicit multi-threading.
Definition: TROOT.cxx:614
Config & gConfig()