I have questions about ~.root files handlings. I want to merge two or more ~.root files to one ~.root file. I attached two root data file macro in this message for example. I want to add these data and or take averages. But the number of the data is not same. So, if the data of the bin # in one file does not have the data of same bin # in other file, take one data. If the two files have the data of same bin #, take average. What can I do to write root macros?
In addtion, I want to read ~.root files and analyze (fit the data) to use root macros. What kind of header files I need and how to write the macros? Would you tell me how to do that to use the macro example?
90B_MRS_pions_-0.10_0.10_0_10.C (5.27 KB)
90A_MRS_pions_-0.10_0.10_0_10.C (5.13 KB)
Please TRY reading tutorials, how-to’s, and maybe users guide.
Many answers are there. And this one too.
Thank you for the message. I read user’s guide, tutorials, and HOWTO’s, however, I cannot find the examples or I don’t understand them since my conditions are different from these examples. It is not simple file merges of histograms. Would you show me the examples to use my data file macros that I attached with previous message?
to put histograms into root file:
to add histograms in reference guide look at
void TH1::Add(const TH1* h1, Double_t c1 = 1);
an example attached, but still TRY HARDER to look at web-site
macro.C (6.41 KB)
Thank you for the reply and I understand your code. I appreciate that.
I am not mature enough about root, so I have other questions.
When I read the ~.root data files instead of …SetBinContent(…); and I analize previous proceedure, how should I do?
I read the website:
And I wrote the code:
fFileA = new TFile(“90A_MRS_pions…root”, “READ”);
fFileB = new TFile(“90B_MRS_pions…root”, “READ”);
The ~.root files contain KEY: TH1F 90A_MRS_pions_…
but there are error messages,
does not work…
So, I would like to know how to handle ~.root files (binary code data files), read and analyze the data?
Would you tell me how to do it?
I attached the sample ~.root data file with this message.
90A_NewAveSpec_MRS_pions_-0.10_0.10_0_10_3_13.root (4.64 KB)