TSelector variables wrt slaves


I am trying to migrate my analysis code (based on TTree::MakeClass) to TSelector. I have a few questions:

  • At the moment, I initialize the member variables of my class in its constructor. Does this still work, or do I need to initialize them in SlaveBegin()?

  • How do I pass run-time arguments to the selector? I see there is fInput, but it is a TList so it seems that it can only hold TObjects. I’m not sure how to pass bools or STL vectors that do not inherit from TObject.

Also, I’m confused about which objects I need to add for my slaves to see them. I would like to add as few as possible since I have around 200 histograms, as well as numerous other arrays, enums, etc belonging to the class. Do I only need to add those objects (histograms) that will be merged into the output, or all? Same question also about adding non-TObjects.

Would be grateful for any advice!


Dear Eric.

The constructor is run on every node, but the input list is not yet filled when the constructor is called, so if you want to use run-time arguments you have to initialize things in SlaveBegin().

For non TObject-derived objects you need a wrapper. We have TParameter for that, which is a templated class. The only trick is that dictionaries (and streamers) are not defined for all possible implementations, so you have to add the ones that you need. See the attached example, where I have added a std::vector, together w/ other ROOT types for which the dictionary is not there by default.

You need to add those that you are used by the workers either in input or in output. Those that you expect to be merged should be added to the output list.
Are the 200 histos the output of your run? If yes then they should go to the output list.

If the non-TObjects are the output of your analysis , and therefore you need them back - you need to have streamers for them to transfer them correctly over the sockets. The easiest is to write a dedicated TObject wrapper where you can also implement the Merge method, if you want them to be automatically merged.

To try the attached example, do the following

$ tar xf exapar.tar
$ cd exapar
$ root
root [0] .L runExaPar.C+
root [1] runExaPar("<proofmaster>")

where is the entry point of your PROOF cluster.
The sort of output that you should get is also included in the attached tarball (see runExaPar.log).

G. Ganis
exapar.tar (30 KB)