JAPAn
Just Another Parity Analyzer
Loading...
Searching...
No Matches
MQwCodaControlEvent Class Reference

Mix-in class for handling CODA control event data and timing. More...

#include <MQwCodaControlEvent.h>

+ Inheritance diagram for MQwCodaControlEvent:
+ Collaboration diagram for MQwCodaControlEvent:

Public Member Functions

 MQwCodaControlEvent ()
 
 ~MQwCodaControlEvent ()
 
void ResetControlParameters ()
 
void ProcessControlEvent (UInt_t evtype, UInt_t *buffer)
 
void ReportRunSummary ()
 
UInt_t GetStartTime ()
 
UInt_t GetPrestartTime ()
 
UInt_t GetPrestartRunNumber ()
 
UInt_t GetRunType ()
 
UInt_t GetGoTime (int index=0)
 
UInt_t GetGoEventCount (int index=0)
 
UInt_t GetPauseTime (int index=0)
 
UInt_t GetPauseEventCount (int index=0)
 
UInt_t GetEndTime ()
 
UInt_t GetEndEventCount ()
 
TString GetStartSQLTime ()
 
TString GetEndSQLTime ()
 
time_t GetStartUnixTime ()
 
time_t GetEndUnixTime ()
 

Protected Types

enum  EventTypes {
  kSYNC_EVENT = 16 , kPRESTART_EVENT = 17 , kGO_EVENT = 18 , kPAUSE_EVENT = 19 ,
  kEND_EVENT = 20
}
 

Protected Member Functions

void ProcessSync (UInt_t local_time, UInt_t statuscode)
 
void ProcessPrestart (UInt_t local_time, UInt_t local_runnumber, UInt_t local_runtype)
 
void ProcessGo (UInt_t local_time, UInt_t evt_count)
 
void ProcessPause (UInt_t local_time, UInt_t evt_count)
 
void ProcessEnd (UInt_t local_time, UInt_t evt_count)
 

Protected Attributes

Bool_t fFoundControlEvents
 
UInt_t fPrestartTime
 
UInt_t fPrestartRunNumber
 
UInt_t fRunType
 
UInt_t fEndTime
 
UInt_t fEndEventCount
 
UInt_t fNumberPause
 
std::vector< UInt_t > fPauseEventCount
 
std::vector< UInt_t > fPauseTime
 
UInt_t fNumberGo
 
std::vector< UInt_t > fGoEventCount
 
std::vector< UInt_t > fGoTime
 
UInt_t fStartTime
 
TDatime fPrestartDatime
 
TDatime fStartDatime
 
TDatime fEndDatime
 

Detailed Description

Mix-in class for handling CODA control event data and timing.

Provides functionality for processing and storing information from CODA control events including prestart, go, pause, and end events. Manages run timing, event counts, and run summary reporting.

Definition at line 24 of file MQwCodaControlEvent.h.

Member Enumeration Documentation

◆ EventTypes

Enumerator
kSYNC_EVENT 
kPRESTART_EVENT 
kGO_EVENT 
kPAUSE_EVENT 
kEND_EVENT 

Definition at line 64 of file MQwCodaControlEvent.h.

Constructor & Destructor Documentation

◆ MQwCodaControlEvent()

MQwCodaControlEvent::MQwCodaControlEvent ( )

Definition at line 10 of file MQwCodaControlEvent.cc.

References ResetControlParameters().

+ Here is the call graph for this function:

◆ ~MQwCodaControlEvent()

MQwCodaControlEvent::~MQwCodaControlEvent ( )

Definition at line 14 of file MQwCodaControlEvent.cc.

14{ }

Member Function Documentation

◆ GetEndEventCount()

UInt_t MQwCodaControlEvent::GetEndEventCount ( )
inline

Definition at line 46 of file MQwCodaControlEvent.h.

References fEndEventCount.

◆ GetEndSQLTime()

TString MQwCodaControlEvent::GetEndSQLTime ( )

Definition at line 144 of file MQwCodaControlEvent.cc.

145{
146 return fEndDatime.AsSQLString();
147}

References fEndDatime.

Referenced by ReportRunSummary().

+ Here is the caller graph for this function:

◆ GetEndTime()

UInt_t MQwCodaControlEvent::GetEndTime ( )
inline

Definition at line 45 of file MQwCodaControlEvent.h.

45{return fEndTime;};

References fEndTime.

Referenced by GetEndUnixTime().

+ Here is the caller graph for this function:

◆ GetEndUnixTime()

time_t MQwCodaControlEvent::GetEndUnixTime ( )

Definition at line 195 of file MQwCodaControlEvent.cc.

196{
197 // if GetEndTime is equal to 0
198 // we will see the end time as
199 //
200 UInt_t end_time = GetEndTime();
201 UInt_t qweak_end_time = 1338523199;
202 // 2012-05-31 23:59:59 in the MySQL database
203 // $date -d@1338523199
204 // Thu May 31 23:59:59 EDT 2012 in a xterm (Linux)
205
206 if(end_time) return (time_t) end_time;
207 else return (time_t) qweak_end_time;
208}

References GetEndTime().

+ Here is the call graph for this function:

◆ GetGoEventCount()

UInt_t MQwCodaControlEvent::GetGoEventCount ( int index = 0)

Definition at line 120 of file MQwCodaControlEvent.cc.

121{
122 if (index>=0 && index<(Int_t)fNumberGo) return fGoEventCount[index];
123 return 0;
124}
std::vector< UInt_t > fGoEventCount

References fGoEventCount, and fNumberGo.

◆ GetGoTime()

UInt_t MQwCodaControlEvent::GetGoTime ( int index = 0)

Definition at line 114 of file MQwCodaControlEvent.cc.

115{
116 if (index>=0 && index<(Int_t)fNumberGo) return fGoTime[index];
117 return 0;
118}
std::vector< UInt_t > fGoTime

References fGoTime, and fNumberGo.

◆ GetPauseEventCount()

UInt_t MQwCodaControlEvent::GetPauseEventCount ( int index = 0)

Definition at line 132 of file MQwCodaControlEvent.cc.

133{
134 if (index>=0 && index<(Int_t)fNumberPause) return fPauseEventCount[index];
135 return 0;
136}
std::vector< UInt_t > fPauseEventCount

References fNumberPause, and fPauseEventCount.

◆ GetPauseTime()

UInt_t MQwCodaControlEvent::GetPauseTime ( int index = 0)

Definition at line 126 of file MQwCodaControlEvent.cc.

127{
128 if (index>=0 && index<(Int_t)fNumberPause) return fPauseTime[index];
129 return 0;
130}
std::vector< UInt_t > fPauseTime

References fNumberPause, and fPauseTime.

◆ GetPrestartRunNumber()

UInt_t MQwCodaControlEvent::GetPrestartRunNumber ( )
inline

Definition at line 36 of file MQwCodaControlEvent.h.

References fPrestartRunNumber.

◆ GetPrestartTime()

UInt_t MQwCodaControlEvent::GetPrestartTime ( )
inline

Definition at line 35 of file MQwCodaControlEvent.h.

References fPrestartTime.

◆ GetRunType()

UInt_t MQwCodaControlEvent::GetRunType ( )
inline

Definition at line 37 of file MQwCodaControlEvent.h.

37{return fRunType;};

References fRunType.

◆ GetStartSQLTime()

TString MQwCodaControlEvent::GetStartSQLTime ( )

Definition at line 139 of file MQwCodaControlEvent.cc.

140{
141 return fStartDatime.AsSQLString();
142}

References fStartDatime.

Referenced by ReportRunSummary().

+ Here is the caller graph for this function:

◆ GetStartTime()

UInt_t MQwCodaControlEvent::GetStartTime ( )
inline

Definition at line 34 of file MQwCodaControlEvent.h.

34{return fStartTime;};

References fStartTime.

Referenced by GetStartUnixTime().

+ Here is the caller graph for this function:

◆ GetStartUnixTime()

time_t MQwCodaControlEvent::GetStartUnixTime ( )

Definition at line 189 of file MQwCodaControlEvent.cc.

190{
191 return (time_t) GetStartTime();
192}

References GetStartTime().

+ Here is the call graph for this function:

◆ ProcessControlEvent()

void MQwCodaControlEvent::ProcessControlEvent ( UInt_t evtype,
UInt_t * buffer )

Definition at line 36 of file MQwCodaControlEvent.cc.

36 {
37 UInt_t local_time;
38 UInt_t local_evcount;
39
40 local_time = buffer[0];
41 local_evcount = buffer[2];
42 if (evtype==kSYNC_EVENT){
43 UInt_t local_status = buffer[1];
44 ProcessSync(local_time, local_status);
45 } else if (evtype==kPRESTART_EVENT){
46 UInt_t local_runnumber = buffer[1];
47 UInt_t local_runtype = buffer[2];
48 ProcessPrestart(local_time, local_runnumber, local_runtype);
49 } else if (evtype==kGO_EVENT){
50 ProcessGo(local_time, local_evcount);
51 } else if (evtype==kPAUSE_EVENT){
52 ProcessPause(local_time, local_evcount);
53 } else if (evtype==kEND_EVENT){
54 ProcessEnd(local_time, local_evcount);
55 } else {
56 // This isn't a control event.
57 // Do nothing.
58 }
59}
void ProcessPause(UInt_t local_time, UInt_t evt_count)
void ProcessGo(UInt_t local_time, UInt_t evt_count)
void ProcessPrestart(UInt_t local_time, UInt_t local_runnumber, UInt_t local_runtype)
void ProcessSync(UInt_t local_time, UInt_t statuscode)
void ProcessEnd(UInt_t local_time, UInt_t evt_count)

References kEND_EVENT, kGO_EVENT, kPAUSE_EVENT, kPRESTART_EVENT, kSYNC_EVENT, ProcessEnd(), ProcessGo(), ProcessPause(), ProcessPrestart(), and ProcessSync().

Referenced by Coda2EventDecoder::DecodeEventIDBank(), and Coda3EventDecoder::DecodeEventIDBank().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ProcessEnd()

void MQwCodaControlEvent::ProcessEnd ( UInt_t local_time,
UInt_t evt_count )
protected

Definition at line 104 of file MQwCodaControlEvent.cc.

105{
106 fFoundControlEvents = kTRUE;
107 //
108 fEndTime = local_time;
109 fEndEventCount = evt_count;
110 fEndDatime.Set(fEndTime);
111}

References fEndDatime, fEndEventCount, fEndTime, and fFoundControlEvents.

Referenced by Coda2EventDecoder::EncodeEndEventHeader(), Coda3EventDecoder::EncodeEndEventHeader(), and ProcessControlEvent().

+ Here is the caller graph for this function:

◆ ProcessGo()

void MQwCodaControlEvent::ProcessGo ( UInt_t local_time,
UInt_t evt_count )
protected

Definition at line 91 of file MQwCodaControlEvent.cc.

92{
93 fFoundControlEvents = kTRUE;
94 //
95 fNumberGo++;
96 fGoEventCount.push_back(evt_count);
97 fGoTime.push_back(local_time);
98 if (fNumberGo == 1){
101 }
102}

References fFoundControlEvents, fGoEventCount, fGoTime, fNumberGo, fStartDatime, and fStartTime.

Referenced by Coda2EventDecoder::EncodeGoEventHeader(), Coda3EventDecoder::EncodeGoEventHeader(), and ProcessControlEvent().

+ Here is the caller graph for this function:

◆ ProcessPause()

void MQwCodaControlEvent::ProcessPause ( UInt_t local_time,
UInt_t evt_count )
protected

Definition at line 82 of file MQwCodaControlEvent.cc.

83{
84 fFoundControlEvents = kTRUE;
85 //
87 fPauseEventCount.push_back(evt_count);
88 fPauseTime.push_back(local_time);
89}

References fFoundControlEvents, fNumberPause, fPauseEventCount, and fPauseTime.

Referenced by Coda2EventDecoder::EncodePauseEventHeader(), Coda3EventDecoder::EncodePauseEventHeader(), and ProcessControlEvent().

+ Here is the caller graph for this function:

◆ ProcessPrestart()

void MQwCodaControlEvent::ProcessPrestart ( UInt_t local_time,
UInt_t local_runnumber,
UInt_t local_runtype )
protected

Definition at line 69 of file MQwCodaControlEvent.cc.

71{
72 fFoundControlEvents = kTRUE;
73 //
75 //
76 fPrestartTime = local_time;
77 fPrestartRunNumber = local_runnumber;
78 fRunType = local_runtype;
80}

References fFoundControlEvents, fPrestartDatime, fPrestartRunNumber, fPrestartTime, fRunType, and ResetControlParameters().

Referenced by Coda2EventDecoder::EncodePrestartEventHeader(), Coda3EventDecoder::EncodePrestartEventHeader(), and ProcessControlEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ProcessSync()

void MQwCodaControlEvent::ProcessSync ( UInt_t local_time,
UInt_t statuscode )
protected

Definition at line 62 of file MQwCodaControlEvent.cc.

63{
64 fFoundControlEvents = kTRUE;
65 // To be implemented...
66}

References fFoundControlEvents.

Referenced by ProcessControlEvent().

+ Here is the caller graph for this function:

◆ ReportRunSummary()

void MQwCodaControlEvent::ReportRunSummary ( )

Definition at line 150 of file MQwCodaControlEvent.cc.

151{
153 // At least one control event has been found.
154 // Report the control event data we did find.
155 Int_t i;
156 QwMessage << "Run Number: " << fPrestartRunNumber << QwLog::endl;
157 QwMessage << "Run Type: " << fRunType << QwLog::endl;
158 QwMessage << "PreStart Time: " << fPrestartTime << QwLog::endl;
159 QwMessage << "Start Time: " << fStartTime << QwLog::endl;
160 QwMessage << "End Time: " << fEndTime << QwLog::endl;
161 QwMessage << "End Event Counter: " << fEndEventCount << QwLog::endl;
162 if (fEndTime>0 && fStartTime>0)
163 QwMessage << "Run Duration (sec): " << fEndTime-fStartTime << QwLog::endl;
164 else
165 QwMessage << "Run Duration (sec): " << "n/a" << QwLog::endl;
166 QwMessage << "SQL-Formatted Start Time: " << GetStartSQLTime()
167 << QwLog::endl;
168 QwMessage << "SQL-Formatted End Time: " << GetEndSQLTime()
169 << QwLog::endl;
170 QwMessage << "Number of Pauses during this run: " << fNumberPause
171 << QwLog::endl;
172 for (i=0; i<(Int_t)fNumberPause; i++) {
173 QwMessage << "Pause Number: " << i
174 <<"; Events so far: " << fPauseEventCount[i]
175 << "; Runtime since start (sec): "
177 if ((Int_t)fNumberGo > i+1){
178 QwMessage << "; Duration of Pause (sec): "
179 << fGoTime[i+1]-fPauseTime[i]
180 << QwLog::endl;
181 }else {
183 }
184 }
185 }
186}
#define QwMessage
Predefined log drain for regular messages.
Definition QwLog.h:49
static std::ostream & endl(std::ostream &)
End of the line.
Definition QwLog.cc:297

References QwLog::endl(), fEndEventCount, fEndTime, fFoundControlEvents, fGoTime, fNumberGo, fNumberPause, fPauseEventCount, fPauseTime, fPrestartRunNumber, fPrestartTime, fRunType, fStartTime, GetEndSQLTime(), GetStartSQLTime(), and QwMessage.

+ Here is the call graph for this function:

◆ ResetControlParameters()

void MQwCodaControlEvent::ResetControlParameters ( )

Definition at line 16 of file MQwCodaControlEvent.cc.

17{
18 fFoundControlEvents = kFALSE;
19 fPrestartTime = 0;
21 fRunType = 0;
22 fEndTime = 0;
24 fNumberPause = 0;
25 fPauseTime.clear();
26 fPauseEventCount.clear();
27 fNumberGo = 0;
28 fGoTime.clear();
29 fGoEventCount.clear();
30 fStartTime = 0;
31 fPrestartDatime.Set(UInt_t(0));
32 fStartDatime.Set(UInt_t(0));
33 fEndDatime.Set(UInt_t(0));
34}

References fEndDatime, fEndEventCount, fEndTime, fFoundControlEvents, fGoEventCount, fGoTime, fNumberGo, fNumberPause, fPauseEventCount, fPauseTime, fPrestartDatime, fPrestartRunNumber, fPrestartTime, fRunType, fStartDatime, and fStartTime.

Referenced by MQwCodaControlEvent(), and ProcessPrestart().

+ Here is the caller graph for this function:

Field Documentation

◆ fEndDatime

TDatime MQwCodaControlEvent::fEndDatime
protected

Definition at line 93 of file MQwCodaControlEvent.h.

Referenced by GetEndSQLTime(), ProcessEnd(), and ResetControlParameters().

◆ fEndEventCount

UInt_t MQwCodaControlEvent::fEndEventCount
protected

◆ fEndTime

UInt_t MQwCodaControlEvent::fEndTime
protected

◆ fFoundControlEvents

Bool_t MQwCodaControlEvent::fFoundControlEvents
protected

◆ fGoEventCount

std::vector<UInt_t> MQwCodaControlEvent::fGoEventCount
protected

Definition at line 87 of file MQwCodaControlEvent.h.

Referenced by GetGoEventCount(), ProcessGo(), and ResetControlParameters().

◆ fGoTime

std::vector<UInt_t> MQwCodaControlEvent::fGoTime
protected

◆ fNumberGo

UInt_t MQwCodaControlEvent::fNumberGo
protected

◆ fNumberPause

UInt_t MQwCodaControlEvent::fNumberPause
protected

◆ fPauseEventCount

std::vector<UInt_t> MQwCodaControlEvent::fPauseEventCount
protected

◆ fPauseTime

std::vector<UInt_t> MQwCodaControlEvent::fPauseTime
protected

◆ fPrestartDatime

TDatime MQwCodaControlEvent::fPrestartDatime
protected

Definition at line 91 of file MQwCodaControlEvent.h.

Referenced by ProcessPrestart(), and ResetControlParameters().

◆ fPrestartRunNumber

UInt_t MQwCodaControlEvent::fPrestartRunNumber
protected

◆ fPrestartTime

UInt_t MQwCodaControlEvent::fPrestartTime
protected

◆ fRunType

UInt_t MQwCodaControlEvent::fRunType
protected

◆ fStartDatime

TDatime MQwCodaControlEvent::fStartDatime
protected

Definition at line 92 of file MQwCodaControlEvent.h.

Referenced by GetStartSQLTime(), ProcessGo(), and ResetControlParameters().

◆ fStartTime

UInt_t MQwCodaControlEvent::fStartTime
protected

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