ATLAS Offline Software
Loading...
Searching...
No Matches
MSVertexRecoTool.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5#pragma once
6
9
12
13#include "GaudiKernel/SystemOfUnits.h"
14#include "GaudiKernel/ServiceHandle.h"
15#include "GaudiKernel/ToolHandle.h"
18
24
26#include "xAODTracking/Vertex.h"
28
32
33#include <optional>
34#include <vector>
35#include <string>
36#include <memory>
37
38
39namespace Muon {
40
41 class MSVertexRecoTool : virtual public IMSVertexRecoTool, public AthAlgTool {
42
43 public:
44 MSVertexRecoTool(const std::string &type, const std::string &name, const IInterface *parent);
45 virtual ~MSVertexRecoTool() = default;
46
47 virtual StatusCode initialize(void) override;
48 StatusCode findMSvertices(const std::vector<Tracklet> &tracklets, std::vector<std::unique_ptr<MSVertex>> &vertices,
49 const EventContext &ctx) const override;
50
51 struct TrkCluster {
52 double eta{0.};
53 double phi{0.};
54 unsigned int ntrks{0};
55 bool isSystematic{false};
56 std::vector<Tracklet> tracks;
57
58 TrkCluster() = default;
59 };
60
61 private:
62 SG::WriteHandleKey<xAOD::VertexContainer> m_xAODContainerKey{this, "xAODVertexContainer", "MSDisplacedVertex"};
63
67
68 // count hits (total, inwards of the vertex and split by layer) around vertex
69 const std::vector<std::string> m_accMDT_str = {"nMDT", "nMDT_inwards", "nMDT_I", "nMDT_E", "nMDT_M", "nMDT_O"};
70 const std::vector<std::string> m_accRPC_str = {"nRPC", "nRPC_inwards", "nRPC_I", "nRPC_E", "nRPC_M", "nRPC_O"};
71 const std::vector<std::string> m_accTGC_str = {"nTGC", "nTGC_inwards", "nTGC_I", "nTGC_E", "nTGC_M", "nTGC_O"};
72
73 std::vector<SG::AuxElement::Accessor<int>> m_nMDT_accs;
74 std::vector<SG::AuxElement::Accessor<int>> m_nRPC_accs;
75 std::vector<SG::AuxElement::Accessor<int>> m_nTGC_accs;
76
77 ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc{this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};
78 ServiceHandle<IAthRNGSvc> m_rndmSvc{this, "RndmSvc", "AthRNGSvc", "Random Number Service"}; // Random number service
79 ToolHandle<Trk::IExtrapolator> m_extrapolator{this, "MyExtrapolator", "Trk::Extrapolator/AtlasExtrapolator"};
80
81
82 // cuts to prevent excessive processing timing
83 Gaudi::Property<unsigned int> m_maxGlobalTracklets{this, "MaxGlobalTracklets", 40, "maximal number of tracklets in an event"};
84 Gaudi::Property<unsigned int> m_maxClusterTracklets{this, "MaxClusterTracklets", 50, "maximal number of tracklets in a cluster"}; // check if this makes sense to be large than m_maxGlobalTracklets
85 // high occupancy definitions
86 Gaudi::Property<double> m_ChamberOccupancyMin{this, "MinimumHighOccupancy", 0.25, "minimum occupancy to be considered 'high occupancy'"};
87 Gaudi::Property<int> m_minHighOccupancyChambers{this, "MinimumNumberOfHighOccupancy", 2, "number of high occupancy chambers required to be signal like"};
88 // clustering properties
89 Gaudi::Property<double> m_ClusterdEta{this, "ClusterdEta", 0.7, "eta extend of cluster"};
90 Gaudi::Property<double> m_ClusterdPhi{this, "ClusterdPhi", M_PI / 3.*Gaudi::Units::radian, "phi extend of cluster"};
91 // options to calculate vertex systematic uncertainty from the tracklet reco uncertainty
92 Gaudi::Property<bool> m_doSystematics{this, "DoSystematicUncertainty", false, "find vertex systematic uncertainty"};
93 Gaudi::Property<double> m_BarrelTrackletUncert{this, "BarrelTrackletUncertainty", 0.1, "probability of considering a barrel tracklet in the clustering for the systematics reconstruction"};
94 Gaudi::Property<double> m_EndcapTrackletUncert{this, "EndcapTrackletUncertainty", 0.1, "probability of considering a endcap tracklet in the clustering for the systematics reconstruction"};
95 // properties for vertex fitting
96 Gaudi::Property<double> m_TrackPhiAngle{this, "TrackPhiAngle", 0.0*Gaudi::Units::radian, "nominal phi angle for tracklets in rad"};
97 Gaudi::Property<double> m_TrackPhiRotation{this, "TrackPhiRotation", 0.2*Gaudi::Units::radian, "angle to rotate tracklets by for uncertainty estimate in rad"};
98 Gaudi::Property<double> m_MaxTrackUncert{this, "MaxTrackUncert", 200.*Gaudi::Units::millimeter, "maximal tracklet uncertainty in mm"};
99 Gaudi::Property<double> m_VxChi2ProbCUT{this, "VxChi2ProbabilityCut", 0.05, "chi^2 probability cut"};
100 Gaudi::Property<double> m_VertexMinRadialPlane{this, "VertexMinRadialPlane", 3500.*Gaudi::Units::millimeter, "position of first radial plane in mm"};
101 Gaudi::Property<double> m_VertexMaxRadialPlane{this, "VertexMaxRadialPlane", 7000.*Gaudi::Units::millimeter, "position of last radial plane in mm"};
102 Gaudi::Property<double> m_VxPlaneDist{this, "VertexPlaneDist", 200.*Gaudi::Units::millimeter, "distance between two adjacent planes in mm"};
103 Gaudi::Property<double> m_MaxTollDist{this, "MaxTollDist", 300.*Gaudi::Units::millimeter, "maximal distance between tracklet and endcap vertex in mm"};
104 Gaudi::Property<bool> m_useOldMSVxEndcapMethod{this, "UseOldMSVxEndcapMethod", false, "use old vertex reconstruction in the endcaps "};
105 // number of hits near vertex
106 Gaudi::Property<double> m_nMDTHitsEta{this, "nMDTHitsEta", 0.6, "max eta extend between vertex and MDT hit"};
107 Gaudi::Property<double> m_nMDTHitsPhi{this, "nMDTHitsPhi", 0.6*Gaudi::Units::radian, "max phi extend between vertex and MDT hit"};
108 Gaudi::Property<double> m_nTrigHitsdR{this, "nTrigHitsdR", 0.6*Gaudi::Units::radian, "max delta R between vertex and trigger chamber (RPC or TGC) hit"};
109 // minimal good vertex criteria
110 Gaudi::Property<int> m_MinMDTHits{this, "MinMDTHits", 250, "minimal number of MDT hits"};
111 Gaudi::Property<int> m_MinTrigHits{this, "MinTrigHits", 200, "minimal number of trigger chamber (RPC+TGC) hits"};
112 Gaudi::Property<double> m_MaxLxyEndcap{this, "MaxLxyEndcap", 10000*Gaudi::Units::millimeter, "maximal transverse distance for endcap vertex in mm"};
113 Gaudi::Property<double> m_MinZEndcap{this, "MinZEndcap", 8000*Gaudi::Units::millimeter, "minimal longitudinal distance for endcap vertex in mm"};
114 Gaudi::Property<double> m_MaxZEndcap{this, "MaxZEndcap", 14000*Gaudi::Units::millimeter, "maximal longitudinal distance for endcap vertex in mm"};
115
116
117 // group tracklets into clusters -- vertex reco runs on each cluster of tracklets
118 std::vector<TrkCluster> findTrackClusters(const std::vector<Tracklet> &tracklets) const;
119 std::optional<TrkCluster> ClusterizeTracks(std::vector<Tracklet> &tracks) const; // core algorithm for creating the clusters
120 // barrel vertex reco algorithm
121 void MSVxFinder(const std::vector<Tracklet> &tracklets, std::unique_ptr<MSVertex> &vtx, const EventContext &ctx) const;
122 // endcap vertex reco algorithm
123 void MSStraightLineVx(const std::vector<Tracklet> &trks, std::unique_ptr<MSVertex> &vtx, const EventContext &ctx) const;
124 void MSStraightLineVx_oldMethod(const std::vector<Tracklet> &trks, std::unique_ptr<MSVertex> &vtx, const EventContext &ctx) const;
125 static Amg::Vector3D VxMinQuad(const std::vector<Tracklet> &tracks) ; // endcap vertex reco core
126 std::vector<Tracklet> RemoveBadTrk(const std::vector<Tracklet> &tracklets, const Amg::Vector3D &Vx) const;
127 bool EndcapHasBadTrack(const std::vector<Tracklet> &tracklets, const Amg::Vector3D &Vx) const;
128 // tools
129 void HitCounter(MSVertex *MSRecoVx, const EventContext &ctx) const; // counts MDT, RPC & TGC around a reco'd vertex
130 double vxPhiFinder(const double theta, const double phi, const EventContext &ctx) const; // vertex phi location reco algorithm
131 std::vector<Tracklet> getTracklets(const std::vector<Tracklet> &trks, const std::set<int> &tracklet_subset) const;
132 void dressVtxHits(xAOD::Vertex* xAODVx, const std::vector<SG::AuxElement::Accessor<int>>& accs, const std::vector<int>& hits) const;
133 StatusCode FillOutputContainer(const std::vector<std::unique_ptr<MSVertex>> &, SG::WriteHandle<xAOD::VertexContainer> &xAODVxContainer) const;
134 };
135
136} // namespace Muon
#define M_PI
Scalar phi() const
phi method
Scalar theta() const
theta method
Property holding a SG store/key/clid from which a ReadHandle is made.
Property holding a SG store/key/clid from which a WriteHandle is made.
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
The IMSVertexRecoTool is a pure virtual interface.
Gaudi::Property< double > m_ChamberOccupancyMin
Gaudi::Property< double > m_nMDTHitsPhi
Gaudi::Property< bool > m_useOldMSVxEndcapMethod
void dressVtxHits(xAOD::Vertex *xAODVx, const std::vector< SG::AuxElement::Accessor< int > > &accs, const std::vector< int > &hits) const
Gaudi::Property< double > m_MaxZEndcap
virtual StatusCode initialize(void) override
Gaudi::Property< double > m_VertexMaxRadialPlane
Gaudi::Property< int > m_minHighOccupancyChambers
StatusCode findMSvertices(const std::vector< Tracklet > &tracklets, std::vector< std::unique_ptr< MSVertex > > &vertices, const EventContext &ctx) const override
double vxPhiFinder(const double theta, const double phi, const EventContext &ctx) const
Gaudi::Property< int > m_MinTrigHits
Gaudi::Property< double > m_nMDTHitsEta
Gaudi::Property< double > m_MaxTollDist
StatusCode FillOutputContainer(const std::vector< std::unique_ptr< MSVertex > > &, SG::WriteHandle< xAOD::VertexContainer > &xAODVxContainer) const
std::vector< Tracklet > RemoveBadTrk(const std::vector< Tracklet > &tracklets, const Amg::Vector3D &Vx) const
bool EndcapHasBadTrack(const std::vector< Tracklet > &tracklets, const Amg::Vector3D &Vx) const
std::vector< Tracklet > getTracklets(const std::vector< Tracklet > &trks, const std::set< int > &tracklet_subset) const
void MSStraightLineVx(const std::vector< Tracklet > &trks, std::unique_ptr< MSVertex > &vtx, const EventContext &ctx) const
Gaudi::Property< double > m_MinZEndcap
Gaudi::Property< double > m_VxChi2ProbCUT
std::optional< TrkCluster > ClusterizeTracks(std::vector< Tracklet > &tracks) const
SG::ReadHandleKey< Muon::MdtPrepDataContainer > m_mdtTESKey
Gaudi::Property< double > m_TrackPhiRotation
Gaudi::Property< unsigned int > m_maxClusterTracklets
Gaudi::Property< double > m_EndcapTrackletUncert
std::vector< SG::AuxElement::Accessor< int > > m_nRPC_accs
Gaudi::Property< double > m_ClusterdPhi
void MSVxFinder(const std::vector< Tracklet > &tracklets, std::unique_ptr< MSVertex > &vtx, const EventContext &ctx) const
SG::ReadHandleKey< Muon::RpcPrepDataContainer > m_rpcTESKey
void HitCounter(MSVertex *MSRecoVx, const EventContext &ctx) const
Gaudi::Property< unsigned int > m_maxGlobalTracklets
Gaudi::Property< double > m_TrackPhiAngle
virtual ~MSVertexRecoTool()=default
Gaudi::Property< double > m_MaxTrackUncert
const std::vector< std::string > m_accMDT_str
Gaudi::Property< double > m_MaxLxyEndcap
Gaudi::Property< double > m_VertexMinRadialPlane
SG::ReadHandleKey< Muon::TgcPrepDataContainer > m_tgcTESKey
Gaudi::Property< bool > m_doSystematics
static Amg::Vector3D VxMinQuad(const std::vector< Tracklet > &tracks)
void MSStraightLineVx_oldMethod(const std::vector< Tracklet > &trks, std::unique_ptr< MSVertex > &vtx, const EventContext &ctx) const
std::vector< SG::AuxElement::Accessor< int > > m_nMDT_accs
Gaudi::Property< double > m_nTrigHitsdR
const std::vector< std::string > m_accTGC_str
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
std::vector< SG::AuxElement::Accessor< int > > m_nTGC_accs
Gaudi::Property< double > m_VxPlaneDist
ServiceHandle< IAthRNGSvc > m_rndmSvc
ToolHandle< Trk::IExtrapolator > m_extrapolator
SG::WriteHandleKey< xAOD::VertexContainer > m_xAODContainerKey
Gaudi::Property< double > m_BarrelTrackletUncert
MSVertexRecoTool(const std::string &type, const std::string &name, const IInterface *parent)
const std::vector< std::string > m_accRPC_str
Gaudi::Property< int > m_MinMDTHits
Gaudi::Property< double > m_ClusterdEta
std::vector< TrkCluster > findTrackClusters(const std::vector< Tracklet > &tracklets) const
SG::Accessor< T, ALLOC > Accessor
Definition AuxElement.h:572
Property holding a SG store/key/clid from which a ReadHandle is made.
Property holding a SG store/key/clid from which a WriteHandle is made.
Eigen::Matrix< double, 3, 1 > Vector3D
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
Vertex_v1 Vertex
Define the latest version of the vertex class.