I got an unexpected behaviour when I try to draw data which I stored in a TRefArray of an event class: The resulting histogram doesn’t show the stored data; instead it always shows a single peak at 0. Any help how I can correctly draw the stored data would be highly appreciated.
Please find below more information and a minimal working example.
I constructed my “Event” class following the example of test/Event.h provided by ROOT. My class owns a collection of “Tracks” and a collection of “Hits”. Each hit stores a references to its “parent track” in a TRef. Each track stores references to its “daughter hits” in a TRefArray. Please find attached a minimal working example to produce a ROOT file with random data stored in this event class.
I can successfully compile and run the minimal working example with ROOT 6.02.04 and GCC 4.8.2 with enabled C++11 support.
If I open the produced file test.root in ROOT, I can draw successfully the data of the parent track via:
When I try to draw the data of the daughter hits via:
I get a histogram with a single peak at 0. However, when I read the data of the daughter hits via the script printEvent.C:
I get non-zero values as expected. Therefore, I assume that the data are correctly stored in the ROOT file. So how can I draw them via TTree::Draw command?
minimalWorkingExample.tar.gz (3.82 KB)