I’m afraid this is some kind of a CINT bug.
Try the attached “ReadLHE.C” file.
When “interpreted”, I get a “segmentation violation” (note that the “Particle_” variable has been modified without any reason):
root [0] .L ReadLHE.C
root [1] ReadLHE t
Warning in <TClass::TClass>: no dictionary for class TRootLHEFEvent is available
Warning in <TClass::TClass>: no dictionary for class TRootWeight is available
Warning in <TClass::TClass>: no dictionary for class TRootLHEFParticle is available
Warning in <TClass::TClass>: no dictionary for class TSortableObject is available
root [2] t.Loop();
nb = 940
0 Particle_Py = 1304.34
0 Particle_PID = -1
quakr_count = 1
px, py, pz, E 0 0 1304.34 1304.34
0 Particle_ BEFORE Iqrk0 = 6
0 Particle_ AFTER Iqrk0 = 6
1 Particle_Py = 490.969
1 Particle_PID = 21
quakr_count = 2
px, py, pz, E 0 0 -490.969 490.969
2 Particle_Py = 280.684
2 Particle_PID = 23
3 Particle_Py = 669.786
3 Particle_PID = 23
4 Particle_Py = 416.124
4 Particle_PID = 21
quakr_count = 3
px, py, pz, E -29.075 5.31222 -415.073 416.124
5 Particle_Py = 428.717
5 Particle_PID = -1
quakr_count = 4
px, py, pz, E 90.4598 -213.77 360.441 428.717
nb = 940
0 Particle_Py = 1083.1
0 Particle_PID = 1
quakr_count = 1
px, py, pz, E 0 0 1083.1 1083.1
0 Particle_ BEFORE Iqrk0 = 6
0 Particle_ AFTER Iqrk0 = 0
*** Break *** segmentation violation
===========================================================
There was a crash (kSigSegmentationViolation).
This is the entire stack trace of all threads:
===========================================================
#0 0x00007f2e2f03b6dc in __libc_waitpid (pid=5485, stat_loc=stat_loc
entry=0x7fff72833820, options=options
entry=0) at ../sysdeps/unix/sysv/linux/waitpid.c:31
#1 0x00007f2e2efc02e2 in do_system (line=<optimized out>) at ../sysdeps/posix/system.c:148
#2 0x00007f2e2fdd6d4a in TUnixSystem::Exec (this=0x1ae0ec0, shellcmd=0x2a188a0 "/.../v5-34-00-patches/etc/gdb-backtrace.sh 5471 1>&2") at /.../v5-34-00-patches/core/unix/src/TUnixSystem.cxx:2172
#3 0x00007f2e2fdd7626 in TUnixSystem::StackTrace (this=0x1ae0ec0) at /.../v5-34-00-patches/core/unix/src/TUnixSystem.cxx:2419
#4 0x00007f2e2fdd4f0f in TUnixSystem::DispatchSignals (this=0x1ae0ec0, sig=kSigSegmentationViolation) at /.../v5-34-00-patches/core/unix/src/TUnixSystem.cxx:1294
#5 0x00007f2e2fdd2e5b in SigHandler (sig=kSigSegmentationViolation) at /.../v5-34-00-patches/core/unix/src/TUnixSystem.cxx:440
#6 0x00007f2e2fddafea in sighandler (sig=11) at /.../v5-34-00-patches/core/unix/src/TUnixSystem.cxx:3748
#7 0x00007f2e2fe0f488 in textinput::TerminalConfigUnix::HandleSignal (this=0x7f2e305aad80 <textinput::TerminalConfigUnix::Get()::s>, signum=11) at /.../v5-34-00-patches/core/textinput/src/textinput/TerminalConfigUnix.cpp:96
#8 0x00007f2e2fe0f1c5 in (anonymous namespace)::TerminalConfigUnix__handleSignal (signum=11) at /.../v5-34-00-patches/core/textinput/src/textinput/TerminalConfigUnix.cpp:36
#9 <signal handler called>
#10 0x00007f2e2e67a352 in G__interpret_func (result7=0x1b0d940, funcname=0x2127f60 "LoadTree", libp=0x7fff72837150, hash=784, p_ifunc=0x2273070, funcmatch=1, memfunc_flag=0) at cint/cint/src/ifunc.cxx:6032
#11 0x00007f2e2e5e2aee in G__exec_asm (start=0, stack=0, presult=0x7fff728420c0, localmem=0) at cint/cint/src/bc_exec_asm.h:1982
#12 0x00007f2e2e6d8fe3 in G__exec_loop (forinit=0x0, condition=0x1b20c40 "jentry<nentries", foraction=...) at cint/cint/src/parse.cxx:3318
#13 0x00007f2e2e6d810e in G__exec_for () at cint/cint/src/parse.cxx:2764
#14 0x00007f2e2e6e4d46 in G__exec_statement (mparen=0x7fff728425c4) at cint/cint/src/parse.cxx:7262
#15 0x00007f2e2e67cbd7 in G__interpret_func (result7=0x7fff728433b0, funcname=0x1afcb00 "Loop", libp=0x7fff728433f0, hash=410, p_ifunc=0x2273370, funcmatch=1, memfunc_flag=1) at cint/cint/src/ifunc.cxx:6710
#16 0x00007f2e2e652053 in G__getfunction (item=0x1afbed2 "Loop()", known3=0x7fff7284ec7c, memfunc_flag=1) at cint/cint/src/func.cxx:2660
#17 0x00007f2e2e79042d in G__getstructmem (store_var_type=112, varname=..., membername=0x1afbed2 "Loop()", memnamesize=1021, tagname=0x1afbed0 "t", known2=0x7fff7284ec7c, varglobal=0x7f2e2ea5c680 <G__global>, objptr=1) at cint/cint/src/var.cxx:6821
#18 0x00007f2e2e77fca3 in G__getvariable (item=0x1af62b0 "t.Loop()", known=0x7fff7284ec7c, varglobal=0x7f2e2ea5c680 <G__global>, varlocal=0x0) at cint/cint/src/var.cxx:5390
#19 0x00007f2e2e641326 in G__getitem (item=0x1af62b0 "t.Loop()") at cint/cint/src/expr.cxx:1906
#20 0x00007f2e2e63e934 in G__getexpr (expression=0x1b1f410 "t.Loop()") at cint/cint/src/expr.cxx:1488
#21 0x00007f2e2e6d3e61 in G__exec_function (statement=..., pc=0x7fff72851480, piout=0x7fff72851484, plargestep=0x7fff7285148c, presult=0x7fff72851570) at cint/cint/src/parse.cxx:645
#22 0x00007f2e2e6e54bc in G__exec_statement (mparen=0x7fff72851750) at cint/cint/src/parse.cxx:7371
#23 0x00007f2e2e610e64 in G__exec_tempfile_core (file=0x0, fp=0x25f98c0) at cint/cint/src/debug.cxx:266
#24 0x00007f2e2e6128d6 in G__exec_tempfile_fp (fp=0x25f98c0) at cint/cint/src/debug.cxx:807
#25 0x00007f2e2e6f48df in G__process_cmd (line=0x7fff72852c59 "t.Loop();", prompt=0x1ae6fe8 "", more=0x1ae6fe0, err=0x7fff72852a2c, rslt=0x7fff72852a60) at cint/cint/src/pause.cxx:3343
#26 0x00007f2e2fd86b7e in TCint::ProcessLine (this=0x1ae6fa0, line=0x7fff72852c59 "t.Loop();", error=0x0) at /.../v5-34-00-patches/core/meta/src/TCint.cxx:548
#27 0x00007f2e2fcc5a71 in TApplication::ProcessLine (this=0x1c33300, line=0x7fff72852c59 "t.Loop();", sync=false, err=0x0) at /.../v5-34-00-patches/core/base/src/TApplication.cxx:974
#28 0x00007f2e2f86f33d in TRint::HandleTermInput (this=0x1c33300) at /.../v5-34-00-patches/core/rint/src/TRint.cxx:584
#29 0x00007f2e2f86d189 in TTermInputHandler::Notify (this=0x212e040) at /.../v5-34-00-patches/core/rint/src/TRint.cxx:125
#30 0x00007f2e2f870841 in TTermInputHandler::ReadNotify (this=0x212e040) at /.../v5-34-00-patches/core/rint/src/TRint.cxx:117
#31 0x00007f2e2fdd5273 in TUnixSystem::CheckDescriptors (this=0x1ae0ec0) at /.../v5-34-00-patches/core/unix/src/TUnixSystem.cxx:1396
#32 0x00007f2e2fdd4441 in TUnixSystem::DispatchOneEvent (this=0x1ae0ec0, pendingOnly=false) at /.../v5-34-00-patches/core/unix/src/TUnixSystem.cxx:1103
#33 0x00007f2e2fd3812b in TSystem::InnerLoop (this=0x1ae0ec0) at /.../v5-34-00-patches/core/base/src/TSystem.cxx:410
#34 0x00007f2e2fd37ec6 in TSystem::Run (this=0x1ae0ec0) at /.../v5-34-00-patches/core/base/src/TSystem.cxx:360
#35 0x00007f2e2fcc6542 in TApplication::Run (this=0x1c33300, retrn=false) at /.../v5-34-00-patches/core/base/src/TApplication.cxx:1122
#36 0x00007f2e2f86eb00 in TRint::Run (this=0x1c33300, retrn=false) at /.../v5-34-00-patches/core/rint/src/TRint.cxx:455
#37 0x000000000040128e in main (argc=1, argv=0x7fff72855098) at /.../v5-34-00-patches/main/src/rmain.cxx:29
===========================================================
Root > Function Loop() busy flag cleared
root [3] .q
but when “precompiled”, I get it right:
root [0] .L ReadLHE.C++
Info in <TUnixSystem::ACLiC>: creating shared library /..././ReadLHE_C.so
root [1] ReadLHE t
Warning in <TClass::TClass>: no dictionary for class TRootLHEFEvent is available
Warning in <TClass::TClass>: no dictionary for class TRootWeight is available
Warning in <TClass::TClass>: no dictionary for class TRootLHEFParticle is available
Warning in <TClass::TClass>: no dictionary for class TSortableObject is available
root [2] t.Loop();
nb = 940
0 Particle_Py = 1304.34
0 Particle_PID = -1
quakr_count = 1
px, py, pz, E 0 0 1304.34 1304.34
0 Particle_ BEFORE Iqrk0 = 6
0 Particle_ AFTER Iqrk0 = 6
1 Particle_Py = 490.969
1 Particle_PID = 21
quakr_count = 2
px, py, pz, E 0 0 -490.969 490.969
2 Particle_Py = 280.684
2 Particle_PID = 23
3 Particle_Py = 669.786
3 Particle_PID = 23
4 Particle_Py = 416.124
4 Particle_PID = 21
quakr_count = 3
px, py, pz, E -29.075 5.31222 -415.073 416.124
5 Particle_Py = 428.717
5 Particle_PID = -1
quakr_count = 4
px, py, pz, E 90.4598 -213.77 360.441 428.717
nb = 940
0 Particle_Py = 1083.1
0 Particle_PID = 1
quakr_count = 1
px, py, pz, E 0 0 1083.1 1083.1
0 Particle_ BEFORE Iqrk0 = 6
0 Particle_ AFTER Iqrk0 = 6
1 Particle_Py = 67.644
1 Particle_PID = 21
quakr_count = 2
px, py, pz, E 0 0 -67.644 67.644
2 Particle_Py = 686.778
2 Particle_PID = 23
3 Particle_Py = 382.898
3 Particle_PID = 23
4 Particle_Py = 35.2051
4 Particle_PID = 21
quakr_count = 3
px, py, pz, E 12.3725 32.8481 -2.7057 35.2051
5 Particle_Py = 45.8611
5 Particle_PID = 1
quakr_count = 4
px, py, pz, E 25.0471 -26.653 -27.6677 45.8611
root [3] .q
ReadLHE.C (3.65 KB)