Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
RE02RunAction Class Reference

#include <RE02RunAction.hh>

Inheritance diagram for RE02RunAction:
G4UserRunAction

Public Member Functions

 RE02RunAction ()
 
virtual ~RE02RunAction ()
 
virtual G4RunGenerateRun ()
 
virtual void BeginOfRunAction (const G4Run *)
 
virtual void EndOfRunAction (const G4Run *)
 
G4int CopyNo (G4int ix, G4int iy, G4int iz)
 
- Public Member Functions inherited from G4UserRunAction
 G4UserRunAction ()
 
virtual ~G4UserRunAction ()
 
void SetMaster (G4bool val=true)
 
G4bool IsMaster () const
 

Additional Inherited Members

- Protected Attributes inherited from G4UserRunAction
G4bool isMaster
 

Detailed Description

User run action class

Definition at line 69 of file RE02RunAction.hh.

Constructor & Destructor Documentation

RE02RunAction::RE02RunAction ( )

Definition at line 53 of file RE02RunAction.cc.

54  : G4UserRunAction(),
55  fNx(0), fNy(0), fNz(0)
56 {
57  // - Prepare data member for RE02Run.
58  // vector represents a list of MultiFunctionalDetector names.
59  fSDName.push_back(G4String("PhantomSD"));
60 }
RE02RunAction::~RE02RunAction ( )
virtual

Definition at line 64 of file RE02RunAction.cc.

65 {
66  fSDName.clear();
67 }

Member Function Documentation

void RE02RunAction::BeginOfRunAction ( const G4Run aRun)
virtual

Reimplemented from G4UserRunAction.

Definition at line 81 of file RE02RunAction.cc.

References G4cout, G4endl, and G4Run::GetRunID().

82 {
83  G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;
84 }
G4GLOB_DLL std::ostream G4cout
G4int GetRunID() const
Definition: G4Run.hh:76
#define G4endl
Definition: G4ios.hh:61
G4int RE02RunAction::CopyNo ( G4int  ix,
G4int  iy,
G4int  iz 
)
inline

Definition at line 85 of file RE02RunAction.hh.

Referenced by EndOfRunAction().

86  { return (iy*(fNx*fNz)+ix*fNz+iz); }
G4double iz
Definition: TRTMaterials.hh:39
void RE02RunAction::EndOfRunAction ( const G4Run aRun)
virtual

Reimplemented from G4UserRunAction.

Definition at line 88 of file RE02RunAction.cc.

References python.hepunit::cm, CopyNo(), RE02Run::DumpAllScorer(), G4BestUnit, G4cout, G4endl, RE02Run::GetHitsMap(), G4VHitsCollection::GetName(), G4Run::GetNumberOfEvent(), RE02DetectorConstruction::GetNumberOfSegmentsInPhantom(), G4RunManager::GetRunManager(), G4RunManager::GetUserDetectorConstruction(), G4UserRunAction::IsMaster(), iz, and python.hepunit::MeV.

89 {
90  if(!IsMaster()) return;
91 
92  //- RE02Run object.
93  RE02Run* re02Run = (RE02Run*)aRun;
94  //--- Dump all socred quantities involved in RE02Run.
95  re02Run->DumpAllScorer();
96  //---
97 
98  //
99  //- water phantom (Detector) Information.
100  //-- Number of segments in the water phantom.
101  const RE02DetectorConstruction* detector =
102  (const RE02DetectorConstruction*)
104  detector->GetNumberOfSegmentsInPhantom(fNx,fNy,fNz); //Fill fNx,y,z.
105 
106  //---------------------------------------------
107  // Dump accumulated quantities for this RUN.
108  // (Display only central region of x-y plane)
109  //---------------------------------------------
110  G4THitsMap<G4double>* totEdep = re02Run->GetHitsMap("PhantomSD/totalEDep");
111  G4THitsMap<G4double>* proEdep = re02Run->GetHitsMap("PhantomSD/protonEDep");
112  G4THitsMap<G4double>* proNstep = re02Run->GetHitsMap("PhantomSD/protonNStep");
113  G4THitsMap<G4double>* passCFx =
114  re02Run->GetHitsMap("PhantomSD/chargedPassCellFlux");
115  G4THitsMap<G4double>* cFx =
116  re02Run->GetHitsMap("PhantomSD/chargedCellFlux");
117  G4THitsMap<G4double>* surfFx =
118  re02Run->GetHitsMap("PhantomSD/chargedSurfFlux");
119  G4THitsMap<G4double>* gCurr00 =
120  re02Run->GetHitsMap("PhantomSD/gammaSurfCurr000");
121  G4THitsMap<G4double>* gCurr01 =
122  re02Run->GetHitsMap("PhantomSD/gammaSurfCurr001");
123  G4THitsMap<G4double>* gCurr02 =
124  re02Run->GetHitsMap("PhantomSD/gammaSurfCurr002");
125  G4THitsMap<G4double>* gCurr03 =
126  re02Run->GetHitsMap("PhantomSD/gammaSurfCurr003");
127 
128  G4cout << "============================================================="
129  << G4endl;
130  G4cout << " Number of event processed : "<< aRun->GetNumberOfEvent() << G4endl;
131  G4cout << "============================================================="
132  << G4endl;
133  G4cout << std::setw( 8) << "#Z Cell#";
134  G4cout << std::setw(16) << totEdep->GetName();
135  G4cout << std::setw(16) << proEdep->GetName();
136  G4cout << std::setw(12) << proNstep->GetName();
137  G4cout << std::setw(21) << passCFx->GetName();
138  G4cout << std::setw(20) << cFx->GetName();
139  G4cout << std::setw(20) << surfFx->GetName();
140  G4cout << std::setw(20) << gCurr00->GetName();
141  G4cout << std::setw(20) << gCurr01->GetName();
142  G4cout << std::setw(20) << gCurr02->GetName();
143  G4cout << std::setw(20) << gCurr03->GetName()
144  << G4endl;
145  G4int ix = fNx/2;
146  G4int iy = fNy/2;
147  G4int iz;
148  //G4double totE, proE, proN,pasCF,CF,surfF,gCr0,gCr1,gCr2,gCr3;
149  for ( iz = 0; iz < fNz; iz++){
150  G4double* totED = (*totEdep)[CopyNo(ix,iy,iz)];
151  G4double* proED = (*proEdep)[CopyNo(ix,iy,iz)];
152  G4double* proNS = (*proNstep)[CopyNo(ix,iy,iz)];
153  G4double* pasCF = (*passCFx)[CopyNo(ix,iy,iz)];
154  G4double* cF = (*cFx)[CopyNo(ix,iy,iz)];
155  G4double* sfx = (*surfFx)[CopyNo(ix,iy,iz)];
156  G4double* gcur0 = (*gCurr00)[CopyNo(ix,iy,iz)];
157  G4double* gcur1 = (*gCurr01)[CopyNo(ix,iy,iz)];
158  G4double* gcur2 = (*gCurr02)[CopyNo(ix,iy,iz)];
159  G4double* gcur3 = (*gCurr03)[CopyNo(ix,iy,iz)];
160  if ( !totED ) totED = new G4double(0.0);
161  if ( !proED ) proED = new G4double(0.0);
162  if ( !proNS ) proNS = new G4double(0.0);
163  if ( !pasCF ) pasCF = new G4double(0.0);
164  if ( !cF ) cF = new G4double(0.0);
165  if ( !sfx ) sfx = new G4double(0.0);
166  if ( !gcur0 ) gcur0 = new G4double(0.0);
167  if ( !gcur1 ) gcur1 = new G4double(0.0);
168  if ( !gcur2 ) gcur2 = new G4double(0.0);
169  if ( !gcur3 ) gcur3 = new G4double(0.0);
170  G4cout << std::setw( 6) << iz << " "
171  << std::setw(12) << G4BestUnit(*totED,"Energy")
172  << std::setw(12) << G4BestUnit(*proED,"Energy")
173  << std::setw(12) << (*proNS) << " "
174  << std::setw(13) << (*pasCF)*cm*cm <<" /cm2"
175  << std::setw(15) << (*cF)*cm*cm <<" /cm2"
176  << std::setw(15) << (*sfx)*cm*cm <<" /cm2"
177  << std::setw(15) << (*gcur0)*cm*cm <<" /cm2"
178  << std::setw(15) << (*gcur1)*cm*cm <<" /cm2"
179  << std::setw(15) << (*gcur2)*cm*cm <<" /cm2"
180  << std::setw(15) << (*gcur3)*cm*cm <<" /cm2"
181  << G4endl;
182  }
183  G4cout << "============================================="<<G4endl;
184 
185  std::ofstream file("totED.txt");
186  for ( iz = 0; iz < fNz; iz++){
187  for ( iy = 0; iy < fNy; iy++){
188  for ( ix = 0; ix < fNx; ix++){
189  G4double* totED = (*totEdep)[CopyNo(ix,iy,iz)];
190  if ( !totED ) totED = new G4double(0.0);
191  file << ix << " "<<iy<<" "<<iz<<" "<< *totED/MeV << G4endl;
192 
193  }
194  }
195  }
196  file.close();
197 }
const G4VUserDetectorConstruction * GetUserDetectorConstruction() const
void GetNumberOfSegmentsInPhantom(G4int &nx, G4int &ny, G4int &nz) const
#define G4BestUnit(a, b)
#define G4_USE_G4BESTUNIT_FOR_VERBOSE 1
int G4int
Definition: G4Types.hh:78
G4int CopyNo(G4int ix, G4int iy, G4int iz)
G4GLOB_DLL std::ostream G4cout
G4int GetNumberOfEvent() const
Definition: G4Run.hh:79
G4double iz
Definition: TRTMaterials.hh:39
G4bool IsMaster() const
G4THitsMap< G4double > * GetHitsMap(G4int i)
Definition: RE02Run.hh:96
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:74
#define G4endl
Definition: G4ios.hh:61
void DumpAllScorer()
Definition: RE02Run.cc:216
double G4double
Definition: G4Types.hh:76
G4Run * RE02RunAction::GenerateRun ( void  )
virtual

Reimplemented from G4UserRunAction.

Definition at line 71 of file RE02RunAction.cc.

72 {
73  // Generate new RUN object, which is specially
74  // dedicated for MultiFunctionalDetector scheme.
75  // Detail description can be found in RE02Run.hh/cc.
76  return new RE02Run(fSDName);
77 }

The documentation for this class was generated from the following files: