Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check presence of hit files before adding to TChain #13842

Merged
merged 1 commit into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,9 @@ inline void DigitizationContext::retrieveHits(std::vector<TChain*> const& chains
int entryID,
std::vector<T>* hits) const
{
if (chains.size() <= sourceID) {
return;
}
auto br = chains[sourceID]->GetBranch(brname);
if (!br) {
LOG(error) << "No branch found with name " << brname;
Expand Down
8 changes: 8 additions & 0 deletions DataFormats/simulation/src/DigitizationContext.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,14 @@ bool DigitizationContext::initSimChains(o2::detectors::DetID detid, std::vector<
return false;
}

// check that all files are present, otherwise quit
for (int source = 0; source < mSimPrefixes.size(); ++source) {
if (!std::filesystem::exists(o2::base::DetectorNameConf::getHitsFileName(detid, mSimPrefixes[source].data()))) {
LOG(info) << "Not hit file present for " << detid.getName() << " (exiting SimChain setup)";
return false;
}
}

simchains.emplace_back(new TChain("o2sim"));
// add the main (background) file
simchains.back()->AddFile(o2::base::DetectorNameConf::getHitsFileName(detid, mSimPrefixes[0].data()).c_str());
Expand Down
Loading