43 "RootTrackParameterWriter", level),
46 throw std::invalid_argument(
"Missing proto tracks input collection");
49 throw std::invalid_argument(
"Missing particles input collection");
52 throw std::invalid_argument(
"Missing simulated hits input collection");
55 throw std::invalid_argument(
"Missing hit-particles map input collection");
58 throw std::invalid_argument(
59 "Missing hit-simulated-hits map input collection");
62 throw std::invalid_argument(
"Missing output filename");
65 throw std::invalid_argument(
"Missing tree name");
79 throw std::ios_base::failure(
"Could not open '" +
path);
85 throw std::bad_alloc();
111 if (m_outputFile !=
nullptr) {
112 m_outputFile->Close();
118 m_outputTree->Write();
119 m_outputFile->Close();
121 ACTS_INFO(
"Wrote estimated parameters from seed to tree '"
122 <<
m_cfg.treeName <<
"' in '" <<
m_cfg.filePath <<
"'");
131 const auto& protoTracks = m_inputProtoTracks(ctx);
132 const auto&
particles = m_inputParticles(ctx);
133 const auto& simHits = m_inputSimHits(ctx);
134 const auto& hitParticlesMap = m_inputMeasurementParticlesMap(ctx);
135 const auto& hitSimHitsMap = m_inputMeasurementSimHitsMap(ctx);
138 std::lock_guard<std::mutex> lock(m_writeMutex);
143 ACTS_VERBOSE(
"Writing " << trackParams.size() <<
" track parameters");
146 for (
size_t iparams = 0; iparams < trackParams.size(); ++iparams) {
149 const auto&
surface = trackParams[iparams].referenceSurface();
151 const auto params = trackParams[iparams].parameters();
158 m_p = std::abs(1.0 / m_qop);
159 m_pt = m_p * std::sin(m_theta);
160 m_eta = std::atanh(std::cos(m_theta));
163 const auto& ptrack = protoTracks[iparams];
164 std::vector<ParticleHitCount> particleHitCounts;
166 m_truthMatched =
false;
167 if (particleHitCounts.size() == 1) {
168 m_truthMatched =
true;
171 const auto& hitIdx = ptrack.front();
173 auto indices =
makeRange(hitSimHitsMap.equal_range(hitIdx));
174 auto [truthLocal, truthPos4, truthUnitDir] =
179 m_t_phi =
phi(truthUnitDir);
180 m_t_theta =
theta(truthUnitDir);
184 if (not indices.empty()) {
187 const auto simHitIdx0 = indices.begin()->second;
188 const auto& simHit0 = *simHits.nth(simHitIdx0);
191 const auto& particleId = simHit0.particleId();
196 m_t_charge =
static_cast<int>(
particle.charge());
197 m_t_qop = m_t_charge /
p;
200 << particleId <<
"=" << particleId.value() <<
" not found!");
204 m_outputTree->Fill();