22#include "MicrosliceDescriptor.hpp"
30#include <FairParAsciiFileIo.h>
31#include <FairParamList.h>
32#include <FairRunOnline.h>
35#include <TStopwatch.h>
52 L_(fatal) <<
"Instantiated CbmTaskUnpack() without arguments (needs path to parameters and run ID).";
59 L_(info) <<
"Using parameter files for setup " << parFiles.
setup;
65 sts::Unpack::Config stsCfg{.readout = readout, .walkMap = walkMap, .bCollectAuxData =
false};
66 fStsUnpack = std::make_unique<sts::Unpack>(stsCfg);
70 fTofUnpack = std::make_unique<tof::Unpack>(tofCfg);
74 fBmonUnpack = std::make_unique<bmon::Unpack>(bmonCfg);
77 fTrdUnpack = std::make_unique<trd::Unpack>(trdCfg);
80 fTrd2dUnpack = std::make_unique<trd2d::Unpack>(trd2dCfg);
83 fMuchUnpack = std::make_unique<much::Unpack>(muchCfg);
86 fRichUnpack = std::make_unique<rich::Unpack>(richCfg);
173 logOut << setw(15) << left << GetName() <<
" [";
174 logOut << fixed << setw(8) << setprecision(1) << right << timer.RealTime() * 1000. <<
" ms] ";
175 logOut <<
"TS " <<
fNumTs <<
" (index " << timeslice->index() <<
")";
176 logOut <<
", components " << monitor.
numCompUsed <<
" / " << timeslice->num_components();
177 logOut <<
", microslices " << monitor.
numMs;
178 logOut <<
", input rate " << double(monitor.
numBytes) / timer.RealTime() / 1.e6 <<
" MB/s";
179 logOut <<
", digis " << monitor.
numDigis;
180 LOG(info) << logOut.str();
182#if !defined(__CLING__) && !defined(__ROOTCLING__)
185 {{
"realtime", timer.RealTime()},
186 {
"cputime", timer.CpuTime()},
188 {
"input_rate", double(monitor.
numBytes) / timer.RealTime()},
198 fTime += timer.RealTime();
208 LOG(info) <<
"=====================================";
209 LOG(info) << GetName() <<
": Run summary";
210 LOG(info) <<
"Timeslices : " <<
fNumTs;
211 LOG(info) <<
"Microslices : " <<
fNumMs;
213 LOG(info) <<
"Av. input rate : " << fixed << setprecision(2) << rate <<
" MB/s";
214 LOG(info) <<
"Time / TS : " << fixed << setprecision(2) << timePerTs <<
" ms";
215 LOG(info) <<
"=====================================";
221template<
typename TVecobj>
224 if (ioman->GetObject(TVecobj::GetBranchName())) {
225 LOG(fatal) << GetName() <<
": Branch " << TVecobj::GetBranchName() <<
" already exists!";
229 ioman->RegisterAny(TVecobj::GetBranchName(), vec, kTRUE);
230 LOG(info) << GetName() <<
": Registered branch " << TVecobj::GetBranchName() <<
" at " << vec;
237 LOG(info) <<
"==================================================";
238 LOG(info) << GetName() <<
": Initialising...";
241 fHostname = fles::system::current_hostname();
246 LOG(error) << GetName() <<
": No valid source class registered!";
249 LOG(info) <<
"--- Found CbmSourceTs instance";
252 FairRootManager* ioman = FairRootManager::Instance();
256 if (ioman->GetObject(
"DigiTimeslice")) {
257 LOG(fatal) << GetName() <<
": Branch DigiTimeslice already exists!";
264 LOG(fatal) <<
"CbmSourceDigiTimeslice::Init() no CbmTsEventHeader was added to the run. "
265 "Without it, we can not store the UTC of the Timeslices correctly. "
266 "Hence, this causes a fatal. Please add it to the Run in the steering macro.";
271 if (ioman->GetObject(
"TimeSlice.")) {
272 LOG(fatal) <<
"Source: Branch TimeSlice. already exists!";
278 ioman->Register(
"TimeSlice.",
"DAQ",
fTimeslice, kTRUE);
287 fStsDigis =
new std::vector<CbmStsDigi>();
299 fTrdDigis =
new std::vector<CbmTrdDigi>();
305 fTofDigis =
new std::vector<CbmTofDigi>();
318 ioman->RegisterAny(
"DigiTimeslice.",
fDigiTimeslice, IsOutputBranchPersistent(
"DigiTimeslice."));
319 LOG(info) <<
"--- Registered branch DigiTimeslice.";
327template<
class Unpacker>
331 auto [digis, detmon, detaux] = (*unpacker)(timeslice);
332 monitor.numCompUsed += detmon.numComponents;
333 monitor.numMs += detmon.numMs;
334 monitor.numBytes += detmon.sizeBytesIn;
335 monitor.numDigis += digis.size();
ClassImp(CbmConverterManager)
This file contains the definition of the ParFiles class.
Collection of digis from all detector systems within one timeslice.
CbmDigiData fData
Timeslice data.
void Clear()
Clear content.
Source class for reading from archived time slice data.
fles::Timeslice * GetTimeslice()
Pointer to current FLES timeslice.
Task class for associating digis to events.
Bool_t RegisterVector(FairRootManager *ioman, std::vector< TVecobj > *&vec)
virtual ~CbmTaskUnpack()
Destructor.
virtual void Exec(Option_t *opt)
Task execution.
CbmTaskUnpack()
Constructor.
bool fCbmrootFormatOutput
std::vector< CbmMuchDigi > * fMuchDigis
std::unique_ptr< cbm::algo::sts::Unpack > fStsUnpack
std::unique_ptr< cbm::algo::trd::Unpack > fTrdUnpack
std::unique_ptr< cbm::algo::trd2d::Unpack > fTrd2dUnpack
CbmTimeSlice * fTimeslice
=> Time-slice header (old version, class about to be deprecated? one should use only CbmTsEventHeader...
std::vector< CbmTofDigi > * fTofDigis
std::vector< CbmStsDigi > * fStsDigis
CbmTsEventHeader * fTsEventHeader
Time-slice event header.
std::vector< CbmBmonDigi > * fBmonDigis
=> Branch vectors of Digis
virtual InitStatus Init()
Task initialisation.
std::unique_ptr< cbm::algo::rich::Unpack > fRichUnpack
virtual void Finish()
Finish timeslice.
std::vector< CbmRichDigi > * fRichDigis
std::unique_ptr< cbm::algo::bmon::Unpack > fBmonUnpack
std::unique_ptr< cbm::algo::tof::Unpack > fTofUnpack
std::vector< CbmTrdDigi > * fTrdDigis
auto RunUnpacker(const std::unique_ptr< Unpacker > &unpacker, const fles::Timeslice &ts, Monitor &monitor) -> cbm::algo::algo_traits::Output_t< Unpacker >
std::enable_if< std::is_member_function_pointer< decltype(&TVecobj::GetTime)>::value, void >::type Timesort(std::vector< TVecobj > *vec=nullptr)
CbmDigiTimeslice * fDigiTimeslice
Output data if writing root files "as if rra".
std::unique_ptr< cbm::algo::much::Unpack > fMuchUnpack
Bookkeeping of time-slice content.
void SetStartTime(double time)
Set start time.
Provides the hardware-to-software address mapping for the CBM-RICH.
Provides the hardware-to-software address mapping for the CBM-STS.
typename std::tuple_element< 0, ResultOf_t< Algo > >::type Output_t
Type alias for the output type produced by an algorithm.
T ReadFromFile(fs::path path)
Collection of digis from all detector systems.
PODVector< CbmRichDigi > fRich
Unpacked RICH digis.
PODVector< CbmTrdDigi > fTrd
Unpacked TRD digis.
PODVector< CbmStsDigi > fSts
Unpacked STS digis.
PODVector< CbmTrdDigi > fTrd2d
Unpacked TRD2D digis.
PODVector< CbmTofDigi > fTof
Unpacked TOF digis.
CbmDigiData ToStorable() const
Convert to CbmDigiData for file storage.
PODVector< CbmMuchDigi > fMuch
Unpacked MUCH digis.
PODVector< CbmBmonDigi > fBmon
Unpacked Bmon digis.
Class to hold the paths to the parameter files for the different detectors.
struct cbm::algo::ParFiles::@2 tof
struct cbm::algo::ParFiles::@0 bmon
struct cbm::algo::ParFiles::@1 sts
struct cbm::algo::ParFiles::@3 trd
Readout setup / Hardware cabling for BMon Used to create the hardware mapping for the BMon unpacker.
Readout setup / Hardware cabling for STS Used to create the hardware mapping for the STS unpacker.
Readout setup / Hardware cabling for TOF Used to create the hardware mapping for the TOF unpacker.