Message: Re: Run condition access from master thread Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Re: Run condition access from master thread 

Forum: Multithreading
Re: Question Run condition access from master thread (Delvan Neville)
Date: Mar 12, 16:09
From: Makoto Asai <Makoto Asai>

There is no public way of accessing to a user action object in a worker thread. You need to write such information from your worker run action, but you may write it only from a certain thread.
G4Threading::G4GetThreadId()
(http://www-geant4.kek.jp/lxr/source/global/management/include/G4Threading.hh#L278)
returns a unique thread ID for each worker thread (0 or positive), while it returns -1 if it is invoked from the mater thread. Thus, in your UserRunAction::EndOfRunAction(),

   if(G4Threading::G4GetThreadId()==0)
   {
      const G4VUserPrimaryGeneratorAction* primGenAction = G4G4RunManager::GetRunManager()-> GetUserPrimaryGeneratorAction();
      // write to a CSV
   }

Hope this helps,
Makoto

Inline Depth:
 1 1
 All All
Outline Depth:
 1 1
 2 2
 All All
Add message: (add)

1 Ok: Re: Run condition access from master thread   (Delvan Neville - Mar 12, 16:26)
 Add Message Add Message
to: "Re: Run condition access from master thread"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews