Project
Loading...
Searching...
No Matches
ClusterReaderSpec.cxx
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
14
21#include "TPCBase/Sector.h"
22#include <numeric>
23
24using namespace o2::framework;
25
26namespace o2
27{
28namespace tpc
29{
30
31framework::DataProcessorSpec getClusterReaderSpec(bool useMC, const std::vector<int>* tpcSectors, const std::vector<int>* laneConfiguration)
32{
33 static RootTreeReader::SpecialPublishHook hook{[](std::string_view name, ProcessingContext& context, o2::framework::Output const& output, char* data) -> bool {
34 if (TString(name.data()).Contains("TPCDigitMCTruth") || TString(name.data()).Contains("TPCClusterHwMCTruth") || TString(name.data()).Contains("TPCClusterNativeMCTruth")) {
35 auto storedlabels = reinterpret_cast<o2::dataformats::IOMCTruthContainerView const*>(data);
37 storedlabels->copyandflatten(flatlabels);
38 //LOG(info) << "PUBLISHING CONST LABELS " << flatlabels.getNElements();
39 context.outputs().snapshot(output, flatlabels);
40 return true;
41 }
42 return false;
43 }};
44
45 std::vector<int> defaultSectors;
46 std::vector<int> defaultLaneConfig;
47 if (tpcSectors == nullptr) {
48 defaultSectors.resize(Sector::MAXSECTOR);
49 std::iota(defaultSectors.begin(), defaultSectors.end(), 0);
50 tpcSectors = &defaultSectors;
51 }
52 if (laneConfiguration == nullptr) {
53 defaultLaneConfig = *tpcSectors;
54 laneConfiguration = &defaultLaneConfig;
55 }
56
58 "tpc-native-cluster-reader",
59 "tpc-native-clusters.root",
60 "tpcrec",
61 {"clusterbranch", "TPCClusterNative", "Branch with TPC native clusters"},
62 {"clustermcbranch", "TPCClusterNativeMCTruth", "MC label branch"},
63 OutputSpec{"TPC", "CLUSTERNATIVE"},
64 OutputSpec{"TPC", "CLNATIVEMCLBL"},
65 *tpcSectors,
66 *laneConfiguration,
67 &hook},
68 useMC));
69}
70
71} // end namespace tpc
72} // end namespace o2
A const (ready only) version of MCTruthContainer.
A special IO container - splitting a given vector to enable ROOT IO.
void output(const std::map< std::string, ChannelStat > &channels)
Definition rawdump.cxx:197
A generic reader for ROOT TTrees.
A read-only version of MCTruthContainer allowing for storage optimisation.
static constexpr int MAXSECTOR
Definition Sector.h:44
GLuint const GLchar * name
Definition glcorearb.h:781
GLboolean * data
Definition glcorearb.h:298
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
framework::DataProcessorSpec getClusterReaderSpec(bool useMC, const std::vector< int > *tpcSectors=nullptr, const std::vector< int > *laneConfiguration=nullptr)
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 ...