corrections to obey coding conventions
[u/mrichter/AliRoot.git] / MONITOR / AliMonitorPlot.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 plots used to monitor the quality of the      //
21 //  recorded data.                                                           //
22 //                                                                           //
23 ///////////////////////////////////////////////////////////////////////////////
24
25
26 #include "AliMonitorPlot.h"
27
28
29 ClassImp(AliMonitorPlot) 
30
31
32 Bool_t  AliMonitorPlot::fgDrawRef = kTRUE;
33 Float_t AliMonitorPlot::fgThreshold = 5.0;
34
35 Color_t AliMonitorPlot::fgColorData = kBlack;
36 Color_t AliMonitorPlot::fgColorRef = kBlue;
37 Color_t AliMonitorPlot::fgColorCompare = kRed;
38
39
40 //_____________________________________________________________________________
41 AliMonitorPlot::AliMonitorPlot() : TNamed()
42 {
43 // default contructor
44
45   fNumberOfEvents = 0;
46 }
47
48 //_____________________________________________________________________________
49 AliMonitorPlot::AliMonitorPlot(const AliMonitorPlot& plot) :
50   TNamed(plot)
51 {
52 // copy constructor
53
54   fNumberOfEvents = plot.fNumberOfEvents;
55 }
56
57 //_____________________________________________________________________________
58 AliMonitorPlot& AliMonitorPlot::operator =(const AliMonitorPlot& plot)
59 {
60 // assignment operator
61
62   TNamed::operator =(plot);
63   fNumberOfEvents = plot.fNumberOfEvents;
64   return *this;
65 }
66
67 //_____________________________________________________________________________
68 AliMonitorPlot::AliMonitorPlot(const char* name, const char* title) :
69   TNamed(name, title)
70 {
71 // constructor setting name and title
72
73   fNumberOfEvents = 0;
74 }
75
76
77
78 //_____________________________________________________________________________
79 void AliMonitorPlot::SetDrawRef(Bool_t drawRef)
80 {
81 // set the flag for drawing the reference plot
82
83   fgDrawRef = drawRef;
84 }
85
86 //_____________________________________________________________________________
87 void AliMonitorPlot::SetThreshold(Float_t threshold)
88 {
89 // set the threshold in standard deviations for the comparison 
90 // to the reference plot.
91 // no comparison is performed, if the threshold is <= 0
92
93   fgThreshold = threshold;
94 }
95
96
97 //_____________________________________________________________________________
98 void AliMonitorPlot::DrawEvent(Int_t number)
99 {
100 // draw the normalized monitor plot together with the reference
101 // plot and the comparison plot (if available)
102 // for the "number"th last event
103
104   if (!GetEvent(number)) return;
105   if (fgDrawRef) ComparePlot();
106   DrawPlot();
107 }
108
109 //_____________________________________________________________________________
110 void AliMonitorPlot::DrawSum(Int_t number)
111 {
112 // draw the normalized monitor plot together with the reference
113 // plot and the comparison plot (if available)
114 // for the sum of the last "number" events
115
116   if (!GetSum(number)) return;
117   if (fgDrawRef) ComparePlot();
118   DrawPlot();
119 }
120
121 //_____________________________________________________________________________
122 void AliMonitorPlot::DrawRun()
123 {
124 // draw the normalized monitor plot together with the reference
125 // plot and the comparison plot (if available)
126 // for all monitored events of the current run
127
128   if (!GetRun()) return;
129   if (fgDrawRef) ComparePlot();
130   DrawPlot();
131 }
132
133
134 //_____________________________________________________________________________
135 Bool_t AliMonitorPlot::CompareEvent(Int_t number)
136 {
137 // compare the normalized monitor plot for the "number"th last event
138 // to the reference plot
139
140   if (!GetEvent(number)) return kTRUE;
141   return ComparePlot();
142 }
143
144 //_____________________________________________________________________________
145 Bool_t AliMonitorPlot::CompareSum(Int_t number)
146 {
147 // compare the normalized monitor plot for the sum of the last 
148 // "number" events to the reference plot
149
150   if (!GetSum(number)) return kTRUE;
151   return ComparePlot();
152 }
153
154 //_____________________________________________________________________________
155 Bool_t AliMonitorPlot::CompareRun()
156 {
157 // compare the normalized monitor plot for all monitored events 
158 // of the current run to the reference plot
159
160   if (!GetRun()) return kTRUE;
161   return ComparePlot();
162 }
163