]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MONITOR/AliMonitorHisto.cxx
First version of ACORDE QA reference data. Up tp now, we use the modules activity...
[u/mrichter/AliRoot.git] / MONITOR / AliMonitorHisto.cxx
index 42f4c8a2a8c4185d9bb2322f0508d25d443afa2a..d9dec4c6fce404bcd26ab68a4b5a99a9391a1f24 100644 (file)
 ///////////////////////////////////////////////////////////////////////////////
 
 
-#include "AliMonitorHisto.h"
-#include <TProfile.h>
 #include <TH2.h>
+#include <TMath.h>
+#include <TProfile.h>
 #include <TVirtualPad.h>
 
+#include "AliLog.h"
+
+#include "AliMonitorHisto.h"
+
 
 ClassImp(AliMonitorHisto) 
 
@@ -40,25 +44,55 @@ Int_t   AliMonitorHisto::fgNHistosMax = 10;
 
 
 //_____________________________________________________________________________
-AliMonitorHisto::AliMonitorHisto()
+AliMonitorHisto::AliMonitorHisto() :
+  AliMonitorPlot(),
+  fHisto(NULL),
+  fHistoList(),
+  fNHistos(0),
+  fHistoRun(NULL),
+  fHistoDraw(NULL),
+  fHistoRef(NULL),
+  fHistoCompare(NULL),
+  fNorm(kNormNone)
 {
 // default contructor
 
-  fHisto = NULL;
-  fNHistos = 0;
-  fHistoRun = NULL;
-  fHistoDraw = NULL;
-  fHistoRef = NULL;
-  fHistoCompare = NULL;
-  fNorm = kNormNone;
 }
 
 //_____________________________________________________________________________
 AliMonitorHisto::AliMonitorHisto(const AliMonitorHisto& histo) :
-  AliMonitorPlot(histo)
+  AliMonitorPlot(histo),
+  fHisto(NULL),
+  fHistoList(),
+  fNHistos(histo.fNHistos),
+  fHistoRun(NULL),
+  fHistoDraw(NULL),
+  fHistoRef(NULL),
+  fHistoCompare(NULL),
+  fNorm(histo.fNorm)
 {
 // copy constructor
 
+  Bool_t addStatus = TH1::AddDirectoryStatus();
+  TH1::AddDirectory(kFALSE);
+  if (histo.fHisto) fHisto = (TH1*) histo.fHisto->Clone();
+  TObjLink* link = histo.fHistoList.FirstLink();
+  for (Int_t i = 0; i < fNHistos; i++) {
+    fHistoList.Add(link->GetObject()->Clone());
+    link = link->Next();
+  }
+  if (histo.fHistoRun) fHistoRun = (TH1*) histo.fHistoRun->Clone();
+  if (histo.fHistoRef) fHistoRef = (TH1*) histo.fHistoRef->Clone();
+  TH1::AddDirectory(addStatus);
+}
+
+//_____________________________________________________________________________
+AliMonitorHisto& AliMonitorHisto::operator =(const AliMonitorHisto& histo)
+{
+// assignment operator
+
+  AliMonitorPlot::operator =(histo);
+
   Bool_t addStatus = TH1::AddDirectoryStatus();
   TH1::AddDirectory(kFALSE);
   fHisto = NULL;
@@ -77,31 +111,35 @@ AliMonitorHisto::AliMonitorHisto(const AliMonitorHisto& histo) :
   fHistoCompare = NULL;
   fNorm = histo.fNorm;
   TH1::AddDirectory(addStatus);
+
+  return *this;
 }
 
 //_____________________________________________________________________________
 AliMonitorHisto::AliMonitorHisto(TH1* histo, ENorm norm) :
-  AliMonitorPlot(histo->GetName(), histo->GetTitle())
+  AliMonitorPlot(histo->GetName(), histo->GetTitle()),
+  fHisto(histo),
+  fHistoList(),
+  fNHistos(0),
+  fHistoRun(NULL),
+  fHistoDraw(NULL),
+  fHistoRef(NULL),
+  fHistoCompare(NULL),
+  fNorm(norm)
 {
 // create a monitor histogram from the given histogram
 
   if (histo->GetDimension() > 2) {
-    Fatal("AliMonitorHisto", "3 dimensional histograms are not supported");
+    AliFatal("3 dimensional histograms are not supported");
   }
 
   histo->SetDirectory(NULL);
   histo->Reset();
-  fHisto = histo;
   fHisto->Sumw2();
-  fNHistos = 0;
   Bool_t addStatus = TH1::AddDirectoryStatus();
   TH1::AddDirectory(kFALSE);
   fHistoRun = (TH1*) histo->Clone();
   TH1::AddDirectory(addStatus);
-  fHistoDraw = NULL;
-  fHistoRef = NULL;
-  fHistoCompare = NULL;
-  fNorm = norm;
 }
 
 //_____________________________________________________________________________
@@ -167,7 +205,7 @@ void AliMonitorHisto::Fill(Axis_t x, Axis_t y, Stat_t w)
   } else if (fHisto->InheritsFrom(TProfile::Class())) {
     ((TProfile*)fHisto)->Fill(x, y, w);
   } else {
-    Error("Fill", "trying to fill x and y of a 1 dimensinal histogram");
+    AliError("trying to fill x and y of a 1 dimensinal histogram");
     return;
   }
 }
@@ -296,7 +334,7 @@ Bool_t AliMonitorHisto::ComparePlot()
   if (!fHistoRef) return kTRUE;
   if (fgThreshold <= 0) return kTRUE;
   if (!fHistoDraw) {
-    Info("Compare", "no data histogram available for comparison\ncall DrawEvent, DrawSum or DrawRaw before calling Compare");
+    AliWarning("no data histogram available for comparison\ncall DrawEvent, DrawSum or DrawRaw before calling Compare");
     return kTRUE;
   }
   if (fHistoCompare) delete fHistoCompare;
@@ -336,12 +374,12 @@ Bool_t AliMonitorHisto::GetEvent(Int_t number)
 // get the normalized monitor histogram for the "number"th last event
 
   if (fNHistos == 0) {
-    Info("GetEvent", "there are no histograms for single events available");
+    AliWarning("there are no histograms for single events available");
     return kFALSE;
   }
   if (number > fNHistos) {
-    Error("GetEvent", "requested event number (%d) exceeds range of available events (%d)\n", 
-         number, fNHistos);
+    AliError(Form("requested event number (%d) exceeds range of available events (%d)", 
+                 number, fNHistos));
     return kFALSE;
   }
   if (number <= 0) return kFALSE;
@@ -368,12 +406,12 @@ Bool_t AliMonitorHisto::GetSum(Int_t number)
 // "number" events
 
   if (fNHistos == 0) {
-    Info("GetSum", "there are no histograms for single events available");
+    AliWarning("there are no histograms for single events available");
     return kFALSE;
   }
   if (number > fNHistos) {
-    Info("GetSum", "requested number of events (%d) exceeds range of available events (%d)\nusing last %d event(s)", 
-         number, fNHistos, fNHistos);
+    AliError(Form("requested number of events (%d) exceeds range of available events (%d)\nusing last %d event(s)", 
+                 number, fNHistos, fNHistos));
     number = fNHistos;
   }
   if (number <= 0) return kFALSE;