From ef0e4c63f2e84735b822ac730caaf6dca37ea3fb Mon Sep 17 00:00:00 2001 From: Dmitry Kalinkin Date: Fri, 27 Oct 2023 10:54:18 -0400 Subject: [PATCH 1/6] Move DECLARE_SEGMENTATIONs for CartesianGridXYStaggered and HexGrid to ReadoutSegmentations This fixes runtime errors like: libc++abi: __cxa_guard_acquire detected recursive initialization --- DDCore/src/plugins/ReadoutSegmentations.cpp | 6 ++++++ DDCore/src/segmentations/CartesianGridXYStaggered.cpp | 4 ---- DDCore/src/segmentations/HexGrid.cpp | 2 -- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/DDCore/src/plugins/ReadoutSegmentations.cpp b/DDCore/src/plugins/ReadoutSegmentations.cpp index 7462e7d93..578c3bfbb 100644 --- a/DDCore/src/plugins/ReadoutSegmentations.cpp +++ b/DDCore/src/plugins/ReadoutSegmentations.cpp @@ -40,6 +40,9 @@ DECLARE_SEGMENTATION(CartesianGridYZ,create_segmentation) +#include "DDSegmentation/CartesianGridXYStaggered.h" +DECLARE_SEGMENTATION(CartesianGridXYStaggered,dd4hep::create_segmentation) + #include "DDSegmentation/CartesianStripX.h" DECLARE_SEGMENTATION(CartesianStripX,create_segmentation) @@ -75,3 +78,6 @@ DECLARE_SEGMENTATION(ProjectiveCylinder,create_segmentation) + +#include "DDSegmentation/HexGrid.h" +DECLARE_SEGMENTATION(HexGrid,create_segmentation) diff --git a/DDCore/src/segmentations/CartesianGridXYStaggered.cpp b/DDCore/src/segmentations/CartesianGridXYStaggered.cpp index 871958ffe..69cf77236 100644 --- a/DDCore/src/segmentations/CartesianGridXYStaggered.cpp +++ b/DDCore/src/segmentations/CartesianGridXYStaggered.cpp @@ -96,7 +96,3 @@ std::vector CartesianGridXYStaggered::cellDimensions(const CellID& cellI } /* namespace DDSegmentation */ } /* namespace dd4hep */ - -// This is done DDCore/src/plugins/ReadoutSegmentations.cpp so the plugin is not part of libDDCore -// needs also #include "DD4hep/Factories.h" -// DECLARE_SEGMENTATION(CartesianGridXYStaggered,dd4hep::create_segmentation) diff --git a/DDCore/src/segmentations/HexGrid.cpp b/DDCore/src/segmentations/HexGrid.cpp index f051a8f61..0e9224e52 100644 --- a/DDCore/src/segmentations/HexGrid.cpp +++ b/DDCore/src/segmentations/HexGrid.cpp @@ -145,5 +145,3 @@ namespace dd4hep { } /* namespace DDSegmentation */ } /* namespace dd4hep */ - -DECLARE_SEGMENTATION(HexGrid, create_segmentation) From 740772f9f799450504d69c91736f876581f071df Mon Sep 17 00:00:00 2001 From: Markus Frank Date: Thu, 16 Nov 2023 16:38:53 +0100 Subject: [PATCH 2/6] Allow to set visualization depth to teveDisplay --- UtilityApps/src/run_plugin.h | 10 +++--- UtilityApps/src/teve_display.cpp | 56 ++++++++++++++++++++++---------- 2 files changed, 43 insertions(+), 23 deletions(-) diff --git a/UtilityApps/src/run_plugin.h b/UtilityApps/src/run_plugin.h index a62a84890..a0c2cf274 100644 --- a/UtilityApps/src/run_plugin.h +++ b/UtilityApps/src/run_plugin.h @@ -220,11 +220,11 @@ namespace { std::cout << "]" << std::endl << std::flush; } if ( name && name[0] ) { - result = run_plugin(description, name, a.first, a.second); - return result; + result = run_plugin(description, name, a.first, a.second); + return result; } std::cout << "WARNING: run_plugin: No plugin name supplied. " - << "Implicitly assuming execution steered by XML." << std::endl; + << "Implicitly assuming execution steered by XML." << std::endl; return ENOENT; } }; @@ -279,7 +279,7 @@ namespace dd4hep { } else { result = args.run(description, name); - } + } if ( result == EINVAL ) usage_default(name); } else { @@ -329,7 +329,7 @@ namespace dd4hep { !arguments.ui && !arguments.interpreter && arguments.plugins.empty() && - arguments.geo_files.empty() ) + arguments.geo_files.empty() ) { usage_plugin_runner(); } diff --git a/UtilityApps/src/teve_display.cpp b/UtilityApps/src/teve_display.cpp index 962997988..4272f279c 100644 --- a/UtilityApps/src/teve_display.cpp +++ b/UtilityApps/src/teve_display.cpp @@ -65,21 +65,32 @@ TEveStraightLineSet* getSurfaceVectors(bool addO=true, bool addU= true, bool add //===================================================================================== -static long teve_display(Detector& description, int /* argc */, char** /* argv */) { +static long teve_display(Detector& description, int argc, char** argv) { + int level = 4, visopt = 0, help = 0; + for( int i=0; i Visualization level [TGeoManager::SetVisLevel] Default: 4 \n" + " -visopt Visualization option [TGeoManager::SetVisOption] Default: 0 \n" + " -help Print this help output" << std::endl << std::flush; + ::exit(EINVAL); + } + TGeoManager* mgr = &description.manager(); mgr->SetNsegments(100); // Increase the visualization resolution. TEveManager::Create(); - // mgr->SetVisOption(1) ; - // mgr->SetVisLevel(4) ; - - // gEve->fGeometries->Add(new TObjString("DefaultGeometry"),mgr); - TEveGeoTopNode* tn = new TEveGeoTopNode(mgr, mgr->GetTopNode()); // option 0 in TEve seems to correspond to option 1 in TGeo ( used in geoDisplay ...) - tn->SetVisOption(0) ; - tn->SetVisLevel(4); + tn->SetVisOption(visopt) ; + tn->SetVisLevel(level); // // ---- try to set transparency - does not seem to work ... // TGeoNode* node1 = gGeoManager->GetTopNode(); @@ -130,13 +141,9 @@ static long teve_display(Detector& description, int /* argc */, char** /* argv * MultiView::instance()->ImportGeomRPhi( helperSurfaces ); MultiView::instance()->ImportGeomRhoZ( helperSurfaces ) ; - make_gui(); - next_event(); - gEve->FullRedraw3D(kTRUE); - return 1; } DECLARE_APPLY(DD4hepTEveDisplay,teve_display) @@ -145,18 +152,31 @@ DECLARE_APPLY(DD4hepTEveDisplay,teve_display) //===================================================================================================================== int main(int argc,char** argv) { - return dd4hep::execute::main_default("DD4hepTEveDisplay",argc,argv); + std::vector av; + std::string level, visopt, opt; + bool help = false; + for( int i=0; i Date: Sat, 18 Nov 2023 17:34:10 -0600 Subject: [PATCH 3/6] fix: use TROOT::GetIconPath instead of $ROOTSYS/icons --- DDEve/src/Display.cpp | 5 +++++ DDEve/src/EventControl.cpp | 5 +++++ DDEve/src/GenericEventHandler.cpp | 9 +++++++++ UtilityApps/src/teve_display.cpp | 5 +++++ 4 files changed, 24 insertions(+) diff --git a/DDEve/src/Display.cpp b/DDEve/src/Display.cpp index 1f98aa84c..140ce924a 100644 --- a/DDEve/src/Display.cpp +++ b/DDEve/src/Display.cpp @@ -30,6 +30,7 @@ #include "DD4hep/Printout.h" // ROOT include files +#include "TROOT.h" #include "TH2.h" #include "TFile.h" #include "TSystem.h" @@ -270,7 +271,11 @@ void Display::UnregisterEvents(View* view) { /// Open standard message box void Display::MessageBox(PrintLevel level, const string& text, const string& title) const { +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,9,2) + string path = TString::Format("%s/", TROOT::GetIconPath().Data()).Data(); +#else string path = TString::Format("%s/icons/", gSystem->Getenv("ROOTSYS")).Data(); +#endif const TGPicture* pic = 0; if ( level == VERBOSE ) pic = client().GetPicture((path+"mb_asterisk_s.xpm").c_str()); diff --git a/DDEve/src/EventControl.cpp b/DDEve/src/EventControl.cpp index a41add5d0..a5c9e4ad9 100644 --- a/DDEve/src/EventControl.cpp +++ b/DDEve/src/EventControl.cpp @@ -18,6 +18,7 @@ #include "DD4hep/InstanceCount.h" // ROOT include files +#include #include #include #include @@ -158,7 +159,11 @@ void EventControl::OnNewEvent(EventHandler& handler) { /// User callback to add elements to the control void EventControl::OnBuild() { +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,9,2) + string icondir = TString::Format("%s/", TROOT::GetIconPath().Data()).Data(); +#else string icondir = TString::Format("%s/icons/", gSystem->Getenv("ROOTSYS")).Data(); +#endif TGGroupFrame* group = new TGGroupFrame(m_frame,"Event I/O Control"); TGCompositeFrame* top = new TGHorizontalFrame(group); TGPictureButton* b = 0; diff --git a/DDEve/src/GenericEventHandler.cpp b/DDEve/src/GenericEventHandler.cpp index c5cbba92c..fa4f2043b 100644 --- a/DDEve/src/GenericEventHandler.cpp +++ b/DDEve/src/GenericEventHandler.cpp @@ -19,6 +19,7 @@ #include /// ROOT include files +#include "TROOT.h" #include "TGMsgBox.h" #include "TSystem.h" #include @@ -136,7 +137,11 @@ bool GenericEventHandler::Open(const string& file_type, const string& file_name) err = "\nAn exception occurred \n" "while opening event data:\n" + string(e.what()) + "\n\n"; } +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,9,2) + string path = TString::Format("%s/stop_t.xpm", TROOT::GetIconPath().Data()).Data(); +#else string path = TString::Format("%s/icons/stop_t.xpm", gSystem->Getenv("ROOTSYS")).Data(); +#endif const TGPicture* pic = gClient->GetPicture(path.c_str()); new TGMsgBox(gClient->GetRoot(),0,"Failed to open event data",err.c_str(),pic, kMBDismiss,0,kVerticalFrame,kTextLeft|kTextCenterY); @@ -157,7 +162,11 @@ bool GenericEventHandler::NextEvent() { throw runtime_error("+++ EventHandler::readEvent: No file open!"); } catch(const exception& e) { +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,9,2) + string path = TString::Format("%s/stop_t.xpm", TROOT::GetIconPath().Data()).Data(); +#else string path = TString::Format("%s/icons/stop_t.xpm", gSystem->Getenv("ROOTSYS")).Data(); +#endif string err = "\nAn exception occurred \n" "while reading a new event:\n" + string(e.what()) + "\n\n"; const TGPicture* pic = gClient->GetPicture(path.c_str()); diff --git a/UtilityApps/src/teve_display.cpp b/UtilityApps/src/teve_display.cpp index 4272f279c..8030b5307 100644 --- a/UtilityApps/src/teve_display.cpp +++ b/UtilityApps/src/teve_display.cpp @@ -22,6 +22,7 @@ #include "run_plugin.h" #include "TRint.h" +#include "TROOT.h" #include "TEveGeoNode.h" #include "TEveBrowser.h" #include "TGNumberEntry.h" @@ -282,7 +283,11 @@ void make_gui() { TGHorizontalFrame* hf = new TGHorizontalFrame(frmMain); { +#if ROOT_VERSION_CODE >= ROOT_VERSION(6,9,2) + TString icondir( Form("%s/", TROOT::GetIconPath().Data()) ); +#else TString icondir( Form("%s/icons/", gSystem->Getenv("ROOTSYS")) ); +#endif TGPictureButton* b = 0; EvNavHandler *fh = new EvNavHandler; From f2ad48f21583519b35a45854e0a4b10c1482cf8b Mon Sep 17 00:00:00 2001 From: jmcarcell Date: Mon, 20 Nov 2023 18:54:44 +0100 Subject: [PATCH 4/6] Add a check for the standard that Geant4 was compiled with --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1ada9cbc8..bd6f40dd2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -137,6 +137,10 @@ if(DD4HEP_USE_GEANT4) IF(NOT Geant4_builtin_clhep_FOUND) SET(DD4HEP_USE_CLHEP TRUE) ENDIF() + if(Geant4_CXX_STANDARD MATCHES "[0-9]+" AND Geant4_CXX_STANDARD LESS ${CMAKE_CXX_STANDARD}) + message(FATAL_ERROR "Geant4 was compiled with C++${Geant4_CXX_STANDARD}, but DD4hep requires C++${CMAKE_CXX_STANDARD}") + endif() + DD4HEP_SETUP_GEANT4_TARGETS() # Geant4 sets the CLHEP include directory to include_directories, we undo this here # we don't do this inside DD4hep_SETUP_GEANT4_TARGETS, because that is also used in From d7d1fbfdf96fe28a3c1545d03f73bd66b4e4d442 Mon Sep 17 00:00:00 2001 From: Andre Sailer Date: Tue, 21 Nov 2023 16:10:46 +0100 Subject: [PATCH 5/6] Release Notes for v01-27-01 --- doc/ReleaseNotes.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/doc/ReleaseNotes.md b/doc/ReleaseNotes.md index 2520513ff..29bf1e213 100644 --- a/doc/ReleaseNotes.md +++ b/doc/ReleaseNotes.md @@ -1,3 +1,19 @@ +# v01-27-01 + +* 2023-11-20 jmcarcell ([PR#1191](https://github.com/aidasoft/DD4hep/pull/1191)) + - CMake: Add a check for the c++ standard that Geant4 was compiled with, and fail if it is + different from the one required for DD4hep. + +* 2023-11-19 Wouter Deconinck ([PR#1190](https://github.com/aidasoft/DD4hep/pull/1190)) + - Use TROOT::GetIconPath to find icons in DDEve + +* 2023-11-17 Markus Frank ([PR#1187](https://github.com/aidasoft/DD4hep/pull/1187)) + - Implement startup flags to set the visualization depth in teveDisplay like for geoDisplay. + See Issue: See deeper hierarchy in teveDisplay https://github.com/AIDASoft/DD4hep/issues/1186 for details. + +* 2023-11-17 Dmitry Kalinkin ([PR#1184](https://github.com/aidasoft/DD4hep/pull/1184)) + - Fixed runtime issues during initialization caused by incorrectly placed `DECLARE_SEGMENTATION` for CartesianGridXYStaggered and HexGrid. + # v01-27 * 2023-10-19 Alvaro Tolosa Delgado ([PR#1174](https://github.com/aidasoft/dd4hep/pull/1174)) From 04bb629ddab5344c8df69070c35573f2f8095c69 Mon Sep 17 00:00:00 2001 From: Andre Sailer Date: Tue, 21 Nov 2023 16:10:47 +0100 Subject: [PATCH 6/6] Updating version to v01-27-01 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bd6f40dd2..e282c31ac 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ SET_PROPERTY(DIRECTORY . PROPERTY PACKAGE_NAME DD4hep) SET( DD4hep_VERSION_MAJOR 1 ) SET( DD4hep_VERSION_MINOR 27 ) -SET( DD4hep_VERSION_PATCH 0 ) +SET( DD4hep_VERSION_PATCH 1 ) ####################### # Basic project setup #