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
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(),
32 fOpt.MaxNumTs(), fOpt.HttpServerPort(), fMonitor.get());
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.
Configuration of digi event building.