GRSISort "v4.0.0.5"
An extension of the ROOT analysis Framework
Loading...
Searching...
No Matches
TScalerQueue.h
Go to the documentation of this file.
1#ifndef TTIGSCALERQUEUE_H
2#define TTIGSCALERQUEUE_H
3
4/** \addtogroup Sorting
5 * @{
6 */
7
8#include <cstdio>
9#include <queue>
10#include <map>
11
12#if !defined(__CINT__) && !defined(__CLING__)
13// NOLINTBEGIN(readability-identifier-naming, cppcoreguidelines-macro-usage)
14#define _GLIBCXX_USE_NANOSLEEP 1
15// NOLINTEND(readability-identifier-naming, cppcoreguidelines-macro-usage)
16#include <mutex>
17#endif
18
19#include "TStopwatch.h"
20
21#include "TScaler.h"
22
23class TDeadtimeScalerQueue : public TObject {
24public:
25 static TDeadtimeScalerQueue* Get(); // Returns the Queue
28 TDeadtimeScalerQueue& operator=(const TDeadtimeScalerQueue&) = default;
29 TDeadtimeScalerQueue& operator=(TDeadtimeScalerQueue&&) noexcept = default;
31
32private:
34 static TDeadtimeScalerQueue* fDeadtimeScalerQueueClassPointer; // Pointer to the scaler Q singleton
35
36 std::queue<TScalerData*> fDeadtimeScalerQueue; // The scaler Queue itself
37 int fScalersInQueue{0}; // The current number of scalers in the Q
38
39 void StatusUpdate();
40 bool fStatusUpdateOn{false}; // flag that determines whether the Q status should be read out
41
42 bool fStop{false};
43
44 int fScalersIn{0};
46
47 TStopwatch* fStopwatch{nullptr}; // The stop watch used for timing in the status
48 void ResetRateCounter();
49
50 unsigned int fTotalScalersIn{0};
51 unsigned int fTotalScalersOut{0};
52
53 static std::map<int, int> fScalerIdMap;
54
55public:
56#if !defined(__CINT__) && !defined(__CLING__)
57#ifndef NO_MUTEX
58 static std::mutex All; // NOLINT(readability-identifier-naming)
59 static std::mutex Sorted; // NOLINT(readability-identifier-naming)
60#endif
61#endif
62
63 void Add(TScalerData*);
64
65 void Pop() override;
67
68 int Size() const;
69
70 void StartStatusUpdate();
71 void StopStatusUpdate();
72 void CheckStatus() const;
73
74 unsigned int GetTotalScalersIn() const { return fTotalScalersIn; }
75 unsigned int GetTotalScalersOut() const { return fTotalScalersOut; }
76
77 bool Running() const { return !fStop; }
78 void Stop() { fStop = true; }
79
80 void Print(Option_t* opt = "") const override;
81 void Clear(Option_t* opt = "") override;
82};
83
84class TRateScalerQueue : public TObject {
85public:
86 static TRateScalerQueue* Get(); // Returns the Queue
88 TRateScalerQueue(TRateScalerQueue&&) noexcept = default;
89 TRateScalerQueue& operator=(const TRateScalerQueue&) = default;
90 TRateScalerQueue& operator=(TRateScalerQueue&&) noexcept = default;
92
93private:
95 static TRateScalerQueue* fRateScalerQueueClassPointer; // Pointer to the scaler Q singleton
96
97 std::queue<TScalerData*> fRateScalerQueue; // The scaler Queue itself
98 int fScalersInQueue{0}; // The current number of scalers in the Q
99
100 void StatusUpdate();
101 bool fStatusUpdateOn{false}; // flag that determines whether the Q status should be read out
102
103 bool fStop{false};
104
107
108 TStopwatch* fStopwatch{nullptr}; // The stop watch used for timing in the status
109 void ResetRateCounter();
110
111 unsigned int fTotalScalersIn{0};
112 unsigned int fTotalScalersOut{0};
113
114 static std::map<int, int> fScalerIdMap;
115
116public:
117#if !defined(__CINT__) && !defined(__CLING__)
118#ifndef NO_MUTEX
119 static std::mutex All; // NOLINT(readability-identifier-naming)
120 static std::mutex Sorted; // NOLINT(readability-identifier-naming)
121#endif
122#endif
123
124 void Add(TScalerData*);
125
126 void Pop() override;
128
129 int Size() const;
130
131 void StartStatusUpdate();
132 void StopStatusUpdate();
133 void CheckStatus() const;
134
135 unsigned int GetTotalScalersIn() const { return fTotalScalersIn; }
136 unsigned int GetTotalScalersOut() const { return fTotalScalersOut; }
137
138 bool Running() const { return !fStop; }
139 void Stop() { fStop = true; }
140
141 void Print(Option_t* opt = "") const override;
142 void Clear(Option_t* opt = "") override;
143};
144/*! @} */
145#endif
TDeadtimeScalerQueue(TDeadtimeScalerQueue &&) noexcept=default
unsigned int fTotalScalersOut
void Add(TScalerData *)
std::queue< TScalerData * > fDeadtimeScalerQueue
unsigned int GetTotalScalersIn() const
TStopwatch * fStopwatch
void Pop() override
void Clear(Option_t *opt="") override
TScalerData * PopScaler()
static TDeadtimeScalerQueue * fDeadtimeScalerQueueClassPointer
static TDeadtimeScalerQueue * Get()
unsigned int fTotalScalersIn
unsigned int GetTotalScalersOut() const
TDeadtimeScalerQueue(const TDeadtimeScalerQueue &)=default
bool Running() const
static std::map< int, int > fScalerIdMap
void Print(Option_t *opt="") const override
static std::mutex Sorted
static std::mutex All
unsigned int GetTotalScalersOut() const
void Print(Option_t *opt="") const override
unsigned int GetTotalScalersIn() const
static std::mutex Sorted
static TRateScalerQueue * fRateScalerQueueClassPointer
void CheckStatus() const
unsigned int fTotalScalersOut
TScalerData * PopScaler()
void Clear(Option_t *opt="") override
void Add(TScalerData *)
bool Running() const
static std::mutex All
TStopwatch * fStopwatch
std::queue< TScalerData * > fRateScalerQueue
unsigned int fTotalScalersIn
void Pop() override
static TRateScalerQueue * Get()
TRateScalerQueue(TRateScalerQueue &&) noexcept=default
static std::map< int, int > fScalerIdMap
TRateScalerQueue(const TRateScalerQueue &)=default