ATLAS Offline Software
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 
20 namespace 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 {
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)) ||
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 {
63  } else
64  return mst1->globalPosition().perp() < mst2->globalPosition().perp();
65  }
66  }
67  }
68  SortMeas(const IMuonEDMHelperSvc* h, const IMuonIdHelperSvc* idh, bool end) :
70 
73  bool isEndcap;
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
Muon::MuonCandidate
Definition: MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonLayerEvent/MuonLayerEvent/MuonCandidate.h:14
ICombinedMuonTrackBuilder.h
Muon::IMuonEDMHelperSvc::getIdentifier
virtual Identifier getIdentifier(const Trk::MeasurementBase &meas) const =0
tries to get Identifier for measurement, if not possible it will return Identifier()
Muon::SortMeas::SortMeas
SortMeas(const IMuonEDMHelperSvc *h, const IMuonIdHelperSvc *idh, bool end)
Definition: MuonCandidateTrackBuilderTool.h:68
Muon::MuonCandidateTrackBuilderTool::buildCombinedTrack
virtual std::unique_ptr< Trk::Track > buildCombinedTrack(const EventContext &ctx, const Trk::Track &idTrack, const MuonCandidate &candidate) const override
IMuonCandidateTrackBuilderTool interface: buildCombinedTrack.
Definition: MuonCandidateTrackBuilderTool.cxx:29
Muon::IMuonEDMHelperSvc
Helper tool containing functionality needed by multiple tools.
Definition: IMuonEDMHelperSvc.h:33
MeasurementBase.h
Muon::MuonCandidateTrackBuilderTool::m_trackFitter
ToolHandle< Rec::ICombinedMuonTrackBuilder > m_trackFitter
Definition: MuonCandidateTrackBuilderTool.h:92
Trk::Track
The ATLAS Track class.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/Track.h:73
MuonEDMPrinterTool.h
Muon::IMuonIdHelperSvc::stationIndex
virtual MuonStationIndex::StIndex stationIndex(const Identifier &id) const =0
calculate station index from Identifier
RpcIdHelper::doubletZ
int doubletZ(const Identifier &id) const
Definition: RpcIdHelper.cxx:1062
Muon::SortMeas::m_idHelperSvc
const IMuonIdHelperSvc * m_idHelperSvc
Definition: MuonCandidateTrackBuilderTool.h:72
Muon::IMuonIdHelperSvc::isRpc
virtual bool isRpc(const Identifier &id) const =0
returns whether this is a RPC Identifier or not
Muon::SortMeas::operator()
bool operator()(const Trk::MeasurementBase *mst1, const Trk::MeasurementBase *mst2) const
Definition: MuonCandidateTrackBuilderTool.h:26
Muon
This class provides conversion from CSC RDO data to CSC Digits.
Definition: TrackSystemController.h:49
Muon::IMuonCandidateTrackBuilderTool
Interface for a tool to build tracks out of a MuonCandidate
Definition: IMuonCandidateTrackBuilderTool.h:18
Identifier::is_valid
bool is_valid() const
Check if id is in a valid state.
IMuonCandidateTrackBuilderTool.h
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
Muon::MuonCandidateTrackBuilderTool::m_edmHelperSvc
ServiceHandle< IMuonEDMHelperSvc > m_edmHelperSvc
Definition: MuonCandidateTrackBuilderTool.h:90
Muon::MuonCandidateTrackBuilderTool::m_printer
PublicToolHandle< MuonEDMPrinterTool > m_printer
Definition: MuonCandidateTrackBuilderTool.h:88
id2
HWIdentifier id2
Definition: LArRodBlockPhysicsV0.cxx:564
RpcIdHelper::doubletR
int doubletR(const Identifier &id) const
Definition: RpcIdHelper.cxx:1060
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
AthAlgTool.h
test_pyathena.parent
parent
Definition: test_pyathena.py:15
Muon::MuonCandidateTrackBuilderTool::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: MuonCandidateTrackBuilderTool.h:89
Muon::IMuonIdHelperSvc::chamberIndex
virtual MuonStationIndex::ChIndex chamberIndex(const Identifier &id) const =0
calculate chamber index from Identifier
Muon::MuonCandidateTrackBuilderTool::MuonCandidateTrackBuilderTool
MuonCandidateTrackBuilderTool(const std::string &type, const std::string &name, const IInterface *parent)
Default AlgTool functions.
Definition: MuonCandidateTrackBuilderTool.cxx:15
Muon::IMuonIdHelperSvc::isMdt
virtual bool isMdt(const Identifier &id) const =0
returns whether this is a MDT Identifier or not
Trk::MeasurementBase
Definition: MeasurementBase.h:58
Muon::MuonCandidateTrackBuilderTool::~MuonCandidateTrackBuilderTool
virtual ~MuonCandidateTrackBuilderTool()=default
IMuonEDMHelperSvc.h
Muon::IMuonIdHelperSvc::isSmallChamber
virtual bool isSmallChamber(const Identifier &id) const =0
returns whether this is a small chamber, always returns true for TGCs
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
Muon::SortMeas
Definition: MuonCandidateTrackBuilderTool.h:24
Trk::MeasurementBase::globalPosition
virtual const Amg::Vector3D & globalPosition() const =0
Interface method to get the global Position.
Muon::SortMeas::isEndcap
bool isEndcap
Definition: MuonCandidateTrackBuilderTool.h:73
Muon::MuonCandidateTrackBuilderTool
Definition: MuonCandidateTrackBuilderTool.h:76
Muon::SortMeas::m_edmHelperSvc
const IMuonEDMHelperSvc * m_edmHelperSvc
Definition: MuonCandidateTrackBuilderTool.h:71
h
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
Muon::IMuonIdHelperSvc
Interface for Helper service that creates muon Identifiers and can be used to print Identifiers.
Definition: IMuonIdHelperSvc.h:26
AthAlgTool
Definition: AthAlgTool.h:26
Muon::MuonCandidateTrackBuilderTool::m_reOrderMeasurements
Gaudi::Property< bool > m_reOrderMeasurements
Definition: MuonCandidateTrackBuilderTool.h:95
Muon::MuonCandidateTrackBuilderTool::initialize
virtual StatusCode initialize() override
Definition: MuonCandidateTrackBuilderTool.cxx:21
IMuonIdHelperSvc.h
Muon::IMuonIdHelperSvc::rpcIdHelper
virtual const RpcIdHelper & rpcIdHelper() const =0
access to RpcIdHelper
RpcIdHelper::doubletPhi
int doubletPhi(const Identifier &id) const
Definition: RpcIdHelper.cxx:1064
ServiceHandle< Muon::IMuonIdHelperSvc >