Definition at line 56 of file LArQuickHistMerge.cxx.
◆ histCollection()
histCollection::histCollection |
( |
bool |
debug = false | ) |
|
|
inlineexplicit |
◆ addDirectory()
void histCollection::addDirectory |
( |
TDirectory * |
dir, |
|
|
const std::string & |
dirName |
|
) |
| |
Definition at line 301 of file LArQuickHistMerge.cxx.
303 TIter
next(
dir->GetListOfKeys() );
306 const char*
name=
key->GetName();
307 const char* classname=
key->GetClassName();
308 if (
m_dbg) std::cout <<
"Found name " <<
name <<
", classname=" << classname << std::endl;
313 std::cout <<
"Path " <<
newName <<
" excluded" << std::endl;
318 if (!strncmp(classname,
"TH1",3) || !strncmp(classname,
"TH2",3) || !strncmp(classname,
"TProfile",8)) {
321 TTree* md=(TTree*)
dir->Get(
"metadata");
322 if (!md) std::cout <<
"ERROR: Did not find metadata tree in directroy " << dirName << std::endl;
323 mIt=
m_data.insert(std::make_pair(dirName,histDir_t(md))).
first;
326 mIt->second.histos.push_back(
histo);
328 else if (!strncmp(classname,
"TDirectory",10)) {
329 TObject*
obj =
key->ReadObj();
330 TDirectory*
subdir =
dynamic_cast<TDirectory*
>(
obj );
335 else if (!strcmp(classname,
"TTree") && (!strcmp(
name,
"metadata"))) {
339 std::cout <<
"Ignored objects '" <<
name <<
"' of type "<< classname << std::endl;
◆ addExclusion()
void histCollection::addExclusion |
( |
const std::string & |
dir | ) |
|
◆ addFile()
void histCollection::addFile |
( |
TFile * |
in | ) |
|
Definition at line 346 of file LArQuickHistMerge.cxx.
347 std::map<std::string,histDir_t>::const_iterator
it=
m_data.begin();
348 std::map<std::string,histDir_t>::const_iterator it_e=
m_data.end();
349 for(;
it!=it_e;++
it) {
350 const std::string& dirName=
it->first;
351 const histDir_t& hd=
it->second;
352 std::vector<histPerDir_t>::const_iterator
it1=hd.histos.begin();
353 std::vector<histPerDir_t>::const_iterator it1_e=hd.histos.end();
362 std::cout <<
"ERROR: Could not access path " <<
fullName <<
" in file " << in->GetName() << std::endl;
◆ isExcluded()
bool histCollection::isExcluded |
( |
const std::string & |
dir | ) |
|
|
private |
Definition at line 99 of file LArQuickHistMerge.cxx.
101 const size_t firstSlash=
dir.find(
'/',1);
102 if (firstSlash==std::string::npos)
return false;
104 std::vector<std::string>::const_iterator
it=
m_exclusion.begin();
105 std::vector<std::string>::const_iterator it_e=
m_exclusion.end();
106 for(;
it!=it_e;++
it) {
107 const std::string& excl=*
it;
108 const size_t s=excl.size();
110 if (
dir.compare(firstSlash,
s,excl)==0) {
◆ print()
void histCollection::print |
( |
| ) |
|
Definition at line 117 of file LArQuickHistMerge.cxx.
118 std::map<std::string,histDir_t>::const_iterator
it=
m_data.begin();
119 std::map<std::string,histDir_t>::const_iterator it_e=
m_data.end();
120 for(;
it!=it_e;++
it) {
121 std::cout <<
"Dir: " <<
it->first << std::endl;
122 const histDir_t& hd=
it->second;
123 std::vector<histPerDir_t>::const_iterator
it1=hd.histos.begin();
124 std::vector<histPerDir_t>::const_iterator it1_e=hd.histos.end();
126 std::cout <<
"\t" <<
it1->name << std::endl;
129 std::cout <<
"\nExclusion List: " << std::endl;
130 std::vector<std::string>::const_iterator sit=
m_exclusion.begin();
131 std::vector<std::string>::const_iterator sit_e=
m_exclusion.end();
132 for(;sit!=sit_e;++sit)
133 std::cout <<
"\t" << *sit << std::endl;
◆ size()
size_t histCollection::size |
( |
| ) |
|
|
inline |
◆ write()
void histCollection::write |
( |
TFile * |
out | ) |
|
Definition at line 373 of file LArQuickHistMerge.cxx.
376 TDirectory* histDir=
nullptr;
378 std::map<std::string,histDir_t>::const_iterator
it=
m_data.begin();
379 std::map<std::string,histDir_t>::const_iterator it_e=
m_data.end();
380 for(;
it!=it_e;++
it) {
381 const std::string
fulldir=
it->first +
"/";
383 std::string::size_type j=0,
j1=0;
384 while (
j1!=std::string::npos) {
390 while(
j1!=std::string::npos && !
fulldir.compare(0,
j1,lastDir,0,
j1));
391 const std::string currDirAtLevel(
fulldir.substr(j,
j1-j));
392 const std::string currFullDir(
fulldir.substr(0,
j1));
393 const std::string currBaseDir(
fulldir.substr(0,j));
396 out->cd(currBaseDir.c_str());
401 it->second.md->SetDirectory(histDir);
402 it->second.md->Write(
nullptr,TObject::kOverwrite);
403 std::vector<histPerDir_t>::const_iterator ith=
it->second.histos.begin();
404 std::vector<histPerDir_t>::const_iterator ith_e=
it->second.histos.end();
405 for (;ith!=ith_e;++ith) {
408 std::cout <<
"Writing " << ith->name <<
" to dir " <<
fulldir << std::endl;
412 std::cout <<
"NOT writing " << ith->name <<
". Invalid." << std::endl;
417 std::cout <<
"Wrote " <<
nWritten <<
" histograms to output file.";
419 std::cout <<
" Omitting " << nIgnored <<
" histograms." << std::endl;
421 std::cout << std::endl;
◆ m_data
std::map<std::string,histDir_t> histCollection::m_data |
|
private |
◆ m_dbg
bool histCollection::m_dbg |
|
private |
◆ m_exclusion
std::vector<std::string> histCollection::m_exclusion |
|
private |
The documentation for this class was generated from the following file: