Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
extended/electromagnetic/TestEm18/src/EventAction.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: EventAction.cc 105927 2017-08-29 13:25:29Z gcosmo $
30 //
31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
33 
34 #include "EventAction.hh"
35 
36 #include "RunAction.hh"
37 #include "HistoManager.hh"
38 
39 #include "G4Event.hh"
40 
41 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
42 
44 :G4UserEventAction(),fRunAction(RA)
45 {}
46 
47 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
48 
50 {}
51 
52 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
53 
55 {
56  // initialisation per event
58 }
59 
60 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
61 
63 {
64  if (trackID == 1) fEdepPrimary += edep;
65  else fEdepSecondary += edep;
66 }
67 
68 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
69 
71 {
72  G4String procName = process->GetProcessName();
73  std::map<G4String,G4double>::iterator it = fEnergyTransfered.find(procName);
74  if ( it == fEnergyTransfered.end()) {
75  fEnergyTransfered[procName] = energy;
76  }
77  else {
78  fEnergyTransfered[procName] += energy;
79  }
80 
81  G4int subtype = process-> GetProcessSubType();
82  fProcessSubType[procName] = subtype;
83 }
84 
85 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
86 
88 {
89  G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
90 
91  G4double EtransferedTotal = 0.;
92  std::map<G4String,G4double>::iterator it;
93  for (it = fEnergyTransfered.begin(); it != fEnergyTransfered.end(); it++) {
94  G4String procName = it->first;
95  G4double energy = it->second;
96  fRunAction->EnergyTransferedByProcess(procName, energy);
97  EtransferedTotal += energy;
98  //
99  G4int ih = 0;
100  if(fProcessSubType[procName] == 2) ih = 3;
101  else if(fProcessSubType[procName] == 3) ih = 4;
102  else if(fProcessSubType[procName] == 4) ih = 5;
103  if (ih > 0) analysisManager->FillH1(ih, energy);
104  }
105 
107  if (EtransferedTotal > 0.) fRunAction->EnergyTransfered(EtransferedTotal);
108  G4double energyLostTotal = fEdepPrimary + EtransferedTotal;
109  fRunAction->TotalEnergyLost(energyLostTotal);
110  G4double energyDepositTotal = fEdepPrimary + fEdepSecondary;
111  fRunAction->TotalEnergyDeposit(energyDepositTotal);
112 
113 
114  analysisManager->FillH1( 2, fEdepPrimary);
115  analysisManager->FillH1( 6, EtransferedTotal);
116  analysisManager->FillH1( 7, energyLostTotal);
117  analysisManager->FillH1( 9, fEdepSecondary);
118  analysisManager->FillH1(10, energyDepositTotal);
119 
120  fEnergyTransfered.clear();
121  fProcessSubType.clear();
122 }
123 
124 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
125 
void EndOfEventAction(const G4Event *)
void EnergyTransferedByProcess(G4String procName, G4double energy)
void BeginOfEventAction(const G4Event *)
std::map< G4String, G4double > fEnergyTransfered
double G4double
Definition: G4Types.hh:76
double energy
Definition: plottest35.C:25
const G4String & GetProcessName() const
Definition: G4VProcess.hh:411
G4CsvAnalysisManager G4AnalysisManager
Definition: g4csv_defs.hh:77
Double_t edep
void SumEnergyTransfered(const G4VProcess *, G4double)
void EnergyDeposited(G4double edepPrim, G4double edepSecond)
int G4int
Definition: G4Types.hh:78
void SumEnergyDeposited(G4int trackID, G4double edep)
G4int first(char) const