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

CODA version 2 event decoder implementation. More...

#include <Coda2EventDecoder.h>

+ Inheritance diagram for Coda2EventDecoder:
+ Collaboration diagram for Coda2EventDecoder:

Public Member Functions

 Coda2EventDecoder ()
 
 ~Coda2EventDecoder () override
 
std::vector< UInt_t > EncodePHYSEventHeader (std::vector< ROCID_t > &ROCList) override
 
void EncodePrestartEventHeader (int *buffer, int runnumber, int runtype, int localtime) override
 
void EncodeGoEventHeader (int *buffer, int eventcount, int localtime) override
 
void EncodePauseEventHeader (int *buffer, int eventcount, int localtime) override
 
void EncodeEndEventHeader (int *buffer, int eventcount, int localtime) override
 
Int_t DecodeEventIDBank (UInt_t *buffer) override
 
void PrintDecoderInfo (QwLog &out) override
 
- Public Member Functions inherited from VEventDecoder
 VEventDecoder ()
 
virtual ~VEventDecoder ()
 
virtual Bool_t DecodeSubbankHeader (UInt_t *buffer)
 Decode the subbank header for the current event/bank context.
 
virtual Bool_t IsPhysicsEvent ()
 
virtual Bool_t IsROCConfigurationEvent ()
 
virtual Bool_t IsEPICSEvent ()
 
UInt_t GetWordsSoFar () const
 
UInt_t GetEvtNumber () const
 
UInt_t GetEvtLength () const
 
UInt_t GetFragLength () const
 
UInt_t GetEvtType () const
 
UInt_t GetBankDataType () const
 
UInt_t GetSubbankTag () const
 
UInt_t GetSubbankType () const
 
ROCID_t GetROC () const
 
void SetWordsSoFar (UInt_t val)
 
void AddWordsSoFarAndFragLength ()
 
void SetFragLength (UInt_t val)
 
void SetAllowLowSubbankIDs (Bool_t val=kFALSE)
 
- Public Member Functions inherited from MQwCodaControlEvent
 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 ()
 

Private Attributes

UInt_t fEvtClass
 
UInt_t fStatSum
 
UInt_t fIDBankNum
 

Additional Inherited Members

- Protected Types inherited from VEventDecoder
enum  KEYWORDS { EPICS_EVTYPE = 131 }
 
- Protected Types inherited from MQwCodaControlEvent
enum  EventTypes {
  kSYNC_EVENT = 16 , kPRESTART_EVENT = 17 , kGO_EVENT = 18 , kPAUSE_EVENT = 19 ,
  kEND_EVENT = 20
}
 
- Protected Member Functions inherited from MQwCodaControlEvent
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 inherited from VEventDecoder
UInt_t fWordsSoFar
 
UInt_t fEvtLength
 
UInt_t fEvtNumber
 CODA event number; only defined for physics events.
 
UInt_t fFragLength
 
UInt_t fEvtType
 
UInt_t fEvtTag
 
UInt_t fBankDataType
 
BankID_t fSubbankTag
 
UInt_t fSubbankType
 
UInt_t fSubbankNum
 
ROCID_t fROC
 
Bool_t fPhysicsEventFlag
 
Bool_t fControlEventFlag
 
Bool_t fAllowLowSubbankIDs
 
- Protected Attributes inherited from MQwCodaControlEvent
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

CODA version 2 event decoder implementation.

Concrete decoder for CODA 2.x format event streams, handling the legacy data structures and bank formats. Maintains compatibility with older data files while providing the same encoding/decoding interface.

Definition at line 22 of file Coda2EventDecoder.h.

Constructor & Destructor Documentation

◆ Coda2EventDecoder()

Coda2EventDecoder::Coda2EventDecoder ( )
inline

Definition at line 25 of file Coda2EventDecoder.h.

References fEvtClass, fIDBankNum, and fStatSum.

◆ ~Coda2EventDecoder()

Coda2EventDecoder::~Coda2EventDecoder ( )
inlineoverride

Definition at line 29 of file Coda2EventDecoder.h.

29{ }

Member Function Documentation

◆ DecodeEventIDBank()

Int_t Coda2EventDecoder::DecodeEventIDBank ( UInt_t * buffer)
overridevirtual

Determine whether a buffer contains a PHYS, control, or other event.

Parameters
bufferEvent buffer to decode.
Returns
CODA_OK on success.

Implements VEventDecoder.

Definition at line 73 of file Coda2EventDecoder.cc.

74{
75
76 UInt_t local_datatype;
77 UInt_t local_eventtype;
78
79 fPhysicsEventFlag = kFALSE;
80
81 QwDebug << "QwEventBuffer::DecodeEventIDBank: " << std::hex
82 << buffer[0] << " "
83 << buffer[1] << " "
84 << buffer[2] << " "
85 << buffer[3] << " "
86 << buffer[4] << std::dec
87 << QwLog::endl;
88
89 if ( buffer[0] == 0 ){
90 /*****************************************************************
91 * This buffer is empty. *
92 *****************************************************************/
93 fEvtLength = (1); // Pretend that there is one word.
94 fWordsSoFar = (1); // Mark that we've read the word already.
95 fEvtType = (0);
96 fEvtTag = 0;
97 fBankDataType = 0;
98 fIDBankNum = 0;
99 fEvtNumber = 0;
100 fEvtClass = 0;
101 fStatSum = 0;
102 } else {
103 /*****************************************************************
104 * This buffer contains data; fill the event ID parameters. *
105 *****************************************************************/
106 // First word is the number of long-words in the buffer.
107 fEvtLength = (buffer[0]+1);
108
109 // Second word contains the event type, for CODA events.
110 fEvtTag = (buffer[1] & 0xFFFF0000) >> 16; // (bits(31-16));
111 local_datatype = (buffer[1] & 0xFF00) >> 8; // (bits(15-8));
112 fIDBankNum = (buffer[1] & 0xFF); // (bits(7-0));
113 if ( fIDBankNum == 0xCC) {
114 // This is a CODA event bank; the event type is equal to
115 // the event tag.
116 local_eventtype = fEvtTag;
117 fEvtType = (local_eventtype);
118 fBankDataType = local_datatype;
119
120 // local_eventtype is unsigned int and always positive
121 if (/* local_eventtype >= 0 && */ local_eventtype <= 15) {
122 // This is a physics event; record the event number, event
123 // classification, and status summary.
124 fPhysicsEventFlag = kTRUE;
125 fEvtNumber = buffer[4];
126 fEvtClass = buffer[5];
127 fStatSum = buffer[6];
128 // Now skip to the first ROC data bank.
129 fWordsSoFar = (7);
130 } else {
131 // This is not a physics event, but is still in the CODA
132 // event format. The first two words have been examined.
133 fEvtNumber = 0;
134 fEvtClass = 0;
135 fStatSum = 0;
136 fWordsSoFar = (2);
137 // Run this event through the Control event processing.
138 // If it is not a control event, nothing will happen.
140 }
141 } else {
142 // This is not an event in the CODA event bank format,
143 // but it still follows the CEBAF common event format.
144 // Arbitrarily set the event type to "fEvtTag".
145 // The first two words have been examined.
146 fEvtType = (fEvtTag);
147 fBankDataType = local_datatype;
148 fEvtNumber = 0;
149 fEvtClass = 0;
150 fStatSum = 0;
151 fWordsSoFar = (2);
152 }
153 }
154 // Initialize the fragment size to the event size, in case the
155 // event is not subbanked.
157 QwDebug << Form("buffer[0-1] 0x%x 0x%x ; ",
158 buffer[0], buffer[1])
159 << Form("Length: %d; Tag: 0x%x; Bank data type: 0x%x; Bank ID num: 0x%x; ",
161 << Form("Evt type: 0x%x; Evt number %d; Evt Class 0x%.8x; ",
163 << Form("Status Summary: 0x%.8x; Words so far %d",
165 << QwLog::endl;
166
167 return CODA_OK;
168}
#define QwDebug
Predefined log drain for debugging output.
Definition QwLog.h:59
void ProcessControlEvent(UInt_t evtype, UInt_t *buffer)
static std::ostream & endl(std::ostream &)
End of the line.
Definition QwLog.cc:297
Bool_t fPhysicsEventFlag
UInt_t fEvtNumber
CODA event number; only defined for physics events.

References QwLog::endl(), VEventDecoder::fBankDataType, fEvtClass, VEventDecoder::fEvtLength, VEventDecoder::fEvtNumber, VEventDecoder::fEvtTag, VEventDecoder::fEvtType, VEventDecoder::fFragLength, fIDBankNum, VEventDecoder::fPhysicsEventFlag, fStatSum, VEventDecoder::fWordsSoFar, MQwCodaControlEvent::ProcessControlEvent(), and QwDebug.

+ Here is the call graph for this function:

◆ EncodeEndEventHeader()

void Coda2EventDecoder::EncodeEndEventHeader ( int * buffer,
int eventcount,
int localtime )
overridevirtual

Create an END event EVIO header.

Parameters
bufferOutput buffer (>= 5 words).
eventcountNumber of events.
localtimeEvent time.

Implements VEventDecoder.

Definition at line 62 of file Coda2EventDecoder.cc.

63{
64 buffer[0] = 4; // End event length
65 buffer[1] = ((kEND_EVENT << 16) | (0x01 << 8) | 0xCC);
66 buffer[2] = localtime;
67 buffer[3] = 0; // unused
68 buffer[4] = eventcount;
69 ProcessEnd(localtime, eventcount);
70}
void ProcessEnd(UInt_t local_time, UInt_t evt_count)

References MQwCodaControlEvent::kEND_EVENT, and MQwCodaControlEvent::ProcessEnd().

+ Here is the call graph for this function:

◆ EncodeGoEventHeader()

void Coda2EventDecoder::EncodeGoEventHeader ( int * buffer,
int eventcount,
int localtime )
overridevirtual

Create a GO event EVIO header.

Parameters
bufferOutput buffer (>= 5 words).
eventcountNumber of events.
localtimeEvent time.

Implements VEventDecoder.

Definition at line 40 of file Coda2EventDecoder.cc.

41{
42 buffer[0] = 4; // Go event length
43 buffer[1] = ((kGO_EVENT << 16) | (0x01 << 8) | 0xCC);
44 buffer[2] = localtime;
45 buffer[3] = 0; // unused
46 buffer[4] = eventcount;
47 ProcessGo(localtime, eventcount);
48}
void ProcessGo(UInt_t local_time, UInt_t evt_count)

References MQwCodaControlEvent::kGO_EVENT, and MQwCodaControlEvent::ProcessGo().

+ Here is the call graph for this function:

◆ EncodePauseEventHeader()

void Coda2EventDecoder::EncodePauseEventHeader ( int * buffer,
int eventcount,
int localtime )
overridevirtual

Create a PAUSE event EVIO header.

Parameters
bufferOutput buffer (>= 5 words).
eventcountNumber of events.
localtimeEvent time.

Implements VEventDecoder.

Definition at line 51 of file Coda2EventDecoder.cc.

52{
53 buffer[0] = 4; // Pause event length
54 buffer[1] = ((kPAUSE_EVENT << 16) | (0x01 << 8) | 0xCC);
55 buffer[2] = localtime;
56 buffer[3] = 0; // unused
57 buffer[4] = eventcount;
58 ProcessPause(localtime, eventcount);
59}
void ProcessPause(UInt_t local_time, UInt_t evt_count)

References MQwCodaControlEvent::kPAUSE_EVENT, and MQwCodaControlEvent::ProcessPause().

+ Here is the call graph for this function:

◆ EncodePHYSEventHeader()

std::vector< UInt_t > Coda2EventDecoder::EncodePHYSEventHeader ( std::vector< ROCID_t > & ROCList)
overridevirtual

Create a PHYS event EVIO header.

Parameters
ROCListList of ROC IDs (unused in CODA2 headers).
Returns
Vector of 32-bit words containing the header.

Implements VEventDecoder.

Definition at line 14 of file Coda2EventDecoder.cc.

15{
16 std::vector<UInt_t> header;
17 header.push_back((0x0001 << 16) | (0x10 << 8) | 0xCC);
18 // event type | event data type | event ID (0xCC for CODA event)
19 header.push_back(4); // size of header field
20 header.push_back((0xC000 << 16) | (0x01 << 8) | 0x00);
21 // bank type | bank data type (0x01 for uint32) | bank ID (0x00 for header event)
22 header.push_back(++fEvtNumber); // event number (initialized to 0, so increment before use to agree with CODA number)
23 header.push_back(1); // event class
24 header.push_back(0); // status summary
25 return header;
26}

References VEventDecoder::fEvtNumber.

◆ EncodePrestartEventHeader()

void Coda2EventDecoder::EncodePrestartEventHeader ( int * buffer,
int runnumber,
int runtype,
int localtime )
overridevirtual

Create a PRESTART event EVIO header.

Parameters
bufferOutput buffer (>= 5 words).
runnumberRun number.
runtypeRun type.
localtimeEvent time.

Implements VEventDecoder.

Definition at line 29 of file Coda2EventDecoder.cc.

30{
31 buffer[0] = 4; // Prestart event length
32 buffer[1] = ((kPRESTART_EVENT << 16) | (0x01 << 8) | 0xCC);
33 buffer[2] = localtime;
34 buffer[3] = runnumber;
35 buffer[4] = runtype;
36 ProcessPrestart(localtime, runnumber, runtype);
37}
void ProcessPrestart(UInt_t local_time, UInt_t local_runnumber, UInt_t local_runtype)

References MQwCodaControlEvent::kPRESTART_EVENT, and MQwCodaControlEvent::ProcessPrestart().

+ Here is the call graph for this function:

◆ PrintDecoderInfo()

void Coda2EventDecoder::PrintDecoderInfo ( QwLog & out)
overridevirtual

Print internal decoder state for diagnostics.

Parameters
outLogging stream.

Reimplemented from VEventDecoder.

Definition at line 171 of file Coda2EventDecoder.cc.

172{
173
174 out << Form("Length: %d; Tag: 0x%x; Bank data type: 0x%x; Bank ID num: 0x%x; ",
176 << Form("Evt type: 0x%x; Evt number %d; Evt Class 0x%.8x; ",
178 << QwLog::endl;
179}

References QwLog::endl(), VEventDecoder::fBankDataType, fEvtClass, VEventDecoder::fEvtLength, VEventDecoder::fEvtNumber, VEventDecoder::fEvtTag, VEventDecoder::fEvtType, and fIDBankNum.

+ Here is the call graph for this function:

Field Documentation

◆ fEvtClass

UInt_t Coda2EventDecoder::fEvtClass
private

Definition at line 76 of file Coda2EventDecoder.h.

Referenced by Coda2EventDecoder(), DecodeEventIDBank(), and PrintDecoderInfo().

◆ fIDBankNum

UInt_t Coda2EventDecoder::fIDBankNum
private

Definition at line 78 of file Coda2EventDecoder.h.

Referenced by Coda2EventDecoder(), DecodeEventIDBank(), and PrintDecoderInfo().

◆ fStatSum

UInt_t Coda2EventDecoder::fStatSum
private

Definition at line 77 of file Coda2EventDecoder.h.

Referenced by Coda2EventDecoder(), and DecodeEventIDBank().


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