CbmRoot
Loading...
Searching...
No Matches
services/tsa_dump/Application.cxx
Go to the documentation of this file.
1/* Copyright (C) 2024 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Pierre-Alain Loizeau [committer] */
4
5#include "Application.h"
6
9
10#include <StorableTimeslice.hpp>
11#include <TimesliceAutoSource.hpp>
12
13#include <Logger.h>
14
15#include <iomanip>
16#include <ios>
17#include <iostream>
18#include <sstream>
19
21{
22 LOG(info) << "Calling string constructor with ";
23 LOG(info) << fOpts.sFullFilename;
24 fles::TimesliceAutoSource* fTsSource = new fles::TimesliceAutoSource(fOpts.sFullFilename);
25
26 LOG(info) << "Selected SysID: " << std::hex << fOpts.selSysId << std::dec;
27
28 LOG(info) << FormatMsHeaderHelp();
29
30 std::unique_ptr<fles::Timeslice> ts;
31 ts = fTsSource->get();
32 uint64_t uTsNb = 0;
33 while (ts) {
34 // Use << operator defined in <cbmroot_src>core/base/utils/flestools/CbmFormatTsPrintout.h
35 std::stringstream ss;
36 ss << FormatTsPrintout(*(ts.get()), fOpts.selSysId, fOpts.nbMsPerComp);
37 LOG(info) << "=====================================\n" << ss.str();
38 uTsNb++;
39 if (fOpts.uNbTimeslices == uTsNb) {
40 break;
41 }
42 ts = fTsSource->get();
43 }
44 if (fOpts.uNbTimeslices == uTsNb) {
45 LOG(info) << "Requested number of TS reached; stopping there. Dumped " << uTsNb << " TS";
46 }
47 else {
48 LOG(info) << "End of archive reached; stopping there. Dumped " << uTsNb << " TS";
49 }
50}
std::string FormatMsHeaderHelp()
std::string FormatTsPrintout(const fles::Timeslice &ts, std::underlying_type_t< fles::Subsystem > selSysId, size_t nbMsPerComp)
void Run()
Run the application.