Skip to content

Commit 19fd16e

Browse files
committed
Use strong typing to avoid root serialization in RootTreeReader
1 parent 5361fab commit 19fd16e

2 files changed

Lines changed: 26 additions & 21 deletions

File tree

DataFormats/Detectors/CPV/include/DataFormatsCPV/Cluster.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,18 @@ class Cluster
118118

119119
ClassDefNV(Cluster, 1);
120120
};
121+
121122
} // namespace cpv
123+
124+
namespace framework
125+
{
126+
template <typename T>
127+
struct is_messageable;
128+
template <>
129+
struct is_messageable<o2::cpv::Cluster> : std::true_type {
130+
};
131+
} // namespace framework
132+
122133
} // namespace o2
123134

124135
#endif

Detectors/CPV/workflow/src/ReaderSpec.cxx

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010
// or submit itself to any jurisdiction.
1111

1212
#include "DataFormatsCPV/CPVBlockHeader.h"
13+
#include "DataFormatsCPV/Cluster.h"
14+
#include "DataFormatsCPV/Digit.h"
15+
#include "DataFormatsCPV/TriggerRecord.h"
16+
#include "SimulationDataFormat/MCTruthContainer.h"
17+
#include "SimulationDataFormat/MCCompLabel.h"
1318
#include "CPVWorkflow/ReaderSpec.h"
1419
#include "Framework/ConfigParamRegistry.h"
1520
#include "Framework/ControlService.h"
@@ -54,28 +59,22 @@ DataProcessorSpec getDigitsReaderSpec(bool propagateMC)
5459
processAttributes->terminateOnEod = ic.options().get<bool>("terminate-on-eod");
5560
processAttributes->finished = false;
5661
processAttributes->datatype = "CPVDigit";
57-
constexpr auto persistency = Lifetime::Timeframe;
5862
o2::header::DataHeader::SubSpecificationType subSpec = 0;
5963
if (propagateMC) {
6064
processAttributes->reader = std::make_shared<RootTreeReader>(treename.c_str(), // tree name
6165
filename.c_str(), // input file name
6266
nofEvents, // number of entries to publish
6367
publishingMode,
64-
Output{"CPV", "DIGITS", subSpec, persistency},
65-
"CPVDigit", // name of data branch
66-
Output{"CPV", "DIGITTRIGREC", subSpec, persistency},
67-
"CPVDigitTrigRecords", // name of data triggerrecords branch
68-
Output{"CPV", "DIGITSMCTR", subSpec, persistency},
69-
"CPVDigitMCTruth"); // name of mc label branch
68+
RootTreeReader::BranchDefinition<std::vector<Digit>>{Output{"CPV", "DIGITS", subSpec}, "CPVDigit"},
69+
RootTreeReader::BranchDefinition<std::vector<TriggerRecord>>{Output{"CPV", "DIGITTRIGREC", subSpec}, "CPVDigitTrigRecords"},
70+
RootTreeReader::BranchDefinition<dataformats::MCTruthContainer<MCCompLabel>>{Output{"CPV", "DIGITSMCTR", subSpec}, "CPVDigitMCTruth"});
7071
} else {
7172
processAttributes->reader = std::make_shared<RootTreeReader>(treename.c_str(), // tree name
7273
filename.c_str(), // input file name
7374
nofEvents, // number of entries to publish
7475
publishingMode,
75-
Output{"CPV", "DIGITS", subSpec, persistency},
76-
"CPVDigit", // name of data branch
77-
Output{"CPV", "DIGITTRIGREC", subSpec, persistency},
78-
"CPVDigitTrigRecords"); // name of data triggerrecords branch
76+
RootTreeReader::BranchDefinition<std::vector<Digit>>{Output{"CPV", "DIGITS", subSpec}, "CPVDigit"},
77+
RootTreeReader::BranchDefinition<std::vector<TriggerRecord>>{Output{"CPV", "DIGITTRIGREC", subSpec}, "CPVDigitTrigRecords"});
7978
}
8079
}
8180

@@ -157,21 +156,16 @@ DataProcessorSpec getClustersReaderSpec(bool propagateMC)
157156
filename.c_str(), // input file name
158157
nofEvents, // number of entries to publish
159158
publishingMode,
160-
Output{"CPV", "CLUSTERS", subSpec, persistency},
161-
"CPVCluster", // name of data branch
162-
Output{"CPV", "CLUSTERTRIGRECS", subSpec, persistency},
163-
"CPVClusterTrigRec", // name of data triggerrecords branch
164-
Output{"CPV", "CLUSTERTRUEMC", subSpec, persistency},
165-
"CPVClusterTrueMC"); // name of mc label branch
159+
RootTreeReader::BranchDefinition<std::vector<Cluster>>{Output{"CPV", "CLUSTERS", subSpec}, "CPVCluster"},
160+
RootTreeReader::BranchDefinition<std::vector<TriggerRecord>>{Output{"CPV", "CLUSTERTRIGRECS", subSpec}, "CPVClusterTrigRec"},
161+
RootTreeReader::BranchDefinition<dataformats::MCTruthContainer<MCCompLabel>>{Output{"CPV", "CLUSTERTRUEMC", subSpec}, "CPVClusterTrueMC"});
166162
} else {
167163
processAttributes->reader = std::make_shared<RootTreeReader>(treename.c_str(), // tree name
168164
filename.c_str(), // input file name
169165
nofEvents, // number of entries to publish
170166
publishingMode,
171-
Output{"CPV", "CLUSTERS", subSpec, persistency},
172-
"CPVCluster", // name of data branch
173-
Output{"CPV", "CLUSTERTRIGRECS", subSpec, persistency},
174-
"CPVClusterTrueMC"); // name of data triggerrecords branch
167+
RootTreeReader::BranchDefinition<std::vector<Cluster>>{Output{"CPV", "CLUSTERS", subSpec}, "CPVCluster"},
168+
RootTreeReader::BranchDefinition<std::vector<TriggerRecord>>{Output{"CPV", "CLUSTERTRIGRECS", subSpec}, "CPVClusterTrigRec"});
175169
}
176170
}
177171

0 commit comments

Comments
 (0)