-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathgen_lhcb.cxx
66 lines (56 loc) · 1.59 KB
/
gen_lhcb.cxx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#include <ROOT/RNTupleImporter.hxx>
#include <TROOT.h>
#include <cstdio>
#include <iostream>
#include <string>
#include <unistd.h>
#include "util.h"
using RNTupleImporter = ROOT::Experimental::RNTupleImporter;
void Usage(char *progname)
{
std::cout << "Usage: " << progname << " -o <ntuple-path> -c <compression> [-m(t)] <B2HHH.root>"
<< std::endl;
}
int main(int argc, char **argv)
{
std::string inputFile = "B2HHH.root";
std::string outputPath = ".";
int compressionSettings = 0;
std::string compressionShorthand = "none";
std::string treeName = "DecayTree";
int c;
while ((c = getopt(argc, argv, "hvi:o:c:m")) != -1) {
switch (c) {
case 'h':
case 'v':
Usage(argv[0]);
return 0;
case 'i':
inputFile = optarg;
break;
case 'o':
outputPath = optarg;
break;
case 'c':
compressionSettings = GetCompressionSettings(optarg);
compressionShorthand = optarg;
break;
case 'm':
ROOT::EnableImplicitMT();
break;
default:
fprintf(stderr, "Unknown option: -%c\n", c);
Usage(argv[0]);
return 1;
}
}
std::string dsName = "B2HHH";
std::string outputFile = outputPath + "/" + dsName + "~" + compressionShorthand + ".ntuple";
unlink(outputFile.c_str());
auto importer = RNTupleImporter::Create(inputFile, treeName, outputFile);
auto options = importer->GetWriteOptions();
options.SetCompression(compressionSettings);
importer->SetWriteOptions(options);
importer->Import();
return 0;
}