JAPAn
Just Another Parity Analyzer
Loading...
Searching...
No Matches
QwEventRing.h
Go to the documentation of this file.
1/**********************************************************\
2* File: QwEventRing.h *
3* *
4* Author: P. M. King, Rakitha Beminiwattha *
5* Time-stamp: <2009-11-08 15:40> *
6\**********************************************************/
7
8/*!
9 * \file QwEventRing.h
10 * \brief Event ring buffer for burp detection and stability monitoring
11 */
12
13#pragma once
14
15#include <vector>
16
17#include <fstream>
19
20/**
21 * \class QwEventRing
22 * \ingroup QwAnalysis_BL
23 * \brief Ring buffer of subsystem snapshots for burp/stability handling
24 *
25 * Maintains a sliding window of events to compute running averages,
26 * handle beam trips with holdoff, and apply burp cuts over extents.
27 */
29
30/******************************************************************
31 * Class: QwEventRing
32 * Description : The event buffer to reduce beam trips effects on running
33 * averages.
34 *
35 ******************************************************************/
36 private:
38
39 public:
41 virtual ~QwEventRing() { };
42
43 /// \brief Define options
44 static void DefineOptions(QwOptions &options);
45 /// \brief Process options
46 void ProcessOptions(QwOptions &options);
47
48 /// \brief Add the subsystem to the ring
49 void push(QwSubsystemArrayParity &event);
50 /// \brief Return the last subsystem in the ring
52
53 /// \brief Print value of rolling average
55 fRollingAvg.CalculateRunningAverage();
56 fRollingAvg.PrintValue();
57 }
58
59 /// \brief Return the read status of the ring
60 Bool_t IsReady();
61
62 void CheckBurpCut(Int_t thisevent);
63
64 /// \brief Return the number of events in the ring
65 Int_t GetNumberOfEvents() const { return fNumberOfEvents; }
66
67 /// \brief Unwind the ring until empty
68 void Unwind() {
69 while (GetNumberOfEvents() > 0) pop();
71 QwMessage << "Residual rolling average (should be zero)" << QwLog::endl;
73 }
74 }
75 private:
76
77 Int_t fRING_SIZE;//this is the length of the ring
78
80
81 Int_t fNextToBeFilled;//counts events in the ring
82 Int_t fNextToBeRead;//keep track off when to read next from the ring.
83
84 Bool_t fPrintAfterUnwind; // print rolling average after unwinding
85
86 Bool_t bEVENT_READY; //If kTRUE, the good events are added to the event ring. After a beam trip this is set to kFALSE
87 //after discarding LEAVE_COUNT no.of good event this is set to kTRUE
88
89 Bool_t bRING_READY; //set to true after ring is filled with good events and time to process them. Set to kFALSE after processing
90 //all the events in the ring
91 std::vector<QwSubsystemArrayParity> fEvent_Ring;
92 //to track all the rolling averages for stability checks
94
95 //for debugging purposes
96 FILE *out_file;
97 static const Bool_t bDEBUG=kFALSE;//kTRUE;
98 static const Bool_t bDEBUG_Write=kFALSE;
99
100 //State of the stability check - ON/OFF
102
103 //Beam Trip Variables
104 int holdoff; //the amount of events that are ignored when the beam trips
105 int countdown; //the amount of current events that are to be ignored
106
107 // Burp cut variables
111};
#define QwMessage
Predefined log drain for regular messages.
Definition QwLog.h:49
Subsystem array container for parity analysis with asymmetry calculations.
static std::ostream & endl(std::ostream &)
End of the line.
Definition QwLog.cc:297
Command-line and configuration file options processor.
Definition QwOptions.h:141
QwSubsystemArrayParity & pop()
Return the last subsystem in the ring.
Int_t fNextToBeFilled
Definition QwEventRing.h:81
FILE * out_file
Definition QwEventRing.h:96
QwSubsystemArrayParity fRollingAvg
Definition QwEventRing.h:93
QwSubsystemArrayParity fBurpAvg
Bool_t bEVENT_READY
Definition QwEventRing.h:86
std::vector< QwSubsystemArrayParity > fEvent_Ring
Definition QwEventRing.h:91
Bool_t bRING_READY
Definition QwEventRing.h:89
void push(QwSubsystemArrayParity &event)
Add the subsystem to the ring.
Bool_t IsReady()
Return the read status of the ring.
virtual ~QwEventRing()
Definition QwEventRing.h:41
void ProcessOptions(QwOptions &options)
Process options.
Bool_t fPrintAfterUnwind
Definition QwEventRing.h:84
Int_t fNumberOfEvents
Definition QwEventRing.h:79
static const Bool_t bDEBUG_Write
Definition QwEventRing.h:98
Int_t fNextToBeRead
Definition QwEventRing.h:82
void CheckBurpCut(Int_t thisevent)
void PrintRollingAverage()
Print value of rolling average.
Definition QwEventRing.h:54
static void DefineOptions(QwOptions &options)
Define options.
Bool_t bStability
Int_t GetNumberOfEvents() const
Return the number of events in the ring.
Definition QwEventRing.h:65
Int_t fBurpPrecut
static const Bool_t bDEBUG
Definition QwEventRing.h:97
Int_t fBurpExtent
Int_t fRING_SIZE
Definition QwEventRing.h:77
void Unwind()
Unwind the ring until empty.
Definition QwEventRing.h:68
Subsystem array container specialized for parity analysis with asymmetry calculations.