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);
82 fTrd2dUnpack = std::make_unique<trd2d::Unpack>(trd2dCfg);
85 fMuchUnpack = std::make_unique<much::Unpack>(muchCfg);
88 fRichUnpack = std::make_unique<rich::Unpack>(richCfg);
175 logOut << setw(15) << left << GetName() <<
" [";
176 logOut << fixed << setw(8) << setprecision(1) << right << timer.RealTime() * 1000. <<
" ms] ";
177 logOut <<
"TS " <<
fNumTs <<
" (index " << timeslice->index() <<
")";
178 logOut <<
", components " << monitor.
numCompUsed <<
" / " << timeslice->num_components();
179 logOut <<
", microslices " << monitor.
numMs;
180 logOut <<
", input rate " << double(monitor.
numBytes) / timer.RealTime() / 1.e6 <<
" MB/s";
181 logOut <<
", digis " << monitor.
numDigis;
182 LOG(info) << logOut.str();
184#if !defined(__CLING__) && !defined(__ROOTCLING__)
187 {{
"realtime", timer.RealTime()},
188 {
"cputime", timer.CpuTime()},
190 {
"input_rate", double(monitor.
numBytes) / timer.RealTime()},
200 fTime += timer.RealTime();
210 LOG(info) <<
"=====================================";
211 LOG(info) << GetName() <<
": Run summary";
212 LOG(info) <<
"Timeslices : " <<
fNumTs;
213 LOG(info) <<
"Microslices : " <<
fNumMs;
215 LOG(info) <<
"Av. input rate : " << fixed << setprecision(2) << rate <<
" MB/s";
216 LOG(info) <<
"Time / TS : " << fixed << setprecision(2) << timePerTs <<
" ms";
217 LOG(info) <<
"=====================================";
223template<
typename TVecobj>
226 if (ioman->GetObject(TVecobj::GetBranchName())) {
227 LOG(fatal) << GetName() <<
": Branch " << TVecobj::GetBranchName() <<
" already exists!";
231 ioman->RegisterAny(TVecobj::GetBranchName(), vec, kTRUE);
232 LOG(info) << GetName() <<
": Registered branch " << TVecobj::GetBranchName() <<
" at " << vec;
239 LOG(info) <<
"==================================================";
240 LOG(info) << GetName() <<
": Initialising...";
243 fHostname = fles::system::current_hostname();
248 LOG(error) << GetName() <<
": No valid source class registered!";
251 LOG(info) <<
"--- Found CbmSourceTs instance";
254 FairRootManager* ioman = FairRootManager::Instance();
258 if (ioman->GetObject(
"DigiTimeslice")) {
259 LOG(fatal) << GetName() <<
": Branch DigiTimeslice already exists!";
266 LOG(fatal) <<
"CbmSourceDigiTimeslice::Init() no CbmTsEventHeader was added to the run. "
267 "Without it, we can not store the UTC of the Timeslices correctly. "
268 "Hence, this causes a fatal. Please add it to the Run in the steering macro.";
273 if (ioman->GetObject(
"TimeSlice.")) {
274 LOG(fatal) <<
"Source: Branch TimeSlice. already exists!";
280 ioman->Register(
"TimeSlice.",
"DAQ",
fTimeslice, kTRUE);
289 fStsDigis =
new std::vector<CbmStsDigi>();
301 fTrdDigis =
new std::vector<CbmTrdDigi>();
307 fTofDigis =
new std::vector<CbmTofDigi>();
320 ioman->RegisterAny(
"DigiTimeslice.",
fDigiTimeslice, IsOutputBranchPersistent(
"DigiTimeslice."));
321 LOG(info) <<
"--- Registered branch DigiTimeslice.";
329template<
class Unpacker>
333 auto [digis, detmon, detaux] = (*unpacker)(timeslice);
334 monitor.numCompUsed += detmon.numComponents;
335 monitor.numMs += detmon.numMs;
336 monitor.numBytes += detmon.sizeBytesIn;
337 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.