34 MuonHitTesterAlg::~MuonHitTesterAlg() =
default;
39 m_tree.addBranch(std::make_shared<EventInfoBranch>(m_tree, evOpts,m_evtKey.key()));
46 return StatusCode::SUCCESS;
50 return StatusCode::SUCCESS;
52 if (m_writeTruthMuon) {
53 m_truthParts = std::make_shared<ParticleVariables>(m_tree, m_truthMuonCont,
"truthMuon", msgLevel());
54 m_truthParts->addVariable<
int>(
"truthOrigin");
55 m_truthParts->addVariable<
int>(
"truthType");
56 m_tree.addBranch(m_truthParts);
58 if (m_writeTruthSeg) {
59 m_truthSegs = std::make_shared<SegmentVariables>(m_tree, m_truthSegCont,
"truthSegment", msgLevel());
60 if (m_writeTruthMuon) {
62 m_tree,
std::format(
"{}_truthLink", m_truthSegs->name()),
64 static const TruthLinkDecor_t acc{
"truthParticleLink"};
68 return m_truthParts->push_back(*
acc(seg));
71 m_tree.addBranch(m_truthSegs);
73 return StatusCode::SUCCESS;
76 if (!m_writeSimHits || !m_isMC){
77 return StatusCode::SUCCESS;
80 auto testerBr = std::make_shared<SimHitTester>(m_tree,
key,
type, msgLevel());
85 const auto hitSet = MuonR4::getMatchingSimHits(seg);
86 std::vector<const xAOD::MuonSimHit*> sortedHits{};
88 return m_detMgr->getReadoutElement(hit->identify())->detectorType() == type;
91 return a->identify() < b->identify();
93 std::vector<unsigned short> matchIds{};
95 return testerBr->push_back(*hit);
100 m_tree.addBranch(std::move(testerBr));
111 if (m_writesTgcSim) {
117 return StatusCode::SUCCESS;
120 if (!m_writeDigits) {
121 return StatusCode::SUCCESS;
123 if (m_writeMdtDigits) {
124 m_tree.addBranch(std::make_shared<MdtDigitVariables>(m_tree, m_mdtDigitKey, msgLevel()));
126 if (m_writeRpcDigits) {
127 m_tree.addBranch(std::make_shared<RpcDigitVariables>(m_tree, m_rpcDigitKey, msgLevel()));
129 if (m_writeTgcDigits) {
130 m_tree.addBranch(std::make_shared<TgcDigitVariables>(m_tree, m_tgcDigitKey, msgLevel()));
132 if (m_writeMmDigits) {
133 m_tree.addBranch(std::make_shared<MMDigitVariables>(m_tree, m_mmDigitKey, msgLevel()));
135 if (m_writesTgcDigits) {
136 m_tree.addBranch(std::make_shared<sTgcDigitVariables>(m_tree, m_sTgcDigitKey, msgLevel()));
138 return StatusCode::SUCCESS;
142 return StatusCode::SUCCESS;
144 if (m_writeMdtPrds) {
145 m_tree.addBranch(std::make_shared<MdtDriftCircleVariables>(m_tree, m_mdtPrdKey, msgLevel()));
146 m_tree.addBranch(std::make_shared<MdtTwinDriftCircleVariables>(m_tree, m_mdtTwinPrdKey, msgLevel()));
148 if (m_writeRpcPrds) {
149 m_tree.addBranch(std::make_shared<RpcMeasurementVariables>(m_tree, m_rpcPrdKey, msgLevel()));
151 if (m_writeTgcPrds) {
152 m_tree.addBranch(std::make_shared<TgcStripVariables>(m_tree, m_tgcPrdKey, msgLevel()));
155 m_tree.addBranch(std::make_shared<MmClusterVariables>(m_tree, m_mmPrdKey, msgLevel()));
157 return StatusCode::SUCCESS;
161 return StatusCode::SUCCESS;
164 const EventContext& ctx{Gaudi::Hive::currentContext()};
165 return m_tree.fill(ctx) ? StatusCode::SUCCESS : StatusCode::FAILURE;