Geant4
9.6.p02
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
geant4_9_6_p02
examples
extended
field
field01
src
F01CalorimeterSD.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
//
30
// $Id$
31
//
32
//
33
34
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
35
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
36
37
#include "
F01CalorimeterSD.hh
"
38
39
#include "
F01CalorHit.hh
"
40
#include "
F01DetectorConstruction.hh
"
41
42
#include "
G4VPhysicalVolume.hh
"
43
#include "
G4Step.hh
"
44
#include "
G4VTouchable.hh
"
45
#include "
G4TouchableHistory.hh
"
46
#include "
G4SDManager.hh
"
47
48
#include "
G4ios.hh
"
49
50
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
51
52
F01CalorimeterSD::F01CalorimeterSD
(
G4String
name
,
53
F01DetectorConstruction
* det)
54
:
G4VSensitiveDetector
(name),
55
fCalCollection(0),
56
fDetector(det),
57
fHitID(new
G4int
[500])
58
{
59
collectionName
.
insert
(
"CalCollection"
);
60
}
61
62
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
63
64
F01CalorimeterSD::~F01CalorimeterSD
()
65
{
66
delete
[] fHitID;
67
}
68
69
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
70
71
void
F01CalorimeterSD::Initialize
(
G4HCofThisEvent
*)
72
{
73
fCalCollection =
new
F01CalorHitsCollection
74
(
SensitiveDetectorName
,
collectionName
[0]);
75
for
(
G4int
j=0;j<1; j++) {fHitID[j] = -1;};
76
}
77
78
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
79
80
G4bool
F01CalorimeterSD::ProcessHits
(
G4Step
* step,
G4TouchableHistory
*)
81
{
82
G4double
edep
= step->
GetTotalEnergyDeposit
();
83
G4double
stepl = 0.;
84
85
stepl = step->
GetStepLength
();
86
87
if
((edep == 0.) && (stepl == 0.) )
return
false
;
88
89
G4TouchableHistory
* theTouchable
90
= (
G4TouchableHistory
*)(step->
GetPreStepPoint
()->
GetTouchable
());
91
92
G4VPhysicalVolume
* physVol = theTouchable->
GetVolume
();
93
94
G4int
F01Number = 0 ;
95
if
(fHitID[F01Number]==-1)
96
{
97
F01CalorHit
* calHit =
new
F01CalorHit
();
98
if
(physVol == fDetector->
GetAbsorber
()) calHit->
AddAbs
(edep,stepl);
99
fHitID[F01Number] = fCalCollection->
insert
(calHit) - 1;
100
if
(
verboseLevel
>0)
101
G4cout
<<
" New Calorimeter Hit on F01: "
<< F01Number <<
G4endl
;
102
}
103
else
104
{
105
if
(physVol == fDetector->
GetAbsorber
())
106
(*fCalCollection)[fHitID[F01Number]]->AddAbs(edep,stepl);
107
if
(
verboseLevel
>0)
108
G4cout
<<
" Energy added to F01: "
<< F01Number <<
G4endl
;
109
}
110
return
true
;
111
}
112
113
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
114
115
void
F01CalorimeterSD::EndOfEvent
(
G4HCofThisEvent
* hce)
116
{
117
static
G4int
hcID = -1;
118
if
(hcID<0)
119
{ hcID =
G4SDManager::GetSDMpointer
()->
GetCollectionID
(
collectionName
[0]); }
120
hce->
AddHitsCollection
(hcID,fCalCollection);
121
}
122
123
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
124
125
void
F01CalorimeterSD::clear
()
126
{}
127
128
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
129
130
131
void
F01CalorimeterSD::PrintAll
()
132
{}
133
134
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
Generated on Sat May 25 2013 14:32:25 for Geant4 by
1.8.4