-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerator.cc
35 lines (27 loc) · 1.14 KB
/
generator.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include "generator.hh"
MyPrimaryGenerator::MyPrimaryGenerator()
{
fParticleGun = new G4ParticleGun(1);
}
MyPrimaryGenerator::~MyPrimaryGenerator()
{
delete fParticleGun;
}
void MyPrimaryGenerator::GeneratePrimaries(G4Event *anEvent)
{
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
G4IonTable* Iontable = particleTable->GetIonTable();
//G4ParticleDefinition* particle = particleTable->FindParticle(11); // ýëåêòðîíû
//G4ParticleDefinition *particle = particleTable->FindParticle(2212); // ïðîòîíû
//G4ParticleDefinition* particle = Iontable->GetIon(2, 4, 0); // He-4
//G4ParticleDefinition* particle = Iontable->GetIon(6, 12, 0); // Ñ-12
//G4ParticleDefinition* particle = Iontable->GetIon(8, 16, 0); // O-16
G4ParticleDefinition* particle = Iontable->GetIon(26, 56, 0); // Fe-56
G4ThreeVector pos(0.,0.,-280.*mm);
G4ThreeVector mom(0.,0.,1.);
fParticleGun->SetParticleDefinition(particle);
fParticleGun->SetParticlePosition(pos);
fParticleGun->SetParticleMomentumDirection(mom);
fParticleGun->SetParticleEnergy(20.*GeV);
fParticleGun->GeneratePrimaryVertex(anEvent);
}