#include "art/Framework/IO/Root/RootSizeOnDisk.h"
#include "boost/program_options.hpp"
#include "cetlib/container_algorithms.h"
#include "TError.h"
#include "TFile.h"
#include <iostream>
#include <memory>
#include <string>
Go to the source code of this file.
|
int | main (int argc, char **argv) |
|
int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 21 of file product_sizes_dumper.cc.
28 std::ostringstream descstr;
29 descstr <<
argv[0] <<
" <options> [<source-file>]+";
30 bpo::options_description desc(descstr.str());
31 desc.add_options()(
"help,h",
"this help message.")(
33 bpo::value<double>()->default_value(0.05,
"0.05"),
34 "floating point number on the range [0,1]. " 35 "If a TTree occupies a fraction on disk of the total space in the file " 36 "that is less than <f>, then a detailed analysis of its branches will " 38 "source,s", bpo::value<stringvec>(),
"source data file (multiple OK)");
39 bpo::options_description all_opts(
"All Options.");
43 bpo::positional_options_description pd;
46 bpo::variables_map vm;
48 bpo::store(bpo::command_line_parser(argc, argv)
56 std::cerr <<
"Exception from command line processing in " << argv[0] <<
": " 60 if (vm.count(
"help")) {
61 std::cout << desc << std::endl;
66 double minimumFraction(-1.);
67 if (vm.count(
"fraction")) {
68 minimumFraction = vm[
"fraction"].as<
double>();
69 if (minimumFraction < 0 || minimumFraction > 1) {
70 std::cerr <<
"Must choose fraction between 0 and 1\n" 71 <<
"For usage and options list, please do " 72 "'product_sizes_dumper --help'.\n";
79 size_t const file_count = vm.count(
"source");
81 std::cerr <<
"One or more input files must be specified;" 82 <<
" supply filenames as program arguments\n" 83 <<
"For usage and options list, please do 'product_sizes_dumper " 87 file_names.reserve(file_count);
88 cet::copy_all(vm[
"source"].as<stringvec>(), std::back_inserter(file_names));
95 for (
auto const&
filename : file_names) {
98 if (file_names.size() > 1 &&
n != 0)
99 std::cout << separator << std::endl;
105 auto file = std::make_unique<TFile>(
filename.c_str());
111 info.print(std::cout, minimumFraction);
114 if (file_names.size() > 1)
115 std::cout <<
"Done: " <<
filename << std::endl;
std::vector< std::string > stringvec
auto copy_all(FwdCont &, FwdIter)