Re: problems pasting ntuples ?

From: Rene Brun <Rene.Brun_at_cern.ch>
Date: Tue, 3 Nov 2009 16:57:50 +0100


It is likely that your program crashes when ROOT automatically creates a new output file when the max tree size is reached. For more details see documentation of TTree::ChangeFile.

However, what you are doing is not the most efficient way to combine files. Instead of your program do
  hadd -f result.root file1.root file2.root .. fileN.root where hadd is $ROOTSYS/bin/hadd

Rene Brun

Henso Abreu wrote:
> Hello,
>
> I use the following script to paste several root files (247 files ~10M
> events) into only one or two root files .
>
> void ntuple_glue(TString path){
> TChain *mytree = new TChain("mytree");
> Int_t nntup = mytree->Add(path);
> Int_t entries = mytree->GetEntries();
> cout << " Number of merged ntuples = " << nntup ;
> cout << ", Number of Entries ="<<entries<<endl;
> // Pasting all ntuples into one file
>
> TFile * machin = new TFile("OneNtuple.root","RECREATE");
> TTree *tree = mytree->CloneTree(0);
> // tree->SetAutoSave();
> gROOT->cd();
> for (unsigned int ievt = 0; ievt < entries; ievt++){
> if (ievt%10000 == 0 ) std::cout << "Reading event "<< ievt
> <<std::endl;
> mytree->GetEntry(ievt);
> tree->Fill();
>
> }
> machin->cd();
> tree->Write("",TObject::kOverwrite);
> machin->Close();
> }
>
>
> He works very , but just at the end crash "see below", to be honest I
> don't have any idea.
>
> Could someone help me?
>
> Henso
>
>
> Reading event 9670000
> Reading event 9680000
> Reading event 9690000
> Reading event 9700000
> Reading event 9710000
> Reading event 9720000
> Reading event 9730000
> Reading event 9740000
> Reading event 9750000
> Reading event 9760000
> Reading event 9770000
> Reading event 9780000
> Reading event 9790000
> Reading event 9800000
> Reading event 9810000
> Reading event 9820000
> Reading event 9830000
>
> *** Break *** segmentation violation
> (no debugging symbols found)
> Using host libthread_db library "/lib64/tls/libthread_db.so.1".
> Attaching to program: /proc/25451/exe, process 25451
> (no debugging symbols found)...done.
> [Thread debugging using libthread_db enabled]
> [New Thread 4144347360 (LWP 25451)]
> (no debugging symbols found)...done.
> (no debugging symbols found)...done.
> (no debugging symbols found)...done.
> 0xffffe410 in __kernel_vsyscall
> ()
> #1 0x00257d23 in __waitpid_nocancel () from /lib/tls/libc.so.6
> #2 0x002017a9 in do_system () from /lib/tls/libc.so.6
> #3 0x003fe98d in system () from /lib/tls/libpthread.so.0
> #4 0xf7b624bb in TUnixSystem::Exec () from
> /tmp_mnt/lal_prod/Linux/gen/root/v5.24sl4gcc3.4/lib/libCore.so
> #5 0xf7b68153 in TUnixSystem::StackTrace () from
> /tmp_mnt/lal_prod/Linux/gen/root/v5.24sl4gcc3.4/lib/libCore.so
> #6 0xf7b64b4e in TUnixSystem::DispatchSignals () from
> /tmp_mnt/lal_prod/Linux/gen/root/v5.24sl4gcc3.4/lib/libCore.so
> #7 0xf7b64bdc in SigHandler () from
> /tmp_mnt/lal_prod/Linux/gen/root/v5.24sl4gcc3.4/lib/libCore.so
> #8 0xf7b63e59 in sighandler () from
> /tmp_mnt/lal_prod/Linux/gen/root/v5.24sl4gcc3.4/lib/libCore.so
> #9 <signal handler called>
> #10 0xf7bae4a6 in G__G__Base1_8_0_22 () from
> /tmp_mnt/lal_prod/Linux/gen/root/v5.24sl4gcc3.4/lib/libCore.so
> #11 0xf72c8d43 in Cint::G__ExceptionWrapper () from
> /tmp_mnt/lal_prod/Linux/gen/root/v5.24sl4gcc3.4/lib/libCint.so
> #12 0xf735dbdc in G__execute_call () from
> /tmp_mnt/lal_prod/Linux/gen/root/v5.24sl4gcc3.4/lib/libCint.so
> #13 0xf735deee in G__call_cppfunc () from
> /tmp_mnt/lal_prod/Linux/gen/root/v5.24sl4gcc3.4/lib/libCint.so
> #14 0xf733ebb7 in G__interpret_func () from
> /tmp_mnt/lal_prod/Linux/gen/root/v5.24sl4gcc3.4/lib/libCint.so
> #15 0xf732d4ec in G__getfunction () from
> /tmp_mnt/lal_prod/Linux/gen/root/v5.24sl4gcc3.4/lib/libCint.so
> #16 0xf741185d in G__getstructmem () from
> /tmp_mnt/lal_prod/Linux/gen/root/v5.24sl4gcc3.4/lib/libCint.so
> #17 0xf7409353 in G__getvariable () from
> /tmp_mnt/lal_prod/Linux/gen/root/v5.24sl4gcc3.4/lib/libCint.so
> #18 0xf73114da in G__getitem () from
> /tmp_mnt/lal_prod/Linux/gen/root/v5.24sl4gcc3.4/lib/libCint.so
> #19 0xf731446f in G__getexpr () from
> /tmp_mnt/lal_prod/Linux/gen/root/v5.24sl4gcc3.4/lib/libCint.so
> #20 0xf738d5d4 in G__exec_statement () from
> /tmp_mnt/lal_prod/Linux/gen/root/v5.24sl4gcc3.4/lib/libCint.so
> #21 0xf734069f in G__interpret_func () from
> /tmp_mnt/lal_prod/Linux/gen/root/v5.24sl4gcc3.4/lib/libCint.so
> #22 0xf732d32e in G__getfunction () from
> /tmp_mnt/lal_prod/Linux/gen/root/v5.24sl4gcc3.4/lib/libCint.so
> #23 0xf7311824 in G__getitem () from
> /tmp_mnt/lal_prod/Linux/gen/root/v5.24sl4gcc3.4/lib/libCint.so
> #24 0xf731446f in G__getexpr () from
> /tmp_mnt/lal_prod/Linux/gen/root/v5.24sl4gcc3.4/lib/libCint.so
> #25 0xf738d5d4 in G__exec_statement () from
> /tmp_mnt/lal_prod/Linux/gen/root/v5.24sl4gcc3.4/lib/libCint.so
> #26 0xf72ff660 in G__exec_tempfile_core () from
> /tmp_mnt/lal_prod/Linux/gen/root/v5.24sl4gcc3.4/lib/libCint.so
> #27 0xf730097b in G__exec_tempfile_fp () from
> /tmp_mnt/lal_prod/Linux/gen/root/v5.24sl4gcc3.4/lib/libCint.so
> #28 0xf7399b28 in G__process_cmd () from
> /tmp_mnt/lal_prod/Linux/gen/root/v5.24sl4gcc3.4/lib/libCint.so
> #29 0xf7b504b7 in TCint::ProcessLine () from
> /tmp_mnt/lal_prod/Linux/gen/root/v5.24sl4gcc3.4/lib/libCore.so
> #30 0xf7a83faa in TApplication::ProcessLine () from
> /tmp_mnt/lal_prod/Linux/gen/root/v5.24sl4gcc3.4/lib/libCore.so
> #31 0xf70cd6df in TRint::HandleTermInput () from
> /tmp_mnt/lal_prod/Linux/gen/root/v5.24sl4gcc3.4/lib/libRint.so
> #32 0xf70cbbb0 in TTermInputHandler::Notify () from
> /tmp_mnt/lal_prod/Linux/gen/root/v5.24sl4gcc3.4/lib/libRint.so
> #33 0xf70cdffe in TTermInputHandler::ReadNotify () from
> /tmp_mnt/lal_prod/Linux/gen/root/v5.24sl4gcc3.4/lib/libRint.so
> #34 0xf7b60e46 in TUnixSystem::CheckDescriptors () from
> /tmp_mnt/lal_prod/Linux/gen/root/v5.24sl4gcc3.4/lib/libCore.so
> #35 0xf7b6502c in TUnixSystem::DispatchOneEvent () from
> /tmp_mnt/lal_prod/Linux/gen/root/v5.24sl4gcc3.4/lib/libCore.so
> #36 0xf7ae07c4 in TSystem::InnerLoop () from
> /tmp_mnt/lal_prod/Linux/gen/root/v5.24sl4gcc3.4/lib/libCore.so
> #37 0xf7ae058b in TSystem::Run () from
> /tmp_mnt/lal_prod/Linux/gen/root/v5.24sl4gcc3.4/lib/libCore.so
> #38 0xf7a84166 in TApplication::Run () from
> /tmp_mnt/lal_prod/Linux/gen/root/v5.24sl4gcc3.4/lib/libCore.so
> #39 0xf70cc496 in TRint::Run () from
> /tmp_mnt/lal_prod/Linux/gen/root/v5.24sl4gcc3.4/lib/libRint.so
> #40 0x08048d46 in main ()
> Root > Function ntuple_glue() busy flag cleared
>
Received on Tue Nov 03 2009 - 16:57:31 CET

This archive was generated by hypermail 2.2.0 : Tue Nov 03 2009 - 17:50:03 CET