30 m_tree.addBranch(std::make_unique<EventInfoBranch>(m_tree, evOpts));
32 auto initSegBranch = [
this](
const std::string& sgKey,
const std::string& outCollName) {
36 auto newColl = std::make_unique<SegmentVariables>(m_tree, sgKey, outCollName, msgLevel());
42 m_truthTrks->push_back(truthP);
43 return m_truthTrks->find(truthP);
47 if (acc_truthSegLink.isAvailable(*aux) && acc_truthSegLink(*aux).isValid()) {
49 return m_truthSegs->push_back(*truthSeg);
54 m_tree.addBranch(std::move(newColl));
57 initSegBranch(m_legacySegmentKey,
"LegacySegments");
58 initSegBranch(m_r4PatternSegmentKey,
"HoughSegments");
59 initSegBranch(m_segmentKeyR4,
"SegmentsR4");
61 ATH_CHECK(m_truthSegmentKey.initialize(m_isMC));
63 m_truthSegs = std::make_unique<SegmentVariables>(m_tree, m_truthSegmentKey.key(),
"TruthSegments", msgLevel());
64 m_tree.addBranch(m_truthSegs);
68 ATH_CHECK(m_TrackKeyHoughR4.initialize(m_r4PatternSegmentKey.value().size()));
73 m_legacyTrks = std::make_unique<IParticleFourMomBranch>(m_tree,
"LegacyMSTrks");
74 m_legacyTrks->addVariable(std::make_unique<TrackChi2Branch>(*m_legacyTrks));
76 if (!m_TrackKeyHoughR4.empty()){
77 m_TrksHoughR4 = std::make_unique<IParticleFourMomBranch>(m_tree,
"HoughMSTrks");
78 m_TrksHoughR4->addVariable(std::make_unique<TrackChi2Branch>(*m_TrksHoughR4));
79 m_tree.addBranch(m_TrksHoughR4);
82 m_TrksSegmentR4 = std::make_unique<IParticleFourMomBranch>(m_tree,
"MSTrksR4");
83 m_TrksSegmentR4->addVariable(std::make_unique<TrackChi2Branch>(*m_TrksSegmentR4));
85 m_tree.addBranch(m_legacyTrks);
86 m_tree.addBranch(m_TrksSegmentR4);
89 m_trkTruthLinks.emplace_back(m_legacyTrackKey,
"truthParticleLink");
90 if (!m_TrackKeyHoughR4.empty()) {
91 m_trkTruthLinks.emplace_back(m_TrackKeyHoughR4,
"truthParticleLink");
92 m_trkTruthLinks.emplace_back(
std::format(
"{:}.truthParticleLink", m_r4PatternSegmentKey.value()));
96 m_trkTruthLinks.emplace_back(m_TrackKeyR4,
"truthParticleLink");
97 m_trkTruthLinks.emplace_back(m_truthSegmentKey,
"truthParticleLink");
99 m_trkTruthLinks.emplace_back(
std::format(
"{:}.truthParticleLink", m_segmentKeyR4.value()));
101 m_truthTrks = std::make_unique<IParticleFourMomBranch>(m_tree,
"TruthMuons");
106 m_tree.addBranch(m_truthTrks);
111 return StatusCode::SUCCESS;
116 outBranch = std::count_if(spContainer.
begin(), spContainer.
end(),
118 return Muon::MuonStationIndex::toStationIndex(bucket->msSector()->chamberIndex()) == station;
124 const EventContext& ctx{Gaudi::Hive::currentContext()};
134 ATH_MSG_DEBUG(
"Fill reconstructed tracks from "<<m_legacyTrackKey.fullKey());
136 m_legacyTrks->push_back(trk);
138 ATH_MSG_DEBUG(
"Fill reconstructed tracks from "<<m_TrackKeyR4.fullKey());
140 m_TrksSegmentR4->push_back(trk);
142 ATH_MSG_DEBUG(
"Fill reconstructed tracks from "<<m_TrackKeyHoughR4.fullKey());
143 if (trksFromHoughR4) {
145 m_TrksHoughR4->push_back(trk);
148 if (!m_truthKey.empty()) {
152 m_truthTrks->push_back(truth);
157 m_truthSegs->push_back(*seg);
163 m_nBucket = spContainer->size();
165 fillBucketsPerStation(*spContainer, StIdx::BI, m_nBucketBI);
166 fillBucketsPerStation(*spContainer, StIdx::BM, m_nBucketBM);
167 fillBucketsPerStation(*spContainer, StIdx::BO, m_nBucketBO);
168 fillBucketsPerStation(*spContainer, StIdx::BE, m_nBucketBE);
170 fillBucketsPerStation(*spContainer, StIdx::EI, m_nBucketEI);
171 fillBucketsPerStation(*spContainer,
StIdx::EM, m_nBucketEM);
172 fillBucketsPerStation(*spContainer,
StIdx::EO, m_nBucketEO);
173 fillBucketsPerStation(*spContainer, StIdx::EE, m_nBucketEE);
176 if(!m_tree.fill(ctx)) {
177 return StatusCode::FAILURE;
179 return StatusCode::SUCCESS;
183 return StatusCode::SUCCESS;