40using std::vector, std::cout, std::endl;
49 std::string
factoryOptions(
"!V:!Silent:Transformations=I;D;P;G,D:AnalysisType=Classification" );
50 TString fname =
"./tmva_example_multiple_background.root";
55 std::cout <<
"ERROR: could not open data file" << std::endl;
81 dataloader->AddVariable(
"var1",
"Variable 1",
"",
'F' );
82 dataloader->AddVariable(
"var2",
"Variable 2",
"",
'F' );
83 dataloader->AddVariable(
"var3",
"Variable 3",
"units",
'F' );
84 dataloader->AddVariable(
"var4",
"Variable 4",
"units",
'F' );
95 "nTrain_Signal=0:nTrain_Background=0:SplitMode=Random:NormMode=NumEvents:!V" );
99 "!H:!V:NTrees=1000:BoostType=Grad:Shrinkage=0.30:UseBaggedBoost:BaggedSampleFraction=0.6:SeparationType=GiniIndex:nCuts=20:MaxDepth=2" );
119 dataloader->AddVariable(
"var1",
"Variable 1",
"",
'F' );
120 dataloader->AddVariable(
"var2",
"Variable 2",
"",
'F' );
121 dataloader->AddVariable(
"var3",
"Variable 3",
"units",
'F' );
122 dataloader->AddVariable(
"var4",
"Variable 4",
"units",
'F' );
131 "nTrain_Signal=0:nTrain_Background=0:SplitMode=Random:NormMode=NumEvents:!V" );
135 "!H:!V:NTrees=1000:BoostType=Grad:Shrinkage=0.30:UseBaggedBoost:BaggedSampleFraction=0.6:SeparationType=GiniIndex:nCuts=20:MaxDepth=2" );
155 dataloader->AddVariable(
"var1",
"Variable 1",
"",
'F' );
156 dataloader->AddVariable(
"var2",
"Variable 2",
"",
'F' );
157 dataloader->AddVariable(
"var3",
"Variable 3",
"units",
'F' );
158 dataloader->AddVariable(
"var4",
"Variable 4",
"units",
'F' );
167 "nTrain_Signal=0:nTrain_Background=0:SplitMode=Random:NormMode=NumEvents:!V" );
171 "!H:!V:NTrees=1000:BoostType=Grad:Shrinkage=0.30:UseBaggedBoost:BaggedSampleFraction=0.5:SeparationType=GiniIndex:nCuts=20:MaxDepth=2" );
211 outputTree->Branch(
"weight", &weight,
"weight/F");
239 reader0->BookMVA(
"BDT method",
"datasetBkg0/weights/TMVAMultiBkg0_BDTG.weights.xml" );
240 reader1->BookMVA(
"BDT method",
"datasetBkg1/weights/TMVAMultiBkg1_BDTG.weights.xml" );
241 reader2->BookMVA(
"BDT method",
"datasetBkg2/weights/TMVAMultiBkg2_BDTG.weights.xml" );
245 TString fname =
"./tmva_example_multiple_background.root";
254 std::cout <<
"--- Select signal sample" << std::endl;
260 std::cout <<
"--- Select background 0 sample" << std::endl;
266 std::cout <<
"--- Select background 1 sample" << std::endl;
272 std::cout <<
"--- Select background 2 sample" << std::endl;
285 std::cout <<
"--- Processing: " <<
theTree->GetEntries() <<
" events" << std::endl;
293 std::cout <<
"--- ... Processing event: " <<
ievt << std::endl;
309 std::cout <<
"--- End of event loop: ";
sw.Print();
321 std::cout <<
"--- Created root file: \"" <<
outfileName.Data() <<
"\" containing the MVA output histograms" << std::endl;
327 std::cout <<
"==> Application of readers is done! combined tree created" << std::endl << std::endl;
345 hFP =
new TH1F(
"hfp",
"hfp",100,-1,1);
346 hTP =
new TH1F(
"htp",
"htp",100,-1,1);
355 Double_t EstimatorFunction( std::vector<Double_t> & factors ){
388 std::cout << std::endl;
389 std::cout <<
"======================" << std::endl
391 <<
"Purity : " <<
purity << std::endl << std::endl
430 ranges.push_back(
new Interval(-1,1) );
431 ranges.push_back(
new Interval(-1,1) );
432 ranges.push_back(
new Interval(-1,1) );
434 std::cout <<
"Classifier ranges (defined by the user)" << std::endl;
435 for( std::vector<Interval*>::iterator it = ranges.
begin(); it != ranges.
end(); it++ ){
436 std::cout <<
" range: " << (*it)->GetMin() <<
" " << (*it)->GetMax() << std::endl;
440 chain->Add(
"tmva_example_multiple_backgrounds__applied.root");
456 std::vector<Double_t>
result;
460 std::cout << std::endl;
463 for( std::vector<Double_t>::iterator it =
result.begin(); it<
result.end(); it++ ){
464 std::cout <<
" cutValue[" <<
n <<
"] = " << (*it) <<
";"<< std::endl;
479 cout <<
"Start Test TMVAGAexample" << endl
480 <<
"========================" << endl
485 gROOT->ProcessLine(
"create_MultipleBackground(200)");
489 cout <<
"========================" << endl;
490 cout <<
"--- Training" << endl;
494 cout <<
"========================" << endl;
495 cout <<
"--- Application & create combined tree" << endl;
499 cout <<
"========================" << endl;
500 cout <<
"--- maximize significance" << endl;
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
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 result
void Print(GNN_Data &d, std::string txt="")
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
const_iterator begin() const
const_iterator end() const
A chain is a collection of files containing TTree objects.
A specialized string object used for TTree selections.
A ROOT file is an on-disk file, usually with extension .root, that stores objects in a file-system-li...
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)
This is the main MVA steering class.
void TrainAllMethods()
Iterates through all booked methods and calls training.
MethodBase * BookMethod(DataLoader *loader, TString theMethodName, TString methodTitle, TString theOption="")
Book a classifier or regression method.
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.
Fitter using a Genetic Algorithm.
Interface for a fitter 'target'.
The TMVA::Interval Class.
The Reader class serves to use the MVAs in a specific analysis context.
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
A TTree represents a columnar dataset.
double efficiency(double effFuncVal, int catIndex, int sigCatIndex)
create variable transformations