proper handling in dump_header of TDirectory in combination with the summary option.
Build and Deploy Documentation / build-and-deploy (push) Successful in 31s

This commit is contained in:
2026-04-30 11:07:20 +02:00
parent a8cd816123
commit bedbe2584b
+24 -8
View File
@@ -56,6 +56,7 @@
#include <TString.h>
#include <TFolder.h>
#include <TH1F.h>
#include <TKey.h>
#ifdef HAVE_GIT_REV_H
#include "git-revision.h"
@@ -273,13 +274,14 @@ int dump_header_root(const std::string fileName, const bool summary, const bool
// summary as well?
if (summary && ((fileType == DH_MUSR_ROOT) || (fileType == DH_MUSR_ROOT_DIR))) {
TObjArray *runSum=nullptr;
TDirectoryFile *runSumDir=nullptr;
if (fileType == DH_MUSR_ROOT) // TFolder
runSum = static_cast<TObjArray*>(folder->FindObject("RunSummary"));
else // TDirectory
f.GetObject("RunHeader/RunSummary", runSum);
f.GetObject("RunHeader/RunSummary", runSumDir);
if (!runSum) { // something is wrong!!
if (!runSum && !runSumDir) { // something is wrong!!
std::cerr << std::endl << "**ERROR** Couldn't obtain RunSummary " << fileName << std::endl;
f.Close();
return 1;
@@ -289,12 +291,26 @@ int dump_header_root(const std::string fileName, const bool summary, const bool
std::cout << "++++++++++++++++++++" << std::endl;
TObjString *tstr;
TString str;
for (Int_t i=0; i<runSum->GetEntries(); i++) {
tstr = static_cast<TObjString*>(runSum->At(i));
str = tstr->String();
std::cout << str;
if (!str.Contains("\r") && !str.Contains("\n"))
std::cout << std::endl;
if (runSum) {
for (Int_t i=0; i<runSum->GetEntries(); i++) {
tstr = static_cast<TObjString*>(runSum->At(i));
str = tstr->String();
std::cout << str;
if (!str.Contains("\r") && !str.Contains("\n"))
std::cout << std::endl;
}
} else if (runSumDir) {
TIter next(runSumDir->GetListOfKeys());
TKey *key;
while ((key = (TKey*)next())) {
if (TString(key->GetClassName()) == "TObjString") {
tstr = dynamic_cast<TObjString*>(key->ReadObj());
str = tstr->String();
std::cout << str;
if (!str.Contains("\r") && !str.Contains("\n"))
std::cout << std::endl;
}
}
}
}