Loading...
Searching...
No Matches
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//
26/// \file biasing/ReverseMC01/src/RMC01SD.cc
27/// \brief Implementation of the RMC01SD class
28//
29//
30//////////////////////////////////////////////////////////////
31// Class Name: RMC01SD
32// Author: L. Desorgher
33// Organisation: SpaceIT GmbH
34// Contract: ESA contract 21435/08/NL/AT
35// Customer: ESA/ESTEC
36//////////////////////////////////////////////////////////////
37
38//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
39//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
40
41#include "RMC01SD.hh"
42#include "G4Step.hh"
43#include "G4HCofThisEvent.hh"
44#include "G4Track.hh"
45#include "G4SDManager.hh"
46#include "G4ios.hh"
47#include "G4ParticleDefinition.hh"
48#include "G4VProcess.hh"
49#include "G4LogicalVolumeStore.hh"
50#include "G4LogicalVolume.hh"
51#include "G4PhysicalVolumeStore.hh"
52#include "G4VPhysicalVolume.hh"
53
54//#include "G4AdjointAnalysisManager.hh"
55#include "G4THitsCollection.hh"
56#include "G4RunManager.hh"
57#include "G4Electron.hh"
58#include "G4Gamma.hh"
59#include "G4Proton.hh"
60
61class G4Step;
62
63//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
64
67 fTotalEventEdep(0.),fEventEdepCollection(0),
68 fProtonCurrentCollection(0),fGammaCurrentCollection(0),
69 fElectronCurrentCollection(0)
70{
71 collectionName.insert("edep");
72 collectionName.insert("current_electron");
73 collectionName.insert("current_proton");
74 collectionName.insert("current_gamma");
75}
76
77//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
78
82
83//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
84
86{
88 static G4int HCID = -1;
89
91 (SensitiveDetectorName,collectionName[0]);
92 HCID = GetCollectionID(0);
93 HCE->AddHitsCollection(HCID,fEventEdepCollection);
94
96 (SensitiveDetectorName,collectionName[1]);
97 HCID = GetCollectionID(1);
98 HCE->AddHitsCollection(HCID,fElectronCurrentCollection);
99
101 (SensitiveDetectorName,collectionName[2]);
102 HCID = GetCollectionID(2);
103 HCE->AddHitsCollection(HCID,fProtonCurrentCollection);
104
106 (SensitiveDetectorName,collectionName[3]);
107 HCID = GetCollectionID(3);
108 HCE->AddHitsCollection(HCID,fGammaCurrentCollection);
109}
110
111//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
112
114{
115 G4double weight =aStep->GetTrack()->GetWeight();
116 G4double edep= aStep->GetTotalEnergyDeposit();
117 if (edep >0) fEventEdepCollection->insert(
118 new RMC01DoubleWithWeightHit(edep,weight));
119
120 G4StepPoint* preStepPoint =aStep->GetPreStepPoint();
121
122 if (preStepPoint->GetStepStatus() == fGeomBoundary ){
123 // Entering the sensitive volume
124 weight=preStepPoint->GetWeight();
125 G4double eKin = preStepPoint->GetKineticEnergy();
126 G4ParticleDefinition* thePartDef = aStep->GetTrack()->GetDefinition();
127 if (thePartDef == G4Electron::Electron()) fElectronCurrentCollection->
128 insert(new RMC01DoubleWithWeightHit(eKin,weight));
129 else if (thePartDef == G4Gamma::Gamma()) fGammaCurrentCollection->
130 insert(new RMC01DoubleWithWeightHit(eKin,weight));
131 else if (thePartDef == G4Proton::Proton()) fProtonCurrentCollection->
132 insert(new RMC01DoubleWithWeightHit(eKin,weight));
133 }
134 return true;
135}
136
137//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
138
144
145//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
146
148{;
149}
150
151//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
152
154{;
155}
156
157//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
158
160{;
161}
162
163//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
164
Definition of the RMC01SD class.
virtual G4bool ProcessHits(G4Step *aStep, G4TouchableHistory *ROhist)
Definition RMC01SD.cc:113
virtual void DrawAll()
Definition RMC01SD.cc:153
virtual void Clear()
Definition RMC01SD.cc:147
G4double fTotalEventEdep
Definition RMC01SD.hh:78
RMC01DoubleWithWeightHitsCollection * fProtonCurrentCollection
Definition RMC01SD.hh:80
RMC01SD(G4String name)
Definition RMC01SD.cc:65
RMC01DoubleWithWeightHitsCollection * fElectronCurrentCollection
Definition RMC01SD.hh:82
virtual ~RMC01SD()
Definition RMC01SD.cc:79
virtual void EndOfEvent(G4HCofThisEvent *HCE)
Definition RMC01SD.cc:139
virtual void Initialize(G4HCofThisEvent *HCE)
Definition RMC01SD.cc:85
RMC01DoubleWithWeightHitsCollection * fEventEdepCollection
Definition RMC01SD.hh:79
RMC01DoubleWithWeightHitsCollection * fGammaCurrentCollection
Definition RMC01SD.hh:81
virtual void PrintAll()
Definition RMC01SD.cc:159

Applications | User Support | Publications | Collaboration