ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
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.
Or view
the newest version in sPHENIX GitHub for file G4MultiSensitiveDetector.cc
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
}
geant4
tree
geant4-10.6-release
source
digits_hits
detector
src
G4MultiSensitiveDetector.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:12
using
1.8.2 with
ECCE GitHub integration