R3BROOT
R3B analysis software
Loading...
Searching...
No Matches
R3BEventHeaderPropagator.cxx
Go to the documentation of this file.
1/******************************************************************************
2 * Copyright (C) 2019 GSI Helmholtzzentrum für Schwerionenforschung GmbH *
3 * Copyright (C) 2019-2025 Members of R3B Collaboration *
4 * *
5 * This software is distributed under the terms of the *
6 * GNU General Public Licence (GPL) version 3, *
7 * copied verbatim in the file "LICENSE". *
8 * *
9 * In applying this license GSI does not waive the privileges and immunities *
10 * granted to it by virtue of its status as an Intergovernmental Organization *
11 * or submit itself to any jurisdiction. *
12 ******************************************************************************/
13
14#include <FairRootManager.h>
15
17#include "R3BFileSource.h"
18#include "R3BLogger.h"
19
21 : R3BEventHeaderPropagator("R3BEventHeaderPropagator", 1, "EventHeader.")
22{
23}
24
25R3BEventHeaderPropagator::R3BEventHeaderPropagator(const TString& name, Int_t iVerbose, std::string_view nameheader)
26 : FairTask(name, iVerbose)
27 , fNameHeader(nameheader)
28{
29}
30
32{
33 R3BLOG(info, "");
34 FairRootManager* frm = FairRootManager::Instance();
35 fHeader = dynamic_cast<R3BEventHeader*>(frm->GetObject("EventHeader."));
36 R3BLOG_IF(fatal, !fHeader, "EventHeader. not found.");
37 R3BLOG_IF(info, fHeader, "EventHeader. found.");
38
39 frm->Register(fNameHeader.data(), "EventHeader", fHeader, kTRUE);
40
41 fSource = frm->GetSource();
42 R3BLOG_IF(fatal, !fSource, "R3BFileSource not found.");
43
44 return kSUCCESS;
45}
46
47void R3BEventHeaderPropagator::Exec(Option_t* /*option*/)
48{
49 if (fSource != nullptr)
50 {
51 fHeader->SetRunId(fSource->GetRunId());
52 }
53}
54
ClassImp(R3BEventHeaderPropagator)
#define R3BLOG(severity, x)
Definition R3BLogger.h:35
#define R3BLOG_IF(severity, condition, x)
Definition R3BLogger.h:46
InitStatus Init() override
Method for task initialization.
R3BEventHeaderPropagator()
Default constructor.
void Exec(Option_t *) override
Method for event loop implementation.