JAPAn
Just Another Parity Analyzer
Loading...
Searching...
No Matches
VEventDecoder Class Referenceabstract

Abstract base for CODA event encoding and decoding. More...

#include <VEventDecoder.h>

+ Inheritance diagram for VEventDecoder:
+ Collaboration diagram for VEventDecoder:

Public Member Functions

 VEventDecoder ()
 
virtual ~VEventDecoder ()
 
virtual std::vector< UInt_t > EncodePHYSEventHeader (std::vector< ROCID_t > &ROCList)=0
 Create a physics-event (PHYS) header bank for the given ROCs.
 
virtual void EncodePrestartEventHeader (int *buffer, int runnumber, int runtype, int localtime)=0
 Encode a PRESTART control-event header.
 
virtual void EncodeGoEventHeader (int *buffer, int eventcount, int localtime)=0
 Encode a GO control-event header.
 
virtual void EncodePauseEventHeader (int *buffer, int eventcount, int localtime)=0
 Encode a PAUSE control-event header.
 
virtual void EncodeEndEventHeader (int *buffer, int eventcount, int localtime)=0
 Encode an END control-event header.
 
virtual Int_t DecodeEventIDBank (UInt_t *buffer)=0
 Decode the event ID bank and classify the event type.
 
virtual Bool_t DecodeSubbankHeader (UInt_t *buffer)
 Decode the subbank header for the current event/bank context.
 
virtual void PrintDecoderInfo (QwLog &out)
 Print internal decoder state for diagnostics.
 
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 ()
 

Protected Types

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 Attributes

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
 

Additional Inherited Members

- 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)
 

Detailed Description

Abstract base for CODA event encoding and decoding.

Provides the interface for encoding mock CODA events and decoding real CODA event streams. Concrete implementations handle version-specific differences (CODA 2 vs CODA 3) while exposing a common API for event type detection, bank decoding, and header processing.

Definition at line 27 of file VEventDecoder.h.

Member Enumeration Documentation

◆ KEYWORDS

enum VEventDecoder::KEYWORDS
protected
Enumerator
EPICS_EVTYPE 

Definition at line 168 of file VEventDecoder.h.

168 {
169 EPICS_EVTYPE = 131
170 };

Constructor & Destructor Documentation

◆ VEventDecoder()

VEventDecoder::VEventDecoder ( )
inline

Definition at line 29 of file VEventDecoder.h.

29 :
30 fWordsSoFar(0),
31 fEvtLength(0),
32 fEvtNumber(0),
33 fFragLength(0),
34 fEvtType(0),
35 fEvtTag(0),
37 fSubbankTag(0),
38 fSubbankType(0),
39 fSubbankNum(0),
40 fROC(0),
41 fPhysicsEventFlag(kFALSE),
42 fControlEventFlag(kFALSE),
43 fAllowLowSubbankIDs(kFALSE) { }
Bool_t fPhysicsEventFlag
BankID_t fSubbankTag
UInt_t fEvtNumber
CODA event number; only defined for physics events.
Bool_t fControlEventFlag
Bool_t fAllowLowSubbankIDs

References fAllowLowSubbankIDs, fBankDataType, fControlEventFlag, fEvtLength, fEvtNumber, fEvtTag, fEvtType, fFragLength, fPhysicsEventFlag, fROC, fSubbankNum, fSubbankTag, fSubbankType, and fWordsSoFar.

◆ ~VEventDecoder()

virtual VEventDecoder::~VEventDecoder ( )
inlinevirtual

Definition at line 45 of file VEventDecoder.h.

45{ }

Member Function Documentation

◆ AddWordsSoFarAndFragLength()

void VEventDecoder::AddWordsSoFarAndFragLength ( )
inline

Definition at line 141 of file VEventDecoder.h.

References fFragLength, and fWordsSoFar.

◆ DecodeEventIDBank()

virtual Int_t VEventDecoder::DecodeEventIDBank ( UInt_t * buffer)
pure virtual

Decode the event ID bank and classify the event type.

Parameters
bufferPointer to the start of the event buffer.
Returns
Non-negative on success (implementation-specific), negative on error.

Implemented in Coda2EventDecoder, and Coda3EventDecoder.

◆ DecodeSubbankHeader()

Bool_t VEventDecoder::DecodeSubbankHeader ( UInt_t * buffer)
virtual

Decode the subbank header for the current event/bank context.

Updates internal fields (subbank tag/type/num, ROC, fragment length) and advances the internal word counter to the first subbank data word.

Parameters
bufferPointer to the current position in the event buffer.
Returns
kTRUE if a valid header was decoded; kFALSE at end-of-event or on error.

Definition at line 11 of file VEventDecoder.cc.

11 {
12 // This function will decode the header information from
13 // either a ROC bank or a subbank. It will also bump
14 // fWordsSoFar to be referring to the first word of
15 // the subbank's data.
16 //
17 // NOTE TO DAQ PROGRAMMERS:
18 // All internal subbank tags MUST be defined to
19 // be greater than 31.
20 Bool_t okay = kTRUE;
21 if (fWordsSoFar >= fEvtLength){
22 // We have reached the end of this event.
23 okay = kFALSE;
24 } else if (fBankDataType == 0x10) {
25 // This bank has subbanks, so decode the subbank header.
26 fFragLength = buffer[0] - 1; // This is the number of words in the data block
27 fSubbankTag = (buffer[1]&0xFFFF0000)>>16; // Bits 16-31
28 fSubbankType = (buffer[1]&0xFF00)>>8; // Bits 8-15
29 fSubbankNum = (buffer[1]&0xFF); // Bits 0-7
30
31 QwDebug << "QwEventBuffer::DecodeSubbankHeader: "
32 << "fROC=="<<fROC << ", fSubbankTag==" << fSubbankTag
33 << ", fSubbankType=="<<fSubbankType << ", fSubbankNum==" <<fSubbankNum
34 << ", fAllowLowSubbankIDs==" << fAllowLowSubbankIDs
35 << QwLog::endl;
36
37 if (fSubbankTag<=31
38 && ( (fAllowLowSubbankIDs==kFALSE)
39 || (fAllowLowSubbankIDs==kTRUE && fSubbankType==0x10) ) ){
40 // Subbank tags between 0 and 31 indicate this is
41 // a ROC bank.
43 fSubbankTag = 0;
44 }
46 // Trouble, because we'll have too many words!
47 QwError << "fWordsSoFar+2+fFragLength=="<<fWordsSoFar+2+fFragLength
48 << " and fEvtLength==" << fEvtLength
49 << QwLog::endl;
50 okay = kFALSE;
51 }
52 fWordsSoFar += 2;
53 }
54 QwDebug << "QwEventBuffer::DecodeSubbankHeader: "
55 << "fROC=="<<fROC << ", fSubbankTag==" << fSubbankTag <<": "
56 << std::hex
57 << buffer[0] << " "
58 << buffer[1] << " "
59 << buffer[2] << " "
60 << buffer[3] << " "
61 << buffer[4] << std::dec << " "
62 << fWordsSoFar << " "<< fEvtLength
63 << QwLog::endl;
64 // There is no final else, because any bank type other than
65 // 0x10 should just return okay.
66 return okay;
67}
#define QwError
Predefined log drain for errors.
Definition QwLog.h:39
#define QwDebug
Predefined log drain for debugging output.
Definition QwLog.h:59
static std::ostream & endl(std::ostream &)
End of the line.
Definition QwLog.cc:297

References QwLog::endl(), fAllowLowSubbankIDs, fBankDataType, fEvtLength, fFragLength, fROC, fSubbankNum, fSubbankTag, fSubbankType, fWordsSoFar, QwDebug, and QwError.

+ Here is the call graph for this function:

◆ EncodeEndEventHeader()

virtual void VEventDecoder::EncodeEndEventHeader ( int * buffer,
int eventcount,
int localtime )
pure virtual

Encode an END control-event header.

Parameters
bufferOutput buffer (size >= 5 words) to receive the header.
eventcountFinal event count.
localtimeWall-clock time (seconds) for the header timestamp.

Implemented in Coda2EventDecoder, and Coda3EventDecoder.

◆ EncodeGoEventHeader()

virtual void VEventDecoder::EncodeGoEventHeader ( int * buffer,
int eventcount,
int localtime )
pure virtual

Encode a GO control-event header.

Parameters
bufferOutput buffer (size >= 5 words) to receive the header.
eventcountCurrent event count.
localtimeWall-clock time (seconds) for the header timestamp.

Implemented in Coda2EventDecoder, and Coda3EventDecoder.

◆ EncodePauseEventHeader()

virtual void VEventDecoder::EncodePauseEventHeader ( int * buffer,
int eventcount,
int localtime )
pure virtual

Encode a PAUSE control-event header.

Parameters
bufferOutput buffer (size >= 5 words) to receive the header.
eventcountCurrent event count.
localtimeWall-clock time (seconds) for the header timestamp.

Implemented in Coda2EventDecoder, and Coda3EventDecoder.

◆ EncodePHYSEventHeader()

virtual std::vector< UInt_t > VEventDecoder::EncodePHYSEventHeader ( std::vector< ROCID_t > & ROCList)
pure virtual

Create a physics-event (PHYS) header bank for the given ROCs.

Encodes a minimal CODA-compliant PHYS event header for one trigger, suitable for mock-data generation and unit tests.

Parameters
ROCListList of ROC IDs to include in the header/banks.
Returns
A vector of 32-bit words containing the encoded header.

Implemented in Coda2EventDecoder, and Coda3EventDecoder.

◆ EncodePrestartEventHeader()

virtual void VEventDecoder::EncodePrestartEventHeader ( int * buffer,
int runnumber,
int runtype,
int localtime )
pure virtual

Encode a PRESTART control-event header.

Parameters
bufferOutput buffer (size >= 5 words) to receive the header.
runnumberRun number to store in the header.
runtypeRun type identifier.
localtimeWall-clock time (seconds) for the header timestamp.

Implemented in Coda2EventDecoder, and Coda3EventDecoder.

◆ GetBankDataType()

UInt_t VEventDecoder::GetBankDataType ( ) const
inline

Definition at line 134 of file VEventDecoder.h.

134{ return fBankDataType;}

References fBankDataType.

◆ GetEvtLength()

UInt_t VEventDecoder::GetEvtLength ( ) const
inline

Definition at line 130 of file VEventDecoder.h.

130{ return fEvtLength; }

References fEvtLength.

◆ GetEvtNumber()

UInt_t VEventDecoder::GetEvtNumber ( ) const
inline

Definition at line 129 of file VEventDecoder.h.

129{ return fEvtNumber; }

References fEvtNumber.

◆ GetEvtType()

UInt_t VEventDecoder::GetEvtType ( ) const
inline

Definition at line 133 of file VEventDecoder.h.

133{ return fEvtType; }

References fEvtType.

◆ GetFragLength()

UInt_t VEventDecoder::GetFragLength ( ) const
inline

Definition at line 131 of file VEventDecoder.h.

131{ return fFragLength; }

References fFragLength.

◆ GetROC()

ROCID_t VEventDecoder::GetROC ( ) const
inline

Definition at line 137 of file VEventDecoder.h.

137{ return fROC; }

References fROC.

◆ GetSubbankTag()

UInt_t VEventDecoder::GetSubbankTag ( ) const
inline

Definition at line 135 of file VEventDecoder.h.

135{ return fSubbankTag; }

References fSubbankTag.

◆ GetSubbankType()

UInt_t VEventDecoder::GetSubbankType ( ) const
inline

Definition at line 136 of file VEventDecoder.h.

136{ return fSubbankType; }

References fSubbankType.

◆ GetWordsSoFar()

UInt_t VEventDecoder::GetWordsSoFar ( ) const
inline

Definition at line 128 of file VEventDecoder.h.

128{ return fWordsSoFar; }

References fWordsSoFar.

◆ IsEPICSEvent()

virtual Bool_t VEventDecoder::IsEPICSEvent ( )
inlinevirtual

Definition at line 123 of file VEventDecoder.h.

123 {
124 return (fEvtType==EPICS_EVTYPE); // Defined in CodaDecoder.h
125 }

References EPICS_EVTYPE, and fEvtType.

◆ IsPhysicsEvent()

virtual Bool_t VEventDecoder::IsPhysicsEvent ( )
inlinevirtual

Definition at line 115 of file VEventDecoder.h.

115 {
116 return fPhysicsEventFlag;
117 }

References fPhysicsEventFlag.

◆ IsROCConfigurationEvent()

virtual Bool_t VEventDecoder::IsROCConfigurationEvent ( )
inlinevirtual

Definition at line 119 of file VEventDecoder.h.

119 {
120 return (fEvtType>=0x90 && fEvtType<=0x18f);
121 }

References fEvtType.

◆ PrintDecoderInfo()

void VEventDecoder::PrintDecoderInfo ( QwLog & out)
virtual

Print internal decoder state for diagnostics.

Parameters
outLogging stream to receive the formatted state (QwMessage/QwWarning/etc.).

Reimplemented in Coda2EventDecoder, and Coda3EventDecoder.

Definition at line 70 of file VEventDecoder.cc.

71{
72 out << "\n-------\n" << std::hex <<
73 "fWordsSoFar " << fWordsSoFar <<
74 "\n fEvtLength; " << fEvtLength <<
75 "\n fEvtType " << fEvtType <<
76 "\n fEvtTag " << fEvtTag <<
77 "\n fBankDataType " << fBankDataType <<
78 "\n fPhysicsEventFlag " << fPhysicsEventFlag <<
79 "\n fEvtNumber; " << fEvtNumber <<
80 "\n fFragLength " << fFragLength <<
81 "\n fSubbankTag " << fSubbankTag <<
82 "\n fSubbankType " << fSubbankType <<
83 "\n fSubbankNum " << fSubbankNum <<
84 "\n fROC " << fROC <<
85 "\n fAllowLowSubbankIDs " << fAllowLowSubbankIDs <<
86 "\n-------\n" << std::dec <<
88}

References QwLog::endl(), fAllowLowSubbankIDs, fBankDataType, fEvtLength, fEvtNumber, fEvtTag, fEvtType, fFragLength, fPhysicsEventFlag, fROC, fSubbankNum, fSubbankTag, fSubbankType, and fWordsSoFar.

+ Here is the call graph for this function:

◆ SetAllowLowSubbankIDs()

void VEventDecoder::SetAllowLowSubbankIDs ( Bool_t val = kFALSE)
inline

Definition at line 143 of file VEventDecoder.h.

143{ fAllowLowSubbankIDs = val; }

References fAllowLowSubbankIDs.

◆ SetFragLength()

void VEventDecoder::SetFragLength ( UInt_t val)
inline

Definition at line 142 of file VEventDecoder.h.

142{ fFragLength = val; }

References fFragLength.

◆ SetWordsSoFar()

void VEventDecoder::SetWordsSoFar ( UInt_t val)
inline

Definition at line 140 of file VEventDecoder.h.

140{ fWordsSoFar = val; }

References fWordsSoFar.

Field Documentation

◆ fAllowLowSubbankIDs

Bool_t VEventDecoder::fAllowLowSubbankIDs
protected

◆ fBankDataType

◆ fControlEventFlag

Bool_t VEventDecoder::fControlEventFlag
protected

◆ fEvtLength

◆ fEvtNumber

◆ fEvtTag

◆ fEvtType

◆ fFragLength

◆ fPhysicsEventFlag

◆ fROC

ROCID_t VEventDecoder::fROC
protected

Definition at line 160 of file VEventDecoder.h.

Referenced by DecodeSubbankHeader(), GetROC(), PrintDecoderInfo(), and VEventDecoder().

◆ fSubbankNum

UInt_t VEventDecoder::fSubbankNum
protected

Definition at line 159 of file VEventDecoder.h.

Referenced by DecodeSubbankHeader(), PrintDecoderInfo(), and VEventDecoder().

◆ fSubbankTag

BankID_t VEventDecoder::fSubbankTag
protected

◆ fSubbankType

UInt_t VEventDecoder::fSubbankType
protected

◆ fWordsSoFar


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