47 static_assert(
DetID == o2::detectors::DetID::TRK ||
DetID == o2::detectors::DetID::FT3,
"only TRK and FT3 cluster writers are supported");
48 using ClustersType = std::vector<o2::trkft3::Cluster<DetID>>;
51 const auto detName = Origin.as<std::string>();
53 auto compClusterSizes = std::make_shared<std::vector<size_t>>(nLayers, 0);
54 auto compClustersSizeGetter = [compClusterSizes](ClustersType
const& compClusters,
DataRef const&
ref) {
55 auto const* dh = DataRefUtils::getHeader<o2::header::DataHeader*>(
ref);
56 (*compClusterSizes)[dh->subSpecification] = compClusters.size();
59 auto const* dh = DataRefUtils::getHeader<o2::header::DataHeader*>(
ref);
60 const auto i = dh->subSpecification;
61 LOG(info) << detName <<
"ClusterWriter on layer " <<
i
62 <<
" pulled " << (*compClusterSizes)[
i] <<
" clusters, in " << rofs.size() <<
" RO frames";
64 auto getIndex = [](
DataRef const&
ref) ->
size_t {
65 auto const* dh = DataRefUtils::getHeader<o2::header::DataHeader*>(
ref);
66 return static_cast<size_t>(dh->subSpecification);
68 auto getName = [](std::string base,
size_t index) -> std::string {
71 auto detNameLC = detName;
72 std::transform(detNameLC.begin(), detNameLC.end(), detNameLC.begin(), [](
unsigned char c) { return std::tolower(c); });
74 std::vector<InputSpec> vecInpSpecClus, vecInpSpecPatt, vecInpSpecROF, vecInpSpecLbl;
75 vecInpSpecClus.reserve(nLayers);
76 vecInpSpecPatt.reserve(nLayers);
77 vecInpSpecROF.reserve(nLayers);
78 vecInpSpecLbl.reserve(nLayers);
79 for (
int iLayer = 0; iLayer < nLayers; iLayer++) {
80 vecInpSpecClus.emplace_back(
getName(detName +
"compclus", iLayer), Origin,
"COMPCLUSTERS", iLayer);
81 vecInpSpecPatt.emplace_back(
getName(detName +
"patterns", iLayer), Origin,
"PATTERNS", iLayer);
82 vecInpSpecROF.emplace_back(
getName(detName +
"ROframes", iLayer), Origin,
"CLUSTERSROF", iLayer);
83 vecInpSpecLbl.emplace_back(
getName(detName +
"labels", iLayer), Origin,
"CLUSTERSMCTR", iLayer);
87 std::format(
"o2clus_{}.root", detNameLC).c_str(),
90 detName +
"ClusterComp",
"compact-cluster-branch",
92 compClustersSizeGetter,
96 detName +
"ClusterPatt",
"cluster-pattern-branch",
101 detName +
"ClustersROF",
"cluster-rof-branch",
107 detName +
"ClusterMCTruth",
"cluster-label-branch",
108 (useMC ? nLayers : 0),