FairRoot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FairMQSamplerTask.cxx
Go to the documentation of this file.
1 /********************************************************************************
2  * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
3  * *
4  * This software is distributed under the terms of the *
5  * GNU Lesser General Public Licence (LGPL) version 3, *
6  * copied verbatim in the file "LICENSE" *
7  ********************************************************************************/
15 #include "FairMQSamplerTask.h"
16 
17 using namespace std;
18 
20  : FairTask("Abstract base task used for loading a branch from a root file into memory")
21  , fBranch()
22  , fInput(nullptr)
23  , fPayload()
24  , fEventIndex(0)
25  , fEvtHeader(nullptr)
26  , fTransportFactory(nullptr)
27 {}
28 
29 FairMQSamplerTask::FairMQSamplerTask(const Text_t* name, int iVerbose)
30  : FairTask(name, iVerbose)
31  , fBranch()
32  , fInput(nullptr)
33  , fPayload()
34  , fEventIndex(0)
35  , fEvtHeader(nullptr)
36  , fTransportFactory(nullptr)
37 {}
38 
40 
42 {
44  fEvtHeader = static_cast<FairEventHeader*>(ioman->GetObject("EventHeader."));
45  fInput = static_cast<TClonesArray*>(ioman->GetObject(fBranch.c_str()));
46 
47  return kSUCCESS;
48 }
49 
50 void FairMQSamplerTask::Exec(Option_t* /*opt*/) {}
51 
52 void FairMQSamplerTask::SetBranch(const string& branch) { fBranch = branch; }
53 
54 void FairMQSamplerTask::SetEventIndex(Long64_t eventIndex) { fEventIndex = eventIndex; }
55 
56 void FairMQSamplerTask::GetPayload(FairMQMessagePtr& msg) { msg = move(fPayload); }
57 
58 void FairMQSamplerTask::SetTransport(shared_ptr<FairMQTransportFactory> factory) { fTransportFactory = factory; }
virtual void Exec(Option_t *opt)
FairEventHeader * fEvtHeader
TClonesArray * fInput
InitStatus
Definition: FairTask.h:33
std::shared_ptr< FairMQTransportFactory > fTransportFactory
static FairRootManager * Instance()
TObject * GetObject(const char *BrName)
FairMQMessagePtr fPayload
void SetEventIndex(Long64_t eventIndex)
void SetTransport(std::shared_ptr< FairMQTransportFactory > factory)
void GetPayload(std::unique_ptr< FairMQMessage > &msg)
void SetBranch(const std::string &branch)
virtual InitStatus Init()