#include "TTree.h" #include "TFile.h" void try4() { // open ROOT file TFile *ftree = new TFile("tree_nucnet.root", "recreate"); // creation of the first TTree TTree *prop = new TTree("properties", ""); // creation and filling of branches to hold the variables prop->ReadFile("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("masses.txt","sequence/F:H_mass:He_mass"); // 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("masses","tree1_nucnet.root"); TCanvas *c = new TCanvas("c", "c"); c->Divide(1, 2); c->cd(1); prop->Draw("masses.H_mass:Time"); c->cd(2); prop->Draw("He_mass:Time"); }