9#include <framework/logging/Logger.h>
10#include <framework/dataobjects/FileMetaData.h>
15#include <boost/program_options.hpp>
23namespace po = boost::program_options;
25int main(
int argc,
char* argv[])
30 if (signal(SIGPIPE, SIG_DFL) == SIG_ERR) {
31 B2FATAL(
"Cannot remove SIGPIPE signal handler");
35 po::options_description description(
"Options");
36 description.add_options()
37 (
"filename", po::value<std::string>(&filename),
"belle 2 mdst file");
39 po::positional_options_description p;
40 p.add(
"filename", -1);
43 po::parsed_options parsed = po::command_line_parser(argc, argv).options(description).positional(p).run();
44 po::store(parsed, vm);
46 if (vm.count(
"help")) {
47 std::cout << description << std::endl;
51 }
catch (po::error& err) {
52 std::cerr <<
"Error: " << err.what() <<
"\n";
60 TFile* file = TFile::Open(filename.c_str(),
"READ");
61 if (!file || !file->IsOpen()) {
62 B2ERROR(
"Couldn't open file " << filename);
65 TTree* tree = (TTree*) file->Get(
"persistent");
67 B2ERROR(
"No tree persistent found in " << filename);
70 TBranch* branch = tree->GetBranch(
"FileMetaData");
72 B2ERROR(
"No meta data found in " << filename);
76 branch->SetAddress(&metaDataPtr);
78 std::cout << metaDataPtr->
getNEvents() << std::endl;
Abstract base class for different kinds of events.