50void TMVAClassificationCategory()
55 std::cout << std::endl <<
"==> Start TMVAClassificationCategory" << std::endl;
60 bool batchMode =
false;
63 TString outfileName(
"TMVA.root" );
68 std::string factoryOptions(
"!V:!Silent:Transformations=I;D;P;G,D" );
69 if (batchMode) factoryOptions +=
":!Color:!DrawProgressBar";
92 fname =
gROOT->GetTutorialDir() +
"/tmva/data/";
94 if (UseOffsetMethod) fname +=
"toy_sigbkg_categ_offset.root";
95 else fname +=
"toy_sigbkg_categ_varoff.root";
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");
115 dataloader->AddSignalTree ( signalTree, signalWeight );
123 dataloader->PrepareTrainingAndTestTree( mycuts, mycutb,
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();
R__EXTERN TSystem * gSystem
A specialized string object used for TTree selections.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
virtual void Close(Option_t *option="")
Close a file.
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseGeneralPurpose, Int_t netopt=0)
Create / open a file.
This is the main MVA steering class.
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
virtual const char * GetName() const
Returns name of object.
virtual const char * DirName(const char *pathname)
Return the directory name in pathname.
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 object has a header with a name and a title.
int main(int argc, char **argv)
void TMVAGui(const char *fName="TMVA.root", TString dataset="")