2 #ifndef OFFLINE_DECODER
3 #include "ersL1Calo/Exceptions.h"
29 #ifdef OFFLINE_DECODER
31 auto file = std::ifstream(mappingfilename, std::ifstream::in);
32 if (!mappingfilename.empty() &&
file.good()) {
33 m_tables.at(table_num-1) = std::make_shared<CSVWrapper> (
file);
37 throw std::runtime_error(std::string(
"Cannot find file ") + suffixName);
40 const char* l1caloRootEnv =
std::getenv(
"L1CALO_ROOT");
42 throw l1calo::EnvUndefined(ERS_HERE,
"L1CALO_ROOT");
46 std::string l1caloRoot(l1caloRootEnv);
47 auto baseDir = l1caloRoot.substr(0,l1caloRoot.find_last_of(
"/"));
48 std::vector<std::string> mapDirs = {
49 baseDir +
"/channelMappings/data/",
50 baseDir +
"/installed/share/data/channelMappings/",
52 for (
auto& basePath: mapDirs) {
53 auto mappingfilename = basePath + suffixName;
54 auto file = std::ifstream(mappingfilename, std::ifstream::in);
56 m_tables.at(table_num-1) = std::make_shared<CSVWrapper> (
file);
61 std::string suffixPath = suffixName +
" (under " + baseDir +
")";
62 throw l1calo::FileError(ERS_HERE,
"open",suffixPath);