diff --git a/macro/run/run_unpack_tsa.C b/macro/run/run_unpack_tsa.C index c6035e9da4cee5428bacc2c2d1757dd5e44c3a62..55f3bbf029c031b378a7637c9727dfab9fb9cda0 100644 --- a/macro/run/run_unpack_tsa.C +++ b/macro/run/run_unpack_tsa.C @@ -32,8 +32,8 @@ std::shared_ptr<CbmTrdUnpackMonitor> GetTrdMonitor(std::string treefilename); std::shared_ptr<CbmTrdSpadic> GetTrdSpadic(bool useAvgBaseline = false); std::shared_ptr<CbmStsUnpackMonitor> GetStsMonitor(std::string treefilename); -void run_unpack_tsa(std::string infile = "test.tsa", UInt_t runid = 0, const char* setupName = "mcbm_beam_2021_03", - std::int32_t nevents = -1, std::string outpath = "") +void run_unpack_tsa(std::vector<std::string> infile = {"test.tsa"}, UInt_t runid = 0, + const char* setupName = "mcbm_beam_2021_03", std::int32_t nevents = -1, std::string outpath = "") { // ======================================================================== @@ -58,13 +58,13 @@ void run_unpack_tsa(std::string infile = "test.tsa", UInt_t runid = 0, const cha // ----- Output filename ---------------------------------------------- - std::string outfilename = infile; - auto filenamepos = infile.find_last_of("/"); + std::string outfilename = infile[0]; + auto filenamepos = infile[0].find_last_of("/"); filenamepos++; - std::string filename = infile.substr(filenamepos); - if (filename.find("*") != infile.npos) filename = std::to_string(runid) + ".tsa"; - if (filename.find(";") != infile.npos) filename = std::to_string(runid) + "_merged" + ".tsa"; - if (outpath.empty()) { outpath = infile.substr(0, filenamepos); } + std::string filename = infile[0].substr(filenamepos); + if (filename.find("*") != infile[0].npos) filename = std::to_string(runid) + ".tsa"; + if (filename.find(";") != infile[0].npos) filename = std::to_string(runid) + "_merged" + ".tsa"; + if (outpath.empty()) { outpath = infile[0].substr(0, filenamepos); } outfilename = outpath + filename; outfilename.replace(outfilename.find(".tsa"), 4, ".digi.root"); std::cout << "-I- " << myName << ": Output file will be " << outfilename << std::endl; @@ -198,7 +198,7 @@ void run_unpack_tsa(std::string infile = "test.tsa", UInt_t runid = 0, const cha // ----- CbmSourceTsArchive ------------------------------------------- - auto source = new CbmSourceTsArchive(infile.data()); + auto source = new CbmSourceTsArchive(infile); auto unpack = source->GetRecoUnpack(); unpack->SetDoPerfProfiling(doPerfProfiling); unpack->SetOutputFilename(perfProfFileName); @@ -361,3 +361,10 @@ std::shared_ptr<CbmStsUnpackMonitor> GetStsMonitor(std::string treefilename) //monitor->SetDebugMode(true); return monitor; } + +void run_unpack_tsa(std::string infile = "test.tsa", UInt_t runid = 0, const char* setupName = "mcbm_beam_2021_03", + std::int32_t nevents = -1, std::string outpath = "") +{ + std::vector<std::string> vInFile = {infile}; + return run_unpack_tsa(vInFile, runid, setupName, nevents, outpath); +} diff --git a/reco/steer/CbmSourceTsArchive.cxx b/reco/steer/CbmSourceTsArchive.cxx index 0e657fbd895ad7f55f48ef3cbd1811ab01c84a9d..20de26d0cf78875c513d2e2f5d6a2e4f85d6efc7 100644 --- a/reco/steer/CbmSourceTsArchive.cxx +++ b/reco/steer/CbmSourceTsArchive.cxx @@ -1,9 +1,6 @@ -/** @file CbmSourceTsArchive.cxx - ** @copyright Copyright (C) 2021 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt - ** @license SPDX-License-Identifier: GPL-3.0-only - ** @author Volker Friese [originator] - **/ - +/* Copyright (C) 2021 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt + SPDX-License-Identifier: GPL-3.0-only + Authors: Jan de Cuveland, Volker Friese[committer], Pierre-Alain Loizeau */ #include "CbmSourceTsArchive.h" @@ -22,6 +19,10 @@ using std::unique_ptr; CbmSourceTsArchive::CbmSourceTsArchive(const char* fileName) { AddInputFile(fileName); } // ---------------------------------------------------------------------------- +// ----- Constructor ------------------------------------------------------ +CbmSourceTsArchive::CbmSourceTsArchive(std::vector<std::string> fileNames) : fFileNames(fileNames) {} +// ---------------------------------------------------------------------------- + // ----- Add an input file ------------------------------------------------ size_t CbmSourceTsArchive::AddInputFile(const char* fileName) @@ -45,7 +46,16 @@ void CbmSourceTsArchive::Close() // ----- Initialisation --------------------------------------------------- Bool_t CbmSourceTsArchive::Init() { - fTsSource = new fles::TimesliceAutoSource(fFileNames); + if (1 == fFileNames.size()) { + LOG(info) << "SourceTsArchive::Init() calling string constructor with "; + LOG(info) << fFileNames[0]; + fTsSource = new fles::TimesliceAutoSource(fFileNames[0]); + } + else { + LOG(info) << "SourceTsArchive::Init() calling vector constructor with size "; + LOG(info) << fFileNames.size(); + fTsSource = new fles::TimesliceAutoSource(fFileNames); + } // Initialise unpacker fUnpack.Init(); diff --git a/reco/steer/CbmSourceTsArchive.h b/reco/steer/CbmSourceTsArchive.h index d87dc668ec99111417271f6a0176949911a0f739..15e622e1d6d11486b1714d915d10d02e40a63d8e 100644 --- a/reco/steer/CbmSourceTsArchive.h +++ b/reco/steer/CbmSourceTsArchive.h @@ -1,9 +1,6 @@ -/** @file CbmSourceTsArchive.h - ** @copyright Copyright (C) 2021 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt - ** @license SPDX-License-Identifier: GPL-3.0-only - ** @author Volker Friese [originator] - **/ - +/* Copyright (C) 2021 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt + SPDX-License-Identifier: GPL-3.0-only + Authors: Jan de Cuveland, Volker Friese[committer], Pierre-Alain Loizeau */ #ifndef CBMSOURCETSARCHIVE_H #define CBMSOURCETSARCHIVE_H 1 @@ -36,6 +33,13 @@ public: */ CbmSourceTsArchive(const char* fileName = ""); + /** @brief Constructor + ** @param fileName Vector with name(s) of input file(s). + ** + ** More input files can be added by the method AddInputFile. + */ + CbmSourceTsArchive(std::vector<std::string> fileNames); + /** @brief Destructor **/ virtual ~CbmSourceTsArchive() {}; @@ -67,7 +71,7 @@ public: /** * @brief Get the Reco Unpack * Access the CbmRecoUnpack class to add unpacker configs - * @return CbmRecoUnpack* + * @return CbmRecoUnpack* */ CbmRecoUnpack* GetRecoUnpack() { return &fUnpack; }