forked from JeffersonLab/japan-MOLLER
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updating to EVIOv5.3 (JeffersonLab#20)
Removes the bundled EVIO from japan-MOLLER and places it as a standalone dependency that must be compiled independently. Target library version: EVIOv5.3 (internal EVIO data format 4) __Warning__: EVIOv5.3 (https://github.com/JeffersonLab/evio/tree/evio-5.3) does not properly support the bundled EVIO version currently in japan-MOLLER. Any previous mock data generated cannot be analyzed with the EVIOv5.3, and would need to be regenerated. ============================= * Adds cmake modules FindEVIO.cmake and FetchBuildEVIO.cmake from the Hall A analyzer * Modifies CMakeTextList(s) and adds evio/CMakeLists.txt.in to support building against a seperate EVIO lib. * Replaces THaCodaData.[h,C] and replaces THaCodaFile.[h,C] with the Hall A analyzer's version * Adds additional header files needed for wrapper compilation Moves QwEventBuffer decoding logic into an abstract class VEventDecoder. Two concrete decoding classes are derived from the abstract decoder class: Coda2Decoder and Coda3Decoder. QwEventbuffer instantiates the appropriate class at runtime. * Original japan-MOLLER event decoding logic is moved into Coda2Decoder.[h,cc]. * Ports Hall A analyzer CODA 3 decoding into the Coda3Decoder class. * Adds CODA 3 style mock data generation Adds QwEventBuffer Command Line Args to select which CODA version data is being decoded. * --coda-version flag can be used to select the CODA version. Only supports versions 2 or 3 * Adds verification in QwEventBuffer. Exits if mismatch occurs (ie analyzing CODA 2 data with CODA 3 logic). Misc. Changes: * Adds version number the TList* condition output in root files * Adjusts formatting of the TList* condition naming scheme Note: Hall A analyzer version: commit 9616c77e8e061ef1b69dfe1882e2254a5113683b Files ported: * analyzer/cmake/Modules/FindEVIO.cmake * analyzer/cmake/Modules/FetchBuildEVIO.cmake * analyzer/cmake/scripts/mk_rootdict.sh * analyzer/Database/Helper.h * analyzer/hana_decode/CustomAlloc.h * analyzer/hana_decode/THaCodaFile.h analyzer/hana_decode/THaCodaData.h * analyzer/hana_decode/Decoder.h * analyzer/hana_decode/CodaDecoder.h * Fixes errors found in the clang-build workflow * fEvtLength is protected in context error * Typo in include guard Note: Comments out function QwEventBuffer::FillObjectWithEventData to check if it is used anywhere * Undoes the commenting out of QwEventBuffer::FillObjectWithEventData so that it is included in compilation * Fixes typo where a was duplicated * Cleans up misc. TODO comments and modifies the warning for undetermined CODA3 events * Adds simple Doxygen-Style comments to Decoder Functions
- Loading branch information
Showing
39 changed files
with
2,292 additions
and
3,557 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#ifndef CODA2EVENTDECODER_H | ||
#define CODA2EVENTDECODER_H | ||
|
||
#include "VEventDecoder.h" | ||
#include "Rtypes.h" | ||
|
||
#include <vector> | ||
|
||
class Coda2EventDecoder : public VEventDecoder | ||
{ | ||
public: | ||
Coda2EventDecoder() : | ||
fEvtClass(0), | ||
fStatSum(0), | ||
fIDBankNum(0) { } | ||
~Coda2EventDecoder() { } | ||
public: | ||
// Encoding Functions | ||
virtual std::vector<UInt_t> EncodePHYSEventHeader(std::vector<ROCID_t> &ROCList); | ||
virtual void EncodePrestartEventHeader(int* buffer, int runnumber, int runtype, int localtime); | ||
virtual void EncodeGoEventHeader(int* buffer, int eventcount, int localtime); | ||
virtual void EncodePauseEventHeader(int* buffer, int eventcount, int localtime); | ||
virtual void EncodeEndEventHeader(int* buffer, int eventcount, int localtime); | ||
public: | ||
// Decoding Functions | ||
virtual Int_t DecodeEventIDBank(UInt_t *buffer); | ||
virtual void PrintDecoderInfo(QwLog& out); | ||
|
||
private: | ||
// Event Information (CODA 2 Specific) | ||
UInt_t fEvtClass; | ||
UInt_t fStatSum; | ||
UInt_t fIDBankNum; | ||
}; | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
#ifndef CODA3EVENTDECODER_H | ||
#define CODA3EVENTDECODER_H | ||
|
||
#include "VEventDecoder.h" | ||
#include "Rtypes.h" | ||
|
||
#include <vector> | ||
|
||
class Coda3EventDecoder : public VEventDecoder | ||
{ | ||
public: | ||
Coda3EventDecoder() : | ||
tsEvType(0), | ||
block_size(0), | ||
evt_time(0), | ||
trigger_bits(0), | ||
TSROCNumber(0) { } | ||
~Coda3EventDecoder() { } | ||
public: | ||
// Encoding Functions | ||
virtual std::vector<UInt_t> EncodePHYSEventHeader(std::vector<ROCID_t> &ROCList); | ||
virtual void EncodePrestartEventHeader(int* buffer, int runnumber, int runtype, int localtime); | ||
virtual void EncodeGoEventHeader(int* buffer, int eventcount, int localtime); | ||
virtual void EncodePauseEventHeader(int* buffer, int eventcount, int localtime); | ||
virtual void EncodeEndEventHeader(int* buffer, int eventcount, int localtime); | ||
|
||
public: | ||
// Decoding Functions | ||
virtual Int_t DecodeEventIDBank(UInt_t *buffer); | ||
private: | ||
// Debugging Functions | ||
void printUserEvent(const UInt_t *buffer); | ||
virtual void PrintDecoderInfo(QwLog& out); | ||
protected: | ||
// TI Decoding Functions | ||
UInt_t InterpretBankTag(UInt_t tag); | ||
Int_t trigBankDecode(UInt_t* buffer); | ||
void trigBankErrorHandler( Int_t flag ); | ||
|
||
ULong64_t GetEvTime() const { return evt_time; } | ||
void SetEvTime(ULong64_t evtime) { evt_time = evtime; } | ||
UInt_t tsEvType, block_size; | ||
ULong64_t evt_time; // Event time (for CODA 3.* this is a 250 Mhz clock) | ||
UInt_t trigger_bits; // (Not completely sure) The TS# trigger for the TS | ||
public: | ||
// Ti Specific Functions | ||
enum { HED_OK = 0, HED_WARN = -63, HED_ERR = -127, HED_FATAL = -255 }; | ||
class coda_format_error : public std::runtime_error { | ||
public: | ||
explicit coda_format_error( const std::string& what_arg ) : std::runtime_error(what_arg) {} | ||
explicit coda_format_error( const char* what_arg ) : std::runtime_error(what_arg) {} | ||
}; | ||
|
||
// Trigger Bank OBJect | ||
class TBOBJ { | ||
public: | ||
TBOBJ() : blksize(0), tag(0), nrocs(0), len(0), tsrocLen(0), evtNum(0), | ||
runInfo(0), start(nullptr), evTS(nullptr), evType(nullptr), | ||
TSROC(nullptr) {} | ||
void Clear() { memset(this, 0, sizeof(*this)); } | ||
uint32_t Fill( const uint32_t* evbuffer, uint32_t blkSize, uint32_t tsroc ); | ||
bool withTimeStamp() const { return (tag & 1) != 0; } | ||
bool withRunInfo() const { return (tag & 2) != 0; } | ||
bool withTriggerBits() const { return (tsrocLen > 2*blksize);} | ||
|
||
uint32_t blksize; /* total number of triggers in the Bank */ | ||
uint16_t tag; /* Trigger Bank Tag ID = 0xff2x */ | ||
uint16_t nrocs; /* Number of ROC Banks in the Event Block (val = 1-256) */ | ||
uint32_t len; /* Total Length of the Trigger Bank - including Bank header */ | ||
uint32_t tsrocLen; /* Number of words in TSROC array */ | ||
uint64_t evtNum; /* Starting Event # of the Block */ | ||
uint64_t runInfo; /* Run Info Data (optional) */ | ||
const uint32_t *start; /* Pointer to start of the Trigger Bank */ | ||
const uint64_t *evTS; /* Pointer to the array of Time Stamps (optional) */ | ||
const uint16_t *evType; /* Pointer to the array of Event Types */ | ||
const uint32_t *TSROC; /* Pointer to Trigger Supervisor ROC segment data */ | ||
}; | ||
|
||
protected: | ||
Int_t LoadTrigBankInfo( UInt_t index_buffer ); | ||
TBOBJ tbank; | ||
|
||
public: | ||
// Hall A analyzer keywords (analyzer/Decoder.h) | ||
// Keywords that collide with JAPAN have been removed (deferring to JAPAN's definitions) | ||
static const UInt_t MAX_PHYS_EVTYPE = 14; // Types up to this are physics | ||
static const UInt_t TS_PRESCALE_EVTYPE = 120; | ||
// TODO: | ||
// Do we need any of these keywords? | ||
static const UInt_t PRESCALE_EVTYPE = 133; | ||
static const UInt_t DETMAP_FILE = 135; // Most likely do not need this one | ||
static const UInt_t DAQCONFIG_FILE1 = 137; | ||
static const UInt_t DAQCONFIG_FILE2 = 138; | ||
static const UInt_t TRIGGER_FILE = 136; | ||
static const UInt_t SCALER_EVTYPE = 140; | ||
static const UInt_t SBSSCALER_EVTYPE = 141; | ||
static const UInt_t HV_DATA_EVTYPE = 150; | ||
|
||
protected: | ||
// TODO: | ||
// How does JAPAN want to handle a TS? | ||
// Currently implemented as 0 | ||
uint32_t TSROCNumber; | ||
}; | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.