Hello all,
I have to write a macro that
- reads a TTree, in a ROOT file, which is made of branches whose elements are simple numbers and some other whose elements are std::vector, both Int_t and Double_t;
- searches for some conditions and in case do some operations and write to ANOTHER TTree, within the same ROOT file, in form of std::vector.
In this macro I included as dictionary for CINT. when I read the first TTree I use
std::vector<Vec_type> vec_name1;
T1->SetBranchAddress("branch_name1", &vec_name1);
where “branch_name” is a branch in which the elements are std::vector.
In creating the vectors that will be the entries for the branches of the new TTree I use
std::vector<Vec_type> vec_name2;
T2->Branch("branch_name2",& vec_name2);
where the numbers 1 and 2 after branch and vec name indicates the fact that they belong to the first or second TTree of the ROOT file.
Then I simply put
T2->Fill();
file_ptr->Write();
to fill the new TTree and write the new file.
Unfortunately when I try to plot branches initiating a TBrowser I get empty canvases, when I try to Scan the new TTree I get this segmentation fault signal:
(no debugging symbols found)
Using host libthread_db library "/lib/tls/libthread_db.so.1".
Attaching to program: /proc/2152/exe, process 2152
(no debugging symbols found)...done.
[Thread debugging using libthread_db enabled]
[New Thread -1208285504 (LWP 2152)]
(no debugging symbols found)...done.
(no debugging symbols found)...done.
(no debugging symbols found)...done.
(no debugging symbols found)...done.
(no debugging symbols found)...done.
(no debugging symbols found)...done.
(no debugging symbols found)...done.
0x00b2a7a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
#1 0x069dc7d3 in __waitpid_nocancel () from /lib/tls/libc.so.6
#2 0x06986649 in do_system () from /lib/tls/libc.so.6
#3 0x00a128bd in system () from /lib/tls/libpthread.so.0
#4 0x0041ff07 in TUnixSystem::Exec () from /disk3/sw/root/5.22.00/lib/libCore.so
#5 0x00425b9f in TUnixSystem::StackTrace () from /disk3/sw/root/5.22.00/lib/libCore.so
#6 0x0042259a in TUnixSystem::DispatchSignals () from /disk3/sw/root/5.22.00/lib/libCore.so
#7 0x00422628 in SigHandler () from /disk3/sw/root/5.22.00/lib/libCore.so
#8 0x004218a5 in sighandler () from /disk3/sw/root/5.22.00/lib/libCore.so
#9 <signal handler called>
#10 0x008e2bb5 in std::fill_n<double*, unsigned int, double> () from /disk3/sw/root/5.22.00/lib/libMathCore.so
#11 0x008e36cc in std::vector<double, std::allocator<double> >::_M_fill_insert () from /disk3/sw/root/5.22.00/lib/libMathCore.so
#12 0x0098790d in std::vector<double, std::allocator<double> >::insert () from /disk3/sw/root/5.22.00/lib/libMathCore.so
#13 0x0098748b in std::vector<double, std::allocator<double> >::resize () from /disk3/sw/root/5.22.00/lib/libMathCore.so
#14 0x009873d5 in std::vector<double, std::allocator<double> >::resize () from /disk3/sw/root/5.22.00/lib/libMathCore.so
#15 0x00987bb0 in ROOT::TCollectionProxyInfo::Pushback<std::vector<double, std::allocator<double> > >::resize () from /disk3/sw/root/5.22.00/lib/libMathCore.so
#16 0x06d7591c in TGenCollectionStreamer::ReadPrimitives () from /disk3/sw/root/5.22.00/lib/libRIO.so
#17 0x06d77eb7 in TGenCollectionStreamer::Streamer () from /disk3/sw/root/5.22.00/lib/libRIO.so
#18 0x06d4e92d in TCollectionStreamer::Streamer () from /disk3/sw/root/5.22.00/lib/libRIO.so
#19 0x06d4f343 in TCollectionClassStreamer::operator() () from /disk3/sw/root/5.22.00/lib/libRIO.so
#20 0x003e2ea6 in TClass::Streamer () from /disk3/sw/root/5.22.00/lib/libCore.so
#21 0x06d4970b in TBufferFile::ReadFastArray () from /disk3/sw/root/5.22.00/lib/libRIO.so
#22 0x06e049af in TStreamerInfo::ReadBuffer<char**> () from /disk3/sw/root/5.22.00/lib/libRIO.so
#23 0x02b51f6b in TBranchElement::ReadLeaves () from /disk3/sw/root/5.22.00/lib/libTree.so
#24 0x02b4c5fc in TBranch::GetEntry () from /disk3/sw/root/5.22.00/lib/libTree.so
#25 0x02b4e89b in TBranchElement::GetEntry () from /disk3/sw/root/5.22.00/lib/libTree.so
#26 0x0276e4ba in TTreeFormula::LoadCurrentDim () from /disk3/sw/root/5.22.00/lib/libTreePlayer.so
#27 0x0277a981 in TTreeFormulaManager::GetNdata () from /disk3/sw/root/5.22.00/lib/libTreePlayer.so
#28 0x0276c147 in TTreeFormula::GetNdata () from /disk3/sw/root/5.22.00/lib/libTreePlayer.so
#29 0x02788d7e in TTreePlayer::Scan () from /disk3/sw/root/5.22.00/lib/libTreePlayer.so
#30 0x02b9a1eb in TTree::Scan () from /disk3/sw/root/5.22.00/lib/libTree.so
#31 0x02bc5332 in G__G__Tree_109_0_144 () from /disk3/sw/root/5.22.00/lib/libTree.so
#32 0x00b7ebd7 in Cint::G__ExceptionWrapper () from /disk3/sw/root/5.22.00/lib/libCint.so
#33 0x00c13adc in G__execute_call () from /disk3/sw/root/5.22.00/lib/libCint.so
#34 0x00c13dee in G__call_cppfunc () from /disk3/sw/root/5.22.00/lib/libCint.so
#35 0x00bf4a1f in G__interpret_func () from /disk3/sw/root/5.22.00/lib/libCint.so
#36 0x00be3410 in G__getfunction () from /disk3/sw/root/5.22.00/lib/libCint.so
#37 0x00cc79fd in G__getstructmem () from /disk3/sw/root/5.22.00/lib/libCint.so
#38 0x00cbf4f3 in G__getvariable () from /disk3/sw/root/5.22.00/lib/libCint.so
#39 0x00bc7412 in G__getitem () from /disk3/sw/root/5.22.00/lib/libCint.so
#40 0x00bc78a5 in G__getitem () from /disk3/sw/root/5.22.00/lib/libCint.so
#41 0x00bca3a7 in G__getexpr () from /disk3/sw/root/5.22.00/lib/libCint.so
#42 0x00c400bc in G__exec_statement () from /disk3/sw/root/5.22.00/lib/libCint.so
#43 0x00bb552c in G__exec_tempfile_core () from /disk3/sw/root/5.22.00/lib/libCint.so
#44 0x00bb6867 in G__exec_tempfile_fp () from /disk3/sw/root/5.22.00/lib/libCint.so
#45 0x00c4f790 in G__process_cmd () from /disk3/sw/root/5.22.00/lib/libCint.so
#46 0x0040e1af in TCint::ProcessLine () from /disk3/sw/root/5.22.00/lib/libCore.so
#47 0x00346eaa in TApplication::ProcessLine () from /disk3/sw/root/5.22.00/lib/libCore.so
#48 0x0011e1b3 in TRint::HandleTermInput () from /disk3/sw/root/5.22.00/lib/libRint.so
#49 0x0011c684 in TTermInputHandler::Notify () from /disk3/sw/root/5.22.00/lib/libRint.so
#50 0x0011ead2 in TTermInputHandler::ReadNotify () from /disk3/sw/root/5.22.00/lib/libRint.so
#51 0x0041e892 in TUnixSystem::CheckDescriptors () from /disk3/sw/root/5.22.00/lib/libCore.so
#52 0x00422a78 in TUnixSystem::DispatchOneEvent () from /disk3/sw/root/5.22.00/lib/libCore.so
#53 0x0039f788 in TSystem::InnerLoop () from /disk3/sw/root/5.22.00/lib/libCore.so
#54 0x0039f54f in TSystem::Run () from /disk3/sw/root/5.22.00/lib/libCore.so
#55 0x0034702a in TApplication::Run () from /disk3/sw/root/5.22.00/lib/libCore.so
#56 0x0011cf6a in TRint::Run () from /disk3/sw/root/5.22.00/lib/libRint.so
#57 0x08048d46 in main ()
Can anyone help me?
Thank you for helping me.
PS I’m running on a ROOT v5.22/00 with SLC v4.5