33 :
WriterT(config.inputMeasurements,
"RootMeasurementWriter", level),
37 throw std::invalid_argument(
"Missing simulated hits input collection");
40 throw std::invalid_argument(
41 "Missing hit-to-simulated-hits map input collection");
49 throw std::invalid_argument(
"Missing tracking geometry");
54 throw std::ios_base::failure(
"Could not open '" +
m_cfg.
filePath);
61 std::pair<Acts::GeometryIdentifier, std::unique_ptr<DigitizationTree>>>
64 ACTS_DEBUG(
"Bound indices are declared, preparing trees.");
68 auto dTree = std::make_unique<DigitizationTree>(geoID);
69 for (
const auto& bIndex : bIndices) {
71 dTree->setupBoundRecBranch(bIndex);
74 dTree->setupClusterBranch(bIndices);
76 dTrees.push_back({geoID,
std::move(dTree)});
79 ACTS_DEBUG(
"Bound indices are not declared, no reco setup.")
87 if (m_outputFile !=
nullptr) {
88 m_outputFile->Close();
95 for (
auto dTree = m_outputTrees.begin(); dTree != m_outputTrees.end();
97 (*dTree)->tree->Write();
99 m_outputFile->Close();
106 const auto& simHits = m_inputSimHits(ctx);
107 const auto& hitSimHitsMap = m_inputMeasurementSimHitsMap(ctx);
110 if (not
m_cfg.inputClusters.empty()) {
111 clusters = m_inputClusters(ctx);
115 std::lock_guard<std::mutex> lock(m_writeMutex);
117 for (
Index hitIdx = 0
u; hitIdx < measurements.size(); ++hitIdx) {
118 const auto& meas = measurements[hitIdx];
123 m.sourceLink().template get<IndexSourceLink>().geometryId();
126 m_cfg.trackingGeometry->findSurface(geoId);
127 if (not surfacePtr) {
132 auto dTreeItr = m_outputTrees.find(geoId);
133 if (dTreeItr == m_outputTrees.end()) {
136 auto& dTree = *dTreeItr;
142 auto indices =
makeRange(hitSimHitsMap.equal_range(hitIdx));
145 simHits, indices,
logger());
151 std::pair<double, double> angles =
153 dTree->fillTruthParameters(local, pos4, dir, angles);
154 dTree->fillBoundMeasurement(
m);
155 if (not clusters.empty()) {
156 const auto&
c = clusters[hitIdx];
157 dTree->fillCluster(
c);
160 if (dTree->chValue !=
nullptr) {
161 dTree->chValue->clear();
163 if (dTree->chId[0] !=
nullptr) {
164 dTree->chId[0]->clear();
166 if (dTree->chId[1] !=
nullptr) {
167 dTree->chId[1]->clear();