GSI Object Oriented Online Offline (Go4) GO4-6.4.0
Loading...
Searching...
No Matches
TGo4Ratemeter.h
Go to the documentation of this file.
1// $Id$
2//-----------------------------------------------------------------------
3// The GSI Online Offline Object Oriented (Go4) Project
4// Experiment Data Processing at EE department, GSI
5//-----------------------------------------------------------------------
6// Copyright (C) 2000- GSI Helmholtzzentrum fuer Schwerionenforschung GmbH
7// Planckstr. 1, 64291 Darmstadt, Germany
8// Contact: http://go4.gsi.de
9//-----------------------------------------------------------------------
10// This software can be used under the license agreements as stated
11// in Go4License.txt file which is part of the distribution.
12//-----------------------------------------------------------------------
13
14#ifndef TGO4RATEMETER_H
15#define TGO4RATEMETER_H
16
17#include "TNamed.h"
18
19#include "TTimeStamp.h"
20
24class TGo4Ratemeter : public TNamed {
25 private:
26 Bool_t fbRunning{kFALSE}; // Indicates if analysis running
27 ULong64_t fuCurrentCount{0}; // Number of events processed since last start.
28 Double_t fdRate{0}; // Current eventrate (events/sec)
29 Double_t fdTime{0}; // Time sum since last ratemeter reset. in s.
30 TString fxDateString; // Time and date of the last update of this status as sql string.
31 TString fxEventSource; // Name of eventsource of first step / current filelist name
32
33 ULong64_t fuLastCount{0};
34 TTimeStamp fLastTm;
35 Bool_t fbUpdateDone{kFALSE};
36
37 ULong64_t fuNextCheckCnt{0};
38 ULong64_t fuCheckInterval{0};
39 Double_t fdUpdateInterval{0};
40
41 static const Double_t fgdUPDATEINTERVAL;
42
43 public:
45
46 virtual ~TGo4Ratemeter();
47
48 Bool_t IsRunning() const { return fbRunning; }
49
50 Double_t GetRate() const { return fdRate; }
51
52 Double_t GetTime() const { return fdTime; }
53
54 ULong64_t GetCurrentCount() const { return fuCurrentCount; }
55
56 Double_t GetAvRate() const { return (fdTime > 0) ? ((Double_t) fuCurrentCount) / fdTime : 0.; }
57
58 const char *GetDateTime() const { return fxDateString.Data(); }
59
60 const char *GetCurrentSource() const { return fxEventSource.Data(); }
61
62 void UpdateFrom(const TGo4Ratemeter* r);
63
67 Bool_t Update(Int_t increment = 1);
68
69 void SetRunning(Bool_t on = kTRUE) { fbRunning = on; }
70 void SetDateTime(const char *str) { fxDateString = str; }
71 void SetCurrentSource(const char *str) { fxEventSource = str; }
72
74 void Reset();
75
79 Bool_t TestUpdate();
80
82 void SetUpdateInterval(double v) { if (v > 0) fdUpdateInterval = v; }
83
84 ClassDefOverride(TGo4Ratemeter, 1)
85};
86
87#endif //TGO4RATEMETER_H
Class containing event counter and ratemeter services.
Double_t GetRate() const
void Reset()
Reset counter and rate values.
ULong64_t GetCurrentCount() const
const char * GetDateTime() const
Bool_t IsRunning() const
ULong64_t fuCurrentCount
Double_t GetTime() const
const char * GetCurrentSource() const
void SetDateTime(const char *str)
ULong64_t fuCheckInterval
Next counter value when time will be checked.
Double_t fdTime
TTimeStamp fLastTm
Number of events processed at last ratemeter update.
Bool_t fbUpdateDone
Time when last rate measurement was done.
void SetCurrentSource(const char *str)
Bool_t TestUpdate()
Test if update has been called since last test.
ULong64_t fuNextCheckCnt
True if update has been performed since last TestZero call.
virtual ~TGo4Ratemeter()
TString fxEventSource
void UpdateFrom(const TGo4Ratemeter *r)
Double_t GetAvRate() const
void SetUpdateInterval(double v)
Set update interval in seconds - default is 1.
Double_t fdUpdateInterval
How often time should be checked.
Bool_t Update(Int_t increment=1)
Update counter and rate values.
void SetRunning(Bool_t on=kTRUE)
ULong64_t fuLastCount
Double_t fdRate
TString fxDateString
static const Double_t fgdUPDATEINTERVAL
Configured interval in seconds before two updates.