You are here

Merging customized classes

Merging customized classes

The PROOF merging phase takes place on the master when the lists of results are received from the workers. PROOF looks for the Merge method of the object class and applies it to the list of objects in hands.

The Merge(TCollection *) interface

The signature of the Merge() method is:

void myClass::Merge(TCollection *)

The idea is that an object is passed a list of similar objects and it should take the necessary steps to incorporate the information contained in these objects into itself. For common objects, like histograms and trees, the Merge() method is provided by ROOT.

The following is an example of the way TH1::Merge could look like in his basic form:

void TH1::Merge(TCollection *hlist)
   // Possible implementation for TH1::Merge; the real one add checks on the ranges ...

   if (hlist) {
      TH1 *xh = 0;
      TIter nxh(hlist);
      while (xh = (TH1 *) nxh()) {
         // Add this histogram to me

The real implementation is more complicated because of the checks on the bin ranges.

Note that currently the return value from Merge() is ignored. It may be used in the future.

Finally, for full ROOT functionality (hadd, etc...), if the new class is provided via a new dedicated library, e.g., a rootmap file has to be created and placed together with the the library. The rootmap file is a text file with information about the content of the library in terms of class; the name of the file must be the same of the library, with extension '.rootmap', for example libmyClass.rootmap . See examples under $ROOTSYS/lib .