How to submit parallel jobs using TChain

Dear,

I want to run a script with many MC files in parallel, but having the output all merged.
Is there any clean way to do it using TChain? Or do I have to make list of commands to be submitted and later on hadd the outputs?

Thanks for your help!

What do you mean by “submit parallel jobs”?
I don’t think ROOT knows anything about your batch system so, unless you try to use ROOT’s built-in PROOF or PROOF-Lite or multi-threading / multi-processing, you need to split your jobs manually.

Hi,

Thanks for your answer, maybe another question, what if your MC file is too large, is there a way divide the events in a few subfiles? or again, you have to do it manually using the event number?

and you can download the binary for your platform+OS from https://go-hep.org/dist (choosing the latest version).
you don’t need Go installed on your machine (you just need to get root-split.)

Hi Sebastien,

Thanks a lot for the suggestion, do you mind explaining how this works and how to install it?

many thanks

how it works

root-split takes an input ROOT file, the name of the input tree to split out and the number of events per output file.

how to install

binary installation

you just have to go there:

choose the binary for your OS/platform (e.g.: root-split-linux_amd64.exe for a Linux/64b machine, root-split-darwin_amd64.exe for a Mac, etc…)
download it (eventually make it executable, chmod +x ./the.file.exe on a Unix machine)

and voilà.

from sources

alternatively, you can install it from sources like so:

  • install the Go compiler: golang.org/doc/install
  • and then run:
    $> go get -v go-hep.org/x/hep/groot/cmd/root-split
    
    this will download the sources (and their dependencies, recursively), and compile+install the binary.

then:

$> root-split -h
Usage: root-split [options] file.root

ex:
 $> root-split -o out.root -n 10 ./testdata/chain.flat.1.root

options:
  -n int
    	number of events to split into (default 100)
  -o string
    	path to output ROOT files (default "out.root")
  -t string
    	input tree name to split (default "tree")
  -v	enable verbose mode

hth,
-s