Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
extended/medical/fanoCavity2/src/SteppingAction.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: SteppingAction.cc 90829 2015-06-10 08:37:55Z gcosmo $
30 //
31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
33 
34 #include "SteppingAction.hh"
35 #include "DetectorConstruction.hh"
36 #include "TrackingAction.hh"
37 #include "HistoManager.hh"
38 #include "G4RunManager.hh"
39 #include "Run.hh"
40 
41 #include "G4SteppingManager.hh"
42 #include "G4Gamma.hh"
43 #include "G4UnitsTable.hh"
44 
45 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
46 
48  TrackingAction* TrAct)
49 :fDetector(det), fTrackAction(TrAct),
50  fWall(0), fCavity(0)
51 {
52  first = true;
53  fTrackSegm = 0.;
54  fDirectionIn = G4ThreeVector(0.,0.,0.);
55 }
56 
57 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
58 
60 { }
61 
62 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
63 
65 {
66  //get fDetector pointers
67  if (first) {
68  fWall = fDetector->GetWall();
70  first = false;
71  }
72 
73 
74  Run* run = static_cast<Run*>(
76 
77  //histograms
78  G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
79 
80  //get volume
81  //
82  G4StepPoint* point1 = step->GetPreStepPoint();
83  G4VPhysicalVolume* volume = point1->GetTouchableHandle()->GetVolume();
84 
85  // count processes
86  //
87  G4StepPoint* point2 = step->GetPostStepPoint();
88  const G4VProcess* process = point2->GetProcessDefinedStep();
89  if (process) run->CountProcesses(process->GetProcessName());
90 
91  //energy deposit in fCavity
92  //
93  if (volume == fCavity) {
95  if (edep > 0.) fTrackAction->AddEdepCavity(edep);
96  }
97 
98  //keep only charged particles
99  //
100  if (step->GetTrack()->GetDefinition() == G4Gamma::Gamma()) return;
101 
102  //step size of charged particles
103  //
104  G4int id;
105  G4double steplen = step->GetStepLength();
106  if (volume == fWall) {run->StepInWall (steplen); id = 9;}
107  else {run->StepInCavity(steplen); id = 10;}
108  analysisManager->FillH1(id,steplen);
109 
110  //last step before hitting the fCavity
111  //
112  if ((volume == fWall) && (point2->GetStepStatus() == fGeomBoundary)) {
114  }
115 
116  //keep only charged particles within fCavity
117  //
118  if (volume == fWall) return;
119 
120  G4double ekin1 = point1->GetKineticEnergy();
121  G4double ekin2 = point2->GetKineticEnergy();
122 
123  //first step in cavity
124  //
125  if (point1->GetStepStatus() == fGeomBoundary) {
126  fTrackSegm = 0.;
127  G4ThreeVector vertex = step->GetTrack()->GetVertexPosition();
128  analysisManager->FillH1(4,vertex.z());
129  run->FlowInCavity(0,ekin1);
130  analysisManager->FillH1(5,ekin1);
131  if (steplen>0.) {
132  G4ThreeVector directionOut =
133  (point2->GetPosition() - point1->GetPosition()).unit();
135  ->SurfaceNormal(point1->GetPosition());
136  analysisManager->FillH1(6,std::acos(-fDirectionIn*normal));
137  analysisManager->FillH1(7,std::acos(-directionOut*normal));
138  }
139  }
140 
141  //within cavity
142  //
143  if (step->GetTrack()->GetCurrentStepNumber() == 1) fTrackSegm = 0.;
144  fTrackSegm += steplen;
145  if (ekin2 <= 0.) {
147  analysisManager->FillH1(8,fTrackSegm);
148  }
149 
150  //exit cavity
151  //
152  if (point2->GetStepStatus() == fGeomBoundary) {
153  run->FlowInCavity(1,ekin2);
155  analysisManager->FillH1(8,fTrackSegm);
156  }
157 }
158 
159 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
160 
161 
const G4ThreeVector & GetVertexPosition() const
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:80
const DetectorConstruction * fDetector
CLHEP::Hep3Vector G4ThreeVector
G4StepPoint * GetPreStepPoint() const
double z() const
static double normal(HepRandomEngine *eptr)
Definition: RandPoisson.cc:77
virtual G4VPhysicalVolume * GetVolume(G4int depth=0) const
Definition: G4VTouchable.cc:44
G4int GetCurrentStepNumber() const
virtual G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const =0
G4ParticleDefinition * GetDefinition() const
const G4TouchableHandle & GetTouchableHandle() const
static G4Gamma * Gamma()
Definition: G4Gamma.cc:86
virtual G4VSolid * GetSolid(G4int depth=0) const
Definition: G4VTouchable.cc:51
double G4double
Definition: G4Types.hh:76
G4StepStatus GetStepStatus() const
void AddTrakCavity(G4double dt)
G4double GetStepLength() const
const G4ThreeVector & GetPosition() const
G4Track * GetTrack() const
const G4String & GetProcessName() const
Definition: G4VProcess.hh:411
const G4ThreeVector & GetMomentumDirection() const
G4double GetTotalEnergyDeposit() const
G4CsvAnalysisManager G4AnalysisManager
Definition: g4csv_defs.hh:77
Definition: G4Step.hh:76
G4StepPoint * GetPostStepPoint() const
void UserSteppingAction(const G4Step *)
G4double GetKineticEnergy() const
Double_t edep
G4Run * GetNonConstCurrentRun() const
void FlowInCavity(G4int k, G4double e)
int G4int
Definition: G4Types.hh:78
void CountProcesses(G4String procName)
const G4VProcess * GetProcessDefinedStep() const
Simple detector construction with a box volume placed in a world.