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 | // |
---|
27 | // $Id: RE02RunAction.cc,v 1.3 2006/11/18 01:37:24 asaim Exp $ |
---|
28 | // GEANT4 tag $Name: geant4-09-03-cand-01 $ |
---|
29 | // |
---|
30 | #include "RE02RunAction.hh" |
---|
31 | #include "RE02Run.hh" |
---|
32 | |
---|
33 | //-- In order to obtain detector information. |
---|
34 | #include "G4RunManager.hh" |
---|
35 | #include "RE02DetectorConstruction.hh" |
---|
36 | #include "G4THitsMap.hh" |
---|
37 | |
---|
38 | #include "G4UnitsTable.hh" |
---|
39 | //======================================================================= |
---|
40 | // RE02RunAction |
---|
41 | // |
---|
42 | // |
---|
43 | // |
---|
44 | //======================================================================= |
---|
45 | // Constructor |
---|
46 | RE02RunAction::RE02RunAction() |
---|
47 | { |
---|
48 | // - Prepare data member for RE02Run. |
---|
49 | // vector represents a list of MultiFunctionalDetector names. |
---|
50 | theSDName.push_back(G4String("PhantomSD")); |
---|
51 | } |
---|
52 | |
---|
53 | // Destructor. |
---|
54 | RE02RunAction::~RE02RunAction() |
---|
55 | { |
---|
56 | theSDName.clear(); |
---|
57 | } |
---|
58 | |
---|
59 | // |
---|
60 | //== |
---|
61 | G4Run* RE02RunAction::GenerateRun() |
---|
62 | { |
---|
63 | // Generate new RUN object, which is specially |
---|
64 | // dedicated for MultiFunctionalDetector scheme. |
---|
65 | // Detail description can be found in RE02Run.hh/cc. |
---|
66 | return new RE02Run(theSDName); |
---|
67 | } |
---|
68 | |
---|
69 | // |
---|
70 | //== |
---|
71 | void RE02RunAction::BeginOfRunAction(const G4Run* aRun) |
---|
72 | { |
---|
73 | G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl; |
---|
74 | } |
---|
75 | |
---|
76 | // |
---|
77 | //== |
---|
78 | void RE02RunAction::EndOfRunAction(const G4Run* aRun) |
---|
79 | { |
---|
80 | //- RE02Run object. |
---|
81 | RE02Run* re02Run = (RE02Run*)aRun; |
---|
82 | //--- Dump all socred quantities involved in RE02Run. |
---|
83 | // re02Run->DumpAllScorer(); |
---|
84 | //--- |
---|
85 | |
---|
86 | // |
---|
87 | //- water phantom (Detector) Information. |
---|
88 | //-- Number of segments in the water phantom. |
---|
89 | const RE02DetectorConstruction* detector = |
---|
90 | (const RE02DetectorConstruction*) |
---|
91 | (G4RunManager::GetRunManager()->GetUserDetectorConstruction()); |
---|
92 | detector->GetNumberOfSegmentsInPhantom(fNx,fNy,fNz); //Fill fNx,y,z. |
---|
93 | |
---|
94 | |
---|
95 | //--------------------------------------------- |
---|
96 | // Dump accumulated quantities for this RUN. |
---|
97 | // (Display only central region of x-y plane) |
---|
98 | //--------------------------------------------- |
---|
99 | G4THitsMap<G4double>* totEdep = re02Run->GetHitsMap("PhantomSD/totalEDep"); |
---|
100 | G4THitsMap<G4double>* proEdep = re02Run->GetHitsMap("PhantomSD/protonEDep"); |
---|
101 | G4THitsMap<G4double>* proNstep= re02Run->GetHitsMap("PhantomSD/protonNStep"); |
---|
102 | G4THitsMap<G4double>* passCFx = re02Run->GetHitsMap("PhantomSD/chargedPassCellFlux"); |
---|
103 | G4THitsMap<G4double>* CFx = re02Run->GetHitsMap("PhantomSD/chargedCellFlux"); |
---|
104 | G4THitsMap<G4double>* surfFx = re02Run->GetHitsMap("PhantomSD/chargedSurfFlux"); |
---|
105 | G4THitsMap<G4double>* gCurr00 = re02Run->GetHitsMap("PhantomSD/gammaSurfCurr000"); |
---|
106 | G4THitsMap<G4double>* gCurr01 = re02Run->GetHitsMap("PhantomSD/gammaSurfCurr001"); |
---|
107 | G4THitsMap<G4double>* gCurr02 = re02Run->GetHitsMap("PhantomSD/gammaSurfCurr002"); |
---|
108 | G4THitsMap<G4double>* gCurr03 = re02Run->GetHitsMap("PhantomSD/gammaSurfCurr003"); |
---|
109 | |
---|
110 | G4cout << "=============================================================" <<G4endl; |
---|
111 | G4cout << " Number of event processed : "<< aRun->GetNumberOfEvent() << G4endl; |
---|
112 | G4cout << "=============================================================" <<G4endl; |
---|
113 | G4cout << std::setw( 8) << "#Z Cell#" |
---|
114 | << std::setw(16) << totEdep->GetName() |
---|
115 | << std::setw(16) << proEdep->GetName() |
---|
116 | << std::setw(12) << proNstep->GetName() |
---|
117 | << std::setw(21) << passCFx->GetName() |
---|
118 | << std::setw(20) << CFx->GetName() |
---|
119 | << std::setw(20) << surfFx->GetName() |
---|
120 | << std::setw(20) << gCurr00->GetName() |
---|
121 | << std::setw(20) << gCurr01->GetName() |
---|
122 | << std::setw(20) << gCurr02->GetName() |
---|
123 | << std::setw(20) << gCurr03->GetName() |
---|
124 | << G4endl; |
---|
125 | G4int ix = fNx/2; |
---|
126 | G4int iy = fNy/2; |
---|
127 | G4int iz; |
---|
128 | //G4double totE, proE, proN,pasCF,CF,surfF,gCr0,gCr1,gCr2,gCr3; |
---|
129 | for ( iz = 0; iz < fNz; iz++){ |
---|
130 | G4double* totED = (*totEdep)[CopyNo(ix,iy,iz)]; |
---|
131 | G4double* proED = (*proEdep)[CopyNo(ix,iy,iz)]; |
---|
132 | G4double* proNS = (*proNstep)[CopyNo(ix,iy,iz)]; |
---|
133 | G4double* pasCF = (*passCFx)[CopyNo(ix,iy,iz)]; |
---|
134 | G4double* CF = (*CFx)[CopyNo(ix,iy,iz)]; |
---|
135 | G4double* sfx = (*surfFx)[CopyNo(ix,iy,iz)]; |
---|
136 | G4double* gcur0 = (*gCurr00)[CopyNo(ix,iy,iz)]; |
---|
137 | G4double* gcur1 = (*gCurr01)[CopyNo(ix,iy,iz)]; |
---|
138 | G4double* gcur2 = (*gCurr02)[CopyNo(ix,iy,iz)]; |
---|
139 | G4double* gcur3 = (*gCurr03)[CopyNo(ix,iy,iz)]; |
---|
140 | if ( !totED ) totED = new G4double(0.0); |
---|
141 | if ( !proED ) proED = new G4double(0.0); |
---|
142 | if ( !proNS ) proNS = new G4double(0.0); |
---|
143 | if ( !pasCF ) pasCF = new G4double(0.0); |
---|
144 | if ( !CF ) CF = new G4double(0.0); |
---|
145 | if ( !sfx ) sfx = new G4double(0.0); |
---|
146 | if ( !gcur0 ) gcur0 = new G4double(0.0); |
---|
147 | if ( !gcur1 ) gcur1 = new G4double(0.0); |
---|
148 | if ( !gcur2 ) gcur2 = new G4double(0.0); |
---|
149 | if ( !gcur3 ) gcur3 = new G4double(0.0); |
---|
150 | G4cout << std::setw( 6) << iz << " " |
---|
151 | << std::setw(12) << G4BestUnit(*totED,"Energy") |
---|
152 | << std::setw(12) << G4BestUnit(*proED,"Energy") |
---|
153 | << std::setw(12) << (*proNS) << " " |
---|
154 | << std::setw(13) << (*pasCF)*cm*cm <<" /cm2" |
---|
155 | << std::setw(15) << (*CF)*cm*cm <<" /cm2" |
---|
156 | << std::setw(15) << (*sfx)*cm*cm <<" /cm2" |
---|
157 | << std::setw(15) << (*gcur0)*cm*cm <<" /cm2" |
---|
158 | << std::setw(15) << (*gcur1)*cm*cm <<" /cm2" |
---|
159 | << std::setw(15) << (*gcur2)*cm*cm <<" /cm2" |
---|
160 | << std::setw(15) << (*gcur3)*cm*cm <<" /cm2" |
---|
161 | << G4endl; |
---|
162 | } |
---|
163 | G4cout << "============================================="<<G4endl; |
---|
164 | |
---|
165 | } |
---|
166 | // |
---|
167 | // -- |
---|