Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MicrobeamRunAction.cc
Go to the documentation of this file.
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$
28 // -------------------------------------------------------------------
29 
30 #include "G4UImanager.hh"
31 #include "Randomize.hh"
32 
33 #include "MicrobeamRunAction.hh"
34 
35 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
36 
39 :Detector(det),Histo(his)
40 {
41  saveRndm = 0;
42 }
43 
44 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
45 
47 {
48  delete[] dose3DDose;
49  delete[] mapVoxels;
50 }
51 
52 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
53 
55 {
56 
57  // Histograms
58  Histo->book();
59 
60  // save Rndm status
61  if (saveRndm > 0)
62  {
64  CLHEP::HepRandom::saveEngineStatus("beginOfRun.rndm");
65  }
66 
67  numEvent = 0;
68  nbOfHitsGas = 0;
69 
70  // ABSORBED DOSES INITIALIZATION
71  DoseN = 0;
72  DoseC = 0;
73 
74  massCytoplasm = Detector->GetMassCytoplasm();
75  massNucleus = Detector->GetMassNucleus();
76  nbOfPixels = Detector->GetNbOfPixelsInPhantom();
77 
78  mapVoxels = new G4ThreeVector[nbOfPixels];
79  dose3DDose = new G4float[nbOfPixels];
80 
81  for (G4int i=0; i<nbOfPixels; i++)
82  {
83  mapVoxels [i]=myMicrobeamPhantomConfiguration.GetVoxelThreeVector(i);
84  dose3DDose[i]=0;
85  G4ThreeVector v=mapVoxels[i];
86  }
87 
88 }
89 
90 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
91 
93 {
94  // save Rndm status
95  if (saveRndm == 1)
96  {
98  CLHEP::HepRandom::saveEngineStatus("endOfRun.rndm");
99  }
100 
101  for (G4int i=0; i<nbOfPixels; i++)
102  {
104  v = mapVoxels[i];
105  if ( (GetNumEvent()+1) !=0)
106  {
107  Histo->FillNtuple(4,0,v.x());
108  Histo->FillNtuple(4,1,v.y());
109  Histo->FillNtuple(4,2,v.z());
110  Histo->FillNtuple(4,3,dose3DDose[i]/(GetNumEvent()+1));
111  Histo->AddRowNtuple(4);
112  }
113  }
114 
115  G4cout << "-> Total number of particles detected by the gas detector : " << GetNbOfHitsGas() << G4endl;
116  G4cout << G4endl;
117 
118  //save histograms
119  Histo->save();
120 
121 }