12 #include "cetlib/HorizontalRule.h" 21 openFile(std::string
const& fn)
23 std::unique_ptr<TFile>
file{TFile::Open(fn.c_str(),
"READ")};
26 <<
"Unable to open file '" << fn <<
"' for reading.";
29 auto* key_ptr =
file->GetKey(
"RootFileDB");
30 if (key_ptr ==
nullptr) {
32 <<
"Requested DB, \"RootFileDB\" of type, \"tkeyvfs\", not present in " 35 <<
"Either this is not an art/ROOT file, it is a corrupt art/ROOT " 37 <<
"or it is an art/ROOT file produced with a version older than " 53 auto const eid = it->eventID_;
54 for (; it != end && eid == it->eventID_; ++it) {
55 entries.push_back(it->entry_);
62 std::string
const& filename)
63 : file_{openFile(filename)}
66 std::unique_ptr<TTree> md{
79 pHistMap_ = detail::readMetadata<ProcessHistoryMap>(md.get());
98 bool printHistoryLabel{
false};
99 if (processNamesCollection.empty()) {
100 os <<
"\n No process history was recorded for this file.\n";
102 }
else if (processNamesCollection.size() > 1ull) {
103 printHistoryLabel =
true;
104 os <<
"\n This file was produced with multiple processing histories.\n";
114 for (
auto const& processNames : processNamesCollection) {
116 if (printHistoryLabel) {
117 os <<
"\n Chronological list of process names for process history: " 120 os <<
"\n Chronological list of process names for processes that\n" 121 <<
" produced this file.\n\n";
123 for (
auto const& process : processNames) {
124 os <<
' ' << std::setw(4) <<
std::right << i++ <<
". " << process <<
'\n';
133 std::ostringstream oss;
134 oss <<
" BranchIDLists are not stored for art/ROOT files with a format\n" 137 "InfoDumperInputFile::print_branchIDLists:\n"}
145 assert(processNames.size() == 1ull);
147 os <<
"\n List of BranchIDs produced for this file. The BranchIDs are\n" 148 <<
" grouped according to the process in which they were produced. The\n" 149 <<
" processes are presented in chronological order; however within each " 151 <<
" the order of listed BranchIDs is not meaningful.\n";
153 for (
auto const& process : processNames.front()) {
154 os <<
"\n Process " << i + 1 <<
": " << process <<
'\n';
156 os <<
" " << bid <<
'\n';
165 bool const compactRanges)
const 169 constexpr cet::HorizontalRule rule{30};
170 std::string
const rep{compactRanges ?
"compact" :
"full (default)"};
175 <<
"\" and therefore\n" 176 <<
"*** does not contain range-set information. The printout below is\n" 177 <<
"*** the range set art would assign to this file.\n\n" 178 <<
"Representation: " << rep <<
'\n' 179 << rule(
'-') <<
'\n';
185 fileIndex_, element.eventID_.runID(), compactRanges);
195 os <<
"Representation: " << rep <<
'\n' << rule(
'-') <<
'\n';
202 auto const& entries = getEntryNumbers(it, cend);
213 auto aux = std::make_unique<RunAuxiliary>();
214 auto pAux = aux.get();
217 auxBranch->SetAddress(&pAux);
218 tree->LoadTree(entry);
219 auxBranch->GetEntry(entry);
227 std::string
const& filename,
228 bool const compactRanges)
const 230 auto resolve_info = [db, &filename](
auto const id,
bool const compact) {
235 auto rangeSetInfo = resolve_info(auxResult.rangeSetID(), compactRanges);
237 for (
auto i = entries.cbegin() + 1,
e = entries.cend(); i !=
e; ++i) {
239 rangeSetInfo.update(resolve_info(tmpAux.rangeSetID(), compactRanges),
std::string const & BranchTypeToProductTreeName(BranchType const bt)
constexpr auto const & right(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
RangeSetInfo resolveRangeSetInfo(sqlite3 *, std::string const &filename, BranchType, unsigned RangeSetID, bool compact)
const_iterator cbegin() const
void readFileIndex(TFile *file, TTree *metaDataTree, FileIndex *&findexPtr)
RangeSet rangeSetFromFileIndex(FileIndex const &fileIndex, RunID runID, bool compactRanges)
std::string const & BranchTypeToAuxiliaryBranchName(BranchType const bt)
RangeSet resolveRangeSet(RangeSetInfo const &rs)
std::vector< std::vector< std::string > > orderedProcessNamesCollection(ProcessHistoryMap const &pHistMap)
std::string const & metaDataTreeName()
void print_event_list(std::ostream &os) const
const_iterator cend() const
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
std::vector< Element >::const_iterator const_iterator
std::vector< evd::details::RawDigitInfo_t >::const_iterator end(RawDigitCacheDataClass const &cache)
T readMetadata(TTree *md, bool const requireDict=true)