Message: Particles with 3 different energies Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Particles with 3 different energies 

Keywords: paricles energy
Forum: Particles
Date: 08 Jul, 2007
From: Konstantinos Michael <Konstantinos Michael >

hi all,

I want to make the particle gun to shoot randomly particles with 3 different energies and in random direction but i am not sure how can i do it.

here is a part of my code.

void ExN03PrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
G4double x0 = -0.8*(ExN03Detector->GetWorldSizeX());
  G4double y0 = 0.*cm, z0 = 0.*cm;

{ 
       y0 = (ExN03Detector->GetCalorSizeYZ())*(G4UniformRand()-0.5);
      z0 = (ExN03Detector->GetCalorSizeYZ())*(G4UniformRand()-0.5);

      G4double E1=5.5*MeV;
      G4double E2=6.5*MeV;
      G4double E3=7.5*MeV;

particleGun->SetParticleEnergy(E1);      
particleGun->SetParticleEnergy(E2);
particleGun->SetParticleEnergy(E3);
      G4double i=G4UniformRand();
       G4double j=0;
       G4double k=0;
      particleGun->SetParticleMomentumDirection(G4ThreeVector(i,j,k));

    particleGun->SetParticlePosition(G4ThreeVector(x0,y0,z0));

}

  particleGun->GeneratePrimaryVertex(anEvent);
  particleGun->GeneratePrimaryVertex(anEvent);
  particleGun->GeneratePrimaryVertex(anEvent);
}

Thanks

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

1 Feedback: Re: Particles with 3 different energies   (Peter Gumplinger - 09 Jul, 2007)
(_ None: Re: Particles with 3 different energies   (areg - 08 Nov, 2007)
(_ Feedback: Re: Particles with 3 different energies   (Peter Gumplinger - 09 Nov, 2007)
(_ None: Re: Particles with 3 different energies   (Areg - 09 Nov, 2007)
(_ More: Re: Particles with 3 different energies   (Peter Gumplinger - 12 Nov, 2007)
 Add Message Add Message
to: "Particles with 3 different energies"

 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 ]