Message: Re: Particle Source Biasing Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Re: Particle Source Biasing 

Forum: Biasing and Scoring
Re: None Particle Source Biasing (Ran Itay)
Date: 21 May, 2014
From: Daren Sawkey <Daren Sawkey>

You can choose the angle randomly. If it is not within the interesting angle, discard the particle with probability p.

If you don't want to bias the result, then multiply the weights of surviving particles (not in the interesting solid angle) by 1/(1-p).

To "shoot" the particle: In your

 MyUserPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)

calculate particle properties, create a vertex, assign properties, and add it to the event. Here's some of it (reply if you need more):

 G4ThreeVector particle_position(x,y,z);

 G4ParticleTable* particle_table = G4ParticleTable::GetParticleTable();
 G4ParticleDefinition* particle_def = particle_table->FindParticle(type);
 G4double particle_time = 0.0;

 G4PrimaryVertex* vertex =
   new G4PrimaryVertex(particle_position,particle_time);

 G4PrimaryParticle* particle = new G4PrimaryParticle(particle_def,u,v,w);
 particle->SetWeight(weight);
 vertex->SetPrimary(particle);
 anEvent->AddPrimaryVertex(vertex);

(Better would be to use G4ParticleGun, but I'm not aware of a way to set the weight using G4ParticleGun.)

 Add Message Add Message
to: "Re: Particle Source Biasing"

 Subscribe Subscribe

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