I’m having some trouble trying to use variable size arrays in a TObject. Wrote some smaller code to try to isolate the problem. It is attached.
When I run this sequence:
.x fadc.C+
TFile f("tree2.root")
t2->Scan("fmod0.raw_data")
The output I get is expected:
***********************************
* Row * Instance * fmod0.raw *
***********************************
* 0 * 0 * 0 *
* 0 * 1 * 10 *
* 0 * 2 * 20 *
* 0 * 3 * 30 *
* 0 * 4 * 40 *
* 0 * 5 * 50 *
* 0 * 6 * 60 *
* 0 * 7 * 70 *
* 0 * 8 * 80 *
* 0 * 9 * 90 *
* 0 * 10 * 100 *
* 0 * 11 * 110 *
* 0 * 12 * 120 *
* 0 * 13 * 130 *
* 0 * 14 * 140 *
* 0 * 15 * 150 *
* 1 * 0 * 0 *
* 1 * 1 * 10 *
* 1 * 2 * 20 *
* 1 * 3 * 30 *
* 1 * 4 * 40 *
* 1 * 5 * 50 *
* 1 * 6 * 60 *
* 1 * 7 * 70 *
* 1 * 8 * 80 *
If I try the same with fmod1:
[code]t2->Scan(“fmod1.raw_data”)
- Row * Instance * fmod1.raw *
*** Break *** segmentation violation
There was a crash (#7 0x00ccb2ad in SigHandler(ESignals) ()).
This is the entire stack trace of all threads:
#0 0x006a0410 in __kernel_vsyscall ()
#1 0x002a5cb3 in __waitpid_nocancel () from /lib/libc.so.6
#2 0x0024a62b in do_system () from /lib/libc.so.6
#3 0x00206f3d in system () from /lib/libpthread.so.0
#4 0x00cc6d2d in TUnixSystem::Exec(char const*) ()
from /daqfs/home/moffit/software/root_v5.32.00/lib/libCore.so
#5 0x00cce8dd in TUnixSystem::StackTrace() ()
from /daqfs/home/moffit/software/root_v5.32.00/lib/libCore.so
#6 0x00ccb1db in TUnixSystem::DispatchSignals(ESignals) ()
from /daqfs/home/moffit/software/root_v5.32.00/lib/libCore.so
#7 0x00ccb2ad in SigHandler(ESignals) ()
from /daqfs/home/moffit/software/root_v5.32.00/lib/libCore.so
#8 0x00cc41a4 in sighandler(int) ()
from /daqfs/home/moffit/software/root_v5.32.00/lib/libCore.so
#9 0x00cf5b81 in textinput::TerminalConfigUnix::HandleSignal(int) ()
from /daqfs/home/moffit/software/root_v5.32.00/lib/libCore.so
#10 0x00cf5fe6 in (anonymous namespace)::TerminalConfigUnix__handleSignal(int)
() from /daqfs/home/moffit/software/root_v5.32.00/lib/libCore.so
#11
#12 0x01982daa in TStreamerInfo::GetValueAux(int, void*, int, int) ()
from /daqfs/home/moffit/software/root_v5.32.00/lib/libRIO.so
#13 0x01984279 in TStreamerInfo::GetValue(char*, int, int, int) const ()
from /daqfs/home/moffit/software/root_v5.32.00/lib/libRIO.so
#14 0x01fb229d in TBranchElement::GetValue(int, int, bool) const ()
from /daqfs/home/moffit/software/root_v5.32.00/lib/libTree.so
#15 0x01fe5976 in TLeafElement::GetValue(int) const ()
from /daqfs/home/moffit/software/root_v5.32.00/lib/libTree.so
#16 0x02bff361 in TTreeFormula::EvalInstance(int, char const**) ()
from /daqfs/home/moffit/software/root_v5.32.00/lib/libTreePlayer.so
#17 0x02bfb1cd in TTreeFormula::PrintValue(int, int, char const*) const ()
from /daqfs/home/moffit/software/root_v5.32.00/lib/libTreePlayer.so
#18 0x02c1bc1e in TTreePlayer::Scan(char const*, char const*, char const*, long long, long long) ()
from /daqfs/home/moffit/software/root_v5.32.00/lib/libTreePlayer.so
#19 0x01fff19d in TTree::Scan(char const*, char const*, char const*, long long, long long) () from /daqfs/home/moffit/software/root_v5.32.00/lib/libTree.so
#20 0x02094da7 in G__G__Tree_119_0_168(G__value*, char const*, G__param*, int)
() from /daqfs/home/moffit/software/root_v5.32.00/lib/libTree.so
#21 0x0127ce2a in Cint::G__ExceptionWrapper(int ()(G__value, char const*, G__param*, int), G__value*, char*, G__param*, int) ()
from /daqfs/home/moffit/software/root_v5.32.00/lib/libCint.so
#22 0x01337ba6 in G__execute_call ()
from /daqfs/home/moffit/software/root_v5.32.00/lib/libCint.so
#23 0x0133c15d in G__call_cppfunc ()
from /daqfs/home/moffit/software/root_v5.32.00/lib/libCint.so
#24 0x0130e74e in G__interpret_func ()
from /daqfs/home/moffit/software/root_v5.32.00/lib/libCint.so
#25 0x012fbe48 in G__getfunction ()
from /daqfs/home/moffit/software/root_v5.32.00/lib/libCint.so
#26 0x013ff78c in G__getstructmem(int, G__FastAllocString&, char*, int, char*, int*, G__var_array*, int) ()
from /daqfs/home/moffit/software/root_v5.32.00/lib/libCint.so
#27 0x013f5578 in G__getvariable ()
from /daqfs/home/moffit/software/root_v5.32.00/lib/libCint.so
#28 0x012d00c1 in G__getitem ()
from /daqfs/home/moffit/software/root_v5.32.00/lib/libCint.so
#29 0x012d0366 in G__getitem ()
from /daqfs/home/moffit/software/root_v5.32.00/lib/libCint.so
#30 0x012d9b29 in G__getexpr ()
from /daqfs/home/moffit/software/root_v5.32.00/lib/libCint.so
#31 0x0136d78f in G__exec_statement ()
from /daqfs/home/moffit/software/root_v5.32.00/lib/libCint.so
#32 0x012ba86b in G__exec_tempfile_core ()
from /daqfs/home/moffit/software/root_v5.32.00/lib/libCint.so
#33 0x012babc6 in G__exec_tempfile_fp ()
from /daqfs/home/moffit/software/root_v5.32.00/lib/libCint.so
#34 0x013777e8 in G__process_cmd ()
from /daqfs/home/moffit/software/root_v5.32.00/lib/libCint.so
#35 0x00c80c73 in TCint::ProcessLine(char const*, TInterpreter::EErrorCode*) ()
from /daqfs/home/moffit/software/root_v5.32.00/lib/libCore.so
#36 0x00bc682e in TApplication::ProcessLine(char const*, bool, int*) ()
from /daqfs/home/moffit/software/root_v5.32.00/lib/libCore.so
#37 0x007704f7 in TRint::HandleTermInput() ()
from /daqfs/home/moffit/software/root_v5.32.00/lib/libRint.so
#38 0x0076f6b5 in TTermInputHandler::Notify() ()
from /daqfs/home/moffit/software/root_v5.32.00/lib/libRint.so
#39 0x007727b4 in TTermInputHandler::ReadNotify() ()
from /daqfs/home/moffit/software/root_v5.32.00/lib/libRint.so
#40 0x00ccadbb in TUnixSystem::CheckDescriptors() ()
from /daqfs/home/moffit/software/root_v5.32.00/lib/libCore.so
#41 0x00ccb945 in TUnixSystem::DispatchOneEvent(bool) ()
from /daqfs/home/moffit/software/root_v5.32.00/lib/libCore.so
#42 0x00c2f174 in TSystem::InnerLoop() ()
from /daqfs/home/moffit/software/root_v5.32.00/lib/libCore.so
#43 0x00c33621 in TSystem::Run() ()
from /daqfs/home/moffit/software/root_v5.32.00/lib/libCore.so
#44 0x00bc4a68 in TApplication::Run(bool) ()
from /daqfs/home/moffit/software/root_v5.32.00/lib/libCore.so
#45 0x0077232c in TRint::Run(bool) ()
from /daqfs/home/moffit/software/root_v5.32.00/lib/libRint.so
#46 0x08048d73 in main ()
The lines below might hint at the cause of the crash.
If they do not help you then please submit a bug report at
http://root.cern.ch/bugs. Please post the ENTIRE stack trace
from above as an attachment in addition to anything else
that might help us fixing this issue.
#12 0x01982daa in TStreamerInfo::GetValueAux(int, void*, int, int) ()
from /daqfs/home/moffit/software/root_v5.32.00/lib/libRIO.so
#13 0x01984279 in TStreamerInfo::GetValue(char*, int, int, int) const ()
from /daqfs/home/moffit/software/root_v5.32.00/lib/libRIO.so
#14 0x01fb229d in TBranchElement::GetValue(int, int, bool) const ()
from /daqfs/home/moffit/software/root_v5.32.00/lib/libTree.so
#15 0x01fe5976 in TLeafElement::GetValue(int) const ()
from /daqfs/home/moffit/software/root_v5.32.00/lib/libTree.so
#16 0x02bff361 in TTreeFormula::EvalInstance(int, char const**) ()
from /daqfs/home/moffit/software/root_v5.32.00/lib/libTreePlayer.so
#17 0x02bfb1cd in TTreeFormula::PrintValue(int, int, char const*) const ()
from /daqfs/home/moffit/software/root_v5.32.00/lib/libTreePlayer.so
#18 0x02c1bc1e in TTreePlayer::Scan(char const*, char const*, char const*, long long, long long) ()
from /daqfs/home/moffit/software/root_v5.32.00/lib/libTreePlayer.so
#19 0x01fff19d in TTree::Scan(char const*, char const*, char const*, long long, long long) () from /daqfs/home/moffit/software/root_v5.32.00/lib/libTree.so
[/code]
Not sure if this helps… but if I run
t2->Show(1)
The result is as expected:
======> EVENT:1
roc = (roc*)0x927b288
fUniqueID = 0
fBits = 50331648
fmod[21] = printing kStreamer case (81)
fmod0 = (fadc_channel_data*)0x927b608
fUniqueID = 0
fBits = 50331648
nsamples = 16
raw_data = 0
10 , 20 , 30 , 40 , 50 , 60 , 70 , 80 , 90 ,
100 , 110 , 120 , 130 , 140 , 150 ,
sample = 0
1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 ,
10 , 11 , 12 , 13 , 14 , 15 ,
fmod1 = (fadc_channel_data*)0x92cb3a0
fUniqueID = 0
fBits = 50331648
nsamples = 16
raw_data = 0
20 , 40 , 60 , 80 , 100 , 120 , 140 , 160 , 180 ,
200 , 220 , 240 , 260 , 280 , 300 ,
sample = 0
1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 ,
10 , 11 , 12 , 13 , 14 , 15 ,
And I can retry fmod1 again, and it works…
[code] t2->Scan(“fmod1.raw_data”)
- Row * Instance * fmod1.raw *
-
0 * 0 * 0 *
-
0 * 1 * 20 *
-
0 * 2 * 40 *
-
0 * 3 * 60 *
-
0 * 4 * 80 *
-
0 * 5 * 100 *
-
0 * 6 * 120 *
-
0 * 7 * 140 *
-
0 * 8 * 160 *
-
0 * 9 * 180 *
-
0 * 10 * 200 *
-
0 * 11 * 220 *
-
0 * 12 * 240 *
-
0 * 13 * 260 *
-
0 * 14 * 280 *
-
0 * 15 * 300 *
-
1 * 0 * 0 *
-
1 * 1 * 20 *
-
1 * 2 * 40 *
-
1 * 3 * 60 *
-
1 * 4 * 80 *
-
1 * 5 * 100 *
-
1 * 6 * 120 *
-
1 * 7 * 140 *
-
1 * 8 * 160 *
[/code]
I’m getting the feeling here that the address pointers of the Branch are not quite correct when I read the TFile, but unsure as to why running TTree::Show(…) would correct this.
I was originally just trying to use roc as my only branch… but was unable to get any access to the data in the variable sized arrays within the fmod[…] objects.
Pretty sure I’m doing something dumb here.
fadc.C (1.47 KB)