ATLAS Offline Software
Loading...
Searching...
No Matches
SpacePointMakerAlg.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 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{
35 public:
36 template <Acts::PointerConcept Prd_t>
37 using PrdVec_t = std::vector<Prd_t>;
38 template <typename T>
39 using EtaPhi2DHits = std::array<PrdVec_t<T>, 3>;
40 template <typename T>
41 using EtaPhi2DHitsVec = std::vector<EtaPhi2DHits<T>>;
42
43 using AthReentrantAlgorithm::AthReentrantAlgorithm;
45
46 StatusCode execute(const EventContext& ctx) const override;
47 StatusCode initialize() override;
48 StatusCode finalize() override;
49
50 private:
53 double spacePointWindow{0.8 * Gaudi::Units::m};
54 double maxBucketLength{2.0 * Gaudi::Units::m};
55 double spacePointOverlap{0.25 * Gaudi::Units::m};
56 };
57
60 double value{0.};
61 bool matched{false};
62 };
63
70 public:
76 void addToStat(const std::vector<SpacePoint>& spacePoints);
79 void dumpStatisics(MsgStream& msg) const;
80 private:
83 struct StatField{
85 unsigned measEtaPhi{0};
87 unsigned measEta{0};
89 unsigned measPhi{0};
92 unsigned allHits() const;
93 };
94
95 struct FieldKey{
98 StIdx_t stIdx{StIdx_t::StUnknown};
99 TechIdx_t techIdx{TechIdx_t::TechnologyUnknown};
100 int eta{0};
101 bool operator<(const FieldKey& other) const;
102 };
103
105 std::mutex m_mutex{};
106 using StatMap_t = std::map<FieldKey, StatField>;
108 };
109
114 std::vector<SpacePoint> etaHits{};
116 std::vector<SpacePoint> phiHits{};
117 };
118
119 using PreSortedSpacePointMap = std::unordered_map<const MuonGMR4::SpectrometerSector*, SpacePointsPerChamber>;
120
122 using SpacePointBucketVec = std::vector<SpacePointBucket>;
131 template <typename ContType>
132 StatusCode loadContainerAndSort(const EventContext& ctx,
134 PreSortedSpacePointMap& fillContainer) const;
142 template <typename PrdType>
144 const PrdVec_t<PrdType>& phiHits) const;
151 template <typename ContType>
159 template <typename PrdType>
161 const Amg::Transform3D& sectorTrans,
162 const PrdVec_t<const PrdType*>& prdsToFill,
163 std::vector<SpacePoint>& outColl) const;
174 SpacePointContainer& finalContainer) const;
180 void distributePrimaryPoints(std::vector<SpacePoint>&& spacePoints,
181 SpacePointBucketVec& splittedContainer) const;
186 void distributePhiPoints(std::vector<SpacePoint>&& spacePoints,
187 SpacePointBucketVec& splittedContainer) const;
188
194 bool splitBucket(const SpacePoint& spacePoint,
195 const double firstSpPos,
196 const SpacePointBucketVec& sortedPoints,
197 const BucketParameters& bucketParams) const;
204 void newBucket(const SpacePoint& refSp,
205 SpacePointBucketVec& sortedPoints,
206 const BucketParameters& bucketParams) const;
207
208 using BucketPatternMap = std::map<std::string, double, std::less<>>;
209
213 std::string chamberConfigKey(const MuonGMR4::Chamber& chamber) const;
214
218 std::optional<BucketParameters> resolveBucketParameters(const MuonGMR4::Chamber& chamber) const;
224 ResolvedParameter resolveParameter( const std::string_view chamberKey, const double defaultValue, const BucketPatternMap& patterns) const;
228 const BucketParameters& getBucketParameters(const SpacePoint& spacePoint) const;
229
231 "Key to the uncalibrated Drift circle measurements"};
232
234 "Key to the uncalibrated 1D rpc hits"};
235
237 "Key to the uncalibrated 1D tgc hits"};
238
240 "Key to the uncalibrated 1D Mm hits"};
241
242 SG::ReadHandleKey<xAOD::sTgcMeasContainer> m_stgcKey{this, "sTgcKey", "xAODsTgcMeasurements"};
243
244
245 ActsTrk::GeoContextReadKey_t m_geoCtxKey{this, "AlignmentKey", "ActsAlignment", "cond handle key"};
246
248
249 ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc{this, "IdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};
250
251 SG::WriteHandleKey<SpacePointContainer> m_writeKey{this, "WriteKey", "MuonSpacePoints"};
252
255 Gaudi::Property<double> m_spacePointWindow{this, "spacePointWindowSize", 0.8*Gaudi::Units::m,
256 "Maximal distance between consecutive hits in a bucket"};
257
259 Gaudi::Property<double> m_maxBucketLength{this, "maxBucketLength", 2.*Gaudi::Units::m,
260 "Maximal size of a space point bucket"};
261
264 Gaudi::Property<double> m_spacePointOverlap{this, "spacePointOverlap", 25.*Gaudi::Units::cm,
265 "Hits that are within <spacePointOverlap> of the bucket margin. "
266 "Are copied to the next bucket"};
267
269 Gaudi::Property<BucketPatternMap> m_spacePointWindowPatterns{ this, "spacePointWindowPatterns", {},
270 "Chamber-pattern dependent space point window. " "Examples: BML*=0.5, BIL_eta3_phi3=0.2"};
271
273 Gaudi::Property<BucketPatternMap> m_maxBucketLengthPatterns{ this, "maxBucketLengthPatterns", {},
274 "Chamber-pattern dependent max bucket length. " "Examples: BML*=0.5, BIL_eta3_phi3=0.2"};
275
277 Gaudi::Property<BucketPatternMap> m_spacePointOverlapPatterns{ this, "spacePointOverlapPatterns", {},
278 "Chamber-dependent overrides of spacePointOverlap" };
279
281 std::unordered_map<const MuonGMR4::Chamber*, BucketParameters> m_bucketParameters{};
284
285 Gaudi::Property<bool> m_doStat{this, "doStats", false,
286 "If enabled the algorithm keeps track how many hits have been made" };
287
288 Gaudi::Property<unsigned> m_capacityBucket{this,"CapacityBucket" , 50};
289 std::unique_ptr<SpacePointStatistics> m_statCounter ATLAS_THREAD_SAFE{};
290
291 Gaudi::Property<double> m_maxOccRpcEta{this, "maxRpcEtaOccupancy", 0.1,
292 "Maximum occpancy of Rpc eta hits in a gasGap"};
293 Gaudi::Property<double> m_maxOccRpcPhi{this, "maxRpcPhiOccupancy", 0.1,
294 "Maximum occpancy of Rpc phi hits in a gasGap"};
295
296 Gaudi::Property<double> m_maxOccTgcEta{this, "maxTgcEtaOccupancy", 0.1,
297 "Maximum occpancy of Tgc eta hits in a gasGap"};
298 Gaudi::Property<double> m_maxOccTgcPhi{this, "maxTgcPhiOccupancy", 0.1,
299 "Maximum occpancy of Tgc phi hits in a gasGap"};
300 };
301}
302
303
304#endif
Property holding a SG store/key/clid from which a WriteHandle is made.
An algorithm that can be simultaneously executed in multiple threads.
Chamber represent the volume enclosing a muon station.
Definition Chamber.h:29
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.
Data preparation algorithm that transforms the uncalibrated measurements into muon space points.
Gaudi::Property< double > m_maxOccRpcEta
BucketParameters m_defaultBucketParameters
Default bucket parameters used if no chamber-specific parameters are found, defaults into m_spacePoin...
std::unique_ptr< SpacePointStatistics > m_statCounter ATLAS_THREAD_SAFE
Gaudi::Property< double > m_maxOccTgcEta
const MuonGMR4::MuonDetectorManager * m_detMgr
Gaudi::Property< double > m_maxOccTgcPhi
Gaudi::Property< double > m_spacePointWindow
Default space point window size (Max distance between the two eta hits).
Gaudi::Property< bool > m_doStat
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
std::vector< EtaPhi2DHits< T > > EtaPhi2DHitsVec
SG::ReadHandleKey< xAOD::TgcStripContainer > m_tgcKey
bool splitBucket(const SpacePoint &spacePoint, const double firstSpPos, const SpacePointBucketVec &sortedPoints, const BucketParameters &bucketParams) const
Returns whether the space point is beyond the bucket boundary.
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
Default maximum bucket length (the width of the bucket in local y coordinate).
ResolvedParameter resolveParameter(const std::string_view chamberKey, const double defaultValue, const BucketPatternMap &patterns) const
Resolves a specific parameter for a given chamber key, based on the configured patterns.
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.
std::vector< SpacePointBucket > SpacePointBucketVec
Abrivation of a MuonSapcePoint bucket vector.
void fillUncombinedSpacePoints(const ActsTrk::GeometryContext &gctx, const Amg::Transform3D &sectorTrans, const PrdVec_t< const PrdType * > &prdsToFill, std::vector< SpacePoint > &outColl) const
Transform the uncombined space prd measurements to space points.
void newBucket(const SpacePoint &refSp, SpacePointBucketVec &sortedPoints, const BucketParameters &bucketParams) const
Closes the current processed bucket and creates a new one.
Gaudi::Property< BucketPatternMap > m_spacePointOverlapPatterns
Chamber-pattern dependent space point overlap.
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
Default space point overlap (the margin around the edge of the bucket which is also coppied into anot...
StatusCode execute(const EventContext &ctx) const override
std::optional< BucketParameters > resolveBucketParameters(const MuonGMR4::Chamber &chamber) const
Resolves the bucket parameters for a given chamber, based on the chamber key and the configured patte...
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.
StatusCode finalize() override
########################################## SpacePointMakerAlg #######################################...
const BucketParameters & getBucketParameters(const SpacePoint &spacePoint) const
Returns the bucket parameters for a given space point.
Gaudi::Property< BucketPatternMap > m_maxBucketLengthPatterns
Chamber-pattern dependent maximum bucket length.
std::string chamberConfigKey(const MuonGMR4::Chamber &chamber) const
Returns a string key for a chamber, based on the space point identifier.
Gaudi::Property< BucketPatternMap > m_spacePointWindowPatterns
Chamber-pattern dependent space point window.
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
ActsTrk::GeoContextReadKey_t m_geoCtxKey
std::map< std::string, double, std::less<> > BucketPatternMap
std::unordered_map< const MuonGMR4::Chamber *, BucketParameters > m_bucketParameters
Map of bucket parameters for each chamber.
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.
std::vector< std::string > patterns
Definition listroot.cxx:187
SG::ReadHandleKey< GeometryContext > GeoContextReadKey_t
Abrivate the ReadHandleKey to declare the data dependency on the Geometry context.
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 bucket parameters for a given chamber.
Helper struct to store the resolved bucket parameters for a given chamber.
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.