MUSIC unknown
Analysis for the MUSIC active-target ionization chamber
Loading...
Searching...
No Matches
main_split_sol.cpp
Go to the documentation of this file.
1#include "BinaryUtils.hpp"
2#include <iostream>
3#include <sstream>
4
5int main(int argc, char *argv[]) {
6 if (argc < 4) {
7 std::cerr << "Usage: " << argv[0]
8 << " <input.sol> <output_dir> <chunk_seconds>" << std::endl;
9 return 1;
10 }
11
12 const char *inputFile = argv[1];
13 const char *outputDir = argv[2];
14 Double_t chunkSeconds = std::stod(argv[3]);
15
16 std::cout << "Splitting " << inputFile << " into " << chunkSeconds
17 << "s chunks..." << std::endl;
18
19 Int_t totalBlocks = 0;
20 Int_t totalChunks = 0;
21 std::vector<TString> outputFiles = SOLReader::SplitSolFileByTime(
22 inputFile, outputDir, chunkSeconds, totalBlocks, totalChunks);
23
24 if (outputFiles.empty()) {
25 std::cerr << "ERROR: Failed to split file" << std::endl;
26 return 1;
27 }
28
29 std::cout << "Output files:" << std::endl;
30 for (std::vector<TString>::const_iterator it = outputFiles.begin();
31 it != outputFiles.end(); ++it) {
32 std::cout << " " << *it << std::endl;
33 }
34
35 return 0;
36}
int main()