ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
EfexCSVTables Class Reference

#include <EfexCSVTables.h>

Inheritance diagram for EfexCSVTables:
Collaboration diagram for EfexCSVTables:

Public Member Functions

std::shared_ptr< CSVWrapperGetTable (int table_num)
 

Static Public Member Functions

static EfexCSVTablesgetInstance ()
 

Private Member Functions

 EfexCSVTables (EfexCSVTables const &)=delete
 
void operator= (EfexCSVTables const &)=delete
 
 EfexCSVTables ()
 

Private Attributes

std::array< std::shared_ptr< CSVWrapper >, 6 > m_tables
 
std::array< bool, 6 > m_table_opens
 
std::string m_subsystem
 

Detailed Description

Definition at line 6 of file EfexCSVTables.h.

Constructor & Destructor Documentation

◆ EfexCSVTables() [1/2]

EfexCSVTables::EfexCSVTables ( EfexCSVTables const )
privatedelete

◆ EfexCSVTables() [2/2]

EfexCSVTables::EfexCSVTables ( )
private

Definition at line 3 of file EfexCSVTables.cxx.

3 : CSVTablesBase("eFex") {}

Member Function Documentation

◆ getInstance()

EfexCSVTables & EfexCSVTables::getInstance ( )
static

Definition at line 5 of file EfexCSVTables.cxx.

5  {
6  static thread_local EfexCSVTables instance; // Guaranteed to be destroyed.
7  // Instantiated on first use.
8  return instance;
9 }

◆ GetTable()

std::shared_ptr< CSVWrapper > CSVTablesBase::GetTable ( int  table_num)
inherited

Definition at line 26 of file CSVTablesBase.cxx.

26  {
27  //Check if table not open, the construct table
28  std::string suffixName = m_subsystem + "Map"
29  + std::to_string(table_num)
30  + ".csv";
31  if( not (m_table_opens.at(table_num-1) )){
32 #ifdef OFFLINE_DECODER
33  auto mappingfilename = PathResolver::find_file("L1CaloFEXByteStream/2022-07-22/" + suffixName,"CALIBPATH");
34  auto file = std::ifstream(mappingfilename, std::ifstream::in);
35  if (!mappingfilename.empty() && file.good()) {
36  m_tables.at(table_num-1) = std::make_shared<CSVWrapper> (file);
37  m_table_opens.at(table_num-1) = true;
38  return m_tables.at(table_num-1);
39  } else {
40  throw std::runtime_error(std::string("Cannot find file ") + suffixName);
41  }
42 #else
43  const char* l1caloRootEnv = std::getenv("L1CALO_ROOT");
44  if (!l1caloRootEnv) {
45  throw l1calo::EnvUndefined(ERS_HERE,"L1CALO_ROOT");
46  }
47  // To be able to use updated mappings while building the release
48  // check for files in the source area then the installed area.
49  std::string l1caloRoot(l1caloRootEnv);
50  auto baseDir = l1caloRoot.substr(0,l1caloRoot.find_last_of("/"));
51  std::vector<std::string> mapDirs = {
52  baseDir + "/channelMappings/data/",
53  baseDir + "/installed/share/data/channelMappings/",
54  };
55  for (auto& basePath: mapDirs) {
56  auto mappingfilename = basePath + suffixName;
57  auto file = std::ifstream(mappingfilename, std::ifstream::in);
58  if (file.good()) {
59  m_tables.at(table_num-1) = std::make_shared<CSVWrapper> (file);
60  m_table_opens.at(table_num-1) = true;
61  return m_tables.at(table_num-1);
62  }
63  }
64  std::string suffixPath = suffixName + " (under " + baseDir + ")";
65  throw l1calo::FileError(ERS_HERE,"open",suffixPath);
66 #endif
67  }
68  return m_tables.at(table_num-1);
69 }

◆ operator=()

void EfexCSVTables::operator= ( EfexCSVTables const )
privatedelete

Member Data Documentation

◆ m_subsystem

std::string CSVTablesBase::m_subsystem
privateinherited

Definition at line 20 of file CSVTablesBase.h.

◆ m_table_opens

std::array<bool, 6> CSVTablesBase::m_table_opens
privateinherited

Definition at line 19 of file CSVTablesBase.h.

◆ m_tables

std::array<std::shared_ptr<CSVWrapper>, 6> CSVTablesBase::m_tables
privateinherited

Definition at line 18 of file CSVTablesBase.h.


The documentation for this class was generated from the following files:
MuonR4::to_string
std::string to_string(const SectorProjector proj)
Definition: MsTrackSeeder.cxx:66
CSVTablesBase::m_table_opens
std::array< bool, 6 > m_table_opens
Definition: CSVTablesBase.h:19
instance
std::map< std::string, double > instance
Definition: Run_To_Get_Tags.h:8
CSVTablesBase::m_subsystem
std::string m_subsystem
Definition: CSVTablesBase.h:20
file
TFile * file
Definition: tile_monitor.h:29
runITkAlign.baseDir
baseDir
Definition: runITkAlign.py:63
SCT_ConditionsAlgorithms::CoveritySafe::getenv
std::string getenv(const std::string &variableName)
get an environment variable
Definition: SCT_ConditionsUtilities.cxx:17
PathResolver::find_file
static std::string find_file(const std::string &logical_file_name, const std::string &search_path)
Definition: PathResolver.cxx:220
CSVTablesBase::m_tables
std::array< std::shared_ptr< CSVWrapper >, 6 > m_tables
Definition: CSVTablesBase.h:18
EfexCSVTables
Definition: EfexCSVTables.h:6
CSVTablesBase::CSVTablesBase
CSVTablesBase(const std::string &subsystem)
Definition: CSVTablesBase.cxx:20