24 unsigned int nbins = 3;
36 return StatusCode::SUCCESS;
40 const EventContext& ctx{Gaudi::Hive::currentContext()};
45 if (!segments || !truthSegments) {
46 return StatusCode::SUCCESS;
48 std::set<const xAOD::MuonSegment*> matchedSegments;
51 bool missedSegment =
false;
52 for (
const auto seg : *truthSegments) {
57 unsigned int index = 0;
58 if (seg->nPrecisionHits() < 3)
continue;
67 recoSegmentLinkAcc(
"recoSegmentLink");
71 matchedSegments.insert(*recoLink);
75 <<
" eta " << seg->etaIndex() <<
" nprec " << seg->nPrecisionHits() <<
" nphi " << seg->nPhiLayers()
76 <<
" nTrigEta " << seg->nTrigEtaLayers());
82 for (
const auto seg : *segments) {
83 if (matchedSegments.count(seg))
continue;
90 unsigned int index = 0;
91 if (seg->nPrecisionHits() < 3)
continue;
96 <<
" eta " << seg->etaIndex() <<
" nprec " << seg->nPrecisionHits() <<
" nphi " << seg->nPhiLayers()
97 <<
" nTrigEta " << seg->nTrigEtaLayers());
102 return StatusCode::SUCCESS;
107 std::ostringstream sout;
108 unsigned int width = 9;
109 unsigned int precision = 3;
110 sout << std::endl << prefix;
111 for (
unsigned int i = begin; i < end; ++i) {
112 sout << std::setw(
width) << std::setprecision(precision);
116 sout << static_cast<double>(reco[i]) /
static_cast<double>(truth[i]);
121 for (
unsigned int i = begin; i < end; ++i) {
122 sout << std::setw(
width) << std::setprecision(precision);
126 sout << static_cast<double>(truth[i]);
132 std::ostringstream sout;
133 unsigned int width = 9;
134 unsigned int precision = 3;
135 sout << std::endl << prefix;
136 for (
unsigned int i = begin; i < end; ++i) {
137 sout << std::setw(
width) << std::setprecision(precision);
141 sout << static_cast<double>(reco[i]) /
static_cast<double>(
m_nevents);
147 std::ofstream fileOutput;
148 std::string outfile =
"muonPerformance_segments.txt";
149 fileOutput.open(outfile.c_str(), std::ios::trunc);
150 std::ostringstream sout;
153 unsigned int width = 9;
154 sout <<
"Segment finding efficiencies barrel" << std::endl;
155 sout <<
" Chambers ";
156 std::string prefix_eff =
" Efficiency ";
157 std::string prefix_fake =
" Fake rate ";
159 for (
unsigned int i = 0; i <
s_chIdxMax; ++i){
163 sout << std::setw(width) << chName(static_cast<ChIndex>(i));
166 for (
unsigned int j = 0; j < end; ++j) {
170 for (
unsigned int j = 0; j < end; ++j) {
175 sout <<
"Segment finding efficiencies endcaps" << std::endl;
176 sout <<
" Chambers ";
177 for (
unsigned int i = end; i <
s_chIdxMax; ++i)
179 for (
unsigned int j = 0; j <
m_nfound.size(); ++j) {
184 for (
unsigned int j = 0; j <
m_nfound.size(); ++j) {
188 fileOutput << sout.str() << std::endl;
190 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
Helper class to provide constant type-safe access to aux data.
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
ElementLink implementation for ROOT usage.
bool isValid() const
Test to see if the link can be dereferenced.
Helper class to provide constant type-safe access to aux data.
ChIndex chIndex(const std::string &index)
convert ChIndex name string to enum
constexpr int toInt(const EnumType enumVal)
bool isBarrel(const ChIndex index)
Returns true if the chamber index points to a barrel chamber.
const std::string & chName(ChIndex index)
convert ChIndex into a string
ChIndex
enum to classify the different chamber layers in the muon spectrometer
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
MuonSegmentContainer_v1 MuonSegmentContainer
Definition of the current "MuonSegment container version".