-
Notifications
You must be signed in to change notification settings - Fork 63
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
Update StarGenerator and starsim codes in preparation for geant4star integration #103
Conversation
Point is well taken. Co-authored-by: Dmitri Smirnov <dmixsmi@gmail.com>
on the starsim libraries out of the event generator framework. The AgStarReader framework is moved into St_geant_Maker. Initialization of the reader presents a small problem. Most of our example macros have delayed initialization of the generator framework until *after* the initialization of the full chain. So we don't have a guarenteed hook to setup the connection between the event generator and the starsim package. Thus, the only place we can do this is on the first call to St_geant_Maker::Make. It is somewaht ugly, but the alternative is to change the initialization scheme, change all of the production and example macros, AND handle the fallout of breaking *users* macros.
Should resolve the compiler error due to the moved file: StRoot/StarGenerator/BASE/AgStarReader.h -> StRoot/St_geant_Maker/AgStarReader.h
StRoot/StarGenerator/FILT/StarFilterMaker.cxx does not depend on anything in StRoot/StarGenerator/BASE/AgStarReader.h
That is exactly the problem with the environment on rcf. You move/rename a file in your local directory but cons can still pick up the old header files from the central location pointed by $STAR |
if ( stack != 0 ) AgStarReader::Instance().SetStack( (StarParticleStack*)stack->GetObject() ); | ||
if ( data != 0 ) AgStarReader::Instance().SetParticleData( (StarParticleData*)data->GetObject() ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per STAR coding guidelines C-style type casting should be avoided.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is one of those cases where it is hard to avoid. If I use static / dynamic casts, then the dynamic linker complains that StarParticleStack / Data are not completely defined when I load the St_geant_Maker library. Same result if I push the cast down into the AgStarReader class. The crime against good coding style is not the use of the c-style cast, but rather the use of the singleton pattern for AgStarReader. Would prefer to keep the c-style cast here, rather than re-engineer the fortran interface.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you trying to avoid #include "StarGenerator/UTIL/StarParticleData.h"
and #include "StarGenerator/BASE/StarParticleStack.h"
from StRoot/St_geant_Maker/St_geant_Maker.cxx
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Also trying to avoid any run time dependence between the two libraries, so that
St_geant_Maker can be loaded without StarGenerator, and StarGenerator can be loaded w/out
loading St_geant_Maker.
(Also, not sure if replying in email gets logged as part of the discussion on github? If so, this may be redundant.)
import datetime, os | ||
import ROOT | ||
import subprocess, shlex | ||
import sys |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
datetime, ROOT, and sys are not used
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed... will push shortly.
For clarity Co-authored-by: Dmitri Smirnov <dmixsmi@gmail.com>
Yes. Also trying to avoid any run time dependence between the two
libraries, so that
St_geant_Maker can be loaded without StarGenerator, and StarGenerator
can be loaded w/out
loading St_geant_Maker.
…On 2021-08-16 16:29, Dmitri Smirnov wrote:
@plexoos commented on this pull request.
-------------------------
In StRoot/St_geant_Maker/St_geant_Maker.cxx [1]:
> + if ( stack != 0 ) AgStarReader::Instance().SetStack(
(StarParticleStack*)stack->GetObject() );
+ if ( data != 0 ) AgStarReader::Instance().SetParticleData(
(StarParticleData*)data->GetObject() );
Are you trying to avoid #include
"StarGenerator/UTIL/StarParticleData.h" and #include
"StarGenerator/BASE/StarParticleStack.h" from
StRoot/St_geant_Maker/St_geant_Maker.cxx?
--
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub [1], or unsubscribe
[2].
Triage notifications on the go with GitHub Mobile for iOS [3] or
Android [4].
Links:
------
[1] #103 (comment)
[2]
https://github.com/notifications/unsubscribe-auth/ANL4LVES6PMW2PT2FFWMEWLT5FYMJANCNFSM5CEJDTWQ
[3]
https://urldefense.com/v3/__https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675__;!!P4SdNyxKAPE!XLCtpy9gZ0ca7HZlivJP7MRXJOrMg19dcTwCbf-TzjDCM8_c_groPphI8z7B7J0$
[4]
https://urldefense.com/v3/__https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email__;!!P4SdNyxKAPE!XLCtpy9gZ0ca7HZlivJP7MRXJOrMg19dcTwCbf-TzjDCM8_c_groPphIH6_hHHk$
|
Jason, Can you illustrate with a macro what you are trying to achieve. It is not very clear, how you expect to avoid a run time dependence if one library makes use of the other one. As far as I know, a dynamic loader does not complain about unresolved symbols but if you try to call something that depends on the second library the process will definitely crash. |
Any (most) of the macros under StRoot/StarGenerator/macros will demonstrate... e.g. $ ln -s StRoot/StarGenerator/macros/starsim.pythia6.C starsim.C dlopen error: /gpfs/mnt/gpfs01/star/simu/simu/jwebb/STAR/.sl73_gcc485/lib/libSt_geant_Maker.so: undefined symbol: _ZTI16StarParticleData $ c++filt _ZTI16StarParticleData |
I could not reproduce this. When run from the current main your test goes through and produces an fzd file but from G4star it seg faults. |
I get a segmentation fault if I compile star-sw without compiling star-mcgen. Otherwise it worked (to be confirmed again...) |
…cular dependency, meaning that it will not be simple to remove the starsim dependency in StarGenerator. We have two (or more) choices here. Either create an interface class and a separate library for the concrete starsim reader, or provide a set of dummy symbols in geant4 maker in order to satisfy the generator dependencies. Final choice will be defered, but I am leaning towards a set of dummy symbols in geant4mk.
Decided on a different path. Instead of removing the dependence on starsim functions from StarGenerator (agsvert, agskine, etc...), the plan will be to satisfy these with dummy symbols inserted into the geant4 maker. Alternatively I could create an interface base class, and a plugin library to support starsim (but this seems like overkill). |
@@ -1363,6 +1363,15 @@ Bfc_st BFC[] = { // standard chains | |||
{"gstarLib","","","" ,"","gstar","Load gstar lib",kFALSE}, | |||
{"flux" ,"","","simu" ,"","flux","Load flux lib",kFALSE}, | |||
{"------------","-----------","-----------","------------------------------------------","","","",kFALSE}, | |||
{"Generators ","-----------","-----------","------------------------------------------","","","",kFALSE}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DId not intend to commit this, but it is a harmless addition to our list of chain options (and will be utilized as we merge in the G4star codes).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understand correctly, if you update the branch from which you are making the PR not to have this line, then it will drop off the list of changed files. Then you can re-apply this change later when it is needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you clarify if it is only the single "Generators" line that isn't needed for this commit, or all the BigFullChain.h line changes in this PR that aren't really needed for this PR? git makes my approval mandatory for the whole shebang of this PR because I'm a code owner for a small part of it :-(
Yes, that's my understanding as well. This would otherwise be in my
next pull request, so not worth the effort to retract.
…On 2021-08-18 17:18, Gene Van Buren wrote:
@genevb commented on this pull request.
-------------------------
In StRoot/StBFChain/BigFullChain.h [1]:
> @@ -1363,6 +1363,15 @@ Bfc_st BFC[] = { // standard chains
{"gstarLib","","",""
,"","gstar","Load gstar lib",kFALSE},
{"flux" ,"","","simu"
,"","flux","Load flux lib",kFALSE},
{"------------","-----------","-----------","------------------------------------------","","","",kFALSE},
+ {"Generators
","-----------","-----------","------------------------------------------","","","",kFALSE},
If I understand correctly, if you update the branch from which you are
making the PR not to have this line, then it will drop off the list of
changed files. Then you can re-apply this change later when it is
needed.
--
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub [1], or unsubscribe
[2].
Triage notifications on the go with GitHub Mobile for iOS [3] or
Android [4].
Links:
------
[1] #103 (comment)
[2]
https://github.com/notifications/unsubscribe-auth/ANL4LVFT7FFVHXSEDY4WMFTT5QPTHANCNFSM5CEJDTWQ
[3]
https://urldefense.com/v3/__https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675__;!!P4SdNyxKAPE!U2j1b4N6coeaMKudKwpWU9MNrggjtnAZqCBMRGP-7deYgbgQ9xia87Mk7eve5Mo$
[4]
https://urldefense.com/v3/__https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email__;!!P4SdNyxKAPE!U2j1b4N6coeaMKudKwpWU9MNrggjtnAZqCBMRGP-7deYgbgQ9xia87MkaYeDij4$
|
Hi Gene,
It's the group of ~5 event generator declarations which follows (as well
as that "Generators" header).
Jason
…On 2021-08-18 17:34, Gene Van Buren wrote:
@genevb commented on this pull request.
-------------------------
In StRoot/StBFChain/BigFullChain.h [1]:
> @@ -1363,6 +1363,15 @@ Bfc_st BFC[] = { // standard chains
{"gstarLib","","",""
,"","gstar","Load gstar lib",kFALSE},
{"flux" ,"","","simu"
,"","flux","Load flux lib",kFALSE},
{"------------","-----------","-----------","------------------------------------------","","","",kFALSE},
+ {"Generators
","-----------","-----------","------------------------------------------","","","",kFALSE},
Can you clarify if it is only the single "Generators" line that isn't
needed for this commit, or all the BigFullChain.h line changes in this
PR that aren't really needed for this PR? git makes my approval
mandatory for the whole shebang of this PR because I'm a code owner
for a small part of it :-(
--
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub [1], or unsubscribe
[2].
Triage notifications on the go with GitHub Mobile for iOS [3] or
Android [4].
Links:
------
[1] #103 (comment)
[2]
https://github.com/notifications/unsubscribe-auth/ANL4LVEEYMW2MRKIOKNQZMTT5QRNNANCNFSM5CEJDTWQ
[3]
https://urldefense.com/v3/__https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675__;!!P4SdNyxKAPE!QuRI6NMej0dQEM_ZKJ4Y1zaIjY0DrpIazuYKRRxq-URkLvFp0iLIzpEWMQ4Ik1Y$
[4]
https://urldefense.com/v3/__https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email__;!!P4SdNyxKAPE!QuRI6NMej0dQEM_ZKJ4Y1zaIjY0DrpIazuYKRRxq-URkLvFp0iLIzpEWG0Q-54g$
|
Just pinging this. Are there any other recommendations to push these changes? |
As long as your other pull request (for which these chain options matter) and this one point to each other, I'm not too particular. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No opposition.
The description states that "This removes from StarGenerator the dependence on code in the starsim library." I don't see how the submitted changes do anything to achieve this. The original intention to move the code that depends on St_geant_Maker from StarGenerator/ looked more like the move in the right direction but it was reverted. Please update the description and title to reflect what is really being changed. |
Thanks for updating the description Jason.
This one is still confusing because |
This is deep in the dark recesses of starsim...
https://github.com/star-bnl/star-sw/pull/103/files#diff-60be39524263b2d623a8cb4328ae1ce1e44cbf95a429a2bfad492e80127ea853
The block staring around line 113. We ask comis for the address of the
'AgUSRead'
subroutine. If it doesn't exist, we ask it for the address of the
'AgUSEvent' subroutine.
If an address was found, we call the subroutine at that point (line
117).
…On 2021-08-23 18:22, Dmitri Smirnov wrote:
Thanks for updating the description Jason.
> It will be difficult to eliminate the dependence on the
> agseventread_ (&etc...) methods in StarGenerator.
This one is still confusing because ageventread is defined in
StarGenerator... I am probably missing something but where is
ageventread called from?
--
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub [1], or unsubscribe
[2].
Triage notifications on the go with GitHub Mobile for iOS [3] or
Android [4].
Links:
------
[1] #103 (comment)
[2]
https://github.com/notifications/unsubscribe-auth/ANL4LVDVXKG6BQCMYD3OUALT6LC2ZANCNFSM5CEJDTWQ
[3]
https://urldefense.com/v3/__https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675__;!!P4SdNyxKAPE!QO32SI-N6f48rLhs8alaw5VHG1f9OMUFRN1hKoUn-FVkS3Sis4_zQZl3R7msDe8$
[4]
https://urldefense.com/v3/__https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email__;!!P4SdNyxKAPE!QO32SI-N6f48rLhs8alaw5VHG1f9OMUFRN1hKoUn-FVkS3Sis4_zQZl3VvaQzCc$
|
Without tests it is very hard to judge whether these changes will break anything or not... Anyway, if you are confident about these changes we can merge... or maybe it can wait until introduction of geant4star when these preparatory changes will be actually used. |
Yes I am confident that the code functions and is correct. agusread --> agusevent is simply a renaming of a subroutine, plus a branch under a switch statement to enable the different path. The code runs. stargentest.py confirms that events are produced. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The author claims that all changes are necessary for Geant4 integration and have been tested
Changes to the StarGenerator and starsim codes in preparation for geant4star integration.