Project
Loading...
Searching...
No Matches
PublisherSpec.h
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
16
20#include "Framework/Output.h"
22#include <vector>
23#include <string>
24#include <functional>
25
26namespace o2
27{
28namespace tpc
29{
30
33
52
55template <typename T = void>
56framework::DataProcessorSpec getPublisherSpec(PublisherConf const& config, bool propagateMC = true)
57{
62
63 // a creator callback for the actual reader instance
64 auto creator = [dto, mco, propagateMC](const char* treename, const char* filename, int nofEvents, Reader::PublishingMode publishingMode, o2::header::DataHeader::SubSpecificationType subSpec, const char* branchname, const char* mcbranchname, Reader::SpecialPublishHook* publishhook = nullptr) {
65 if (propagateMC) {
66 return std::make_shared<Reader>(treename,
68 nofEvents,
69 publishingMode,
70 Output{mco.origin, mco.description, subSpec},
71 mcbranchname,
72 Reader::BranchDefinition<T>{Output{dto.origin, dto.description, subSpec}, branchname},
73 publishhook);
74 } else {
75 return std::make_shared<Reader>(treename,
77 nofEvents,
78 publishingMode,
79 Reader::BranchDefinition<T>{Output{dto.origin, dto.description, subSpec}, branchname},
80 publishhook);
81 }
82 };
83
84 return createPublisherSpec(config, propagateMC, creator);
85}
86
87namespace workflow_reader
88{
90using Creator = std::function<std::shared_ptr<Reader>(const char*, const char*, int, Reader::PublishingMode, o2::header::DataHeader::SubSpecificationType, const char*, const char*, Reader::SpecialPublishHook*)>;
91} // namespace workflow_reader
92
94
95} // end namespace tpc
96} // end namespace o2
A generic reader for ROOT TTrees.
PublishingMode
Publishing mode determines what to do when the number of entries in the tree is reached.
GenericRootTreeReader< rtr::DefaultKey > RootTreeReader
std::function< std::shared_ptr< Reader >(const char *, const char *, int, Reader::PublishingMode, o2::header::DataHeader::SubSpecificationType, const char *, const char *, Reader::SpecialPublishHook *)> Creator
framework::DataProcessorSpec createPublisherSpec(PublisherConf const &config, bool propagateMC, workflow_reader::Creator creator)
framework::DataProcessorSpec getPublisherSpec(PublisherConf const &config, bool propagateMC=true)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
std::string filename()
static ConcreteDataTypeMatcher asConcreteDataTypeMatcher(OutputSpec const &spec)
header::DataOrigin origin
Definition Output.h:28
uint32_t SubSpecificationType
Definition DataHeader.h:620
BranchOptionConfig mcbranch
std::string defaultTreeName
BranchOptionConfig databranch
std::string defaultFileName
Reader::SpecialPublishHook * hook
std::vector< int > outputIds
std::vector< int > tpcSectors