Geant4_10
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
source
examples
advanced
xray_fluorescence
src
XrayFluoHPGeSD.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
//
27
// $Id: XrayFluoHPGeSD.cc
28
// GEANT4 tag $Name: xray_fluo-V04-01-03
29
//
30
// Author: Elena Guardincerri (Elena.Guardincerri@ge.infn.it)
31
//
32
// History:
33
// -----------
34
// 28 Nov 2001 Elena Guardincerri Created
35
// 29 Nov 2002 Energy deposition bug fixed (Alfonso.mantero@ge.infn.it)
36
// -------------------------------------------------------------------
37
38
#include "
XrayFluoHPGeSD.hh
"
39
#include "
XrayFluoSensorHit.hh
"
40
#include "
XrayFluoDetectorConstruction.hh
"
41
#include "
G4VPhysicalVolume.hh
"
42
#include "
G4Step.hh
"
43
#include "
G4VTouchable.hh
"
44
#include "
G4TouchableHistory.hh
"
45
#include "
G4SDManager.hh
"
46
#include "
G4ios.hh
"
47
#include "
G4VProcess.hh
"
48
49
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
50
51
XrayFluoHPGeSD::XrayFluoHPGeSD
(
G4String
name
,
52
XrayFluoDetectorConstruction
* det)
53
:
G4VSensitiveDetector
(name),Detector(det)
54
{
55
collectionName
.
insert
(
"HPGeCollection"
);
56
HitHPGeID =
new
G4int
[500];
57
//G4cout << "XrayFluoHPGeSD created" << G4endl;
58
59
}
60
61
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
62
63
XrayFluoHPGeSD::~XrayFluoHPGeSD
()
64
{
65
66
delete
[] HitHPGeID;
67
68
// delete HPGeCollection;
69
70
G4cout
<<
"XrayFluoHPGeSD deleted"
<<
G4endl
;
71
}
72
73
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
74
75
void
XrayFluoHPGeSD::Initialize
(
G4HCofThisEvent
*HCE)
76
77
//initializes HCE with the hits collection(s) created by this
78
//sensitive detector
79
{
80
if
(HCE){
81
82
HPGeCollection =
new
XrayFluoSensorHitsCollection
83
(
SensitiveDetectorName
,
collectionName
[0]);
84
for
(
G4int
j=0;j<Detector->
GetNbOfPixels
();j++)
85
{HitHPGeID [j]= -1;};
86
}
87
}
88
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
89
90
G4bool
XrayFluoHPGeSD::ProcessHits
(
G4Step
* aStep,
G4TouchableHistory
* ROhist)
91
{
92
93
if
(ROhist){
94
95
G4double
edep
= aStep->
GetTotalEnergyDeposit
();
96
// G4String particleName = aStep->GetTrack()->GetDynamicParticle()->GetDefinition()->GetParticleName();
97
// G4String processName = aStep->GetTrack()->GetCreatorProcess()->GetProcessName();
98
99
// G4double partEnergy = aStep->GetPreStepPoint()->GetKineticEnergy();
100
// G4double secondEnergy = aStep->GetPostStepPoint()->GetKineticEnergy();
101
// G4cout << " la particella che deposita e': " << particleName << " ha una energia di keV "
102
// << partEnergy << " e deposita "<< edep << G4endl;
103
// G4cout << " la particella creata deposita: " << secondEnergy << G4endl;
104
// if (processName){
105
106
107
108
// G4cout << " la particella viene da: " << processName << G4endl;
109
// }
110
111
// else {G4cout << " il deposito proviene da: Rayleugh" << G4endl;}
112
113
if
(edep==0.)
return
false
;
114
115
// G4cout << " edep = " << edep << G4endl;
116
117
G4TouchableHistory
* theTouchable
118
= (
G4TouchableHistory
*)(aStep->
GetPreStepPoint
()->
GetTouchable
());
119
120
G4VPhysicalVolume
* physVol = theTouchable->
GetVolume
();
121
// theTouchable->MoveUpHistory();
122
G4int
PixelNumber = 0;
123
if
(Detector->
GetNbOfPixels
()>1) PixelNumber= physVol->
GetCopyNo
() ;
124
if
( HitHPGeID[PixelNumber]==-1)
125
{
126
XrayFluoSensorHit
* HPGeHit =
new
XrayFluoSensorHit
();
127
HPGeHit->
AddEnergy
(edep);
128
HitHPGeID[PixelNumber] = HPGeCollection->
insert
(HPGeHit) - 1;
129
if
(
verboseLevel
>0){
130
G4cout
<<
" New Hit on pixel: "
<< PixelNumber <<
G4endl
;
131
}
132
}
133
else
134
{
135
(*HPGeCollection)[HitHPGeID[PixelNumber]]->AddEnergy(edep);
136
//G4double ED =(*HPGeCollection)[HitHPGeID[PixelNumber]]->GetEdepTot();
137
if
(
verboseLevel
>0)
138
G4cout
<<
" Energy added to Pixel: "
<< PixelNumber <<
G4endl
;
139
}
140
141
return
true
;
142
}
143
else
{
return
false
;}
144
145
}
146
147
148
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
149
150
void
XrayFluoHPGeSD::EndOfEvent
(
G4HCofThisEvent
* HCE)
151
{
152
static
G4int
HCID = -1;
153
if
(HCID<0)
154
{ HCID =
G4SDManager::GetSDMpointer
()->
GetCollectionID
(
collectionName
[0]); }
155
HCE->
AddHitsCollection
(HCID,HPGeCollection);
156
}
157
158
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
159
160
void
XrayFluoHPGeSD::clear
()
161
{}
162
163
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
164
165
void
XrayFluoHPGeSD::DrawAll
()
166
{}
167
168
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
169
170
void
XrayFluoHPGeSD::PrintAll
()
171
{}
172
173
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
G4VSensitiveDetector::SensitiveDetectorName
G4String SensitiveDetectorName
Definition:
G4VSensitiveDetector.hh:105
XrayFluoSensorHit
Definition:
XrayFluoSensorHit.hh:50
G4TouchableHistory.hh
G4SDManager::GetCollectionID
G4int GetCollectionID(G4String colName)
Definition:
G4SDManager.cc:131
G4TouchableHistory::GetVolume
G4VPhysicalVolume * GetVolume(G4int depth=0) const
G4VPhysicalVolume
Definition:
G4VPhysicalVolume.hh:80
XrayFluoHPGeSD::ProcessHits
G4bool ProcessHits(G4Step *, G4TouchableHistory *)
Definition:
XrayFluoHPGeSD.cc:90
XrayFluoHPGeSD::DrawAll
void DrawAll()
Definition:
XrayFluoHPGeSD.cc:165
G4VSensitiveDetector
Definition:
G4VSensitiveDetector.hh:50
XrayFluoDetectorConstruction::GetNbOfPixels
G4int GetNbOfPixels()
Definition:
XrayFluoDetectorConstruction.hh:124
G4Step.hh
name
const XML_Char * name
Definition:
expat.h:151
XrayFluoSensorHit.hh
G4THitsCollection::insert
G4int insert(T *aHit)
Definition:
G4THitsCollection.hh:105
G4StepPoint::GetTouchable
const G4VTouchable * GetTouchable() const
G4int
int G4int
Definition:
G4Types.hh:78
edep
Double_t edep
Definition:
macro.C:13
XrayFluoSensorHitsCollection
G4THitsCollection< XrayFluoSensorHit > XrayFluoSensorHitsCollection
Definition:
XrayFluoSensorHit.hh:76
XrayFluoHPGeSD::Initialize
void Initialize(G4HCofThisEvent *)
Definition:
XrayFluoHPGeSD.cc:75
XrayFluoHPGeSD::clear
void clear()
Definition:
XrayFluoHPGeSD.cc:160
G4Step::GetPreStepPoint
G4StepPoint * GetPreStepPoint() const
G4cout
G4GLOB_DLL std::ostream G4cout
XrayFluoHPGeSD.hh
G4CollectionNameVector::insert
void insert(G4String str)
Definition:
G4CollectionNameVector.hh:42
G4SDManager.hh
G4bool
bool G4bool
Definition:
G4Types.hh:79
XrayFluoDetectorConstruction.hh
XrayFluoHPGeSD::PrintAll
void PrintAll()
Definition:
XrayFluoHPGeSD.cc:170
G4VSensitiveDetector::verboseLevel
G4int verboseLevel
Definition:
G4VSensitiveDetector.hh:108
G4Step
Definition:
G4Step.hh:76
G4Step::GetTotalEnergyDeposit
G4double GetTotalEnergyDeposit() const
G4HCofThisEvent::AddHitsCollection
void AddHitsCollection(G4int HCID, G4VHitsCollection *aHC)
Definition:
G4HCofThisEvent.cc:57
G4TouchableHistory
Definition:
G4TouchableHistory.hh:53
XrayFluoHPGeSD::XrayFluoHPGeSD
XrayFluoHPGeSD(G4String, XrayFluoDetectorConstruction *)
Definition:
XrayFluoHPGeSD.cc:51
G4VProcess.hh
G4SDManager::GetSDMpointer
static G4SDManager * GetSDMpointer()
Definition:
G4SDManager.cc:40
XrayFluoSensorHit::AddEnergy
void AddEnergy(G4double de)
Definition:
XrayFluoSensorHit.hh:61
G4ios.hh
G4VPhysicalVolume::GetCopyNo
virtual G4int GetCopyNo() const =0
G4HCofThisEvent
Definition:
G4HCofThisEvent.hh:64
G4VTouchable.hh
G4endl
#define G4endl
Definition:
G4ios.hh:61
G4VSensitiveDetector::collectionName
G4CollectionNameVector collectionName
Definition:
G4VSensitiveDetector.hh:99
XrayFluoHPGeSD::EndOfEvent
void EndOfEvent(G4HCofThisEvent *)
Definition:
XrayFluoHPGeSD.cc:150
G4VPhysicalVolume.hh
G4double
double G4double
Definition:
G4Types.hh:76
XrayFluoHPGeSD::~XrayFluoHPGeSD
~XrayFluoHPGeSD()
Definition:
XrayFluoHPGeSD.cc:63
XrayFluoDetectorConstruction
Definition:
XrayFluoDetectorConstruction.hh:70
G4String
Definition:
G4String.hh:45
Generated on Sat Dec 14 2013 14:33:04 for Geant4_10 by
1.8.5