Can anyone explain why I got segmentation fault with the ("ROCCurve","TH1D",ROCCurve);
line. Doesnt it the way to define a branch that stores TObject (If the TString
line is working) ?
void test(){
TString Options;
double TrainTime;
double ROCArea;
TH1D* ROCCurve;
//Build Result Tree
TTree ResultsTree("t","tree");
ResultsTree.Branch("Options","TString",&Options);
ResultsTree.Branch("ROCCurve","TH1D",ROCCurve);
ResultsTree.Branch("TrainTime",&TrainTime,"TrainTime/D");
ResultsTree.Branch("ROCArea",&ROCArea,"ROCArea/D");
Options = TString("hhh");
TrainTime = 2.0;
ROCArea = 4.0;
*ROCCurve = new TH1D("jj","kk",50,0,100);
// for(int i=0;i<10;i++){ROCCurve->Fill(i*100);};
ResultsTree.Fill();
//End
TFile ResultsFile("test.root","recreate");
ResultsTree.Write();
ResultsFile.Close();
}
n.b.: I didnt get the point even though there is a similar topic Add a branch holding object
ROOT Version: 6.26.00 (conda)
Platform: Ubuntu20.04 (WSL)
Compiler: gcc 9