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);
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";
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;