How biasing events?

Hello, I’m trying to simulate 10^8 events. The run started at 3 pm and it is still running…unfortunately due the low cross section value of the interaction e+e- -> mu+ mu- I need many events to hope to produce muons (maybe also more than 10^8), but I can’t wait days to get a simulation! I know that Geant allows to do a bias, i.e. I simulate n events, but I can set to show results as if I simulate m>>m events. How can I do it? for example, how can I set to simulate 10^5 events, but show results as if I simulated 10^10?

Thank you

10^8 events require so much time without biasing. I tried to simulate 10^6 but I didn’t get secondary mu+/-. I do the selection of secondary mu+/- in this way in the stepping action

G4VPhysicalVolume* ThisVol = step->GetPreStepPoint()->GetTouchableHandle()->GetVolume();
	G4VPhysicalVolume* NextVol = step->GetPostStepPoint()->GetTouchableHandle()->GetVolume();

if(NextVol && ThisVol->GetName()=="Envelope2" && NextVol->GetName()=="World" && step->GetTrack()->GetParentID()!=00 && (step->GetTrack()->GetDynamicParticle()->GetPDGcode()==13 || step->GetTrack()->GetDynamicParticle()->GetPDGcode()==-13 )) {

I was noticing that there are some examples in which there is the Physics and there are included some G4 files regarding the physics process…so…maybe, didn’t I get e-e+ ->mu+mu- events, because I need to add the files and to call the class e G4AnnihiToMuPair or to call this process in other file (stepping action, etc.)???

Edit: Do I’ve just to copy the files



  • Physicslist.hh

  • StepMax.hh

from the \geant4_10_06\examples\extended\electromagnetic\TestEm6\ to my program and to add
#include "PhysicsList.hh" in or what should I do to simulate the interaction e+e- ->mu+mu-?

Thank you

Does anyone know how to simulate also the process e+e- -> mu+mu- and how to bias events please?

@anna or @mkelsey you are helping me so much…I hope you can help me for that too…

The long output that you get for each Geant4 simulation summarises at the top what you have included, for instance, it tells you which processes are defined. Indeed, it probably lacks AnnihiToMuPair.
You can activate it directly in your UI macro (before run initialization):

/physics_lists/em/PositronToMuons true

To bias the cross section you can use another command:

/physics_lists/em/PositronToMuonsFactor <N>

Thank you @anna

Regarding of the positronTomuons call, I added the line

/physics_lists/em/PositronToMuons true
in my run1.mac
but I get this error

Regarding of the bias

/physics_lists/em/PositronToMuonsFactor <N>

do I have to replace the N by a number?

For example

/physics_lists/em/PositronToMuonsFactor <100>
to inclrease the cross section by a factor 100?

They need to be placed before the run initialisation (meaning before UI command /run/initialize).

Yes, you need to replace <N> by a number (not just N). Once you do it you should get an information:

The cross section for AnnihiToMuPair is artificially increased by the CrossSecFactor=<N>

Thank you @anna it worked and biasing the cross section, I also get the muons!

Last question please,
I copied the and the PrimaryGeneratorAction.hh from examples\extended\common\
to use the G4GeneralParticleSource. I tried it and it worked. I’ve just a problem.

I added two lines


but the first one (to set the beam momentum) doesn’t work. It says that SetParticleMomentumDirection isn’t a memember of the GeneralParticleSource, so what shoul I use to set the particle momentum along the z axis?

You can consult the list of available UI commands for GPS in the user guide. To set up the direction and position:

/gps/direction Px Py Pz
Set the momentum direction [default (1,0,0)] of generated particles using (1)
/gps/position X Y Z unit 
Sets the centre co-ordinates (X,Y,Z) of the source [default (0,0,0) cm]. The units can be micron, mm, cm, m or km. (NB: it is recommended to use /gps/pos/centre instead.)

Thank you @anna! it worked