FairRoot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
runMBSSink.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  ********************************************************************************/
8 #include "BaseMQFileSink.h"
9 #include "FairMBSRawItem.h" // data type for the OutputPolicy
10 #include "IOPolicy.h" // fair::mq::policy::
11 #include "RootOutFileManager.h" // OutputPolicy
12 #include "RootSerializer.h" // RootSerializer
13 #include "runFairMQDevice.h"
14 
15 #include <TClonesArray.h> // data type for the InputPolicy
16 
17 // InputPolicy - initialize input and deserialize message into it
19  fair::mq::policy::InputPolicy<RootSerializer, // deserializer from msg to input
20  TClonesArray, // input data type
21  fair::mq::policy::PointerType, // input pointer type (automatically selected)
22  fair::mq::policy::OpNewCreator, // input allocation
23  fair::mq::policy::NullptrInitializer, // input initialization
25 
26 namespace bpo = boost::program_options;
27 
28 void addCustomOptions(bpo::options_description& options)
29 {
30  // clang-format off
31  options.add_options()
32  ("output-file-name", bpo::value<std::string>(), "Path to the input file")
33  ("output-file-tree", bpo::value<std::string>()->default_value("mbstree"), "Name of the output tree")
34  ("output-file-branch", bpo::value<std::string>()->default_value("FairMBSRawItem"), "Name of the output Branch")
35  ("hit-classname", bpo::value<std::string>()->default_value("FairMBSRawItem"), "Hit class name for initializing TClonesArray")
36  ("output-file-option", bpo::value<std::string>()->default_value("RECREATE"), "Root file option : UPDATE, RECREATE etc.")
37  ("use-clones-array", bpo::value<bool>()->default_value(true), "Use TClonesArray")
38  ("flow-mode", bpo::value<bool>()->default_value(true), "Flow mode")
39  ("in-chan-name", bpo::value<std::string>()->default_value("data"), "input channel name");
40  // clang-format on
41 }
42 
43 FairMQDevicePtr getDevice(const FairMQProgOptions& config)
44 {
47 
48  // call function member from deserialization policy
49  sink->InitInputData(config.GetValue<std::string>("hit-classname").c_str());
50 
51  return sink;
52 }
void addCustomOptions(bpo::options_description &options)
void InitInputData(Args &&...args)
FairMQDevicePtr getDevice(const FairMQProgOptions &config)