Hello there.
The title is probably not very suggestive, or even misleading, since I am not only interested in importing a Tree from multiple ROOT files. I also want to multiply the data in the tree and then sum up all the data.
Ok, let’s go it through step by step. I have, say 5, ROOT files (rootfile1.root, rootfile2.root, etc.).
In every one of those files i have a tree with the same name, say T2. In every T2 in every file i have a variable, say S2. For every file I also know about a correction factor, which has not been implemented in those files yet (for whatever reason, not important here). So, i also have 5 correction factors, say A1, A2, …, A5, one for each rootfile and applied always to S2.
The question now is, since I am a ROOT and PyROOT beginner, I am not sure of how to load and Draw this data. What i finally want to have is the following. I want to have a TH1 of S2 summed up from all 5 ROOT files with the correct factor multiplied. So I first want to open the first ROOT file, read S2, multiply it with A1 and store it in an empty histogram, say h1. Then I want to move on with the second ROOT file, read S2, multiply with A2, and add it to h1. And the same for number 3, 4 and 5.
The easiest way to read a tree from a file is with TChain, isn’t it? But when I do T2.Add(…) i already add the data without incorporating the factors A1, …, A5. And the same problem I have with TTree() and TFile(), don’t I? So, my question is now: how can i do it? What other way is to do it?
Probably the question is rather stupid. But I am a beginner trying to find my way through ROOT and PyROOT with numerous tutorials and questioning colleagues, who btw also don’t know how to do it.
Thank you for your help.
Best wishes,
heico