ATLAS Offline Software
TRTStrawStatusAccessor.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 #include <fstream>
7 
8 void TRTStrawStatusAccessor::fill(const std::string& path)
9 {
10  std::ifstream file{path};
11  if(!file.is_open()) throw std::runtime_error{"Failed to open " + path + " for reading"};
12 
13  m_statusMap.clear();
14  while(!file.eof()) {
15  Key key;
16  int status;
17  file >> key >> status;
18  m_statusMap.emplace(key,status);
19  }
20  file.close();
21 }
22 
24 {
25  auto it = m_statusMap.find(id.get_compact());
26  if(it!=m_statusMap.end()) return it->second;
27  return -1;
28 }
athena.path
path
python interpreter configuration --------------------------------------—
Definition: athena.py:128
skel.it
it
Definition: skel.GENtoEVGEN.py:407
TRTStrawStatusAccessor::Key
Identifier::value_type Key
Definition: TRTStrawStatusAccessor.h:23
file
TFile * file
Definition: tile_monitor.h:29
TRTStrawStatusAccessor::m_statusMap
std::map< Key, int > m_statusMap
Definition: TRTStrawStatusAccessor.h:24
TRTStrawStatusAccessor.h
TRTStrawStatusAccessor::fill
void fill(const std::string &path)
Definition: TRTStrawStatusAccessor.cxx:8
TRTStrawStatusAccessor::status
int status(const Identifier &id) const
Definition: TRTStrawStatusAccessor.cxx:23
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37
Identifier
Definition: IdentifierFieldParser.cxx:14