Revision 7ba112e2c428e7f5d165b17a20b0b84e8e4386fd authored by Rene Brun on 20 January 2002, 10:21:47 UTC, committed by Rene Brun on 20 January 2002, 10:21:47 UTC
 Int_t Merge(TCollection *list)

All classes created by TTreePlayer::DrawSelect have now a Merge function.
This function will be called by the PROOF system currently in development
to merge the list of objects generated by each slave processor on
the master server.
In case of histograms (1,2,3-D, profiles) Merge computes the min/max for
the x, y or z axis, the new number of bins, if necessary. iT add bin contents,
errors and statistics.
The function returns the merged number of entries if the merge is
successfull, -1 otherwise.

In case of polymarkers (2 or 3-d), Merge adds the list of markers in
the collection to the current object.

An example to merge a list of histograms with different binning, but
having a lowest common denominator bin size is shown below:

void atest() {
   TH1F *h1 = new TH1F("h1","h1",110,-110,0);
   TH1F *h2 = new TH1F("h2","h2",220,0,110);
   TH1F *h3 = new TH1F("h3","h3",330,-55,55);
   TRandom r;
   for (Int_t i=0;i<10000;i++) {
      h1->Fill(r.Gaus(-55,10));
      h2->Fill(r.Gaus(55,10));
      h3->Fill(r.Gaus(0,10));
   }

   TList *list = new TList;
   list->Add(h1);
   list->Add(h2);
   list->Add(h3);
   TH1F *h = (TH1F*)h1->Clone("h");
   h->Reset();
   h.Merge(list);
   h->Draw();


git-svn-id: http://root.cern.ch/svn/root/trunk@3715 27541ba8-7e3a-0410-8455-c3a389f83636
1 parent 00c7e4b
History

back to top