13int main(
int argc,
char **argv)
17 std::cout <<
"Usage: " << argv[0] <<
" (input ROOT file) (output NAGASH file)" << std::endl;
21 TFile *f =
new TFile(argv[1],
"READ");
24 std::cout <<
"Input Root file is broken!" << std::endl;
28 TIter next(f->GetListOfKeys());
32 NAGASHFile outfile(std::make_shared<MSGTool>(), argv[2], NAGASHFile::Mode::WRITE);
34 while ((key = (TKey *)next()))
37 if (TString(key->GetClassName()) == TString(
"TH1D"))
39 TH1D *h = (TH1D *)(key->ReadObj());
42 NNGHist<Axis::Regular> nnghist(h);
43 outfile.SaveHist(h->GetName(), nnghist);
47 NNGHist<Axis::Variable> nnghist(h);
48 outfile.SaveHist(h->GetName(), nnghist);
52 if (TString(key->GetClassName()) == TString(
"TH2D"))
54 TH2D *h = (TH2D *)(key->ReadObj());
57 NNGHist<Axis::Regular, Axis::Regular> nnghist(h);
58 outfile.SaveHist(h->GetName(), nnghist);
62 NNGHist<Axis::Regular, Axis::Variable> nnghist(h);
63 outfile.SaveHist(h->GetName(), nnghist);
67 NNGHist<Axis::Variable, Axis::Regular> nnghist(h);
68 outfile.SaveHist(h->GetName(), nnghist);
72 NNGHist<Axis::Variable, Axis::Variable> nnghist(h);
73 outfile.SaveHist(h->GetName(), nnghist);
77 if (TString(key->GetClassName()) == TString(
"TH3D"))
79 TH3D *h = (TH3D *)(key->ReadObj());
82 NNGHist<Axis::Regular, Axis::Regular, Axis::Regular> nnghist(h);
83 outfile.SaveHist(h->GetName(), nnghist);
87 NNGHist<Axis::Variable, Axis::Variable, Axis::Variable> nnghist(h);
88 outfile.SaveHist(h->GetName(), nnghist);