Message: how can i emitting particle in space Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Question how can i emitting particle in space  

Forum: Event and Track Management
Date: 18 Jul, 2013
From: shayma nader <shayma nader>

please i used this command in primary generation action but i don't obtain isotropic source, i need to emit positron particle in space to obtain isotropic dource direction

PSPrimaryGeneratorAction::PSPrimaryGeneratorAction(PSDetectorConstruction* DC) :Detector(DC) {

}

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

PSPrimaryGeneratorAction::~PSPrimaryGeneratorAction()
{
  delete particleGun;
}

//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......

void PSPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
  //this function is called at the begining of event
  // 

  G4int n_particle = 1;
  particleGun  = new G4ParticleGun(n_particle);
  // default particle kinematic
 //G4cout<<"-----------------------------------------------------------"<<G4endl;

  G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
  G4String particleName;
  G4ParticleDefinition* particle
                    = particleTable->FindParticle(particleName="e+");
  particleGun->SetParticleDefinition(particle);
  particleGun->SetParticleEnergy(1.*MeV);
  particleGun->SetParticlePosition(G4ThreeVector(0.0*cm,0.0*cm,-0.0150*cm));
 G4double Px,Py,Pz;
 //G4cout<<Px<<" * "<<Py<<" * "<<Pz<<G4endl;

 //G4cout<<"-----------------------------------------------------------"<<G4endl;

 Px=(0.5-G4UniformRand())*2.;
 Py=(0.5-G4UniformRand())*2.;
 Pz=(0.5-G4UniformRand())*2.;

 double module= sqrt(Px*Px+Py*Py+Pz*Pz);
 Px=Px/module;
 Py=Py/module;
 Pz=Pz/module;

particleGun->SetParticleMomentumDirection(G4ThreeVector(Px,Py,Pz)); particleGun->GeneratePrimaryVertex(anEvent); }

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

1 None: Re: how can i emitting particle in space   (michel maire - 18 Jul, 2013)
(_ Ok: Re: how can i emitting particle in space   (shayma nader - 18 Jul, 2013)
 Add Message Add Message
to: "how can i emitting particle in space "

 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 ]