9 #include <framework/logging/Logger.h>
10 #include <framework/gearbox/Unit.h>
11 #include <framework/dataobjects/BackgroundMetaData.h>
17 #include <boost/program_options.hpp>
24 namespace prog = boost::program_options;
26 int main(
int argc,
char* argv[])
29 prog::options_description options(
"Options");
31 (
"help,h",
"print available options")
32 (
"file,f", prog::value<string>(),
"local file name")
35 prog::positional_options_description posOptDesc;
36 posOptDesc.add(
"file", -1);
38 prog::variables_map varMap;
39 prog::store(prog::command_line_parser(argc, argv).
40 options(options).positional(posOptDesc).run(), varMap);
44 if (varMap.count(
"help")) {
45 cout <<
"Usage: " << argv[0] <<
" [OPTIONS] [FILE]\n";
46 cout << options << endl;
54 if (varMap.count(
"file")) {
55 gErrorIgnoreLevel = kError;
56 string fileName = varMap[
"file"].as<
string>();
57 TFile* file = TFile::Open(fileName.c_str(),
"READ");
58 if (!file || !file->IsOpen()) {
59 B2ERROR(
"Couldn't open file " << fileName);
62 TTree* tree = (TTree*) file->Get(
"persistent");
64 B2ERROR(
"No tree persistent found in " << fileName);
67 TBranch* branch = tree->GetBranch(
"BackgroundMetaData");
69 B2ERROR(
"No meta data found in " << fileName);
73 branch->SetAddress(&metaDataPtr);
77 B2ERROR(
"Please specify a file name.");
81 cout <<
"BackgroundMetaData in file " << varMap[
"file"].as<
string>() <<
": " << endl;
83 cout <<
"Real time : " << metaDataPtr->
getRealTime() / Unit::us <<
" us" << endl << endl;
Abstract base class for different kinds of events.
int main(int argc, char **argv)
Run all tests.