From a34894eced1af8b404a25be5a5ea30dabd078ece Mon Sep 17 00:00:00 2001 From: Gene Van Buren <85305093+genevb@users.noreply.github.com> Date: Tue, 12 Nov 2024 22:00:51 -0500 Subject: [PATCH] No StMaker functions if no StMaker loaded (#693) In ROOT6, it isn't enough to just hide a class's functions inside an `if` clause checking the corresponding TClass's existence when the class isn't loaded. This can be demonstrated currently in SL24x by simply executing: ``` root4star -b -l -q ``` ...which produces an error when executing `rootlogoff.C` at quit. Maybe there are other solutions, but this simple proposal breaks `rootlogoff.C` into two parts, not even loading the second part unless the first part is true - test the existence of the StMaker class - execution of StMaker functions I welcome other proposals. --- StRoot/macros/rootlogoff.C | 5 +---- StRoot/macros/rootlogoff2.C | 6 ++++++ 2 files changed, 7 insertions(+), 4 deletions(-) create mode 100644 StRoot/macros/rootlogoff2.C diff --git a/StRoot/macros/rootlogoff.C b/StRoot/macros/rootlogoff.C index 661712dcac2..6fa2c7632d9 100644 --- a/StRoot/macros/rootlogoff.C +++ b/StRoot/macros/rootlogoff.C @@ -1,10 +1,7 @@ { if (TClassTable::GetDict("StMaker")) { - StMaker* mk = StMaker::GetChain(); - if (mk) { - mk->Finish(); - } + gROOT->Macro("rootlogoff2.C"); } std::cout << "\nThis is the end of STAR ROOT -- Goodbye\n" << std::endl; diff --git a/StRoot/macros/rootlogoff2.C b/StRoot/macros/rootlogoff2.C new file mode 100644 index 00000000000..1440421a1ea --- /dev/null +++ b/StRoot/macros/rootlogoff2.C @@ -0,0 +1,6 @@ +{ + StMaker* mk = StMaker::GetChain(); + if (mk) { + mk->Finish(); + } +}