Hi,
I looked inside a lot of topics, but I didn’t find any answer to my problem. The more similar is Problem using TTree::Draw command with data in TRefArray but is not exactly the same problem and, anyhow, nobody replied to the guy…
I have a class, DecodeDataAMSL0
acting as “factory” (i.e. filling another event class to be stored inside a TTree
. This class has:
class DecodeDataAMSL0 : public DecodeData {
public:
using EventAMSL0 = GenericEvent<2, 9, 64, 8, 16, 0>;
using calibelemAMSL0 = calibelem<1024>;
EventAMSL0 *ev;
static calibelemAMSL0 calped[2][9];
where
template <size_t NCh> class calibelem : public TObject {
public:
float value[NCh];
ClassDef(calibelem, 2)
};
and GenericEvent
is a template class that is holding my “event”, that is the only TBranch
of a TTree
. This GenericEvent class
has
TRef refCalPed[2][9];
with the idea to have, on event-by-event basis, the calibration that is a thing that would be the same for all the events (i.e. writing directly calibelem
as data member would, and I check is actually doing, waste a lot of disk space even with a quite high compression, both at file level that at branch level).
When filling the first event into the tree, these calibelem
’s (2 * 9 elements) are created/populated, written into the TTree::GetUserInfo()
and “assigned” to the 2 * 9 TRef
’s.
If I try to Draw
the resulting TTree
what happens is:
- the
TRef
is working: without any action it “appears” as a real leaf of the tree and can be draw - the plotted values are correct
but
- to print 1024 values (first event, notice the “1” passed as last argument) I have to do
t4->Draw("refCalPed[0][0][0].value[0]", "", "", 1)
. Essentially I have to use four indices, while only two were expected:
root [8] t4->Draw("refCalPed[0][0][0].value[0]", "", "", 1)
(long long) 1024
If I do:
root [9] t4->Draw("refCalPed[0][0][0].value", "", "", 1)
(long long) 9216
I end up drawing 9 * 1024. If I do
root [10] t4->Draw("refCalPed[0][0].value", "", "", 1)
(long long) 18432
2 * 9 * 1024 values are drawn, even if I specified refCalPed[0][0]…
With less indices it still works and the result is even more strange:
root [11] t4->Draw("refCalPed[0].value", "", "", 1)
(long long) 165888
root [12] t4->Draw("refCalPed.value", "", "", 1)
(long long) 331776
Another strange point is that:
root [13] t4->Draw("refCalPed[0][0][0][0].value", "", "", 1)
(long long) 1024
root [14] t4->Draw("refCalPed[0][0].value[0][0]", "", "", 1)
(long long) 1024
root [15] t4->Draw("refCalPed.value[0][0][0][0]", "", "", 1)
(long long) 1024
all give the very same result…
Where I’m wrong?
Thanks,
Matteo
Please read tips for efficient and successful posting and posting code
Please fill also the fields below. Note that root -b -q
will tell you this info, and starting from 6.28/06 upwards, you can call .forum bug
from the ROOT prompt to pre-populate a topic.
ROOT Version: 6.26/06
Platform: M1Pro / MacOs Monterey 12.6.8
Compiler: Apple clang version 14.0.0 (clang-1400.0.29.202)