QwAnalysis
MQwCodaControlEvent Class Reference

#include <MQwCodaControlEvent.h>

+ Inheritance 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

Definition at line 13 of file MQwCodaControlEvent.h.

Member Enumeration Documentation

Enumerator
kSYNC_EVENT 
kPRESTART_EVENT 
kGO_EVENT 
kPAUSE_EVENT 
kEND_EVENT 

Definition at line 53 of file MQwCodaControlEvent.h.

Constructor & Destructor Documentation

MQwCodaControlEvent::MQwCodaControlEvent ( )

Definition at line 5 of file MQwCodaControlEvent.cc.

References ResetControlParameters().

5  {
7 }

+ Here is the call graph for this function:

MQwCodaControlEvent::~MQwCodaControlEvent ( )

Definition at line 9 of file MQwCodaControlEvent.cc.

9 { }

Member Function Documentation

UInt_t MQwCodaControlEvent::GetEndEventCount ( )
inline

Definition at line 35 of file MQwCodaControlEvent.h.

References fEndEventCount.

35 {return fEndEventCount;};
TString MQwCodaControlEvent::GetEndSQLTime ( )

Definition at line 139 of file MQwCodaControlEvent.cc.

References fEndDatime.

Referenced by ReportRunSummary().

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

+ Here is the caller graph for this function:

UInt_t MQwCodaControlEvent::GetEndTime ( )
inline

Definition at line 34 of file MQwCodaControlEvent.h.

References fEndTime.

Referenced by GetEndUnixTime().

34 {return fEndTime;};

+ Here is the caller graph for this function:

time_t MQwCodaControlEvent::GetEndUnixTime ( )

Definition at line 190 of file MQwCodaControlEvent.cc.

References GetEndTime().

Referenced by QwParityDB::SetRunID().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

UInt_t MQwCodaControlEvent::GetGoEventCount ( int  index = 0)

Definition at line 115 of file MQwCodaControlEvent.cc.

References fGoEventCount, and fNumberGo.

116 {
117  if (index>=0 && index<(Int_t)fNumberGo) return fGoEventCount[index];
118  return 0;
119 }
std::vector< UInt_t > fGoEventCount
UInt_t MQwCodaControlEvent::GetGoTime ( int  index = 0)

Definition at line 109 of file MQwCodaControlEvent.cc.

References fGoTime, and fNumberGo.

110 {
111  if (index>=0 && index<(Int_t)fNumberGo) return fGoTime[index];
112  return 0;
113 }
std::vector< UInt_t > fGoTime
UInt_t MQwCodaControlEvent::GetPauseEventCount ( int  index = 0)

Definition at line 127 of file MQwCodaControlEvent.cc.

References fNumberPause, and fPauseEventCount.

128 {
129  if (index>=0 && index<(Int_t)fNumberPause) return fPauseEventCount[index];
130  return 0;
131 }
std::vector< UInt_t > fPauseEventCount
UInt_t MQwCodaControlEvent::GetPauseTime ( int  index = 0)

Definition at line 121 of file MQwCodaControlEvent.cc.

References fNumberPause, and fPauseTime.

122 {
123  if (index>=0 && index<(Int_t)fNumberPause) return fPauseTime[index];
124  return 0;
125 }
std::vector< UInt_t > fPauseTime
UInt_t MQwCodaControlEvent::GetPrestartRunNumber ( )
inline

Definition at line 25 of file MQwCodaControlEvent.h.

References fPrestartRunNumber.

25 {return fPrestartRunNumber;};
UInt_t MQwCodaControlEvent::GetPrestartTime ( )
inline

Definition at line 24 of file MQwCodaControlEvent.h.

References fPrestartTime.

24 {return fPrestartTime;};
UInt_t MQwCodaControlEvent::GetRunType ( )
inline

Definition at line 26 of file MQwCodaControlEvent.h.

References fRunType.

26 {return fRunType;};
TString MQwCodaControlEvent::GetStartSQLTime ( )

Definition at line 134 of file MQwCodaControlEvent.cc.

References fStartDatime.

Referenced by ReportRunSummary().

135 {
136  return fStartDatime.AsSQLString();
137 }

+ Here is the caller graph for this function:

UInt_t MQwCodaControlEvent::GetStartTime ( )
inline

Definition at line 23 of file MQwCodaControlEvent.h.

References fStartTime.

Referenced by GetStartUnixTime().

23 {return fStartTime;};

+ Here is the caller graph for this function:

time_t MQwCodaControlEvent::GetStartUnixTime ( )

Definition at line 184 of file MQwCodaControlEvent.cc.

References GetStartTime().

Referenced by QwParityDB::SetRunID().

185 {
186  return (time_t) GetStartTime();
187 }

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 31 of file MQwCodaControlEvent.cc.

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

Referenced by QwEventBuffer::DecodeEventIDBank().

31  {
32  UInt_t local_time;
33  UInt_t local_evcount;
34 
35  local_time = buffer[0];
36  local_evcount = buffer[2];
37  if (evtype==kSYNC_EVENT){
38  UInt_t local_status = buffer[1];
39  ProcessSync(local_time, local_status);
40  } else if (evtype==kPRESTART_EVENT){
41  UInt_t local_runnumber = buffer[1];
42  UInt_t local_runtype = buffer[2];
43  ProcessPrestart(local_time, local_runnumber, local_runtype);
44  } else if (evtype==kGO_EVENT){
45  ProcessGo(local_time, local_evcount);
46  } else if (evtype==kPAUSE_EVENT){
47  ProcessPause(local_time, local_evcount);
48  } else if (evtype==kEND_EVENT){
49  ProcessEnd(local_time, local_evcount);
50  } else {
51  // This isn't a control event.
52  // Do nothing.
53  }
54 }
void ProcessPause(UInt_t local_time, UInt_t evt_count)
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 ProcessSync(UInt_t local_time, UInt_t statuscode)
void ProcessEnd(UInt_t local_time, UInt_t evt_count)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 99 of file MQwCodaControlEvent.cc.

References fEndDatime, fEndEventCount, fEndTime, and fFoundControlEvents.

Referenced by QwEventBuffer::EncodeEndEvent(), and ProcessControlEvent().

100 {
101  fFoundControlEvents = kTRUE;
102  //
103  fEndTime = local_time;
104  fEndEventCount = evt_count;
105  fEndDatime.Set(fEndTime);
106 }

+ Here is the caller graph for this function:

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

Definition at line 86 of file MQwCodaControlEvent.cc.

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

Referenced by QwEventBuffer::EncodeGoEvent(), and ProcessControlEvent().

87 {
88  fFoundControlEvents = kTRUE;
89  //
90  fNumberGo++;
91  fGoEventCount.push_back(evt_count);
92  fGoTime.push_back(local_time);
93  if (fNumberGo == 1){
94  fStartTime = fGoTime[0];
96  }
97 }
std::vector< UInt_t > fGoTime
std::vector< UInt_t > fGoEventCount

+ Here is the caller graph for this function:

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

Definition at line 77 of file MQwCodaControlEvent.cc.

References fFoundControlEvents, fNumberPause, fPauseEventCount, and fPauseTime.

Referenced by QwEventBuffer::EncodePauseEvent(), and ProcessControlEvent().

78 {
79  fFoundControlEvents = kTRUE;
80  //
81  fNumberPause++;
82  fPauseEventCount.push_back(evt_count);
83  fPauseTime.push_back(local_time);
84 }
std::vector< UInt_t > fPauseTime
std::vector< UInt_t > fPauseEventCount

+ Here is the caller graph for this function:

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

Definition at line 64 of file MQwCodaControlEvent.cc.

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

Referenced by QwEventBuffer::EncodePrestartEvent(), and ProcessControlEvent().

66 {
67  fFoundControlEvents = kTRUE;
68  //
70  //
71  fPrestartTime = local_time;
72  fPrestartRunNumber = local_runnumber;
73  fRunType = local_runtype;
75 }

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Definition at line 57 of file MQwCodaControlEvent.cc.

References fFoundControlEvents.

Referenced by ProcessControlEvent().

58 {
59  fFoundControlEvents = kTRUE;
60  // To be implemented...
61 }

+ Here is the caller graph for this function:

void MQwCodaControlEvent::ReportRunSummary ( )

Definition at line 145 of file MQwCodaControlEvent.cc.

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

Referenced by main().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void MQwCodaControlEvent::ResetControlParameters ( )

Definition at line 11 of file MQwCodaControlEvent.cc.

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

Referenced by main(), MQwCodaControlEvent(), and ProcessPrestart().

12 {
13  fFoundControlEvents = kFALSE;
14  fPrestartTime = 0;
16  fRunType = 0;
17  fEndTime = 0;
18  fEndEventCount = 0;
19  fNumberPause = 0;
20  fPauseTime.clear();
21  fPauseEventCount.clear();
22  fNumberGo = 0;
23  fGoTime.clear();
24  fGoEventCount.clear();
25  fStartTime = 0;
26  fPrestartDatime.Set(UInt_t(0));
27  fStartDatime.Set(UInt_t(0));
28  fEndDatime.Set(UInt_t(0));
29 }
std::vector< UInt_t > fGoTime
std::vector< UInt_t > fGoEventCount
std::vector< UInt_t > fPauseTime
std::vector< UInt_t > fPauseEventCount

+ Here is the caller graph for this function:

Field Documentation

TDatime MQwCodaControlEvent::fEndDatime
protected

Definition at line 82 of file MQwCodaControlEvent.h.

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

UInt_t MQwCodaControlEvent::fEndEventCount
protected
UInt_t MQwCodaControlEvent::fEndTime
protected
Bool_t MQwCodaControlEvent::fFoundControlEvents
protected
std::vector<UInt_t> MQwCodaControlEvent::fGoEventCount
protected

Definition at line 76 of file MQwCodaControlEvent.h.

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

std::vector<UInt_t> MQwCodaControlEvent::fGoTime
protected
UInt_t MQwCodaControlEvent::fNumberGo
protected
UInt_t MQwCodaControlEvent::fNumberPause
protected
std::vector<UInt_t> MQwCodaControlEvent::fPauseEventCount
protected
std::vector<UInt_t> MQwCodaControlEvent::fPauseTime
protected
TDatime MQwCodaControlEvent::fPrestartDatime
protected

Definition at line 80 of file MQwCodaControlEvent.h.

Referenced by ProcessPrestart(), and ResetControlParameters().

UInt_t MQwCodaControlEvent::fPrestartRunNumber
protected
UInt_t MQwCodaControlEvent::fPrestartTime
protected
UInt_t MQwCodaControlEvent::fRunType
protected
TDatime MQwCodaControlEvent::fStartDatime
protected

Definition at line 81 of file MQwCodaControlEvent.h.

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

UInt_t MQwCodaControlEvent::fStartTime
protected

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