9 #include <framework/core/Environment.h>
10 #include <framework/datastore/DataStore.h>
11 #include <framework/datastore/StoreObjPtr.h>
12 #include <framework/utilities/FileSystem.h>
14 #include <framework/logging/Logger.h>
16 #define BELLE_TARGET_H "belle-x86_64-unknown-linux-gnu-g++.h"
17 #include "belle_legacy/panther/panther.h"
18 #include "belle_legacy/panther/panther_group.h"
19 #include "belle_legacy/tables/belletdf.h"
21 #include <boost/program_options.hpp>
29 namespace po = boost::program_options;
32 int main(
int argc,
char* argv[])
36 po::options_description description(
"Options");
37 description.add_options()
38 (
"filename", po::value<std::string>(&filename),
"belle 1 mdst file");
40 po::positional_options_description p;
41 p.add(
"filename", -1);
44 po::parsed_options parsed = po::command_line_parser(argc, argv).options(description).positional(p).run();
45 po::store(parsed, vm);
47 if (vm.count(
"help")) {
48 std::cout << description << std::endl;
52 }
catch (po::error& err) {
53 std::cerr <<
"Error: " << err.what() <<
"\n";
58 const char* table_dir = getenv(
"PANTHER_TABLE_DIR");
59 if (!table_dir or !FileSystem::isDir(table_dir)) {
60 string fixed_table_dir = Environment::Instance().getExternalsPath() +
"/share/belle_legacy/panther";
61 B2WARNING(
"PANTHER_TABLE_DIR environment variable not set correctly. This is a known problem with externals v00-05-09, using " <<
62 fixed_table_dir <<
" instead.");
63 if (!FileSystem::isDir(fixed_table_dir))
64 B2FATAL(
"Path " << fixed_table_dir <<
" does not exist, your externals setup seems broken.");
65 setenv(
"PANTHER_TABLE_DIR", fixed_table_dir.c_str(), 1);
71 BsClrTab(BBS_CLEAR_ALL);
73 if (!std::filesystem::exists(filename)) {
74 std::cout <<
"Couldn't find file!" << std::endl;
79 Belle::Panther_FileIO* fd =
new Belle::Panther_FileIO(filename.c_str(), BBS_READ);
82 if (fd->read() == -1) {
83 B2FATAL(
"Couldn't read file '" << filename <<
"'!");
86 unsigned int nevt = 0;
90 while (rectype > -2) {
92 while (rectype < 0 && rectype != -2) {
97 B2ERROR(
"Error while reading panther tables! Record skipped.");
105 std::cout << static_cast<int>(nevt) - 2 << std::endl;
Abstract base class for different kinds of events.
int main(int argc, char **argv)
Run all tests.