source: trunk/examples/novice/N07/src/ExN07RunAction.cc @ 1319

Last change on this file since 1319 was 1230, checked in by garnier, 14 years ago

update to geant4.9.3

File size: 6.0 KB
Line 
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: ExN07RunAction.cc,v 1.8 2007/05/12 20:02:58 asaim Exp $
28// GEANT4 tag $Name: geant4-09-03-cand-01 $
29//
30
31#include "ExN07RunAction.hh"
32#include "ExN07Run.hh"
33
34#include "G4RegionStore.hh"
35#include "G4Region.hh"
36#include "G4ProductionCuts.hh"
37#include "G4ios.hh"
38#include "G4UnitsTable.hh"
39
40#include "G4VSteppingVerbose.hh"
41#include "ExN07SteppingVerbose.hh"
42
43ExN07RunAction::ExN07RunAction()
44{;}
45
46ExN07RunAction::~ExN07RunAction()
47{;}
48
49G4Run* ExN07RunAction::GenerateRun()
50{ return new ExN07Run; }
51
52void ExN07RunAction::BeginOfRunAction(const G4Run*)
53{
54  ExN07SteppingVerbose* sv = (ExN07SteppingVerbose*)(G4VSteppingVerbose::GetInstance());
55  sv->InitializeTimers();
56}
57
58void ExN07RunAction::EndOfRunAction(const G4Run* aRun)
59{
60  static G4String regName[3] = {"Calor-A","Calor-B","Calor-C"};
61
62  const ExN07Run* theRun = (const ExN07Run*)aRun;
63 
64  G4cout
65    << "############################################################" << G4endl;
66  G4cout
67    << " Run Summary - Number of events : " << theRun->GetNumberOfEvent() 
68    << G4endl;
69  G4cout
70    << "############################################################" << G4endl;
71
72  G4double nEvt = (G4double)(theRun->GetNumberOfEvent());
73  for(size_t i=0;i<3;i++)
74  {
75    size_t ih1 = 2*i;
76    size_t ih2 = 2*i+1;
77
78    G4Region* region = G4RegionStore::GetInstance()->GetRegion(regName[i]);
79    G4ProductionCuts* cuts = region->GetProductionCuts();
80    G4cout << "Region : " << region->GetName() << G4endl;
81    G4cout << " Production thresholds :" << G4endl << "   "
82           << " gamma " << G4BestUnit(cuts->GetProductionCut("gamma"),"Length")
83           << "    e- " << G4BestUnit(cuts->GetProductionCut("e-"),"Length")
84           << "    e+ " << G4BestUnit(cuts->GetProductionCut("e+"),"Length")
85           << G4endl;
86    G4cout << " Energy deposition in an event :" << G4endl << "   "
87           << " Absorber " << G4BestUnit((theRun->GetTotalE(ih1))/nEvt,"Energy")
88           << "      Gap " << G4BestUnit((theRun->GetTotalE(ih2))/nEvt,"Energy")
89           << G4endl;
90    G4cout << " Number of secondaries in an event :" << G4endl << "   "
91           << " gamma in Absorber " << (theRun->GetNGamma(ih1))/nEvt
92           << "    in Gap " << (theRun->GetNGamma(ih2))/nEvt << G4endl << "   "
93           << " e-    in Absorber " << (theRun->GetNElectron(ih1))/nEvt
94           << "    in Gap " << (theRun->GetNElectron(ih2))/nEvt << G4endl << "   "
95           << " e+    in Absorber " << (theRun->GetNPositron(ih1))/nEvt
96           << "    in Gap " << (theRun->GetNPositron(ih2))/nEvt << G4endl;
97    G4cout << " Minimum kinetic energy of generated secondaries :" << G4endl << "   "
98           << " gamma in Absorber " << G4BestUnit(theRun->GetEMinGamma(ih1),"Energy")
99           << "    in Gap " << G4BestUnit(theRun->GetEMinGamma(ih2),"Energy")
100           << G4endl << "   "
101           << " e-    in Absorber " << G4BestUnit(theRun->GetEMinElectron(ih1),"Energy")
102           << "    in Gap " << G4BestUnit(theRun->GetEMinElectron(ih2),"Energy")
103           << G4endl << "   "
104           << " e+    in Absorber " << G4BestUnit(theRun->GetEMinPositron(ih1),"Energy")
105           << "    in Gap " << G4BestUnit(theRun->GetEMinPositron(ih2),"Energy")
106           << G4endl;
107    G4cout << " Total track length of e+/e- in an event :" << G4endl << "   "
108           << " Absorber " << G4BestUnit((theRun->GetTotalL(ih1))/nEvt,"Length")
109           << "      Gap " << G4BestUnit((theRun->GetTotalL(ih2))/nEvt,"Length")
110           << G4endl;
111    G4cout << " Total number of steps of e+/e- in an event :" << G4endl << "   "
112           << " Absorber " << (theRun->GetNStep(ih1))/nEvt
113           << "      Gap " << (theRun->GetNStep(ih2))/nEvt
114           << G4endl;
115    G4cout
116    << "------------------------------------------------------------" << G4endl;
117    G4cout << "Scores in parallel geometry" << G4endl;
118    G4cout << "layer   eDep/evt  nGamma/evt nElec/evt  nPosi/evt  stpLen/evt nStep/evt"
119           << G4endl;
120    for(size_t k=0;k<20;k++)
121    {
122      G4cout << std::setw(8) << k;
123      for(size_t j=0;j<6;j++)
124      { G4cout << " " << std::setw(10) << (theRun->GetParaValue(i,j,k))/nEvt; }
125      G4cout << G4endl;
126    }
127    G4cout
128    << "############################################################" << G4endl;
129  }
130  G4cout << "CPU Time spent by each region" << G4cout;
131  ExN07SteppingVerbose* sv = (ExN07SteppingVerbose*)(G4VSteppingVerbose::GetInstance());
132  sv->Report();
133}
134
Note: See TracBrowser for help on using the repository browser.