-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathgenerator.cc
More file actions
42 lines (32 loc) · 1.15 KB
/
generator.cc
File metadata and controls
42 lines (32 loc) · 1.15 KB
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
36
37
38
39
40
41
42
#include "generator.hh"
MyPrimaryGenerator::MyPrimaryGenerator()
{
fParticleGun = new G4ParticleGun(1);
G4ParticleTable *particleTable = G4ParticleTable::GetParticleTable();
G4ParticleDefinition *particle = particleTable->FindParticle("chargedgeantino");
G4ThreeVector pos(0.,0.,-20.*km);
G4ThreeVector mom(0.,0.,1.);
fParticleGun->SetParticlePosition(pos);
fParticleGun->SetParticleMomentumDirection(mom);
fParticleGun->SetParticleMomentum(100.*GeV);
fParticleGun->SetParticleDefinition(particle);
}
MyPrimaryGenerator::~MyPrimaryGenerator()
{
delete fParticleGun;
}
void MyPrimaryGenerator::GeneratePrimaries(G4Event *anEvent)
{
G4ParticleDefinition* particle = fParticleGun->GetParticleDefinition();
if(particle == G4ChargedGeantino::ChargedGeantino())
{
G4int Z = 27;
G4int A = 60;
G4double charge = 0.*eplus;
G4double energy = 0.*keV;
G4ParticleDefinition* ion = G4IonTable::GetIonTable()->GetIon(Z,A,energy);
fParticleGun->SetParticleDefinition(ion);
fParticleGun->SetParticleCharge(charge);
}
fParticleGun->GeneratePrimaryVertex(anEvent);
}