Message: Re: Saving partial results Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Re: Saving partial results 

Forum: Multithreading
Re: None Saving partial results
Date: 20 Aug, 2015
From: <herr_apa>

Hi again,

I've worked some more on this problem, and now I have a different question: In multithreaded mode, how can I prompt a call to G4VUserActionInitialization::Build after having already called beamOn once?

And here's some context if that helps. Let's go back to the 1000 events that I wanted to split up into 50-event slices. What I do now is loop over beamOn and execute twenty runs 50 events each. The position of the initial particle is calculated by a dedicated class called ParticlePosition, that defines x(t). I added two new variables to this class: The total number of events to be simulated, Nsim (1000 in this example), and the number of events completed by previous runs, Noffset. Time then becomes t = (Noffset + N)/Nsim where N is the event number of the current event (i.e. a number between 0 and 49 in this example). Before each call to beamOn, I update Noffset. And this is where I run into trouble.

The program is structured such that an ActionInitialization is created in the main function. This ActionInitialization has a ParticlePosition variable. In ActionInitialization::Build a PrimaryGeneratorAction is created, and the ParticlePosition is passed to its constructor. Everything works fine the first time beamOn is called. For each subsequent turn in the loop, I update the Noffset in the ParticlePosition owned by the ActionInitialization and call runManager->SetUserInitialization(actionInitialization) before the next call to beamOn. Had it been a single-threaded G4RunManager, Build would have been invoked. But because it is a G4MTRunManager, only BuildForMaster is invoked. No new PrimaryGeneratorAction object is created, because that happens in Build. How can I relay the updated ParticlePosition to my PrimaryGeneratorAction? Is there a way to destroy the worker threads and then re-create them (which would invoke Build)?

Thanks in advance!

// Anders

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

1 None: Re: Saving partial results   (herr_apa - 25 Aug, 2015)
2 Warning: Re: Saving partial results   (Andrea Dotti - 26 Aug, 2015)
 Add Message Add Message
to: "Re: Saving partial results"

 Subscribe Subscribe

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