Project
Loading...
Searching...
No Matches
WriterSpec.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
26{
27namespace cpv
28{
29
30template <typename T>
32using ClusType = std::vector<o2::cpv::Cluster>;
33using DigitType = std::vector<o2::cpv::Digit>;
34using TriggerRecordType = std::vector<o2::cpv::TriggerRecord>;
36using namespace o2::header;
37
39{
40 // Spectators for logging
41 // this is only to restore the original behavior
42 auto ClustersSize = std::make_shared<int>(0);
43 auto ClustersSizeGetter = [ClustersSize](ClusType const& Clusters) {
44 *ClustersSize = Clusters.size();
45 };
46
47 if (useMC) {
48 return MakeRootTreeWriterSpec("cpv-cluster-writer",
49 "cpvclusters.root",
50 MakeRootTreeWriterSpec::TreeAttributes{"o2sim", "Tree with CPV clusters"},
51 BranchDefinition<ClusType>{InputSpec{"clus", "CPV", "CLUSTERS", 0},
52 "CPVCluster", ClustersSizeGetter},
53 BranchDefinition<TriggerRecordType>{InputSpec{"clusRecs", "CPV", "CLUSTERTRIGRECS", 0},
54 "CPVClusterTrigRec"},
55 BranchDefinition<MCLabelType>{InputSpec{"clusMC", "CPV", "CLUSTERTRUEMC", 0},
56 "CPVClusterTrueMC"})();
57 } else {
58 return MakeRootTreeWriterSpec("cpv-cluster-writer",
59 "cpvclusters.root",
60 MakeRootTreeWriterSpec::TreeAttributes{"o2sim", "Tree with CPV clusters"},
61 BranchDefinition<ClusType>{InputSpec{"clus", "CPV", "CLUSTERS", 0},
62 "CPVCluster", ClustersSizeGetter},
63 BranchDefinition<TriggerRecordType>{InputSpec{"clusRecs", "CPV", "CLUSTERTRIGRECS", 0},
64 "CPVClusterTrigRec"})();
65 }
66}
67
69{
70 // Spectators for logging
71 // this is only to restore the original behavior
72 auto DigitsSize = std::make_shared<int>(0);
73 auto DigitsSizeGetter = [DigitsSize](DigitType const& Digits) {
74 *DigitsSize = Digits.size();
75 };
76
77 if (useMC) {
78 return MakeRootTreeWriterSpec("cpv-digit-writer",
79 "cpvdigits.root",
80 MakeRootTreeWriterSpec::TreeAttributes{"o2sim", "Tree with CPV digits"},
81 BranchDefinition<DigitType>{InputSpec{"CPVDigit", "CPV", "DIGITS", 0},
82 "CPVDigit", DigitsSizeGetter},
83 BranchDefinition<TriggerRecordType>{InputSpec{"CPVDigitTrigRecords", "CPV", "DIGITTRIGREC", 0},
84 "CPVDigitTrigRecords"},
85 BranchDefinition<MCLabelType>{InputSpec{"clusMC", "CPV", "DIGITSMCTR", 0},
86 "CPVDigitMCTruth"})();
87 } else {
88 return MakeRootTreeWriterSpec("cpv-digit-writer",
89 "cpvdigits.root",
90 MakeRootTreeWriterSpec::TreeAttributes{"o2sim", "Tree with CPV digits"},
91 BranchDefinition<DigitType>{InputSpec{"CPVDigit", "CPV", "DIGITS", 0},
92 "CPVDigit", DigitsSizeGetter},
93 BranchDefinition<TriggerRecordType>{InputSpec{"CPVDigitTrigRecords", "CPV", "DIGITTRIGREC", 0},
94 "CPVDigitTrigRecords"})();
95 }
96}
97
98} // namespace cpv
99} // namespace o2
Definition of a container to keep Monte Carlo truth external to simulation objects.
Configurable generator for RootTreeWriter processor spec.
A container to hold and manage MC truth information/labels.
Generate a processor spec for the RootTreeWriter utility.
std::vector< o2::cpv::Digit > DigitType
framework::DataProcessorSpec getClusterWriterSpec(bool useMC)
framework::DataProcessorSpec getDigitWriterSpec(bool useMC)
std::vector< o2::cpv::TriggerRecord > TriggerRecordType
std::vector< o2::cpv::Cluster > ClusType
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
O2 data header classes and API, v0.1.
Definition DetID.h:49
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...