36 std::map<std::string,int> Use;
43 std::cout << std::endl;
44 std::cout <<
"==> Start TMVAMulticlassApplication" << std::endl;
45 if (myMethodList !=
"") {
46 for (std::map<std::string,int>::iterator it = Use.begin(); it != Use.end(); it++) it->second = 0;
49 for (
UInt_t i=0; i<mlist.size(); i++) {
50 std::string regMethod(mlist[i]);
52 if (Use.find(regMethod) == Use.end()) {
53 std::cout <<
"Method \"" << regMethod <<
"\" not known in TMVA under this name. Choose among the following:" << std::endl;
54 for (std::map<std::string,int>::iterator it = Use.begin(); it != Use.end(); it++) std::cout << it->first <<
" " << std::endl;
55 std::cout << std::endl;
77 TString prefix =
"TMVAMulticlass";
79 for (std::map<std::string,int>::iterator it = Use.begin(); it != Use.end(); it++) {
83 reader->
BookMVA( methodName, weightfile );
89 TH1F *histMLP_signal(0), *histBDTG_signal(0), *histFDAGA_signal(0), *histPDEFoam_signal(0);
91 histMLP_signal =
new TH1F(
"MVA_MLP_signal",
"MVA_MLP_signal", nbin, 0., 1.1 );
93 histBDTG_signal =
new TH1F(
"MVA_BDTG_signal",
"MVA_BDTG_signal", nbin, 0., 1.1 );
95 histFDAGA_signal =
new TH1F(
"MVA_FDA_GA_signal",
"MVA_FDA_GA_signal", nbin, 0., 1.1 );
97 histPDEFoam_signal =
new TH1F(
"MVA_PDEFoam_signal",
"MVA_PDEFoam_signal", nbin, 0., 1.1 );
101 TString fname =
"./tmva_example_multiple_background.root";
106 std::cout <<
"ERROR: could not open data file, please generate example data first!" << std::endl;
109 std::cout <<
"--- TMVAMulticlassApp : Using input file: " << input->GetName() << std::endl;
117 std::cout <<
"--- Select signal sample" << std::endl;
123 std::cout <<
"--- Processing: " << theTree->
GetEntries() <<
" events" << std::endl;
129 std::cout <<
"--- ... Processing event: " << ievt << std::endl;
146 std::cout <<
"--- End of event loop: "; sw.
Print();
148 TFile *target =
new TFile(
"TMVAMulticlassApp.root",
"RECREATE" );
150 histMLP_signal->Write();
152 histBDTG_signal->Write();
154 histFDAGA_signal->Write();
156 histPDEFoam_signal->Write();
159 std::cout <<
"--- Created root file: \"TMVMulticlassApp.root\" containing the MVA output histograms" << std::endl;
163 std::cout <<
"==> TMVAClassificationApplication is done!" << std::endl << std::endl;
166 int main(
int argc,
char** argv )
170 for (
int i=1; i<argc; i++) {
172 if(regMethod==
"-b" || regMethod==
"--batch")
continue;
174 methodList += regMethod;
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
void Print(Option_t *option="") const
Print the real and cpu time passed between the start and stop events.
void Start(Bool_t reset=kTRUE)
Start the stopwatch.
void AddVariable(const TString &expression, Float_t *)
Add a float variable or expression to the reader.
void TMVAMulticlassApplication(TString myMethodList="")
virtual Int_t GetEntry(Long64_t entry=0, Int_t getall=0)
Read all branches of entry and return total number of bytes read.
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=1, Int_t netopt=0)
Create / open a file.
void Stop()
Stop the stopwatch.
virtual Int_t SetBranchAddress(const char *bname, void *add, TBranch **ptr=0)
Change branch address, dealing with clone trees properly.
IMethod * BookMVA(const TString &methodTag, const TString &weightfile)
read method name from weight file
R__EXTERN TSystem * gSystem
int main(int argc, char **argv)
virtual Long64_t GetEntries() const
A TTree object has a header with a name and a title.
const std::vector< Float_t > & EvaluateMulticlass(const TString &methodTag, Double_t aux=0)
evaluates MVA for given set of input variables