Skip to content

Commit

Permalink
No StMaker functions if no StMaker loaded (#693)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
genevb authored Nov 13, 2024
1 parent 3271996 commit a34894e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 1 addition & 4 deletions StRoot/macros/rootlogoff.C
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
6 changes: 6 additions & 0 deletions StRoot/macros/rootlogoff2.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
StMaker* mk = StMaker::GetChain();
if (mk) {
mk->Finish();
}
}

0 comments on commit a34894e

Please sign in to comment.