#include "TTree.h" #include "TFile.h" void H_Burning() { // open ROOT file TFile *ftree = new TFile("../ROOT_files/H_Burning.root", "recreate"); // creation of the first TTree TTree *prop = new TTree("properties", ""); // creation and filling of branches to hold the variables prop->ReadFile("../Data/properties.txt","sequence/F:Time:Temperature:Density"); // Write, Scan and Print the Tree prop->Write(); prop->Scan(); prop->Print(); // creation of the secound TTree TTree *mass = new TTree("masses", ""); // creation and filling of branches to hold the variables mass->ReadFile("../Data/masses.txt","sequence/F:h1_masses:he4_masses:c12_masses:n14_masses"); // open ROOT file //TFile *ftree1 = new TFile("tree1_nucnet.root", "recreate"); // Write, Scan and Print the Tree mass->Write(); mass->Scan(); mass->Print(); prop->AddFriend(mass); TCanvas *c = new TCanvas("c", "c"); prop->SetLineWidth(3); prop->SetLineColor(kRed); prop->Draw("h1_masses:Time/3.15e16", "" , " line"); prop->SetLineColor(kBlue); prop->Draw("he4_masses:Time/3.15e16", "","SAME line"); htemp->SetTitle("{}^{1}H and {}^{4}He Mass Fraction #it{vs}. Time"); htemp->GetXaxis()->SetTitle("Time (Gy)"); htemp->GetXaxis()->SetTitleOffset(1.4); htemp->GetXaxis()->CenterTitle(); htemp->GetXaxis()->SetRangeUser(0,10); htemp->GetYaxis()->SetTitle("Mass fraction"); htemp->GetYaxis()->SetTitleOffset(1.4); htemp->GetYaxis()->SetRangeUser(0,1); htemp->GetYaxis()->CenterTitle(); tex = new TLatex(0.2,0.7,"{}^{1}H"); tex->SetTextSize(0.03); tex->SetLineWidth(2); tex->Draw(); tex = new TLatex(0.2,0.37,"{}^{4}He"); tex->SetTextSize(0.03); tex->SetLineWidth(2); tex->Draw(); }