Geant4
10.03.p03
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
G4MultiSensitiveDetector.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
// G4MultiSensitiveDetector
27
28
#include "
G4MultiSensitiveDetector.hh
"
29
#include "
G4SDManager.hh
"
30
#include <sstream>
31
32
//#define MSDDEBUG
33
#ifdef MSDDEBUG
34
#define DBG( msg ) G4cout<<msg<<G4endl
35
#else
36
#define DBG( msg )
37
#endif
38
#define VDBG( vl , msg ) if ( vl<=verboseLevel ) G4cout<<msg<<G4endl
39
40
G4MultiSensitiveDetector::G4MultiSensitiveDetector
(
G4String
name
)
41
:
G4VSensitiveDetector
(name)
42
{
43
#ifdef MSDDEBUG
44
verboseLevel
= 3;
45
#endif
46
VDBG
(1,
"Creating G4MultiSenstiveDetector with name: "
<<name);
47
}
48
49
G4MultiSensitiveDetector::~G4MultiSensitiveDetector
()
50
{
51
VDBG
(2,
GetName
()<<
" : Destructing G4MultiSensitiveDetector"
);
52
ClearSDs
();
53
}
54
55
G4MultiSensitiveDetector::G4MultiSensitiveDetector
(
const
G4MultiSensitiveDetector
& rhs)
56
:
G4VSensitiveDetector
(rhs) ,
57
fSensitiveDetectors(rhs.fSensitiveDetectors)
58
{
59
VDBG
(3,
GetName
()<<
" : Copy constructor called."
);
60
}
61
62
G4MultiSensitiveDetector
&
63
G4MultiSensitiveDetector::operator=
(
const
G4MultiSensitiveDetector
& rhs)
64
{
65
if
(
this
!= &rhs ) {
66
//G4VSensitiveDetector::operator=(static_cast<const G4VSensitiveDetector&>(rhs));
67
G4VSensitiveDetector::operator=
(static_cast<const G4VSensitiveDetector&>(rhs));
68
fSensitiveDetectors = rhs.fSensitiveDetectors;
69
}
70
return
*
this
;
71
}
72
73
void
74
G4MultiSensitiveDetector::Initialize
(
G4HCofThisEvent
* )
75
{
76
//SDManager is resposnsible for calling this since the granular SDs
77
// are also registered
78
//for ( auto sd : fSensitiveDetectors ) sd->Initialize(hcte);
79
}
80
81
void
82
G4MultiSensitiveDetector::EndOfEvent
(
G4HCofThisEvent
* )
83
{
84
//SDManager is resposnsible for calling this since the granular SDs
85
// are also registered
86
//for ( auto sd : fSensitiveDetectors ) sd->EndOfEvent(hcte);
87
}
88
89
void
90
G4MultiSensitiveDetector::clear
()
91
{
92
for
(
auto
sd : fSensitiveDetectors ) sd->clear();
93
}
94
95
void
96
G4MultiSensitiveDetector::DrawAll
()
97
{
98
for
(
auto
sd : fSensitiveDetectors ) sd->DrawAll();
99
}
100
101
void
102
G4MultiSensitiveDetector::PrintAll
()
103
{
104
for
(
auto
sd : fSensitiveDetectors ) sd->PrintAll();
105
}
106
107
G4bool
108
G4MultiSensitiveDetector::ProcessHits
(
G4Step
*aStep,
G4TouchableHistory
*)
109
{
110
VDBG
(2,
GetName
()<<
" : Called processHits: "
<<aStep<<
" with Edep: "
<<aStep->
GetTotalEnergyDeposit
());
111
G4bool
result
=
true
;
112
for
(
auto
sd : fSensitiveDetectors )
113
result &= sd->Hit(aStep);
114
return
result
;
115
}
116
117
G4int
G4MultiSensitiveDetector::GetCollectionID
(
G4int
)
118
{
119
G4ExceptionDescription
msg;
120
msg <<
GetName
()<<
" : This method cannot be called for an instance of type G4MultiSensitiveDetector."
121
<<
" First retrieve a contained G4VSensitiveDetector with. i.e. GetSD and then "
122
<<
" call this method."
;
123
G4Exception
(
"G4MultiSensitiveDetector::GetCollectionID"
,
"Det0011"
,
FatalException
,msg);
124
return
-1;
125
}
126
127
//This method requires all contained SD to be clonable
128
G4VSensitiveDetector
*
G4MultiSensitiveDetector::Clone
()
const
129
{
130
VDBG
(2,
GetName
()<<
"Cloning an instance of G4MultiSensitiveDetector"
);
131
G4MultiSensitiveDetector
* newInst =
new
G4MultiSensitiveDetector
(this->
GetName
());
132
for
(
auto
sd : fSensitiveDetectors )
133
newInst->
AddSD
( sd->Clone() );
134
return
newInst;
135
}
result
G4double G4ParticleHPJENDLHEData::G4double result
Definition:
G4ParticleHPJENDLHEData.cc:257
G4MultiSensitiveDetector::PrintAll
virtual void PrintAll()
Definition:
G4MultiSensitiveDetector.cc:102
name
const XML_Char * name
Definition:
expat.h:151
G4MultiSensitiveDetector::GetCollectionID
virtual G4int GetCollectionID(G4int i) final
Definition:
G4MultiSensitiveDetector.cc:117
G4ExceptionDescription
std::ostringstream G4ExceptionDescription
Definition:
globals.hh:76
G4VSensitiveDetector
Definition:
G4VSensitiveDetector.hh:50
G4MultiSensitiveDetector::Clone
virtual G4VSensitiveDetector * Clone() const
Definition:
G4MultiSensitiveDetector.cc:128
G4MultiSensitiveDetector::DrawAll
virtual void DrawAll()
Definition:
G4MultiSensitiveDetector.cc:96
G4MultiSensitiveDetector::Initialize
virtual void Initialize(G4HCofThisEvent *)
Definition:
G4MultiSensitiveDetector.cc:74
G4MultiSensitiveDetector::EndOfEvent
virtual void EndOfEvent(G4HCofThisEvent *)
Definition:
G4MultiSensitiveDetector.cc:82
G4MultiSensitiveDetector::AddSD
void AddSD(G4VSensitiveDetector *sd)
Definition:
G4MultiSensitiveDetector.hh:80
G4int
int G4int
Definition:
G4Types.hh:78
G4VSensitiveDetector::GetName
G4String GetName() const
Definition:
G4VSensitiveDetector.hh:146
G4MultiSensitiveDetector::ProcessHits
virtual G4bool ProcessHits(G4Step *aStep, G4TouchableHistory *ROhist)
Definition:
G4MultiSensitiveDetector.cc:108
G4SDManager.hh
G4bool
bool G4bool
Definition:
G4Types.hh:79
G4VSensitiveDetector::verboseLevel
G4int verboseLevel
Definition:
G4VSensitiveDetector.hh:108
G4MultiSensitiveDetector
Definition:
G4MultiSensitiveDetector.hh:40
G4Step
Definition:
G4Step.hh:76
G4MultiSensitiveDetector::ClearSDs
void ClearSDs()
Definition:
G4MultiSensitiveDetector.hh:79
G4MultiSensitiveDetector::~G4MultiSensitiveDetector
virtual ~G4MultiSensitiveDetector()
Definition:
G4MultiSensitiveDetector.cc:49
G4Step::GetTotalEnergyDeposit
G4double GetTotalEnergyDeposit() const
G4Exception
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition:
G4Exception.cc:41
G4MultiSensitiveDetector::G4MultiSensitiveDetector
G4MultiSensitiveDetector(G4String name)
Definition:
G4MultiSensitiveDetector.cc:40
G4TouchableHistory
Definition:
G4TouchableHistory.hh:53
G4VSensitiveDetector::operator=
G4VSensitiveDetector & operator=(const G4VSensitiveDetector &right)
Definition:
G4VSensitiveDetector.cc:79
G4MultiSensitiveDetector::operator=
G4MultiSensitiveDetector & operator=(const G4MultiSensitiveDetector &rhs)
Definition:
G4MultiSensitiveDetector.cc:63
FatalException
Definition:
G4ExceptionSeverity.hh:60
G4HCofThisEvent
Definition:
G4HCofThisEvent.hh:64
G4MultiSensitiveDetector.hh
VDBG
#define VDBG(vl, msg)
Definition:
G4MultiSensitiveDetector.cc:38
G4MultiSensitiveDetector::clear
virtual void clear()
Definition:
G4MultiSensitiveDetector.cc:90
G4String
Definition:
G4String.hh:45
source
geant4.10.03.p03
source
digits_hits
detector
src
G4MultiSensitiveDetector.cc
Generated on Tue Nov 28 2017 21:43:53 for Geant4 by
1.8.5