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";
77 dataloader->AddVariable(
"var1",
"Variable 1",
"",
'F' );
78 dataloader->AddVariable(
"var2",
"Variable 2",
"",
'F' );
79 dataloader->AddVariable(
"var3",
"Variable 3",
"units",
'F' );
80 dataloader->AddVariable(
"var4",
"Variable 4",
"units",
'F' );
91 "nTrain_Signal=0:nTrain_Background=0:SplitMode=Random:NormMode=NumEvents:!V" );
95 "!H:!V:NTrees=1000:BoostType=Grad:Shrinkage=0.30:UseBaggedBoost:BaggedSampleFraction=0.6:SeparationType=GiniIndex:nCuts=20:MaxDepth=2" );
115 dataloader->AddVariable(
"var1",
"Variable 1",
"",
'F' );
116 dataloader->AddVariable(
"var2",
"Variable 2",
"",
'F' );
117 dataloader->AddVariable(
"var3",
"Variable 3",
"units",
'F' );
118 dataloader->AddVariable(
"var4",
"Variable 4",
"units",
'F' );
127 "nTrain_Signal=0:nTrain_Background=0:SplitMode=Random:NormMode=NumEvents:!V" );
131 "!H:!V:NTrees=1000:BoostType=Grad:Shrinkage=0.30:UseBaggedBoost:BaggedSampleFraction=0.6:SeparationType=GiniIndex:nCuts=20:MaxDepth=2" );
151 dataloader->AddVariable(
"var1",
"Variable 1",
"",
'F' );
152 dataloader->AddVariable(
"var2",
"Variable 2",
"",
'F' );
153 dataloader->AddVariable(
"var3",
"Variable 3",
"units",
'F' );
154 dataloader->AddVariable(
"var4",
"Variable 4",
"units",
'F' );
163 "nTrain_Signal=0:nTrain_Background=0:SplitMode=Random:NormMode=NumEvents:!V" );
167 "!H:!V:NTrees=1000:BoostType=Grad:Shrinkage=0.30:UseBaggedBoost:BaggedSampleFraction=0.5:SeparationType=GiniIndex:nCuts=20:MaxDepth=2" );
207 outputTree->Branch(
"weight", &weight,
"weight/F");
235 reader0->BookMVA(
"BDT method",
"datasetBkg0/weights/TMVAMultiBkg0_BDTG.weights.xml" );
236 reader1->BookMVA(
"BDT method",
"datasetBkg1/weights/TMVAMultiBkg1_BDTG.weights.xml" );
237 reader2->BookMVA(
"BDT method",
"datasetBkg2/weights/TMVAMultiBkg2_BDTG.weights.xml" );
241 TString fname =
"./tmva_example_multiple_background.root";
250 std::cout <<
"--- Select signal sample" << std::endl;
256 std::cout <<
"--- Select background 0 sample" << std::endl;
262 std::cout <<
"--- Select background 1 sample" << std::endl;
268 std::cout <<
"--- Select background 2 sample" << std::endl;
281 std::cout <<
"--- Processing: " <<
theTree->GetEntries() <<
" events" << std::endl;
289 std::cout <<
"--- ... Processing event: " <<
ievt << std::endl;
305 std::cout <<
"--- End of event loop: ";
sw.Print();
317 std::cout <<
"--- Created root file: \"" <<
outfileName.Data() <<
"\" containing the MVA output histograms" << std::endl;
323 std::cout <<
"==> Application of readers is done! combined tree created" << std::endl << std::endl;
341 hFP =
new TH1F(
"hfp",
"hfp",100,-1,1);
342 hTP =
new TH1F(
"htp",
"htp",100,-1,1);
351 Double_t EstimatorFunction( std::vector<Double_t> & factors ){
384 std::cout << std::endl;
385 std::cout <<
"======================" << std::endl
387 <<
"Purity : " <<
purity << std::endl << std::endl
426 ranges.push_back(
new Interval(-1,1) );
427 ranges.push_back(
new Interval(-1,1) );
428 ranges.push_back(
new Interval(-1,1) );
430 std::cout <<
"Classifier ranges (defined by the user)" << std::endl;
431 for( std::vector<Interval*>::iterator it = ranges.
begin(); it != ranges.
end(); it++ ){
432 std::cout <<
" range: " << (*it)->GetMin() <<
" " << (*it)->GetMax() << std::endl;
436 chain->Add(
"tmva_example_multiple_backgrounds__applied.root");
452 std::vector<Double_t>
result;
456 std::cout << std::endl;
459 for( std::vector<Double_t>::iterator it =
result.begin(); it<
result.end(); it++ ){
460 std::cout <<
" cutValue[" <<
n <<
"] = " << (*it) <<
";"<< std::endl;
475 cout <<
"Start Test TMVAGAexample" << endl
476 <<
"========================" << endl
481 gROOT->ProcessLine(
"create_MultipleBackground(200)");
485 cout <<
"========================" << endl;
486 cout <<
"--- Training" << endl;
490 cout <<
"========================" << endl;
491 cout <<
"--- Application & create combined tree" << endl;
495 cout <<
"========================" << endl;
496 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