Geant4  10.00.p02
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 70966 2013-06-07 15:22:09Z 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 
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 
94  HCID = GetCollectionID(0);
96 
99  HCID = GetCollectionID(1);
101 
104  HCID = GetCollectionID(2);
106 
109  HCID = GetCollectionID(3);
111 }
112 
113 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
114 
116 {
117  G4double weight =aStep->GetTrack()->GetWeight();
118  G4double edep= aStep->GetTotalEnergyDeposit();
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 {
145 }
146 
147 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
148 
150 {;
151 }
152 
153 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
154 
156 {;
157 }
158 
159 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
160 
162 {;
163 }
164 
165 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
166 
167 
G4ParticleDefinition * GetDefinition() const
G4double GetWeight() const
virtual void PrintAll()
Definition: RMC01SD.cc:161
G4String name
Definition: TRTMaterials.hh:40
G4StepStatus GetStepStatus() const
RMC01DoubleWithWeightHitsCollection * fElectronCurrentCollection
Definition: RMC01SD.hh:83
G4int insert(T *aHit)
int G4int
Definition: G4Types.hh:78
G4double fTotalEventEdep
Definition: RMC01SD.hh:79
virtual G4int GetCollectionID(G4int i)
virtual G4bool ProcessHits(G4Step *aStep, G4TouchableHistory *ROhist)
Definition: RMC01SD.cc:115
G4StepPoint * GetPreStepPoint() const
Definition of the RMC01SD class.
virtual void DrawAll()
Definition: RMC01SD.cc:155
RMC01DoubleWithWeightHitsCollection * fEventEdepCollection
Definition: RMC01SD.hh:80
bool G4bool
Definition: G4Types.hh:79
static G4Proton * Proton()
Definition: G4Proton.cc:93
Definition: G4Step.hh:76
RMC01DoubleWithWeightHitsCollection * fProtonCurrentCollection
Definition: RMC01SD.hh:81
static G4Gamma * Gamma()
Definition: G4Gamma.cc:86
G4double GetTotalEnergyDeposit() const
void AddHitsCollection(G4int HCID, G4VHitsCollection *aHC)
virtual ~RMC01SD()
Definition: RMC01SD.cc:81
virtual void Initialize(G4HCofThisEvent *HCE)
Definition: RMC01SD.cc:87
RMC01SD(G4String name)
Definition: RMC01SD.cc:67
G4double GetWeight() const
static G4Electron * Electron()
Definition: G4Electron.cc:94
G4CollectionNameVector collectionName
RMC01DoubleWithWeightHitsCollection * fGammaCurrentCollection
Definition: RMC01SD.hh:82
virtual void Clear()
Definition: RMC01SD.cc:149
G4double GetKineticEnergy() const
double G4double
Definition: G4Types.hh:76
G4Track * GetTrack() const
virtual void EndOfEvent(G4HCofThisEvent *HCE)
Definition: RMC01SD.cc:141