16#ifndef WORKFLOWHELPER_H
17#define WORKFLOWHELPER_H
52 std::vector<o2::dataformats::ConstMCLabelContainerView>
mcInputs;
53 std::vector<gsl::span<const char>>
inputs;
60 std::array<gsl::span<const o2::tpc::Digit>, constants::MAXSECTOR>
inputDigits;
61 std::array<const o2::dataformats::ConstMCLabelContainerView*, constants::MAXSECTOR>
inputDigitsMCPtrs;
66static auto getWorkflowTPCInput(
o2::framework::ProcessingContext& pc,
int verbosity = 0,
bool do_mcLabels =
false,
bool do_clusters =
true,
unsigned long tpcSectorMask = 0xFFFFFFFFF,
bool do_digits =
false)
68 auto retVal = std::make_unique<internal::getWorkflowTPCInput_ret>();
70 if (do_clusters && do_digits) {
71 throw std::invalid_argument(
"Currently cannot process both clusters and digits");
73 std::array<int, constants::MAXSECTOR> inputDigitsMCIndex;
76 std::vector<o2::framework::InputSpec>
filter = {
80 unsigned long recvMask = 0;
82 std::fill(inputDigitsMCIndex.begin(), inputDigitsMCIndex.end(), -1);
84 for (
auto const&
ref :
o2::
framework::InputRecordWalker<
o2::utilities::DataSamplingHeader>(pc.inputs(),
filter)) {
85 auto const* sectorHeader = o2::framework::DataRefUtils::getHeader<TPCSectorHeader*>(
ref);
86 if (sectorHeader ==
nullptr) {
88 LOG(
error) <<
"sector header missing on header stack";
91 const int sector = sectorHeader->sector();
95 if (recvMask & sectorHeader->sectorBits) {
96 throw std::runtime_error(
"can only have one MC data set per sector");
98 recvMask |= (sectorHeader->sectorBits & tpcSectorMask);
101 inputDigitsMCIndex[
sector] =
retVal->internal.inputDigitsMC.size();
105 if (recvMask != tpcSectorMask) {
106 throw std::runtime_error(
"Incomplete set of MC labels received");
109 for (
unsigned int i = 0;
i < constants::MAXSECTOR;
i++) {
110 if (tpcSectorMask & (1ul <<
i)) {
112 LOG(info) <<
"GOT MC LABELS FOR SECTOR " <<
i <<
" -> " <<
retVal->internal.inputDigitsMC[inputDigitsMCIndex[
i]].getNElements();
114 if (inputDigitsMCIndex[
i] == -1) {
115 throw std::runtime_error(
"digit mc labels missing");
117 retVal->inputDigitsMCPtrs[
i] = &
retVal->internal.inputDigitsMC[inputDigitsMCIndex[
i]];
119 retVal->inputDigitsMCPtrs[
i] =
nullptr;
125 if (do_clusters || do_digits) {
126 std::vector<o2::framework::InputSpec>
filter = {
130 unsigned long recvMask = 0;
131 for (
auto const&
ref :
o2::
framework::InputRecordWalker<
o2::utilities::DataSamplingHeader>(pc.inputs(),
filter)) {
132 auto const* sectorHeader = o2::framework::DataRefUtils::getHeader<TPCSectorHeader*>(
ref);
133 if (sectorHeader ==
nullptr) {
134 throw std::runtime_error(
"sector header missing on header stack");
136 const int sector = sectorHeader->sector();
140 if (recvMask & sectorHeader->sectorBits) {
141 throw std::runtime_error(
"can only have one cluster data set per sector");
143 recvMask |= (sectorHeader->sectorBits & tpcSectorMask);
146 if (tpcSectorMask & (1ul <<
sector)) {
149 LOG(info) <<
"GOT DIGITS SPAN FOR SECTOR " <<
sector <<
" -> " <<
retVal->inputDigits[
sector].size();
154 if (recvMask != tpcSectorMask) {
155 throw std::runtime_error(
"Incomplete set of clusters/digits received");
159 auto&
sector = refentry.first;
160 auto&
ref = refentry.second.data;
162 if (
ref.payload ==
nullptr) {
166 if (!(tpcSectorMask & (1ul <<
sector))) {
169 if (refentry.second.labels.header !=
nullptr && refentry.second.labels.payload !=
nullptr) {
181 memset(&
retVal->clusterIndex, 0,
sizeof(
retVal->clusterIndex));
182 ClusterNativeHelper::Reader::fillIndex(
retVal->clusterIndex,
retVal->internal.clusterBuffer,
retVal->internal.clustersMCBuffer,
retVal->internal.inputs,
retVal->internal.mcInputs, tpcSectorMask);
Meta data for a group describing it by sector number and global padrow.
Helper class to read the binary format of TPC ClusterNative.
Class of a TPC cluster in TPC-native coordinates (row, time)
A const (ready only) version of MCTruthContainer.
configStandalone Light OpenGL display display_light Apply smoothing to points Enable Z buffer Highlight links Highlight seeds Highlight sector tracks Highlight final tracks Show individual Show related Highlight grid Show only individual collision Color clusters belonging to track objects Set line Enable drawing TPC data Enable drawing TOF data Enable drawing magnetic field Set field line step count Invert colors configStandalone Heavy OpenGL display display_heavy Show tracks with ITS contribution Show tracks with TOF contribution Enable propagation of loopers Show clusters at nominal x of pad row for early transformed data Split CE tracks when they cross the central Mark clusters Mark adjacent clusters Hide rejected tracks Apply filter on tracks to be displayed Separate increase X h configStandalone Camera window renderer OpenGL display display_camera Orient the camera such that the y axis is always upwards Full Screen MultiSample Anti Downsampling Anti Enable Vertical Sync Target frame or if the backend cannot limit to the refresh Use OpenGL indirect draws to reduce number of draw calls Display h configStandalone Vulkan display display_vulkan Have uniform buffers in host accessible device memory h internal
configStandalone Light OpenGL display display_light Apply smoothing to points Enable Z buffer Highlight links Highlight seeds Highlight sector tracks Highlight final tracks Show individual sector
char error[CURL_ERROR_SIZE]
Definition of a container to keep Monte Carlo truth external to simulation objects.
InputRecord & inputs()
The inputs associated with this processing context.
ClusterNativeAccess::ConstMCLabelContainerViewWithBuffer ConstMCLabelContainerViewWithBuffer
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
constexpr o2::header::DataOrigin gDataOriginTPC
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
static o2::header::DataHeader::PayloadSizeType getPayloadSize(const DataRef &ref)
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"