==> Start TMVAClassificationCategoryApplication
: Booking "FisherCat method" of type "Category" from dataset/weights/TMVAClassificationCategory_FisherCat.weights.xml.
: Reading weight file: dataset/weights/TMVAClassificationCategory_FisherCat.weights.xml
<HEADER> DataSetInfo : [Default] : Added class "Signal"
<HEADER> DataSetInfo : [Default] : Added class "Background"
: Recreating sub-classifiers from XML-file
<HEADER> DataSetInfo : [Category_Fisher_1_dsi] : Added class "Signal"
<HEADER> DataSetInfo : [Category_Fisher_1_dsi] : Added class "Background"
<HEADER> DataSetInfo : [Category_Fisher_2_dsi] : Added class "Signal"
<HEADER> DataSetInfo : [Category_Fisher_2_dsi] : Added class "Background"
: Booked classifier "FisherCat" of type: "Category"
: Booking "LikelihoodCat method" of type "Category" from dataset/weights/TMVAClassificationCategory_LikelihoodCat.weights.xml.
: Reading weight file: dataset/weights/TMVAClassificationCategory_LikelihoodCat.weights.xml
: Recreating sub-classifiers from XML-file
<HEADER> DataSetInfo : [Category_Likelihood_1_dsi] : Added class "Signal"
<HEADER> DataSetInfo : [Category_Likelihood_1_dsi] : Added class "Background"
<HEADER> DataSetInfo : [Category_Likelihood_2_dsi] : Added class "Signal"
<HEADER> DataSetInfo : [Category_Likelihood_2_dsi] : Added class "Background"
: Booked classifier "LikelihoodCat" of type: "Category"
--- TMVAClassificationApp : Accessing /home/sftnight/build/workspace/root-makedoc-v628/rootspi/rdoc/src/v6-28-00-patches/tutorials/tmva/data/toy_sigbkg_categ_offset.root!
--- Use signal sample for evaluation
: Rebuilding Dataset Default
--- End of event loop: Real time 0:00:00, CP time 0.070
--- Created root file: "TMVApp.root" containing the MVA output histograms
==> TMVAClassificationApplication is done!
#include <cstdlib>
#include <vector>
#include <iostream>
#include <map>
#include <string>
#if not defined(__CINT__) || defined(__MAKECINT__)
#endif
void TMVAClassificationCategoryApplication()
{
std::map<std::string,int> Use;
Use["LikelihoodCat"] = 1;
Use["FisherCat"] = 1;
std::cout << std::endl
<< "==> Start TMVAClassificationCategoryApplication" << std::endl;
Float_t var1, var2, var3, var4, eta;
for (std::map<std::string,int>::iterator it = Use.begin(); it != Use.end(); it++) {
if (it->second) {
TString methodName = it->first +
" method";
TString weightfile =
"dataset/weights/TMVAClassificationCategory_" +
TString(it->first) +
".weights.xml";
reader->
BookMVA( methodName, weightfile );
}
}
std::map<std::string,TH1*> hist;
hist[
"LikelihoodCat"] =
new TH1F(
"MVA_LikelihoodCat",
"MVA_LikelihoodCat", nbin, -1, 0.9999 );
hist[
"FisherCat"] =
new TH1F(
"MVA_FisherCat",
"MVA_FisherCat", nbin, -4, 4 );
fname =
gROOT->GetTutorialDir() +
"/tmva/data/";
}
if (UseOffsetMethod) fname += "toy_sigbkg_categ_offset.root";
else fname += "toy_sigbkg_categ_varoff.root";
std::cout << "--- TMVAClassificationApp : Accessing " << fname << "!" << std::endl;
std::cout << "ERROR: could not open data file: " << fname << std::endl;
exit(1);
}
std::cout << "--- Use signal sample for evaluation" << std::endl;
std::cout <<
"--- Processing: " << theTree->
GetEntries() <<
" events" << std::endl;
if (ievt%1000 == 0) std::cout << "--- ... Processing event: " << ievt << std::endl;
for (std::map<std::string,int>::iterator it = Use.begin(); it != Use.end(); it++) {
if (!it->second) continue;
TString methodName = it->first +
" method";
hist[it->first]->Fill( reader->
EvaluateMVA( methodName ) );
}
}
std::cout <<
"--- End of event loop: "; sw.
Print();
for (std::map<std::string,int>::iterator it = Use.begin(); it != Use.end(); it++)
if (it->second) hist[it->first]->Write();
std::cout << "--- Created root file: \"TMVApp.root\" containing the MVA output histograms" << std::endl;
delete reader;
std::cout << "==> TMVAClassificationApplication is done!" << std::endl << std::endl;
}
int main(
int argc,
char** argv )
{
TMVAClassificationCategoryApplication();
return 0;
}
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 ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
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.
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...
IMethod * BookMVA(const TString &methodTag, const TString &weightfile)
read method name from weight file
void AddSpectator(const TString &expression, Float_t *)
Add a float spectator or expression to the reader.
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.
virtual TString GetDirName(const char *pathname)
Return the directory name in pathname.
A TTree represents a columnar dataset.
virtual Int_t GetEntry(Long64_t entry, Int_t getall=0)
Read all branches of entry and return total number of bytes read.
virtual Int_t SetBranchAddress(const char *bname, void *add, TBranch **ptr=nullptr)
Change branch address, dealing with clone trees properly.
virtual Long64_t GetEntries() const