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

Add a possibility to display a GDML file #28348

Merged
merged 1 commit into from Nov 8, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 7 additions & 6 deletions Fireworks/Core/src/FWGeometryTableViewManager.cc
Expand Up @@ -94,12 +94,13 @@ void FWGeometryTableViewManager::setGeoManagerFromFile() {
TFile* file = FWGeometry::findFile(m_fileName.c_str());
fwLog(fwlog::kInfo) << "Geometry table file: " << m_fileName.c_str() << std::endl;
try {
if (!file)
throw std::runtime_error("No root file.");

file->ls();

s_geoManager = (TGeoManager*)file->Get(m_TGeoName.c_str());
if (!file) {
// Try it as a GDML file
s_geoManager = TGeoManager::Import(m_fileName.c_str(), m_TGeoName.c_str());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ianna as far as I can see TGeoManager has already a protection against odd files, and in any case the final check here on the pointer not being null should be enough...

} else {
file->ls();
s_geoManager = (TGeoManager*)file->Get(m_TGeoName.c_str());
}
if (!s_geoManager)
throw std::runtime_error("Can't find TGeoManager object in selected file.");

Expand Down