Geant4
10.00.p01
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
GammaRayTelCalorimeterSD.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: GammaRayTelCalorimeterSD.cc 66508 2012-12-19 10:16:45Z gcosmo $
28
// ------------------------------------------------------------
29
// GEANT 4 class implementation file
30
// CERN Geneva Switzerland
31
//
32
//
33
// ------------ GammaRayTelCalorimeterSD ------
34
// by R.Giannitrapani, F.Longo & G.Santin (13 nov 2000)
35
//
36
// ************************************************************
37
#include "
G4RunManager.hh
"
38
#include "
GammaRayTelCalorimeterSD.hh
"
39
#include "
GammaRayTelCalorimeterHit.hh
"
40
#include "
GammaRayTelDetectorConstruction.hh
"
41
42
#include "
G4SystemOfUnits.hh
"
43
#include "
G4VPhysicalVolume.hh
"
44
#include "
G4Step.hh
"
45
#include "
G4VTouchable.hh
"
46
#include "
G4TouchableHistory.hh
"
47
#include "
G4SDManager.hh
"
48
#include "
G4ios.hh
"
49
50
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
51
52
GammaRayTelCalorimeterSD::GammaRayTelCalorimeterSD
(
G4String
name
):
G4VSensitiveDetector
(name)
53
{
54
G4RunManager
* runManager =
G4RunManager::GetRunManager
();
55
Detector
=
56
(
GammaRayTelDetectorConstruction
*)(runManager->
GetUserDetectorConstruction
());
57
58
NbOfCALBars
=
Detector
->
GetNbOfCALBars
();
59
NbOfCALLayers
=
Detector
->
GetNbOfCALLayers
();
60
61
//G4cout << NbOfCALBars << " bars " << G4endl;
62
//G4cout << NbOfCALLayers << " layers " << G4endl;
63
64
NbOfCALChannels
=
NbOfCALBars
*
NbOfCALLayers
;
65
66
ChitXID
=
new
G4int
[
NbOfCALChannels
];
67
ChitYID
=
new
G4int
[
NbOfCALChannels
];
68
collectionName
.
insert
(
"CalorimeterCollection"
);
69
}
70
71
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
72
73
GammaRayTelCalorimeterSD::~GammaRayTelCalorimeterSD
()
74
{
75
delete
[]
ChitXID
;
76
delete
[]
ChitYID
;
77
}
78
79
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
80
81
void
GammaRayTelCalorimeterSD::Initialize
(
G4HCofThisEvent
*)
82
{
83
CalorimeterCollection
=
new
GammaRayTelCalorimeterHitsCollection
84
(
SensitiveDetectorName
,
collectionName
[0]);
85
for
(
G4int
i=0;i<
NbOfCALChannels
;i++)
86
{
87
ChitXID
[i] = -1;
88
ChitYID
[i] = -1;
89
};
90
}
91
92
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
93
94
G4bool
GammaRayTelCalorimeterSD::ProcessHits
(
G4Step
* aStep,
G4TouchableHistory
*)
95
{
96
97
G4double
edep = aStep->
GetTotalEnergyDeposit
();
98
if
((edep/
keV
== 0.))
return
false
;
99
100
// This TouchableHistory is used to obtain the physical volume
101
// of the hit
102
G4TouchableHistory
* theTouchable
103
= (
G4TouchableHistory
*)(aStep->
GetPreStepPoint
()->
GetTouchable
());
104
105
G4VPhysicalVolume
* cal_bar = theTouchable->
GetVolume
();
106
G4VPhysicalVolume
* cal_plane = theTouchable->
GetVolume
(1);
107
108
G4int
CALBarNumber=cal_bar->
GetCopyNo
();
109
G4String
CALBarName = cal_bar->
GetName
();
110
111
G4int
PlaneNumber = 0;
112
PlaneNumber=cal_plane->
GetCopyNo
();
113
G4String
PlaneName = cal_plane->
GetName
();
114
115
116
G4int
NChannel = 0;
117
118
NChannel = PlaneNumber *
NbOfCALBars
+ CALBarNumber;
119
120
if
(PlaneName ==
"CALLayerX"
)
121
122
// The hit is on an X CsI plane
123
124
{
125
// This is a new hit
126
if
(
ChitXID
[NChannel]==-1)
127
{
128
GammaRayTelCalorimeterHit
* CalorimeterHit =
new
GammaRayTelCalorimeterHit
;
129
CalorimeterHit->
SetCALType
(1);
130
CalorimeterHit->
AddEnergy
(edep);
131
CalorimeterHit->
SetPos
(aStep->
GetPreStepPoint
()->
GetPosition
());
132
CalorimeterHit->
SetCALPlaneNumber
(PlaneNumber);
133
CalorimeterHit->
SetCALBarNumber
(CALBarNumber);
134
ChitXID
[NChannel] =
135
CalorimeterCollection
->
insert
(CalorimeterHit) -1;
136
}
137
else
// This is not new
138
{
139
(*CalorimeterCollection)
140
[
ChitXID
[NChannel]]->AddEnergy(edep);
141
}
142
}
143
144
if
(PlaneName ==
"CALLayerY"
)
145
// The hit is on an Y CsI plane
146
{
147
// This is a new hit
148
if
(
ChitYID
[NChannel]==-1)
149
{
150
GammaRayTelCalorimeterHit
* CalorimeterHit
151
=
new
GammaRayTelCalorimeterHit
;
152
CalorimeterHit->
SetCALType
(0);
153
CalorimeterHit->
AddEnergy
(edep);
154
CalorimeterHit->
SetPos
(aStep->
GetPreStepPoint
()->
GetPosition
());
155
CalorimeterHit->
SetCALPlaneNumber
(PlaneNumber);
156
CalorimeterHit->
SetCALBarNumber
(CALBarNumber);
157
ChitYID
[NChannel] =
158
CalorimeterCollection
->
insert
(CalorimeterHit)-1;
159
}
160
else
// This is not new
161
{
162
(*CalorimeterCollection)
163
[
ChitYID
[NChannel]]->AddEnergy(edep);
164
}
165
}
166
167
return
true
;
168
}
169
170
171
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
172
void
GammaRayTelCalorimeterSD::EndOfEvent
(
G4HCofThisEvent
* HCE)
173
{
174
static
G4int
HCID = -1;
175
if
(HCID<0)
176
{
177
HCID =
G4SDManager::GetSDMpointer
()->
GetCollectionID
(
collectionName
[0]);
178
}
179
HCE->
AddHitsCollection
(HCID,
CalorimeterCollection
);
180
181
182
for
(
G4int
i=0;i<
NbOfCALChannels
;i++)
183
{
184
ChitXID
[i] = -1;
185
ChitYID
[i] = -1;
186
};
187
}
188
189
190
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
191
192
void
GammaRayTelCalorimeterSD::clear
()
193
{}
194
195
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
196
197
void
GammaRayTelCalorimeterSD::DrawAll
()
198
{}
199
200
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
201
202
void
GammaRayTelCalorimeterSD::PrintAll
()
203
{}
204
205
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
206
207
208
209
210
211
212
213
214
215
216
217
218
219
GammaRayTelCalorimeterHit::SetCALType
void SetCALType(G4int i)
Definition:
GammaRayTelCalorimeterHit.hh:80
G4VSensitiveDetector::SensitiveDetectorName
G4String SensitiveDetectorName
Definition:
G4VSensitiveDetector.hh:105
GammaRayTelCalorimeterSD::Initialize
void Initialize(G4HCofThisEvent *)
Definition:
GammaRayTelCalorimeterSD.cc:81
GammaRayTelCalorimeterSD::~GammaRayTelCalorimeterSD
~GammaRayTelCalorimeterSD()
Definition:
GammaRayTelCalorimeterSD.cc:73
G4TouchableHistory.hh
GammaRayTelCalorimeterHit::AddEnergy
void AddEnergy(G4double de)
Definition:
GammaRayTelCalorimeterHit.hh:77
G4SDManager::GetCollectionID
G4int GetCollectionID(G4String colName)
Definition:
G4SDManager.cc:131
GammaRayTelCalorimeterSD::DrawAll
void DrawAll()
Definition:
GammaRayTelCalorimeterSD.cc:197
GammaRayTelCalorimeterHit::SetCALPlaneNumber
void SetCALPlaneNumber(G4int i)
Definition:
GammaRayTelCalorimeterHit.hh:79
G4RunManager.hh
G4TouchableHistory::GetVolume
G4VPhysicalVolume * GetVolume(G4int depth=0) const
GammaRayTelCalorimeterSD::clear
void clear()
Definition:
GammaRayTelCalorimeterSD.cc:192
G4VPhysicalVolume
Definition:
G4VPhysicalVolume.hh:80
GammaRayTelCalorimeterSD::NbOfCALLayers
G4int NbOfCALLayers
Definition:
GammaRayTelCalorimeterSD.hh:73
G4RunManager::GetUserDetectorConstruction
const G4VUserDetectorConstruction * GetUserDetectorConstruction() const
Definition:
G4RunManager.hh:346
name
G4String name
Definition:
TRTMaterials.hh:40
G4VSensitiveDetector
Definition:
G4VSensitiveDetector.hh:50
G4Step.hh
GammaRayTelDetectorConstruction
Definition:
GammaRayTelDetectorConstruction.hh:58
GammaRayTelCalorimeterSD::ProcessHits
G4bool ProcessHits(G4Step *astep, G4TouchableHistory *ROHist)
Definition:
GammaRayTelCalorimeterSD.cc:94
GammaRayTelCalorimeterSD::ChitYID
G4int * ChitYID
Definition:
GammaRayTelCalorimeterSD.hh:71
G4THitsCollection::insert
G4int insert(T *aHit)
Definition:
G4THitsCollection.hh:105
G4StepPoint::GetTouchable
const G4VTouchable * GetTouchable() const
GammaRayTelCalorimeterSD::Detector
GammaRayTelDetectorConstruction * Detector
Definition:
GammaRayTelCalorimeterSD.hh:68
G4int
int G4int
Definition:
G4Types.hh:78
GammaRayTelCalorimeterHit::SetCALBarNumber
void SetCALBarNumber(G4int i)
Definition:
GammaRayTelCalorimeterHit.hh:78
GammaRayTelCalorimeterSD::PrintAll
void PrintAll()
Definition:
GammaRayTelCalorimeterSD.cc:202
GammaRayTelCalorimeterSD::GammaRayTelCalorimeterSD
GammaRayTelCalorimeterSD(G4String)
Definition:
GammaRayTelCalorimeterSD.cc:52
GammaRayTelCalorimeterHit.hh
GammaRayTelDetectorConstruction.hh
GammaRayTelCalorimeterSD::EndOfEvent
void EndOfEvent(G4HCofThisEvent *)
Definition:
GammaRayTelCalorimeterSD.cc:172
G4Step::GetPreStepPoint
G4StepPoint * GetPreStepPoint() const
GammaRayTelCalorimeterHit::SetPos
void SetPos(G4ThreeVector xyz)
Definition:
GammaRayTelCalorimeterHit.hh:81
G4CollectionNameVector::insert
void insert(G4String str)
Definition:
G4CollectionNameVector.hh:42
G4RunManager
Definition:
G4RunManager.hh:138
G4VPhysicalVolume::GetName
const G4String & GetName() const
G4SDManager.hh
G4StepPoint::GetPosition
const G4ThreeVector & GetPosition() const
G4bool
bool G4bool
Definition:
G4Types.hh:79
GammaRayTelCalorimeterSD.hh
G4Step
Definition:
G4Step.hh:76
G4Step::GetTotalEnergyDeposit
G4double GetTotalEnergyDeposit() const
G4HCofThisEvent::AddHitsCollection
void AddHitsCollection(G4int HCID, G4VHitsCollection *aHC)
Definition:
G4HCofThisEvent.cc:57
GammaRayTelCalorimeterHitsCollection
G4THitsCollection< GammaRayTelCalorimeterHit > GammaRayTelCalorimeterHitsCollection
Definition:
GammaRayTelCalorimeterHit.hh:93
GammaRayTelDetectorConstruction::GetNbOfCALBars
G4int GetNbOfCALBars()
Definition:
GammaRayTelDetectorConstruction.hh:127
G4RunManager::GetRunManager
static G4RunManager * GetRunManager()
Definition:
G4RunManager.cc:74
GammaRayTelCalorimeterHit
Definition:
GammaRayTelCalorimeterHit.hh:50
G4TouchableHistory
Definition:
G4TouchableHistory.hh:53
G4SDManager::GetSDMpointer
static G4SDManager * GetSDMpointer()
Definition:
G4SDManager.cc:40
GammaRayTelCalorimeterSD::NbOfCALChannels
G4int NbOfCALChannels
Definition:
GammaRayTelCalorimeterSD.hh:75
G4ios.hh
G4VPhysicalVolume::GetCopyNo
virtual G4int GetCopyNo() const =0
GammaRayTelCalorimeterSD::CalorimeterCollection
GammaRayTelCalorimeterHitsCollection * CalorimeterCollection
Definition:
GammaRayTelCalorimeterSD.hh:67
G4HCofThisEvent
Definition:
G4HCofThisEvent.hh:64
G4VTouchable.hh
G4VSensitiveDetector::collectionName
G4CollectionNameVector collectionName
Definition:
G4VSensitiveDetector.hh:99
keV
static const double keV
Definition:
G4SIunits.hh:195
GammaRayTelDetectorConstruction::GetNbOfCALLayers
G4int GetNbOfCALLayers()
Definition:
GammaRayTelDetectorConstruction.hh:126
G4VPhysicalVolume.hh
G4double
double G4double
Definition:
G4Types.hh:76
G4SystemOfUnits.hh
GammaRayTelCalorimeterSD::NbOfCALBars
G4int NbOfCALBars
Definition:
GammaRayTelCalorimeterSD.hh:74
GammaRayTelCalorimeterSD::ChitXID
G4int * ChitXID
Definition:
GammaRayTelCalorimeterSD.hh:70
G4String
Definition:
G4String.hh:45
geant4.10.00.p01
examples
advanced
gammaray_telescope
src
GammaRayTelCalorimeterSD.cc
Generated on Thu Dec 31 2015 17:38:28 for Geant4 by
1.8.8