-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
SimpleGun.cpp
59 lines (42 loc) · 1.39 KB
/
SimpleGun.cpp
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// File modified by Deepak Samuel on 25 Sep 2019
#include "SimpleGun.h"
#include "G4LogicalVolumeStore.hh"
#include "G4LogicalVolume.hh"
#include "G4Box.hh"
#include "G4RunManager.hh"
#include "G4ParticleGun.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
#include "G4SystemOfUnits.hh"
#include "Randomize.hh"
#include "G4GeneralParticleSource.hh"
#include <QDebug>
#include <G4Run.hh>
int SimpleGun::nevent=0;
SimpleGun::SimpleGun() : QObject(new QObject), G4VUserPrimaryGeneratorAction()
{
G4int n_particle = 1;
fParticleGun = new G4GeneralParticleSource();
G4String particleName;
// G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
// G4ParticleDefinition* particle = particleTable->FindParticle(particleName="e-");
// fParticleGun->SetParticleDefinition(particle);
}
SimpleGun::~SimpleGun()
{
delete fParticleGun;
}
void SimpleGun::GeneratePrimaries(G4Event* anEvent)
{
//if(anEvent->GetEventID()==0){
//const G4Run *thisRun = static_cast<const G4Run*> (G4RunManager::GetRunManager()->GetCurrentRun());
// nevents = ;
// }
fParticleGun->GeneratePrimaryVertex(anEvent);
//nextEvent(100*(anEvent->GetEventID()+1)/thisRun->GetNumberOfEventToBeProcessed());
//nextEvent(nevent++);
if(nevent%1000==0){
//qDebug()<<nevent<<" processed..."<<endl;
G4cout<<nevent<<" processed";
}
}