Message: Re: Isotropic source how to specify??? Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Re: Isotropic source how to specify??? 

Forum: Event and Track Management
Re: None Isotropic source how to specify??? (Yuri Burmistenko)
Date: 12 Mar, 2008
From: Victor_Makarov <Victor_Makarov>

Hello, my university comrade!!! Put the following in the end of PrimaryGeneratorAction

void PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
  //this function is called at the begining of event
  //
  //distribution uniform in solid angle
  //
 G4double cosTheta = 2*G4UniformRand() - 1., phi = twopi*G4UniformRand();
  G4double sinTheta = std::sqrt(1. - cosTheta*cosTheta);
  G4double ux = sinTheta*std::cos(phi),
           uy = sinTheta*std::sin(phi),
           uz = cosTheta;

  particleGun->SetParticleMomentumDirection(G4ThreeVector(ux,uy,uz));

particleGun->GeneratePrimaryVertex(anEvent); }

In future I advise you to use some kimd of search here...

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

 Add Message Add Message
to: "Re: Isotropic source how to specify???"

 Subscribe Subscribe

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


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]