Heavy ion Analysis Libriares
Loading...
Searching...
No Matches
hal_report.cpp
1/*
2 * hal_report.cpp
3 *
4 * Created on: 30-04-2022
5 * Author: Daniel Wielanek
6 * E-mail: daniel.wielanek@gmail.com
7 * Warsaw University of Technology, Faculty of Physics
8 */
9
10#include "Cout.h"
11#include "Std.h"
12#include "HtmlCore.h"
13#include "Package2HTML.h"
14#include "PackageSql.h"
15
16#include <RtypesCore.h>
17#include <TString.h>
18#include <TSystem.h>
19#include <iostream>
20
21
43int main(int argc, char* argv[]) {
44 if (argc < 2) {
45 Hal::Cout::PrintInfo("No arguments! run: hal-report --help to get help", Hal::EInfo::kCriticalError);
46 return 0;
47 }
48 TString arg1 = argv[1];
49 if (arg1 == "--help") {
50 std::cout << " Usage:" << std::endl;
51 std::cout << "hal-report inFile outFile [OPTIONS] to extract files to local file" << std::endl;
52 std::cout << "hal-report inFile to extract files to local database" << std::endl;
53 std::cout << "OPTIONS:" << std::endl;
54 std::cout << "--online - extract files but use jsroot from official site " << std::endl;
55 std::cout << "--gz - compress archive to zip with using tar " << std::endl;
56 return 1;
57 }
58 if (argc < 3) {
59 Hal::Cout::PrintInfo("No output file, export to SQL", Hal::EInfo::kLowWarning);
60 Hal::PackageSql* sql = new Hal::PackageSql(argv[1]);
61 delete sql;
62 return 0;
63 }
64 gSystem->Load("libTree");
65 Bool_t zip = kFALSE;
66 if (argc > 3) {
67 for (int i = 3; i < argc; i++) {
68 TString temp = argv[i];
69 if (temp.EqualTo("--online")) Hal::HtmlCore::SetOnline(kTRUE);
70 if (temp.EqualTo("--gz")) zip = kTRUE;
71 }
72 }
73 Hal::Package2HTML* package = new Hal::Package2HTML(argv[1], argv[2]);
74 delete package;
75 if (zip) {
76 TString command = Form("tar -czvf %s.tar.gz %s", argv[2], argv[2]);
77 gSystem->Exec(command);
78 gSystem->Exec(Form("rm -rf %s", argv[2]));
79 }
80 return 0;
81}
static void PrintInfo(TString text, Hal::EInfo status)
Definition Cout.cxx:370
static void SetOnline(Bool_t online)
Definition HtmlCore.h:120