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 Add(xh); } } }
Note that currently the return value from Merge() is ignored. It may be used in the future.