ATLAS Offline Software
Loading...
Searching...
No Matches
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
19public:
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;}
30private:
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
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
virtual StatusCode initialize() override
std::vector< counter_t > m_ntruth
std::ofstream m_fileOutput
output file
SG::ReadHandleKey< xAOD::MuonSegmentContainer > m_segmentKey
std::vector< counter_t > m_nfake
virtual StatusCode execute() override
virtual ~MuonSegmentPerformanceAlg()=default
MuonSegmentPerformanceAlg(const std::string &name, ISvcLocator *pSvcLocator)
std::array< int, s_chIdxMax > counter_t
std::vector< counter_t > m_nfound
std::string printRatio(const std::string &prefix, unsigned int begin, unsigned int end, const counter_t &reco, const counter_t &truth) const
unsigned int cardinality() const override final
SG::ReadHandleKey< xAOD::MuonSegmentContainer > m_truthSegmentKey
SG::ReadDecorHandleKey< xAOD::MuonSegmentContainer > m_truthSegmenLinkKey
static constexpr unsigned s_chIdxMax
bool m_writeToFile
name of external file to write statistics
virtual StatusCode finalize() override
std::vector< std::string > m_hitCutString
Property holding a SG store/key/clid/attr name from which a ReadDecorHandle is made.
Property holding a SG store/key/clid from which a ReadHandle is made.
constexpr int toInt(const EnumType enumVal)