source: trunk/examples/extended/parallel/ExDiane/src/BrachyPhantomSD.cc@ 1036

Last change on this file since 1036 was 807, checked in by garnier, 17 years ago

update

File size: 3.9 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// Code developed by: S.Guatelli
28//
29// ********************************
30// * *
31// * BrachyPhantomSD.cc *
32// * *
33// ********************************
34//
35// $Id: BrachyPhantomSD.cc,v 1.4 2006/06/29 17:33:27 gunter Exp $
36// GEANT4 tag $Name: $
37//
38#include "BrachyPhantomSD.hh"
39#include "BrachyPhantomHit.hh"
40#include "BrachyAnalysisManager.hh"
41#include "BrachyDetectorConstruction.hh"
42#include "G4Track.hh"
43#include "G4LogicalVolume.hh"
44#include "G4VPhysicalVolume.hh"
45#include "G4Step.hh"
46#include "G4VTouchable.hh"
47#include "G4TouchableHistory.hh"
48#include "G4SDManager.hh"
49#include "G4ParticleDefinition.hh"
50
51BrachyPhantomSD::BrachyPhantomSD(G4String name, G4int NumVoxelX, G4int NumVoxelZ)
52 :G4VSensitiveDetector(name),numberOfVoxelsX(NumVoxelX),
53 numberOfVoxelsZ(NumVoxelZ)
54{
55}
56
57BrachyPhantomSD::~BrachyPhantomSD()
58{
59}
60
61void BrachyPhantomSD::Initialize(G4HCofThisEvent*)
62{
63}
64
65G4bool BrachyPhantomSD::ProcessHits(G4Step* aStep, G4TouchableHistory* ROhist)
66{
67 if(!ROhist)
68 return false;
69
70 if(aStep->GetPreStepPoint()->GetPhysicalVolume()->GetName() != "PhantomPhys")
71 return false;
72
73 G4double energyDeposit = aStep -> GetTotalEnergyDeposit();
74 if(energyDeposit == 0.)
75 return false;
76
77 if(energyDeposit != 0)
78 {
79#ifdef G4ANALYSIS_USE
80 // Read Voxel indexes: i is the x index, k is the z index
81 G4int k = ROhist -> GetReplicaNumber(1);
82 G4int i = ROhist -> GetReplicaNumber(2);
83 G4int j = ROhist -> GetReplicaNumber();
84
85 G4int numberOfVoxelZ = 300;
86 G4double voxelWidthZ = 1. *mm;
87
88 G4double x = (- numberOfVoxelZ+1+2*i)*voxelWidthZ/2;
89 G4double y = (- numberOfVoxelZ+1+2*j)*voxelWidthZ/2;
90 G4double z = (- numberOfVoxelZ+1+2*k)*voxelWidthZ/2;
91
92 BrachyAnalysisManager* analysis =
93 BrachyAnalysisManager::getInstance();
94 if (y < 0.8*mm && y > -0.8*mm)
95 {
96 analysis -> FillHistogramWithEnergy(x,z,energyDeposit/MeV);
97
98 if (z < 0.8*mm && z > -0.8*mm)
99 analysis -> DoseDistribution(x,energyDeposit/MeV);
100 }
101#endif
102 }
103 return true;
104}
105
106void BrachyPhantomSD::EndOfEvent(G4HCofThisEvent*)
107{
108}
109
110void BrachyPhantomSD::clear()
111{
112}
113
114void BrachyPhantomSD::DrawAll()
115{
116}
117
118void BrachyPhantomSD::PrintAll()
119{
120}
121
122
123
Note: See TracBrowser for help on using the repository browser.