4 #include <TCollection.h>
5 #include <TDirectory.h>
35 std::cout << __PRETTY_FUNCTION__ <<
" no histograms to be saved " << std::endl;
39 TFile *
f = TFile::Open(
m_Filename.c_str(),
"RECREATE");
45 gROOT->cd(currdir.c_str());
54 std::cout << __PRETTY_FUNCTION__ <<
" Could not open " <<
m_Filename << std::endl;
57 TList *list = fin->GetListOfKeys();
60 std::cout << __PRETTY_FUNCTION__ <<
" No keys found in " <<
m_Filename << std::endl;
62 gROOT->cd(currdir.c_str());
69 while ((key = (TKey *)
next()))
72 if ((obj->InheritsFrom(
"TH1")))
74 fin->GetObject(obj->GetName(),
h1);
75 h1->SetDirectory(
nullptr);
80 gROOT->cd(currdir.c_str());
87 std::cout <<
"histogram " << iter.first <<
", type "
88 << iter.second->IsA()->GetName() << std::endl;
95 const auto iter =
m_HistoMap.find(h1->GetName());
98 std::cout << __PRETTY_FUNCTION__ <<
" Histogram " << h1->GetName() <<
" already registered, use a different name and try again" << std::endl;
110 std::cout << __PRETTY_FUNCTION__ <<
": Histogram " << name <<
" not found" << std::endl;