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
G4MultiFunctionalDetector.cc
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file G4MultiFunctionalDetector.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
//
27
//
28
// G4MultiFunctionalDetector
29
//
30
// 2010-07-23 T.Aso Call PS if the step length or energy deposit is not zero.
31
//
32
//
33
#include "
G4MultiFunctionalDetector.hh
"
34
#include "
G4SDManager.hh
"
35
#include "
G4VPrimitiveScorer.hh
"
36
37
G4MultiFunctionalDetector::G4MultiFunctionalDetector
(
G4String
name
)
38
:
G4VSensitiveDetector
(name)
39
{;}
40
41
G4MultiFunctionalDetector::~G4MultiFunctionalDetector
()
42
{
43
for
(
auto
pr
:
primitives
)
delete
pr
;
44
primitives.clear();
45
}
46
47
G4bool
G4MultiFunctionalDetector::ProcessHits
(
G4Step
* aStep,
G4TouchableHistory
* aTH)
48
{
49
if
(aStep->
GetStepLength
()>0. || aStep->
GetTotalEnergyDeposit
()>0.){
50
for
(
auto
pr
:
primitives
)
51
{
pr
->HitPrimitive(aStep,aTH); }
52
}
53
return
true
;
54
}
55
56
G4bool
G4MultiFunctionalDetector::RegisterPrimitive
(
G4VPrimitiveScorer
* aPS)
57
{
58
for
(
auto
pr
:
primitives
)
59
{
60
if
(
pr
==aPS)
61
{
62
G4ExceptionDescription
ED;
63
ED <<
"Primitive <"
<< aPS->
GetName
() <<
"> is already defined in <"
<<
SensitiveDetectorName
64
<<
">."
<<
G4endl
<<
"Method RegisterPrimitive() is ignored."
<<
G4endl
;
65
G4Exception
(
"G4MultiFunctionalDetector::RegisterPrimitive"
,
"Det0101"
,
66
JustWarning
,ED);
67
return
false
;
68
}
69
}
70
primitives.push_back(aPS);
71
aPS->
SetMultiFunctionalDetector
(
this
);
72
collectionName
.
insert
(aPS->
GetName
());
73
if
(
G4SDManager::GetSDMpointer
()->
FindSensitiveDetector
(
SensitiveDetectorName
,
false
))
74
{
75
// This G4MultiFunctionalDetector has already been registered to G4SDManager.
76
// Make sure this new primitive is registered as well.
77
G4SDManager::GetSDMpointer
()->
AddNewCollection
(
SensitiveDetectorName
,aPS->
GetName
());
78
}
79
return
true
;
80
}
81
82
G4bool
G4MultiFunctionalDetector::RemovePrimitive
(
G4VPrimitiveScorer
* aPS)
83
{
84
auto
pr
= std::find(
primitives
.begin(),
primitives
.end(),aPS);
85
if
(
pr
!=
primitives
.end())
86
{
87
primitives
.erase(
pr
);
88
aPS->
SetMultiFunctionalDetector
(
nullptr
);
89
return
true
;
90
}
91
G4cerr
<<
"Primitive <"
<< aPS->
GetName
() <<
"> is not defined in <"
<<
SensitiveDetectorName
92
<<
">."
<<
G4endl
<<
"Method RemovePrimitive() is ignored."
<<
G4endl
;
93
return
false
;
94
}
95
96
void
G4MultiFunctionalDetector::Initialize
(
G4HCofThisEvent
* HC)
97
{
98
for
(
auto
pr
:
primitives
)
99
{
pr
->Initialize(HC); }
100
}
101
102
void
G4MultiFunctionalDetector::EndOfEvent
(
G4HCofThisEvent
* HC)
103
{
104
for
(
auto
pr
:
primitives
)
105
{
pr
->EndOfEvent(HC); }
106
}
107
108
void
G4MultiFunctionalDetector::clear
()
109
{
110
for
(
auto
pr
:
primitives
)
111
{
pr
->clear(); }
112
}
113
114
void
G4MultiFunctionalDetector::DrawAll
()
115
{
116
for
(
auto
pr
:
primitives
)
117
{
pr
->DrawAll(); }
118
}
119
120
void
G4MultiFunctionalDetector::PrintAll
()
121
{
122
for
(
auto
pr
:
primitives
)
123
{
pr
->PrintAll(); }
124
}
125
geant4
tree
geant4-10.6-release
source
digits_hits
detector
src
G4MultiFunctionalDetector.cc
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:12
using
1.8.2 with
ECCE GitHub integration