# Root 6.04.14 hadd 100Gb and rootlogon

**URL:** <https://root-forum.cern.ch/t/root-6-04-14-hadd-100gb-and-rootlogon/24581>\
**Category:** ROOT\
**Created:** [April 28, 2017, 8:15am UTC](https://root-forum.cern.ch/t/root-6-04-14-hadd-100gb-and-rootlogon/24581 "2017-04-28T08:15:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![msaimper](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/m/f0a364/32.png) [@msaimper](https://root-forum.cern.ch/u/msaimper)\
**Post date:** [April 28, 2017, 8:15am UTC](https://root-forum.cern.ch/t/root-6-04-14-hadd-100gb-and-rootlogon/24581/1 "2017-04-28T08:15:38Z")

</div>

Dear experts,

I am currently trying to use hadd to make an output file with a tree with size \> 100 Gb.

I read:  
[https://root-forum.cern.ch/t/root-6-04-14-hadd-100gb-tfilemerger-recursiveremove/24117/4](https://root-forum.cern.ch/t/root-6-04-14-hadd-100gb-tfilemerger-recursiveremove/24117/4)  
and:

> [@Hadd: 100Gb TTree Limit/compression levels](https://root-forum.cern.ch/t/hadd-100gb-ttree-limit-compression-levels/16519):
>
> I want to merge 30 ~15Gb files containing an TNtuple using hadd, but get the following error: Fatal in \<TFileMerger::RecursiveRemove\>: Output file of the TFile Merger (targeting xxx.root) has been deleted (likely due to a TTree larger than 100Gb) Indeed, the target file is 100Gb when the error occurs. The files are generated from simulation data that writes an entry every break point. I have 512Gb of RAM on my server, and I don’t want to slow down hadd by using more compression if I can hel…

It seems that in my case the easiest solution is to create in the directory I execute “hadd” a rootlogon.C file with:  
{  
TTree::SetMaxTreeSize( 1000000000000LL ); // 1 TB  
}

However, it seems that when I run “hadd” this new option is not taken into account. I tried two commands:

- hadd output.root input\_\*

- root -l  
root [0] TTree::GetMaxTreeSize()  
(Long64\_t) 1000000000000  
root [1] gSystem-\>Exec(“hadd output.root input\_\*”);

I guess this is because hadd is not recompiled. Please could you tell me what the easiest way to take the new MaxTreeSize number into account in hadd?

I would prefer not to write a separate macro replicating the hadd behavior if possible.

Thanks for your help  
Best wishes  
Matthias

---

<div class="post-metadata">

**Author:** ![pcanal](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/pcanal/32/12439_2.png) [@pcanal](https://root-forum.cern.ch/u/pcanal)\
**Post date:** [May 1, 2017, 6:33pm UTC](https://root-forum.cern.ch/t/root-6-04-14-hadd-100gb-and-rootlogon/24581/2 "2017-05-01T18:33:02Z")

</div>

Indeed hadd does not load the rootlogon file. However you can still manager using the following pattern.

Use a source file (let’s called it startup.C) like

```auto
#include "TTree.h"

int startup() {
  TTree::SetMaxTreeSize( 1000000000000LL ); // 1 TB
  return 0;
}

namespace {
  static int i = startup();
}

```

compile it into a shared library, for example with:

```auto
root.exe -b -l -q startup.C+

```

and then use LD\_PRELOAD (DYLD\_INSERT\_LIBRARIES on MacOS) to preload that library:

```auto
 DYLD_INSERT_LIBRARIES=startup_C.so hadd output.root input_*
 LD_PRELOAD=startup_C.so hadd output.root input_*

```

Cheers,  
Philippe.

---

<div class="post-metadata">

**Author:** ![msaimper](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/m/f0a364/32.png) [@msaimper](https://root-forum.cern.ch/u/msaimper)\
**Post date:** [May 2, 2017, 7:23am UTC](https://root-forum.cern.ch/t/root-6-04-14-hadd-100gb-and-rootlogon/24581/3 "2017-05-02T07:23:06Z")

</div>

Dear Philippe,

thank you very much for your message, this is very helpful!

In addition, let me copy/paste here a little python script a colleague passed me which does the job also in case people visit this thread (\*).

Thanks again for your help  
Best wishes  
Matthias

(\*)

```auto
import ROOT
import os, sys

print 'Merging %s' % sys.argv[1]

print "Max tree size",ROOT.TTree.GetMaxTreeSize()
ROOT.TTree.SetMaxTreeSize(200000000000) # 200 Gb
print "Updated tree size",ROOT.TTree.GetMaxTreeSize()

rm = ROOT.TFileMerger(False)
rm.SetFastMethod(True)

path = 'mypath'
file_output = '%s.root' % sys.argv[1]
file_list = []
for path, dirs, files in os.walk(path):
  for filename in files:
    if ('%s_part' % sys.argv[1]) in filename: file_list.append(path+filename)

print "Input file list:",file_list
print "Output file:",file_output

for F in file_list:

    print "Adding ->",F
    rm.AddFile(F)

rm.OutputFile(file_output)
rm.Merge()

```

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [May 16, 2017, 7:27am UTC](https://root-forum.cern.ch/t/root-6-04-14-hadd-100gb-and-rootlogon/24581/4 "2017-05-16T07:27:04Z")

</div>

Closed on May 16, 2017, 7:27am UTC

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
