Logo ROOT  
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 
32 Singleton 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 
43 
44 #if __cplusplus > 199711L
45 std::atomic<TMVA::Config*> TMVA::Config::fgConfigPtr{ 0 };
46 #else
48 #endif
49 
51 
52 ////////////////////////////////////////////////////////////////////////////////
53 /// constructor - set defaults
54 
56  fDrawProgressBar ( kFALSE ),
57  fNWorkers (1),
58  fUseColoredConsole ( kTRUE ),
59  fSilent ( kFALSE ),
60  fWriteOptionsReference( kFALSE ),
61  fLogger (new MsgLogger("Config"))
62 {
63  // plotting
69 
73  fVariablePlotting.fPlotFormat = VariablePlotting::kPNG; // format for plotting (use when fUsePaperStyle ==0)
74 
75  // IO names
77  fIONames.fWeightFileDir = "weights";
78  fIONames.fWeightFileExtension = "weights";
79  fIONames.fOptionsReferenceFileDir = "optionInfo";
80 
81 }
82 
83 ////////////////////////////////////////////////////////////////////////////////
84 /// destructor
85 
87 {
88  delete fLogger;
89 }
90 
91 ////////////////////////////////////////////////////////////////////////////////
92 /// static function: destroy TMVA instance
93 
95 {
96 #if __cplusplus > 199711L
97  delete fgConfigPtr.exchange(0);
98 #else
99  if (fgConfigPtr != 0) { delete fgConfigPtr; fgConfigPtr = 0;}
100 #endif
101 }
102 
103 ////////////////////////////////////////////////////////////////////////////////
104 /// static function: returns TMVA instance
105 
107 {
108 #if __cplusplus > 199711L
109  if(!fgConfigPtr) {
110  TMVA::Config* tmp = new Config();
111  TMVA::Config* expected = 0;
112  if(! fgConfigPtr.compare_exchange_strong(expected,tmp) ) {
113  //another thread beat us to the switch
114  delete tmp;
115  }
116  }
117  return *fgConfigPtr;
118 #else
119  return fgConfigPtr ? *fgConfigPtr :*(fgConfigPtr = new Config());
120 #endif
121 }
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
ClassImp
#define ClassImp(name)
Definition: Rtypes.h:364
TMVA::Config::VariablePlotting::kPNG
@ kPNG
Definition: Config.h:115
TMVA::Config::VariablePlotting::fNbins2D
Int_t fNbins2D
Definition: Config.h:109
TMVA::Config::Config
Config()
constructor - set defaults
Definition: Config.cxx:55
TString.h
TMVA::Config
Singleton class for global configuration settings used by TMVA.
Definition: Config.h:51
TMVA::Config::VariablePlotting::fNbinsXOfROCCurve
Int_t fNbinsXOfROCCurve
Definition: Config.h:113
TMVA::Config::DestroyInstance
static void DestroyInstance()
static function: destroy TMVA instance
Definition: Config.cxx:94
TMVA::Config::Instance
static Config & Instance()
static function: returns TMVA instance
Definition: Config.cxx:106
TMVA::Config::IONames::fOptionsReferenceFileDir
TString fOptionsReferenceFileDir
Definition: Config.h:128
TMVA::Config::IONames::fWeightFileExtension
TString fWeightFileExtension
Definition: Config.h:127
MsgLogger.h
TMVA::gConfig
Config & gConfig()
TMVA::Config::VariablePlotting::fUsePaperStyle
Bool_t fUsePaperStyle
Definition: Config.h:114
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
TMVA::Config::IONames::fWeightFileDir
TString fWeightFileDir
Definition: Config.h:126
TMVA::Config::~Config
virtual ~Config()
destructor
Definition: Config.cxx:86
Config.h
TMVA::Config::fIONames
class TMVA::Config::IONames fIONames
TMVA::Config::VariablePlotting::fPlotFormat
Int_t fPlotFormat
Definition: Config.h:116
TMVA::Config::fgConfigPtr
static Config * fgConfigPtr
Definition: Config.h:142
TMVA::MsgLogger
ostringstream derivative to redirect and format output
Definition: MsgLogger.h:59
TMVA::Config::fVariablePlotting
class TMVA::Config::VariablePlotting fVariablePlotting
TMVA::Config::IONames::fWeightFileDirPrefix
TString fWeightFileDirPrefix
Definition: Config.h:125
TMVA::Config::VariablePlotting::fNbinsMVAoutput
Int_t fNbinsMVAoutput
Definition: Config.h:112
Rtypes.h
TMVA::Config::VariablePlotting::fMaxNumOfAllowedVariables
Int_t fMaxNumOfAllowedVariables
Definition: Config.h:110
TMVA::Config::VariablePlotting::fNbins1D
Int_t fNbins1D
Definition: Config.h:108
TMVA::Config::VariablePlotting::fTimesRMS
Float_t fTimesRMS
Definition: Config.h:107
TMVA::Config::VariablePlotting::fMaxNumOfAllowedVariablesForScatterPlots
Int_t fMaxNumOfAllowedVariablesForScatterPlots
Definition: Config.h:111