Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
medical/fanoCavity/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 98764 2016-08-09 14:12:17Z gcosmo $
30 //
31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
33 
34 #include "StackingAction.hh"
35 
36 #include "DetectorConstruction.hh"
37 #include "RunAction.hh"
38 #include "HistoManager.hh"
39 #include "G4RunManager.hh"
40 #include "StackingMessenger.hh"
41 #include "Run.hh"
42 
43 #include "G4Track.hh"
44 #include "G4EmCalculator.hh"
45 
46 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
47 
49 :fDetector(det),fStackMessenger(0)
50 {
51  fMatWall = 0;
52  fZcav = 0.;
53  fEmCal = 0;
54  first = true;
55  fKillTrack = true;
56 
57  //create a messenger for this class
59 }
60 
61 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
62 
64 {
65  delete fEmCal;
66  delete fStackMessenger;
67 }
68 
69 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
70 
73 {
74  //get fDetector informations
75  if (first) {
78  fEmCal = new G4EmCalculator();
79  first = false;
80  }
81 
83 
84  //keep primary particle or neutral
85  //
86  G4ParticleDefinition* particle = track->GetDefinition();
87  G4bool neutral = (particle->GetPDGCharge() == 0.);
88  if ((track->GetParentID() == 0) || neutral) return status;
89 
90  Run* run = static_cast<Run*>(
92 
93  //energy spectrum of charged secondaries
94  //
95  G4double energy = track->GetKineticEnergy();
96  run->SumEsecond(energy);
97 
98  // kill e- which cannot reach Cavity
99  //
100  G4double position = (track->GetPosition()).z();
101  G4double safe = std::abs(position) - fZcav;
103  if (fKillTrack) {
104  if (range < 0.8*safe) status = fKill;
105  }
106 
107  //histograms
108  //
109  G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
110  analysisManager->FillH1(1,position);
111  analysisManager->FillH1(2,energy);
112  G4ThreeVector direction = track->GetMomentumDirection();
113  analysisManager->FillH1(3,std::acos(direction.z()));
114 
115  return status;
116 }
117 
118 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double GetRangeFromRestricteDEDX(G4double kinEnergy, const G4ParticleDefinition *, const G4Material *, const G4Region *r=nullptr)
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:80
G4double GetKineticEnergy() const
virtual G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track *)
Double_t z
G4double GetPDGCharge() const
double z() const
G4ParticleDefinition * GetDefinition() const
double G4double
Definition: G4Types.hh:76
bool G4bool
Definition: G4Types.hh:79
const G4ParticleDefinition const G4Material *G4double range
double energy
Definition: plottest35.C:25
const G4ThreeVector & GetPosition() const
G4CsvAnalysisManager G4AnalysisManager
Definition: g4csv_defs.hh:77
G4Run * GetNonConstCurrentRun() const
const G4ThreeVector & GetMomentumDirection() const
Simple detector construction with a box volume placed in a world.
G4int GetParentID() const