Hello
I have a series of root files created by the ATLAS athena software. I seem to be able to plot histograms without any problems but when trying to access the actual numbers in the chain the output I am getting is always 0 (or ~10^-33).
Some example code:
TChain chain(“CollectionTree”);
chain.Add(“bd10001.aan.root”);
chain.Add(“bd10002.aan.root”);
chain.Add(“bd10003.aan.root”);
Float_t JpsiMass = 0;
chain.SetBranchAddress(“JpsiMass”, &JpsiMass);
for(int i = 0; i < chain.GetEntries(); ++i){
chain.GetEntry(i);
std::cout << "Entry: " << i << std::endl;
std::cout << JpsiMass << std::endl;
}
This gives an output along the lines of:
Entry: 0
5.81628e-33
Entry: 1
5.81628e-33
Entry: 2
5.81628e-33
Entry: 3
5.81628e-33
etc… The number changes each time I run but it is always effectively 0 and not around 3000 which is what I get when I plot it.
I think the problem is that data in the root file is saved in a slightly unusual way. If I do a:
chain.Scan(“JpsiMass”);
I get something like:
- Row * Instance * JpsiMass *
-
0 * 0 * 1169.8223 *
-
0 * 1 * 18868.732 *
-
0 * 2 * 3120.3016 *
-
1 * 0 * 60993.448 *
-
1 * 1 * 28015.276 *
-
1 * 2 * 23108.280 *
-
1 * 3 * 12970.957 *
-
1 * 4 * 306.49083 *
-
1 * 5 * 17989.376 *
-
1 * 6 * 27748.248 *
-
1 * 7 * 28063.830 *
-
1 * 8 * 3520.0950 *
-
1 * 9 * 10407.286 *
-
2 * 0 * 613.46000 *
-
2 * 1 * 18748.954 *
-
2 * 2 * 1537.7683 *
-
2 * 3 * 57904.155 *
-
2 * 4 * 29852.022 *
-
2 * 5 * 53332.928 *
-
2 * 6 * 19310.274 *
-
2 * 7 * 995.52865 *
-
2 * 8 * 3065.5888 *
-
2 * 9 * 13860.224 *
-
2 * 10 * 18580.413 *
-
3 * 0 * 32961.969 *
Type to continue or q to quit ==> q
So I assume there are several different JpsiMass values for each entry and this is why I am not getting out the correct values? Does anybody know a way I can fix this problem?