9#include <framework/logging/Logger.h>
10#include <framework/utilities/FileSystem.h>
11#include <cdc/utilities/OpenFile.h>
13#include <boost/iostreams/device/file.hpp>
14#include <boost/iostreams/filter/gzip.hpp>
26 void openFileA(std::ifstream& ifs,
const std::string& fileName0)
28 std::string fileName1 =
"/data/cdc/" + fileName0;
36 B2FATAL(
"CDC::openFile: " << fileName0 <<
" not exist!");
38 B2INFO(
"CDC::openFile: open " << fileName);
39 ifs.open(fileName.c_str());
40 if (!ifs) B2FATAL(
"CDC::openFile: cannot open " << fileName <<
" !");
45 void openFileB(boost::iostreams::filtering_istream& ifs,
const std::string& fileName0)
47 std::string fileName1 =
"/data/cdc/" + fileName0;
55 B2FATAL(
"CDC::openFile: " << fileName0 <<
" not exist!");
57 B2INFO(
"CDC::openFile: open " << fileName);
58 if ((fileName.rfind(
".gz") != string::npos) && (fileName.length() - fileName.rfind(
".gz") == 3)) {
59 ifs.push(boost::iostreams::gzip_decompressor());
61 ifs.push(boost::iostreams::file_source(fileName));
62 if (!ifs) B2FATAL(
"CDC::openFile: cannot open " << fileName <<
" !");
static std::string findFile(const std::string &path, bool silent=false)
Search for given file or directory in local or central release directory, and return absolute path if...
void openFileB(boost::iostreams::filtering_istream &ifs, const std::string &fileName0)
Open a file using boost (to be able to read a gzipped file)
void openFileA(std::ifstream &ifs, const std::string &fileName0)
Open a file.
Abstract base class for different kinds of events.