#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::RCompressionSetting::EAlgorithm::kZLIB )
51 comp_level = ROOT::RCompressionSetting::ELevel::kDefaultZLIB;
52 else if( comp_alg == ROOT::RCompressionSetting::EAlgorithm::kLZMA)
53 comp_level = ROOT::RCompressionSetting::ELevel::kDefaultLZMA;
54 else if( comp_alg == ROOT::RCompressionSetting::EAlgorithm::kLZ4 )
55 comp_level = ROOT::RCompressionSetting::ELevel::kDefaultLZ4;
56 else comp_level = ROOT::RCompressionSetting::ELevel::kUseMin;
59 if (auto_flush == -1) {
60 auto_flush = (
static_cast<TTree*
>(
input_file->Get(
"CollectionTree")))->GetAutoFlush();
70 for ( TKey* tree_key =
static_cast<TKey*
>(nextTree()); tree_key; tree_key =
static_cast<TKey*
>(nextTree()) ) {
71 if (strcmp(tree_key->GetClassName(),
"TTree"))
continue;
73 TTree* input_tree =
static_cast<TTree*
>(
input_file->Get(tree_key->GetName()));
79 if (!strcmp(tree_key->GetName(),
"CollectionTree"))
output_tree->SetAutoFlush(auto_flush);
85 int nentries = input_tree->GetEntriesFast();
87 input_tree->GetEntry(
i);
◆ main()
int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 109 of file compressionTool.cxx.
110 const char* input_filename =
"";
118 if (*
argv[
i] ==
'-') {
119 switch(::toupper(*(
argv[
i]+1))) {
149 if (input_filename ==
nullptr) {
150 cout <<
"No input filename received" << endl;
154 cout <<
"No output filename received" << endl;
◆ usage()
Definition at line 97 of file compressionTool.cxx.
98 cout <<
"Tool to change compression settings of a ROOT file.\n"
100 "-i <input filename>\n"
101 "-o <output filename>\n"
102 "-c <compression algorithm> 1==ZLIB, 2==LZMA, 4==LZ4, -1==Match input file\n"
103 "-l <compression level> Possible values: 1-9, -1==Match input file or default\n"
104 "-a <auto flush> Possible values: any int, -1==Match input file\n"
105 "-h Return usage details\n";