Project
Loading...
Searching...
No Matches
ClusterWriterSpec.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
13
14#include <vector>
15
22
23using namespace o2::framework;
24
25namespace o2::trk
26{
27
28template <typename T>
30using ClustersType = std::vector<o2::trk::Cluster>;
31using PatternsType = std::vector<unsigned char>;
32using ROFrameType = std::vector<o2::trk::ROFRecord>;
34using ROFRecLblType = std::vector<o2::trk::MC2ROFRecord>;
35
37{
38 auto clustersSize = std::make_shared<int>(0);
39 auto clustersSizeGetter = [clustersSize](ClustersType const& clusters) {
40 *clustersSize = clusters.size();
41 };
42 auto logger = [clustersSize](ROFrameType const& rofs) {
43 LOG(info) << "TRKClusterWriter pulled " << *clustersSize << " clusters, in " << rofs.size() << " RO frames";
44 };
45
46 return MakeRootTreeWriterSpec("trk-cluster-writer",
47 "o2clus_trk.root",
48 MakeRootTreeWriterSpec::TreeAttributes{"o2sim", "Tree with TRK clusters"},
49 BranchDefinition<ClustersType>{InputSpec{"compclus", "TRK", "COMPCLUSTERS", 0},
50 "TRKClusterComp",
51 clustersSizeGetter},
52 BranchDefinition<PatternsType>{InputSpec{"patterns", "TRK", "PATTERNS", 0},
53 "TRKClusterPatt"},
54 BranchDefinition<ROFrameType>{InputSpec{"ROframes", "TRK", "CLUSTERSROF", 0},
55 "TRKClustersROF",
56 logger},
57 BranchDefinition<LabelsType>{InputSpec{"labels", "TRK", "CLUSTERSMCTR", 0},
58 "TRKClusterMCTruth",
59 (useMC ? 1 : 0)},
60 BranchDefinition<ROFRecLblType>{InputSpec{"MC2ROframes", "TRK", "CLUSTERSMC2ROF", 0},
61 "TRKClustersMC2ROF",
62 (useMC ? 1 : 0)})();
63}
64
65} // namespace o2::trk
Definition of a container to keep Monte Carlo truth external to simulation objects.
Configurable generator for RootTreeWriter processor spec.
Generate a processor spec for the RootTreeWriter utility.
Defining PrimaryVertex explicitly as messageable.
std::vector< o2::trk::Cluster > ClustersType
framework::DataProcessorSpec getClusterWriterSpec(bool useMC)
std::vector< o2::trk::ROFRecord > ROFrameType
std::vector< o2::trk::MC2ROFRecord > ROFRecLblType
std::vector< unsigned char > PatternsType
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"
std::vector< Cluster > clusters