34void TMVAMulticlassApplication(
TString myMethodList =
"" )
41 std::map<std::string,int> Use;
48 std::cout << std::endl;
49 std::cout <<
"==> Start TMVAMulticlassApp" << std::endl;
50 if (myMethodList !=
"") {
51 for (std::map<std::string,int>::iterator it = Use.begin(); it != Use.end(); it++) it->second = 0;
54 for (
UInt_t i=0; i<mlist.size(); i++) {
55 std::string regMethod(mlist[i]);
57 if (Use.find(regMethod) == Use.end()) {
58 std::cout <<
"Method \"" << regMethod <<
"\" not known in TMVA under this name. Choose among the following:" << std::endl;
59 for (std::map<std::string,int>::iterator it = Use.begin(); it != Use.end(); it++) std::cout << it->first <<
" " << std::endl;
60 std::cout << std::endl;
81 TString dir =
"dataset/weights/";
82 TString prefix =
"TMVAMulticlass";
84 for (std::map<std::string,int>::iterator it = Use.begin(); it != Use.end(); it++) {
91 reader->
BookMVA( methodName, weightfile );
93 std::cout <<
"TMVAMultiClassApplication: Skip " << methodName <<
" since it has not been trained !" << std::endl;
101 TH1F *histMLP_signal(0), *histBDTG_signal(0), *histFDAGA_signal(0), *histPDEFoam_signal(0);
103 histMLP_signal =
new TH1F(
"MVA_MLP_signal",
"MVA_MLP_signal", nbin, 0., 1.1 );
105 histBDTG_signal =
new TH1F(
"MVA_BDTG_signal",
"MVA_BDTG_signal", nbin, 0., 1.1 );
107 histFDAGA_signal =
new TH1F(
"MVA_FDA_GA_signal",
"MVA_FDA_GA_signal", nbin, 0., 1.1 );
109 histPDEFoam_signal =
new TH1F(
"MVA_PDEFoam_signal",
"MVA_PDEFoam_signal", nbin, 0., 1.1 );
113 TString fname =
gROOT->GetTutorialDir() +
"/machine_learning/data/tmva_multiclass_example.root";
118 std::cout <<
"ERROR: could not open data file" << std::endl;
121 std::cout <<
"--- TMVAMulticlassApp : Using input file: " <<
input->GetName() << std::endl;
129 std::cout <<
"--- Select signal sample" << std::endl;
135 std::cout <<
"--- Processing: " << theTree->
GetEntries() <<
" events" << std::endl;
141 std::cout <<
"--- ... Processing event: " << ievt << std::endl;
158 std::cout <<
"--- End of event loop: "; sw.
Print();
162 histMLP_signal->Write();
164 histBDTG_signal->Write();
166 histFDAGA_signal->Write();
168 histPDEFoam_signal->Write();
171 std::cout <<
"--- Created root file: \"TMVMulticlassApp.root\" containing the MVA output histograms" << std::endl;
175 std::cout <<
"==> TMVAMulticlassApp is done!" << std::endl << std::endl;
178int main(
int argc,
char** argv )
182 for (
int i=1; i<argc; i++) {
184 if(regMethod==
"-b" || regMethod==
"--batch")
continue;
186 methodList += regMethod;
188 TMVAMulticlassApplication(methodList);
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int)
float Float_t
Float 4 bytes (float)
long long Long64_t
Portable signed long integer 8 bytes.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void input
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t target
R__EXTERN TSystem * gSystem
A file, usually with extension .root, that stores data and code in the form of serialized objects in ...
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Create / open a file.
1-D histogram with a float per channel (see TH1 documentation)
The Reader class serves to use the MVAs in a specific analysis context.
IMethod * BookMVA(const TString &methodTag, const TString &weightfile)
read method name from weight file
const std::vector< Float_t > & EvaluateMulticlass(const TString &methodTag, Double_t aux=0)
evaluates MVA for given set of input variables
void AddVariable(const TString &expression, Float_t *)
Add a float variable or expression to the reader.
void Start(Bool_t reset=kTRUE)
Start the stopwatch.
void Stop()
Stop the stopwatch.
void Print(Option_t *option="") const override
Print the real and cpu time passed between the start and stop events.
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
A TTree represents a columnar dataset.
virtual Int_t SetBranchAddress(const char *bname, void *add, TBranch **ptr, TClass *realClass, EDataType datatype, bool isptr, bool suppressMissingBranchError)
virtual Int_t GetEntry(Long64_t entry, Int_t getall=0)
Read all branches of entry and return total number of bytes read.
virtual Long64_t GetEntries() const
create variable transformations