Skip to content
Snippets Groups Projects
Commit d9b8b7c4 authored by Felix Weiglhofer's avatar Felix Weiglhofer Committed by Dominik Smith
Browse files

algo::Unpack: Generalize ParallelMsLoop function.

parent 4f3999d3
No related branches found
No related tags found
1 merge request!1219algo: Unpack TOF and STS in parallel.
...@@ -30,7 +30,7 @@ namespace cbm::algo ...@@ -30,7 +30,7 @@ namespace cbm::algo
if (DetectorEnabled(fles::SubsystemIdentifier::STS)) { if (DetectorEnabled(fles::SubsystemIdentifier::STS)) {
xpu::scoped_timer t1("STS"); xpu::scoped_timer t1("STS");
ParallelMsLoop(digiTs.fData.fSts.fDigis, monitor.fSts, *timeslice, 0x20); ParallelMsLoop(fParallelStsSetup, digiTs.fData.fSts.fDigis, monitor.fSts, *timeslice, fAlgoSts, 0x20);
} }
// --- Component loop // --- Component loop
...@@ -342,14 +342,16 @@ namespace cbm::algo ...@@ -342,14 +342,16 @@ namespace cbm::algo
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void Unpack::ParallelMsLoop(std::vector<CbmStsDigi>& digisOut, std::vector<UnpackStsMonitorData>& monitorOut, template<class Digi, class UnpackAlgo, class Monitor>
const fles::Timeslice& ts, u8 sys_ver) void Unpack::ParallelMsLoop(ParallelSetup<Digi, Monitor>& setup, std::vector<Digi>& digisOut,
std::vector<Monitor>& monitorOut, const fles::Timeslice& ts,
const std::map<u16, UnpackAlgo>& algos, u8 sys_ver)
{ {
const auto& msContent = fParallelStsSetup.msContent; const auto& msContent = setup.msContent;
const auto& msDesc = fParallelStsSetup.msDescriptors; const auto& msDesc = setup.msDescriptors;
const auto& msEqIds = fParallelStsSetup.msEquipmentIds; const auto& msEqIds = setup.msEquipmentIds;
auto& monitor = fParallelStsSetup.msMonitorData; auto& monitor = setup.msMonitorData;
auto& msDigis = fParallelStsSetup.msDigis; auto& msDigis = setup.msDigis;
size_t numMs = msDigis.size(); size_t numMs = msDigis.size();
xpu::push_timer("Unpack"); xpu::push_timer("Unpack");
......
...@@ -131,12 +131,13 @@ namespace cbm::algo ...@@ -131,12 +131,13 @@ namespace cbm::algo
} }
private: // types private: // types
template<class Digi, class Monitor>
struct ParallelSetup { struct ParallelSetup {
std::vector<u16> msEquipmentIds; std::vector<u16> msEquipmentIds;
std::vector<fles::MicrosliceDescriptor> msDescriptors; std::vector<fles::MicrosliceDescriptor> msDescriptors;
std::vector<const u8*> msContent; std::vector<const u8*> msContent;
std::vector<std::vector<sts::Digi>> msDigis; std::vector<std::vector<Digi>> msDigis;
std::vector<UnpackStsMonitorData> msMonitorData; std::vector<Monitor> msMonitorData;
}; };
private: // methods private: // methods
...@@ -150,8 +151,9 @@ namespace cbm::algo ...@@ -150,8 +151,9 @@ namespace cbm::algo
void ParallelInit(const fles::Timeslice& timeslice); void ParallelInit(const fles::Timeslice& timeslice);
/** @brief Parallel microslice loop **/ /** @brief Parallel microslice loop **/
void ParallelMsLoop(std::vector<CbmStsDigi>& digisOut, std::vector<UnpackStsMonitorData>& monitor, template<class Digi, class UnpackAlgo, class Monitor>
const fles::Timeslice& ts, u8 sys_ver); void ParallelMsLoop(ParallelSetup<Digi, Monitor>& setup, std::vector<Digi>& digisOut, std::vector<Monitor>& monitor,
const fles::Timeslice& ts, const std::map<u16, UnpackAlgo>& algos, u8 sys_ver);
private: // members private: // members
...@@ -186,7 +188,7 @@ namespace cbm::algo ...@@ -186,7 +188,7 @@ namespace cbm::algo
{fles::SubsystemIdentifier::T0, 0}, {fles::SubsystemIdentifier::TRD, 1300}, {fles::SubsystemIdentifier::T0, 0}, {fles::SubsystemIdentifier::TRD, 1300},
{fles::SubsystemIdentifier::TRD2D, -510}}; {fles::SubsystemIdentifier::TRD2D, -510}};
/** @brief Parallel STS Setup */ /** @brief Parallel STS Setup */
ParallelSetup fParallelStsSetup = {}; ParallelSetup<sts::Digi, UnpackStsMonitorData> fParallelStsSetup = {};
}; };
} // namespace cbm::algo } // namespace cbm::algo
......
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