ATLAS Offline Software
MuonPatternCalibration.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 MUON_MUONPATTERNCALIBRATION_H
5 #define MUON_MUONPATTERNCALIBRATION_H
6 
7 #include <map>
8 #include <string>
9 #include <vector>
10 
12 #include "GaudiKernel/ServiceHandle.h"
13 #include "GaudiKernel/ToolHandle.h"
22 
23 class MdtPrepData;
24 
25 namespace Muon {
26 class MdtPrepData;
27 class MuonClusterOnTrack;
28 class MdtDriftCircleOnTrack;
29 
30 class MuonPatternCalibration : public extends<AthAlgTool, IMuonPatternCalibration> {
31  public:
32  using ISPrd = std::pair<Amg::Vector3D, const MuonCluster*>;
33  using ISPrdVec = std::vector<ISPrd>;
34 
35  using ISPrdMdt = std::pair<Amg::Vector3D, const MdtPrepData*>;
36  using ISPrdMdtVec = std::vector<ISPrdMdt>;
37  using RegionIdMap = std::map<int, ISPrdMdtVec>;
38 
39  struct Region {
40  Region() = default;
45  bool init{false};
46  };
47 
48 
49  using RegionMap = std::map<int, Region>;
50 
51  struct EtaPhiHits {
52  EtaPhiHits() = default;
53  unsigned int neta{0};
54  unsigned int nphi{0};
55  };
56 
57  public:
58  MuonPatternCalibration(const std::string&, const std::string&, const IInterface*);
59  virtual ~MuonPatternCalibration() = default;
60 
61  virtual StatusCode initialize() override;
62 
63  StatusCode calibrate(const EventContext& ctx, const MuonPatternCombination& pat, ROTsPerRegion& hitsPerRegion) const override;
64  int getRegionId(const Identifier& id) const override;
65  bool checkForPhiMeasurements(const MuonPatternCombination& pat) const override;
66 
67  private:
68  StatusCode createRegionMap(const EventContext& ctx, const MuonPatternCombination& pat,
69  RegionMap& regionMap, bool hasPhiMeasurements) const;
70 
71  void printRegionMap(const RegionMap& regionMap) const;
72 
73  void calibrateRegionMap(const RegionMap& regionMap, IMuonPatternCalibration::ROTsPerRegion& hitsPerRegion) const;
74 
75 
76  void insertCluster(const MuonCluster& mdt, RegionMap& regionMap, const Amg::Vector3D& patpose,
77  const Amg::Vector3D& patdire, bool hasPhiMeasurements) const;
78 
79  void insertMdt(const MdtPrepData& clus, RegionMap& regionMap, const Amg::Vector3D& patpose,
80  const Amg::Vector3D& patdire, bool hasPhiMeasurements) const;
81 
82 
83  ToolHandle<IMdtDriftCircleOnTrackCreator> m_mdtCreator{
84  this,
85  "MdtCreator",
86  "",
87  }; //<! pointer to mdt rio ontrack creator
88  ToolHandle<IMuonClusterOnTrackCreator> m_clusterCreator{
89  this,
90  "ClusterCreator",
91  "Muon::MuonClusterOnTrackCreator/MuonClusterOnTrackCreator",
92  }; //<! pointer to muon cluster rio ontrack creator
93  PublicToolHandle<MuonEDMPrinterTool> m_printer{
94  this,
95  "Printer",
96  "Muon::MuonEDMPrinterTool",
97  }; //<! tool to print EDM objects
98 
100  this,
101  "MuonIdHelperSvc",
102  "Muon::MuonIdHelperSvc/MuonIdHelperSvc",
103  };
104 
105  Gaudi::Property<bool> m_doMultiAnalysis{this, "DoMultiChamberAnalysis", true}; //<! use neighbouring chambers during segment finding
106  Gaudi::Property<double> m_dropDistance{this, "DropDistance", 1500.}; //<! hits that are further away than the distance are not added to segmentmaker input
107  Gaudi::Property<double> m_phiAngleCut{this, "AngleCutPhi", 1.e9}; //<! cut on the phi opening angle between chamber and pattern
108  Gaudi::Property<bool> m_doSummary{this, "DoSummary", false};
109  Gaudi::Property<bool> m_recoverTriggerHits{this, "RecoverTriggerHits", true};
110  Gaudi::Property<bool> m_removeDoubleMdtHits{this, "RemoveDoubleMdtHits", true};
111 
112  SG::ReadHandleKey<Muon::RpcPrepDataContainer> m_keyRpc{this, "RpcPrepDataContainer","RPC_Measurements"};
113  SG::ReadHandleKey<Muon::TgcPrepDataContainer> m_keyTgc{this, "TgcPrepDataContainer","TGC_Measurements"};
114 
117  template <class ContType> StatusCode loadFromStoreGate(const EventContext& ctx,
119  const ContType* & cont_ptr) const;
120 };
121 
122 } // namespace Muon
123 
124 #endif // MUON_MUONPATTERNCALIBRATION_H
Muon::MuonPatternCalibration::Region::mdtPrdsPerChamber
RegionIdMap mdtPrdsPerChamber
Definition: MuonPatternCalibration.h:44
Muon::MuonPatternCalibration::m_removeDoubleMdtHits
Gaudi::Property< bool > m_removeDoubleMdtHits
Definition: MuonPatternCalibration.h:110
Trk::PrepRawDataType::MdtPrepData
@ MdtPrepData
Muon::MuonPatternCalibration::m_idHelperSvc
ServiceHandle< Muon::IMuonIdHelperSvc > m_idHelperSvc
Definition: MuonPatternCalibration.h:99
MuonEDMPrinterTool.h
Muon::MuonPatternCalibration::calibrate
StatusCode calibrate(const EventContext &ctx, const MuonPatternCombination &pat, ROTsPerRegion &hitsPerRegion) const override
Definition: MuonPatternCalibration.cxx:40
Muon::MuonPatternCalibration::m_printer
PublicToolHandle< MuonEDMPrinterTool > m_printer
Definition: MuonPatternCalibration.h:93
Muon::MuonPatternCalibration::Region::regionPos
Amg::Vector3D regionPos
Definition: MuonPatternCalibration.h:41
Muon::MuonPatternCalibration::ISPrd
std::pair< Amg::Vector3D, const MuonCluster * > ISPrd
Definition: MuonPatternCalibration.h:32
Muon::MuonPatternCalibration::getRegionId
int getRegionId(const Identifier &id) const override
Definition: MuonPatternCalibration.cxx:50
Muon::MuonPatternCalibration::initialize
virtual StatusCode initialize() override
Definition: MuonPatternCalibration.cxx:26
MuonPrepDataContainer.h
SG::ReadHandleKey
Property holding a SG store/key/clid from which a ReadHandle is made.
Definition: StoreGate/StoreGate/ReadHandleKey.h:39
Muon::MuonPatternCalibration::calibrateRegionMap
void calibrateRegionMap(const RegionMap &regionMap, IMuonPatternCalibration::ROTsPerRegion &hitsPerRegion) const
Definition: MuonPatternCalibration.cxx:429
Muon
This class provides conversion from CSC RDO data to CSC Digits.
Definition: TrackSystemController.h:45
Muon::MuonPatternCalibration::m_recoverTriggerHits
Gaudi::Property< bool > m_recoverTriggerHits
Definition: MuonPatternCalibration.h:109
Muon::MuonPatternCalibration::Region
Definition: MuonPatternCalibration.h:39
Muon::MuonPatternCalibration::RegionIdMap
std::map< int, ISPrdMdtVec > RegionIdMap
Definition: MuonPatternCalibration.h:37
Muon::MuonPatternCalibration::m_clusterCreator
ToolHandle< IMuonClusterOnTrackCreator > m_clusterCreator
Definition: MuonPatternCalibration.h:88
Muon::MuonPatternCalibration::RegionMap
std::map< int, Region > RegionMap
Definition: MuonPatternCalibration.h:49
Muon::MuonPatternCalibration::~MuonPatternCalibration
virtual ~MuonPatternCalibration()=default
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
Muon::MuonPatternCalibration::ISPrdVec
std::vector< ISPrd > ISPrdVec
Definition: MuonPatternCalibration.h:33
Muon::MuonPatternCalibration::Region::triggerPrds
ISPrdVec triggerPrds
Definition: MuonPatternCalibration.h:43
IMuonClusterOnTrackCreator.h
AthAlgTool.h
MuonPatternCombination.h
Muon::MuonPatternCalibration::EtaPhiHits
Definition: MuonPatternCalibration.h:51
MuonPatternCombinationCollection.h
Muon::MuonPatternCalibration::insertCluster
void insertCluster(const MuonCluster &mdt, RegionMap &regionMap, const Amg::Vector3D &patpose, const Amg::Vector3D &patdire, bool hasPhiMeasurements) const
Definition: MuonPatternCalibration.cxx:201
Muon::MuonPatternCalibration::Region::regionDir
Amg::Vector3D regionDir
Definition: MuonPatternCalibration.h:42
Muon::MuonPatternCalibration::ISPrdMdtVec
std::vector< ISPrdMdt > ISPrdMdtVec
Definition: MuonPatternCalibration.h:36
Muon::MuonPatternCalibration::m_dropDistance
Gaudi::Property< double > m_dropDistance
Definition: MuonPatternCalibration.h:106
Muon::MuonPatternCalibration::checkForPhiMeasurements
bool checkForPhiMeasurements(const MuonPatternCombination &pat) const override
Definition: MuonPatternCalibration.cxx:59
Muon::IMuonPatternCalibration::ROTsPerRegion
std::vector< ROTRegion > ROTsPerRegion
Definition: IMuonPatternCalibration.h:55
dso-stats.pat
pat
Definition: dso-stats.py:39
Muon::MuonPatternCalibration::loadFromStoreGate
StatusCode loadFromStoreGate(const EventContext &ctx, const SG::ReadHandleKey< ContType > &key, const ContType *&cont_ptr) const
load the container from storegate given a ReadHandleKey.
Definition: MuonPatternCalibration.cxx:463
Muon::MuonPatternCalibration::insertMdt
void insertMdt(const MdtPrepData &clus, RegionMap &regionMap, const Amg::Vector3D &patpose, const Amg::Vector3D &patdire, bool hasPhiMeasurements) const
Definition: MuonPatternCalibration.cxx:304
Muon::MuonPatternCalibration::MuonPatternCalibration
MuonPatternCalibration(const std::string &, const std::string &, const IInterface *)
Definition: MuonPatternCalibration.cxx:22
Muon::MuonPatternCalibration::EtaPhiHits::EtaPhiHits
EtaPhiHits()=default
IMdtDriftCircleOnTrackCreator.h
Muon::MdtPrepData
Class to represent measurements from the Monitored Drift Tubes.
Definition: MdtPrepData.h:33
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
Muon::MuonPatternCalibration::m_phiAngleCut
Gaudi::Property< double > m_phiAngleCut
Definition: MuonPatternCalibration.h:107
Muon::MuonPatternCalibration::ISPrdMdt
std::pair< Amg::Vector3D, const MdtPrepData * > ISPrdMdt
Definition: MuonPatternCalibration.h:35
Muon::MuonPatternCalibration::EtaPhiHits::nphi
unsigned int nphi
Definition: MuonPatternCalibration.h:54
Muon::MuonPatternCalibration::m_keyTgc
SG::ReadHandleKey< Muon::TgcPrepDataContainer > m_keyTgc
Definition: MuonPatternCalibration.h:113
Muon::MuonPatternCalibration::m_mdtCreator
ToolHandle< IMdtDriftCircleOnTrackCreator > m_mdtCreator
Definition: MuonPatternCalibration.h:83
IMuonPatternCalibration.h
Muon::MuonPatternCalibration::Region::init
bool init
Definition: MuonPatternCalibration.h:45
Muon::MuonPatternCalibration::Region::Region
Region()=default
Muon::MuonPatternCalibration::printRegionMap
void printRegionMap(const RegionMap &regionMap) const
Definition: MuonPatternCalibration.cxx:406
Muon::MuonPatternCalibration::createRegionMap
StatusCode createRegionMap(const EventContext &ctx, const MuonPatternCombination &pat, RegionMap &regionMap, bool hasPhiMeasurements) const
Definition: MuonPatternCalibration.cxx:73
Muon::MuonCluster
Class representing clusters in the muon system.
Definition: MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData/MuonPrepRawData/MuonCluster.h:37
Muon::MuonPatternCalibration::m_doSummary
Gaudi::Property< bool > m_doSummary
Definition: MuonPatternCalibration.h:108
Muon::MuonPatternCalibration::EtaPhiHits::neta
unsigned int neta
Definition: MuonPatternCalibration.h:53
Muon::MuonPatternCalibration::m_keyRpc
SG::ReadHandleKey< Muon::RpcPrepDataContainer > m_keyRpc
Definition: MuonPatternCalibration.h:112
Muon::MuonPatternCombination
The MuonPatternCombination class provides the means to store the output of the initial global pattern...
Definition: MuonPatternCombination.h:29
Muon::MuonPatternCalibration::m_doMultiAnalysis
Gaudi::Property< bool > m_doMultiAnalysis
Definition: MuonPatternCalibration.h:105
Muon::MuonPatternCalibration
Definition: MuonPatternCalibration.h:30
IMuonIdHelperSvc.h
generate::Zero
void Zero(TH1D *hin)
Definition: generate.cxx:32
ServiceHandle< Muon::IMuonIdHelperSvc >
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
Identifier
Definition: IdentifierFieldParser.cxx:14