ROOT Version 6.08/04
Platform Xubuntu 17.04
Compiler gcc6.3
Hello forum!
After a successful TMVA run the ROC-Curves are saved in my fdmTMVA.root file.
Each method gets a folder:
fdmTMVA.root -> TDirectoryFile::dataset -> TDirectoryFile::Method_KNN -> TDirectoryFile::KNN ->
TH1D::MVA_KNN_effBvsS (ROC-curve)
-
My question is, how do I extract the TH1D ROC-curve? I.e. how do I traverse TDirectoryFile folders?
-
Secondly, how do I modify it using the TSyle and THistPainter Classes?
Attempt:
// Open .root file
TFile *f1 = TFile::Open("fdmTMVA.root");
// Set pointer to directory containing ROC-curve
TDirectory* dir = gFile->GetDirectory("/dataset/Method_KNN/KNN");
TString objectName( "MVA_KNN_effBvsS" );
TH1D* h;
// Extract ROC-curve
dir->GetObject(objectName,h);
// Set Canvas
TCanvas *c = new TCanvas("c");
gPad->SetGrid();
// more style options etc...
// Draw and save
h->Draw();
c->SaveAs(objectName + ".png");
delete c;
delete f1;
This doesn’t work as it gives the following warning:
- Warning: null passed to a callee that requires a non-null argument [-Wnonnull] dir->GetObject(objectName,h);
Many thanks in advance!
Edit: This now works by replacing GetDirectory(“Method_KNN/KNN”) with GetDirectory("/dataset/Method_KNN/KNN")