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 <algorithm>
15#include <cctype>
16#include <memory>
17#include <vector>
18#include <format>
19
22#include "Framework/DataRef.h"
31
32using namespace o2::framework;
33
34namespace o2::iotof
35{
36
37template <typename T>
39using ClustersType = std::vector<o2::iotof::Cluster>;
40using PatternsType = std::vector<unsigned char>;
41using ROFrameType = std::vector<o2::itsmft::ROFRecord>;
43
45{
46 std::string detStr = o2::detectors::DetID::getName(detId);
47 std::string detStrL = dec ? "o2_" : ""; // for decoded digits prepend by o2
48 detStrL += detStr;
49 std::transform(detStrL.begin(), detStrL.end(), detStrL.begin(), ::tolower);
50 auto logger = [](std::vector<o2::iotof::Cluster> const& inClusters) {
51 LOG(info) << "RECEIVED CLUSTERS SIZE " << inClusters.size();
52 };
53
54 return MakeRootTreeWriterSpec((detStr + "ClusterWriter" + (dec ? "_dec" : "")).c_str(),
55 (detStrL + "clusters.root").c_str(),
56 MakeRootTreeWriterSpec::TreeAttributes{.name = "o2sim", .title = "Tree with TF3 clusters"},
57 BranchDefinition<ClustersType>{InputSpec{"tf3_compclus", detOrig, "COMPCLUSTERS", 0},
58 (detStr + "ClusterComp").c_str(),
59 logger},
60 BranchDefinition<PatternsType>{InputSpec{"tf3_patterns", detOrig, "PATTERNS", 0},
61 (detStr + "ClusterPatt").c_str()},
62 BranchDefinition<ROFrameType>{InputSpec{"tf3_ROframes", detOrig, "CLUSTERSROF", 0},
63 (detStr + "ClusterROF").c_str(), "cluster-rof-branch"},
64 BranchDefinition<LabelsType>{InputSpec{"tf3_labels", detOrig, "CLUSTERSMCTR", 0},
65 (detStr + "ClusterMCTruth").c_str()})();
66}
67
69{
70 return getClusterWriterSpec(mctruth, dec, o2::header::gDataOriginTF3, o2::detectors::DetID::TF3);
71}
72
73} // namespace o2::iotof
A const (ready only) version of MCTruthContainer.
Definition of IOTOF digit class.
A special IO container - splitting a given vector to enable ROOT IO.
Definition of the ITSMFT ROFrame (trigger) record.
Configurable generator for RootTreeWriter processor spec.
Static class with identifiers, bitmasks and names for ALICE detectors.
Definition DetID.h:58
static constexpr const char * getName(ID id)
names of defined detectors
Definition DetID.h:146
Generate a processor spec for the RootTreeWriter utility.
constexpr o2::header::DataOrigin gDataOriginTF3
Definition DataHeader.h:587
Defining ITS Vertex explicitly as messageable.
Definition Cartesian.h:288
std::vector< o2::itsmft::ROFRecord > ROFrameType
o2::framework::DataProcessorSpec getIOTOFClusterWriterSpec(bool useMC, bool dec)
DataProcessorSpec getClusterWriterSpec(bool mctruth, bool dec, o2::header::DataOrigin detOrig, o2::detectors::DetID detId)
std::vector< unsigned char > PatternsType
std::vector< o2::iotof::Cluster > ClustersType
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"