]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MONITOR/AliMonitor.cxx
Coding conventions (Gustavo)
[u/mrichter/AliRoot.git] / MONITOR / AliMonitor.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 /* $Id$ */
17
18 ///////////////////////////////////////////////////////////////////////////////
19 //                                                                           //
20 //  This is the base class for the creation and filling of monitor           //
21 //  histograms.                                                              //
22 //  Derived classes have to implement the methods CreateHistos and           //
23 //  FillHistos. CreateHistos has to create the monitor histograms, put       //
24 //  them into a new folder and add this folder to the given root folder.     //
25 //  FillHistos has to fill the data of the current event into the created    //
26 //  monitor histograms.                                                      //
27 //                                                                           //
28 ///////////////////////////////////////////////////////////////////////////////
29
30
31 #include <TFolder.h>
32 #include <TH1.h>
33 #include <TH2.h>
34
35 #include "AliLog.h"
36 #include "AliMonitorTrend.h"
37
38 #include "AliMonitor.h"
39
40
41 ClassImp(AliMonitor) 
42
43
44 //_____________________________________________________________________________
45 AliMonitor::AliMonitor()
46 {
47   fFolder = NULL;
48 }
49
50 //_____________________________________________________________________________
51 AliMonitor::AliMonitor(const AliMonitor& monitor) :
52   TObject(monitor)
53 {
54   AliFatal("copy constructor not implemented");
55 }
56
57 //_____________________________________________________________________________
58 AliMonitor& AliMonitor::operator = (const AliMonitor& /*monitor*/)
59 {
60   AliFatal("assignment operator not implemented");
61   return *this;
62 }
63
64 //_____________________________________________________________________________
65 void AliMonitor::CreateBranches(TTree*)
66 {
67 // add branches to the monitor tree
68 // by default no branches are added
69 // this method can be overwritten by derived classes
70
71 }
72
73
74 //_____________________________________________________________________________
75 AliMonitorHisto* AliMonitor::CreateHisto1(const char* name, const char* title,
76                               Int_t xBins, Double_t xMin, Double_t xMax,
77                               const char* xTitle, const char* yTitle,
78                               AliMonitorHisto::ENorm norm)
79 {
80 // create a 1 dimensional monitor histogram and add it to fFolder
81
82   TH1F* histo = new TH1F(name, title, xBins, xMin, xMax);
83   histo->SetMarkerStyle(kFullCircle);
84   histo->GetXaxis()->SetTitle(xTitle);
85   histo->GetYaxis()->SetTitle(yTitle);
86   AliMonitorHisto* result = new AliMonitorHisto(histo, norm);
87   fFolder->Add(result);
88   return result;
89 }
90
91 //_____________________________________________________________________________
92 AliMonitorHisto* AliMonitor::CreateHisto2(const char* name, const char* title,
93                               Int_t xBins, Double_t xMin, Double_t xMax,
94                               Int_t yBins, Double_t yMin, Double_t yMax,
95                               const char* xTitle, const char* yTitle,
96                               const char* zTitle,
97                               AliMonitorHisto::ENorm norm)
98 {
99 // create a 2 dimensional monitor histogram and add it to fFolder
100
101   TH2F* histo = new TH2F(name, title, xBins, xMin, xMax, yBins, yMin, yMax);
102   histo->SetOption("BOX");
103   histo->GetXaxis()->SetTitle(xTitle);
104   histo->GetYaxis()->SetTitle(yTitle);
105   histo->GetZaxis()->SetTitle(zTitle);
106   AliMonitorHisto* result = new AliMonitorHisto(histo, norm);
107   fFolder->Add(result);
108   return result;
109 }
110
111 //_____________________________________________________________________________
112 AliMonitorTrend* AliMonitor::CreateTrend(const char* name, const char* title,
113                                          const char* label, 
114                                          Double_t min, Double_t max)
115 {
116 // create a trend monitor histogram and add it to fFolder
117
118   AliMonitorTrend* result = new AliMonitorTrend(name, title, label, min, max);
119   fFolder->Add(result);
120   return result;
121 }
122