CbmRoot
Loading...
Searching...
No Matches
reco/app/cbmreco_fairrun/Application.cxx
Go to the documentation of this file.
1/* Copyright (C) 2022 Johann Wolfgang Goethe-Universitaet Frankfurt, Frankfurt am Main
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Jan de Cuveland [committer] */
4
5#include "Application.h"
6
7#include "MainConfig.h"
8
9#include <chrono>
10#include <fstream>
11#include <thread>
12
13#include <yaml-cpp/yaml.h>
14
16{
17 // start up monitoring
18 if (!fOpt.MonitorUri().empty()) {
19 fMonitor = std::make_unique<cbm::Monitor>(fOpt.MonitorUri());
20 }
21
22 cbm::algo::evbuild::Config config(YAML::LoadFile(fOpt.ConfigYamlFile()));
23 if (!fOpt.SaveConfigYamlFile().empty()) {
24 std::ofstream fout(fOpt.SaveConfigYamlFile());
25 fout << config.ToYaml();
26 }
27
28 CbmReco::Config recoConfig;
29 recoConfig.dumpSetup = fOpt.DumpSetup();
30
31 fCbmReco = std::make_unique<CbmReco>(recoConfig, fOpt.InputUri(), fOpt.OutputRootFile(), fOpt.ConfigYamlFile(),
33}
34
35void Application::Run() { fCbmReco->Run(); }
36
38{
39 // delay to allow monitor to process pending messages
40 constexpr auto destruct_delay = std::chrono::milliseconds(200);
41 std::this_thread::sleep_for(destruct_delay);
42}
Application(ProgramOptions const &opt)
Standard constructor, initialize the application.
void Run()
Run the application.
std::unique_ptr< cbm::Monitor > fMonitor
The application's monitoring object.
std::unique_ptr< CbmReco > fCbmReco
CBM reconstruction steering class instance.
ProgramOptions const & fOpt
Program options object.
Program options class for the "cbmreco_fairrun" application.
const std::string & OutputRootFile() const
Get output file name (.root format)
bool DumpSetup() const
Get flag to dump the readout setup to yaml.
const std::vector< std::string > & InputUri() const
Get URI specifying input timeslice stream source(s)
int32_t MaxNumTs() const
Get maximum number of timeslices to process.
const std::string & MonitorUri() const
Get URI specifying the monitoring server interface.
uint16_t HttpServerPort() const
Get the port number for the HTTP server.
const std::string & ConfigYamlFile() const
Get configuration file name (.yaml format)
const std::string & SaveConfigYamlFile() const
Get save configuration file name (.yaml format)
Configuration of digi event building.