Reading and writing multiple files

Hi, I’d like to know how I should go about to do the following (using a .C macro):

1- Open "File1.root"
2- Do some calculations
3- Write the results in an output file "Output.root"
4- Open “File2.root” and repeat previous steps (still using the same output file)

Thanks.

There is many examples here: https://root.cern/doc/master/group__Tutorials.html

Could you maybe point me to a particular tutorial, because I’ve had a look at them, and I can’t seem to find what I’m looking for.
Alternatively, could you write an example of code structure?

It looks like you mainly need help for the IO part. So the most appropriate tutorials will be:
https://root.cern/doc/master/group__tutorial__io.html

Basically you already have the code structure:

1- Open “File1.root” ==> Use TFile to open the file
2- Do some calculations ==> … up to you …
3- Write the results in an output file “Output.root” ==> Use TFile to open a new file and Write in it
4- Open “File2.root” and repeat previous steps (still using the same output file) ==> repeat what you just did.