Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
extended/radioactivedecay/rdecay02/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 "DetectorConstruction.hh"
37 #include "Run.hh"
38 #include "HistoManager.hh"
39 
40 #include "G4RunManager.hh"
41 #include "G4Track.hh"
42 #include "G4HadronicProcessType.hh"
43 
44 #include "G4SystemOfUnits.hh"
45 
46 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
47 
49 :G4UserTrackingAction(), fDetector(det)
50 { }
51 
52 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
53 
55 {
56 
57  Run* run = static_cast<Run*>(
59 
60  G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
61 
62  //which volume ?
63  //
64  G4LogicalVolume* lVolume = track->GetVolume()->GetLogicalVolume();
65  G4int iVol = 0;
66  if (lVolume == fDetector->GetLogicTarget()) iVol = 1;
67  if (lVolume == fDetector->GetLogicDetector()) iVol = 2;
68 
69  //secondary particles only
70  if (track->GetTrackID() == 1) return;
71 
72  const G4ParticleDefinition* particle = track->GetParticleDefinition();
73  G4String name = particle->GetParticleName();
74  G4int pid = particle->GetPDGEncoding();
75  G4int Z = particle->GetAtomicNumber();
76  G4int A = particle->GetAtomicMass();
77  G4double charge = particle->GetPDGCharge();
78  G4double energy = track->GetKineticEnergy();
79  G4double time = track->GetGlobalTime();
80  G4double weight = track->GetWeight();
81 
82  run->ParticleCount(name,energy,iVol);
83 
84  //Radioactive decay products
85  G4int processType = track->GetCreatorProcess()->GetProcessSubType();
86  if (processType == fRadioactiveDecay) {
87  //fill ntuple id = 3
88  G4int id = 3;
89  analysisManager->FillNtupleDColumn(id,0, double(pid));
90  analysisManager->FillNtupleDColumn(id,1, double(Z));
91  analysisManager->FillNtupleDColumn(id,2, double(A));
92  analysisManager->FillNtupleDColumn(id,3, energy);
93  analysisManager->FillNtupleDColumn(id,4, time/s);
94  analysisManager->FillNtupleDColumn(id,5, weight);
95  analysisManager->AddNtupleRow(id);
96 
97  if (charge < 3.) {
98  //fill ntuple id = 0
99  id = 0;
100  analysisManager->FillNtupleDColumn(id,0, double(pid));
101  analysisManager->FillNtupleDColumn(id,1, energy);
102  analysisManager->FillNtupleDColumn(id,2, time/s);
103  analysisManager->FillNtupleDColumn(id,3, weight);
104  analysisManager->AddNtupleRow(id);
105 
106  analysisManager->FillH1(6, energy, weight);
107  analysisManager->FillH1(7, energy, weight);
108  analysisManager->FillH1(8, energy, weight);
109  }
110  }
111 
112  //all unstable ions produced in target
113  G4bool unstableIon = ((charge > 2.) && !(particle->GetPDGStable()));
114  if ((unstableIon) && (iVol == 1)) {
115  //fill ntuple id = 1
116  G4int id = 1;
117  analysisManager->FillNtupleDColumn(id,0, double(pid));
118  analysisManager->FillNtupleDColumn(id,1, time/s);
119  analysisManager->FillNtupleDColumn(id,2, weight);
120  analysisManager->AddNtupleRow(id);
121  }
122 }
123 
124 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
125 
127 { }
128 
129 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
130 
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:80
G4double GetKineticEnergy() const
const XML_Char * name
Definition: expat.h:151
G4int GetAtomicNumber() const
G4LogicalVolume * GetLogicalVolume() const
const G4String & GetParticleName() const
G4int GetTrackID() const
G4double GetPDGCharge() const
const G4ParticleDefinition * GetParticleDefinition() const
void ParticleCount(G4String, G4double)
void PostUserTrackingAction(const G4Track *)
G4double GetWeight() const
Float_t Z
const XML_Char * s
Definition: expat.h:262
double G4double
Definition: G4Types.hh:76
bool G4bool
Definition: G4Types.hh:79
G4double GetGlobalTime() const
double energy
Definition: plottest35.C:25
double A(double temperature)
G4CsvAnalysisManager G4AnalysisManager
Definition: g4csv_defs.hh:77
G4Run * GetNonConstCurrentRun() const
G4bool GetPDGStable() const
double weight
Definition: plottest35.C:25
int G4int
Definition: G4Types.hh:78
const G4VProcess * GetCreatorProcess() const
G4int GetAtomicMass() const
void PreUserTrackingAction(const G4Track *)
Simple detector construction with a box volume placed in a world.
G4VPhysicalVolume * GetVolume() const
G4int GetProcessSubType() const
Definition: G4VProcess.hh:429