50void TMVAClassificationCategory()
55 std::cout << std::endl <<
"==> Start TMVAClassificationCategory" << std::endl;
60 bool batchMode =
false;
63 TString outfileName(
"TMVACC.root" );
68 std::string factoryOptions(
"!V:!Silent:Transformations=I;D;P;G,D" );
69 if (batchMode) factoryOptions +=
":!Color:!DrawProgressBar";
90 if (
gSystem->AccessPathName( fname +
"toy_sigbkg_categ_offset.root")) {
92 fname =
gROOT->GetTutorialDir() +
"/machine_learning/data/";
94 if (UseOffsetMethod) fname +=
"toy_sigbkg_categ_offset.root";
95 else fname +=
"toy_sigbkg_categ_varoff.root";
96 if (!
gSystem->AccessPathName( fname )) {
98 std::cout <<
"--- TMVAClassificationCategory: Accessing " << fname << std::endl;
103 std::cout <<
"ERROR: could not open data file: " << fname << std::endl;
107 TTree *signalTree = (
TTree*)input->Get(
"TreeS");
108 TTree *background = (
TTree*)input->Get(
"TreeB");
124 "nTrain_Signal=0:nTrain_Background=0:SplitMode=Random:NormMode=NumEvents:!V" );
133 "!H:!V:TransformOutput:PDFInterpol=Spline2:NSmoothSig[0]=20:NSmoothBkg[0]=20:NSmoothBkg[1]=10:NSmooth=1:NAvEvtPerBin=50" );
139 TString theCat1Vars =
"var1:var2:var3:var4";
140 TString theCat2Vars = (UseOffsetMethod ?
"var1:var2:var3:var4" :
"var1:var2:var3");
152 "Category_Likelihood_1",
"!H:!V:TransformOutput:PDFInterpol=Spline2:NSmoothSig[0]=20:NSmoothBkg[0]=20:NSmoothBkg[1]=10:NSmooth=1:NAvEvtPerBin=50" );
154 "Category_Likelihood_2",
"!H:!V:TransformOutput:PDFInterpol=Spline2:NSmoothSig[0]=20:NSmoothBkg[0]=20:NSmoothBkg[1]=10:NSmooth=1:NAvEvtPerBin=50" );
172 std::cout <<
"==> Wrote root file: " << outputFile->
GetName() << std::endl;
173 std::cout <<
"==> TMVAClassificationCategory is done!" << std::endl;
182int main(
int argc,
char** argv )
184 TMVAClassificationCategory();
bool Bool_t
Boolean (0=false, 1=true) (bool).
double Double_t
Double 8 bytes.
A specialized string object used for TTree selections.
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.
void Close(Option_t *option="") override
Close a file.
void AddSignalTree(TTree *signal, Double_t weight=1.0, Types::ETreeType treetype=Types::kMaxTreeType)
number of signal events (used to compute significance)
void AddSpectator(const TString &expression, const TString &title="", const TString &unit="", Double_t min=0, Double_t max=0)
user inserts target in data set info
void PrepareTrainingAndTestTree(const TCut &cut, const TString &splitOpt)
prepare the training and test trees -> same cuts for signal and background
void AddBackgroundTree(TTree *background, Double_t weight=1.0, Types::ETreeType treetype=Types::kMaxTreeType)
number of signal events (used to compute significance)
void AddVariable(const TString &expression, const TString &title, const TString &unit, char type='F', Double_t min=0, Double_t max=0)
user inserts discriminating variable in data set info
This is the main MVA steering class.
void TrainAllMethods()
Iterates through all booked methods and calls training.
void TestAllMethods()
Evaluates all booked methods on the testing data and adds the output to the Results in the corresponi...
void EvaluateAllMethods(void)
Iterates over all MVAs that have been booked, and calls their evaluation methods.
MethodBase * BookMethod(DataLoader *loader, MethodName theMethodName, TString methodTitle, TString theOption="")
Books an MVA classifier or regression method.
Virtual base Class for all MVA method.
Class for categorizing the phase space.
TMVA::IMethod * AddMethod(const TCut &, const TString &theVariables, Types::EMVA theMethod, const TString &theTitle, const TString &theOptions)
adds sub-classifier for a category
const char * GetName() const override
Returns name of object.
A TTree represents a columnar dataset.
void TMVAGui(const char *fName="TMVA.root", TString dataset="")