-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCRateProcessor.h
91 lines (67 loc) · 2.08 KB
/
CRateProcessor.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/*
This software is Copyright by the Board of Trustees of Michigan
State University (c) Copyright 2005.
You may use this software under the terms of the GNU public license
(GPL). The terms of this license are described at:
http://www.gnu.org/licenses/gpl.txt
Author:
Ron Fox
NSCL
Michigan State University
East Lansing, MI 48824-1321
*/
#ifndef __CRATEPROCESSOR_H
#define __CRATEPROCESSOR_H
#ifndef __EVENTPROCESSOR_H
#include <EventProcessor.h>
#endif
#ifndef __CRT_STDINT_H
#include <stdint.h>
#ifndef __CRT_STDINT_H
#define __CRT_STDINT_H
#endif
#endif
// forward classes:
class CSpectrum;
class CAnalyzer;
class CBufferDecoder;
/*!
This class computes rate information for a spectrum. Any
1-d spectrum can have a rates processor attached to it.
A rates processor hooks into scaler buffers (which have time base
information), and computes the total number of counts in the spectrum
as well as the count increments since the last scaler buffer.
The class supports fetching the values of the spectrum object,
the total counts in the spectrum as of the last computation,
and the increments since th last computation.
*/
class CRateProcessor : public CEventProcessor
{
private:
CSpectrum* m_pSpectrum;
uint64_t m_totalCounts;
uint64_t m_increments;
public:
// Construtors and cannonicals.
CRateProcessor(CSpectrum& spectrum);
CRateProcessor(const CRateProcessor& rhs);
virtual ~CRateProcessor();
CRateProcessor& operator=(const CRateProcessor& rhs);
int operator==(const CRateProcessor& rhs);
int operator!=(const CRateProcessor& rhs);
// Selectors
CSpectrum* getSpectrum();
uint64_t getTotals() const;
uint64_t getIncrements() const;
// Virtual function overrides:
virtual Bool_t OnBegin (CAnalyzer& analyzer, CBufferDecoder& decoder);
virtual Bool_t OnOther (UInt_t nType, CAnalyzer& analyzer, CBufferDecoder& decoder);
// Utilties:
private:
void disable();
void adjustSpectrum();
void clear();
uint64_t sum1d();
uint64_t sum2d();
};
#endif