Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
electromagnetic/TestEm5/src/StackingAction.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: StackingAction.cc 104417 2017-05-30 08:30:48Z gcosmo $
30 //
31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
33 
34 #include "StackingAction.hh"
35 
36 #include "Run.hh"
37 #include "EventAction.hh"
38 #include "HistoManager.hh"
39 #include "StackingMessenger.hh"
40 
41 #include "G4RunManager.hh"
42 #include "G4Track.hh"
43 
44 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
45 
47  : G4UserStackingAction(), fEventAction(EA),
48  fKillSecondary(0),fStackMessenger(0),fPhotoGamma(-1),fComptGamma(-1),
49  fPhotoAuger(-1),fComptAuger(-1),fPixeGamma(-1),fPixeAuger(-1),
50  fElectronDNAGamma(-1),fElectronDNAAuger(-1),fProtonDNAGamma(-1),
51  fProtonDNAAuger(-1),fHydrogenDNAGamma(-1),fHydrogenDNAAuger(-1),
52  fAlphaDNAGamma(-1),fAlphaDNAAuger(-1),fAlphaPlusDNAGamma(-1),
53  fAlphaPlusDNAAuger(-1),fHeliumDNAGamma(-1),fHeliumDNAAuger(-1),
54  fGenericIonDNAGamma(-1),fGenericIonDNAAuger(-1),fIDdefined(false)
55 {
57 }
58 
59 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
60 
62 {
63  delete fStackMessenger;
64 }
65 
66 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
67 
70 {
71  G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
72 
73  //keep primary particle
74  if (aTrack->GetParentID() == 0) { return fUrgent; }
75 
76  if(!fIDdefined) {
77  fIDdefined = true;
85  G4PhysicsModelCatalog::GetIndex("e-_G4DNAIonisation_fluo");
87  G4PhysicsModelCatalog::GetIndex("e-_G4DNAIonisation_auger");
89  G4PhysicsModelCatalog::GetIndex("proton_G4DNAIonisation_fluo");
91  G4PhysicsModelCatalog::GetIndex("proton_G4DNAIonisation_auger");
93  G4PhysicsModelCatalog::GetIndex("hydrogen_G4DNAIonisation_fluo");
95  G4PhysicsModelCatalog::GetIndex("hydrogen_G4DNAIonisation_auger");
97  G4PhysicsModelCatalog::GetIndex("alpha_G4DNAIonisation_fluo");
99  G4PhysicsModelCatalog::GetIndex("alpha_G4DNAIonisation_auger");
101  G4PhysicsModelCatalog::GetIndex("alpha+_G4DNAIonisation_fluo");
103  G4PhysicsModelCatalog::GetIndex("alpha+_G4DNAIonisation_auger");
104  fHeliumDNAGamma =
105  G4PhysicsModelCatalog::GetIndex("helium_G4DNAIonisation_fluo");
106  fHeliumDNAAuger =
107  G4PhysicsModelCatalog::GetIndex("helium_G4DNAIonisation_auger");
109  G4PhysicsModelCatalog::GetIndex("GenericIon_G4DNAIonisation_fluo");
111  G4PhysicsModelCatalog::GetIndex("GenericIon_G4DNAIonisation_auger");
112  }
113  G4int idx = aTrack->GetCreatorModelID();
114 
115  //count secondary particles
116 
117  Run* run = static_cast<Run*>(
119  run->CountParticles(aTrack->GetDefinition());
120  /*
121  G4cout << "###StackingAction: new "
122  << aTrack->GetDefinition()->GetParticleName()
123  << " E(MeV)= " << aTrack->GetKineticEnergy()
124  << " " << aTrack->GetMomentumDirection() << G4endl;
125  */
126  //
127  //energy spectrum of secondaries
128  //
129  G4double energy = aTrack->GetKineticEnergy();
130  G4double charge = aTrack->GetDefinition()->GetPDGCharge();
131 
132  if (charge != 0.) {
133  analysisManager->FillH1(2,energy);
134  analysisManager->FillH1(4,energy);
135  if(idx == fPhotoAuger || idx == fComptAuger) {
136  analysisManager->FillH1(50,energy);
137  analysisManager->FillH1(52,energy);
138  } else if(idx == fPixeAuger) {
139  analysisManager->FillH1(54,energy);
140  analysisManager->FillH1(56,energy);
141  } else if(idx == fElectronDNAAuger ||
142  idx == fProtonDNAAuger ||
143  idx == fHydrogenDNAAuger ||
144  idx == fAlphaDNAAuger ||
145  idx == fAlphaPlusDNAAuger ||
146  idx == fHeliumDNAAuger ||
147  idx == fGenericIonDNAAuger) {
148  analysisManager->FillH1(58,energy);
149  analysisManager->FillH1(60,energy);
150  }
151  }
152 
153  if (aTrack->GetDefinition() == G4Gamma::Gamma()) {
154  analysisManager->FillH1(3,energy);
155  analysisManager->FillH1(5,energy);
156  if(idx == fPhotoGamma || idx == fComptGamma) {
157  analysisManager->FillH1(51,energy);
158  analysisManager->FillH1(53,energy);
159  } else if(idx == fPixeGamma) {
160  analysisManager->FillH1(55,energy);
161  analysisManager->FillH1(57,energy);
162  } else if(idx == fElectronDNAGamma ||
163  idx == fProtonDNAGamma ||
164  idx == fHydrogenDNAGamma ||
165  idx == fAlphaDNAGamma ||
166  idx == fAlphaPlusDNAGamma ||
167  idx == fHeliumDNAGamma ||
168  idx == fGenericIonDNAGamma) {
169  analysisManager->FillH1(59,energy);
170  analysisManager->FillH1(61,energy);
171  }
172  }
173 
174  //stack or delete secondaries
176  if (fKillSecondary) {
177  if (fKillSecondary == 1) {
178  fEventAction->AddEnergy(energy);
179  status = fKill;
180  }
181  if (aTrack->GetDefinition() == G4Gamma::Gamma()) {
182  status = fKill;
183  }
184  }
185 
186  return status;
187 }
188 
189 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:80
G4double GetKineticEnergy() const
virtual G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track *)
void CountParticles(G4ParticleDefinition *part)
G4double GetPDGCharge() const
G4ParticleDefinition * GetDefinition() const
static G4Gamma * Gamma()
Definition: G4Gamma.cc:86
static G4int GetIndex(const G4String &)
double G4double
Definition: G4Types.hh:76
double energy
Definition: plottest35.C:25
G4CsvAnalysisManager G4AnalysisManager
Definition: g4csv_defs.hh:77
G4Run * GetNonConstCurrentRun() const
int G4int
Definition: G4Types.hh:78
G4int GetCreatorModelID() const
G4int GetParentID() const