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 
13 #include "GaudiKernel/ToolHandle.h"
16 
18 public:
19  // Algorithm Constructor
20  MuonSegmentPerformanceAlg(const std::string &name, ISvcLocator *pSvcLocator);
21  virtual ~MuonSegmentPerformanceAlg() = default;
22 
23  // Gaudi algorithm hooks
24  virtual StatusCode initialize() override;
25  virtual StatusCode execute() override;
26  virtual StatusCode finalize() override;
27 
28  unsigned int cardinality() const override final { return 1;}
29 private:
31  std::string printRatio(const std::string& prefix, unsigned int begin, unsigned int end, const std::vector<int>& reco,
32  const std::vector<int>& truth) const;
33  std::string printRatio(const std::string& prefix, unsigned int begin, unsigned int end, const std::vector<int>& reco) const;
34 
37  std::string m_fileName;
38 
40  std::ofstream m_fileOutput;
41 
42  SG::ReadHandleKey<xAOD::MuonSegmentContainer> m_segmentKey{this, "SegmentLocation", "MuonSegments"};
43  SG::ReadHandleKey<xAOD::MuonSegmentContainer> m_truthSegmentKey{this, "TruthSegmentLocation", "MuonTruthSegments"};
44  SG::ReadDecorHandleKey<xAOD::MuonSegmentContainer> m_truthSegmenLinkKey{this, "truthSegmentsRecoSegmentLinkKey", m_truthSegmentKey, "recoSegmentLink" };
45 
46  unsigned int m_nevents;
47  std::vector<int> m_nhitCuts;
48  std::vector<std::string> m_hitCutString;
49  std::vector<std::vector<int> > m_ntruth;
50  std::vector<std::vector<int> > m_nfound;
51  std::vector<std::vector<int> > m_nfake;
52 };
53 
54 #endif // MUONPERFORMANCEALG
MuonSegmentPerformanceAlg::initialize
virtual StatusCode initialize() override
Definition: MuonSegmentPerformanceAlg.cxx:21
MuonSegmentPerformanceAlg::m_segmentKey
SG::ReadHandleKey< xAOD::MuonSegmentContainer > m_segmentKey
Definition: MuonSegmentPerformanceAlg.h:42
ReadDecorHandleKey.h
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
MuonSegmentPerformanceAlg::m_ntruth
std::vector< std::vector< int > > m_ntruth
Definition: MuonSegmentPerformanceAlg.h:49
MuonSegmentPerformanceAlg::m_truthSegmentKey
SG::ReadHandleKey< xAOD::MuonSegmentContainer > m_truthSegmentKey
Definition: MuonSegmentPerformanceAlg.h:43
MuonSegmentPerformanceAlg::m_hitCutString
std::vector< std::string > m_hitCutString
Definition: MuonSegmentPerformanceAlg.h:48
MuonSegmentPerformanceAlg::~MuonSegmentPerformanceAlg
virtual ~MuonSegmentPerformanceAlg()=default
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
MuonSegmentPerformanceAlg::printRatio
std::string printRatio(const std::string &prefix, unsigned int begin, unsigned int end, const std::vector< int > &reco, const std::vector< int > &truth) const
Definition: MuonSegmentPerformanceAlg.cxx:110
MuonSegmentPerformanceAlg::m_nhitCuts
std::vector< int > m_nhitCuts
Definition: MuonSegmentPerformanceAlg.h:47
MuonSegmentPerformanceAlg::m_fileOutput
std::ofstream m_fileOutput
output file
Definition: MuonSegmentPerformanceAlg.h:40
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:562
SG::ReadHandleKey
Property holding a SG store/key/clid from which a ReadHandle is made.
Definition: StoreGate/StoreGate/ReadHandleKey.h:39
MuonSegmentPerformanceAlg::MuonSegmentPerformanceAlg
MuonSegmentPerformanceAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: MuonSegmentPerformanceAlg.cxx:12
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
MuonSegmentPerformanceAlg::m_nevents
unsigned int m_nevents
Definition: MuonSegmentPerformanceAlg.h:46
MuonSegmentContainer.h
MuonSegmentPerformanceAlg
Definition: MuonSegmentPerformanceAlg.h:17
AthAlgorithm.h
MuonSegmentPerformanceAlg::m_nfake
std::vector< std::vector< int > > m_nfake
Definition: MuonSegmentPerformanceAlg.h:51
MuonSegmentPerformanceAlg::m_nfound
std::vector< std::vector< int > > m_nfound
Definition: MuonSegmentPerformanceAlg.h:50
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:44
checkCorrelInHIST.prefix
dictionary prefix
Definition: checkCorrelInHIST.py:391
MuonSegmentPerformanceAlg::retrieve
bool retrieve(const SG::ReadHandleKey< xAOD::MuonSegmentContainer > &, const xAOD::MuonSegmentContainer *&ptr) const
Definition: MuonSegmentPerformanceAlg.cxx:192
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
MuonSegmentPerformanceAlg::execute
virtual StatusCode execute() override
Definition: MuonSegmentPerformanceAlg.cxx:43
AthAlgorithm
Definition: AthAlgorithm.h:47
MuonSegmentPerformanceAlg::m_writeToFile
bool m_writeToFile
name of external file to write statistics
Definition: MuonSegmentPerformanceAlg.h:36
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
MuonSegmentPerformanceAlg::m_fileName
std::string m_fileName
Definition: MuonSegmentPerformanceAlg.h:37
MuonSegmentPerformanceAlg::cardinality
unsigned int cardinality() const override final
Definition: MuonSegmentPerformanceAlg.h:28
MuonSegmentPerformanceAlg::finalize
virtual StatusCode finalize() override
Definition: MuonSegmentPerformanceAlg.cxx:151
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