Commit e1f65758 authored by Pascal Raisig's avatar Pascal Raisig Committed by Pierre-Alain Loizeau
Browse files

Use event header in a more FairRootish way

Remove by hand added CbmTsEventHeader from CbmRecoUnpack. Instead, use the getter from the FairRun::Instance() to access the event header. Remark a fatal will be created if the wrong event header is set in the steering macro
parent a77bbe77
......@@ -190,6 +190,9 @@ void run_unpack_tsa(std::string infile = "test.tsa", UInt_t runid = 0, const cha
auto run = new FairRunOnline(source);
auto sink = new FairRootFileSink(;
auto eventheader = new CbmTsEventHeader();
// ------------------------------------------------------------------------
......@@ -54,10 +54,13 @@ Bool_t CbmRecoUnpack::Init()
FairRootManager* ioman = FairRootManager::Instance();
// --- Register the branch for the Timeslice start time
fCbmTsEventHeader = new CbmTsEventHeader();
ioman->RegisterAny("TsEventHeader", fCbmTsEventHeader, kTRUE);
LOG(info) << "CbmRecoUnpack::Init() registered CbmTsEventHeader to output tree!\n";
auto eh = FairRun::Instance()->GetEventHeader();
if (eh->IsA() == CbmTsEventHeader::Class()) fCbmTsEventHeader = static_cast<CbmTsEventHeader*>(eh);
<< "CbmRecoUnpack::Init() no CbmTsEventHeader was added to the run. Without it, we can not store the UTC of the "
"Timeslices correctly. Hence, this causes a fatal. Please add it in the steering macro to the Run.";
// --- Psd
......@@ -39,9 +39,7 @@ class CbmRecoUnpack : public TObject {
/** @brief Constructor
** @param fileName Name of (single) input file.
** More input files can be added by the method AddInputFile.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment