Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RMC01SD.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 //
28 //
29 // $Id$
30 //
32 // Class Name: RMC01SD
33 // Author: L. Desorgher
34 // Organisation: SpaceIT GmbH
35 // Contract: ESA contract 21435/08/NL/AT
36 // Customer: ESA/ESTEC
38 
39 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
40 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
41 
42 #include "RMC01SD.hh"
43 #include "G4Step.hh"
44 #include "G4HCofThisEvent.hh"
45 #include "G4Track.hh"
46 #include "G4SDManager.hh"
47 #include "G4ios.hh"
48 #include "G4ParticleDefinition.hh"
49 #include "G4VProcess.hh"
50 #include "G4LogicalVolumeStore.hh"
51 #include "G4LogicalVolume.hh"
52 #include "G4PhysicalVolumeStore.hh"
53 #include "G4VPhysicalVolume.hh"
54 
55 
56 //#include "G4AdjointAnalysisManager.hh"
57 #include "G4THitsCollection.hh"
58 #include "G4RunManager.hh"
59 #include "G4Electron.hh"
60 #include "G4Gamma.hh"
61 #include "G4Proton.hh"
62 
63 class G4Step;
64 
65 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
66 
69  fTotalEventEdep(0.),fEventEdepCollection(0),
70  fProtonCurrentCollection(0),fGammaCurrentCollection(0),
71  fElectronCurrentCollection(0)
72 {
73  collectionName.insert("edep");
74  collectionName.insert("current_electron");
75  collectionName.insert("current_proton");
76  collectionName.insert("current_gamma");
77 }
78 
79 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
80 
82 {;
83 }
84 
85 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
86 
88 {
89  fTotalEventEdep=0.;
90  static G4int HCID = -1;
91 
92  fEventEdepCollection = new G4THitsCollection<RMC01DoubleWithWeightHit>
94  HCID = GetCollectionID(0);
95  HCE->AddHitsCollection(HCID,fEventEdepCollection);
96 
97  fElectronCurrentCollection = new G4THitsCollection<RMC01DoubleWithWeightHit>
99  HCID = GetCollectionID(1);
100  HCE->AddHitsCollection(HCID,fElectronCurrentCollection);
101 
102  fProtonCurrentCollection = new G4THitsCollection<RMC01DoubleWithWeightHit>
104  HCID = GetCollectionID(2);
105  HCE->AddHitsCollection(HCID,fProtonCurrentCollection);
106 
107  fGammaCurrentCollection = new G4THitsCollection<RMC01DoubleWithWeightHit>
109  HCID = GetCollectionID(3);
110  HCE->AddHitsCollection(HCID,fGammaCurrentCollection);
111 }
112 
113 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
114 
116 {
117  G4double weight =aStep->GetTrack()->GetWeight();
119  if (edep >0) fEventEdepCollection->insert(
120  new RMC01DoubleWithWeightHit(edep,weight));
121 
122  G4StepPoint* preStepPoint =aStep->GetPreStepPoint();
123 
124  if (preStepPoint->GetStepStatus() == fGeomBoundary ){
125  // Entering the sensitive volume
126  weight=preStepPoint->GetWeight();
127  G4double eKin = preStepPoint->GetKineticEnergy();
128  G4ParticleDefinition* thePartDef = aStep->GetTrack()->GetDefinition();
129  if (thePartDef == G4Electron::Electron()) fElectronCurrentCollection->
130  insert(new RMC01DoubleWithWeightHit(eKin,weight));
131  else if (thePartDef == G4Gamma::Gamma()) fGammaCurrentCollection->
132  insert(new RMC01DoubleWithWeightHit(eKin,weight));
133  else if (thePartDef == G4Proton::Proton()) fProtonCurrentCollection->
134  insert(new RMC01DoubleWithWeightHit(eKin,weight));
135  }
136  return true;
137 }
138 
139 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
140 
142 {
143  fEventEdepCollection->insert(new RMC01DoubleWithWeightHit(fTotalEventEdep,1.));
144 }
145 
146 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
147 
149 {;
150 }
151 
152 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
153 
155 {;
156 }
157 
158 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
159 
161 {;
162 }
163 
164 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
165 
166