Hello,
I am trying to access the values in the tree I created and just be able to view them for later.
The following code works fine:
#include <iostream>
#include <fstream>
#include "TTree.h"
#include "TH1F.h"
void pngtotree(){
TTree *image = new TTree("Milky Way", "Milky Way");
image -> ReadFile("milkywaytree.txt", "Red/I:Green:Blue:Y:X");
image -> Show(0);
TH1F *h1 = new TH1F("h1","Color Histogram", 256., 0.,256.);
image -> Draw("Red");
/*
image -> Print();
for (int i = 0; i < 10; i++){
image -> Show(i);
}*/
}
and when I run it, I get the event 0 to show perfectly as I had in the file.
But, I would like to say, get the value in Red[0] or Y[100](if they were arrays instead of branches), and store them somewhere or change them, but I don’t know how to do that exactly.
Also, I would like to know if there are any functions in TTree or similar that I could use to quickly get the mean values of the branch.
I am fairly new to Root so any explanations would be greatly appreciated.