Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
extended/electromagnetic/TestEm18/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 105927 2017-08-29 13:25:29Z gcosmo $
30 //
31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
33 
34 #include "SteppingAction.hh"
35 
36 #include "RunAction.hh"
37 #include "EventAction.hh"
38 #include "HistoManager.hh"
39 
40 #include "G4Step.hh"
41 #include "G4ParticleTypes.hh"
42 
43 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
44 
46 :G4UserSteppingAction(),fRunaction(RA), fEventaction(EA)
47 { }
48 
49 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
50 
52 { }
53 
54 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
55 
57 {
58  // energy continuously deposited along trajectory
59  //
60  G4int trackID = step->GetTrack()->GetTrackID();
61  G4double Edep = step->GetTotalEnergyDeposit();
62  if (Edep > 0.) fEventaction->SumEnergyDeposited(trackID, Edep);
63 
64  // the rest for primary track only
65  if (trackID > 1) return;
66 
67  // count processes
68  //
69  const G4StepPoint* endPoint = step->GetPostStepPoint();
70  const G4VProcess* process = endPoint->GetProcessDefinedStep();
71  G4String procName = process->GetProcessName();
72  G4int subtype = process-> GetProcessSubType();
74  if ((subtype == 2)&&(nbsec == 0)) procName = "Edep alone";
75  fRunaction->CountProcesses(procName);
76 
77  // step size and track length
78  //
79  G4double stepSize = step->GetStepLength();
80  fRunaction->TrackLength(stepSize);
81  G4AnalysisManager::Instance()->FillH1(1,stepSize);
82 
83  if (nbsec == 0) return; // no secondary particles
84 
85  // energy transfered to secondary particles
86  //
87  const std::vector<const G4Track*>* secondaries
88  = step->GetSecondaryInCurrentStep();
89  G4double Etransfer = 0.;
90  for (G4int itr=0; itr<nbsec; itr++) {
91  const G4Track* trk = (*secondaries)[itr];
92  const G4ParticleDefinition* particle = trk->GetParticleDefinition();
93  G4String name = particle->GetParticleName();
96  G4int ih = 0;
97  if (particle == G4Gamma::Gamma()) ih = 11;
98  else if (particle == G4Electron::Electron()) ih = 12;
99  else if (particle == G4Positron::Positron()) ih = 13;
100  if (ih > 0) G4AnalysisManager::Instance()->FillH1(ih,energy);
101  if (subtype == 4) energy = trk->GetTotalEnergy(); //(e+,e-) production
102  Etransfer += energy;
103  }
104  fEventaction->SumEnergyTransfered(process, Etransfer);
105 }
106 
107 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
108 
G4double GetKineticEnergy() const
const XML_Char * name
Definition: expat.h:151
const std::vector< const G4Track * > * GetSecondaryInCurrentStep() const
Definition: G4Step.cc:193
const G4String & GetParticleName() const
G4int GetTrackID() const
const G4ParticleDefinition * GetParticleDefinition() const
static G4Gamma * Gamma()
Definition: G4Gamma.cc:86
double G4double
Definition: G4Types.hh:76
G4double GetStepLength() const
G4int GetNumberOfSecondariesInCurrentStep() const
double energy
Definition: plottest35.C:25
G4Track * GetTrack() const
const G4String & GetProcessName() const
Definition: G4VProcess.hh:411
G4double GetTotalEnergyDeposit() const
static G4Positron * Positron()
Definition: G4Positron.cc:94
Definition: G4Step.hh:76
G4StepPoint * GetPostStepPoint() const
void UserSteppingAction(const G4Step *)
static G4Electron * Electron()
Definition: G4Electron.cc:94
void SumEnergyTransfered(const G4VProcess *, G4double)
int G4int
Definition: G4Types.hh:78
void SumEnergyDeposited(G4int trackID, G4double edep)
const G4VProcess * GetProcessDefinedStep() const
void EnergySpectrumOfSecondaries(G4String particleName, G4double ekin)
G4double GetTotalEnergy() const