From 44f86ed007a6aea7379789c663c39fae60dfad16 Mon Sep 17 00:00:00 2001 From: Default Online user <Markus.Frank@cern.ch> Date: Fri, 1 Apr 2022 16:18:31 +0200 Subject: [PATCH] Adopt new bank type convention for DAQ errors --- CMakeLists.txt | 2 +- Online/Dataflow/src/components/FileWriter.cpp | 15 +- Online/EventData/src/EventHandler.cpp | 15 +- Online/FarmConfig/options/EBReader.opts | 2 + Online/GaudiOnline/components/InputAlg.cpp | 16 +- Online/GaudiOnlineTests/src/TestAsioTAN.cpp | 1 + Online/GaudiOnlineTests/src/TestScreen.cpp | 2 +- Online/GaudiOnlineTests/src/TestSensors.cpp | 11 +- Online/GaudiOnlineTests/src/TestSocketTAN.cpp | 1 + Online/GaudiOnlineTests/src/TestTAN.cpp | 1 + Online/GaudiOnlineTests/src/ams_bounce.cpp | 6 +- Online/GaudiOnlineTests/src/ams_sender.cpp | 6 +- .../GaudiOnlineTests/src/mbm_simple_test.cpp | 4 +- Online/GaudiOnlineTests/src/wttest.cpp | 24 +- Online/OnlineBase/CMakeLists.txt | 7 - Online/OnlineBase/src/AMS/ams_test.cpp | 45 --- Online/OnlineBase/src/CPP/sensor_tests.cpp | 129 ------- Online/OnlineBase/src/RTL/que.cpp | 8 +- Online/OnlineBase/src/TAN/TanDB_tst.cpp | 134 ------- Online/OnlineBase/src/TAN/tan_inquire_tst.cpp | 120 ------ Online/OnlineBase/src/WT/wtlib.cpp | 16 +- Online/OnlineBase/src/WT/wttest.cpp | 351 ------------------ .../PCIE40Data/include/PCIE40Data/RawBank40.h | 17 +- Online/PCIE40Data/include/PCIE40Data/pcie40.h | 25 +- Online/PCIE40Data/src/pcie40encoder.cpp | 188 +++++----- .../Tell1Data/include/Tell1Data/Tell1Bank.h | 16 +- Online/Tell1Data/src/Tell1Decoder.cpp | 16 +- 27 files changed, 187 insertions(+), 991 deletions(-) delete mode 100755 Online/OnlineBase/src/AMS/ams_test.cpp delete mode 100755 Online/OnlineBase/src/CPP/sensor_tests.cpp delete mode 100755 Online/OnlineBase/src/TAN/TanDB_tst.cpp delete mode 100755 Online/OnlineBase/src/TAN/tan_inquire_tst.cpp delete mode 100755 Online/OnlineBase/src/WT/wttest.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index d23f50ea2..118eb4d99 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,7 +64,7 @@ lhcb_add_subdirectories( Online/DataflowExample Online/Gaucho Online/DefHLTUtils - Online/EventBuilding +# Online/EventBuilding Online/EventData Online/FarmConfig Online/GaudiOnline diff --git a/Online/Dataflow/src/components/FileWriter.cpp b/Online/Dataflow/src/components/FileWriter.cpp index c11001e99..14fc263d6 100755 --- a/Online/Dataflow/src/components/FileWriter.cpp +++ b/Online/Dataflow/src/components/FileWriter.cpp @@ -137,11 +137,12 @@ int FileWriter::initialize() { } if (sc == DF_SUCCESS) { vector<string> to_keep; - this->declareMonitor("EvtsIn", this->m_evIn = 0, "Number of Events received."); - this->declareMonitor("EvtsOut", this->m_evOut = 0, "Number of Events written."); - this->declareMonitor("BytesOut", this->m_BytesOut = 0, "Number of Bytes Written to File"); - this->declareMonitor("BadFrames", this->m_num_bad_frames = 0, "Number bad frames"); - this->declareMonitor("FilesOpen", this->m_filesOpen, "Number of files open"); + this->declareMonitor("EvtsIn", this->m_evIn = 0, "Number of Events received."); + this->declareMonitor("EvtsOut", this->m_evOut = 0, "Number of Events written."); + this->declareMonitor("BytesOut", this->m_BytesOut = 0, "Number of Bytes Written to File"); + this->declareMonitor("BadFrames", this->m_num_bad_frames = 0, "Number bad frames"); + this->declareMonitor("FilesOpen", this->m_filesOpen, "Number of files opened"); + this->declareMonitor("FilesClosed", this->m_filesClosed, "Number of files closed"); this->m_sizeLimit *= 1024 * 1024; for (string dir_name : m_deviceList) { dir_name = RTL::str_replace(dir_name, "${NODE}", node); @@ -359,10 +360,11 @@ void FileWriter::close_files() { file->run_number, file->seq_number, file->fileName.c_str(), int(file->bytes_written/1024)); ::close(file->fileHandle); + ++this->m_filesClosed; this->m_fileCloseList.erase(i); delete file; i = this->m_fileCloseList.begin(); - if ( 0 == ((++this->m_filesClosed)%100) ) { + if ( 0 == (this->m_filesClosed%100) ) { this->info("Wrote a total of %ld files Events: %8ld [%7.1f GB]", this->m_filesClosed, this->m_evOut, double(this->m_BytesOut)/double(1024*1024*1024)); @@ -380,7 +382,6 @@ void FileWriter::markClose(FileDescr* file, int delay) { file->closeAt = ::time(0) + delay; file->state = C_CLOSED; --this->m_filesOpen; - this->debug("Mark file for delete run:%6d seq:%5d %s [%ld kB]", file->run_number, file->seq_number, file->fileName.c_str(), int(file->bytes_written/1024)); diff --git a/Online/EventData/src/EventHandler.cpp b/Online/EventData/src/EventHandler.cpp index 385491c66..ec4821893 100644 --- a/Online/EventData/src/EventHandler.cpp +++ b/Online/EventData/src/EventHandler.cpp @@ -23,7 +23,6 @@ #include <Tell1Data/RunInfo.h> #include <PCIE40Data/pcie40decoder.h> -#include <PCIE40Data/RawBank40.h> #include <PCIE40Data/sodin.h> #include <CPP/Value.h> @@ -149,8 +148,8 @@ namespace { { auto* bank = dsc.first; switch (bank->magic()) { - case RawBank40::MagicPattern: - return output_bank<RawBank40>(logger, tr, (RawBank40*)bank, dsc.second); + case pcie40::bank_t::MagicPattern: + return output_bank<pcie40::bank_t>(logger, tr, (pcie40::bank_t*)bank, dsc.second); case Tell1Bank::MagicPattern: return output_bank<Tell1Bank>(logger, tr, (Tell1Bank*)bank, dsc.second); default: @@ -217,7 +216,7 @@ namespace Online { auto data = ev->data_frame(); while ( data.start < data.end ) { const Tell1Bank* bank = (Tell1Bank*)data.start; - if ( bank->type() == RawBank40::ODIN ) + if ( bank->type() == Tell1Bank::ODIN ) return {bank, bank->data()}; size_t len = bank->totalSize(); data.start += len; @@ -638,7 +637,7 @@ namespace Online { if ( crossings.size() == 1 ) { const auto& banks = *crossings.at(0).second; if ( !banks.empty() ) { - if ( banks.at(0).first->magic() == RawBank40::MagicPattern ) + if ( banks.at(0).first->magic() == pcie40::bank_t::MagicPattern ) return output_mdf<event_traits::tell40>(banks, mask, true, output); else if ( banks.at(0).first->magic() == Tell1Bank::MagicPattern ) return output_mdf<event_traits::tell1>(banks, mask, true, output); @@ -652,7 +651,7 @@ namespace Online { total_len += _event_length(*cr.second); if ( 0 == cr.first ) { for(const auto& b : *cr.second) { - if ( b.first->type() == RawBank40::ODIN ) { + if ( b.first->type() == Tell1Bank::ODIN ) { odin = {b.first, b.second}; break; } @@ -736,11 +735,11 @@ namespace Online { for(size_t i=0; i < event.num_bank_collections(); ++i) { const auto* bc = event.bank_collection(i); for(const auto* b=bc->begin(); b != bc->end(); b = bc->next(b)) { - if ( b->type() >= RawBank40::DaqErrorBase ) + if ( b->type() >= b->DaqErrorFragmentThrottled ) banks.emplace_back((event_traits::tell1::bank_type*)b, b->data()); } for(const auto* b=bc->special_begin(); b != bc->special_end(); b = bc->next(b)) { - if ( b->type() >= RawBank40::DaqErrorBase ) + if ( b->type() >= b->DaqErrorFragmentThrottled ) banks.emplace_back((event_traits::tell1::bank_type*)b, b->data()); } } diff --git a/Online/FarmConfig/options/EBReader.opts b/Online/FarmConfig/options/EBReader.opts index 70cd67efa..9f53bd4dd 100644 --- a/Online/FarmConfig/options/EBReader.opts +++ b/Online/FarmConfig/options/EBReader.opts @@ -36,6 +36,8 @@ Reader.FilePrefix = "00135282"; Reader.Directories = { "/daqarea1/fest/202110/mdf_hlt1/30000000"}; Reader.FilePrefix = "hlt1_00146082"; // +Reader.Directories = { "/daqarea1/fest/202110/mep/sourceID-with-upper-five-bits/Retina_only/30000000" }; +Reader.FilePrefix = "00146082_0000"; // Reader.AllowedRuns = {"*"}; Reader.MuDelay = 0; diff --git a/Online/GaudiOnline/components/InputAlg.cpp b/Online/GaudiOnline/components/InputAlg.cpp index 89102d63f..7559b1d95 100644 --- a/Online/GaudiOnline/components/InputAlg.cpp +++ b/Online/GaudiOnline/components/InputAlg.cpp @@ -33,10 +33,9 @@ public: std::atomic<long> daqErrorTOTAL; std::atomic<long> daqErrorFragmentThrottled; std::atomic<long> daqErrorBXIDCorrupted; - std::atomic<long> daqErrorBXIDJump; + std::atomic<long> daqErrorSyncBXIDCurrupted; std::atomic<long> daqErrorFragmentMissing; std::atomic<long> daqErrorFragmentTruncated; - std::atomic<long> daqErrorInvalid; std::atomic<long> daqCounters_NZS_mode; std::atomic<long> daqCounters_have_ODIN; std::atomic<long> daqCounters_no_ODIN; @@ -47,10 +46,9 @@ public: void zero() { this->daqErrorFragmentThrottled = 0; this->daqErrorBXIDCorrupted = 0; - this->daqErrorBXIDJump = 0; + this->daqErrorSyncBXIDCurrupted = 0; this->daqErrorFragmentMissing = 0; this->daqErrorFragmentTruncated = 0; - this->daqErrorInvalid = 0; this->daqCounters_NZS_mode = 0; this->daqCounters_have_ODIN = 0; this->daqCounters_no_ODIN = 0; @@ -63,10 +61,9 @@ public: m->declareInfo("daqErrorTOTAL", daqErrorTOTAL, "DAQ Errors: daqErrorTOTAL", owner); m->declareInfo("daqErrorBXIDCorrupted", daqErrorBXIDCorrupted, "DAQ Errors: daqErrorBXIDCorrupted", owner); m->declareInfo("daqErrorFragmentThrottled", daqErrorFragmentThrottled, "DAQ Errors: daqErrorFragmentThrottled", owner); - m->declareInfo("daqErrorBXIDJump", daqErrorBXIDJump, "DAQ Errors: daqErrorBXIDJump", owner); + m->declareInfo("daqErrorSyncBXIDCurrupted", daqErrorSyncBXIDCurrupted, "DAQ Errors: daqErrorSyncBXIDCurrupted", owner); m->declareInfo("daqErrorFragmentMissing", daqErrorFragmentMissing, "DAQ Errors: daqErrorFragmentMissing", owner); m->declareInfo("daqErrorFragmentTruncated", daqErrorFragmentTruncated, "DAQ Errors: daqErrorFragmentTruncated", owner); - m->declareInfo("daqErrorInvalid", daqErrorInvalid, "DAQ Errors: daqErrorInvalid", owner); m->declareInfo("daqErrorBXIDCorrupted", daqErrorBXIDCorrupted, "DAQ Errors: daqErrorBXIDCorrupted", owner); m->declareInfo("daqCounters_NZS_mode", daqCounters_NZS_mode, "DAQ Counter: daqCounters_NZS_mode", owner); m->declareInfo("daqCounters_have_ODIN", daqCounters_have_ODIN, "DAQ Counter: daqCounters_have_ODIN", owner); @@ -232,8 +229,8 @@ StatusCode Online::InputAlg::process(EventContext const& /* ctxt */) const { case RawBank40::DaqErrorBXIDCorrupted: ++m_counters->daqErrorBXIDCorrupted; break; - case RawBank40::DaqErrorBXIDJump: - ++m_counters->daqErrorBXIDJump; + case RawBank40::DaqErrorSyncBXIDCurrupted: + ++m_counters->daqErrorSyncBXIDCurrupted; break; case RawBank40::DaqErrorFragmentMissing: ++m_counters->daqErrorFragmentMissing; @@ -241,9 +238,6 @@ StatusCode Online::InputAlg::process(EventContext const& /* ctxt */) const { case RawBank40::DaqErrorFragmentTruncated: ++m_counters->daqErrorFragmentTruncated; break; - case RawBank40::DaqErrorInvalid: - ++m_counters->daqErrorInvalid; - break; default: break; } diff --git a/Online/GaudiOnlineTests/src/TestAsioTAN.cpp b/Online/GaudiOnlineTests/src/TestAsioTAN.cpp index 43e579a5e..a45e08338 100644 --- a/Online/GaudiOnlineTests/src/TestAsioTAN.cpp +++ b/Online/GaudiOnlineTests/src/TestAsioTAN.cpp @@ -50,5 +50,6 @@ extern "C" int boost_asio_tan_qmtest(int argc, char** /* argv */) { for(int i=3; i>=0; --i) p[i]->wait(); cout << "All processes finished work.. " << endl; ::lib_rtl_sleep(1000); + pg.removeAll(); return 0; } diff --git a/Online/GaudiOnlineTests/src/TestScreen.cpp b/Online/GaudiOnlineTests/src/TestScreen.cpp index bae1f3c06..a79034d1d 100755 --- a/Online/GaudiOnlineTests/src/TestScreen.cpp +++ b/Online/GaudiOnlineTests/src/TestScreen.cpp @@ -36,6 +36,6 @@ extern "C" int rtl_testscreen(int argc,char **) { ::printf("\n\n\n +---------------------------------------+\n"); ::printf(" | It looks like SCR seems to work |\n"); ::printf(" +---------------------------------------+\n\n\n"); - + ::scrc_delete_pasteboard(pasteboard); return 0; } diff --git a/Online/GaudiOnlineTests/src/TestSensors.cpp b/Online/GaudiOnlineTests/src/TestSensors.cpp index c198b5e90..a44af8003 100755 --- a/Online/GaudiOnlineTests/src/TestSensors.cpp +++ b/Online/GaudiOnlineTests/src/TestSensors.cpp @@ -9,14 +9,15 @@ // Author : M.Frank // //========================================================================== -#include "CPP/Interactor.h" -#include "CPP/TimeSensor.h" -#include "CPP/IocSensor.h" -#include "CPP/Event.h" +#include <CPP/Interactor.h> +#include <CPP/TimeSensor.h> +#include <CPP/IocSensor.h> +#include <CPP/Event.h> +#include <WT/wtdef.h> + #include <iostream> #include <cstdlib> #include <vector> -#include "WT/wtdef.h" using namespace std; namespace { diff --git a/Online/GaudiOnlineTests/src/TestSocketTAN.cpp b/Online/GaudiOnlineTests/src/TestSocketTAN.cpp index b8d03f505..8d877c14c 100644 --- a/Online/GaudiOnlineTests/src/TestSocketTAN.cpp +++ b/Online/GaudiOnlineTests/src/TestSocketTAN.cpp @@ -49,5 +49,6 @@ extern "C" int rtl_socket_tan_qmtest(int argc, char** /* argv */) { for(int i=3; i>=0; --i) p[i]->wait(); cout << "All processes finished work.. " << endl; ::lib_rtl_sleep(1000); + pg.removeAll(); return 0; } diff --git a/Online/GaudiOnlineTests/src/TestTAN.cpp b/Online/GaudiOnlineTests/src/TestTAN.cpp index 169e36e11..e378740e1 100644 --- a/Online/GaudiOnlineTests/src/TestTAN.cpp +++ b/Online/GaudiOnlineTests/src/TestTAN.cpp @@ -49,5 +49,6 @@ extern "C" int rtl_tan_qmtest(int argc, char** /* argv */) { for(int i=3; i>=0; --i) p[i]->wait(); cout << "All processes finished work.. " << endl; ::lib_rtl_sleep(1000); + pg.removeAll(); return 0; } diff --git a/Online/GaudiOnlineTests/src/ams_bounce.cpp b/Online/GaudiOnlineTests/src/ams_bounce.cpp index 72321ea8e..52d25f234 100755 --- a/Online/GaudiOnlineTests/src/ams_bounce.cpp +++ b/Online/GaudiOnlineTests/src/ams_bounce.cpp @@ -14,9 +14,9 @@ #include <cstdio> #include <cstring> #include <string> -#include "RTL/rtl.h" -#include "WT/wtdef.h" -#include "AMS/amsdef.h" +#include <RTL/rtl.h> +#include <WT/wtdef.h> +#include <AMS/amsdef.h> #define SIZE 20000 diff --git a/Online/GaudiOnlineTests/src/ams_sender.cpp b/Online/GaudiOnlineTests/src/ams_sender.cpp index c5b5b9311..c5954d723 100755 --- a/Online/GaudiOnlineTests/src/ams_sender.cpp +++ b/Online/GaudiOnlineTests/src/ams_sender.cpp @@ -12,9 +12,9 @@ #include <cstdio> #include <string> #include <cstring> -#include "RTL/rtl.h" -#include "WT/wtdef.h" -#include "AMS/amsdef.h" +#include <RTL/rtl.h> +#include <WT/wtdef.h> +#include <AMS/amsdef.h> namespace { void fill (char *buff,int len) { diff --git a/Online/GaudiOnlineTests/src/mbm_simple_test.cpp b/Online/GaudiOnlineTests/src/mbm_simple_test.cpp index c8b958d87..c7b52568f 100644 --- a/Online/GaudiOnlineTests/src/mbm_simple_test.cpp +++ b/Online/GaudiOnlineTests/src/mbm_simple_test.cpp @@ -111,7 +111,7 @@ extern "C" int mbm_simple_test(int argc, char** /* argv */) { for(int i=2; i>=0; --i) p[i]->wait(); cout << "All processes finished work.. " << endl; ::lib_rtl_sleep(1000); - + pg.removeAll(); return 0; } @@ -168,7 +168,7 @@ extern "C" int mbm_full_test(int argc, char** /* argv */) { for(int i=6; i>=0; --i) p[i]->wait(); cout << "All processes finished work.. " << endl; ::lib_rtl_sleep(1000); - + pg.removeAll(); return 0; } diff --git a/Online/GaudiOnlineTests/src/wttest.cpp b/Online/GaudiOnlineTests/src/wttest.cpp index 01453f3c2..70ec99971 100755 --- a/Online/GaudiOnlineTests/src/wttest.cpp +++ b/Online/GaudiOnlineTests/src/wttest.cpp @@ -11,9 +11,9 @@ //========================================================================== // WAIT FACILITY TEST PROGRAM //---------------------------------------------------------------------- -#include "WT/wtdef.h" -#include "RTL/rtl.h" -#include "SCR/scr.h" +#include <WT/wtdef.h> +#include <RTL/rtl.h> +#include <SCR/scr.h> #include <cstdlib> #include <cstdarg> @@ -128,7 +128,8 @@ static int rearm4(unsigned int /* fac */, void* /* par */) { print_at(4, 13,"WTC: Successfully executed %d AST4 requests. (%d AST4, %d AST3 %d AST2 %d AST1)", ast4_count, ast4_count, ast3_count, ast2_count, ast1_count); print_at(4, 14, ""); - exit(0); + ::wtc_insert(WT_FACILITY_EXIT, nullptr); + return WT_SUCCESS; } return ::lib_rtl_set_timer(INTERVAL4, ast4, 0, &alarm4); } @@ -180,6 +181,14 @@ extern "C" int wtc_test(int /* argc */, char** /* argv */) { status = ::wtc_wait(&facility, &userpar, &sub_status); ::lib_rtl_output(LIB_RTL_ALWAYS,"Exited WAIT>>>> Facility = %d Status=%d Sub-Status = %d\n", facility, status, sub_status); + if ( facility == WT_FACILITY_EXIT ) { + ::wtc_remove(WT_FACILITY_TIMER1); + ::wtc_remove(WT_FACILITY_TIMER2); + ::wtc_remove(WT_FACILITY_TIMER3); + ::wtc_remove(WT_FACILITY_TIMER4); + ::wtc_shutdown(); + ::exit(0); + } } } @@ -210,5 +219,12 @@ extern "C" int wtc_test_qmtest(int /* argc */, char** /* argv */) { status = ::wtc_wait(&facility, &userpar, &sub_status); ::lib_rtl_output(LIB_RTL_ALWAYS,"Exited WAIT>>>> Facility = %d Status=%d Sub-Status = %d\n", facility, status, sub_status); + if ( facility == WT_FACILITY_EXIT ) { + ::wtc_remove(WT_FACILITY_TIMER2); + ::wtc_remove(WT_FACILITY_TIMER3); + ::wtc_remove(WT_FACILITY_TIMER4); + ::wtc_shutdown(); + ::exit(0); + } } } diff --git a/Online/OnlineBase/CMakeLists.txt b/Online/OnlineBase/CMakeLists.txt index 3195c88bf..39c74f83c 100755 --- a/Online/OnlineBase/CMakeLists.txt +++ b/Online/OnlineBase/CMakeLists.txt @@ -17,9 +17,6 @@ Online/OnlineBase gaudi_add_library(OnlineBase SOURCES src/AMS/ams_bounce.cpp - src/AMS/ams_qmtest.cpp - src/AMS/ams_sender.cpp - src/AMS/ams_test.cpp src/AMS/ams_transfer.cpp src/AMS/amslib.cpp src/AMS/amsu.cpp @@ -44,7 +41,6 @@ gaudi_add_library(OnlineBase src/CPP/Sensor.cpp src/CPP/Table.cpp src/CPP/TimeSensor.cpp - src/CPP/sensor_tests.cpp src/MBM/BufferInfo.cpp src/MBM/DumpBits.cpp src/MBM/Dumper.cpp @@ -126,12 +122,9 @@ gaudi_add_library(OnlineBase src/TAN/NameServer.cpp src/TAN/TanDB.cpp src/TAN/TanDB_Dump.cpp - src/TAN/TanDB_tst.cpp src/TAN/TanInterface.cpp src/TAN/TanMon.cpp - src/TAN/tan_inquire_tst.cpp src/WT/wtlib.cpp - src/WT/wttest.cpp LINK PUBLIC Boost::headers diff --git a/Online/OnlineBase/src/AMS/ams_test.cpp b/Online/OnlineBase/src/AMS/ams_test.cpp deleted file mode 100755 index 2469722b3..000000000 --- a/Online/OnlineBase/src/AMS/ams_test.cpp +++ /dev/null @@ -1,45 +0,0 @@ -//========================================================================== -// LHCb Online software suite -//-------------------------------------------------------------------------- -// Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) -// All rights reserved. -// -// For the licensing terms see OnlineSys/LICENSE. -// -// Author : M.Frank, B.Jost -// -//========================================================================== -#include <AMS/amsdef.h> -#include <RTL/rtl.h> -#include <cstdio> -#include <cstdlib> - -extern "C" int amsc_test(int /* ac */, char** /* av */) { - const char *amsname = "testing"; - int loop; - - ::printf ("Starting test task \n"); - ::printf (" How many loops ?\n "); - ::scanf ("%d", &loop); - for (int i = 0; i < loop; i++) { - int ams_status = ::amsc_init (amsname); - if (ams_status != AMS_SUCCESS) { - ::printf ("Can't initialise ams\n"); - ::exit (ams_status); - } - else { - ::printf (" opened ams loop number %d \n", i); - } - - ams_status = ::amsc_close (); - if (ams_status != AMS_SUCCESS) { - ::printf ("Can't close ams\n"); - ::exit (ams_status); - } - else { - ::printf (" closed ams loop number %d \n", i); - - } - } - return ::lib_rtl_default_return(); -} diff --git a/Online/OnlineBase/src/CPP/sensor_tests.cpp b/Online/OnlineBase/src/CPP/sensor_tests.cpp deleted file mode 100755 index 17b26dcd1..000000000 --- a/Online/OnlineBase/src/CPP/sensor_tests.cpp +++ /dev/null @@ -1,129 +0,0 @@ -//========================================================================== -// LHCb Online software suite -//-------------------------------------------------------------------------- -// Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) -// All rights reserved. -// -// For the licensing terms see OnlineSys/LICENSE. -// -// Author : M.Frank -// -//========================================================================== -#include "CPP/Interactor.h" -#include "CPP/TimeSensor.h" -#include "CPP/IocSensor.h" -#include "CPP/Event.h" -#include <iostream> -#include <cstdlib> -#include <vector> -using namespace std; - -namespace { - class SensorTester : public Interactor { - typedef vector<SensorTester*> Probes; - SensorTester* m_parent; - int m_globalCount, m_count, m_turns, m_sleep, m_id; - Probes m_probes; - public: - SensorTester(SensorTester* parent, int turns) - : m_parent(parent), m_globalCount(parent ? turns : 0), m_count(-1), m_turns(turns) - { - m_id = turns; - m_sleep = 10%turns; - } - virtual ~SensorTester() { - for(Probes::iterator i=m_probes.begin(); i!=m_probes.end();++i) - delete (*i); - m_probes.clear(); - } - void add(SensorTester* test) { - m_globalCount += test->m_turns; - m_probes.push_back(test); - } - void handleTimer(void* data) { - if ( data == 0 ) { - ++m_count; - //cout << "[TIMERTEST] " << m_id << " Processing timer request " << m_count << "/" << m_turns << " turns." << endl; - if ( m_count < m_turns ) TimeSensor::instance().add(this,m_sleep,0); - } - else if ( data == (void*)~0 ) { - size_t i; - for(i=0; i<m_probes.size();++i) { - if ( m_probes[i]->m_count < m_probes[i]->m_turns ) { - TimeSensor::instance().add(this,1,(void*)~0); - return; - } - } - cout << "[TIMERTEST] Finished processing after " << m_globalCount << " turns." << endl; - for(i=0; i<m_probes.size();++i) { - cout << "[TIMERTEST] ---> Probe " << i << " had " << m_probes[i]->m_count << " turns." << endl; - } - //::delete this; // No! main test object is taken from stack! - ::exit(0); - } - } - void handleIoc(SensorTester* source, int typ) { - size_t i; - switch(typ) { - case 1: - ++m_count; - IocSensor::instance().send(m_parent,0,this); - break; - case 0: - if ( ++m_count <= m_globalCount ) - IocSensor::instance().send(source,1,this); - else - IocSensor::instance().send(this,2,this); - break; - case 2: - cout << "[IOCTEST] Finished processing after " << m_globalCount << " turns." << endl; - for(i=0; i<m_probes.size();++i) { - cout << "[IOCTEST] ---> Probe " << i << " had " << m_probes[i]->m_count << " turns." << endl; - } - //::delete this; - ::exit(0); - } - } - void handle(const Event& ev) override { - switch(ev.eventtype) { - case IocEvent: - handleIoc((SensorTester*)ev.data,ev.type); - break; - case TimeEvent: - handleTimer(ev.timer_data); - break; - default: - break; - } - } - static int start_ioc() { - SensorTester test(0,1); - for (size_t i=0; i<10; ++i) { - SensorTester* probe = new SensorTester(&test, 1000); - test.add(probe); - IocSensor::instance().send(probe,1,&test); - } - IocSensor::instance().run(); - return 0; - } - static int start_timer() { - SensorTester test(0,1); - for (size_t i=0; i<10; ++i) { - SensorTester* probe = new SensorTester(&test,i+1); - test.add(probe); - TimeSensor::instance().add(probe,i+1,0); - } - TimeSensor::instance().add(&test,1,(void*)~0); - TimeSensor::instance().run(); - return 0; - } - }; -} - -extern "C" int cpp_test_iocsensor(int, char**) { - return SensorTester::start_ioc(); -} - -extern "C" int cpp_test_timesensor(int, char**) { - return SensorTester::start_timer(); -} diff --git a/Online/OnlineBase/src/RTL/que.cpp b/Online/OnlineBase/src/RTL/que.cpp index aaf2cdb6e..8ed2acba5 100755 --- a/Online/OnlineBase/src/RTL/que.cpp +++ b/Online/OnlineBase/src/RTL/que.cpp @@ -217,15 +217,15 @@ qentry_t* remqent(qentry_t* e) { if ( e ) { qentry_t* entry = 0; qentry_t *hd = add_ptr(e->prev,e); - remqhi(hd, &entry); + ::remqhi(hd, &entry); return entry; } - return 0; + return nullptr; } qentry_t *remqhead( qentry_t* head ) { - qentry_t *entry; - int status = remqhi(head,&entry); + qentry_t *entry = nullptr; + int status = ::remqhi(head,&entry); return lib_rtl_queue_success(status) ? entry : 0; } diff --git a/Online/OnlineBase/src/TAN/TanDB_tst.cpp b/Online/OnlineBase/src/TAN/TanDB_tst.cpp deleted file mode 100755 index 13676be74..000000000 --- a/Online/OnlineBase/src/TAN/TanDB_tst.cpp +++ /dev/null @@ -1,134 +0,0 @@ -//========================================================================== -// LHCb Online software suite -//-------------------------------------------------------------------------- -// Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) -// All rights reserved. -// -// For the licensing terms see OnlineSys/LICENSE. -// -// Author : M.Frank -// -//========================================================================== - -// System include files -#include <cstdio> -#include <iostream> - -// Framework include files -#include <RTL/rtl.h> -#include <TAN/TanDB.h> - -#define LINE(ll,x) { \ - for ( int i=0; i < ll; i++ ) std::cout << x; \ - std::cout << std::endl; \ - } - -extern "C" int rtl_tandb_test( int /* argc */, char** /*argv */ ) { - char buff[32]; - std::cout << "Sizes: TANDB_ENTRY=" << long(sizeof(TANDB_ENTRY)) - << " TanMessage=" << long(sizeof(TanMessage)) << " Bytes" - << std::endl; - - // Start with clean pubarea... - TanDataBase& db = TanDataBase::Instance(); - - LINE(80,'='); - db.Dump( std::cout ); - LINE(80,'='); - - TANDB_ENTRY* entry[128]; -#ifndef _OSK - int num_task = 22, num_loop = 10; -#else - int num_task = 4, num_loop = 10; -#endif - for ( int i = 0; i < num_task; i++ ) { - // Insert entry - TANDB_ENTRY* e = entry[i] = db.AllocateEntry(i); - ::snprintf(e->_Message()._Name(),sizeof(e->_Message().m_name),"MYTASK_%02d",i); - db.allocatePort (e); - - // Insert alias(s) - for ( int j = 0; j < i; j++ ) { - ::snprintf(e->_Message()._Name(),sizeof(e->_Message().m_name),"MYTASK_%02d_%02d",i,j); - db.insertAlias (e); - } - } - // Dump contents - LINE(80,'='); - db.Dump( std::cout ); - LINE(80,'='); - -#ifdef _VMS - db.Close( entry[8] ); - - db.Dump( std::cout ); - LINE(80,'='); - - db.Close( entry[9] ); - db.Close( entry[7] ); - db.Close( entry[6] ); - db.Close( entry[5] ); - db.Close( entry[4] ); -#endif - db.Close( entry[3] ); - db.Dump( std::cout ); - LINE(80,'='); - db.Close( entry[2] ); - db.Dump( std::cout ); - LINE(80,'='); - db.Close( entry[1] ); - db.Dump( std::cout ); - LINE(80,'='); - db.Close( entry[0] ); - db.Dump( std::cout ); - LINE(80,'='); - - LINE(80,'-'); - printf(" Create and delete %d x %d tasks with 0...%d aliases\n", - num_loop,num_task,num_task-1); - printf(" ... including to retrieve inserted port entries by task/alias name\n"); - TanMessage msg; - for ( int k = 0; k < num_loop; k++ ) { - for ( int i = 0; i < num_task; i++ ) { - // Insert entry - TANDB_ENTRY* e = entry[i] = db.AllocateEntry(i); - ::snprintf(e->_Message()._Name(),sizeof(e->_Message().m_name),"MYTASK_%02d",i); - ::snprintf(msg._Name(),sizeof(msg.m_name),"%s",e->_Message()._Name()); - NetworkChannel::Port port = db.allocatePort (e); - NetworkChannel::Port fnd = db.findPort(msg); - if ( fnd != port ) { - std::cout << "!!!!!!!!!!! Port allocated:" << std::hex << port - << " found:" << std::hex << fnd << std::endl; - } - - // Insert alias(s) - for ( int j = 0; j < i; j++ ) { - ::snprintf(e->_Message()._Name(),sizeof(e->_Message().m_name),"MYTASK_%02d_%02d",i,j); - ::snprintf(msg._Name(),sizeof(msg.m_name),"%s",e->_Message()._Name()); - int status = db.insertAlias (e); - NetworkChannel::Port fnd = db.findPort(msg); - if ( fnd != port ) { - std::cout << "!!!!!!!!!!! Port allocated:" << std::hex << port - << " found:" << std::hex << fnd - << " status:" << std::hex << status << std::endl; - } - } - } - // fprintf(stdout,"Type return to delete tasks:"); - // fflush(stdout); - // scanf("%c",&buff[0]); - for ( int i = 0; i < num_task; i++ ) { - ::snprintf(buff,sizeof(buff),"MYTASK_%02d",i); - TANDB_ENTRY* e = db.FindEntry ( buff ); - db.Close( e ); - } - } - LINE(80,'-'); - LINE(80,'='); - LINE(80,'-'); - db.Dump( std::cout ); - LINE(80,'='); - std::cout << "All done ...." << std::endl; - return lib_rtl_default_return(); -} diff --git a/Online/OnlineBase/src/TAN/tan_inquire_tst.cpp b/Online/OnlineBase/src/TAN/tan_inquire_tst.cpp deleted file mode 100755 index 5dd9adc67..000000000 --- a/Online/OnlineBase/src/TAN/tan_inquire_tst.cpp +++ /dev/null @@ -1,120 +0,0 @@ -//========================================================================== -// LHCb Online software suite -//-------------------------------------------------------------------------- -// Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) -// All rights reserved. -// -// For the licensing terms see OnlineSys/LICENSE. -// -// Author : M.Frank -// -//========================================================================== - -// System include files -#include <cstdio> -#include <cstdlib> -#include <ctime> - - -// Framework include files -#include <RTL/rtl.h> -#include <AMS/amsdef.h> -#include <TAN/TanInterface.h> - -#define MAXTASKS 20 -#ifdef _VMS -#define lib_signal(x) lib$signal(x) -#else -#define lib_signal(x) {printf("%s\n",RTL::errorString(x).c_str()); } -#endif -static void help() { - printf("Usage : inquire -opt <opts>\n"); - printf(" -c contious mode\n"); - printf(" -t supply task name; default:MYTASK\n"); - printf(" -n supply host name; default:<localhost>\n"); - printf(" -q quiet mode(statistics only\n"); - printf(" -?, -h get this help\n"); - exit(0); -} - -extern "C" int rtl_tan_inquire_test ( int argc, char* argv[] ) { - RTL::CLI cli(argc,argv,help); - TanInterface& interf = TanInterface::instance(); - int status, num_inq = 0, tot_inq = 0, succ = 0, fail = 0, notfnd = 0; -#ifdef _WIN32 - int inc = 50; -#else - int inc = 500; -#endif - std::string task_name = "MYTASK", host_name; - bool continuous = false, quiet = false; - char buff[64], host[32]; - sockaddr_in addr; - ::lib_rtl_get_node_name(host,sizeof(host)); - tan_host_name(host,sizeof(host)); - cli.getopt("node",1,host_name=host); - cli.getopt("task",1,task_name); - continuous = cli.getopt("continuous",1) != 0; - quiet = cli.getopt("quiet",1) != 0; - -#define _PRINT succ++; if ( !quiet ) printf -#define _PRINTERROR(buff,status) { \ - if ( status == AMS_TASKNOTFOUND ) notfnd++; \ - if ( !quiet || status != AMS_TASKNOTFOUND ) { \ - ::printf("GetAddressByName(%-24s) %4d ", buff, status); \ - lib_signal(status); \ - } fail++; \ - } - - if ( interf.Status() == TAN_SS_SUCCESS ) { - /// Check non-exisiting task - ::snprintf(buff,sizeof(buff),"%s::IDIOTIC",host_name.c_str()); - status = ::tan_get_address_by_name(buff,&addr); - _PRINTERROR(buff,status); - time_t start = ::time(0); - int nalias = 0; - while ( 1 ) { - if ( num_inq > inc ) { - tot_inq += num_inq; - num_inq = 0; - ::printf("->%-4ld sec<- Queries:%6d Aliases:%6d Success:%-4d TaskNotFound:%-4d Failure:%-4d.\n", - time(0) - start, tot_inq, nalias, succ, notfnd, fail); - } - for ( int i = 0; i < MAXTASKS; i++ ) { - if ( (i % 10)==0 && !quiet ) status = tan_dump_dbase ( host_name.c_str() ); - for ( int j = 0; j < i; j++ ) { - // Now check the aliases - ::snprintf(buff,sizeof(buff),"%s::%s_%02d_%02d",host_name.c_str(),task_name.c_str(),i,j); - status = ::tan_get_address_by_name (buff,&addr); - num_inq++; - if ( status == AMS_SUCCESS ) { - _PRINT ("GetAddressByName[%d]: %s Port:%04X Fam:%1X Saddr:%08X (%s)\n", - num_inq, buff, addr.sin_port, addr.sin_family, addr.sin_addr.s_addr, - inet_ntoa(addr.sin_addr) ); - } - else { - nalias++; - _PRINTERROR(buff,status); - } - } - ::snprintf(buff,sizeof(buff),"%s::%s_%02d",host_name.c_str(),task_name.c_str(),i); - status = ::tan_get_address_by_name (buff,&addr); - num_inq++; - if ( status == AMS_SUCCESS ) { - _PRINT ("GetAddressByName[%d]: %s Port:%04X Fam:%1X Saddr:%08X (%s)\n", - num_inq, buff, addr.sin_port, addr.sin_family, addr.sin_addr.s_addr, - inet_ntoa(addr.sin_addr) ); - } - else { - nalias++; - _PRINTERROR(buff,status); - } - if ( !continuous ) return 0x1; // Just stop if non continuous - } - } - } - else { - _PRINTERROR("Error! Status:", interf.Status()); - } - return 0x1; -} diff --git a/Online/OnlineBase/src/WT/wtlib.cpp b/Online/OnlineBase/src/WT/wtlib.cpp index 790b906a4..eeae430f4 100755 --- a/Online/OnlineBase/src/WT/wtlib.cpp +++ b/Online/OnlineBase/src/WT/wtlib.cpp @@ -61,9 +61,9 @@ struct wt_enabled_fac_header : public qentry { }; void wtc_print_space(); -wt_fac_entry* _wtc_find_facility(unsigned int facility,qentry* fac_head); +static wt_fac_entry* _wtc_find_facility(unsigned int facility,qentry* fac_head); static int _wtc_add_fired(wt_queue_entry* entry,wt_enabled_fac_header* mask_ptr,wt_fac_entry* fac); -void _wtc_print_entry(wt_queue_entry *e); +static void _wtc_print_entry(wt_queue_entry *e); //----------------------------STATIC STORAGE---------------------------- @@ -479,11 +479,11 @@ int wtc_restore_stack() { return WT_SUCCESS; } //---------------------------------------------------------------------- -wt_fac_entry* _wtc_find_facility(unsigned int facility,qentry* fac_head) { - wt_fac_entry *fac = 0; - for(fac = (wt_fac_entry*)((char*)fac_head->next+(long)fac_head); - fac != (wt_fac_entry*)fac_head ; fac = (wt_fac_entry*)((char*)fac->next+(long)fac)) - if( fac->facility == facility ) break; +static wt_fac_entry* _wtc_find_facility(unsigned int facility,qentry* fac_head) { + wt_fac_entry *fac = (wt_fac_entry*)((char*)fac_head->next+(long)fac_head); + for(; fac != (wt_fac_entry*)fac_head; fac = (wt_fac_entry*)((char*)fac->next+(long)fac)) { + if( fac->facility == facility ) return fac; + } return fac; } //---------------------------------------------------------------------- @@ -519,6 +519,6 @@ static int _wtc_add_fired(wt_queue_entry* entry,wt_enabled_fac_header* mask_ptr, return WT_SUCCESS; } //---------------------------------------------------------------------- -void _wtc_print_entry(wt_queue_entry *e) { +static void _wtc_print_entry(wt_queue_entry *e) { ::lib_rtl_output(LIB_RTL_ALWAYS," Entry facility: %8X parameter:%p\n",e->facility, e->userpar1); } diff --git a/Online/OnlineBase/src/WT/wttest.cpp b/Online/OnlineBase/src/WT/wttest.cpp deleted file mode 100755 index 0b88623e0..000000000 --- a/Online/OnlineBase/src/WT/wttest.cpp +++ /dev/null @@ -1,351 +0,0 @@ -//========================================================================== -// LHCb Online software suite -//-------------------------------------------------------------------------- -// Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN) -// All rights reserved. -// -// For the licensing terms see OnlineSys/LICENSE. -// -// Author : M.Frank -// -//========================================================================== -// WAIT FACILITY TEST PROGRAM -//---------------------------------------------------------------------- -#include <WT/wtdef.h> -#include <RTL/rtl.h> -#include <SCR/scr.h> -#include <ctime> -#include <cstdlib> -#include <cstdarg> - -namespace { - - struct Params { - int INTERVAL_NORMAL = 1; - int INTERVAL0 = INTERVAL_NORMAL; - int INTERVAL1 = 1*INTERVAL_NORMAL; - int INTERVAL2 = 10*INTERVAL_NORMAL; - int INTERVAL3 = 100*INTERVAL_NORMAL; - int INTERVAL4 = 1000*INTERVAL_NORMAL; - bool silent = false; - struct wt_obj { - unsigned long alarm = 0; - long action = 0; - long ast = 0; - long rearm = 0; - wt_obj() = default; - } counter[5]; - long rearm4_count = -1; - SCR::Pasteboard* pasteboard = 0; - SCR::Display* display = 0; - Params() = default; - }; - - void __print_at_file(Params*, int, int, const char* fmt, ...) { - va_list args; - char buff[256]; - va_start( args, fmt ); - ::vsnprintf( buff, sizeof(buff), fmt, args); - va_end(args); - ::printf("%s\n",buff); - } - - void __print_at_screen(Params* p, int x, int y, const char* fmt, ...) { - if ( !p->silent ) { - va_list args; - char buff[256]; - va_start( args, fmt ); - ::vsnprintf( buff, sizeof(buff), fmt, args); - va_end(args); - ::scrc_begin_pasteboard_update(p->pasteboard); - ::scrc_put_chars(p->display,buff,SCR::NORMAL,y,x,0); - ::scrc_end_pasteboard_update(p->pasteboard); - } - } - - void (*print_at)(Params* p, int x, int y, const char* fmt, ...) = 0; - - int ast0(void* par) { - Params* p = (Params*)par; - p->counter[0].ast++; - return ::wtc_insert(WT_FACILITY_TIMER1, par); - } -#if 0 - int rearm0(unsigned int /* fac */, void* par) { - Params* p = (Params*)par; - if ( (++p->counter[0].rearm%500)==0 ) print_at(p, 40, 4, "%10ld",p->counter[0].rearm); - int sc = ::lib_rtl_set_timer(p->INTERVAL0, ast0, par, &p->counter[0].alarm); - return ::lib_rtl_is_success(sc) ? WT_SUCCESS : WT_ERROR; - } -#endif - int fast_rearm0(unsigned int /* fac */, void* par) { - Params* p = (Params*)par; - if ( (++p->counter[0].rearm%500)==0 ) print_at(p, 40, 4, "%10ld",p->counter[0].rearm); - return ast0(par); - } - - int action0(unsigned int /* fac */, void* par) { - Params* p = (Params*)par; - if ( (++p->counter[0].action%500)==0 ) { - print_at(p, 50, 4, "%10ld", p->counter[0].ast); - print_at(p, 30, 4, "%10ld", p->counter[0].action); - } - return WT_SUCCESS; - } - - int ast1(void* par) { - Params* p = (Params*)par; - p->counter[1].ast++; - return ::wtc_insert(WT_FACILITY_TIMER2, par); - } - - int rearm1(unsigned int /* fac */, void* par) { - Params* p = (Params*)par; - if ( (++p->counter[1].rearm%50)==0 ) print_at(p, 40, 5, "%10ld",p->counter[1].rearm); - int sc = ::lib_rtl_set_timer(p->INTERVAL1, ast1, par, &p->counter[1].alarm); - return ::lib_rtl_is_success(sc) ? WT_SUCCESS : WT_ERROR; - } - - int fast_rearm1(unsigned int /* fac */, void* par) { - Params* p = (Params*)par; - if ( (++p->counter[1].rearm%50)==0 ) print_at(p, 40, 5, "%10ld",p->counter[1].rearm); - return ast1(par); - } - - int action1(unsigned int /* fac */, void* par) { - Params* p = (Params*)par; - if ( (++p->counter[1].action%50)==0 ) { - print_at(p, 50, 5, "%10ld", p->counter[1].ast); - print_at(p, 30, 5, "%10ld", p->counter[1].action); - } - return WT_SUCCESS; - } - - int ast2(void* par) { - Params* p = (Params*)par; - p->counter[2].ast++; - return ::wtc_insert(WT_FACILITY_TIMER3,par); - } - - int rearm2(unsigned int /* fac */, void* par) { - Params* p = (Params*)par; - print_at(p, 40, 6, "%10ld", ++p->counter[2].rearm); - return ::lib_rtl_set_timer(p->INTERVAL2, ast2, par, &p->counter[2].alarm); - } - - int fast_rearm2(unsigned int /* fac */, void* par) { - Params* p = (Params*)par; - if ( (++p->counter[2].rearm%50)==0 ) print_at(p, 40, 6, "%10ld",p->counter[2].rearm); - return ast2(par); - } - - int action2(unsigned int /* fac */, void* par) { - Params* p = (Params*)par; - print_at(p, 50, 6, "%10ld", p->counter[2].ast); - print_at(p, 30, 6, "%10ld",++p->counter[2].action); - return WT_SUCCESS; - } - - int ast3(void* par) { - Params* p = (Params*)par; - p->counter[3].ast++; - return ::wtc_insert(WT_FACILITY_TIMER4, par); - } - - int rearm3(unsigned int /* fac */, void* par) { - Params* p = (Params*)par; - print_at(p, 40, 7, "%10ld", ++p->counter[3].rearm); - return ::lib_rtl_set_timer(p->INTERVAL3, ast3, par, &p->counter[3].alarm); - } - - int fast_rearm3(unsigned int /* fac */, void* par) { - Params* p = (Params*)par; - if ( (++p->counter[3].rearm%50)==0 ) print_at(p, 40, 7, "%10ld",p->counter[3].rearm); - return ast3(par); - } - - int action3(unsigned int /* fac */, void* par) { - Params* p = (Params*)par; - static time_t start = ::time(0); - time_t tm = ::time(0); - if ( start == tm ) ++tm; - long ast_sum = p->counter[4].ast+p->counter[3].ast+p->counter[2].ast+p->counter[1].ast+p->counter[0].ast; - print_at(p, 50, 7, "%10ld", p->counter[3].ast); - print_at(p, 30, 7, "%10ld", ++p->counter[3].action); - bool sil = p->silent; - if ( !sil || (p->counter[3].ast%100000) == 0 ) { - p->silent = false; - print_at(p, 4, 10, "Time: %s %ld seconds", ::ctime(&tm), long(tm-start)); - print_at(p, 4, 11, "Inserts: %ld %10.3f kHz", ast_sum, double(ast_sum)/double(tm-start)/1e3); - } - p->silent = sil; - return WT_SUCCESS; - } - - int ast4(void* par) { - Params* p = (Params*)par; - p->counter[4].ast++; - return ::wtc_insert(WT_FACILITY_TIMER5, par); - } - - int rearm4(unsigned int /* fac */, void* par) { - Params* p = (Params*)par; - print_at(p, 40, 8, "%10ld",++p->counter[4].rearm); - if ( p->rearm4_count > 0 ) --p->rearm4_count; - if ( p->rearm4_count == 0 ) { - print_at(p, 4, 10, "AST0: %10ld",p->counter[0].ast); - print_at(p, 4, 11, "AST1: %10ld",p->counter[1].ast); - print_at(p, 4, 12, "AST2: %10ld",p->counter[2].ast); - print_at(p, 4, 13, "AST3: %10ld",p->counter[3].ast); - print_at(p, 4, 14, "AST4: %10ld",p->counter[4].ast); - print_at(p, 4, 15,"WTC: Successfully executed %ld AST4 requests. (%ld AST4, %ld AST3 %ld AST2 %ld AST1 %ld AST0)", - p->counter[4].ast, p->counter[4].ast, p->counter[3].ast, - p->counter[2].ast, p->counter[1].ast, p->counter[0].ast); - print_at(p, 4, 16, ""); - exit(0); - } - return ::lib_rtl_set_timer(p->INTERVAL4, ast4, par, &p->counter[4].alarm); - } - - int fast_rearm4(unsigned int /* fac */, void* par) { - Params* p = (Params*)par; - if ( (++p->counter[4].rearm%50)==0 ) print_at(p, 40, 8, "%10ld",p->counter[4].rearm); - return ast4(par); - } - - int action4(unsigned int /* fac */, void* par) { - Params* p = (Params*)par; - print_at(p, 50, 8, "%10ld",p->counter[4].ast); - print_at(p, 30, 8, "%10ld",++p->counter[4].action); - return WT_SUCCESS; - } -} - -extern "C" int wtc_test(int /* argc */, char** /* argv */) { - int width, height; - Params params, *p = ¶ms; - print_at = __print_at_screen; - - int status = ::wtc_init(); - if( status != WT_SUCCESS ) exit(status); - - ::scrc_create_pasteboard (&p->pasteboard, 0, &height, &width); - ::scrc_create_display (&p->display, height-2, width-2, SCR::NORMAL, SCR::ON, "WT test program"); - ::scrc_paste_display (p->display, p->pasteboard, 2, 2); - ::scrc_end_pasteboard_update(p->pasteboard); - ::scrc_fflush(p->pasteboard); - ::scrc_set_cursor(p->display, 2, 10); - ::scrc_cursor_off(p->pasteboard); - - print_at(p, 4, 2, "Object name Actions Rearms Asts"); - print_at(p, 4, 4, "WT direct: "); - print_at(p, 4, 5, "Timer 1 (%5d msecs):",p->INTERVAL1); - print_at(p, 4, 6, "Timer 2 (%5d msecs):",p->INTERVAL2); - print_at(p, 4, 7, "Timer 3 (%5d msecs):",p->INTERVAL3); - print_at(p, 4, 8, "Timer 4 (%5d msecs):",p->INTERVAL4); - - //---OBJECT 0---- - status = ::wtc_subscribe( WT_FACILITY_TIMER1, fast_rearm0, action0, p); - if( status != WT_SUCCESS ) exit(status); - //---TIMER 1---- - status = ::wtc_subscribe( WT_FACILITY_TIMER2, rearm1, action1, p); - if( status != WT_SUCCESS ) exit(status); - //---TIMER 2---- - status = ::wtc_subscribe( WT_FACILITY_TIMER3, rearm2, action2, p); - if( status != WT_SUCCESS ) exit(status); - //---TIMER 3---- - status = ::wtc_subscribe( WT_FACILITY_TIMER4, rearm3, action3, p); - if( status != WT_SUCCESS ) exit(status); - //---TIMER 4---- - status = ::wtc_subscribe( WT_FACILITY_TIMER5, rearm4, action4, p); - if( status != WT_SUCCESS ) exit(status); - for(;;) { - unsigned int facility; - int sub_status; - void* userpar; - status = ::wtc_wait(&facility, &userpar, &sub_status); - ::lib_rtl_output(LIB_RTL_ALWAYS,"Exited WAIT>>>> Facility = %d Status=%d Sub-Status = %d\n", - facility, status, sub_status); - } -} - -extern "C" int wtc_test_fast(int /* argc */, char** /* argv */) { - int width, height; - Params params, *p = ¶ms; - print_at = __print_at_screen; - - int status = ::wtc_init(); - if( status != WT_SUCCESS ) exit(status); - - ::scrc_create_pasteboard (&p->pasteboard, 0, &height, &width); - ::scrc_create_display (&p->display, height-2, width-2, SCR::NORMAL, SCR::ON, "WT test program"); - ::scrc_paste_display (p->display, p->pasteboard, 2, 2); - ::scrc_end_pasteboard_update(p->pasteboard); - ::scrc_fflush(p->pasteboard); - ::scrc_set_cursor(p->display, 2, 10); - ::scrc_cursor_off(p->pasteboard); - - print_at(p, 4,2,"Object name Actions Rearms Asts"); - print_at(p, 4,4,"Object 0 :"); - print_at(p, 4,5,"Object 1 :"); - print_at(p, 4,6,"Object 2 :"); - print_at(p, 4,7,"Object 3 :"); - print_at(p, 4,8,"Object 4 :"); - - //---TIMER 0---- - status = ::wtc_subscribe( WT_FACILITY_TIMER1, fast_rearm0, action0, p); - if( status != WT_SUCCESS ) exit(status); - //---TIMER 1---- - status = ::wtc_subscribe( WT_FACILITY_TIMER2, fast_rearm1, action1, p); - if( status != WT_SUCCESS ) exit(status); - //---TIMER 2---- - status = ::wtc_subscribe( WT_FACILITY_TIMER3, fast_rearm2, action2, p); - if( status != WT_SUCCESS ) exit(status); - //---TIMER 3---- - status = ::wtc_subscribe( WT_FACILITY_TIMER4, fast_rearm3, action3, p); - if( status != WT_SUCCESS ) exit(status); - //---TIMER 4---- - status = ::wtc_subscribe( WT_FACILITY_TIMER5, fast_rearm4, action4, p); - if( status != WT_SUCCESS ) exit(status); - p->silent = true; - for(;;) { - unsigned int facility; - int sub_status; - void* userpar; - status = ::wtc_wait(&facility, &userpar, &sub_status); - ::lib_rtl_output(LIB_RTL_ALWAYS,"Exited WAIT>>>> Facility = %d Status=%d Sub-Status = %d\n", - facility, status, sub_status); - } -} - -extern "C" int wtc_test_qmtest(int /* argc */, char** /* argv */) { - Params params, *p = ¶ms; - print_at = __print_at_file; - p->rearm4_count = 4; - p->INTERVAL_NORMAL = 6; - p->INTERVAL2 = 200*p->INTERVAL_NORMAL; - int status = ::wtc_init(); - if( status != WT_SUCCESS ) exit(status); - print_at(p, 4,2,"Object name Actions Rearms Asts"); - print_at(p, 4,5,"Timer 2 (%5d msecs):", p->INTERVAL2); - print_at(p, 4,6,"Timer 3 (%5d msecs):", p->INTERVAL3); - print_at(p, 4,7,"Timer 4 (%5d msecs):", p->INTERVAL4); - - //---TIMER 2---- - status = ::wtc_subscribe( WT_FACILITY_TIMER2, rearm2, action2, p); - if( status != WT_SUCCESS ) ::exit(status); - //---TIMER 3---- - status = ::wtc_subscribe( WT_FACILITY_TIMER3, rearm3, action3, p); - if( status != WT_SUCCESS ) ::exit(status); - //---TIMER 4---- - status = ::wtc_subscribe( WT_FACILITY_TIMER4, rearm4, action4, p); - if( status != WT_SUCCESS ) ::exit(status); - for(;;) { - unsigned int facility; - int sub_status; - void* userpar; - status = ::wtc_wait(&facility, &userpar, &sub_status); - ::lib_rtl_output(LIB_RTL_ALWAYS,"Exited WAIT>>>> Facility = %d Status=%d Sub-Status = %d\n", - facility, status, sub_status); - } -} diff --git a/Online/PCIE40Data/include/PCIE40Data/RawBank40.h b/Online/PCIE40Data/include/PCIE40Data/RawBank40.h index 829112eba..cd0ee91dc 100644 --- a/Online/PCIE40Data/include/PCIE40Data/RawBank40.h +++ b/Online/PCIE40Data/include/PCIE40Data/RawBank40.h @@ -159,18 +159,15 @@ namespace Online { PlumeError, // 86 VeloThresholdScan, // 87 Hardware only ? FTError, // 88 - // Add new types here. Don't forget to update also RawBank.cpp + // Banks above are reserved for DAQ, add only generic DaqError types below. + DaqErrorFragmentThrottled, // 89 + DaqErrorBXIDCorrupted, // 90 + DaqErrorSyncBXIDCurrupted, // 91 + DaqErrorFragmentMissing, // 92 + DaqErrorFragmentTruncated, // 93 + LastType, // LOOP Marker; add new bank types ONLY before! Other = 1, - DaqErrorBase = 192, // Lowest DaqError type available in Run 3 (EDMS2100937) - // Banks above are reserved for DAQ, add only generic DaqError types below. - DaqErrorFragmentThrottled = 250, - DaqErrorBXIDCorrupted = 251, - DaqErrorBXIDJump = 252, - DaqErrorFragmentMissing = 253, - DaqErrorFragmentTruncated = 254, - DaqErrorInvalid = 255 - // 255 is the highest type allowed by the Run 3 raw-data format (8-bit unsigned) }; /// Magic pattern for Raw bank headers diff --git a/Online/PCIE40Data/include/PCIE40Data/pcie40.h b/Online/PCIE40Data/include/PCIE40Data/pcie40.h index 128db6aa2..812adeb22 100644 --- a/Online/PCIE40Data/include/PCIE40Data/pcie40.h +++ b/Online/PCIE40Data/include/PCIE40Data/pcie40.h @@ -506,27 +506,6 @@ namespace Online { maxTell40Plume, maxTell40Other }; -#if 0 - static constexpr - RawBank40::BankType collectionBankType[] = { - RawBank40::ODIN, - RawBank40::VP, - RawBank40::VP, - RawBank40::UT, - RawBank40::UT, - RawBank40::FTGeneric, - RawBank40::FTGeneric, - RawBank40::Calo, - RawBank40::HC, - RawBank40::HC, - RawBank40::Muon, - RawBank40::Muon, - RawBank40::Rich, - RawBank40::Rich, - RawBank40::DAQ, - RawBank40::Plume - }; -#endif static constexpr std::size_t collection_id_ODIN = 0; static constexpr std::size_t collectionSizeODIN = sizeof(bank_collection_t); @@ -884,13 +863,11 @@ namespace Online { case bank_t::TestDet: return std::make_pair(true,params::collectionOffsetOther); - case bank_t::DaqErrorBase: case bank_t::DaqErrorFragmentThrottled: case bank_t::DaqErrorBXIDCorrupted: - case bank_t::DaqErrorBXIDJump: + case bank_t::DaqErrorSyncBXIDCurrupted: case bank_t::DaqErrorFragmentMissing: case bank_t::DaqErrorFragmentTruncated: - case bank_t::DaqErrorInvalid: switch( offset ) { case params::collectionOffsetODIN: case params::collectionOffsetVPA: diff --git a/Online/PCIE40Data/src/pcie40encoder.cpp b/Online/PCIE40Data/src/pcie40encoder.cpp index b96a78f47..9cd52a310 100644 --- a/Online/PCIE40Data/src/pcie40encoder.cpp +++ b/Online/PCIE40Data/src/pcie40encoder.cpp @@ -153,96 +153,96 @@ static const unsigned char* __bank_detector_map() { if ( 0 == detector_map ) { detector_map = new unsigned char[256]; ::memset(detector_map,0,256); - detector_map[RawBank40::L0Calo] = 25; // 0 - detector_map[RawBank40::L0DU] = 17; // 1 - detector_map[RawBank40::PrsE] = 18; // 2 - detector_map[RawBank40::EcalE]= params::detectorid_Ecal; // 3 - detector_map[RawBank40::HcalE]= params::detectorid_Hcal; // 4 - detector_map[RawBank40::PrsTrig] = 31; // 5 - detector_map[RawBank40::EcalTrig] = 16; // 6 - detector_map[RawBank40::HcalTrig] = 16; // 7 - detector_map[RawBank40::Velo] = 2; // 8 - detector_map[RawBank40::Rich] = params::detectorid_Rich1; // 9 - detector_map[RawBank40::TT] = 19; // 10 - detector_map[RawBank40::IT] = 20; // 11 - detector_map[RawBank40::OT] = 21; // 12 - detector_map[RawBank40::Muon] = params::detectorid_MuonA; // 13 - detector_map[RawBank40::L0PU] = 22; // 14 - detector_map[RawBank40::DAQ] = 23; // 15 - detector_map[RawBank40::ODIN] = params::detectorid_ODIN; // 16 - detector_map[RawBank40::HltDecReports] = 30; // 17 - detector_map[RawBank40::VeloFull] = params::detectorid_VPA; // 18 - detector_map[RawBank40::TTFull] = 19; // 19 - detector_map[RawBank40::ITFull] = 20; // 20 - detector_map[RawBank40::EcalPacked]= params::detectorid_Ecal; // 21 - detector_map[RawBank40::HcalPacked]= params::detectorid_Hcal; // 22 - detector_map[RawBank40::PrsPacked] = 18; // 23 - detector_map[RawBank40::L0Muon] = 24; // 24 - detector_map[RawBank40::ITError] = 20; // 25 - detector_map[RawBank40::TTError] = 19; // 26 - detector_map[RawBank40::ITPedestal] = 20; // 27 - detector_map[RawBank40::TTPedestal] = 19; // 28 - detector_map[RawBank40::VeloError] = params::detectorid_VPA; // 29 - detector_map[RawBank40::VeloPedestal] = params::detectorid_VPA; // 30 - detector_map[RawBank40::VeloProcFull] = params::detectorid_VPA; // 31 - detector_map[RawBank40::OTRaw] = 21; // 32 - detector_map[RawBank40::OTError] = 21; // 33 - detector_map[RawBank40::EcalPackedError]= params::detectorid_Ecal; // 34 - detector_map[RawBank40::HcalPackedError]= params::detectorid_Hcal; // 35 - detector_map[RawBank40::PrsPackedError] = 18; // 36 - detector_map[RawBank40::L0CaloFull] = 25; // 37 - detector_map[RawBank40::L0CaloError] = 25; // 38 - detector_map[RawBank40::L0MuonCtrlAll] = 29; // 39 - detector_map[RawBank40::L0MuonProcCand] = 28; // 40 - detector_map[RawBank40::L0MuonProcData] = 27; // 41 - detector_map[RawBank40::L0MuonRaw] = 29; // 42 - detector_map[RawBank40::L0MuonError] = 29; // 43 - detector_map[RawBank40::GaudiSerialize] = 30; // 44 - detector_map[RawBank40::GaudiHeader] = 30; // 45 - detector_map[RawBank40::TTProcFull] = 19; // 46 - detector_map[RawBank40::ITProcFull] = 20; // 47 - detector_map[RawBank40::TAEHeader]= params::detectorid_Ecal; // 48 - detector_map[RawBank40::MuonFull] = params::detectorid_MuonA; // 49 - detector_map[RawBank40::MuonError] = params::detectorid_MuonA; // 50 - detector_map[RawBank40::TestDet] = 15; // 51 - detector_map[RawBank40::L0DUError] = 21; // 52 - detector_map[RawBank40::HltRoutingBits] = 30; // 53 - detector_map[RawBank40::HltSelReports] = 30; // 54 - detector_map[RawBank40::HltVertexReports] = 30; // 55 - detector_map[RawBank40::HltLumiSummary] = 30; // 56 - detector_map[RawBank40::L0PUFull] = 20; // 57 - detector_map[RawBank40::L0PUError] = 20; // 58 - detector_map[RawBank40::DstBank]= params::detectorid_Ecal; // 59 - detector_map[RawBank40::DstData]= params::detectorid_Ecal; // 60 - detector_map[RawBank40::DstAddress]= params::detectorid_Ecal; // 61 - detector_map[RawBank40::FileID]= params::detectorid_Ecal; // 62 - detector_map[RawBank40::VP] = params::detectorid_VPA; // 63 - detector_map[RawBank40::FTCluster] = params::detectorid_FTA; // 64 - detector_map[RawBank40::VL] = params::detectorid_VPA; // 65 - detector_map[RawBank40::UT] = params::detectorid_UTA; // 66 - detector_map[RawBank40::UTFull] = params::detectorid_UTA; // 67 - detector_map[RawBank40::UTError] = params::detectorid_UTA; // 68 - detector_map[RawBank40::UTPedestal] = params::detectorid_UTA; // 69 - detector_map[RawBank40::HC] = 26; // 70 - detector_map[RawBank40::HltTrackReports] = 30; // 71 - detector_map[RawBank40::HCError] = 26; // 72 - detector_map[RawBank40::VPRetinaCluster] = params::detectorid_VPA; // 73 - detector_map[RawBank40::FTGeneric] = params::detectorid_FTA; // 74 - detector_map[RawBank40::FTCalibration] = params::detectorid_FTA; // 75 - detector_map[RawBank40::FTNZS] = params::detectorid_FTA; // 76 - detector_map[RawBank40::Calo] = params::detectorid_Ecal; // 77 - detector_map[RawBank40::CaloError] = params::detectorid_Ecal; // 78 - detector_map[RawBank40::MuonSpecial] = params::detectorid_MuonA; // 79 - detector_map[RawBank40::RichCommissioning] = params::detectorid_Rich1; // 80 - detector_map[RawBank40::RichError] = params::detectorid_Rich1; // 81 - detector_map[RawBank40::FTSpecial] = params::detectorid_FTA; // 82 - detector_map[RawBank40::CaloSpecial] = params::detectorid_Ecal; // 83 - detector_map[RawBank40::Plume] = params::detectorid_Plume; // 84 - detector_map[RawBank40::PlumeSpecial] = params::detectorid_Plume; // 85 - detector_map[RawBank40::PlumeError] = params::detectorid_Plume; // 86 - detector_map[RawBank40::VeloThresholdScan] = params::detectorid_VPA; // 87 Hardware only ? - detector_map[RawBank40::FTError] = params::detectorid_FTA; // 88 - detector_map[RawBank40::LastType] = 0; // LOOP Marker; add new bank types ONLY before! + detector_map[bank_t::L0Calo] = 25; // 0 + detector_map[bank_t::L0DU] = 17; // 1 + detector_map[bank_t::PrsE] = 18; // 2 + detector_map[bank_t::EcalE]= params::detectorid_Ecal; // 3 + detector_map[bank_t::HcalE]= params::detectorid_Hcal; // 4 + detector_map[bank_t::PrsTrig] = 31; // 5 + detector_map[bank_t::EcalTrig] = 16; // 6 + detector_map[bank_t::HcalTrig] = 16; // 7 + detector_map[bank_t::Velo] = 2; // 8 + detector_map[bank_t::Rich] = params::detectorid_Rich1; // 9 + detector_map[bank_t::TT] = 19; // 10 + detector_map[bank_t::IT] = 20; // 11 + detector_map[bank_t::OT] = 21; // 12 + detector_map[bank_t::Muon] = params::detectorid_MuonA; // 13 + detector_map[bank_t::L0PU] = 22; // 14 + detector_map[bank_t::DAQ] = 23; // 15 + detector_map[bank_t::ODIN] = params::detectorid_ODIN; // 16 + detector_map[bank_t::HltDecReports] = 30; // 17 + detector_map[bank_t::VeloFull] = params::detectorid_VPA; // 18 + detector_map[bank_t::TTFull] = 19; // 19 + detector_map[bank_t::ITFull] = 20; // 20 + detector_map[bank_t::EcalPacked]= params::detectorid_Ecal; // 21 + detector_map[bank_t::HcalPacked]= params::detectorid_Hcal; // 22 + detector_map[bank_t::PrsPacked] = 18; // 23 + detector_map[bank_t::L0Muon] = 24; // 24 + detector_map[bank_t::ITError] = 20; // 25 + detector_map[bank_t::TTError] = 19; // 26 + detector_map[bank_t::ITPedestal] = 20; // 27 + detector_map[bank_t::TTPedestal] = 19; // 28 + detector_map[bank_t::VeloError] = params::detectorid_VPA; // 29 + detector_map[bank_t::VeloPedestal] = params::detectorid_VPA; // 30 + detector_map[bank_t::VeloProcFull] = params::detectorid_VPA; // 31 + detector_map[bank_t::OTRaw] = 21; // 32 + detector_map[bank_t::OTError] = 21; // 33 + detector_map[bank_t::EcalPackedError]= params::detectorid_Ecal; // 34 + detector_map[bank_t::HcalPackedError]= params::detectorid_Hcal; // 35 + detector_map[bank_t::PrsPackedError] = 18; // 36 + detector_map[bank_t::L0CaloFull] = 25; // 37 + detector_map[bank_t::L0CaloError] = 25; // 38 + detector_map[bank_t::L0MuonCtrlAll] = 29; // 39 + detector_map[bank_t::L0MuonProcCand] = 28; // 40 + detector_map[bank_t::L0MuonProcData] = 27; // 41 + detector_map[bank_t::L0MuonRaw] = 29; // 42 + detector_map[bank_t::L0MuonError] = 29; // 43 + detector_map[bank_t::GaudiSerialize] = 30; // 44 + detector_map[bank_t::GaudiHeader] = 30; // 45 + detector_map[bank_t::TTProcFull] = 19; // 46 + detector_map[bank_t::ITProcFull] = 20; // 47 + detector_map[bank_t::TAEHeader]= params::detectorid_Ecal; // 48 + detector_map[bank_t::MuonFull] = params::detectorid_MuonA; // 49 + detector_map[bank_t::MuonError] = params::detectorid_MuonA; // 50 + detector_map[bank_t::TestDet] = 15; // 51 + detector_map[bank_t::L0DUError] = 21; // 52 + detector_map[bank_t::HltRoutingBits] = 30; // 53 + detector_map[bank_t::HltSelReports] = 30; // 54 + detector_map[bank_t::HltVertexReports] = 30; // 55 + detector_map[bank_t::HltLumiSummary] = 30; // 56 + detector_map[bank_t::L0PUFull] = 20; // 57 + detector_map[bank_t::L0PUError] = 20; // 58 + detector_map[bank_t::DstBank]= params::detectorid_Ecal; // 59 + detector_map[bank_t::DstData]= params::detectorid_Ecal; // 60 + detector_map[bank_t::DstAddress]= params::detectorid_Ecal; // 61 + detector_map[bank_t::FileID]= params::detectorid_Ecal; // 62 + detector_map[bank_t::VP] = params::detectorid_VPA; // 63 + detector_map[bank_t::FTCluster] = params::detectorid_FTA; // 64 + detector_map[bank_t::VL] = params::detectorid_VPA; // 65 + detector_map[bank_t::UT] = params::detectorid_UTA; // 66 + detector_map[bank_t::UTFull] = params::detectorid_UTA; // 67 + detector_map[bank_t::UTError] = params::detectorid_UTA; // 68 + detector_map[bank_t::UTPedestal] = params::detectorid_UTA; // 69 + detector_map[bank_t::HC] = 26; // 70 + detector_map[bank_t::HltTrackReports] = 30; // 71 + detector_map[bank_t::HCError] = 26; // 72 + detector_map[bank_t::VPRetinaCluster] = params::detectorid_VPA; // 73 + detector_map[bank_t::FTGeneric] = params::detectorid_FTA; // 74 + detector_map[bank_t::FTCalibration] = params::detectorid_FTA; // 75 + detector_map[bank_t::FTNZS] = params::detectorid_FTA; // 76 + detector_map[bank_t::Calo] = params::detectorid_Ecal; // 77 + detector_map[bank_t::CaloError] = params::detectorid_Ecal; // 78 + detector_map[bank_t::MuonSpecial] = params::detectorid_MuonA; // 79 + detector_map[bank_t::RichCommissioning] = params::detectorid_Rich1; // 80 + detector_map[bank_t::RichError] = params::detectorid_Rich1; // 81 + detector_map[bank_t::FTSpecial] = params::detectorid_FTA; // 82 + detector_map[bank_t::CaloSpecial] = params::detectorid_Ecal; // 83 + detector_map[bank_t::Plume] = params::detectorid_Plume; // 84 + detector_map[bank_t::PlumeSpecial] = params::detectorid_Plume; // 85 + detector_map[bank_t::PlumeError] = params::detectorid_Plume; // 86 + detector_map[bank_t::VeloThresholdScan] = params::detectorid_VPA; // 87 Hardware only ? + detector_map[bank_t::FTError] = params::detectorid_FTA; // 88 + detector_map[bank_t::LastType] = 0; // LOOP Marker; add new bank types ONLY before! } return detector_map; } @@ -263,11 +263,11 @@ void encoder_t::append(std::size_t eid, const void* buff, std::size_t len) { const unsigned char* start = (const unsigned char*)buff; const unsigned char* end = start + len; while( start < end ) { - const RawBank40* b = (const RawBank40*)start; + const bank_t* b = (const bank_t*)start; std::size_t blen = b->totalSize(); // HACK::: Manually fix ODIN abnk version to 7! - if ( b->type() == RawBank40::ODIN ) { - const_cast<RawBank40*>(b)->setVersion(7); + if ( b->type() == bank_t::ODIN ) { + const_cast<bank_t*>(b)->setVersion(7); } bool skip = false; for(uint8_t bt : skip_banks) { @@ -279,7 +279,7 @@ void encoder_t::append(std::size_t eid, const void* buff, std::size_t len) { if ( skip ) { // Skip! } - else if ( b->type() == RawBank40::DAQ ) { + else if ( b->type() == bank_t::DAQ ) { // Skip! } else { diff --git a/Online/Tell1Data/include/Tell1Data/Tell1Bank.h b/Online/Tell1Data/include/Tell1Data/Tell1Bank.h index 981a757b9..4422cee20 100755 --- a/Online/Tell1Data/include/Tell1Data/Tell1Bank.h +++ b/Online/Tell1Data/include/Tell1Data/Tell1Bank.h @@ -147,19 +147,15 @@ namespace Online { PlumeError, // 86 VeloThresholdScan, // 87 Hardware only ? FTError, // 88 + // Banks above are reserved for DAQ, add only generic DaqError types below. + DaqErrorFragmentThrottled, // 89 + DaqErrorBXIDCorrupted, // 90 + DaqErrorSyncBXIDCurrupted, // 91 + DaqErrorFragmentMissing, // 92 + DaqErrorFragmentTruncated, // 93 // Add new types here. Don't forget to update also RawBank.cpp LastType, // LOOP Marker; add new bank types ONLY before! - - DaqErrorBase = 192, // Lowest DaqError type available in Run 3 (EDMS2100937) - // Banks above are reserved for DAQ, add only generic DaqError types below. - DaqErrorFragmentThrottled = 250, - DaqErrorBXIDCorrupted = 251, - DaqErrorBXIDJump = 252, - DaqErrorFragmentMissing = 253, - DaqErrorFragmentTruncated = 254, - DaqErrorInvalid = 255 - // 255 is the highest type allowed by the Run 3 raw-data format (8-bit unsigned) }; /// Magic pattern for Raw bank headers diff --git a/Online/Tell1Data/src/Tell1Decoder.cpp b/Online/Tell1Data/src/Tell1Decoder.cpp index 4f7342efe..65ea85af7 100644 --- a/Online/Tell1Data/src/Tell1Decoder.cpp +++ b/Online/Tell1Data/src/Tell1Decoder.cpp @@ -244,7 +244,7 @@ bool Online::checkRawBank(const Tell1Bank* b, bool throw_exc, bool print_cout) // Check bank's magic word: Either Tell1 magic word or PCIE40 magic word if ( b->magic() == Tell1Bank::MagicPattern || b->magic() == 0xFACE ) { // Crude check on the bank type - if ( b->type() < Tell1Bank::LastType || b->type() >= Tell1Bank::DaqErrorBase ) { + if ( b->type() < Tell1Bank::LastType ) { // Crude check on the bank length if ( b->size() >= 0 ) // Zero bank length is apparently legal.... { @@ -778,18 +778,14 @@ std::string Online::Tell1Printout::bankType(int i) { PRINT(PlumeError); // 86 PRINT(VeloThresholdScan); // 87 PRINT(FTError); // 88 - /// DAQ errors: - PRINT(DaqErrorFragmentThrottled); // 250 - PRINT(DaqErrorBXIDCorrupted) // 251 - PRINT(DaqErrorBXIDJump) // 252 - PRINT(DaqErrorFragmentMissing) // 253 - PRINT(DaqErrorFragmentTruncated) // 254 - PRINT(DaqErrorInvalid) // 255 + PRINT(DaqErrorFragmentThrottled); // 89 + PRINT(DaqErrorBXIDCorrupted); // 90 + PRINT(DaqErrorSyncBXIDCurrupted); // 91 + PRINT(DaqErrorFragmentMissing); // 92 + PRINT(DaqErrorFragmentTruncated); // 93 default: - if ( i >= Tell1Bank::DaqErrorBase ) - return "DaqError"; return "UNKNOWN"; #undef PRINT } -- GitLab