#include #include #include #include #include "TChain.h" #include "TFile.h" #include "TTree.h" #include "TString.h" #include "TObjString.h" #include "TSystem.h" #include "TROOT.h" #include "TMVA/Factory.h" #include #include "TMVA/Tools.h" #include "TMVA/TMVAGui.h" void high_granularity_roc() { TFile f("output_R6.root"); auto TestTree = (TTree*) f.Get("Dataset_R6/TestTree"); TCanvas *c1 = new TCanvas("c1", "", 1000, 900); // retrieve from the Testing tree the mva output plus weight and class id int n = TestTree->Draw("BDTG:weight:classID",""); c1->Clear(); // fill vector for the 3 quantities std::vector mvas(TestTree->GetV1(), TestTree->GetV1()+n); std::vector weights(TestTree->GetV2(), TestTree->GetV2()+n); std::vector targets(TestTree->GetV3(), TestTree->GetV3()+n); // classID ==0 is signal , instead for ROC target==1 is considered signal //for(unsigned int i = 0; i < mvas.size(); i++) //{ // cout << mvas.at(i) << ", " << weights.at(i) << ", " << targets.at(i) << endl; //} // need to flip boolean vector targets.flip(); TMVA::ROCCurve roc( mvas, targets,weights); // get a graph given number of points (e.g. 1000) auto curve = roc.GetROCCurve(1000); curve->Draw("AP"); c1->Update(); }