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
24
25using namespace o2::framework;
26
27namespace o2
28{
29namespace phos
30{
31
32template <typename T>
34using ClusType = std::vector<o2::phos::Cluster>;
35using CellType = std::vector<o2::phos::Cell>;
36using TriggerRecordType = std::vector<o2::phos::TriggerRecord>;
38using namespace o2::header;
39
41{
42 // Spectators for logging
43 // this is only to restore the original behavior
44 auto ClustersSize = std::make_shared<int>(0);
45 auto ClustersSizeGetter = [ClustersSize](ClusType const& Clusters) {
46 *ClustersSize = Clusters.size();
47 };
48
49 if (useMC) {
50 return MakeRootTreeWriterSpec("phos-cluster-writer",
51 "phosclusters.root",
52 MakeRootTreeWriterSpec::TreeAttributes{"o2sim", "Tree with PHOS clusters"},
53 BranchDefinition<ClusType>{InputSpec{"clus", "PHS", "CLUSTERS", 0},
54 "PHOSCluster", ClustersSizeGetter},
55 BranchDefinition<TriggerRecordType>{InputSpec{"clusRecs", "PHS", "CLUSTERTRIGREC", 0},
56 "PHOSClusterTrigRec"},
57 BranchDefinition<MCLabelType>{InputSpec{"clusMC", "PHS", "CLUSTERTRUEMC", 0},
58 "PHOSClusterTrueMC"})();
59 } else {
60 return MakeRootTreeWriterSpec("phos-cluster-writer",
61 "phosclusters.root",
62 MakeRootTreeWriterSpec::TreeAttributes{"o2sim", "Tree with PHOS clusters"},
63 BranchDefinition<ClusType>{InputSpec{"clus", "PHS", "CLUSTERS", 0},
64 "PHOSCluster", ClustersSizeGetter},
65 BranchDefinition<TriggerRecordType>{InputSpec{"clusRecs", "PHS", "CLUSTERTRIGREC", 0},
66 "PHOSClusterTrigRec"})();
67 }
68}
69
71{
72 // Spectators for logging
73 // this is only to restore the original behavior
74 auto CellSize = std::make_shared<int>(0);
75 auto CellSizeGetter = [CellSize](CellType const& Cells) {
76 *CellSize = Cells.size();
77 };
78
79 if (useMC) {
80 return MakeRootTreeWriterSpec("phos-cell-writer",
81 "phoscells.root",
82 MakeRootTreeWriterSpec::TreeAttributes{"o2sim", "Tree with PHOS cells"},
83 BranchDefinition<CellType>{InputSpec{"cell", "PHS", "CELLS", 0},
84 "PHOSCell", CellSizeGetter},
85 BranchDefinition<TriggerRecordType>{InputSpec{"PHOSCellTR", "PHS", "CELLTRIGREC", 0},
86 "PHOSCellTrigRec"},
87 BranchDefinition<MCLabelType>{InputSpec{"PHOSCellMCTruth", "PHS", "CELLSMCTR", 0},
88 "PHOSCellTrueMC"})();
89 } else {
90 return MakeRootTreeWriterSpec("phos-cell-writer",
91 "phoscells.root",
92 MakeRootTreeWriterSpec::TreeAttributes{"o2sim", "Tree with PHOS cells"},
93 BranchDefinition<CellType>{InputSpec{"cell", "PHS", "CELLS", 0},
94 "PHOSCell", CellSizeGetter},
95 BranchDefinition<TriggerRecordType>{InputSpec{"PHOSCellTR", "PHS", "CELLTRIGREC", 0},
96 "PHOSCellTrigRec"})();
97 }
98}
99} // namespace phos
100} // namespace o2
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.
Definition TFIDInfo.h:20
O2 data header classes and API, v0.1.
Definition DetID.h:49
std::vector< o2::phos::Cluster > ClusType
std::vector< o2::phos::Cell > CellType
framework::DataProcessorSpec getClusterWriterSpec(bool useMC)
write PHOS clusters to ROOT file
framework::DataProcessorSpec getCellWriterSpec(bool useMC)
std::vector< o2::phos::TriggerRecord > TriggerRecordType
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...