Project
Loading...
Searching...
No Matches
TrackWriterSpec.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
23
24using namespace o2::framework;
25
26namespace o2
27{
28namespace its3
29{
31
32template <typename T>
34using LabelsType = std::vector<o2::MCCompLabel>;
35using ROFRecLblT = std::vector<o2::itsmft::MC2ROFRecord>;
36using namespace o2::header;
37
39{
40 // Spectators for logging
41 // this is only to restore the original behavior
42 auto tracksSize = std::make_shared<int>(0);
43 auto tracksSizeGetter = [tracksSize](std::vector<o2::its::TrackITS> const& tracks) {
44 *tracksSize = tracks.size();
45 };
46 auto logger = [tracksSize](std::vector<o2::itsmft::ROFRecord> const& rofs) {
47 LOG(info) << "ITS3TrackWriter pulled " << *tracksSize << " tracks, in " << rofs.size() << " RO frames";
48 };
49 // NOTE: We name the branches as ITS and not IT3 to ensure matching works.
50 return MakeRootTreeWriterSpec("its3-track-writer",
51 "o2trac_its.root",
52 MakeRootTreeWriterSpec::TreeAttributes{"o2sim", "Tree with ITS3 tracks"},
54 "ITSTrack",
55 tracksSizeGetter},
56 BranchDefinition<std::vector<int>>{InputSpec{"trackClIdx", "ITS", "TRACKCLSID", 0},
57 "ITSTrackClusIdx"},
58 BranchDefinition<std::vector<Vertex>>{InputSpec{"vertices", "ITS", "VERTICES", 0},
59 "Vertices"},
60 BranchDefinition<std::vector<o2::itsmft::ROFRecord>>{InputSpec{"vtxROF", "ITS", "VERTICESROF", 0},
61 "VerticesROF"},
62 BranchDefinition<std::vector<o2::itsmft::ROFRecord>>{InputSpec{"ROframes", "ITS", "ITSTrackROF", 0},
63 "ITSTracksROF",
64 logger},
65 BranchDefinition<LabelsType>{InputSpec{"labels", "ITS", "TRACKSMCTR", 0},
66 "ITSTrackMCTruth",
67 (useMC ? 1 : 0), // one branch if mc labels enabled
68 ""},
69 BranchDefinition<LabelsType>{InputSpec{"labelsVertices", "ITS", "VERTICESMCTR", 0},
70 "ITSVertexMCTruth",
71 (useMC ? 1 : 0), // one branch if mc labels enabled
72 ""},
73 BranchDefinition<std::vector<float>>{InputSpec{"purityVertices", "ITS", "VERTICESMCPUR", 0},
74 "ITSVertexMCPurity", (useMC ? 1 : 0), ""},
75 BranchDefinition<ROFRecLblT>{InputSpec{"MC2ROframes", "ITS", "ITSTrackMC2ROF", 0},
76 "ITSTracksMC2ROF",
77 (useMC ? 1 : 0), // one branch if mc labels enabled
78 ""})();
79}
80
81} // namespace its3
82} // namespace o2
std::vector< o2::MCCompLabel > LabelsType
std::vector< o2::itsmft::MC2ROFRecord > ROFRecLblT
Definition of the ITSMFT ROFrame (trigger) record.
Definition of a container to keep Monte Carlo truth external to simulation objects.
Configurable generator for RootTreeWriter processor spec.
Definition of the ITS track.
Generate a processor spec for the RootTreeWriter utility.
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
O2 data header classes and API, v0.1.
Definition DetID.h:49
o2::framework::DataProcessorSpec getTrackWriterSpec(bool useMC)
o2::dataformats::Vertex< o2::dataformats::TimeStamp< int > > Vertex
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"