Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
B4bEventAction.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 //
26 // $Id: B4bEventAction.cc 100946 2016-11-03 11:28:08Z gcosmo $
27 //
30 
31 #include "B4bEventAction.hh"
32 #include "B4bRunData.hh"
33 
34 #include "G4RunManager.hh"
35 #include "G4Event.hh"
36 #include "G4UnitsTable.hh"
37 
38 #include "Randomize.hh"
39 #include <iomanip>
40 
41 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
42 
45 {}
46 
47 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
48 
50 {}
51 
52 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
53 
55  G4double absoEdep, G4double absoTrackLength,
56  G4double gapEdep, G4double gapTrackLength) const
57 {
58  // print event statistics
59  G4cout
60  << " Absorber: total energy: "
61  << std::setw(7) << G4BestUnit(absoEdep, "Energy")
62  << " total track length: "
63  << std::setw(7) << G4BestUnit(absoTrackLength, "Length")
64  << G4endl
65  << " Gap: total energy: "
66  << std::setw(7) << G4BestUnit(gapEdep, "Energy")
67  << " total track length: "
68  << std::setw(7) << G4BestUnit(gapTrackLength, "Length")
69  << G4endl;
70 }
71 
72 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
73 
75 {
76  auto runData
77  = static_cast<B4bRunData*>(
79  runData->Reset();
80 }
81 
82 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
83 
85 {
86  auto runData
87  = static_cast<B4bRunData*>(
89  runData->FillPerEvent();
90 
91  //print per event (modulo n)
92  //
93  auto eventID = event->GetEventID();
94  auto printModulo = G4RunManager::GetRunManager()->GetPrintProgress();
95  if ( ( printModulo > 0 ) && ( eventID % printModulo == 0 ) ) {
96  G4cout << "---> End of event: " << eventID << G4endl;
97 
99  runData->GetEdep(kAbs),
100  runData->GetTrackLength(kAbs),
101  runData->GetEdep(kGap),
102  runData->GetTrackLength(kGap));
103  }
104 }
105 
106 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:80
const G4int kGap
Definition: B4bRunData.hh:42
virtual void EndOfEventAction(const G4Event *event)
#define G4endl
Definition: G4ios.hh:61
virtual void BeginOfEventAction(const G4Event *event)
const G4int kAbs
Definition: B4bRunData.hh:41
double G4double
Definition: G4Types.hh:76
void PrintEventStatistics(G4double absoEdep, G4double absoTrackLength, G4double gapEdep, G4double gapTrackLength) const
Definition of the B4bRunData class.
Definition of the B4bEventAction class.
G4Run * GetNonConstCurrentRun() const
G4int GetPrintProgress()
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
virtual ~B4bEventAction()
void FillPerEvent()
G4GLOB_DLL std::ostream G4cout
void Reset()