ATLAS Offline Software
Loading...
Searching...
No Matches
MuonCandidateTrackBuilderTool.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef MUON_MUONCANDIDATETRACKBUILDER_H
6#define MUON_MUONCANDIDATETRACKBUILDER_H
7
8#include <vector>
9
11#include "GaudiKernel/ServiceHandle.h"
12#include "GaudiKernel/ToolHandle.h"
19
20namespace Muon {
21
22 struct MuonCandidate;
23
24 class SortMeas {
25 public:
26 bool operator()(const Trk::MeasurementBase* mst1, const Trk::MeasurementBase* mst2) const {
27 if (isEndcap) {
28 return std::abs(mst1->globalPosition().z()) < std::abs(mst2->globalPosition().z());
29 } else {
30 Identifier id1 = m_edmHelperSvc->getIdentifier(*mst1);
31 Identifier id2 = m_edmHelperSvc->getIdentifier(*mst2);
32 // for pseudomeasurements
33 if (!id1.is_valid() || !id2.is_valid())
34 return std::abs(mst1->globalPosition().perp()) < std::abs(mst2->globalPosition().perp());
35 // use r value if both are mdts or if they belong to different chambers
36 // for the case where it's rpc and mdt from the same chamber, use the doublet R
37 if ((m_idHelperSvc->isMdt(id1) && m_idHelperSvc->isMdt(id2)) ||
38 m_idHelperSvc->chamberIndex(id1) != m_idHelperSvc->chamberIndex(id2))
39 return mst1->globalPosition().perp() < mst2->globalPosition().perp();
40 else if (m_idHelperSvc->isRpc(id1) && m_idHelperSvc->isMdt(id2)) {
41 if (m_idHelperSvc->rpcIdHelper().doubletR(id1) == 1) {
42 if (m_idHelperSvc->stationIndex(id2) == MuonStationIndex::StIndex::BM || m_idHelperSvc->isSmallChamber(id2))
43 return true;
44 else
45 return false;
46 } else
47 return false;
48 } else if (m_idHelperSvc->isRpc(id2) && m_idHelperSvc->isMdt(id1)) {
49 if (m_idHelperSvc->rpcIdHelper().doubletR(id2) == 1) {
50 if (m_idHelperSvc->stationIndex(id1) == MuonStationIndex::StIndex::BM || m_idHelperSvc->isSmallChamber(id1))
51 return false;
52 else
53 return true;
54 } else
55 return true;
56 } else {
57 if (m_idHelperSvc->rpcIdHelper().doubletR(id1) != m_idHelperSvc->rpcIdHelper().doubletR(id2)) {
58 return m_idHelperSvc->rpcIdHelper().doubletR(id1) < m_idHelperSvc->rpcIdHelper().doubletR(id2);
59 } else if (m_idHelperSvc->rpcIdHelper().doubletZ(id1) != m_idHelperSvc->rpcIdHelper().doubletZ(id2)) {
60 return m_idHelperSvc->rpcIdHelper().doubletZ(id1) < m_idHelperSvc->rpcIdHelper().doubletZ(id2);
61 } else if (m_idHelperSvc->rpcIdHelper().doubletPhi(id1) != m_idHelperSvc->rpcIdHelper().doubletPhi(id2)) {
62 return m_idHelperSvc->rpcIdHelper().doubletPhi(id1) < m_idHelperSvc->rpcIdHelper().doubletPhi(id2);
63 } else
64 return mst1->globalPosition().perp() < mst2->globalPosition().perp();
65 }
66 }
67 }
68 SortMeas(const IMuonEDMHelperSvc* h, const IMuonIdHelperSvc* idh, bool end) :
70
74 };
75
77 public:
79 MuonCandidateTrackBuilderTool(const std::string& type, const std::string& name, const IInterface* parent);
80 virtual ~MuonCandidateTrackBuilderTool() = default;
81 virtual StatusCode initialize() override;
82
84 virtual std::unique_ptr<Trk::Track> buildCombinedTrack(const EventContext& ctx, const Trk::Track& idTrack,
85 const MuonCandidate& candidate) const override;
86
87 private:
88 PublicToolHandle<MuonEDMPrinterTool> m_printer{this, "MuonEDMPrinterTool", "Muon::MuonEDMPrinterTool/MuonEDMPrinterTool"};
89 ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc{this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};
90 ServiceHandle<IMuonEDMHelperSvc> m_edmHelperSvc{this, "edmHelper", "Muon::MuonEDMHelperSvc/MuonEDMHelperSvc",
91 "Handle to the service providing the IMuonEDMHelperSvc interface"};
92 ToolHandle<Rec::ICombinedMuonTrackBuilder> m_trackFitter{this, "MuonTrackBuilder",
93 "Rec::CombinedMuonTrackBuilder/CombinedMuonTrackBuilder"};
94
95 Gaudi::Property<bool> m_reOrderMeasurements{this, "ReOrderMeasurements", true};
96 };
97} // namespace Muon
98
99#endif
HWIdentifier id2
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Header file for AthHistogramAlgorithm.
bool is_valid() const
Check if id is in a valid state.
Interface for a tool to build tracks out of a MuonCandidate.
Helper tool containing functionality needed by multiple tools.
Interface for Helper service that creates muon Identifiers and can be used to print Identifiers.
ServiceHandle< IMuonEDMHelperSvc > m_edmHelperSvc
PublicToolHandle< MuonEDMPrinterTool > m_printer
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
ToolHandle< Rec::ICombinedMuonTrackBuilder > m_trackFitter
virtual ~MuonCandidateTrackBuilderTool()=default
MuonCandidateTrackBuilderTool(const std::string &type, const std::string &name, const IInterface *parent)
Default AlgTool functions.
virtual std::unique_ptr< Trk::Track > buildCombinedTrack(const EventContext &ctx, const Trk::Track &idTrack, const MuonCandidate &candidate) const override
IMuonCandidateTrackBuilderTool interface: buildCombinedTrack.
SortMeas(const IMuonEDMHelperSvc *h, const IMuonIdHelperSvc *idh, bool end)
bool operator()(const Trk::MeasurementBase *mst1, const Trk::MeasurementBase *mst2) const
const IMuonEDMHelperSvc * m_edmHelperSvc
const IMuonIdHelperSvc * m_idHelperSvc
This class is the pure abstract base class for all fittable tracking measurements.
virtual const Amg::Vector3D & globalPosition() const =0
Interface method to get the global Position.
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.