ATLAS Offline Software
SpacePointMakerAlg.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 #ifndef MUONSPACEPOINTFORMATION_MUONSPACEPOINTMAKERALG_H
5 #define MUONSPACEPOINTFORMATION_MUONSPACEPOINTMAKERALG_H
6 
11 
12 
21 
22 
23 namespace MuonR4{
25  public:
26  SpacePointMakerAlg(const std::string& name, ISvcLocator* pSvcLocator);
27 
28  ~SpacePointMakerAlg() = default;
29 
30  StatusCode execute(const EventContext& ctx) const override;
31  StatusCode initialize() override;
32  StatusCode finalize() override;
33 
34  private:
42  public:
46  SpacePointStatistics(const Muon::IMuonIdHelperSvc* idHelperSvc);
47 
49  void addToStat(const std::vector<SpacePoint>& spacePoints);
52  void dumpStatisics(MsgStream& msg) const;
53 
54  private:
57  struct StatField{
59  unsigned int measEtaPhi{0};
61  unsigned int measEta{0};
63  unsigned int measPhi{0};
66  unsigned int 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 
95 
105  template <class ContType>
106  StatusCode loadContainerAndSort(const EventContext& ctx,
109 
111  using SpacePointBucketVec = std::vector<SpacePointBucket>;
112 
123  void distributePointsAndStore(const EventContext& ctx,
124  SpacePointsPerChamber&& hitsPerChamber,
125  SpacePointContainer& finalContainer) const;
126 
127  void distributePointsAndStore(const EventContext& ctx,
128  std::vector<SpacePoint>&& spacePoints,
129  SpacePointBucketVec& splittedContainer) const;
130 
139  template <class PrdType>
140  bool passOccupancy2D(const std::vector<const PrdType*>& etaHits,
141  const std::vector<const PrdType*>& phiHits) const;
142 
143  SG::ReadHandleKey<xAOD::MdtDriftCircleContainer> m_mdtKey{this, "MdtKey", "xMdtMeasurements",
144  "Key to the uncalibrated Drift circle measurements"};
145 
146  SG::ReadHandleKey<xAOD::RpcMeasurementContainer> m_rpcKey{this, "RpcKey", "xRpcMeasurements",
147  "Key to the uncalibrated 1D rpc hits"};
148 
150  "Key to the uncalibrated 1D tgc hits"};
151 
152  SG::ReadHandleKey<xAOD::MMClusterContainer> m_mmKey{this, "MmKey", "xAODMMClusters",
153  "Key to the uncalibrated 1D Mm hits"};
154 
155  SG::ReadHandleKey<xAOD::sTgcMeasContainer> m_stgcKey{this, "sTgcKey", "xAODsTgcMeasurements"};
156 
157 
158  SG::ReadHandleKey<ActsGeometryContext> m_geoCtxKey{this, "AlignmentKey", "ActsAlignment", "cond handle key"};
159 
160  ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc{this, "IdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"};
161 
162  SG::WriteHandleKey<SpacePointContainer> m_writeKey{this, "WriteKey", "MuonSpacePoints"};
163 
164  Gaudi::Property<double> m_spacePointWindow{this, "spacePointWindowSize", 0.8*Gaudi::Units::m,
165  "Maximal distance between consecutive hits in a bucket"};
166 
167  Gaudi::Property<double> m_maxBucketLength{this, "maxBucketLength", 2.*Gaudi::Units::m,
168  "Maximal size of a space point bucket"};
169 
170  Gaudi::Property<double> m_spacePointOverlap{this, "spacePointOverlap", 25.*Gaudi::Units::cm,
171  "Hits that are within <spacePointOverlap> of the bucket margin. "
172  "Are copied to the next bucket"};
173 
174  Gaudi::Property<bool> m_doStat{this, "doStats", true,
175  "If enabled the algorithm keeps track how many hits have been made" };
176 
177  Gaudi::Property<unsigned int> m_capacityBucket{this,"CapacityBucket" , 50};
178  std::unique_ptr<SpacePointStatistics> m_statCounter ATLAS_THREAD_SAFE{};
179 
180  Gaudi::Property<double> m_maxOccRpcEta{this, "maxRpcEtaOccupancy", 0.1,
181  "Maximum occpancy of Rpc eta hits in a gasGap"};
182  Gaudi::Property<double> m_maxOccRpcPhi{this, "maxRpcPhiOccupancy", 0.1,
183  "Maximum occpancy of Rpc phi hits in a gasGap"};
184 
185  Gaudi::Property<double> m_maxOccTgcEta{this, "maxTgcEtaOccupancy", 0.1,
186  "Maximum occpancy of Tgc eta hits in a gasGap"};
187  Gaudi::Property<double> m_maxOccTgcPhi{this, "maxTgcPhiOccupancy", 0.1,
188  "Maximum occpancy of Tgc phi hits in a gasGap"};
189 
190  Gaudi::Property<double> m_maxOccStgcEta{this, "maxSTGCEtaOccupancy", 0.1,
191  "Maximum occpancy of sTgc eta hits in a gasGap"};
192  Gaudi::Property<double> m_maxOccStgcPhi{this, "maxSTGCPhiOccupancy", 0.1,
193  "Maximum occpancy of sTgc phi hits in a gasGap"};
194 
195  };
196 }
197 
198 
199 #endif
ReadHandleKey.h
Property holding a SG store/key/clid from which a ReadHandle is made.
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:23
MuonR4::SpacePointMakerAlg::m_stgcKey
SG::ReadHandleKey< xAOD::sTgcMeasContainer > m_stgcKey
Definition: SpacePointMakerAlg.h:155
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
MuonR4::SpacePointMakerAlg::SpacePointStatistics::addToStat
void addToStat(const std::vector< SpacePoint > &spacePoints)
Adds the vector of space points to the overall statistics.
Definition: SpacePointMakerAlg.cxx:38
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:89
MuonR4::SpacePointMakerAlg::execute
StatusCode execute(const EventContext &ctx) const override
Definition: SpacePointMakerAlg.cxx:261
MuonR4::SpacePointMakerAlg::m_maxOccStgcPhi
Gaudi::Property< double > m_maxOccStgcPhi
Definition: SpacePointMakerAlg.h:192
MuonR4::SpacePointMakerAlg::ATLAS_THREAD_SAFE
std::unique_ptr< SpacePointStatistics > m_statCounter ATLAS_THREAD_SAFE
Definition: SpacePointMakerAlg.h:178
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
MuonR4::SpacePointMakerAlg::m_rpcKey
SG::ReadHandleKey< xAOD::RpcMeasurementContainer > m_rpcKey
Definition: SpacePointMakerAlg.h:146
MuonR4::SpacePointMakerAlg::SpacePointStatistics::StatField::allHits
unsigned int allHits() const
Helper method returning the sum of the three space point type counts.
Definition: SpacePointMakerAlg.cxx:32
MuonR4::SpacePointMakerAlg::SpacePointStatistics::StatField::measEtaPhi
unsigned int 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
MuonR4::SpacePointMakerAlg::SpacePointStatistics::StatField::measPhi
unsigned int measPhi
Number of space points measuring phi only.
Definition: SpacePointMakerAlg.h:63
sTgcMeasContainer.h
MuonR4::SpacePointMakerAlg::m_mmKey
SG::ReadHandleKey< xAOD::MMClusterContainer > m_mmKey
Definition: SpacePointMakerAlg.h:152
MuonR4::SpacePointMakerAlg::SpacePointStatistics::StatMap_t
std::map< FieldKey, StatField > StatMap_t
Definition: SpacePointMakerAlg.h:80
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
RpcMeasurementContainer.h
cm
const double cm
Definition: Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimParametrization/tools/FCAL_ChannelMap.cxx:25
MuonR4::SpacePointMakerAlg::distributePointsAndStore
void distributePointsAndStore(const EventContext &ctx, SpacePointsPerChamber &&hitsPerChamber, SpacePointContainer &finalContainer) const
Distribute the premade spacepoints per chamber into their individual SpacePoint buckets.
Definition: SpacePointMakerAlg.cxx:279
MuonR4::SpacePointMakerAlg::SpacePointBucketVec
std::vector< SpacePointBucket > SpacePointBucketVec
Abrivation of a MuonSapcePoint bucket vector.
Definition: SpacePointMakerAlg.h:111
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:149
MuonR4::SpacePointMakerAlg::m_writeKey
SG::WriteHandleKey< SpacePointContainer > m_writeKey
Definition: SpacePointMakerAlg.h:162
MuonR4::SpacePointMakerAlg::m_maxOccStgcEta
Gaudi::Property< double > m_maxOccStgcEta
Definition: SpacePointMakerAlg.h:190
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:41
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::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:185
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:54
MMClusterContainer.h
MuonR4::SpacePointMakerAlg::SpacePointStatistics::StatField::measEta
unsigned int measEta
Number of space points measuring eta only.
Definition: SpacePointMakerAlg.h:61
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
MuonR4::SpacePointMakerAlg::m_maxOccTgcPhi
Gaudi::Property< double > m_maxOccTgcPhi
Definition: SpacePointMakerAlg.h:187
ReadCondHandleKey.h
MuonR4::SpacePointMakerAlg::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: SpacePointMakerAlg.h:160
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
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
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:137
MuonR4::SpacePointMakerAlg::m_mdtKey
SG::ReadHandleKey< xAOD::MdtDriftCircleContainer > m_mdtKey
Definition: SpacePointMakerAlg.h:143
MuonR4
This header ties the generic definitions in this package.
Definition: HoughEventData.h:16
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:167
MuonR4::SpacePointMakerAlg::m_spacePointWindow
Gaudi::Property< double > m_spacePointWindow
Definition: SpacePointMakerAlg.h:164
MuonR4::SpacePointMakerAlg::SpacePointStatistics::SpacePointStatistics
SpacePointStatistics(const Muon::IMuonIdHelperSvc *idHelperSvc)
Standard constructor.
Definition: SpacePointMakerAlg.cxx:35
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
SpacePointContainer.h
MuonR4::SpacePointMakerAlg::finalize
StatusCode finalize() override
Definition: SpacePointMakerAlg.cxx:83
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
Muon::MuonStationIndex::StIndex
StIndex
enum to classify the different station layers in the muon spectrometer
Definition: MuonStationIndex.h:23
MuonR4::SpacePointMakerAlg::m_doStat
Gaudi::Property< bool > m_doStat
Definition: SpacePointMakerAlg.h:174
MuonR4::SpacePointMakerAlg::m_geoCtxKey
SG::ReadHandleKey< ActsGeometryContext > m_geoCtxKey
Definition: SpacePointMakerAlg.h:158
MuonR4::SpacePointMakerAlg::m_maxOccRpcEta
Gaudi::Property< double > m_maxOccRpcEta
Definition: SpacePointMakerAlg.h:180
MuonR4::SpacePointMakerAlg::SpacePointStatistics::FieldKey::eta
int eta
Definition: SpacePointMakerAlg.h:74
Muon::MuonStationIndex::TechnologyIndex
TechnologyIndex
enum to classify the different layers in the muon spectrometer
Definition: MuonStationIndex.h:54
MuonR4::SpacePointMakerAlg::SpacePointMakerAlg
SpacePointMakerAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: SpacePointMakerAlg.cxx:79
MuonR4::SpacePointMakerAlg::m_capacityBucket
Gaudi::Property< unsigned int > m_capacityBucket
Definition: SpacePointMakerAlg.h:177
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:170
MuonR4::SpacePointMakerAlg
Definition: SpacePointMakerAlg.h:24
ServiceHandle< Muon::IMuonIdHelperSvc >
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
MuonR4::SpacePointMakerAlg::m_maxOccRpcPhi
Gaudi::Property< double > m_maxOccRpcPhi
Definition: SpacePointMakerAlg.h:182