#include "TFile.h"
#include "TTree.h"
#include "TKey.h"
#include <iostream>
Go to the source code of this file.
|
void | compression_tool (const char *input_filename, const char *output_filename, int comp_alg=-1, int comp_level=-1, int auto_flush=-1) |
|
int | usage () |
|
int | main (int argc, char **argv) |
|
◆ compression_tool()
void compression_tool |
( |
const char * |
input_filename, |
|
|
const char * |
output_filename, |
|
|
int |
comp_alg = -1 , |
|
|
int |
comp_level = -1 , |
|
|
int |
auto_flush = -1 |
|
) |
| |
Definition at line 31 of file compressionTool.cxx.
35 TFile*
input_file = TFile::Open(input_filename);
43 comp_alg =
input_file->GetCompressionAlgorithm();
44 if (comp_level == -1) {
45 comp_level =
input_file->GetCompressionLevel();
49 if (comp_level == -1) {
50 if (comp_alg == ROOT::kZLIB) comp_level = ROOT::RCompressionSetting::ELevel::kDefaultZLIB;
51 else if (comp_alg == ROOT::kLZMA) comp_level = ROOT::RCompressionSetting::ELevel::kDefaultLZMA;
52 else if (comp_alg == ROOT::kLZ4) comp_level = ROOT::RCompressionSetting::ELevel::kDefaultLZ4;
53 else comp_level = ROOT::RCompressionSetting::ELevel::kUseMin;
56 if (auto_flush == -1) {
57 auto_flush = (
static_cast<TTree*
>(
input_file->Get(
"CollectionTree")))->GetAutoFlush();
67 for ( TKey* tree_key =
static_cast<TKey*
>(nextTree()); tree_key; tree_key =
static_cast<TKey*
>(nextTree()) ) {
68 if (strcmp(tree_key->GetClassName(),
"TTree"))
continue;
70 TTree* input_tree =
static_cast<TTree*
>(
input_file->Get(tree_key->GetName()));
76 if (!strcmp(tree_key->GetName(),
"CollectionTree"))
output_tree->SetAutoFlush(auto_flush);
82 int nentries = input_tree->GetEntriesFast();
84 input_tree->GetEntry(
i);
◆ main()
int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 106 of file compressionTool.cxx.
107 const char* input_filename =
"";
115 if (*
argv[
i] ==
'-') {
116 switch(::toupper(*(
argv[
i]+1))) {
146 if (input_filename ==
nullptr) {
147 cout <<
"No input filename received" << endl;
151 cout <<
"No output filename received" << endl;
◆ usage()
Definition at line 94 of file compressionTool.cxx.
95 cout <<
"Tool to change compression settings of a ROOT file.\n"
97 "-i <input filename>\n"
98 "-o <output filename>\n"
99 "-c <compression algorithm> 1==ZLIB, 2==LZMA, 4==LZ4, -1==Match input file\n"
100 "-l <compression level> Possible values: 1-9, -1==Match input file or default\n"
101 "-a <auto flush> Possible values: any int, -1==Match input file\n"
102 "-h Return usage details\n";