JAPAn
Just Another Parity Analyzer
Loading...
Searching...
No Matches
VEventDecoder.cc
Go to the documentation of this file.
1/*!
2 * \file VEventDecoder.cc
3 * \brief Virtual base class implementation for event decoder functionality
4 */
5
6#include "VEventDecoder.h"
7#include "QwOptions.h"
8
9// Decodes the Subbank Header for PHYS Events.
10// Parameters and return value are documented in the header.
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}
68
69// Prints internal decoder information. See header for details.
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}
An options class which parses command line, config file and environment.
#define QwError
Predefined log drain for errors.
Definition QwLog.h:39
#define QwDebug
Predefined log drain for debugging output.
Definition QwLog.h:59
Virtual base class for event decoders to encode and decode CODA data.
Logging and output management system with configurable verbosity levels.
Definition QwLog.h:73
static std::ostream & endl(std::ostream &)
End of the line.
Definition QwLog.cc:297
Bool_t fPhysicsEventFlag
virtual void PrintDecoderInfo(QwLog &out)
Print internal decoder state for diagnostics.
BankID_t fSubbankTag
virtual Bool_t DecodeSubbankHeader(UInt_t *buffer)
Decode the subbank header for the current event/bank context.
UInt_t fEvtNumber
CODA event number; only defined for physics events.
Bool_t fAllowLowSubbankIDs