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-2026 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
16#include <Rtypes.h>
17
19#include "R3BFileSource.h"
20#include "R3BLogger.h"
21
23 : R3BEventHeaderPropagator("R3BEventHeaderPropagator", 1, "EventHeader.")
24{
25}
26
27R3BEventHeaderPropagator::R3BEventHeaderPropagator(const TString& name, Int_t iVerbose, std::string_view nameheader)
28 : FairTask(name, iVerbose)
29 , fNameHeader(nameheader)
30{
31}
32
34{
35 R3BLOG(info, "");
36 FairRootManager* frm = FairRootManager::Instance();
37 fHeader = dynamic_cast<R3BEventHeader*>(frm->GetObject("EventHeader."));
38 R3BLOG_IF(fatal, !fHeader, "EventHeader. not found.");
39 R3BLOG_IF(info, fHeader, "EventHeader. found.");
40
41 frm->Register(fNameHeader.data(), "EventHeader", fHeader, kTRUE);
42
43 fSource = frm->GetSource();
44 R3BLOG_IF(fatal, !fSource, "R3BFileSource not found.");
45
46 return kSUCCESS;
47}
48
49void R3BEventHeaderPropagator::Exec(Option_t* /*option*/)
50{
51 if (fSource != nullptr)
52 {
53 fHeader->SetRunId(fSource->GetRunId());
54 }
55}
56
#define R3BLOG(severity, x)
Definition R3BLogger.h:33
#define R3BLOG_IF(severity, condition, x)
Definition R3BLogger.h:42
ClassImp(R3B::Neuland::Cal2HitPar)
InitStatus Init() override
Method for task initialization.
R3BEventHeaderPropagator()
Default constructor.
void Exec(Option_t *) override
Method for event loop implementation.