Geant4
11.4.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4VReadOutGeometry.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
//
28
29
#include "
G4VReadOutGeometry.hh
"
30
31
#include "
G4Navigator.hh
"
32
33
G4VReadOutGeometry::G4VReadOutGeometry
()
34
:
ROworld
(nullptr),
fincludeList
(nullptr),
fexcludeList
(nullptr),
touchableHistory
(nullptr)
35
{
36
name
=
"unknown"
;
37
ROnavigator
=
new
G4Navigator
();
38
G4ExceptionDescription
ed;
39
ed <<
"The concept and the functionality of Readout Geometry has been merged\n"
40
<<
"into Parallel World. This G4VReadOutGeometry is kept for the sake of\n"
41
<<
"not breaking the commonly-used interface in the sensitive detector "
42
"class.\n"
43
<<
"But this functionality of G4VReadOutGeometry class is no longer "
44
"tested\n"
45
<<
"and thus may not be working well. We strongly recommend our customers "
46
"to\n"
47
<<
"migrate to Parallel World scheme."
;
48
G4Exception
(
"G4VReadOutGeometry"
,
"DIGIHIT1001"
,
JustWarning
, ed);
49
}
50
51
G4VReadOutGeometry::G4VReadOutGeometry
(
const
G4VReadOutGeometry
& right)
52
{
53
fincludeList
=
nullptr
;
54
fexcludeList
=
nullptr
;
55
name
= right.
name
;
56
ROworld
= right.
ROworld
;
57
touchableHistory
=
nullptr
;
58
ROnavigator
=
new
G4Navigator
();
59
// COPY CONSTRUCTOR NOT STRAIGHT FORWARD: need to copy the touchabelHistory
60
// VALUE, same for navigator and same for the World+Geom hierachy
61
}
62
63
G4VReadOutGeometry::G4VReadOutGeometry
(
const
G4String
& n)
64
:
ROworld
(nullptr),
65
fincludeList
(nullptr),
66
fexcludeList
(nullptr),
67
name
(n),
68
touchableHistory
(nullptr)
69
{
70
ROnavigator
=
new
G4Navigator
();
71
G4ExceptionDescription
ed;
72
ed <<
"The concept and the functionality of Readout Geometry has been merged\n"
73
<<
"into Parallel World. This G4VReadOutGeometry is kept for the sake of\n"
74
<<
"not breaking the commonly-used interface in the sensitive detector "
75
"class.\n"
76
<<
"But this functionality of G4VReadOutGeometry class is no longer "
77
"tested\n"
78
<<
"and thus may not be working well. We strongly recommend our customers "
79
"to\n"
80
<<
"migrate to Parallel World scheme."
;
81
G4Exception
(
"G4VReadOutGeometry"
,
"DIGIHIT1001"
,
JustWarning
, ed);
82
}
83
84
G4VReadOutGeometry::~G4VReadOutGeometry
()
85
{
86
// if(ROworld) delete ROworld; //should we do ? will it delete the goem tree
87
// also ?
88
delete
fincludeList
;
89
delete
fexcludeList
;
90
delete
touchableHistory
;
91
delete
ROnavigator
;
92
}
93
94
G4VReadOutGeometry
&
G4VReadOutGeometry::operator=
(
const
G4VReadOutGeometry
& right)
95
{
96
if
(
this
== &right)
return
*
this
;
97
delete
fincludeList
;
98
fincludeList
=
nullptr
;
99
delete
fexcludeList
;
100
fexcludeList
=
nullptr
;
101
name
= right.
name
;
102
ROworld
= right.
ROworld
;
103
delete
touchableHistory
;
104
touchableHistory
=
nullptr
;
105
delete
ROnavigator
;
106
ROnavigator
=
new
G4Navigator
();
107
return
*
this
;
108
}
109
110
G4bool
G4VReadOutGeometry::operator==
(
const
G4VReadOutGeometry
& right)
const
111
{
112
return
(
this
== (
G4VReadOutGeometry
*)&right);
113
}
114
115
G4bool
G4VReadOutGeometry::operator!=
(
const
G4VReadOutGeometry
& right)
const
116
{
117
return
(
this
!= (
G4VReadOutGeometry
*)&right);
118
}
119
120
void
G4VReadOutGeometry::BuildROGeometry
()
121
{
122
ROworld
=
Build
();
123
ROnavigator
->SetWorldVolume(
ROworld
);
124
}
125
126
G4bool
G4VReadOutGeometry::CheckROVolume
(
G4Step
* currentStep,
G4TouchableHistory
*& ROhist)
127
{
128
ROhist =
nullptr
;
129
G4bool
incFlg =
true
;
130
auto
PV = currentStep->
GetPreStepPoint
()->
GetPhysicalVolume
();
131
if
(((
fexcludeList
) !=
nullptr
) && (
fexcludeList
->CheckPV(PV))) {
132
incFlg =
false
;
133
}
134
else
if
(((
fincludeList
) !=
nullptr
) && (
fincludeList
->CheckPV(PV))) {
135
incFlg =
true
;
136
}
137
else
if
(((
fexcludeList
) !=
nullptr
) && (
fexcludeList
->CheckLV(PV->GetLogicalVolume()))) {
138
incFlg =
false
;
139
}
140
else
if
(((
fincludeList
) !=
nullptr
) && (
fincludeList
->CheckLV(PV->GetLogicalVolume()))) {
141
incFlg =
true
;
142
}
143
if
(! incFlg)
return
false
;
144
145
if
(
ROworld
!=
nullptr
) {
146
incFlg =
FindROTouchable
(currentStep);
147
}
148
if
(incFlg) {
149
ROhist =
touchableHistory
;
150
}
151
return
incFlg;
152
}
153
154
G4bool
G4VReadOutGeometry::FindROTouchable
(
G4Step
* currentStep)
155
{
156
// Update G4TouchableHistory object (touchableHistory)
157
// using the parallel readout world (ROworld)
158
// Return false in case the current Step is outside of the
159
// sensitive volume of the readout world.
160
161
// At first invokation, creates the touchable history. Note
162
// that default value (false) of Locate method is used.
163
// ---------> But the default Value is TRUE <-------------------- J.A.
164
if
(
touchableHistory
==
nullptr
) {
165
touchableHistory
=
new
G4TouchableHistory
();
166
ROnavigator
->LocateGlobalPointAndUpdateTouchable(currentStep->
GetPreStepPoint
()->
GetPosition
(),
167
currentStep->
GetPreStepPoint
()->
GetMomentumDirection
(),
touchableHistory
);
168
}
169
else
{
170
ROnavigator
->LocateGlobalPointAndUpdateTouchable(currentStep->
GetPreStepPoint
()->
GetPosition
(),
171
currentStep->
GetPreStepPoint
()->
GetMomentumDirection
(),
touchableHistory
,
true
);
172
}
173
// Can the above be improved by the use of an isotropic safety
174
// in order to avoid LocateGlobalPointAndUpdateTouchable
175
// at each Step ?
176
// Should require that an RO geometry is notified at the
177
// starting of a track to avoid possible confusion looking
178
// at the safety value only.
179
180
// checks if volume is sensitive:
181
auto
currentVolume =
touchableHistory
->GetVolume();
182
// checks first if a physical volume exists here:
183
if
(currentVolume !=
nullptr
) {
184
return
currentVolume->GetLogicalVolume()->GetSensitiveDetector() !=
nullptr
;
185
}
186
// no sensitive volume found: returns false
187
return
false
;
188
}
JustWarning
@ JustWarning
Definition
G4ExceptionSeverity.hh:71
G4Exception
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition
G4Exception.cc:59
G4ExceptionDescription
std::ostringstream G4ExceptionDescription
Definition
G4Exception.hh:40
G4Navigator.hh
G4bool
bool G4bool
Definition
G4Types.hh:86
G4VReadOutGeometry.hh
G4Navigator
G4Navigator is a class for use by the tracking management, able to obtain/calculate dynamic tracking ...
Definition
G4Navigator.hh:76
G4StepPoint::GetPosition
const G4ThreeVector & GetPosition() const
G4StepPoint::GetMomentumDirection
const G4ThreeVector & GetMomentumDirection() const
G4StepPoint::GetPhysicalVolume
G4VPhysicalVolume * GetPhysicalVolume() const
G4Step
Definition
G4Step.hh:61
G4Step::GetPreStepPoint
G4StepPoint * GetPreStepPoint() const
G4String
Definition
G4String.hh:62
G4TouchableHistory
G4TouchableHistory is an object representing a touchable detector element, and its history in the geo...
Definition
G4TouchableHistory.hh:107
G4VReadOutGeometry::ROworld
G4VPhysicalVolume * ROworld
Definition
G4VReadOutGeometry.hh:73
G4VReadOutGeometry::fincludeList
G4SensitiveVolumeList * fincludeList
Definition
G4VReadOutGeometry.hh:74
G4VReadOutGeometry::G4VReadOutGeometry
G4VReadOutGeometry()
Definition
G4VReadOutGeometry.cc:33
G4VReadOutGeometry::~G4VReadOutGeometry
virtual ~G4VReadOutGeometry()
Definition
G4VReadOutGeometry.cc:84
G4VReadOutGeometry::ROnavigator
G4Navigator * ROnavigator
Definition
G4VReadOutGeometry.hh:78
G4VReadOutGeometry::BuildROGeometry
void BuildROGeometry()
Definition
G4VReadOutGeometry.cc:120
G4VReadOutGeometry::operator==
G4bool operator==(const G4VReadOutGeometry &right) const
Definition
G4VReadOutGeometry.cc:110
G4VReadOutGeometry::name
G4String name
Definition
G4VReadOutGeometry.hh:76
G4VReadOutGeometry::CheckROVolume
virtual G4bool CheckROVolume(G4Step *, G4TouchableHistory *&)
Definition
G4VReadOutGeometry.cc:126
G4VReadOutGeometry::operator!=
G4bool operator!=(const G4VReadOutGeometry &right) const
Definition
G4VReadOutGeometry.cc:115
G4VReadOutGeometry::operator=
G4VReadOutGeometry & operator=(const G4VReadOutGeometry &right)
Definition
G4VReadOutGeometry.cc:94
G4VReadOutGeometry::FindROTouchable
virtual G4bool FindROTouchable(G4Step *)
Definition
G4VReadOutGeometry.cc:154
G4VReadOutGeometry::touchableHistory
G4TouchableHistory * touchableHistory
Definition
G4VReadOutGeometry.hh:79
G4VReadOutGeometry::Build
virtual G4VPhysicalVolume * Build()=0
G4VReadOutGeometry::fexcludeList
G4SensitiveVolumeList * fexcludeList
Definition
G4VReadOutGeometry.hh:75
geant4-v11.4.0
source
digits_hits
detector
src
G4VReadOutGeometry.cc
Generated by
1.16.1