I am working on some data analysis. I am trying to construct a TTree to store some data. However, the values that are being stored are incorrect. I want to display “sp” and “sp_err” for now. It seems that the TTree stores the number of entires rather than the actual number. I would appreciate any recommendations. Here is my code: (I have edited the files paths) sep_macro.C (6.7 KB)
Unfortunately, I still have the same issue. Ideally I would like a TTree that can hold the sp variable in a way I can easily incorporate it in plots later. My end goal is something similar to this:
Processing sep_macro.C...
Error in <TFile::TFile>: file /Users/couet/Downloads/kpkm_final3.root does not exist
Error in <TFile::TFile>: file /Users/couet/Downloads/pippim_final1.root does not exist
Error in <HandleInterpreterException>: Trying to dereference null pointer or trying to call routine taking non-null arguments
Execution of your code was aborted.
In file included from input_line_9:1:
/Users/couet/Downloads/sep_macro.C:120:40: warning: null passed to a callee that requires a non-null argument [-Wnonnull]
hist_Ldiff_phi_kp[i] = (TH1D*) file_phi->Get(hnames_phi[i]);
^~~~~~~~
The TTree the macro creates is storing the wrong values. This should be storing the sp value (~2.5 → 3 unitless) so I can include it in another plot, but for some reason I think it is storing the number of entries in the TTree.
On second look, after inspecting the attached “spe.root” file, I noticed a bug.
Inside of the “for” loop, you need “sp = ...” and “sep_err = ...” but there must be NO “double” in front of them.