Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
extended/electromagnetic/TestEm16/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 84365 2014-10-14 12:43:52Z gcosmo $
30 //
31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
33 
34 #include "SteppingAction.hh"
35 #include "Run.hh"
36 
37 #include "G4RunManager.hh"
38 #include "G4SteppingManager.hh"
39 #include "G4VProcess.hh"
40 #include "G4ParticleTypes.hh"
41 #include "G4UnitsTable.hh"
42 #include "HistoManager.hh"
43 #include "G4EmProcessSubType.hh"
44 #include "G4SystemOfUnits.hh"
45 
46 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
47 
50 { }
51 
52 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
53 
55 { }
56 
57 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
58 
60 {
61  Run* run = static_cast<Run*>(
63 
64  const G4VProcess* process = aStep->GetPostStepPoint()->GetProcessDefinedStep();
65  if (process == 0) { return; }
66 
67  static G4int iCalled=0;
68  const G4int nprint=0; // set to 10 to get debug print for first 10 calls
69 
70  if (fSynchrotronRadiation == process->GetProcessSubType())
71  {
72  ++iCalled;
73  const G4StepPoint* PrePoint = aStep->GetPreStepPoint();
74  const G4TrackVector* secondary = fpSteppingManager->GetSecondary();
75 
76  //(*secondary)[lp-1] points to the last photon generated
77  //
78  size_t lp=(*secondary).size();
79  if (lp)
80  {
81  G4double Egamma = (*secondary)[lp-1]->GetTotalEnergy();
82  run->f_n_gam_sync++;
83  run->f_e_gam_sync += Egamma;
84  run->f_e_gam_sync2 += Egamma*Egamma;
85  if (Egamma > run->f_e_gam_sync_max)
86  {
87  run->f_e_gam_sync_max = Egamma;
88  }
89  run->f_lam_gam_sync += aStep->GetStepLength();
90  if (iCalled<nprint)
91  {
92  G4double Eelec = PrePoint->GetTotalEnergy();
93  G4ThreeVector Pelec = PrePoint->GetMomentum();
94  G4ThreeVector PGamma = (*secondary)[lp-1]->GetMomentum();
95  G4bool IsGamma =
96  ((*secondary)[lp-1]->GetDefinition() == G4Gamma::Gamma());
97 
98  G4cout << "UserSteppingAction processName="
99  << process->GetProcessName()
100  << " Step Length=" << std::setw(6)
101  << G4BestUnit(aStep->GetStepLength(),"Length")
102  << " Eelec=" << G4BestUnit(Eelec,"Energy")
103  << " Pelec=" << G4BestUnit(Pelec,"Energy")
104  << " IsGamma=" << IsGamma
105  << " Egamma=" << G4BestUnit(Egamma,"Energy")
106  << " PGamma=" << G4BestUnit(PGamma,"Energy")
107  << " #secondaries lp=" << lp
108  << '\n';
109  }
110 
111  G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
112  analysisManager->FillH1(1,Egamma);
113 
114  // power spectrum : gamma weighted with its energy
115  analysisManager->FillH1(2,Egamma,Egamma/keV);
116 
117  analysisManager->FillH1(3,aStep->GetStepLength());
118  }
119  }
120 }
121 
122 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double GetTotalEnergy() const
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:80
G4StepPoint * GetPreStepPoint() const
static constexpr double keV
Definition: G4SIunits.hh:216
static G4Gamma * Gamma()
Definition: G4Gamma.cc:86
double G4double
Definition: G4Types.hh:76
bool G4bool
Definition: G4Types.hh:79
G4double GetStepLength() const
const G4TrackVector * GetSecondary() const
const G4String & GetProcessName() const
Definition: G4VProcess.hh:411
G4CsvAnalysisManager G4AnalysisManager
Definition: g4csv_defs.hh:77
Definition: G4Step.hh:76
G4StepPoint * GetPostStepPoint() const
void UserSteppingAction(const G4Step *)
G4Run * GetNonConstCurrentRun() const
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
int G4int
Definition: G4Types.hh:78
G4SteppingManager * fpSteppingManager
std::vector< G4Track * > G4TrackVector
G4GLOB_DLL std::ostream G4cout
G4ThreeVector GetMomentum() const
const G4VProcess * GetProcessDefinedStep() const
G4int GetProcessSubType() const
Definition: G4VProcess.hh:429