24 #if not defined(__CINT__) || defined(__MAKECINT__)
37 std::map<std::string,int> Use;
39 Use[
"LikelihoodCat"] = 1;
43 std::cout << std::endl
44 <<
"==> Start TMVAClassificationCategoryApplication" << std::endl;
52 Float_t var1, var2, var3, var4, eta;
62 for (std::map<std::string,int>::iterator it = Use.begin(); it != Use.end(); it++) {
64 TString methodName = it->first +
" method";
65 TString weightfile =
"weights/TMVAClassificationCategory_" +
TString(it->first) +
".weights.xml";
66 reader->
BookMVA( methodName, weightfile );
72 std::map<std::string,TH1*> hist;
73 hist[
"LikelihoodCat"] =
new TH1F(
"MVA_LikelihoodCat",
"MVA_LikelihoodCat", nbin, -1, 0.9999 );
74 hist[
"FisherCat"] =
new TH1F(
"MVA_FisherCat",
"MVA_FisherCat", nbin, -4, 4 );
83 fname =
TString(
gROOT->GetTutorialsDir()) +
"/tmva/data/";
86 else fname +=
"toy_sigbkg_categ_varoff.root";
87 std::cout <<
"--- TMVAClassificationApp : Accessing " << fname <<
"!" << std::endl;
90 std::cout <<
"ERROR: could not open data file: " << fname << std::endl;
102 std::cout <<
"--- Use signal sample for evalution" << std::endl;
110 std::cout <<
"--- Processing: " << theTree->
GetEntries() <<
" events" << std::endl;
115 if (ievt%1000 == 0) std::cout <<
"--- ... Processing event: " << ievt << std::endl;
121 for (std::map<std::string,int>::iterator it = Use.begin(); it != Use.end(); it++) {
122 if (!it->second)
continue;
123 TString methodName = it->first +
" method";
124 hist[it->first]->Fill( reader->
EvaluateMVA( methodName ) );
129 std::cout <<
"--- End of event loop: "; sw.
Print();
133 TFile *target =
new TFile(
"TMVApp.root",
"RECREATE" );
134 for (std::map<std::string,int>::iterator it = Use.begin(); it != Use.end(); it++)
135 if (it->second) hist[it->first]->Write();
138 std::cout <<
"--- Created root file: \"TMVApp.root\" containing the MVA output histograms" << std::endl;
141 std::cout <<
"==> TMVAClassificationApplication is done!" << std::endl << std::endl;
144 int main(
int argc,
char** argv )
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.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
virtual TObject * Get(const char *namecycle)
Return pointer to object identified by namecycle.
virtual Int_t GetEntry(Long64_t entry=0, Int_t getall=0)
Read all branches of entry and return total number of bytes read.
1-D histogram with a float per channel (see TH1 documentation)}
virtual const char * DirName(const char *pathname)
Return the directory name in pathname.
int main(int argc, char **argv)
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
void TMVAClassificationCategoryApplication()
R__EXTERN TSystem * gSystem
void AddSpectator(const TString &expression, Float_t *)
Add a float spectator or expression to the reader.
Double_t EvaluateMVA(const std::vector< Float_t > &, const TString &methodTag, Double_t aux=0)
Evaluate a std::vector<float> of input data for a given method The parameter aux is obligatory for th...
virtual Long64_t GetEntries() const
A TTree object has a header with a name and a title.
virtual void Close(Option_t *option="")
Close a file.