7 #include "boost/regex.hpp"
42 string name = histPtr->GetName();
46 cerr <<
"TH1Store::add() Error: '" << name
47 <<
"' already exists. Aborting." << endl;
52 cout <<
"THStore::add() : Adding " << name << endl;
55 histPtr->SetDirectory(0);
56 if (directory.length())
69 cerr <<
"TH1Store::hist() Error: '" << name
70 <<
"' does not exists. Aborting." << endl;
79 const SVec &inputFilesVec)
const
81 TFile *filePtr = TFile::Open (filename.c_str(),
"RECREATE");
84 cerr <<
"TH1Store::write() Error: Can not open '"
85 << filename <<
"' for output. Aborting." << endl;
88 write (filePtr, argsVec, inputFilesVec);
95 const SVec &inputFilesVec)
const
113 iter->second->Write();
120 dir->WriteObject (&argsVec,
"argsVec");
122 if (inputFilesVec.size())
124 dir->WriteObject (&inputFilesVec,
"inputFiles");
126 cout <<
"TH1Store::write(): Successfully written to '"
127 << filePtr->GetName() <<
"'." << endl;
134 TDirectory *dirPtr = filePtr->GetDirectory (dirName.c_str());
142 const boost::regex subdirRE (
"(.+?)/([^/]+)");
143 boost::smatch matches;
144 TDirectory *parentDir = 0;
146 if( boost::regex_match (dirName, matches, subdirRE) )
149 useName = matches[2];
154 dirPtr = parentDir->mkdir (useName.c_str());
bool m_deleteOnDestruction
void add(TH1 *histPtr, const std::string &directory="")
TDirectory * _createDir(const std::string &dirname, TFile *filePtr) const
std::ostream & operator<<(std::ostream &out, const ALILine &li)
static const SVec kEmptyVec
void write(const std::string &filename, const SVec &argsVec=kEmptyVec, const SVec &inputFilesVec=kEmptyVec) const
STH1PtrMap::const_iterator STH1PtrMapConstIter
std::vector< std::string > SVec
STH1PtrMap::iterator STH1PtrMapIter
SSMap::const_iterator SSMapConstIter
TH1 * hist(const std::string &name)