Skip to content
Snippets Groups Projects
Commit bd4d3d7c authored by Jan de Cuveland's avatar Jan de Cuveland Committed by Florian Uhlig
Browse files

Migrate from TimesliceMulti* classes to TimesliceAutoSource

parent 09194853
No related branches found
No related tags found
No related merge requests found
......@@ -7,8 +7,7 @@
#include "CbmSourceTsArchive.h"
#include <TimesliceMultiInputArchive.hpp>
#include <TimesliceMultiSubscriber.hpp>
#include <TimesliceAutoSource.hpp>
#include <FairSource.h>
#include <Logger.h>
......@@ -46,56 +45,8 @@ void CbmSourceTsArchive::Close()
// ----- Initialisation ---------------------------------------------------
Bool_t CbmSourceTsArchive::Init()
{
fTsSource = new fles::TimesliceAutoSource(fFileNames);
switch (fCbmSourceType) {
// Use again when kFILE does not skipp the first TS by default anymore
// case Source_Type::kONLINE: {
case eCbmSourceType::kOnline: {
// Create a ";" separated string with all host/port combinations
// Build a semicolon-separated list of file names for TimesliceMultiInputArchive
string fileList;
for (const auto& fileName : fFileNames) {
fileList += fileName;
fileList += ";";
}
fileList.pop_back(); // Remove last semicolon after last file name
fTsSource = new fles::TimesliceMultiSubscriber(fileList, fHighWaterMark);
/// Initialize the Multisubscriber
/// (This restores the original behavior after modifications needed to make the MQ version
dynamic_cast<fles::TimesliceMultiSubscriber*>(fTsSource)->InitTimesliceSubscriber();
if (!fTsSource) {
LOG(fatal) << "Could not connect to the TS publisher.";
return kFALSE;
}
break;
}
// Se above
// case Source_Type::kFILE: {
case eCbmSourceType::kOffline: {
// Return error for empty file list and an offline run
if (fFileNames.empty()) return kFALSE;
// Build a semicolon-separated list of file names for TimesliceMultiInputArchive
string fileList;
for (const auto& fileName : fFileNames) {
fileList += fileName;
fileList += ";";
}
fileList.pop_back(); // Remove last semicolon after last file name
// Create the proper TS source
fTsSource = new fles::TimesliceMultiInputArchive(fileList);
if (!fTsSource) {
LOG(error) << "SourceTsArchive: Failed to create TSMultiInputArchive!";
return kFALSE;
}
break;
}
}
// Initialise unpacker
fUnpack.Init();
LOG(info) << "Source: Init done";
......
......@@ -24,7 +24,7 @@
** @since 2 June 2021
**
** This class allows to read time-slice data from file(s) and hands them to
** the unpacking stage. It interfaces fles::TimesliceMultiInputArchive to cbmroot.
** the unpacking stage. It interfaces fles::TimesliceAutoSource to cbmroot.
**/
class CbmSourceTsArchive : public FairSource {
......@@ -106,9 +106,6 @@ public:
/** @brief Reset clear the output vectors as preparation for the next timeslice. Forwarded to CbmRecoUnpack **/
virtual void Reset() { fUnpack.Reset(); }
/** @brief Set the high water mark (limit of buffered timeslice by the publisher) */
void SetHighWaterMark(std::uint32_t value) { fHighWaterMark = value; }
/** @brief Set unpacker parameters (forced by base class) **/
virtual void SetParUnpackers() {}
......@@ -125,9 +122,6 @@ private:
/** List of input file names **/
std::vector<std::string> fFileNames = {};
/** @brief Amount of Timeslices buffered before the publisher starts dropping new ones, if the old are not digested yet.*/
std::uint32_t fHighWaterMark = 1;
/** @brief type of source that is currently used @remark currently we use kONLINE as default, since, kFILE skipps the first TS probably due to obsolete reasons (to be checked PR072021) */
Source_Type fSourceType = Source_Type::kONLINE;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment