Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
extended/medical/electronScattering/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 //
30 // $Id: TrackingAction.cc 88035 2015-01-26 10:22:08Z gcosmo $
31 //
32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
33 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
34 
35 #include "TrackingAction.hh"
36 
37 #include "DetectorConstruction.hh"
38 #include "Run.hh"
39 #include "HistoManager.hh"
40 
41 #include "G4Track.hh"
42 #include "G4PhysicalConstants.hh"
43 #include "G4SystemOfUnits.hh"
44 #include "G4RunManager.hh"
45 
46 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
47 
49 :fDetector(DET)
50 {
51  fZend = 0.5*(fDetector->GetThicknessWorld());
52 }
53 
54 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
55 
57 { }
58 
59 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
60 
62 {
63  G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
64 
65  G4double charge = track->GetDefinition()->GetPDGCharge();
67  G4ThreeVector direction = track->GetMomentumDirection();
68 
69  if (charge == 0.0) return;
70  if (position.z() < fZend) return;
71  if (direction.z() <= 0.) return;
72 
73  G4double rmin, dr, ds;
74  G4int ih = 1;
75 
76  //projected angle at exit
77 
78  G4double ux = direction.x(), uy = direction.y(), uz = direction.z();
79  G4double thetax = std::atan(ux/uz);
80  G4double thetay = std::atan(uy/uz);
81  analysisManager->FillH1(ih, thetax);
82  analysisManager->FillH1(ih, thetay);
83 
84  //dN/dS at exit
85 
86  G4double x = position.x(), y = position.y();
87  G4double r = std::sqrt(x*x + y*y);
88  ih = 2;
89  dr = analysisManager->GetH1Width(ih);
90  rmin = ((int)(r/dr))*dr;
91  ds = twopi*(rmin + 0.5*dr)*dr;
92  analysisManager->FillH1(ih, r, 1/ds);
93 
94  //d(N/cost)/dS at exit
95 
96  ih = 3;
97  dr = analysisManager->GetH1Width(ih);
98  rmin = ((int)(r/dr))*dr;
99  ds = twopi*(rmin + 0.5*dr)*dr;
100  analysisManager->FillH1(ih, r, 1/(uz*ds));
101 
102  //vector of d(N/cost)/dS at exit
103 
104  Run* run = static_cast<Run*>(
106 
107  run->SumFluence(r, 1/uz);
108 
109  //space angle at exit : dN/dOmega
110 
111  ih = 5;
112  G4double theta = std::acos(uz);
113  if (theta > 0.) {
114  G4double dtheta = analysisManager->GetH1Width(ih);
115  G4double unit = analysisManager->GetH1Unit(ih);
116  if (dtheta > 0.) {
117  G4double weight = unit*unit/(twopi*std::sin(theta)*dtheta);
118  analysisManager->FillH1(ih, theta, weight);
119  }
120  }
121 
122  //measured space angle at exit : dN/dOmega_meas
123  //
124  ih = 6;
125  const G4double dist = fDetector->GetZdist_foil_detector();
126  G4double thetam = std::atan(r/dist);
127  if (thetam > 0.) {
128  G4double dtheta = analysisManager->GetH1Width(ih);
129  G4double unit = analysisManager->GetH1Unit(ih);
130  if (dtheta > 0.) {
131  G4double weight = unit*unit/(twopi*std::sin(thetam)*dtheta);
132  analysisManager->FillH1(ih, thetam, weight);
133  }
134  }
135 
136 }
137 
138 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
139 
Float_t x
Definition: compare.C:6
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:80
void SumFluence(G4double, G4double)
Float_t y
Definition: compare.C:6
G4double GetPDGCharge() const
double z() const
G4ParticleDefinition * GetDefinition() const
void PostUserTrackingAction(const G4Track *)
double G4double
Definition: G4Types.hh:76
static constexpr double twopi
Definition: G4SIunits.hh:76
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)
const G4ThreeVector & GetPosition() const
G4CsvAnalysisManager G4AnalysisManager
Definition: g4csv_defs.hh:77
G4Run * GetNonConstCurrentRun() const
double weight
Definition: plottest35.C:25
int G4int
Definition: G4Types.hh:78
double x() const
double y() const
const G4ThreeVector & GetMomentumDirection() const
void PreUserTrackingAction(const G4Track *)
Simple detector construction with a box volume placed in a world.