Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
extended/eventgenerator/GunGPS/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 68734 2013-04-05 09:47:02Z gcosmo $
31 //
32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
33 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
34 
35 #include "TrackingAction.hh"
36 #include "HistoManager.hh"
37 
38 #include "G4Track.hh"
39 #include "G4PhysicalConstants.hh"
40 
41 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
42 
45  { }
46 
47 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
48 
50 {
51  G4AnalysisManager* analysis = G4AnalysisManager::Instance();
52 
53  //vertex position
54  //
55  G4ThreeVector ur(0.,0.,1.);
56  G4ThreeVector vertex = track->GetVertexPosition();
57  G4double r = vertex.mag();
58  if (r > 0.0) {
59  //vertex position: dN = f(radius)
60  //
61  analysis->FillH1(1, r);
62 
63  //vertex position: angular distribution : dN = f(costheta)
64  //
65  ur = vertex/r;
66  G4double costheta = ur.z();
67  analysis->FillH1(2, costheta);
68 
69  //vertex position: angular distribution : dN = f(phi)
70  //
71  G4double phi = std::atan2(ur.y(), ur.x());
72  if (phi < 0.) phi += twopi;
73  analysis->FillH1(3, phi);
74  }
75 
76  //particle direction: angular distr in vetex frame dN = f(cosalpha)
77  //
79  G4double cosalpha = ur*um;
80  analysis->FillH1(4, cosalpha);
81 
82  //particle direction: angular distr in vertex frame dN = f(psi)
83  //
84  // complete local frame
85  G4ThreeVector u1(1.,0.,0.); u1.rotateUz(ur);
86  G4ThreeVector u2(0.,1.,0.); u2.rotateUz(ur);
87  //
88  G4double psi = std::atan2(u2*um, u1*um);
89  if (psi < 0.) psi += twopi;
90  analysis->FillH1(5, psi);
91 
92  //particle direction: angl distr in master frame
93  //
94  G4double cosalphaM = um.z();
95  G4double psiM = um.phi(); if (psiM < 0.) psiM += twopi;
96  analysis->FillH1(6, cosalphaM);
97  analysis->FillH1(7, psiM);
98 }
99 
100 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
101 
103 { }
104 
105 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
106 
const G4ThreeVector & GetVertexPosition() const
double z() const
static constexpr double um
Definition: G4SIunits.hh:113
void PostUserTrackingAction(const G4Track *)
double G4double
Definition: G4Types.hh:76
static constexpr double twopi
Definition: G4SIunits.hh:76
G4CsvAnalysisManager G4AnalysisManager
Definition: g4csv_defs.hh:77
double mag() const
const G4ThreeVector & GetMomentumDirection() const
void PreUserTrackingAction(const G4Track *)