QwAnalysis
QwEventRing Class Reference

#include <QwEventRing.h>

+ Collaboration diagram for QwEventRing:

Public Member Functions

 QwEventRing (QwOptions &options, QwSubsystemArrayParity &event)
 
 QwEventRing (QwSubsystemArrayParity &event, Int_t ring_size)
 
virtual ~QwEventRing ()
 
void ProcessOptions (QwOptions &options)
 Process options. More...
 
void push (QwSubsystemArrayParity &event)
 Add the subsystem to the ring. More...
 
QwSubsystemArrayParitypop ()
 Return the last subsystem in the ring. More...
 
Bool_t IsReady ()
 Return the read status of the ring. More...
 

Static Public Member Functions

static void DefineOptions (QwOptions &options)
 Define options. More...
 

Private Member Functions

 QwEventRing ()
 

Private Attributes

Int_t fRING_SIZE
 
Int_t fNextToBeFilled
 
Int_t fNextToBeRead
 
Bool_t bEVENT_READY
 
Bool_t bRING_READY
 
std::vector
< QwSubsystemArrayParity
fEvent_Ring
 
QwSubsystemArrayParity fRollingAvg
 
FILE * out_file
 
Bool_t bStability
 

Static Private Attributes

static const Bool_t bDEBUG =kFALSE
 
static const Bool_t bDEBUG_Write =kFALSE
 

Detailed Description

Definition at line 16 of file QwEventRing.h.

Constructor & Destructor Documentation

QwEventRing::QwEventRing ( )
private
QwEventRing::QwEventRing ( QwOptions options,
QwSubsystemArrayParity event 
)

Definition at line 23 of file QwEventRing.cc.

References bDEBUG_Write, bEVENT_READY, bRING_READY, fEvent_Ring, fNextToBeFilled, fNextToBeRead, fRING_SIZE, out_file, and ProcessOptions().

24 : fRollingAvg(event)
25 {
26  ProcessOptions(options);
27 
28  fEvent_Ring.resize(fRING_SIZE,event);
29 
30  bRING_READY=kFALSE;
31  bEVENT_READY=kTRUE;
33  fNextToBeRead=0;
34 
35  //open the log file
36  if (bDEBUG_Write)
37  out_file = fopen("Ring_log.txt", "wt");
38 }
Int_t fRING_SIZE
Definition: QwEventRing.h:47
static const Bool_t bDEBUG_Write
Definition: QwEventRing.h:66
Int_t fNextToBeFilled
Definition: QwEventRing.h:50
std::vector< QwSubsystemArrayParity > fEvent_Ring
Definition: QwEventRing.h:59
Int_t fNextToBeRead
Definition: QwEventRing.h:51
FILE * out_file
Definition: QwEventRing.h:64
Bool_t bRING_READY
Definition: QwEventRing.h:57
Bool_t bEVENT_READY
Definition: QwEventRing.h:54
QwSubsystemArrayParity fRollingAvg
Definition: QwEventRing.h:61
void ProcessOptions(QwOptions &options)
Process options.
Definition: QwEventRing.cc:53

+ Here is the call graph for this function:

QwEventRing::QwEventRing ( QwSubsystemArrayParity event,
Int_t  ring_size 
)

Definition at line 6 of file QwEventRing.cc.

References bDEBUG_Write, bEVENT_READY, bRING_READY, fEvent_Ring, fNextToBeFilled, fNextToBeRead, fRING_SIZE, and out_file.

7 : fRollingAvg(event)
8 {
9  fRING_SIZE=ring_size;
10  fEvent_Ring.resize(fRING_SIZE,event);
11 
12  bRING_READY=kFALSE;
13  bEVENT_READY=kTRUE;
15  fNextToBeRead=0;
16 
17  //open the log file
18  if (bDEBUG_Write)
19  out_file = fopen("Ring_log.txt", "wt");
20 }
Int_t fRING_SIZE
Definition: QwEventRing.h:47
static const Bool_t bDEBUG_Write
Definition: QwEventRing.h:66
Int_t fNextToBeFilled
Definition: QwEventRing.h:50
std::vector< QwSubsystemArrayParity > fEvent_Ring
Definition: QwEventRing.h:59
Int_t fNextToBeRead
Definition: QwEventRing.h:51
FILE * out_file
Definition: QwEventRing.h:64
Bool_t bRING_READY
Definition: QwEventRing.h:57
Bool_t bEVENT_READY
Definition: QwEventRing.h:54
QwSubsystemArrayParity fRollingAvg
Definition: QwEventRing.h:61
virtual QwEventRing::~QwEventRing ( )
inlinevirtual

Definition at line 30 of file QwEventRing.h.

30 { };

Member Function Documentation

void QwEventRing::DefineOptions ( QwOptions options)
static

Define options.

Definition at line 41 of file QwEventRing.cc.

References QwOptions::AddDefaultOptions(), and QwOptions::AddOptions().

Referenced by DefineOptionsParity().

42 {
43  // Define the execution options
44  options.AddDefaultOptions();
45  options.AddOptions()("ring.size",
46  po::value<int>()->default_value(4800),
47  "QwEventRing: ring/buffer size");
48  options.AddOptions()("ring.stability_cut",
49  po::value<double>()->default_value(1),
50  "QwEventRing: Stability ON/OFF");
51 }
po::options_description_easy_init AddDefaultOptions()
Add a default option.
Definition: QwOptions.h:159
po::options_description_easy_init AddOptions(const std::string &blockname="Specialized options")
Add an option to a named block or create new block.
Definition: QwOptions.h:164

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Bool_t QwEventRing::IsReady ( )

Return the read status of the ring.

Definition at line 138 of file QwEventRing.cc.

References bRING_READY.

Referenced by main().

138  { //Check for readyness to read data from the ring using the pop() routine
139  return bRING_READY;
140 }
Bool_t bRING_READY
Definition: QwEventRing.h:57

+ Here is the caller graph for this function:

QwSubsystemArrayParity & QwEventRing::pop ( )

Return the last subsystem in the ring.

Definition at line 121 of file QwEventRing.cc.

References bDEBUG, bDEBUG_Write, bRING_READY, bStability, QwSubsystemArrayParity::DeaccumulateRunningSum(), QwLog::endl(), fEvent_Ring, fNextToBeRead, fRING_SIZE, fRollingAvg, out_file, and QwMessage.

Referenced by main().

121  {
122  Int_t tempIndex;
123  tempIndex=fNextToBeRead;
124  if (bDEBUG) QwMessage<<" Read at "<<fNextToBeRead<<QwLog::endl;
125  if (bDEBUG_Write) fprintf(out_file," Read at %d \n",fNextToBeRead);
126 
127  if (fNextToBeRead==(fRING_SIZE-1)){
128  bRING_READY=kFALSE;//setting to false is an extra measure of security to prevent reading a NULL value.
129  }
130  if (bStability){
132  }
134  return fEvent_Ring[tempIndex];
135 }
#define QwMessage
Predefined log drain for regular messages.
Definition: QwLog.h:50
Int_t fRING_SIZE
Definition: QwEventRing.h:47
void DeaccumulateRunningSum(const QwSubsystemArrayParity &value)
Remove the entry value from the running sums for devices.
static const Bool_t bDEBUG
Definition: QwEventRing.h:65
static const Bool_t bDEBUG_Write
Definition: QwEventRing.h:66
std::vector< QwSubsystemArrayParity > fEvent_Ring
Definition: QwEventRing.h:59
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299
Int_t fNextToBeRead
Definition: QwEventRing.h:51
FILE * out_file
Definition: QwEventRing.h:64
Bool_t bStability
Definition: QwEventRing.h:69
Bool_t bRING_READY
Definition: QwEventRing.h:57
QwSubsystemArrayParity fRollingAvg
Definition: QwEventRing.h:61

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwEventRing::ProcessOptions ( QwOptions options)

Process options.

Definition at line 53 of file QwEventRing.cc.

References bStability, fRING_SIZE, QwOptions::GetValue(), gQwOptions, and QwOptions::HasValue().

Referenced by QwEventRing().

54 {
55  // Reads Event Ring parameters from cmd
56  Double_t stability = 0.0;
57  if (gQwOptions.HasValue("ring.size"))
58  fRING_SIZE=gQwOptions.GetValue<int>("ring.size");
59 
60  if (gQwOptions.HasValue("ring.stability_cut"))
61  stability=gQwOptions.GetValue<double>("ring.stability_cut");
62 
63  if (stability>0.0)
64  bStability=kTRUE;
65  else
66  bStability=kFALSE;
67 
68 }
Int_t fRING_SIZE
Definition: QwEventRing.h:47
bool HasValue(const std::string &key)
Has this key been defined.
Definition: QwOptions.h:233
QwOptions gQwOptions
Definition: QwOptions.cc:27
T GetValue(const std::string &key)
Get a templated value.
Definition: QwOptions.h:240
Bool_t bStability
Definition: QwEventRing.h:69

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwEventRing::push ( QwSubsystemArrayParity event)

Add the subsystem to the ring.

Definition at line 69 of file QwEventRing.cc.

References QwSubsystemArrayParity::AccumulateAllRunningSum(), bDEBUG, bDEBUG_Write, bEVENT_READY, bRING_READY, bStability, QwSubsystemArrayParity::CalculateRunningAverage(), QwLog::endl(), fEvent_Ring, fNextToBeFilled, fNextToBeRead, fRING_SIZE, fRollingAvg, out_file, QwMessage, and QwSubsystemArrayParity::UpdateErrorFlag().

Referenced by main().

70 {
71  if (bDEBUG) QwMessage << "QwEventRing::push: BEGIN" <<QwLog::endl;
72 
73 
74 
75  if (bEVENT_READY){
76  fEvent_Ring[fNextToBeFilled]=event;//copy the current good event to the ring
77  if (bStability){
79  }
80 
81 
82  if (bDEBUG) QwMessage<<" Filled at "<<fNextToBeFilled;//<<"Ring count "<<fRing_Count<<QwLog::endl;
83  if (bDEBUG_Write) fprintf(out_file," Filled at %d ",fNextToBeFilled);
84 
85 
86  fNextToBeFilled=(fNextToBeFilled+1)%fRING_SIZE;
87 
88  if(fNextToBeFilled == 0){
89  //then we have RING_SIZE events to process
90  if (bDEBUG) QwMessage<<" RING FILLED "<<fNextToBeFilled+1; //<<QwLog::endl;
91  if (bDEBUG_Write) fprintf(out_file," RING FILLED ");
92  bRING_READY=kTRUE;//ring is filled with good multiplets
93  fNextToBeFilled=0;//next event to be filled
94  fNextToBeRead=0;//first element in the ring
95  //check for current ramps
96  if (bStability){
98  /*
99  //The fRollingAvg dose not contain any regular errorcodes since it only accumulate rolling sum for errorflag==0 event.
100  //The only errorflag it generates is the stability cut faliure error when the rolling avg is computed.
101  //Therefore when fRollingAvg.GetEventcutErrorFlag() is called it will return non-zero error code only if a global stability cut has failed
102  //When fRollingAvg.GetEventcutErrorFlag() is called the fErrorFlag of the subsystemarrayparity object will be updated with any global
103  //stability cut faliures
104  */
105  fRollingAvg.UpdateErrorFlag(); //to update the global error code in the fRollingAvg
106  for(Int_t i=0;i<fRING_SIZE;i++){
107  fEvent_Ring[i].UpdateErrorFlag(fRollingAvg);
108  fEvent_Ring[i].UpdateErrorFlag();
109  }
110 
111  }
112  }
113  //ring processing is done at a separate location
114  }else{
115  }
116 
117 
118 }
#define QwMessage
Predefined log drain for regular messages.
Definition: QwLog.h:50
Int_t fRING_SIZE
Definition: QwEventRing.h:47
static const Bool_t bDEBUG
Definition: QwEventRing.h:65
static const Bool_t bDEBUG_Write
Definition: QwEventRing.h:66
Int_t fNextToBeFilled
Definition: QwEventRing.h:50
void CalculateRunningAverage()
Calculate the average for all good events.
std::vector< QwSubsystemArrayParity > fEvent_Ring
Definition: QwEventRing.h:59
static std::ostream & endl(std::ostream &)
End of the line.
Definition: QwLog.cc:299
Int_t fNextToBeRead
Definition: QwEventRing.h:51
FILE * out_file
Definition: QwEventRing.h:64
Bool_t bStability
Definition: QwEventRing.h:69
Bool_t bRING_READY
Definition: QwEventRing.h:57
void UpdateErrorFlag()
Update the error flag internally from all the subsystems.
Bool_t bEVENT_READY
Definition: QwEventRing.h:54
QwSubsystemArrayParity fRollingAvg
Definition: QwEventRing.h:61
void AccumulateAllRunningSum(const QwSubsystemArrayParity &value)
Update the running sums for devices check only the error flags at the channel level. Only used for stability checks.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

const Bool_t QwEventRing::bDEBUG =kFALSE
staticprivate

Definition at line 65 of file QwEventRing.h.

Referenced by pop(), and push().

const Bool_t QwEventRing::bDEBUG_Write =kFALSE
staticprivate

Definition at line 66 of file QwEventRing.h.

Referenced by pop(), push(), and QwEventRing().

Bool_t QwEventRing::bEVENT_READY
private

Definition at line 54 of file QwEventRing.h.

Referenced by push(), and QwEventRing().

Bool_t QwEventRing::bRING_READY
private

Definition at line 57 of file QwEventRing.h.

Referenced by IsReady(), pop(), push(), and QwEventRing().

Bool_t QwEventRing::bStability
private

Definition at line 69 of file QwEventRing.h.

Referenced by pop(), ProcessOptions(), and push().

std::vector<QwSubsystemArrayParity> QwEventRing::fEvent_Ring
private

Definition at line 59 of file QwEventRing.h.

Referenced by pop(), push(), and QwEventRing().

Int_t QwEventRing::fNextToBeFilled
private

Definition at line 50 of file QwEventRing.h.

Referenced by push(), and QwEventRing().

Int_t QwEventRing::fNextToBeRead
private

Definition at line 51 of file QwEventRing.h.

Referenced by pop(), push(), and QwEventRing().

Int_t QwEventRing::fRING_SIZE
private

Definition at line 47 of file QwEventRing.h.

Referenced by pop(), ProcessOptions(), push(), and QwEventRing().

QwSubsystemArrayParity QwEventRing::fRollingAvg
private

Definition at line 61 of file QwEventRing.h.

Referenced by pop(), and push().

FILE* QwEventRing::out_file
private

Definition at line 64 of file QwEventRing.h.

Referenced by pop(), push(), and QwEventRing().


The documentation for this class was generated from the following files: