Commit 6da8158d authored by Pascal Raisig's avatar Pascal Raisig Committed by Pierre-Alain Loizeau
Browse files

Introduce a CbmSourceType flag

Since, the FairSource::Source_Type setting changes the behavior on the reading of the first Timeslice, its usage is for the time being removed. Therefore, a CbmSourceType enum is introduced which handles now the switch between data reading from online and offline sources.
parent d0469421
......@@ -118,7 +118,7 @@ void run_unpack_online(std::string publisher = "localhost", Int_t serverHttpPort
// ----- CbmSourceTsArchive -------------------------------------------
auto source = new CbmSourceTsArchive(publisher.data());
source->SetSourceType(Source_Type::kONLINE);
source->SetCbmSourceType(CbmSourceTsArchive::eCbmSourceType::kOnline);
auto unpack = source->GetRecoUnpack();
unpack->SetUnpackConfig(trdconfig);
// ------------------------------------------------------------------------
......
......@@ -177,6 +177,7 @@ void run_unpack_tsa(std::string infile = "test.tsa", UInt_t runid = 0, const cha
// ----- CbmSourceTsArchive -------------------------------------------
auto source = new CbmSourceTsArchive(infile.data());
source->SetCbmSourceType(CbmSourceTsArchive::eCbmSourceType::kOffline);
auto unpack = source->GetRecoUnpack();
if (psdconfig) unpack->SetUnpackConfig(psdconfig);
if (richconfig) unpack->SetUnpackConfig(richconfig);
......
......@@ -47,8 +47,10 @@ void CbmSourceTsArchive::Close()
Bool_t CbmSourceTsArchive::Init()
{
switch (fSourceType) {
case Source_Type::kONLINE: {
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;
......@@ -70,7 +72,9 @@ Bool_t CbmSourceTsArchive::Init()
}
break;
}
case Source_Type::kFILE: {
// Se above
// case Source_Type::kFILE: {
case eCbmSourceType::kOffline: {
// Return error for empty file list and an offline run
if (fFileNames.empty()) return kFALSE;
......
......@@ -29,6 +29,16 @@
class CbmSourceTsArchive : public FairSource {
public:
/**
* @brief Enum for switch of source type
* @remark This is a temporary fix as long as in the original FairSource::Source_Type kFILE leads to skipping the first Timeslice
*/
enum class eCbmSourceType : uint16_t
{
kOnline = 0, // Use when running with an online source (published data)
kOffline // Use when running with tsa files as source
};
/** @brief Constructor
** @param fileName Name of (single) input file.
**
......@@ -60,10 +70,15 @@ public:
/** @brief Source type
** @return kFILE
** @return FairSource::Source_Type
**/
virtual Source_Type GetSourceType() { return fSourceType; }
/** @brief Get the Cbm Source type
** @return eCbmSourceType
**/
eCbmSourceType GetCbmSourceType() { return fCbmSourceType; }
/**
* @brief Get the Reco Unpack
* Access the CbmRecoUnpack class to add unpacker configs
......@@ -100,6 +115,9 @@ public:
/** @brief Set the Source Type @param type */
void SetSourceType(Source_Type type) { fSourceType = type; }
/** @brief Set the Cbm Source Type @param type @remark temporary fix see enum */
void SetCbmSourceType(eCbmSourceType type) { fCbmSourceType = type; }
private:
/** List of input file names **/
std::vector<std::string> fFileNames = {};
......@@ -107,8 +125,11 @@ private:
/** @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 */
Source_Type fSourceType = Source_Type::kFILE;
/** @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;
/** @brief type of source that is currently used in the CBM definition @remark temprorary fix for the issue described in the comments of the enum */
eCbmSourceType fCbmSourceType = eCbmSourceType::kOffline;
/** Time-slice source interface **/
fles::TimesliceSource* fTsSource = nullptr; //!
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment