GammaWare  Head Version for release 0.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Counter.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2004 by Olivier Stezowski *
3  * stezow(AT)ipnl.in2p3.fr *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * aLong_t with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ***************************************************************************/
20 
23 #ifndef ADF_Counter_H
24 #include "Counter.h"
25 #endif
26 
27 using namespace ADF;
28 
29 Counter::Counter(Double_t min, Double_t max, const Char_t *unit):
30  fRangeMin(min),fRangeMax(max),fUnits(unit),fN(0uL),fValue(0.0),fValueMin(max),fValueMax(min){;}
31 
32 void Counter::operator +=(Double_t value)
33 {
34  fValue += value;
35  fN++;
36 
37  if ( value < fValueMin ) fValueMin = value;
38  if ( value > fValueMax ) fValueMax = value;
39 }
40 
42 {
43  fRangeMin = c.fRangeMin;
44  fRangeMax = c.fRangeMax;
45  fUnits = c.fUnits;
46  fN = c.fN;
47  fValue = c.fValue;
48  fValueMin = c.fValueMin;
49  fValueMax = c.fValueMax;
50 
51 }
52 
53 void Counter::Print(std::ostream &out) const
54 {
55  out << " " << GetValue() << " " << fUnits ;
56  if ( fN )
57  out << " [N,Mean,Min,Max] : [" << fN << ","
58  << GetMean()
59  << "," << GetMin() << "," << GetMax() << "]";
60 
61  out << std::endl;
62 }
63 
64 /*
65 Counter::Counter(Double_t xmin, Double_t xmax, UInt_t bins)
66 {
67 
68 }
69 
70 void Counter::Init(Double_t xmin, Double_t xmax, UInt_t bins)
71 {
72 
73 }
74 */
75 
76 
77 
78 
79 
void operator=(const Counter &)
Definition: Counter.cpp:41
A Counter.
Definition: Counter.h:42
UInt_t value[MaxValue]
Definition: ReadDaqAlone.C:29
Counter(Double_t, Double_t, const Char_t *unit="")
Definition: Counter.cpp:29
header file for Counter.cpp
Double_t GetMean() const
Definition: Counter.h:58
Double_t GetValue() const
Definition: Counter.h:56
Double_t GetMax() const
Definition: Counter.h:60
void operator+=(Double_t value)
Definition: Counter.cpp:32
ADF::LogMessage & endl(ADF::LogMessage &log)
void Print(std::ostream &out=std::cout) const
Definition: Counter.cpp:53
Double_t GetMin() const
Definition: Counter.h:59