Hi,
I’m using Pythia8 to generate some events and then I would like to use ROOT to analyze them. For this reason, I’m trying to get the Pythia8 plugin inside ROOT working. I looked at the pythia8.C tutorial, and I can not generate events without any problems. However I would also like to store them inside a TTree for future use. What is the recommended way to do this?
I’ve looked at the pythiaExample.C tutorial, which does this for Pythia6. I thought that the core lines were:
// Make a tree in that file ...
TTree* tree = new TTree(TREENAME, "Pythia 6 tree");
// ... and register a the cache of pythia on a branch (It's a
// TClonesArray of TMCParticle objects. )
TClonesArray* particles = (TClonesArray*)pythia->GetListOfParticles();
tree->Branch(BRANCHNAME, &particles);
That is, create a branch on the internal list of particles. However when I modify this example to use Pythia8 (code attached, I basically just changed TPythia7 to TPythia8 and fixed up the initialization code), I get the following warning when making the branch:
Warning in <TTree::Bronch>: Using split mode on a class: TParticle with a custom Streamer
And when I try to fill the tree with an event, I get the following crash:
Event # 0
*** Break *** segmentation violation
===========================================================
There was a crash (#7 0x003798bb in SigHandler(ESignals) () from /home/kkrizka/HEP/root-svn/lib/libCore.so).
This is the entire stack trace of all threads:
===========================================================
#0 0x00d14416 in __kernel_vsyscall ()
#1 0x00a4e023 in waitpid () from /lib/i386-linux-gnu/libc.so.6
#2 0x009ef6e3 in ?? () from /lib/i386-linux-gnu/libc.so.6
#3 0x009a6ebb in system () from /lib/i386-linux-gnu/libpthread.so.0
#4 0x0037279b in TUnixSystem::Exec(char const*) () from /home/kkrizka/HEP/root-svn/lib/libCore.so
#5 0x00376c80 in TUnixSystem::StackTrace() () from /home/kkrizka/HEP/root-svn/lib/libCore.so
#6 0x003797a7 in TUnixSystem::DispatchSignals(ESignals) () from /home/kkrizka/HEP/root-svn/lib/libCore.so
#7 0x003798bb in SigHandler(ESignals) () from /home/kkrizka/HEP/root-svn/lib/libCore.so
#8 0x003709d2 in sighandler(int) () from /home/kkrizka/HEP/root-svn/lib/libCore.so
#9 0x003a3c35 in textinput::TerminalConfigUnix::HandleSignal(int) () from /home/kkrizka/HEP/root-svn/lib/libCore.so
#10 0x003a3c74 in (anonymous namespace)::TerminalConfigUnix__handleSignal(int) () from /home/kkrizka/HEP/root-svn/lib/libCore.so
#11 <signal handler called>
#12 0x0657d839 in int TStreamerInfo::WriteBufferAux<char**>(TBuffer&, char** const&, int, int, int, int) () from /home/kkrizka/HEP/root-svn/lib/libRIO.so
#13 0x064cffba in TStreamerInfoActions::GenericVectorPtrWriteAction(TBuffer&, void*, void const*, TStreamerInfoActions::TConfiguration const*) () from /home/kkrizka/HEP/root-svn/lib/libRIO.so
#14 0x0648aab9 in TBufferFile::ApplySequenceVecPtr(TStreamerInfoActions::TActionSequence const&, void*, void*) () from /home/kkrizka/HEP/root-svn/lib/libRIO.so
#15 0x033059cf in TBranchElement::FillLeavesClonesMember(TBuffer&) () from /home/kkrizka/HEP/root-svn/lib/libTree.so
#16 0x03303823 in TBranch::Fill() () from /home/kkrizka/HEP/root-svn/lib/libTree.so
#17 0x03304d88 in TBranchElement::Fill() () from /home/kkrizka/HEP/root-svn/lib/libTree.so
#18 0x03304b11 in TBranchElement::Fill() () from /home/kkrizka/HEP/root-svn/lib/libTree.so
#19 0x033510a4 in TTree::Fill() () from /home/kkrizka/HEP/root-svn/lib/libTree.so
#20 0x0338425c in G__G__Tree_119_0_54(G__value*, char const*, G__param*, int) () from /home/kkrizka/HEP/root-svn/lib/libTree.so
#21 0x00f204ec in Cint::G__ExceptionWrapper(int (*)(G__value*, char const*, G__param*, int), G__value*, char*, G__param*, int) () from /home/kkrizka/HEP/root-svn/lib/libCint.so
#22 0x00fd09b9 in G__execute_call () from /home/kkrizka/HEP/root-svn/lib/libCint.so
#23 0x00fd0d44 in G__call_cppfunc () from /home/kkrizka/HEP/root-svn/lib/libCint.so
#24 0x00fada4f in G__interpret_func () from /home/kkrizka/HEP/root-svn/lib/libCint.so
#25 0x00f9b882 in G__getfunction () from /home/kkrizka/HEP/root-svn/lib/libCint.so
#26 0x01092f16 in G__getstructmem(int, G__FastAllocString&, char*, int, char*, int*, G__var_array*, int) () from /home/kkrizka/HEP/root-svn/lib/libCint.so
#27 0x0108a98b in G__getvariable () from /home/kkrizka/HEP/root-svn/lib/libCint.so
#28 0x00f72117 in G__getitem () from /home/kkrizka/HEP/root-svn/lib/libCint.so
#29 0x00f79390 in G__getexpr () from /home/kkrizka/HEP/root-svn/lib/libCint.so
#30 0x0100581c in G__exec_statement () from /home/kkrizka/HEP/root-svn/lib/libCint.so
#31 0x0100e03a in G__exec_loop () from /home/kkrizka/HEP/root-svn/lib/libCint.so
#32 0x0100cb06 in G__exec_statement () from /home/kkrizka/HEP/root-svn/lib/libCint.so
#33 0x00faeee9 in G__interpret_func () from /home/kkrizka/HEP/root-svn/lib/libCint.so
#34 0x00f9b8f8 in G__getfunction () from /home/kkrizka/HEP/root-svn/lib/libCint.so
#35 0x00f728a5 in G__getitem () from /home/kkrizka/HEP/root-svn/lib/libCint.so
#36 0x00f79390 in G__getexpr () from /home/kkrizka/HEP/root-svn/lib/libCint.so
#37 0x0100581c in G__exec_statement () from /home/kkrizka/HEP/root-svn/lib/libCint.so
#38 0x00faeee9 in G__interpret_func () from /home/kkrizka/HEP/root-svn/lib/libCint.so
#39 0x00f9b8f8 in G__getfunction () from /home/kkrizka/HEP/root-svn/lib/libCint.so
#40 0x00f728a5 in G__getitem () from /home/kkrizka/HEP/root-svn/lib/libCint.so
#41 0x00f79390 in G__getexpr () from /home/kkrizka/HEP/root-svn/lib/libCint.so
#42 0x00f8530b in G__calc_internal () from /home/kkrizka/HEP/root-svn/lib/libCint.so
#43 0x0101523e in G__process_cmd () from /home/kkrizka/HEP/root-svn/lib/libCint.so
#44 0x0033dc4a in TCint::ProcessLine(char const*, TInterpreter::EErrorCode*) () from /home/kkrizka/HEP/root-svn/lib/libCore.so
#45 0x0033357f in TCint::ProcessLineSynch(char const*, TInterpreter::EErrorCode*) () from /home/kkrizka/HEP/root-svn/lib/libCore.so
#46 0x00294897 in TApplication::ExecuteFile(char const*, int*, bool) () from /home/kkrizka/HEP/root-svn/lib/libCore.so
#47 0x00294c6c in TApplication::ProcessFile(char const*, int*, bool) () from /home/kkrizka/HEP/root-svn/lib/libCore.so
#48 0x002933ff in TApplication::ProcessLine(char const*, bool, int*) () from /home/kkrizka/HEP/root-svn/lib/libCore.so
#49 0x0011dacf in TRint::Run(bool) () from /home/kkrizka/HEP/root-svn/lib/libRint.so
#50 0x08048c8f 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 0x0657d839 in int TStreamerInfo::WriteBufferAux<char**>(TBuffer&, char** const&, int, int, int, int) () from /home/kkrizka/HEP/root-svn/lib/libRIO.so
#13 0x064cffba in TStreamerInfoActions::GenericVectorPtrWriteAction(TBuffer&, void*, void const*, TStreamerInfoActions::TConfiguration const*) () from /home/kkrizka/HEP/root-svn/lib/libRIO.so
#14 0x0648aab9 in TBufferFile::ApplySequenceVecPtr(TStreamerInfoActions::TActionSequence const&, void*, void*) () from /home/kkrizka/HEP/root-svn/lib/libRIO.so
#15 0x033059cf in TBranchElement::FillLeavesClonesMember(TBuffer&) () from /home/kkrizka/HEP/root-svn/lib/libTree.so
#16 0x03303823 in TBranch::Fill() () from /home/kkrizka/HEP/root-svn/lib/libTree.so
#17 0x03304d88 in TBranchElement::Fill() () from /home/kkrizka/HEP/root-svn/lib/libTree.so
#18 0x03304b11 in TBranchElement::Fill() () from /home/kkrizka/HEP/root-svn/lib/libTree.so
#19 0x033510a4 in TTree::Fill() () from /home/kkrizka/HEP/root-svn/lib/libTree.so
===========================================================
Root > Function makeEventSample() busy flag cleared
Function pythiaExample() busy flag cleared
What am I doing wrong? Is this the recommended way to fill a tree in Pythia8 too?
I’ve looked at the ROOT examples that came with Pythia8 (rootexamples directory), and they fill a TTree using the Pythia8::Event class. Should I do that instead?
pythiaExample.C (7.3 KB)