source: trunk/examples/advanced/microbeam/src/MicrobeamRunAction.cc

Last change on this file was 1342, checked in by garnier, 15 years ago

update ti head

  • Property svn:executable set to *
File size: 4.1 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: MicrobeamRunAction.cc,v 1.7 2010/10/07 14:03:11 sincerti Exp $
28// -------------------------------------------------------------------
29
30#include "G4VVisManager.hh"
31#include "G4UImanager.hh"
32#include "Randomize.hh"
33
34#include "MicrobeamRunAction.hh"
35
36//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
37
38MicrobeamRunAction::MicrobeamRunAction(MicrobeamDetectorConstruction* det,
39MicrobeamHistoManager * his)
40:Detector(det),Histo(his)
41{
42 saveRndm = 0;
43}
44
45//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
46
47MicrobeamRunAction::~MicrobeamRunAction()
48{
49 delete[] dose3DDose;
50 delete[] mapVoxels;
51}
52
53//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
54
55void MicrobeamRunAction::BeginOfRunAction(const G4Run* /*aRun*/)
56{
57
58 // Histograms
59 Histo->book();
60
61 // save Rndm status
62 if (saveRndm > 0)
63 {
64 CLHEP::HepRandom::showEngineStatus();
65 CLHEP::HepRandom::saveEngineStatus("beginOfRun.rndm");
66 }
67
68 numEvent = 0;
69 nbOfHitsGas = 0;
70
71 // ABSORBED DOSES INITIALIZATION
72 DoseN = 0;
73 DoseC = 0;
74
75 massCytoplasm = Detector->GetMassCytoplasm();
76 massNucleus = Detector->GetMassNucleus();
77 nbOfPixels = Detector->GetNbOfPixelsInPhantom();
78
79 mapVoxels = new G4ThreeVector[nbOfPixels];
80 dose3DDose = new G4float[nbOfPixels];
81
82 for (G4int i=0; i<nbOfPixels; i++)
83 {
84 mapVoxels [i]=myMicrobeamPhantomConfiguration.GetVoxelThreeVector(i);
85 dose3DDose[i]=0;
86 G4ThreeVector v=mapVoxels[i];
87 }
88
89}
90
91//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
92
93void MicrobeamRunAction::EndOfRunAction(const G4Run* /*aRun*/)
94{
95 //drawing
96 if (G4VVisManager::GetConcreteInstance()) G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/update");
97
98 // save Rndm status
99 if (saveRndm == 1)
100 {
101 CLHEP::HepRandom::showEngineStatus();
102 CLHEP::HepRandom::saveEngineStatus("endOfRun.rndm");
103 }
104
105 for (G4int i=0; i<nbOfPixels; i++)
106 {
107 G4ThreeVector v;
108 v = mapVoxels[i];
109 if ( (GetNumEvent()+1) !=0)
110 {
111 Histo->FillNtuple(4,0,v.x());
112 Histo->FillNtuple(4,1,v.y());
113 Histo->FillNtuple(4,2,v.z());
114 Histo->FillNtuple(4,3,dose3DDose[i]/(GetNumEvent()+1));
115 Histo->AddRowNtuple(4);
116 }
117 }
118
119 G4cout << "-> Total number of particles detected by the gas detector : " << GetNbOfHitsGas() << G4endl;
120 G4cout << G4endl;
121
122 //save histograms
123 Histo->save();
124
125}
Note: See TracBrowser for help on using the repository browser.