ATLAS Offline Software
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 
14 
15 
24 
25 
26 namespace MuonR4{
28  public:
29  using AthReentrantAlgorithm::AthReentrantAlgorithm;
30 
31  ~SpacePointMakerAlg() = default;
32 
33  StatusCode execute(const EventContext& ctx) const override;
34  StatusCode initialize() override;
35  StatusCode finalize() override;
36 
37  private:
44  public:
48  SpacePointStatistics(const Muon::IMuonIdHelperSvc* idHelperSvc);
50  void addToStat(const std::vector<SpacePoint>& spacePoints);
53  void dumpStatisics(MsgStream& msg) const;
54  private:
57  struct StatField{
59  unsigned measEtaPhi{0};
61  unsigned measEta{0};
63  unsigned measPhi{0};
66  unsigned allHits() const;
67  };
69  struct FieldKey{
72  StIdx_t stIdx{StIdx_t::StUnknown};
73  TechIdx_t techIdx{TechIdx_t::TechnologyUnknown};
74  int eta{0};
75  bool operator<(const FieldKey& other) const;
76  };
77 
80  using StatMap_t = std::map<FieldKey, StatField>;
82  };
88  std::vector<SpacePoint> etaHits{};
90  std::vector<SpacePoint> phiHits{};
91  };
93  using PreSortedSpacePointMap = std::unordered_map<const MuonGMR4::SpectrometerSector*, SpacePointsPerChamber>;
94 
96  using SpacePointBucketVec = std::vector<SpacePointBucket>;
105  template <class ContType>
106  StatusCode loadContainerAndSort(const EventContext& ctx,
116  template <class PrdType>
117  bool passOccupancy2D(const std::vector<const PrdType*>& etaHits,
118  const std::vector<const PrdType*>& phiHits) const;
120  template <class PrdType>
122  const Amg::Transform3D& sectorTrans,
123  const std::vector<const PrdType*>& prdsToFill,
124  std::vector<SpacePoint>& outColl) const;
134  void distributePointsAndStore(SpacePointsPerChamber&& hitsPerChamber,
135  SpacePointContainer& finalContainer) const;
141  void distributePrimaryPoints(std::vector<SpacePoint>&& spacePoints,
142  SpacePointBucketVec& splittedContainer) const;
147  void distributePhiPoints(std::vector<SpacePoint>&& spacePoints,
148  SpacePointBucketVec& splittedContainer) const;
149 
153  bool splitBucket(const SpacePoint& spacePoint,
154  const double firstSpPos,
155  const SpacePointBucketVec& sortedPoints) const;
160  void newBucket(const SpacePoint& refSp,
161  SpacePointBucketVec& sortedPoints) const;
162 
163 
164  SG::ReadHandleKey<xAOD::MdtDriftCircleContainer> m_mdtKey{this, "MdtKey", "xMdtMeasurements",
165  "Key to the uncalibrated Drift circle measurements"};
166 
167  SG::ReadHandleKey<xAOD::RpcMeasurementContainer> m_rpcKey{this, "RpcKey", "xRpcMeasurements",
168  "Key to the uncalibrated 1D rpc hits"};
169 
171  "Key to the uncalibrated 1D tgc hits"};
172 
173  SG::ReadHandleKey<xAOD::MMClusterContainer> m_mmKey{this, "MmKey", "xAODMMClusters",
174  "Key to the uncalibrated 1D Mm hits"};
175 
176  SG::ReadHandleKey<xAOD::sTgcMeasContainer> m_stgcKey{this, "sTgcKey", "xAODsTgcMeasurements"};
177 
178 
179  SG::ReadHandleKey<ActsGeometryContext> m_geoCtxKey{this, "AlignmentKey", "ActsAlignment", "cond handle key"};
180 
181  ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc{this, "IdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};
182 
183  SG::WriteHandleKey<SpacePointContainer> m_writeKey{this, "WriteKey", "MuonSpacePoints"};
184 
185  Gaudi::Property<double> m_spacePointWindow{this, "spacePointWindowSize", 0.8*Gaudi::Units::m,
186  "Maximal distance between consecutive hits in a bucket"};
187 
188  Gaudi::Property<double> m_maxBucketLength{this, "maxBucketLength", 2.*Gaudi::Units::m,
189  "Maximal size of a space point bucket"};
190 
191  Gaudi::Property<double> m_spacePointOverlap{this, "spacePointOverlap", 25.*Gaudi::Units::cm,
192  "Hits that are within <spacePointOverlap> of the bucket margin. "
193  "Are copied to the next bucket"};
194 
195  Gaudi::Property<bool> m_doStat{this, "doStats", false,
196  "If enabled the algorithm keeps track how many hits have been made" };
197 
198  Gaudi::Property<unsigned> m_capacityBucket{this,"CapacityBucket" , 50};
199  std::unique_ptr<SpacePointStatistics> m_statCounter ATLAS_THREAD_SAFE{};
200 
201  Gaudi::Property<double> m_maxOccRpcEta{this, "maxRpcEtaOccupancy", 0.1,
202  "Maximum occpancy of Rpc eta hits in a gasGap"};
203  Gaudi::Property<double> m_maxOccRpcPhi{this, "maxRpcPhiOccupancy", 0.1,
204  "Maximum occpancy of Rpc phi hits in a gasGap"};
205 
206  Gaudi::Property<double> m_maxOccTgcEta{this, "maxTgcEtaOccupancy", 0.1,
207  "Maximum occpancy of Tgc eta hits in a gasGap"};
208  Gaudi::Property<double> m_maxOccTgcPhi{this, "maxTgcPhiOccupancy", 0.1,
209  "Maximum occpancy of Tgc phi hits in a gasGap"};
210 
211  Gaudi::Property<double> m_maxOccStgcEta{this, "maxSTGCEtaOccupancy", 0.1,
212  "Maximum occpancy of sTgc eta hits in a gasGap"};
213  Gaudi::Property<double> m_maxOccStgcPhi{this, "maxSTGCPhiOccupancy", 0.1,
214  "Maximum occpancy of sTgc phi hits in a gasGap"};
215 
216  };
217 }
218 
219 
220 #endif
MuonR4::SpacePointMakerAlg::SpacePointStatistics::StatField::allHits
unsigned allHits() const
Helper method returning the sum of the three space point type counts.
Definition: SpacePointMakerAlg.cxx:113
MuonR4::SpacePointMakerAlg::PreSortedSpacePointMap
std::unordered_map< const MuonGMR4::SpectrometerSector *, SpacePointsPerChamber > PreSortedSpacePointMap
Container abrivation of the presorted space point container per MuonChambers.
Definition: SpacePointMakerAlg.h:93
MuonR4::SpacePointMakerAlg::SpacePointStatistics::FieldKey::operator<
bool operator<(const FieldKey &other) const
Definition: SpacePointMakerAlg.cxx:104
MuonR4::SpacePointMakerAlg::m_stgcKey
SG::ReadHandleKey< xAOD::sTgcMeasContainer > m_stgcKey
Definition: SpacePointMakerAlg.h:176
MuonR4::SpacePointMakerAlg::SpacePointStatistics::addToStat
void addToStat(const std::vector< SpacePoint > &spacePoints)
Adds the vector of space points to the overall statistics.
Definition: SpacePointMakerAlg.cxx:119
ActsGeometryContext.h
MuonR4::SpacePointMakerAlg::SpacePointStatistics::m_mutex
std::mutex m_mutex
Definition: SpacePointMakerAlg.h:79
BeamSpot::mutex
std::mutex mutex
Definition: InDetBeamSpotVertex.cxx:18
MuonR4::SpacePointMakerAlg::initialize
StatusCode initialize() override
Definition: SpacePointMakerAlg.cxx:170
MuonR4::SpacePointMakerAlg::execute
StatusCode execute(const EventContext &ctx) const override
Definition: SpacePointMakerAlg.cxx:404
MuonR4::SpacePointMakerAlg::distributePrimaryPoints
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.
Definition: SpacePointMakerAlg.cxx:510
MuonR4::SpacePointMakerAlg::splitBucket
bool splitBucket(const SpacePoint &spacePoint, const double firstSpPos, const SpacePointBucketVec &sortedPoints) const
Returns whether the space point is beyond the bucket boundary.
Definition: SpacePointMakerAlg.cxx:471
Muon::MuonStationIndex::TechnologyIndex
TechnologyIndex
enum to classify the different layers in the muon spectrometer
Definition: MuonStationIndex.h:54
MuonR4::SpacePointMakerAlg::m_maxOccStgcPhi
Gaudi::Property< double > m_maxOccStgcPhi
Definition: SpacePointMakerAlg.h:213
MuonR4::SpacePointMakerAlg::ATLAS_THREAD_SAFE
std::unique_ptr< SpacePointStatistics > m_statCounter ATLAS_THREAD_SAFE
Definition: SpacePointMakerAlg.h:199
MuonR4::SpacePointMakerAlg::SpacePointStatistics::m_idHelperSvc
const Muon::IMuonIdHelperSvc * m_idHelperSvc
Definition: SpacePointMakerAlg.h:78
MuonR4::SpacePointMakerAlg::SpacePointsPerChamber::etaHits
std::vector< SpacePoint > etaHits
Vector of all hits that contain an eta measurement including the ones which are combined with phi mea...
Definition: SpacePointMakerAlg.h:88
SpacePoint.h
MuonR4::SpacePointMakerAlg::m_rpcKey
SG::ReadHandleKey< xAOD::RpcMeasurementContainer > m_rpcKey
Definition: SpacePointMakerAlg.h:167
MuonR4::SpacePointMakerAlg::distributePhiPoints
void distributePhiPoints(std::vector< SpacePoint > &&spacePoints, SpacePointBucketVec &splittedContainer) const
Distributs the vector phi space points into the buckets.
Definition: SpacePointMakerAlg.cxx:455
MuonR4::SpacePointMakerAlg::SpacePointStatistics::StatField::measEtaPhi
unsigned measEtaPhi
Number of space points measuring eta & phi.
Definition: SpacePointMakerAlg.h:59
SG::ReadHandleKey
Property holding a SG store/key/clid from which a ReadHandle is made.
Definition: StoreGate/StoreGate/ReadHandleKey.h:39
sTgcMeasContainer.h
MuonR4::SpacePointMakerAlg::m_mmKey
SG::ReadHandleKey< xAOD::MMClusterContainer > m_mmKey
Definition: SpacePointMakerAlg.h:173
MuonR4::SpacePointMakerAlg::SpacePointStatistics::StatMap_t
std::map< FieldKey, StatField > StatMap_t
Definition: SpacePointMakerAlg.h:80
MuonR4::SpacePointMakerAlg::newBucket
void newBucket(const SpacePoint &refSp, SpacePointBucketVec &sortedPoints) const
Closes the current processed bucket and creates a new one.
Definition: SpacePointMakerAlg.cxx:485
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:74
RpcMeasurementContainer.h
cm
const double cm
Definition: Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/FCAL_ChannelMap.cxx:25
GeoPrimitives.h
MuonR4::SpacePointMakerAlg::SpacePointBucketVec
std::vector< SpacePointBucket > SpacePointBucketVec
Abrivation of a MuonSapcePoint bucket vector.
Definition: SpacePointMakerAlg.h:96
MuonR4::SpacePointMakerAlg::SpacePointsPerChamber
: Helper struct to collect the space point per muon chamber, which are later sorted into the space po...
Definition: SpacePointMakerAlg.h:85
MuonR4::SpacePointMakerAlg::m_tgcKey
SG::ReadHandleKey< xAOD::TgcStripContainer > m_tgcKey
Definition: SpacePointMakerAlg.h:170
MuonR4::SpacePointMakerAlg::m_writeKey
SG::WriteHandleKey< SpacePointContainer > m_writeKey
Definition: SpacePointMakerAlg.h:183
MuonR4::SpacePointMakerAlg::m_maxOccStgcEta
Gaudi::Property< double > m_maxOccStgcEta
Definition: SpacePointMakerAlg.h:211
SG::WriteHandleKey< SpacePointContainer >
MuonR4::SpacePointMakerAlg::SpacePointStatistics
Helper class to keep track of how many eta+phi, eta and phi only space points are built in various de...
Definition: SpacePointMakerAlg.h:43
MuonR4::SpacePointMakerAlg::SpacePointStatistics::m_map
StatMap_t m_map
Definition: SpacePointMakerAlg.h:81
MuonR4::SpacePointMakerAlg::~SpacePointMakerAlg
~SpacePointMakerAlg()=default
TgcStripContainer.h
MuonR4::SpacePointMakerAlg::SpacePointStatistics::StatField
Helper struct to count the space-points in each detector category.
Definition: SpacePointMakerAlg.h:57
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
MuonR4::SpacePointMakerAlg::SpacePointStatistics::StatField::measEta
unsigned measEta
Number of space points measuring eta only.
Definition: SpacePointMakerAlg.h:61
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
MuonR4::SpacePointMakerAlg::SpacePointsPerChamber::phiHits
std::vector< SpacePoint > phiHits
Vector of all space points that are built from single phi hits.
Definition: SpacePointMakerAlg.h:90
MuonR4::SpacePointMakerAlg::m_maxOccTgcEta
Gaudi::Property< double > m_maxOccTgcEta
Definition: SpacePointMakerAlg.h:206
MuonDetectorManager.h
MuonR4::SpacePointMakerAlg::SpacePointStatistics::dumpStatisics
void dumpStatisics(MsgStream &msg) const
Print the statistics table of the built space points per category into the log-file / console.
Definition: SpacePointMakerAlg.cxx:135
MMClusterContainer.h
F600IntegrationConfig.spacePoints
spacePoints
Definition: F600IntegrationConfig.py:122
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
MuonR4::SpacePointMakerAlg::m_maxOccTgcPhi
Gaudi::Property< double > m_maxOccTgcPhi
Definition: SpacePointMakerAlg.h:208
ActsGeometryContext
Include the GeoPrimitives which need to be put first.
Definition: ActsGeometryContext.h:27
MuonR4::SpacePointMakerAlg::fillUncombinedSpacePoints
void fillUncombinedSpacePoints(const ActsGeometryContext &gctx, const Amg::Transform3D &sectorTrans, const std::vector< const PrdType * > &prdsToFill, std::vector< SpacePoint > &outColl) const
Fills all space points that are beloni.
Definition: SpacePointMakerAlg.cxx:224
MuonR4::SpacePoint
The muon space point is the combination of two uncalibrated measurements one of them measures the eta...
Definition: MuonSpectrometer/MuonPhaseII/Event/MuonSpacePoint/MuonSpacePoint/SpacePoint.h:24
MuonR4::SpacePointMakerAlg::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: SpacePointMakerAlg.h:181
Muon::MuonStationIndex::StIndex
StIndex
enum to classify the different station layers in the muon spectrometer
Definition: MuonStationIndex.h:23
AthReentrantAlgorithm.h
MdtDriftCircleContainer.h
WriteHandleKey.h
Property holding a SG store/key/clid from which a WriteHandle is made.
NSWL1::PadTriggerAdapter::fillContainer
StatusCode fillContainer(const std::unique_ptr< Muon::NSW_PadTriggerDataContainer > &out, const std::vector< std::unique_ptr< NSWL1::PadTrigger >> &triggers, const uint32_t l1id)
Definition: PadTriggerAdapter.cxx:17
MuonR4::SpacePointMakerAlg::SpacePointStatistics::FieldKey::techIdx
TechIdx_t techIdx
Definition: SpacePointMakerAlg.h:73
MuonR4::SpacePointMakerAlg::SpacePointStatistics::FieldKey::stIdx
StIdx_t stIdx
Definition: SpacePointMakerAlg.h:72
MuonR4::SpacePointMakerAlg::loadContainerAndSort
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 ...
Definition: SpacePointMakerAlg.cxx:280
MuonR4::SpacePointMakerAlg::SpacePointStatistics::StatField::measPhi
unsigned measPhi
Number of space points measuring phi only.
Definition: SpacePointMakerAlg.h:63
MuonR4::SpacePointMakerAlg::m_mdtKey
SG::ReadHandleKey< xAOD::MdtDriftCircleContainer > m_mdtKey
Definition: SpacePointMakerAlg.h:164
MuonR4
This header ties the generic definitions in this package.
Definition: HoughEventData.h:16
MuonR4::SpacePointMakerAlg::m_capacityBucket
Gaudi::Property< unsigned > m_capacityBucket
Definition: SpacePointMakerAlg.h:198
MuonR4::SpacePointMakerAlg::passOccupancy2D
bool passOccupancy2D(const std::vector< const PrdType * > &etaHits, const std::vector< const PrdType * > &phiHits) const
: Check whether the occupancy cuts of hits in a gasGap are surpassed.
MuonR4::SpacePointMakerAlg::m_maxBucketLength
Gaudi::Property< double > m_maxBucketLength
Definition: SpacePointMakerAlg.h:188
MuonR4::SpacePointMakerAlg::m_spacePointWindow
Gaudi::Property< double > m_spacePointWindow
Definition: SpacePointMakerAlg.h:185
MuonR4::SpacePointMakerAlg::SpacePointStatistics::SpacePointStatistics
SpacePointStatistics(const Muon::IMuonIdHelperSvc *idHelperSvc)
Standard constructor.
Definition: SpacePointMakerAlg.cxx:116
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
SpacePointContainer.h
MuonR4::SpacePointMakerAlg::finalize
StatusCode finalize() override
Definition: SpacePointMakerAlg.cxx:164
AthCommonMsg< Gaudi::Algorithm >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
Muon::IMuonIdHelperSvc
Interface for Helper service that creates muon Identifiers and can be used to print Identifiers.
Definition: IMuonIdHelperSvc.h:27
MuonR4::SpacePointMakerAlg::m_doStat
Gaudi::Property< bool > m_doStat
Definition: SpacePointMakerAlg.h:195
MuonR4::SpacePointMakerAlg::m_geoCtxKey
SG::ReadHandleKey< ActsGeometryContext > m_geoCtxKey
Definition: SpacePointMakerAlg.h:179
MuonR4::SpacePointMakerAlg::m_maxOccRpcEta
Gaudi::Property< double > m_maxOccRpcEta
Definition: SpacePointMakerAlg.h:201
MuonR4::SpacePointMakerAlg::SpacePointStatistics::FieldKey::eta
int eta
Definition: SpacePointMakerAlg.h:74
MuonR4::SpacePointMakerAlg::distributePointsAndStore
void distributePointsAndStore(SpacePointsPerChamber &&hitsPerChamber, SpacePointContainer &finalContainer) const
Distribute the premade spacepoints per chamber into their individual SpacePoint buckets.
Definition: SpacePointMakerAlg.cxx:423
MuonR4::SpacePointMakerAlg::SpacePointStatistics::FieldKey
Helper struct to define the counting categories.
Definition: SpacePointMakerAlg.h:69
IMuonIdHelperSvc.h
MuonR4::SpacePointMakerAlg::m_spacePointOverlap
Gaudi::Property< double > m_spacePointOverlap
Definition: SpacePointMakerAlg.h:191
python.SystemOfUnits.m
float m
Definition: SystemOfUnits.py:106
MuonR4::SpacePointMakerAlg
Definition: SpacePointMakerAlg.h:27
ServiceHandle< Muon::IMuonIdHelperSvc >
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
MuonR4::SpacePointMakerAlg::m_maxOccRpcPhi
Gaudi::Property< double > m_maxOccRpcPhi
Definition: SpacePointMakerAlg.h:203