i had written a script to read 2 txt files (contains 3 coulmns for each ) and need to know how to link the arraies in the script with the files
the code in the attachment
thanx
try1.c (952 Bytes)
Try: {
// open ROOT file to save the TTree and histograms
TFile *ftree = new TFile("tree_nucnet.root", "recreate");
// creation of TTree
TTree *tree = new TTree("YU_NUCNET_TOOLS", "YU_NUCNET_TOOLS");
// creation and filling of branches to hold the variables
tree->ReadFile("The_First_Data_File.txt", "Time/F:H_mass:He_mass");
tree->ReadFile("The_Second_Data_File.txt");
// tree->ReadFile("The_Third_Data_File.txt");
tree->Write();
// creation of histograms
TH1F *h1 = new TH1F("h1", "1H vs. Time", 100, 0, 3.15e16);
TH1F *h2 = new TH1F("h2", "4He vs. Time", 100, 0, 3.15e16);
// filling the histograms
tree->Project("h1", "H_mass");
h1->Write();
tree->Project("h2", "He_mass");
h2->Write();
// drawing histograms
TCanvas *c = new TCanvas("c", "c");
c->Divide(1, 2);
c->cd(1); h1->Draw();
c->cd(2); h2->Draw();
c->cd(0);
// delete ftree; // automatically deletes "tree", "h1" and "h2", too
}
thank you Mr Pepe Le Pew for your reply but still i need to specify the columns i need to plot such as
plot the second column from the first file at x-axis with the third column from the second file at y-axis
how i can do that
and thanks again