16#include <FairFileSource.h>
17#include <FairRootFileSink.h>
18#include <FairRunAna.h>
19#include <FairRunOnline.h>
22#include <THttpServer.h>
23#include <TRootSniffer.h>
28#include <yaml-cpp/yaml.h>
30using std::make_unique;
35CbmReco::CbmReco(Config config,
string source,
string outFile,
string configFile, int32_t numTs, uint16_t port,
36 cbm::Monitor* monitor)
38 , fSourceNames{source}
39 , fOutputFileName(outFile)
40 , fConfigFileName(configFile)
42 , fHttpServerPort(port)
50CbmReco::CbmReco(Config config, std::vector<string> sources,
string outFile,
string configFile, int32_t numTs,
51 uint16_t port, cbm::Monitor* monitor)
53 , fSourceNames(sources)
54 , fOutputFileName(outFile)
55 , fConfigFileName(configFile)
57 , fHttpServerPort(port)
67 std::string result =
"{";
69 result += source +
", ";
98 auto source = make_unique<FairFileSource>(
fSourceNames.at(0));
99 LOG(info) <<
"Reco: Using ROOT input " <<
fSourceNames.at(0);
100 run.SetSource(source.release());
105 LOG(info) <<
"Reco: Using sources " <<
ListSources();
107 LOG(error) <<
"Reco: Could not open sources " <<
ListSources() <<
"; aborting.";
110 run.SetSource(source.release());
118 LOG(error) <<
"Reco: Could not open output " <<
fOutputFileName <<
"; aborting.";
121 run.SetSink(sink.release());
124 auto header = make_unique<CbmTsEventHeader>();
125 run.SetEventHeader(header.release());
133 auto unpack = make_unique<CbmTaskUnpack>();
135 unpack->SetOutputBranchPersistent(
"DigiTimeslice.",
false);
136 run.AddTask(unpack.release());
143 auto trigger = make_unique<CbmTaskTriggerDigi>();
146 trigger->SetOutputBranchPersistent(
"Trigger",
false);
147 run.AddTask(trigger.release());
153 auto evtBuild = make_unique<CbmTaskBuildEvents>();
154 evtBuild->SetConfig(evbuildConfig.
fBuilder);
155 evtBuild->SetOutputBranchPersistent(
"DigiEvent",
true);
156 evtBuild->SetDigiEventSelector(selectConfig);
157 run.AddTask(evtBuild.release());
160 auto evtQa = make_unique<CbmTaskDigiEventQa>();
161 evtQa->Config(evbuildConfig);
162 run.AddTask(evtQa.release());
167 run.GetHttpServer()->GetSniffer()->SetScanGlobalDir(kFALSE);
172 double timeSetup = timer.RealTime();
174 LOG(info) <<
"Reco: Initialising...";
177 double timeInit = timer.RealTime();
183 double timeRun = timer.RealTime();
188 auto src =
dynamic_cast<CbmSourceTs*
>(run.GetSource());
190 numTs = src->GetNumTs();
193 double timeTotal = timeSetup + timeInit + timeRun;
194 LOG(info) <<
"=====================================";
195 LOG(info) <<
"Reco: Run summary";
196 LOG(info) <<
"Timeslices : " << numTs;
197 LOG(info) <<
"Time setup : " << timeSetup <<
" s";
198 LOG(info) <<
"Time init : " << timeInit <<
" s";
199 LOG(info) <<
"Time run : " << timeRun <<
" s";
200 LOG(info) <<
"Time total : " << timeTotal <<
" s"
201 <<
" (" << timeTotal / numTs <<
" s/ts)";
203 LOG(info) <<
"=====================================";
ClassImp(CbmConverterManager)
Main steering class of reconstruction in CBM.
std::string ListSources() const
List all entries in the input vector.
int32_t Run()
Configure and execute run.
Config fConfig
Configuration.
std::string fOutputFileName
Output file (ROOT)
int32_t fNumTs
Number of timeslices to process.
CbmReco(Config config, std::string source, std::string outFile, std::string configFile, int32_t numTs=std::numeric_limits< int32_t >::max(), uint16_t port=0, cbm::Monitor *monitor=nullptr)
Default constructor.
std::vector< std::string > fSourceNames
Sources (input files or stream)
std::string fConfigFileName
Configuration file (YAML)
Source class for reading from archived time slice data.
Configuration of digi event building.
DigiTriggerConfig fDigiTrigger
Digi trigger configuration.
EventBuilderConfig fBuilder
Event builder configuration.
DigiEventSelectorConfig fSelector
Event selector configuration.
Configuration of the DigiEventSelector class.
ECbmModuleId Detector() const
Trigger detector.