source: trunk/examples/extended/parallel/MPI/exMPI02/src/VoxelSD.cc @ 807

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

update

File size: 3.6 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// $Id: VoxelSD.cc,v 1.1 2007/11/16 14:29:33 kmura Exp $
27// $Name:  $
28//
29// ====================================================================
30//   VoxelSD.cc
31//
32//                                         2007 Q
33// ====================================================================
34#include "VoxelSD.hh"
35#include "G4SDManager.hh"
36#include "G4Track.hh"
37#include "G4Step.hh"
38#include "G4VTouchable.hh"
39#include "G4TouchableHistory.hh"
40#include "Randomize.hh"
41#include "G4MPImanager.hh"
42#include "Analysis.hh"
43
44// ====================================================================
45//
46// class description
47//
48// ====================================================================
49
50//////////////////////////////////////
51VoxelSD::VoxelSD(const G4String& name)
52  : G4VSensitiveDetector(name)
53//////////////////////////////////////
54{
55  G4SDManager::GetSDMpointer()-> AddNewDetector(this);
56}
57
58
59///////////////////
60VoxelSD::~VoxelSD()
61///////////////////
62{
63}
64
65///////////////////////////////////////////////////////////////
66G4bool VoxelSD::ProcessHits(G4Step* astep, G4TouchableHistory*)
67///////////////////////////////////////////////////////////////
68{
69  G4ThreeVector x0= astep-> GetPreStepPoint()-> GetPosition();
70  G4ThreeVector x1= astep-> GetPostStepPoint()-> GetPosition();
71 
72  G4int tid= astep-> GetTrack()-> GetTrackID();
73  G4int iz= astep-> GetPreStepPoint()-> GetTouchable()-> GetReplicaNumber(1);
74
75  Analysis* myana= Analysis::GetAnalysis();
76
77  // incident position
78  if (tid==1 && iz==1000) { // scored @ first layer
79    myana-> FillIncident(x0);
80  }
81 
82  // energy deposit
83  G4ThreeVector p= G4UniformRand()*(x1-x0) + x0;   // position sampling
84  G4double edep= astep-> GetTotalEnergyDeposit();
85  myana-> FillDose(p, edep); 
86
87  return true;
88}
89
90
91////////////////////////////////////////////
92void VoxelSD::Initialize(G4HCofThisEvent*)
93////////////////////////////////////////////
94{
95}
96
97
98////////////////////////////////////////////
99void VoxelSD::EndOfEvent(G4HCofThisEvent*)
100////////////////////////////////////////////
101{
102}
103
Note: See TracBrowser for help on using the repository browser.