Skip to content
Snippets Groups Projects
Commit a29b901a authored by John Chapman's avatar John Chapman
Browse files

LArG4ShowerLibSvc: Throw an error if the expected frozen shower libraries are...

LArG4ShowerLibSvc: Throw an error if the expected frozen shower libraries are not all loaded (ATLASSIM-7444)
parent aa75d957
No related branches found
No related tags found
No related merge requests found
Pipeline #11018762 passed
/* /*
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
*/ */
#include "LArG4ShowerLibSvc/LArG4ShowerLibSvc.h" #include "LArG4ShowerLibSvc/LArG4ShowerLibSvc.h"
...@@ -45,11 +45,13 @@ StatusCode LArG4ShowerLibSvc::initialize() ...@@ -45,11 +45,13 @@ StatusCode LArG4ShowerLibSvc::initialize()
{ {
ATH_MSG_INFO("Initializing"); ATH_MSG_INFO("Initializing");
std::vector<std::string> ignoredLibraryFiles{};
// iterate through filenames in list // iterate through filenames in list
for (const std::string& fileName : m_fileNameList) { for (const std::string& fileName : m_fileNameList) {
std::string resolvedFilename = PathResolverFindCalibFile(fileName); std::string resolvedFilename = PathResolverFindCalibFile(fileName);
if (resolvedFilename.empty()) { if (resolvedFilename.empty()) {
ATH_MSG_WARNING("Could not resolve input filename " << (fileName) << ". Ignoring!"); ATH_MSG_WARNING("Could not resolve input filename " << (fileName) << ". Ignoring!");
ignoredLibraryFiles.push_back(fileName);
continue; continue;
} else { } else {
ATH_MSG_INFO("Resolving input filename to " << resolvedFilename); ATH_MSG_INFO("Resolving input filename to " << resolvedFilename);
...@@ -59,6 +61,7 @@ StatusCode LArG4ShowerLibSvc::initialize() ...@@ -59,6 +61,7 @@ StatusCode LArG4ShowerLibSvc::initialize()
if (rootfile.IsZombie()) { if (rootfile.IsZombie()) {
ATH_MSG_WARNING("File " << resolvedFilename << " is not a valid ROOT file"); ATH_MSG_WARNING("File " << resolvedFilename << " is not a valid ROOT file");
ignoredLibraryFiles.push_back(fileName);
continue; continue;
} }
...@@ -70,11 +73,13 @@ StatusCode LArG4ShowerLibSvc::initialize() ...@@ -70,11 +73,13 @@ StatusCode LArG4ShowerLibSvc::initialize()
// if no library can be created based on the file nullptr is returned // if no library can be created based on the file nullptr is returned
if (library == nullptr) { if (library == nullptr) {
ATH_MSG_WARNING("File " << resolvedFilename << " is not a valid library file"); ATH_MSG_WARNING("File " << resolvedFilename << " is not a valid library file");
ignoredLibraryFiles.push_back(fileName);
continue; continue;
} }
if (m_detmap.find(library->detector()) == m_detmap.end()) { if (m_detmap.find(library->detector()) == m_detmap.end()) {
ATH_MSG_WARNING("Library " << resolvedFilename << " is produced for unknown detector: " << library->detector()); ATH_MSG_WARNING("Library " << resolvedFilename << " is produced for unknown detector: " << library->detector());
ignoredLibraryFiles.push_back(fileName);
delete library; delete library;
continue; continue;
} }
...@@ -96,17 +101,24 @@ StatusCode LArG4ShowerLibSvc::initialize() ...@@ -96,17 +101,24 @@ StatusCode LArG4ShowerLibSvc::initialize()
// no point in the service with no libraries // no point in the service with no libraries
if (m_libraryMap.empty()) { if (m_libraryMap.empty()) {
ATH_MSG_WARNING("No library files found"); ATH_MSG_ERROR("No library files found. Please check the configuration of this job.");
} else { return StatusCode::FAILURE;
ATH_MSG_INFO("List of loaded libraries:"); }
for (const auto& m : m_libraryMap) { // some of the configured library files did not work
ATH_MSG_INFO(" " << m_locations[m.first] << ": " << m.second->comment()); if (!ignoredLibraryFiles.empty() ) {
for (const std::string& fileName : ignoredLibraryFiles) {
ATH_MSG_ERROR("Failed to create a library from filename: " << (fileName));
}
ATH_MSG_ERROR("Some library filenames were invalid. Please check the configuration of this job.");
return StatusCode::FAILURE;
}
ATH_MSG_INFO("List of loaded libraries:");
for (const auto& m : m_libraryMap) {
ATH_MSG_INFO(" " << m_locations[m.first] << ": " << m.second->comment());
#ifdef DEBUG_FrozenShowers #ifdef DEBUG_FrozenShowers
m_statisticsMap[m.second] = m.second->createStatistics(); m_statisticsMap[m.second] = m.second->createStatistics();
#endif #endif
}
} }
ATH_MSG_INFO("Shower library successfully initialized."); ATH_MSG_INFO("Shower library successfully initialized.");
return StatusCode::SUCCESS; return StatusCode::SUCCESS;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment