7 #include "boost/regex.hpp" 32 string name = histPtr->GetName();
35 cerr <<
"TH1Store::add() Error: '" <<
name <<
"' already exists. Aborting." << endl;
39 cout <<
"THStore::add() : Adding " <<
name << endl;
42 histPtr->SetDirectory(
nullptr);
52 cerr <<
"TH1Store::hist() Error: '" <<
name <<
"' does not exists. Aborting." << endl;
59 TFile *filePtr = TFile::Open(
filename.c_str(),
"RECREATE");
61 cerr <<
"TH1Store::write() Error: Can not open '" <<
filename <<
"' for output. Aborting." << endl;
64 write(filePtr, argsVec, inputFilesVec);
81 iter->second->Write();
86 if (!argsVec.empty()) {
87 dir->WriteObject(&argsVec,
"argsVec");
89 if (!inputFilesVec.empty()) {
90 dir->WriteObject(&inputFilesVec,
"inputFiles");
92 cout <<
"TH1Store::write(): Successfully written to '" << filePtr->GetName() <<
"'." << endl;
97 TDirectory *dirPtr = filePtr->GetDirectory(
dirName.c_str());
104 const boost::regex subdirRE(
"(.+?)/([^/]+)");
106 TDirectory *parentDir =
nullptr;
115 dirPtr = parentDir->mkdir(useName.c_str());
bool m_deleteOnDestruction
ostream & operator<<(ostream &o_stream, const TH1Store &rhs)
void add(TH1 *histPtr, const std::string &directory="")
static const SVec kEmptyVec
STH1PtrMap::const_iterator STH1PtrMapConstIter
void write(const std::string &filename, const SVec &argsVec=kEmptyVec, const SVec &inputFilesVec=kEmptyVec) const
STH1PtrMap::iterator STH1PtrMapIter
TDirectory * _createDir(const std::string &dirname, TFile *filePtr) const
std::vector< std::string > SVec
SSMap::const_iterator SSMapConstIter
TH1 * hist(const std::string &name)