]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUONSparseHisto.cxx
Adding more bins in QA (Alis)
[u/mrichter/AliRoot.git] / MUON / AliMUONSparseHisto.cxx
index 9a81a0ac15ab6f2569afbc51a8f2ca572e38d67c..289f421c377c3dfb6e016850ec2eb1f695691aa7 100644 (file)
@@ -17,6 +17,7 @@
 
 #include "AliMUONSparseHisto.h"
 
+#include "AliLog.h"
 #include <Riostream.h>
 #include <TH1.h>
 #include <TMath.h>
@@ -31,6 +32,8 @@
 ///
 /// \author Laurent Aphecetche, Subatech
 
+using std::cout;
+using std::endl;
 /// \cond CLASSIMP
 ClassImp(AliMUONSparseHisto)
 /// \endcond
@@ -81,6 +84,26 @@ AliMUONSparseHisto::~AliMUONSparseHisto()
   delete[] fArray;
 }
 
+//______________________________________________________________________________
+Bool_t 
+AliMUONSparseHisto::Add(const AliMUONSparseHisto& h)
+{
+  /// Add h to this
+
+  if ( fXmin != h.Xmin() || fXmax != h.Xmax() ) 
+  {
+    AliError("Cannot add sparse histograms with different limits !");
+    return kFALSE;
+  }
+  
+  for ( Int_t i = 0; i < h.GetNbins(); ++i ) 
+  {
+    Fill(h.GetBinContent(i));
+  }  
+  
+  return kTRUE;
+}
+
 //______________________________________________________________________________
 void 
 AliMUONSparseHisto::Clear(Option_t*)