Geant4  10.03.p03
 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: RMC01SD.cc 98774 2016-08-09 14:28:06Z gcosmo $
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 //#include "G4AdjointAnalysisManager.hh"
56 #include "G4THitsCollection.hh"
57 #include "G4RunManager.hh"
58 #include "G4Electron.hh"
59 #include "G4Gamma.hh"
60 #include "G4Proton.hh"
61 
62 class G4Step;
63 
64 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
65 
68  fTotalEventEdep(0.),fEventEdepCollection(0),
69  fProtonCurrentCollection(0),fGammaCurrentCollection(0),
70  fElectronCurrentCollection(0)
71 {
72  collectionName.insert("edep");
73  collectionName.insert("current_electron");
74  collectionName.insert("current_proton");
75  collectionName.insert("current_gamma");
76 }
77 
78 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
79 
81 {;
82 }
83 
84 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
85 
87 {
88  fTotalEventEdep=0.;
89  static G4int HCID = -1;
90 
91  fEventEdepCollection = new G4THitsCollection<RMC01DoubleWithWeightHit>
93  HCID = GetCollectionID(0);
94  HCE->AddHitsCollection(HCID,fEventEdepCollection);
95 
96  fElectronCurrentCollection = new G4THitsCollection<RMC01DoubleWithWeightHit>
98  HCID = GetCollectionID(1);
99  HCE->AddHitsCollection(HCID,fElectronCurrentCollection);
100 
101  fProtonCurrentCollection = new G4THitsCollection<RMC01DoubleWithWeightHit>
103  HCID = GetCollectionID(2);
104  HCE->AddHitsCollection(HCID,fProtonCurrentCollection);
105 
106  fGammaCurrentCollection = new G4THitsCollection<RMC01DoubleWithWeightHit>
108  HCID = GetCollectionID(3);
109  HCE->AddHitsCollection(HCID,fGammaCurrentCollection);
110 }
111 
112 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
113 
115 {
116  G4double weight =aStep->GetTrack()->GetWeight();
117  G4double edep= aStep->GetTotalEnergyDeposit();
118  if (edep >0) fEventEdepCollection->insert(
119  new RMC01DoubleWithWeightHit(edep,weight));
120 
121  G4StepPoint* preStepPoint =aStep->GetPreStepPoint();
122 
123  if (preStepPoint->GetStepStatus() == fGeomBoundary ){
124  // Entering the sensitive volume
125  weight=preStepPoint->GetWeight();
126  G4double eKin = preStepPoint->GetKineticEnergy();
127  G4ParticleDefinition* thePartDef = aStep->GetTrack()->GetDefinition();
128  if (thePartDef == G4Electron::Electron()) fElectronCurrentCollection->
129  insert(new RMC01DoubleWithWeightHit(eKin,weight));
130  else if (thePartDef == G4Gamma::Gamma()) fGammaCurrentCollection->
131  insert(new RMC01DoubleWithWeightHit(eKin,weight));
132  else if (thePartDef == G4Proton::Proton()) fProtonCurrentCollection->
133  insert(new RMC01DoubleWithWeightHit(eKin,weight));
134  }
135  return true;
136 }
137 
138 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
139 
141 {
142  fEventEdepCollection->insert(
143  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 
G4ParticleDefinition * GetDefinition() const
const XML_Char * name
Definition: expat.h:151
G4double GetWeight() const
virtual void PrintAll()
Definition: RMC01SD.cc:160
G4StepStatus GetStepStatus() const
G4int insert(T *aHit)
int G4int
Definition: G4Types.hh:78
virtual G4int GetCollectionID(G4int i)
virtual G4bool ProcessHits(G4Step *aStep, G4TouchableHistory *ROhist)
Definition: RMC01SD.cc:114
G4StepPoint * GetPreStepPoint() const
Definition of the RMC01SD class.
virtual void DrawAll()
Definition: RMC01SD.cc:154
bool G4bool
Definition: G4Types.hh:79
static G4Proton * Proton()
Definition: G4Proton.cc:93
Definition: G4Step.hh:76
static G4Gamma * Gamma()
Definition: G4Gamma.cc:86
G4double GetTotalEnergyDeposit() const
void AddHitsCollection(G4int HCID, G4VHitsCollection *aHC)
virtual ~RMC01SD()
Definition: RMC01SD.cc:80
virtual void Initialize(G4HCofThisEvent *HCE)
Definition: RMC01SD.cc:86
RMC01SD(G4String name)
Definition: RMC01SD.cc:66
G4double GetWeight() const
static G4Electron * Electron()
Definition: G4Electron.cc:94
G4CollectionNameVector collectionName
virtual void Clear()
Definition: RMC01SD.cc:148
G4double GetKineticEnergy() const
double G4double
Definition: G4Types.hh:76
G4Track * GetTrack() const
virtual void EndOfEvent(G4HCofThisEvent *HCE)
Definition: RMC01SD.cc:140