ATLAS Offline Software
Loading...
Searching...
No Matches
SpacePointMakerAlg.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4#ifndef MUONSPACEPOINTFORMATION_MUONSPACEPOINTMAKERALG_H
5#define MUONSPACEPOINTFORMATION_MUONSPACEPOINTMAKERALG_H
6
9
13#include "Acts/Utilities/PointerTraits.hpp"
14
15
16
26
27
28namespace MuonR4{
29
31 public:
32 template <Acts::PointerConcept Prd_t>
33 using PrdVec_t = std::vector<Prd_t>;
34 template <typename T>
35 using EtaPhi2DHits = std::array<PrdVec_t<T>, 3>;
36 template <typename T>
37 using EtaPhi2DHitsVec = std::vector<EtaPhi2DHits<T>>;
38
39 using AthReentrantAlgorithm::AthReentrantAlgorithm;
41
42 StatusCode execute(const EventContext& ctx) const override;
43 StatusCode initialize() override;
44 StatusCode finalize() override;
45
46 private:
53 public:
59 void addToStat(const std::vector<SpacePoint>& spacePoints);
62 void dumpStatisics(MsgStream& msg) const;
63 private:
66 struct StatField{
68 unsigned measEtaPhi{0};
70 unsigned measEta{0};
72 unsigned measPhi{0};
75 unsigned allHits() const;
76 };
77
78 struct FieldKey{
81 StIdx_t stIdx{StIdx_t::StUnknown};
82 TechIdx_t techIdx{TechIdx_t::TechnologyUnknown};
83 int eta{0};
84 bool operator<(const FieldKey& other) const;
85 };
86
88 std::mutex m_mutex{};
89 using StatMap_t = std::map<FieldKey, StatField>;
91 };
92
97 std::vector<SpacePoint> etaHits{};
99 std::vector<SpacePoint> phiHits{};
100 };
101
102 using PreSortedSpacePointMap = std::unordered_map<const MuonGMR4::SpectrometerSector*, SpacePointsPerChamber>;
103
105 using SpacePointBucketVec = std::vector<SpacePointBucket>;
114 template <typename ContType>
115 StatusCode loadContainerAndSort(const EventContext& ctx,
117 PreSortedSpacePointMap& fillContainer) const;
125 template <typename PrdType>
127 const PrdVec_t<PrdType>& phiHits) const;
134 template <typename ContType>
137 template <typename PrdType>
139 const Amg::Transform3D& sectorTrans,
140 const PrdVec_t<PrdType*>& prdsToFill,
141 std::vector<SpacePoint>& outColl) const;
152 SpacePointContainer& finalContainer) const;
158 void distributePrimaryPoints(std::vector<SpacePoint>&& spacePoints,
159 SpacePointBucketVec& splittedContainer) const;
164 void distributePhiPoints(std::vector<SpacePoint>&& spacePoints,
165 SpacePointBucketVec& splittedContainer) const;
166
170 bool splitBucket(const SpacePoint& spacePoint,
171 const double firstSpPos,
172 const SpacePointBucketVec& sortedPoints) const;
177 void newBucket(const SpacePoint& refSp,
178 SpacePointBucketVec& sortedPoints) const;
179
180
182 "Key to the uncalibrated Drift circle measurements"};
183
185 "Key to the uncalibrated 1D rpc hits"};
186
188 "Key to the uncalibrated 1D tgc hits"};
189
191 "Key to the uncalibrated 1D Mm hits"};
192
193 SG::ReadHandleKey<xAOD::sTgcMeasContainer> m_stgcKey{this, "sTgcKey", "xAODsTgcMeasurements"};
194
195
196 SG::ReadHandleKey<ActsTrk::GeometryContext> m_geoCtxKey{this, "AlignmentKey", "ActsAlignment", "cond handle key"};
197
198 ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc{this, "IdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};
199
200 SG::WriteHandleKey<SpacePointContainer> m_writeKey{this, "WriteKey", "MuonSpacePoints"};
201
202 Gaudi::Property<double> m_spacePointWindow{this, "spacePointWindowSize", 0.8*Gaudi::Units::m,
203 "Maximal distance between consecutive hits in a bucket"};
204
205 Gaudi::Property<double> m_maxBucketLength{this, "maxBucketLength", 2.*Gaudi::Units::m,
206 "Maximal size of a space point bucket"};
207
208 Gaudi::Property<double> m_spacePointOverlap{this, "spacePointOverlap", 25.*Gaudi::Units::cm,
209 "Hits that are within <spacePointOverlap> of the bucket margin. "
210 "Are copied to the next bucket"};
211
212 Gaudi::Property<bool> m_doStat{this, "doStats", false,
213 "If enabled the algorithm keeps track how many hits have been made" };
214
215 Gaudi::Property<unsigned> m_capacityBucket{this,"CapacityBucket" , 50};
216 std::unique_ptr<SpacePointStatistics> m_statCounter ATLAS_THREAD_SAFE{};
217
218 Gaudi::Property<double> m_maxOccRpcEta{this, "maxRpcEtaOccupancy", 0.1,
219 "Maximum occpancy of Rpc eta hits in a gasGap"};
220 Gaudi::Property<double> m_maxOccRpcPhi{this, "maxRpcPhiOccupancy", 0.1,
221 "Maximum occpancy of Rpc phi hits in a gasGap"};
222
223 Gaudi::Property<double> m_maxOccTgcEta{this, "maxTgcEtaOccupancy", 0.1,
224 "Maximum occpancy of Tgc eta hits in a gasGap"};
225 Gaudi::Property<double> m_maxOccTgcPhi{this, "maxTgcPhiOccupancy", 0.1,
226 "Maximum occpancy of Tgc phi hits in a gasGap"};
227
228 Gaudi::Property<double> m_maxOccStgcEta{this, "maxSTGCEtaOccupancy", 0.1,
229 "Maximum occpancy of sTgc eta hits in a gasGap"};
230 Gaudi::Property<double> m_maxOccStgcPhi{this, "maxSTGCPhiOccupancy", 0.5,
231 "Maximum occpancy of sTgc phi hits in a gasGap"};
232
233 };
234}
235
236
237#endif
Property holding a SG store/key/clid from which a WriteHandle is made.
An algorithm that can be simultaneously executed in multiple threads.
SpacePointStatistics(const Muon::IMuonIdHelperSvc *idHelperSvc)
Standard constructor.
void addToStat(const std::vector< SpacePoint > &spacePoints)
Adds the vector of space points to the overall statistics.
void dumpStatisics(MsgStream &msg) const
Print the statistics table of the built space points per category into the log-file / console.
Gaudi::Property< double > m_maxOccRpcEta
std::unique_ptr< SpacePointStatistics > m_statCounter ATLAS_THREAD_SAFE
Gaudi::Property< double > m_maxOccTgcEta
Gaudi::Property< double > m_maxOccTgcPhi
Gaudi::Property< double > m_maxOccStgcPhi
Gaudi::Property< double > m_spacePointWindow
Gaudi::Property< bool > m_doStat
SG::ReadHandleKey< ActsTrk::GeometryContext > m_geoCtxKey
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
void fillUncombinedSpacePoints(const ActsTrk::GeometryContext &gctx, const Amg::Transform3D &sectorTrans, const PrdVec_t< PrdType * > &prdsToFill, std::vector< SpacePoint > &outColl) const
Fills all space points that are beloni.
std::vector< EtaPhi2DHits< T > > EtaPhi2DHitsVec
SG::ReadHandleKey< xAOD::TgcStripContainer > m_tgcKey
void newBucket(const SpacePoint &refSp, SpacePointBucketVec &sortedPoints) const
Closes the current processed bucket and creates a new one.
void distributePhiPoints(std::vector< SpacePoint > &&spacePoints, SpacePointBucketVec &splittedContainer) const
Distributs the vector phi space points into the buckets.
Gaudi::Property< double > m_maxOccRpcPhi
Gaudi::Property< double > m_maxBucketLength
SG::ReadHandleKey< xAOD::MMClusterContainer > m_mmKey
bool passOccupancy2D(const PrdVec_t< PrdType > &etaHits, const PrdVec_t< PrdType > &phiHits) const
: Check whether the occupancy cuts of hits in a gasGap are surpassed.
bool splitBucket(const SpacePoint &spacePoint, const double firstSpPos, const SpacePointBucketVec &sortedPoints) const
Returns whether the space point is beyond the bucket boundary.
Gaudi::Property< double > m_maxOccStgcEta
std::vector< SpacePointBucket > SpacePointBucketVec
Abrivation of a MuonSapcePoint bucket vector.
SG::WriteHandleKey< SpacePointContainer > m_writeKey
StatusCode loadContainerAndSort(const EventContext &ctx, const SG::ReadHandleKey< ContType > &key, PreSortedSpacePointMap &fillContainer) const
Retrieve an uncalibrated measurement container <ContType> and fill the hits into the presorted space ...
SG::ReadHandleKey< xAOD::RpcMeasurementContainer > m_rpcKey
Gaudi::Property< double > m_spacePointOverlap
StatusCode execute(const EventContext &ctx) const override
std::vector< Prd_t > PrdVec_t
void distributePrimaryPoints(std::vector< SpacePoint > &&spacePoints, SpacePointBucketVec &splittedContainer) const
Distributes the vector of primary eta or eta + phi space points and fills them into the buckets.
StatusCode initialize() override
SG::ReadHandleKey< xAOD::sTgcMeasContainer > m_stgcKey
void distributePointsAndStore(SpacePointsPerChamber &&hitsPerChamber, SpacePointContainer &finalContainer) const
Distribute the premade spacepoints per chamber into their individual SpacePoint buckets.
EtaPhi2DHitsVec< typename ContType::const_value_type > splitHitsPerGasGap(xAOD::ChamberViewer< ContType > &viewer) const
Splits the chamber hits of the viewer per gas gap.
std::unordered_map< const MuonGMR4::SpectrometerSector *, SpacePointsPerChamber > PreSortedSpacePointMap
Container abrivation of the presorted space point container per MuonChambers.
std::array< PrdVec_t< T >, 3 > EtaPhi2DHits
Gaudi::Property< unsigned > m_capacityBucket
SG::ReadHandleKey< xAOD::MdtDriftCircleContainer > m_mdtKey
The muon space point is the combination of two uncalibrated measurements one of them measures the eta...
Interface for Helper service that creates muon Identifiers and can be used to print Identifiers.
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::Affine3d Transform3D
This header ties the generic definitions in this package.
DataVector< SpacePointBucket > SpacePointContainer
Abrivation of the space point container type.
StIndex
enum to classify the different station layers in the muon spectrometer
TechnologyIndex
enum to classify the different layers in the muon spectrometer
Helper struct to define the counting categories.
bool operator<(const FieldKey &other) const
################################################################ SpacePointStatistics ###############...
Helper struct to count the space-points in each detector category.
unsigned measEtaPhi
Number of space points measuring eta & phi.
unsigned measEta
Number of space points measuring eta only.
unsigned measPhi
Number of space points measuring phi only.
unsigned allHits() const
Helper method returning the sum of the three space point type counts.
: Helper struct to collect the space point per muon chamber, which are later sorted into the space po...
std::vector< SpacePoint > etaHits
Vector of all hits that contain an eta measurement including the ones which are combined with phi mea...
std::vector< SpacePoint > phiHits
Vector of all space points that are built from single phi hits.