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