Geant4
10.01.p03
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
Par01CalorimeterSD.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: Par01CalorimeterSD.cc 70911 2013-06-07 11:05:37Z mverderi $
28
//
29
30
#include "
Par01CalorimeterSD.hh
"
31
#include "
Par01CalorimeterHit.hh
"
32
33
#include "
G4VPhysicalVolume.hh
"
34
#include "
G4LogicalVolume.hh
"
35
#include "
G4Track.hh
"
36
#include "
G4ParticleDefinition.hh
"
37
#include "
G4SDManager.hh
"
38
#include "
G4ios.hh
"
39
40
Par01CalorimeterSD::Par01CalorimeterSD
(
G4String
name
,
41
G4int
nCells,
42
G4String
colName )
43
:
G4VSensitiveDetector
(name),
44
fNumberOfCells(nCells),
45
fHCID(-1)
46
{
47
G4String
HCname;
48
collectionName
.
insert
(HCname=colName);
49
fCellID
=
new
G4int
[
fNumberOfCells
];
50
}
51
52
Par01CalorimeterSD::~Par01CalorimeterSD
()
53
{
54
delete
[]
fCellID
;
55
}
56
57
void
Par01CalorimeterSD::Initialize
(
G4HCofThisEvent
*)
58
{
59
fCalCollection
=
new
Par01CalorimeterHitsCollection
60
(
SensitiveDetectorName
,
collectionName
[0]);
61
for
(
G4int
j=0;j<
fNumberOfCells
;j++)
62
{
63
fCellID
[j] = -1;
64
}
65
}
66
67
G4bool
Par01CalorimeterSD::ProcessHits
(
G4Step
* aStep,
G4TouchableHistory
*)
68
{
69
G4double
edep = aStep->
GetTotalEnergyDeposit
();
70
if
(edep<=0.)
return
false
;
71
72
G4TouchableHistory
* hist = (
G4TouchableHistory
*)(aStep->
GetPreStepPoint
()->
GetTouchable
());
73
const
G4VPhysicalVolume
* physVol = hist->
GetVolume
();
74
G4int
copyID = hist->
GetReplicaNumber
();
75
76
if
(
fCellID
[copyID]==-1)
77
{
78
Par01CalorimeterHit
* calHit =
79
new
Par01CalorimeterHit
(physVol->
GetLogicalVolume
());
80
calHit->
SetEdep
( edep );
81
G4AffineTransform
aTrans = hist->
GetHistory
()->
GetTopTransform
();
82
aTrans.
Invert
();
83
calHit->
SetPos
(aTrans.
NetTranslation
());
84
calHit->
SetRot
(aTrans.
NetRotation
());
85
G4int
icell =
fCalCollection
->
insert
( calHit );
86
fCellID
[copyID] = icell - 1;
87
if
(
verboseLevel
>0)
88
{
G4cout
<<
" New Calorimeter Hit on CellID "
<< copyID <<
G4endl
; }
89
}
90
else
91
{
92
(*fCalCollection)[
fCellID
[copyID]]->AddEdep( edep );
93
if
(
verboseLevel
>0)
94
{
G4cout
<<
" Energy added to CellID "
<< copyID <<
G4endl
; }
95
}
96
97
return
true
;
98
}
99
100
void
Par01CalorimeterSD::EndOfEvent
(
G4HCofThisEvent
*HCE)
101
{
102
if
(
fHCID
<0)
103
{
fHCID
=
G4SDManager::GetSDMpointer
()->
GetCollectionID
(
collectionName
[0]); }
104
HCE->
AddHitsCollection
(
fHCID
,
fCalCollection
);
105
}
106
107
void
Par01CalorimeterSD::clear
()
108
{
109
}
110
111
void
Par01CalorimeterSD::DrawAll
()
112
{
113
}
114
115
void
Par01CalorimeterSD::PrintAll
()
116
{
117
}
G4VSensitiveDetector::SensitiveDetectorName
G4String SensitiveDetectorName
Definition:
G4VSensitiveDetector.hh:105
G4SDManager::GetCollectionID
G4int GetCollectionID(G4String colName)
Definition:
G4SDManager.cc:131
Par01CalorimeterSD::fHCID
int fHCID
Definition:
Par01CalorimeterSD.hh:57
G4TouchableHistory::GetVolume
G4VPhysicalVolume * GetVolume(G4int depth=0) const
G4Track.hh
Par01CalorimeterHitsCollection
G4THitsCollection< Par01CalorimeterHit > Par01CalorimeterHitsCollection
Definition:
Par01CalorimeterHit.hh:90
G4VPhysicalVolume
Definition:
G4VPhysicalVolume.hh:82
name
G4String name
Definition:
TRTMaterials.hh:40
G4VSensitiveDetector
Definition:
G4VSensitiveDetector.hh:50
Par01CalorimeterHit.hh
Par01CalorimeterHit::SetEdep
void SetEdep(G4double de)
Definition:
Par01CalorimeterHit.hh:71
G4AffineTransform::NetTranslation
G4ThreeVector NetTranslation() const
Par01CalorimeterSD::fCellID
int * fCellID
Definition:
Par01CalorimeterSD.hh:55
Par01CalorimeterHit
Definition:
Par01CalorimeterHit.hh:41
G4THitsCollection::insert
G4int insert(T *aHit)
Definition:
G4THitsCollection.hh:105
G4StepPoint::GetTouchable
const G4VTouchable * GetTouchable() const
G4int
int G4int
Definition:
G4Types.hh:78
Par01CalorimeterSD::~Par01CalorimeterSD
~Par01CalorimeterSD()
Definition:
Par01CalorimeterSD.cc:52
G4AffineTransform
Definition:
G4AffineTransform.hh:69
G4Step::GetPreStepPoint
G4StepPoint * GetPreStepPoint() const
Par01CalorimeterHit::SetPos
void SetPos(G4ThreeVector xyz)
Definition:
Par01CalorimeterHit.hh:77
G4AffineTransform::Invert
G4AffineTransform & Invert()
Par01CalorimeterSD::PrintAll
virtual void PrintAll()
Definition:
Par01CalorimeterSD.cc:115
G4cout
G4GLOB_DLL std::ostream G4cout
Par01CalorimeterSD::DrawAll
virtual void DrawAll()
Definition:
Par01CalorimeterSD.cc:111
G4CollectionNameVector::insert
void insert(G4String str)
Definition:
G4CollectionNameVector.hh:42
G4SDManager.hh
G4bool
bool G4bool
Definition:
G4Types.hh:79
Par01CalorimeterSD::ProcessHits
virtual G4bool ProcessHits(G4Step *aStep, G4TouchableHistory *ROhist)
Definition:
Par01CalorimeterSD.cc:67
G4TouchableHistory::GetReplicaNumber
G4int GetReplicaNumber(G4int depth=0) const
G4VSensitiveDetector::verboseLevel
G4int verboseLevel
Definition:
G4VSensitiveDetector.hh:108
Par01CalorimeterSD::fCalCollection
Par01CalorimeterHitsCollection * fCalCollection
Definition:
Par01CalorimeterSD.hh:53
G4ParticleDefinition.hh
G4Step
Definition:
G4Step.hh:76
Par01CalorimeterSD::fNumberOfCells
int fNumberOfCells
Definition:
Par01CalorimeterSD.hh:56
G4Step::GetTotalEnergyDeposit
G4double GetTotalEnergyDeposit() const
G4HCofThisEvent::AddHitsCollection
void AddHitsCollection(G4int HCID, G4VHitsCollection *aHC)
Definition:
G4HCofThisEvent.cc:57
Par01CalorimeterSD.hh
G4AffineTransform::NetRotation
G4RotationMatrix NetRotation() const
G4LogicalVolume.hh
G4VPhysicalVolume::GetLogicalVolume
G4LogicalVolume * GetLogicalVolume() const
G4TouchableHistory
Definition:
G4TouchableHistory.hh:53
G4SDManager::GetSDMpointer
static G4SDManager * GetSDMpointer()
Definition:
G4SDManager.cc:40
G4ios.hh
G4HCofThisEvent
Definition:
G4HCofThisEvent.hh:64
Par01CalorimeterSD::Initialize
virtual void Initialize(G4HCofThisEvent *HCE)
Definition:
Par01CalorimeterSD.cc:57
G4endl
#define G4endl
Definition:
G4ios.hh:61
G4NavigationHistory::GetTopTransform
const G4AffineTransform & GetTopTransform() const
G4VSensitiveDetector::collectionName
G4CollectionNameVector collectionName
Definition:
G4VSensitiveDetector.hh:99
G4TouchableHistory::GetHistory
const G4NavigationHistory * GetHistory() const
Par01CalorimeterHit::SetRot
void SetRot(G4RotationMatrix rmat)
Definition:
Par01CalorimeterHit.hh:81
G4VPhysicalVolume.hh
G4double
double G4double
Definition:
G4Types.hh:76
Par01CalorimeterSD::EndOfEvent
virtual void EndOfEvent(G4HCofThisEvent *HCE)
Definition:
Par01CalorimeterSD.cc:100
Par01CalorimeterSD::Par01CalorimeterSD
Par01CalorimeterSD(G4String name, G4int nCells, G4String colName)
Definition:
Par01CalorimeterSD.cc:40
Par01CalorimeterSD::clear
virtual void clear()
Definition:
Par01CalorimeterSD.cc:107
G4String
Definition:
G4String.hh:45
geant4.10.01.p03
examples
extended
parameterisations
Par01
src
Par01CalorimeterSD.cc
Generated on Fri Feb 19 2016 15:53:13 for Geant4 by
1.8.8