ATLAS Offline Software
MuonSegmentPerformanceAlg.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef MUONSEGMENTPERFORMANCEALG_H
6 #define MUONSEGMENTPERFORMANCEALG_H
7 
8 #include <fstream>
9 #include <string>
10 #include <vector>
11 #include <array>
12 
14 #include "GaudiKernel/ToolHandle.h"
17 
19 public:
20  // Algorithm Constructor
21  MuonSegmentPerformanceAlg(const std::string &name, ISvcLocator *pSvcLocator);
22  virtual ~MuonSegmentPerformanceAlg() = default;
23 
24  // Gaudi algorithm hooks
25  virtual StatusCode initialize() override;
26  virtual StatusCode execute() override;
27  virtual StatusCode finalize() override;
28 
29  unsigned int cardinality() const override final { return 1;}
30 private:
32  using counter_t = std::array<int, s_chIdxMax>;
33  std::string printRatio(const std::string& prefix, unsigned int begin, unsigned int end, const counter_t& reco,
34  const counter_t& truth) const;
35  std::string printRatio(const std::string& prefix, unsigned int begin, unsigned int end, const counter_t& reco) const;
36 
39  std::string m_fileName;
40 
42  std::ofstream m_fileOutput;
43 
44  SG::ReadHandleKey<xAOD::MuonSegmentContainer> m_segmentKey{this, "SegmentLocation", "MuonSegments"};
45  SG::ReadHandleKey<xAOD::MuonSegmentContainer> m_truthSegmentKey{this, "TruthSegmentLocation", "MuonTruthSegments"};
46  SG::ReadDecorHandleKey<xAOD::MuonSegmentContainer> m_truthSegmenLinkKey{this, "truthSegmentsRecoSegmentLinkKey", m_truthSegmentKey, "recoSegmentLink" };
47 
48  unsigned int m_nevents;
49  std::vector<int> m_nhitCuts;
50  std::vector<std::string> m_hitCutString;
51  std::vector<counter_t > m_ntruth;
52  std::vector<counter_t > m_nfound;
53  std::vector<counter_t > m_nfake;
54 };
55 
56 #endif // MUONPERFORMANCEALG
MuonSegmentPerformanceAlg::initialize
virtual StatusCode initialize() override
Definition: MuonSegmentPerformanceAlg.cxx:22
MuonSegmentPerformanceAlg::m_nfound
std::vector< counter_t > m_nfound
Definition: MuonSegmentPerformanceAlg.h:52
MuonSegmentPerformanceAlg::s_chIdxMax
constexpr static unsigned s_chIdxMax
Definition: MuonSegmentPerformanceAlg.h:31
MuonSegmentPerformanceAlg::m_segmentKey
SG::ReadHandleKey< xAOD::MuonSegmentContainer > m_segmentKey
Definition: MuonSegmentPerformanceAlg.h:44
ReadDecorHandleKey.h
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
MuonSegmentPerformanceAlg::m_truthSegmentKey
SG::ReadHandleKey< xAOD::MuonSegmentContainer > m_truthSegmentKey
Definition: MuonSegmentPerformanceAlg.h:45
MuonSegmentPerformanceAlg::m_hitCutString
std::vector< std::string > m_hitCutString
Definition: MuonSegmentPerformanceAlg.h:50
MuonSegmentPerformanceAlg::counter_t
std::array< int, s_chIdxMax > counter_t
Definition: MuonSegmentPerformanceAlg.h:32
MuonSegmentPerformanceAlg::~MuonSegmentPerformanceAlg
virtual ~MuonSegmentPerformanceAlg()=default
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
MuonSegmentPerformanceAlg::m_nhitCuts
std::vector< int > m_nhitCuts
Definition: MuonSegmentPerformanceAlg.h:49
MuonSegmentPerformanceAlg::m_fileOutput
std::ofstream m_fileOutput
output file
Definition: MuonSegmentPerformanceAlg.h:42
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:560
SG::ReadHandleKey< xAOD::MuonSegmentContainer >
Muon::MuonStationIndex::ChIndex::ChIndexMax
@ ChIndexMax
MuonSegmentPerformanceAlg::MuonSegmentPerformanceAlg
MuonSegmentPerformanceAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: MuonSegmentPerformanceAlg.cxx:13
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:92
MuonSegmentPerformanceAlg::m_nevents
unsigned int m_nevents
Definition: MuonSegmentPerformanceAlg.h:48
MuonSegmentContainer.h
MuonSegmentPerformanceAlg
Definition: MuonSegmentPerformanceAlg.h:18
AthAlgorithm.h
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
MuonSegmentPerformanceAlg::m_truthSegmenLinkKey
SG::ReadDecorHandleKey< xAOD::MuonSegmentContainer > m_truthSegmenLinkKey
Definition: MuonSegmentPerformanceAlg.h:46
checkCorrelInHIST.prefix
dictionary prefix
Definition: checkCorrelInHIST.py:391
MuonSegmentPerformanceAlg::printRatio
std::string printRatio(const std::string &prefix, unsigned int begin, unsigned int end, const counter_t &reco, const counter_t &truth) const
Definition: MuonSegmentPerformanceAlg.cxx:105
MuonSegmentPerformanceAlg::execute
virtual StatusCode execute() override
Definition: MuonSegmentPerformanceAlg.cxx:39
columnar::final
CM final
Definition: ColumnAccessor.h:106
AthAlgorithm
Definition: AthAlgorithm.h:47
MuonSegmentPerformanceAlg::m_writeToFile
bool m_writeToFile
name of external file to write statistics
Definition: MuonSegmentPerformanceAlg.h:38
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
MuonSegmentPerformanceAlg::m_fileName
std::string m_fileName
Definition: MuonSegmentPerformanceAlg.h:39
MuonSegmentPerformanceAlg::cardinality
unsigned int cardinality() const override final
Definition: MuonSegmentPerformanceAlg.h:29
MuonSegmentPerformanceAlg::finalize
virtual StatusCode finalize() override
Definition: MuonSegmentPerformanceAlg.cxx:146
MuonSegmentPerformanceAlg::m_nfake
std::vector< counter_t > m_nfake
Definition: MuonSegmentPerformanceAlg.h:53
MuonSegmentPerformanceAlg::m_ntruth
std::vector< counter_t > m_ntruth
Definition: MuonSegmentPerformanceAlg.h:51
SG::ReadDecorHandleKey
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
Definition: StoreGate/StoreGate/ReadDecorHandleKey.h:85
MuonSegmentReaderConfig.reco
reco
Definition: MuonSegmentReaderConfig.py:133
Muon::MuonStationIndex::toInt
constexpr int toInt(const EnumType enumVal)
Definition: MuonStationIndex.h:61