5 #ifndef OFFLINE_DECODER
6 #include "ersL1Calo/Exceptions.h"
32 #ifdef OFFLINE_DECODER
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);
40 throw std::runtime_error(std::string(
"Cannot find file ") + suffixName);
43 const char* l1caloRootEnv =
std::getenv(
"L1CALO_ROOT");
45 throw l1calo::EnvUndefined(ERS_HERE,
"L1CALO_ROOT");
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/",
55 for (
auto& basePath: mapDirs) {
56 auto mappingfilename = basePath + suffixName;
57 auto file = std::ifstream(mappingfilename, std::ifstream::in);
59 m_tables.at(table_num-1) = std::make_shared<CSVWrapper> (
file);
64 std::string suffixPath = suffixName +
" (under " +
baseDir +
")";
65 throw l1calo::FileError(ERS_HERE,
"open",suffixPath);