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
24
25using namespace o2::framework;
26
27namespace o2
28{
29namespace its
30{
32
33template <typename T>
35using LabelsType = std::vector<o2::MCCompLabel>;
36using ROFRecLblT = std::vector<o2::itsmft::MC2ROFRecord>;
37using namespace o2::header;
38
40{
41 // Spectators for logging
42 // this is only to restore the original behavior
43 const auto writeContLabels = VertexerParamConfig::Instance().outputContLabels && useMC;
44 auto tracksSize = std::make_shared<int>(0);
45 auto tracksSizeGetter = [tracksSize](std::vector<o2::its::TrackITS> const& tracks) {
46 *tracksSize = tracks.size();
47 };
48 auto logger = [tracksSize](std::vector<o2::itsmft::ROFRecord> const& rofs) {
49 LOG(info) << "ITSTrackWriter pulled " << *tracksSize << " tracks, in " << rofs.size() << " RO frames";
50 };
51 return MakeRootTreeWriterSpec("its-track-writer",
52 "o2trac_its.root",
53 MakeRootTreeWriterSpec::TreeAttributes{"o2sim", "Tree with ITS tracks"},
55 "ITSTrack",
56 tracksSizeGetter},
57 BranchDefinition<std::vector<int>>{InputSpec{"trackClIdx", "ITS", "TRACKCLSID", 0},
58 "ITSTrackClusIdx"},
59 BranchDefinition<std::vector<Vertex>>{InputSpec{"vertices", "ITS", "VERTICES", 0},
60 "Vertices"},
61 BranchDefinition<std::vector<o2::itsmft::ROFRecord>>{InputSpec{"vtxROF", "ITS", "VERTICESROF", 0},
62 "VerticesROF"},
63 BranchDefinition<std::vector<o2::itsmft::ROFRecord>>{InputSpec{"ROframes", "ITS", "ITSTrackROF", 0},
64 "ITSTracksROF",
65 logger},
66 BranchDefinition<LabelsType>{InputSpec{"labels", "ITS", "TRACKSMCTR", 0},
67 "ITSTrackMCTruth",
68 (useMC ? 1 : 0), // one branch if mc labels enabled
69 ""},
70 BranchDefinition<LabelsType>{InputSpec{"labelsVertices", "ITS", "VERTICESMCTR", 0},
71 "ITSVertexMCTruth",
72 (useMC ? 1 : 0), // one branch if mc labels enabled
73 ""},
74 BranchDefinition<LabelsType>{InputSpec{"labelsVerticesContributors", "ITS", "VERTICESMCTRCONT", 0},
75 "ITSVertexMCTruthCont",
76 (writeContLabels ? 1 : 0), // one branch if
77 // requested
78 ""},
79 BranchDefinition<ROFRecLblT>{InputSpec{"MC2ROframes", "ITS", "ITSTrackMC2ROF", 0},
80 "ITSTracksMC2ROF",
81 (useMC ? 1 : 0), // one branch if mc labels enabled
82 ""},
83 BranchDefinition<std::vector<float>>{InputSpec{"purityVertices", "ITS", "VERTICESMCPUR", 0},
84 "ITSVertexMCPurity", (useMC ? 1 : 0), // one branch if mc labels enabled
85 ""})();
86}
87
88} // namespace its
89} // 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::dataformats::Vertex< o2::dataformats::TimeStamp< int > > Vertex
Definition TimeFrame.h:65
o2::framework::DataProcessorSpec getTrackWriterSpec(bool useMC)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"