Definition at line 50 of file LArQuickHistMerge.cxx.
◆ histCollection()
histCollection::histCollection |
( |
bool |
debug = false | ) |
|
|
inlineexplicit |
◆ addDirectory()
void histCollection::addDirectory |
( |
TDirectory * |
dir, |
|
|
const std::string & |
dirName |
|
) |
| |
Definition at line 296 of file LArQuickHistMerge.cxx.
297 TIter
next(
dir->GetListOfKeys() );
300 const char*
name=
key->GetName();
301 const char* classname=
key->GetClassName();
302 if (
m_dbg) std::cout <<
"Found name " <<
name <<
", classname=" << classname << std::endl;
306 std::cout <<
"Path " <<
newName <<
" excluded" << std::endl;
310 if (!strncmp(classname,
"TH1",3) || !strncmp(classname,
"TH2",3) || !strncmp(classname,
"TProfile",8)) {
314 TTree* md=(TTree*)
dir->Get(
"metadata");
315 if (!md) std::cout <<
"ERROR: Did not find metadata tree in directroy " <<
dirName << std::endl;
322 for (
auto it1=mIt->second.histos.begin();
it1!=mIt->second.histos.end();++
it1) {
329 mIt->second.histos.push_back(
histo);
333 else if (!strncmp(classname,
"TDirectory",10)) {
334 TObject*
obj =
key->ReadObj();
335 TDirectory*
subdir =
dynamic_cast<TDirectory*
>(
obj );
340 else if (!strcmp(classname,
"TTree") && (!strcmp(
name,
"metadata"))) {
344 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 351 of file LArQuickHistMerge.cxx.
352 std::map<std::string,histDir_t>::const_iterator
it=
m_data.begin();
353 std::map<std::string,histDir_t>::const_iterator it_e=
m_data.end();
354 for(;
it!=it_e;++
it) {
356 const histDir_t& hd=
it->second;
357 std::vector<histPerDir_t>::const_iterator
it1=hd.histos.begin();
358 std::vector<histPerDir_t>::const_iterator it1_e=hd.histos.end();
362 std::cout <<
"Object " <<
fullName <<
" not properly set up. Not merged." << std::endl;
367 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 93 of file LArQuickHistMerge.cxx.
95 const size_t firstSlash=
dir.find(
'/',1);
96 if (firstSlash==std::string::npos)
return false;
98 std::vector<std::string>::const_iterator
it=
m_exclusion.begin();
99 std::vector<std::string>::const_iterator it_e=
m_exclusion.end();
100 for(;
it!=it_e;++
it) {
101 const std::string& excl=*
it;
102 const size_t s=excl.size();
104 if (
dir.compare(firstSlash,
s,excl)==0) {
◆ print()
void histCollection::print |
( |
| ) |
|
Definition at line 112 of file LArQuickHistMerge.cxx.
113 std::map<std::string,histDir_t>::const_iterator
it=
m_data.begin();
114 std::map<std::string,histDir_t>::const_iterator it_e=
m_data.end();
115 for(;
it!=it_e;++
it) {
116 const histDir_t& hd=
it->second;
117 std::cout <<
"Dir: " <<
it->first <<
" has "<<hd.histos.size()<<
" histos"<<std::endl;
118 std::vector<histPerDir_t>::const_iterator
it1=hd.histos.begin();
119 std::vector<histPerDir_t>::const_iterator it1_e=hd.histos.end();
121 std::cout <<
"\t" <<
it1->name << std::endl;
124 std::cout <<
"\nExclusion List: " << std::endl;
125 std::vector<std::string>::const_iterator sit=
m_exclusion.begin();
126 std::vector<std::string>::const_iterator sit_e=
m_exclusion.end();
127 for(;sit!=sit_e;++sit)
128 std::cout <<
"\t" << *sit << std::endl;
◆ size()
size_t histCollection::size |
( |
| ) |
|
|
inline |
◆ write()
void histCollection::write |
( |
TFile * |
out | ) |
|
Definition at line 376 of file LArQuickHistMerge.cxx.
379 TDirectory* histDir=
nullptr;
381 std::map<std::string,histDir_t>::const_iterator
it=
m_data.begin();
382 std::map<std::string,histDir_t>::const_iterator it_e=
m_data.end();
383 for(;
it!=it_e;++
it) {
384 const std::string
fulldir=
it->first +
"/";
386 std::string::size_type j=0,
j1=0;
387 while (
j1!=std::string::npos) {
393 while(
j1!=std::string::npos && !
fulldir.compare(0,
j1,lastDir,0,
j1));
394 const std::string currDirAtLevel(
fulldir.substr(j,
j1-j));
395 const std::string currFullDir(
fulldir.substr(0,
j1));
396 const std::string currBaseDir(
fulldir.substr(0,j));
399 out->cd(currBaseDir.c_str());
404 it->second.md->SetDirectory(histDir);
405 it->second.md->Write(
nullptr,TObject::kOverwrite);
406 std::vector<histPerDir_t>::const_iterator ith=
it->second.histos.begin();
407 std::vector<histPerDir_t>::const_iterator ith_e=
it->second.histos.end();
408 for (;ith!=ith_e;++ith) {
411 std::cout <<
"Writing " << ith->name <<
" to dir " <<
fulldir << std::endl;
415 std::cout <<
"NOT writing " << ith->name <<
". Invalid." << std::endl;
420 std::cout <<
"Wrote " <<
nWritten <<
" histograms to output file.";
422 std::cout <<
" Omitting " << nIgnored <<
" histograms." << std::endl;
424 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: