30 m_tree.addBranch(std::make_unique<EventInfoBranch>(m_tree, evOpts));
32 auto initSegBranch = [
this](
const std::string& sgKey,
const std::string& outCollName) {
33 auto newColl = std::make_unique<SegmentVariables>(m_tree, sgKey, outCollName, msgLevel());
39 m_truthTrks->push_back(truthP);
40 return m_truthTrks->find(truthP);
44 if (acc_truthSegLink.isAvailable(*aux) && acc_truthSegLink(*aux).isValid()) {
46 return m_truthSegs->push_back(*truthSeg);
51 m_tree.addBranch(std::move(newColl));
54 initSegBranch(m_legacySegmentKey,
"LegacySegments");
55 initSegBranch(m_r4PatternSegmentKey,
"HoughSegments");
56 initSegBranch(m_segmentKeyR4,
"SegmentsR4");
58 ATH_CHECK(m_truthSegmentKey.initialize(m_isMC));
60 m_truthSegs = std::make_unique<SegmentVariables>(m_tree, m_truthSegmentKey.key(),
"TruthSegments", msgLevel());
61 m_tree.addBranch(m_truthSegs);
65 ATH_CHECK(m_TrackKeyHoughR4.initialize());
70 m_legacyTrks = std::make_unique<IParticleFourMomBranch>(m_tree,
"LegacyMSTrks");
71 m_legacyTrks->addVariable(std::make_unique<TrackChi2Branch>(*m_legacyTrks));
73 m_TrksHoughR4 = std::make_unique<IParticleFourMomBranch>(m_tree,
"HoughMSTrks");
74 m_TrksHoughR4->addVariable(std::make_unique<TrackChi2Branch>(*m_TrksHoughR4));
76 m_TrksSegmentR4 = std::make_unique<IParticleFourMomBranch>(m_tree,
"MSTrksR4");
77 m_TrksSegmentR4->addVariable(std::make_unique<TrackChi2Branch>(*m_TrksSegmentR4));
79 m_tree.addBranch(m_legacyTrks);
80 m_tree.addBranch(m_TrksSegmentR4);
81 m_tree.addBranch(m_TrksHoughR4);
84 m_trkTruthLinks.emplace_back(m_legacyTrackKey,
"truthParticleLink");
85 m_trkTruthLinks.emplace_back(m_TrackKeyHoughR4,
"truthParticleLink");
86 m_trkTruthLinks.emplace_back(m_TrackKeyR4,
"truthParticleLink");
87 m_trkTruthLinks.emplace_back(m_truthSegmentKey,
"truthParticleLink");
88 m_trkTruthLinks.emplace_back(
std::format(
"{:}.truthParticleLink", m_r4PatternSegmentKey.value()));
89 m_trkTruthLinks.emplace_back(
std::format(
"{:}.truthParticleLink", m_segmentKeyR4.value()));
91 m_truthTrks = std::make_unique<IParticleFourMomBranch>(m_tree,
"TruthMuons");
99 m_tree.addBranch(m_truthTrks);
104 return StatusCode::SUCCESS;
109 outBranch = std::count_if(spContainer.
begin(), spContainer.
end(),
111 return Muon::MuonStationIndex::toStationIndex(bucket->msSector()->chamberIndex()) == station;
117 const EventContext& ctx{Gaudi::Hive::currentContext()};
127 ATH_MSG_DEBUG(
"Fill reconstructed tracks from "<<m_legacyTrackKey.fullKey());
129 m_legacyTrks->push_back(trk);
131 ATH_MSG_DEBUG(
"Fill reconstructed tracks from "<<m_TrackKeyR4.fullKey());
133 m_TrksSegmentR4->push_back(trk);
135 ATH_MSG_DEBUG(
"Fill reconstructed tracks from "<<m_TrackKeyHoughR4.fullKey());
137 m_TrksHoughR4->push_back(trk);
140 if (!m_truthKey.empty()) {
144 m_truthTrks->push_back(truth);
149 m_truthSegs->push_back(*seg);
155 m_nBucket = spContainer->size();
157 fillBucketsPerStation(*spContainer, StIdx::BI, m_nBucketBI);
158 fillBucketsPerStation(*spContainer, StIdx::BM, m_nBucketBM);
159 fillBucketsPerStation(*spContainer, StIdx::BO, m_nBucketBO);
160 fillBucketsPerStation(*spContainer, StIdx::BE, m_nBucketBE);
162 fillBucketsPerStation(*spContainer, StIdx::EI, m_nBucketEI);
163 fillBucketsPerStation(*spContainer,
StIdx::EM, m_nBucketEM);
164 fillBucketsPerStation(*spContainer,
StIdx::EO, m_nBucketEO);
165 fillBucketsPerStation(*spContainer, StIdx::EE, m_nBucketEE);
168 if(!m_tree.fill(ctx)) {
169 return StatusCode::FAILURE;
171 return StatusCode::SUCCESS;
175 return StatusCode::SUCCESS;