TFileMerger crashes with segmentation violation

Hi all,

I am trying to merge two files using the TFileMerger. I use the following script:

TFileMerger *fFM = new TFileMerger();
fFM->AddFile(“File1”);
fFM->AddFile(“File2”);
fFM->Merge();

The result is the following:
*** Break *** segmentation violation
Using host libthread_db library “/lib64/tls/libthread_db.so.1”.
Attaching to program: /proc/24369/exe, process 24369
[Thread debugging using libthread_db enabled]
[New Thread 183250799808 (LWP 24369)]
0x000000396f68e704 in waitpid () from /lib64/tls/libc.so.6
#1 0x000000396f63978f in do_system () from /lib64/tls/libc.so.6
#2 0x0000002aa58e8371 in TUnixSystem::StackTrace () from /home/wilka/ALICE_v4-16-Rev-06/root/lib/libCore.so
#3 0x0000002aa58e4e8a in TUnixSystem::DispatchSignals () from /home/wilka/ALICE_v4-16-Rev-06/root/lib/libCore.so
#4
#5 0x0000002aa589d2b5 in TSeqCollection::Merge () from /home/wilka/ALICE_v4-16-Rev-06/root/lib/libCore.so

I also tried to use hadd with exactly the same result. Has anyone an idea what could have gone wrong? The files themselves seem to be ok.

Best regards and thank you for your help,
Alex
File2.root (66.7 KB)
File1.root (66.3 KB)

Hi,

Thanks for reporting this problem with merge collections with ‘gaps’ in them.
This is fixed in the trunk by revision 28588.

Cheers,
Philippe.

Thank you for the fix. Now it works fine.
But, what do you mean with “merge collections with ‘gaps’ in them”?

Cheers,
Alex

Hi,

In your file you have 2 TObjArray, the one named checkPID has a ‘gap’ in it:Attaching file /Users/pcanal/Downloads/File1-1.root as _file0... root [1] TFile *_file0 = TFile::Open("/Users/pcanal/Downloads/File1-1.root") root [2] checkPID->At(6) (const class TObject*)0x102053400 root [3] checkPID->At(7) (const class TObject*)0x0 root [4] checkPID->At(8) (const class TObject*)0x102053800I.e. slot #7 is empty while slot #8 is not. If you need to preserve this gap, you will need to do the merging by hand.

Cheers,
Philippe.

Ok. Thank you very much! :slight_smile: