Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
extended/radioactivedecay/Activation/src/TrackingAction.cc
이 파일의 문서화 페이지로 가기
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
28 //
29 // $Id: TrackingAction.cc 69099 2013-04-18 12:25:19Z maire $
30 //
31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
33 
34 #include "TrackingAction.hh"
35 
36 #include "Run.hh"
37 #include "EventAction.hh"
38 #include "HistoManager.hh"
39 
40 #include "G4RunManager.hh"
41 #include "G4Track.hh"
42 #include "G4StepStatus.hh"
43 #include "G4ParticleTypes.hh"
44 #include "G4IonTable.hh"
45 
46 #include "G4SystemOfUnits.hh"
47 #include "G4UnitsTable.hh"
48 
49 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
50 
52 :G4UserTrackingAction(), fEventAction(event)
53 {
54  fTimeBirth = fTimeEnd = 0.;
55 }
56 
57 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
58 
60 { }
61 
62 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
63 
65 {
66  Run* run = static_cast<Run*>(
68 
69  G4ParticleDefinition* particle = track->GetDefinition();
70  G4String name = particle->GetParticleName();
71  G4double meanLife = particle->GetPDGLifeTime();
72  G4double ekin = track->GetKineticEnergy();
73  fTimeBirth = track->GetGlobalTime();
74 
75  //count secondary particles
76  if (track->GetTrackID() > 1) run->ParticleCount(name,ekin,meanLife);
77 }
78 
79 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
80 
82 {
83  Run* run = static_cast<Run*>(
85 
86  G4AnalysisManager* analysis = G4AnalysisManager::Instance();
87 
88  const G4ParticleDefinition* particle = track->GetParticleDefinition();
89  G4String name = particle->GetParticleName();
90  G4double meanLife = particle->GetPDGLifeTime();
91  G4double ekin = track->GetKineticEnergy();
92  fTimeEnd = track->GetGlobalTime();
93  if ((particle->GetPDGStable())&&(ekin == 0.)) fTimeEnd = DBL_MAX;
94 
95  // count population of ions with meanLife > 0.
96  if ((G4IonTable::IsIon(particle))&&(meanLife != 0.)) {
97  G4int id = run->GetIonId(name);
98  G4double unit = analysis->GetH1Unit(id);
99  G4double tmin = analysis->GetH1Xmin(id)*unit;
100  G4double tmax = analysis->GetH1Xmax(id)*unit;
101  G4double binWidth = analysis->GetH1Width(id)*unit;
102 
103  G4double t1 = std::max(fTimeBirth,tmin);
104  G4double t2 = std::min(fTimeEnd ,tmax);
105  for (G4double time = t1; time<t2; time+= binWidth)
106  analysis->FillH1(id,time);
107  }
108 
109  // keep only emerging particles
110  G4StepStatus status = track->GetStep()->GetPostStepPoint()->GetStepStatus();
111  if (status != fWorldBoundary) return;
112 
113  fEventAction->AddEflow(ekin);
114  run->ParticleFlux(name,ekin);
115 
116  // histograms: energy flow and activities of emerging particles
117 
118  G4int ih1 = 0, ih2 = 0;
119  G4String type = particle->GetParticleType();
120  G4double charge = particle->GetPDGCharge();
121  G4double time = track->GetGlobalTime();
122  if (charge > 3.) {ih1 = 10; ih2 = 20;}
123  else if (particle == G4Gamma::Gamma()) {ih1 = 4; ih2 = 14;}
124  else if (particle == G4Electron::Electron()) {ih1 = 5; ih2 = 15;}
125  else if (particle == G4Positron::Positron()) {ih1 = 5; ih2 = 15;}
126  else if (particle == G4Neutron::Neutron()) {ih1 = 6; ih2 = 16;}
127  else if (particle == G4Proton::Proton()) {ih1 = 7; ih2 = 17;}
128  else if (particle == G4Deuteron::Deuteron()) {ih1 = 8; ih2 = 18;}
129  else if (particle == G4Alpha::Alpha()) {ih1 = 9; ih2 = 19;}
130  else if (type == "nucleus") {ih1 = 10; ih2 = 20;}
131  else if (type == "baryon") {ih1 = 11; ih2 = 21;}
132  else if (type == "meson") {ih1 = 12; ih2 = 22;}
133  else if (type == "lepton") {ih1 = 13; ih2 = 23;};
134  if (ih1 > 0) analysis->FillH1(ih1,ekin);
135  if (ih2 > 0) analysis->FillH1(ih2,time);
136 
137 }
138 
139 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:80
G4double GetKineticEnergy() const
static G4bool IsIon(const G4ParticleDefinition *)
Definition: G4IonTable.cc:1148
T max(const T t1, const T t2)
brief Return the largest of the two arguments
const XML_Char * name
Definition: expat.h:151
TTree * t1
Definition: plottest35.C:26
G4double GetPDGLifeTime() const
void ParticleFlux(G4String, G4double)
const G4String & GetParticleName() const
G4int GetTrackID() const
const G4String & GetParticleType() const
G4double GetPDGCharge() const
const G4ParticleDefinition * GetParticleDefinition() const
static G4Proton * Proton()
Definition: G4Proton.cc:93
G4ParticleDefinition * GetDefinition() const
void ParticleCount(G4String, G4double)
static G4Deuteron * Deuteron()
Definition: G4Deuteron.cc:94
void PostUserTrackingAction(const G4Track *)
static G4Gamma * Gamma()
Definition: G4Gamma.cc:86
double G4double
Definition: G4Types.hh:76
G4StepStatus GetStepStatus() const
G4double GetGlobalTime() const
static G4Alpha * Alpha()
Definition: G4Alpha.cc:89
G4StepStatus
Definition: G4StepStatus.hh:49
static G4Positron * Positron()
Definition: G4Positron.cc:94
G4CsvAnalysisManager G4AnalysisManager
Definition: g4csv_defs.hh:77
G4StepPoint * GetPostStepPoint() const
const G4Step * GetStep() const
static G4Electron * Electron()
Definition: G4Electron.cc:94
G4Run * GetNonConstCurrentRun() const
G4bool GetPDGStable() const
TTree * t2
Definition: plottest35.C:36
int G4int
Definition: G4Types.hh:78
static G4Neutron * Neutron()
Definition: G4Neutron.cc:104
#define DBL_MAX
Definition: templates.hh:83
void PreUserTrackingAction(const G4Track *)
T min(const T t1, const T t2)
brief Return the smallest of the two arguments