Geant4 11.2.2
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
34 : ROworld(nullptr), fincludeList(nullptr), fexcludeList(nullptr), touchableHistory(nullptr)
35{
36 name = "unknown";
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
52{
53 fincludeList = nullptr;
54 fexcludeList = nullptr;
55 name = right.name;
56 ROworld = right.ROworld;
57 touchableHistory = nullptr;
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
64 : ROworld(nullptr),
65 fincludeList(nullptr),
66 fexcludeList(nullptr),
67 name(n),
68 touchableHistory(nullptr)
69{
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
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
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
111{
112 return (this == (G4VReadOutGeometry*)&right);
113}
114
116{
117 return (this != (G4VReadOutGeometry*)&right);
118}
119
125
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
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) {
168 }
169 else {
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
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
bool G4bool
Definition G4Types.hh:86
void LocateGlobalPointAndUpdateTouchable(const G4ThreeVector &position, const G4ThreeVector &direction, G4VTouchable *touchableToUpdate, const G4bool RelativeSearch=true)
void SetWorldVolume(G4VPhysicalVolume *pWorld)
G4bool CheckLV(const G4LogicalVolume *lvp) const
G4bool CheckPV(const G4VPhysicalVolume *pvp) const
const G4ThreeVector & GetPosition() const
const G4ThreeVector & GetMomentumDirection() const
G4VPhysicalVolume * GetPhysicalVolume() const
G4StepPoint * GetPreStepPoint() const
virtual G4VPhysicalVolume * GetVolume(G4int depth=0) const
G4VPhysicalVolume * ROworld
G4SensitiveVolumeList * fincludeList
G4bool operator==(const G4VReadOutGeometry &right) const
virtual G4bool CheckROVolume(G4Step *, G4TouchableHistory *&)
G4bool operator!=(const G4VReadOutGeometry &right) const
G4VReadOutGeometry & operator=(const G4VReadOutGeometry &right)
virtual G4bool FindROTouchable(G4Step *)
G4TouchableHistory * touchableHistory
virtual G4VPhysicalVolume * Build()=0
G4SensitiveVolumeList * fexcludeList